diff --git a/.efrocachemap b/.efrocachemap index c2b9c92d..9389a2aa 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4072,26 +4072,26 @@ "build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/c5/09/4f10b8a21ba87aa5509cff7a164b", "build/assets/workspace/onslaughtplug.py": "https://files.ballistica.net/cache/ba1/ff/0a/a354984f9c074dab0676ac7e4877", "build/assets/workspace/runaroundplug.py": "https://files.ballistica.net/cache/ba1/2a/1c/9ee5db6d1bceca7fa6638fb8abde", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/2a/bf/5ec0907b7ea2ae9ce556bfbaa977", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/b6/90/05fcb5913ac0efa57a0fe9cdb24e", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d5/9c/a39c893eb6f006a229ae677d7d1f", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/4d/bc/a448dcc9cf0de969e9ab1d723b72", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/89/6b/3661b8151586a16adb80a52c293f", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/be/7d/333edec3e78c3b0f06c7a29571d1", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/06/da/1bd3481ad7c525f537f963352131", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/b8/9a/ad6ecd60091315a0aa31ca55f736", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/3a/73/6cfd57cf5a424767fd7adcf0a2db", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/53/6f/30d29940df133fa78db5b7c3298c", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/b8/7c/41db8ce4cfece1553f07b891ab34", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/73/cb/2a8b7d0a208147be97198cf3a59c", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/97/56/3af6d1fb98c1e9a637f803c45aa5", - "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/4f/26/74f101b0d6f038070a025dfb8c0c", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/a8/12/1e10c0eb9b55408e6e4d3041cbf4", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/eb/5f/50df0e0f91b1c6fe76de7c7fd048", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/85/3f/dc233392f6d02a62dcad599d264d", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/23/2e/78b07a81552a79d67631075f2632", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/26/0e/1900fb42f7080dd62e35607d6d6d", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/c9/28/c98b86c13cfabd168d8683744cf5", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/4b/7b/656bbbcb41f7b43eeee0d0775d9a", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/f4/3e/b48cab42185c07ff6bfc355f3e5e", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d6/9e/c544d5d86c20a42bcee9f7be1cde", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d1/f1/24aaba8bd77035b9d8601eaea3cb", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/39/1f/6a762fd0ccc4ca62a2b7a51f6cc4", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/1a/5e/3b08dab2bffd74edbe744d3717a3", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/c2/4f/f146682e88224ba08219b0ebadc4", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/c2/8b/351d1a6de44b45c06e85b39198a1", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/c4/55/0328e26e65974ee613eb0ff8a99e", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/fc/4e/3ff90a44e988e3db7ea66ca4f073", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/4c/b8/5d909139a0fad91c70c6f870feae", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/16/30/16502e5f928405c6d44c0f1a24bd", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/71/bc/546d02a06b6939c3112e155db26c", + "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/ea/86/eb5c10d57047ee32a82ac3c3790a", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/50/9a/4eef71525e706d4a971c3214422b", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/40/ee/9e6425089e61ff8027871016eeb4", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/7a/b2/d19573e4357cdf109b4e2af43118", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/42/a3/d08f3b7a1594bb1ba4f2ef60dc6e", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/25/45/82f2db0fef5a8df7cb5e71ba4d4c", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/81/14/0121acd7c0cfc62d9c4b51ce60bb", "build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/58/55/b6ae6dd4f3615fa87bb170a43233", "build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/b9/f8/37285d0ced7794a82534d13c33ac", "build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/c7/cc/0c5f0afbfa0ddabaea8d5838562a", diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d03a923..f26bfc47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.20 (build 21077, api 8, 2023-06-08) +### 1.7.20 (build 21078, api 8, 2023-06-08) - This seems like a good time for a `refactoring` release in anticipation of changes coming in 1.8. Basically this means that a lot of things will be diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index f335fcdb..1696032d 100644 --- a/src/assets/ba_data/python/baenv.py +++ b/src/assets/ba_data/python/baenv.py @@ -28,7 +28,7 @@ if TYPE_CHECKING: # Build number and version of the ballistica binary we expect to be # using. -TARGET_BALLISTICA_BUILD = 21077 +TARGET_BALLISTICA_BUILD = 21078 TARGET_BALLISTICA_VERSION = '1.7.20' _g_env_config: EnvConfig | None = None diff --git a/src/ballistica/core/platform/windows/core_platform_windows.cc b/src/ballistica/core/platform/windows/core_platform_windows.cc index 772fe8fc..f7e08276 100644 --- a/src/ballistica/core/platform/windows/core_platform_windows.cc +++ b/src/ballistica/core/platform/windows/core_platform_windows.cc @@ -40,6 +40,7 @@ #endif #include "ballistica/shared/foundation/event_loop.h" +#include "ballistica/shared/generic/utils.h" #include "ballistica/shared/networking/networking_sys.h" #if !defined(UNICODE) || !defined(_UNICODE) @@ -109,7 +110,8 @@ auto CorePlatformWindows::FormatWinStackTraceForDisplay( SYMBOL_INFO* symbol = reinterpret_cast(buf); symbol->MaxNameLen = kTraceMaxFunctionNameLength; symbol->SizeOfStruct = sizeof(SYMBOL_INFO); - DWORD displacement; + DWORD64 s_displacement; + DWORD l_displacement; IMAGEHLP_LINE64 line; line.SizeOfStruct = sizeof(IMAGEHLP_LINE64); @@ -118,27 +120,46 @@ auto CorePlatformWindows::FormatWinStackTraceForDisplay( char linebuf[kTraceMaxFunctionNameLength + 128]; for (int i = 0; i < stack_trace->number_of_frames(); i++) { DWORD64 address = (DWORD64)(stack_trace->stack()[i]); - SymFromAddr(win_sym_process_, address, NULL, symbol); - if (SymGetLineFromAddr64(win_sym_process_, address, &displacement, + std::string symbol_name_s; + if (SymFromAddr(win_sym_process_, address, &s_displacement, symbol)) { + symbol_name_s = UTF8Encode(symbol->Name); + if (!Utils::IsValidUTF8(symbol_name_s)) { + // Debugging some wonky utf8 I was seeing come through. + symbol_name_s = "(got invalid utf8 for symbol name)"; + } + } else { + symbol_name_s = "(unknown symbol name)"; + } + const char* symbol_name = symbol_name_s.c_str(); + + if (SymGetLineFromAddr64(win_sym_process_, address, &l_displacement, &line)) { - std::string filename_s = UTF8Encode(std::wstring(line.FileName)); + std::string filename_s = UTF8Encode(line.FileName); + + if (!Utils::IsValidUTF8(filename_s)) { + // Debugging some wonky utf8 I was seeing come through. + filename_s = "(got invalid utf8 for filename)"; + } const char* filename = filename_s.c_str(); + + // If our filename starts with build_src_dir, trim that part + // off to make things nice and pretty. if (!build_src_dir.empty() && !strncmp(filename, build_src_dir.c_str(), build_src_dir.size())) { filename += build_src_dir.size(); } + snprintf(linebuf, sizeof(linebuf), - "%-3d %s in %s: line: %lu: address: 0x%p\n", i, - UTF8Encode(std::wstring(symbol->Name)).c_str(), filename, - line.LineNumber, reinterpret_cast(symbol->Address)); + "%-3d %s in %s: line: %lu: address: 0x%p\n", i, symbol_name, + filename, line.LineNumber, + reinterpret_cast(symbol->Address)); } else { snprintf(linebuf, sizeof(linebuf), "SymGetLineFromAddr64 returned error code %lu.\n", GetLastError()); snprintf(linebuf, sizeof(linebuf), "%-3d %s, address 0x%p.\n", i, - UTF8Encode(std::wstring(symbol->Name)).c_str(), - reinterpret_cast(symbol->Address)); + symbol_name, reinterpret_cast(symbol->Address)); } out += linebuf; } @@ -174,54 +195,10 @@ auto CorePlatformWindows::UTF8Decode(const std::string& str) -> std::wstring { return wstr; } -#define TRACE_MAX_STACK_FRAMES 256 -#define TRACE_MAX_FUNCTION_NAME_LENGTH 1024 - -// int printStackTrace() { -// void* stack[TRACE_MAX_STACK_FRAMES]; -// if (!win_sym_inited_) { -// win_sym_process_ = GetCurrentProcess(); -// SymInitialize(win_sym_process_, NULL, TRUE); -// win_sym_inited_ = true; -// } -// WORD numberOfFrames = -// CaptureStackBackTrace(0, TRACE_MAX_STACK_FRAMES, stack, NULL); - -// char buf[sizeof(SYMBOL_INFO) -// + (TRACE_MAX_FUNCTION_NAME_LENGTH - 1) * sizeof(TCHAR)]; -// SYMBOL_INFO* symbol = (SYMBOL_INFO*)buf; -// symbol->MaxNameLen = TRACE_MAX_FUNCTION_NAME_LENGTH; -// symbol->SizeOfStruct = sizeof(SYMBOL_INFO); -// DWORD displacement; -// IMAGEHLP_LINE64 line; -// line.SizeOfStruct = sizeof(IMAGEHLP_LINE64); -// for (int i = 0; i < numberOfFrames; i++) { -// DWORD64 address = (DWORD64)(stack[i]); -// SymFromAddr(win_sym_process_, address, NULL, symbol); -// if (SymGetLineFromAddr64(win_sym_process_, address, &displacement, -// &line)) { -// printf("\tat %s in %s: line: %lu: address: 0x%0X\n", symbol->Name, -// line.FileName, line.LineNumber, symbol->Address); -// } else { -// printf("\tSymGetLineFromAddr64 returned error code %lu.\n", -// GetLastError()); -// printf("\tat %s, address 0x%0X.\n", symbol->Name, symbol->Address); -// } -// } -// return 0; -// } - CorePlatformWindows::CorePlatformWindows() { // We should be built in unicode mode. assert(sizeof(TCHAR) == 2); - // printStackTrace(); - - // auto* testtrace = new WinStackTrace(this); - // printf("WINTRACE:\n%s", testtrace->FormatForDisplay().c_str()); - // printf("WOOHOO!\n"); - // fflush(stdout); - // Need to init winsock immediately since we use it for // threading/logging/etc. { @@ -306,7 +283,7 @@ auto CorePlatformWindows::DoGetConfigDirectoryMonolithicDefault() if (result != S_OK) { throw Exception("Unable to get user local-app-data dir."); } - std::string configdir = UTF8Encode(std::wstring(path)) + "\\BallisticaKit"; + std::string configdir = UTF8Encode(path) + "\\BallisticaKit"; return configdir; } @@ -389,7 +366,7 @@ auto CorePlatformWindows::DoAbsPath(const std::string& path, // Buffer not big enough. Should handle this case. return false; } - *outpath = UTF8Encode(std::wstring(abspath)); + *outpath = UTF8Encode(abspath); return true; } @@ -840,7 +817,7 @@ std::string CorePlatformWindows::DoGetDeviceName() { if (result == 0) { device_name = "BallisticaKit Game"; } else { - device_name = UTF8Encode(std::wstring(computer_name)); + device_name = UTF8Encode(computer_name); if (device_name.size() == 0) { device_name = "BallisticaKit Game"; } @@ -876,7 +853,7 @@ auto CorePlatformWindows::DoGetDataDirectoryMonolithicDefault() -> std::string { // If the app path happens to be the current dir, return // the default of "." which gives us cleaner looking paths in // stack traces/etc. - auto out = UTF8Encode(std::wstring(sz_file_name)); + auto out = UTF8Encode(sz_file_name); if (out == GetCWD()) { return CorePlatform::DoGetDataDirectoryMonolithicDefault(); } @@ -905,7 +882,7 @@ auto CorePlatformWindows::GetEnv(const std::string& name) // If it was found and fits in our small static buffer, we're done. if (result <= kStaticBufferSize) { - return UTF8Encode(std::wstring(buffer)); + return UTF8Encode(buffer); } // Ok; apparently its big. Allocate a buffer big enough to hold it and try @@ -920,7 +897,7 @@ auto CorePlatformWindows::GetEnv(const std::string& name) Log(LogLevel::kError, "GetEnv to allocated buffer failed; unexpected."); return {}; } - return UTF8Encode(std::wstring(big_buffer.data())); + return UTF8Encode(big_buffer.data()); } void CorePlatformWindows::SetEnv(const std::string& name, @@ -965,7 +942,7 @@ std::string CorePlatformWindows::GetCWD() { if (result == nullptr) { throw Exception("Error getting CWD; errno=" + std::to_string(errno)); } - return UTF8Encode(std::wstring(buffer)); + return UTF8Encode(buffer); } void CorePlatformWindows::OpenFileExternally(const std::string& path) { diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index a9918efa..f532b334 100644 --- a/src/ballistica/shared/ballistica.cc +++ b/src/ballistica/shared/ballistica.cc @@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int { namespace ballistica { // These are set automatically via script; don't modify them here. -const int kEngineBuildNumber = 21077; +const int kEngineBuildNumber = 21078; const char* kEngineVersion = "1.7.20"; auto MonolithicMain(const core::CoreConfig& core_config) -> int {