diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ac1163..1b8452f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,8 +51,10 @@ if(WHOA_STORM_FLAVOR STREQUAL "SC1") add_definitions(-DWHOA_SUPPORTS_KOREAN_CODEPAGE) elseif(WHOA_STORM_FLAVOR STREQUAL "WOW") message(STATUS "Building Storm with World of Warcraft flavoring") + add_definitions(-DWHOA_DISPLAY_ERR_EXTRA_ARG) else() message(STATUS "Building Storm with default flavoring") + add_definitions(-DWHOA_DISPLAY_ERR_EXTRA_ARG) endif() # OS defines diff --git a/storm/Error.cpp b/storm/Error.cpp index 6a9f086..50aa409 100644 --- a/storm/Error.cpp +++ b/storm/Error.cpp @@ -21,7 +21,11 @@ static int32_t s_displaying; exit(EXIT_FAILURE); } +#ifdef WHOA_DISPLAY_ERR_EXTRA_ARG int32_t STORMAPI SErrDisplayError(uint32_t errorcode, const char* filename, int32_t linenumber, const char* description, int32_t recoverable, uint32_t exitcode, uint32_t a7) { +#else +int32_t STORMAPI SErrDisplayError(uint32_t errorcode, const char* filename, int32_t linenumber, const char* description, int32_t recoverable, uint32_t exitcode) { +#endif if (s_suppress || s_displaying) return 0; s_displaying = 1; @@ -34,7 +38,7 @@ int32_t STORMAPI SErrDisplayError(uint32_t errorcode, const char* filename, int3 printf(" App: %s\n", "GenericBlizzardApp"); - if (errorcode != 0x85100000) { + if (errorcode != STORM_ERROR_ASSERTION) { printf(" Error Code: 0x%08X\n", errorcode); } @@ -48,7 +52,7 @@ int32_t STORMAPI SErrDisplayError(uint32_t errorcode, const char* filename, int3 printf(" File: %s\n", filename); printf(" Line: %d\n", linenumber); - if (errorcode != 0x85100000) { + if (errorcode != STORM_ERROR_ASSERTION) { printf(" Error Code: 0x%08X\n", errorcode); } @@ -74,7 +78,7 @@ int32_t STORMCDECL SErrDisplayErrorFmt(uint32_t errorcode, const char* filename, buffer[sizeof(buffer) - 1] = '\0'; va_end(args); - return SErrDisplayError(errorcode, filename, linenumber, buffer, recoverable, exitcode, 1); + return SErrDisplayError(errorcode, filename, linenumber, buffer, recoverable, exitcode); } void STORMAPI SErrPrepareAppFatal(const char* filename, int32_t linenumber) { diff --git a/storm/Error.hpp b/storm/Error.hpp index 7f0d6da..a5872bb 100644 --- a/storm/Error.hpp +++ b/storm/Error.hpp @@ -18,7 +18,12 @@ [[noreturn]] void STORMCDECL SErrDisplayAppFatal(const char* format, ...); -int32_t STORMAPI SErrDisplayError(uint32_t errorcode, const char* filename, int32_t linenumber, const char* description, int32_t recoverable, uint32_t exitcode, uint32_t a7); + +#ifdef WHOA_DISPLAY_ERR_EXTRA_ARG +int32_t STORMAPI SErrDisplayError(uint32_t errorcode, const char* filename, int32_t linenumber, const char* description, int32_t recoverable, uint32_t exitcode, uint32_t a7 = 0x11111111); +#else +int32_t STORMAPI SErrDisplayError(uint32_t errorcode, const char* filename, int32_t linenumber, const char* description, int32_t recoverable, uint32_t exitcode); +#endif int32_t STORMCDECL SErrDisplayErrorFmt(uint32_t errorcode, const char* filename, int32_t linenumber, int32_t recoverable, uint32_t exitcode, const char* format, ...); diff --git a/storm/error/Macros.hpp b/storm/error/Macros.hpp index 4556a96..d8f4682 100644 --- a/storm/error/Macros.hpp +++ b/storm/error/Macros.hpp @@ -18,7 +18,7 @@ // Debug Build + Release Assertions Enabled Build #define STORM_ASSERT(x) \ if (!(x)) { \ - SErrDisplayError(STORM_ERROR_ASSERTION, __FILE__, __LINE__, #x, 0, 1, 0x11111111); \ + SErrDisplayError(STORM_ERROR_ASSERTION, __FILE__, __LINE__, #x, 0, 1); \ } #else // Release Build diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 38ff1da..b11814a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,9 +1,9 @@ if(WHOA_TEST_STORMDLL) - # Note: Error excluded because some functions take more args than expected by older Storms set(TEST_SOURCES Big.cpp Core.cpp + Error.cpp Event.cpp EventTest.cpp Memory.cpp diff --git a/test/Error.cpp b/test/Error.cpp index 54c6fd5..87dc388 100644 --- a/test/Error.cpp +++ b/test/Error.cpp @@ -1,14 +1,13 @@ #include "test/Test.hpp" #include "storm/Error.hpp" -TEST_CASE("SErrDisplayError", "[event]") { +TEST_CASE("SErrDisplayError", "[error]") { SECTION("does nothing if errors are suppressed") { uint32_t errorcode = GENERATE(0, STORM_ERROR_ASSERTION, ERROR_INVALID_PARAMETER); int32_t recoverable = GENERATE(0, 1); uint32_t exitcode = GENERATE(0, 1); - uint32_t unkarg = GENERATE(0, 1, 0x11111111); SErrSuppressErrors(1); - CHECK_FALSE(SErrDisplayError(errorcode, nullptr, 0, nullptr, recoverable, exitcode, unkarg)); + CHECK_FALSE(SErrDisplayError(errorcode, nullptr, 0, nullptr, recoverable, exitcode)); } }