diff --git a/.gitignore b/.gitignore index c32f22c..68f8581 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ bld/ [Oo]bj/ [Ll]og/ [Ll]ogs/ +[Oo]ut/ # Visual Studio 2015/2017 cache/options directory .vs/ @@ -406,3 +407,6 @@ FodyWeavers.xsd !Engine/Source/BlizzardCore/Source/System/Debug/ !Engine/Source/BlizzardCore/Source/System/Log/ !ThirdParty/nvapi/x86/ + +# Local Visual Studio CMake settings (absolute paths to re/tools) +CMakeSettings.json diff --git a/Tools/WowClient/CMakeLists.txt b/Tools/WowClient/CMakeLists.txt index d590c44..3025746 100644 --- a/Tools/WowClient/CMakeLists.txt +++ b/Tools/WowClient/CMakeLists.txt @@ -8,6 +8,11 @@ else () set(WOWCLIENT_OUTPUT_NAME WowClient32) endif () +set(WOWCLIENT_OUTPUT_OVERRIDE "" CACHE STRING "WowClient executable name instead of WowClient64/WowClient32 (re/tools/build sets Waystone / WaystoneDev)") +if (WOWCLIENT_OUTPUT_OVERRIDE) + set(WOWCLIENT_OUTPUT_NAME ${WOWCLIENT_OUTPUT_OVERRIDE}) +endif () + set(STANDINS_GENERATED "${CMAKE_CURRENT_BINARY_DIR}/standins_generated.cpp") if (NOT EXISTS "${STANDINS_GENERATED}") file(WRITE "${STANDINS_GENERATED}" "extern \"C\" const char* const g_standinNames[] = { \"\" };\nextern \"C\" const int g_standinCount = 0;\n") @@ -32,6 +37,22 @@ target_include_directories(WowClient target_link_options(WowClient PRIVATE "/INCREMENTAL:NO" "/ENTRY:start") +set(WOWCLIENT_STANDIN_LINKER "" CACHE FILEPATH "Link launcher that turns unresolved symbols into stand-ins (re/tools/standin_link.py); Ninja and Makefile generators only") +if (WOWCLIENT_STANDIN_LINKER) + find_package(Python3 COMPONENTS Interpreter REQUIRED) + if (WOWDECOMP_ARCH_32) + set(WOWCLIENT_STANDIN_ARCH win32) + else () + set(WOWCLIENT_STANDIN_ARCH x64) + endif () + set_property(TARGET WowClient PROPERTY RULE_LAUNCH_LINK "\"${Python3_EXECUTABLE}\" \"${WOWCLIENT_STANDIN_LINKER}\" \"${STANDINS_GENERATED}\" ${WOWCLIENT_STANDIN_ARCH} --") +endif () + +option(WOWCLIENT_STANDIN_CONTINUE "Stand-ins log their first hit and return 0 instead of exiting the client" OFF) +if (WOWCLIENT_STANDIN_CONTINUE) + set_source_files_properties(standin_runtime.cpp PROPERTIES COMPILE_DEFINITIONS WOWCLIENT_STANDIN_CONTINUE_DEFAULT) +endif () + target_link_libraries(WowClient PRIVATE BLPFile diff --git a/Tools/WowClient/standin_runtime.cpp b/Tools/WowClient/standin_runtime.cpp index cd7a5f1..788f794 100644 --- a/Tools/WowClient/standin_runtime.cpp +++ b/Tools/WowClient/standin_runtime.cpp @@ -114,7 +114,11 @@ extern "C" double StandinReport(int index, void* returnAddress) { static int s_continue = -1; if (s_continue < 0) { +#ifdef WOWCLIENT_STANDIN_CONTINUE_DEFAULT + s_continue = 1; +#else s_continue = GetEnvironmentVariableA("WOWCLIENT_STANDIN_CONTINUE", nullptr, 0) ? 1 : 0; +#endif } if (!s_continue) {