Extension framework changes

This commit is contained in:
PabstMirror 2015-05-17 04:05:43 -05:00
parent 78dec5debc
commit e78c2fd676
4 changed files with 8 additions and 5 deletions

Binary file not shown.

View File

@ -21,5 +21,5 @@ class CfgPatches {
#include "ACE_Settings.hpp" #include "ACE_Settings.hpp"
class ACE_Extensions { class ACE_Extensions {
extensions[] += {"ace_break_line"}; extensions[] += {"ace_break_line", "ace_parse_imagepath"};
}; };

View File

@ -1,9 +1,10 @@
set(ACE_EXTENSION_NAME "ace_parse_imagepath") set(ACE_EXTENSION_NAME "ace_parse_imagepath")
file(GLOB SOURCES *.h *.hpp *.c *.cpp) file(GLOB SOURCES *.h *.hpp *.c *.cpp)
add_library( ${ACE_EXTENSION_NAME} SHARED ${GLOBAL_SOURCES} ${SOURCES}) add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES} ${GLOBAL_SOURCES})
add_dependencies(${ACE_EXTENSION_NAME} ace_common) target_link_libraries(${ACE_EXTENSION_NAME} ace_common)
SET_TARGET_PROPERTIES(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "") set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "")
set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES FOLDER Extensions)
if(CMAKE_COMPILER_IS_GNUCXX) if(CMAKE_COMPILER_IS_GNUCXX)
set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_START_STATIC 1) set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_START_STATIC 1)

View File

@ -11,7 +11,7 @@
* Just the image path or "" if none * Just the image path or "" if none
*/ */
#include "ace_common.h" #include "shared.hpp"
#include <sstream> #include <sstream>
#include <string> #include <string>
@ -41,12 +41,14 @@ std::string getImagePathFromStructuredText(const std::string & input) {
#pragma warning( disable : 4996 ) #pragma warning( disable : 4996 )
void __stdcall RVExtension(char *output, int outputSize, const char *function) { void __stdcall RVExtension(char *output, int outputSize, const char *function) {
ZERO_OUTPUT();
if (!strcmp(function, "version")) { if (!strcmp(function, "version")) {
strncpy(output, ACE_FULL_VERSION_STR, outputSize); strncpy(output, ACE_FULL_VERSION_STR, outputSize);
} else { } else {
strncpy(output, getImagePathFromStructuredText(function).c_str(), outputSize); strncpy(output, getImagePathFromStructuredText(function).c_str(), outputSize);
output[outputSize - 1] = '\0'; output[outputSize - 1] = '\0';
} }
EXTENSION_RETURN();
} }
#pragma warning( pop ) #pragma warning( pop )