mirror of
https://github.com/thunderbrewhq/squall.git
synced 2026-05-03 06:13:51 +00:00
chore(error): support different era args for SErrDisplayError
This commit is contained in:
parent
b69feaca30
commit
b292aabac0
6 changed files with 19 additions and 9 deletions
|
|
@ -51,8 +51,10 @@ if(WHOA_STORM_FLAVOR STREQUAL "SC1")
|
||||||
add_definitions(-DWHOA_SUPPORTS_KOREAN_CODEPAGE)
|
add_definitions(-DWHOA_SUPPORTS_KOREAN_CODEPAGE)
|
||||||
elseif(WHOA_STORM_FLAVOR STREQUAL "WOW")
|
elseif(WHOA_STORM_FLAVOR STREQUAL "WOW")
|
||||||
message(STATUS "Building Storm with World of Warcraft flavoring")
|
message(STATUS "Building Storm with World of Warcraft flavoring")
|
||||||
|
add_definitions(-DWHOA_DISPLAY_ERR_EXTRA_ARG)
|
||||||
else()
|
else()
|
||||||
message(STATUS "Building Storm with default flavoring")
|
message(STATUS "Building Storm with default flavoring")
|
||||||
|
add_definitions(-DWHOA_DISPLAY_ERR_EXTRA_ARG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# OS defines
|
# OS defines
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,11 @@ static int32_t s_displaying;
|
||||||
exit(EXIT_FAILURE);
|
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) {
|
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;
|
if (s_suppress || s_displaying) return 0;
|
||||||
s_displaying = 1;
|
s_displaying = 1;
|
||||||
|
|
||||||
|
|
@ -34,7 +38,7 @@ int32_t STORMAPI SErrDisplayError(uint32_t errorcode, const char* filename, int3
|
||||||
|
|
||||||
printf(" App: %s\n", "GenericBlizzardApp");
|
printf(" App: %s\n", "GenericBlizzardApp");
|
||||||
|
|
||||||
if (errorcode != 0x85100000) {
|
if (errorcode != STORM_ERROR_ASSERTION) {
|
||||||
printf(" Error Code: 0x%08X\n", errorcode);
|
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(" File: %s\n", filename);
|
||||||
printf(" Line: %d\n", linenumber);
|
printf(" Line: %d\n", linenumber);
|
||||||
|
|
||||||
if (errorcode != 0x85100000) {
|
if (errorcode != STORM_ERROR_ASSERTION) {
|
||||||
printf(" Error Code: 0x%08X\n", errorcode);
|
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';
|
buffer[sizeof(buffer) - 1] = '\0';
|
||||||
va_end(args);
|
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) {
|
void STORMAPI SErrPrepareAppFatal(const char* filename, int32_t linenumber) {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,12 @@
|
||||||
|
|
||||||
[[noreturn]] void STORMCDECL SErrDisplayAppFatal(const char* format, ...);
|
[[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, ...);
|
int32_t STORMCDECL SErrDisplayErrorFmt(uint32_t errorcode, const char* filename, int32_t linenumber, int32_t recoverable, uint32_t exitcode, const char* format, ...);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
// Debug Build + Release Assertions Enabled Build
|
// Debug Build + Release Assertions Enabled Build
|
||||||
#define STORM_ASSERT(x) \
|
#define STORM_ASSERT(x) \
|
||||||
if (!(x)) { \
|
if (!(x)) { \
|
||||||
SErrDisplayError(STORM_ERROR_ASSERTION, __FILE__, __LINE__, #x, 0, 1, 0x11111111); \
|
SErrDisplayError(STORM_ERROR_ASSERTION, __FILE__, __LINE__, #x, 0, 1); \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// Release Build
|
// Release Build
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
if(WHOA_TEST_STORMDLL)
|
if(WHOA_TEST_STORMDLL)
|
||||||
# Note: Error excluded because some functions take more args than expected by older Storms
|
|
||||||
set(TEST_SOURCES
|
set(TEST_SOURCES
|
||||||
Big.cpp
|
Big.cpp
|
||||||
Core.cpp
|
Core.cpp
|
||||||
|
Error.cpp
|
||||||
Event.cpp
|
Event.cpp
|
||||||
EventTest.cpp
|
EventTest.cpp
|
||||||
Memory.cpp
|
Memory.cpp
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,13 @@
|
||||||
#include "test/Test.hpp"
|
#include "test/Test.hpp"
|
||||||
#include "storm/Error.hpp"
|
#include "storm/Error.hpp"
|
||||||
|
|
||||||
TEST_CASE("SErrDisplayError", "[event]") {
|
TEST_CASE("SErrDisplayError", "[error]") {
|
||||||
SECTION("does nothing if errors are suppressed") {
|
SECTION("does nothing if errors are suppressed") {
|
||||||
uint32_t errorcode = GENERATE(0, STORM_ERROR_ASSERTION, ERROR_INVALID_PARAMETER);
|
uint32_t errorcode = GENERATE(0, STORM_ERROR_ASSERTION, ERROR_INVALID_PARAMETER);
|
||||||
int32_t recoverable = GENERATE(0, 1);
|
int32_t recoverable = GENERATE(0, 1);
|
||||||
uint32_t exitcode = GENERATE(0, 1);
|
uint32_t exitcode = GENERATE(0, 1);
|
||||||
uint32_t unkarg = GENERATE(0, 1, 0x11111111);
|
|
||||||
|
|
||||||
SErrSuppressErrors(1);
|
SErrSuppressErrors(1);
|
||||||
CHECK_FALSE(SErrDisplayError(errorcode, nullptr, 0, nullptr, recoverable, exitcode, unkarg));
|
CHECK_FALSE(SErrDisplayError(errorcode, nullptr, 0, nullptr, recoverable, exitcode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue