From 32c37c0f219ca1fbd9fddc7c51ef50ccf83d1f63 Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 19 Dec 2023 18:08:12 -0800 Subject: [PATCH] tidying --- .efrocachemap | 56 ++++++------ CHANGELOG.md | 2 +- src/assets/ba_data/python/baenv.py | 2 +- src/ballistica/base/audio/audio_server.cc | 85 ++++++++++++------- src/ballistica/base/audio/audio_server.h | 5 +- src/ballistica/core/platform/core_platform.cc | 18 +++- src/ballistica/shared/ballistica.cc | 2 +- tools/efrotools/openalbuild.py | 56 ++++++++---- 8 files changed, 144 insertions(+), 82 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 7674b050..21c6050a 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4060,26 +4060,26 @@ "build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1", "build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae", "build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "33bca369a3f395c63d1649f592a4a9f4", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "dc0200fef56dfd9c147114f24aacf3a1", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "dead9bfb4599b0f513ff523eac3b595d", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "aa9ee6dbdace9684841d288ce46ab009", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "5cf88c527ab5d8ecb6bbaf1c960c97ce", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "223e5399352500c69aa8c52759993876", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "b3210494fb5cdab977eac674117bef10", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "79d9ee658372b1f6aeed8fc0259a3123", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "c1f240c7b41fbf658b918370e9013147", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "0e0c748585829ad889db8a7a1e21e6af", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "2858e9de07cea8e74b946a41b8d79cda", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "c164bea683df3f34e1905ccd9d291249", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "67fd7b01645f55aba969f6015f342be4", - "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "ee4283bbf5c4b5fd6cb16dbd5f68f89e", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "32cf56e867fc651c019d052a3dabae13", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "253931a8f5c67cc94258e40b5c9b7456", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "c2f633f4108c0ca0c31f43d8b7fa16a0", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "f6127717a8b69295d7ea0cff8f0bd80f", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "df9cf2434e7b9aa709bc2732446f6493", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "603c6bd25a6700e3c6ed91e82d5c7cff", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "aab12ef3644cfdb3bce807bc046620e7", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "79ee4d6521943e79893c9883f2a548d8", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "b20f62bc58a08d8399b1246e7b3d1b8f", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "c0469461fe759e3826bb7bd8850852ad", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "6fce2f51f1bc935116bc127e527247af", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "eed595ac5934d3596bd5ed56031b09f5", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "fb0d04aa303e344619828b5d3b92e519", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "2e811248fdae63d5b7aabbe774d32e83", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "1e315db5e874312b5e36589c5c968733", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "bb4335a1815782929103aff48bee5b1d", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "bce3c2dbb267e3fed1a1c0f2745707b0", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "faae1a0abcc9bf88524d4f328e3a17be", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "5e500602394893d352da05721c42dcd3", + "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "36605011ccba79eafb36a985331ef439", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "be2ee4efa762275b51837185df5a1bcd", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "728155371cf98f79470a10d67c267ffd", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "aff99e4d9ec01c384c1d47e1edb1ac21", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "8046e2df68d61c99179b4e903e06f945", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "4cda95214bb4f60845ca7d72e852edb8", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "7378c0364421fb0a44373758634fc449", "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "db535f0ca1e01af825f75f204fbc8928", "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "97d51afca996ae15b61fd9f409a00459", "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "db535f0ca1e01af825f75f204fbc8928", @@ -4096,14 +4096,14 @@ "build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "452623f0495dd4375e5b5d9b80d643d5", "build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "ca49b32ed573feea11613d62cd89840c", "build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "452623f0495dd4375e5b5d9b80d643d5", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "a06efb8435973d179dd784e95dba3cd1", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "af4bffcb6ef38a1f845a6005a2c69f9f", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "440ad18ca2d7baf49810de35e1022bbf", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "9abe4e5efa7fe1574e42459731b1b296", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "e71b41f69e8d2289937291f58148b354", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "8a1226538e913154a039fe8b64599eda", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "bdc013ddfc247fb16dc7aa1a14858e8a", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "41cae443b772a2006d072c521c054cd8", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "e4c7a9180c9acf5d8f994ae82f143283", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "b8dd6533992f85e417b0c4fa6a7b684f", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "700d83921b479353a1103f5a8ed67165", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "268b4f49e92b7d698d81560d2d520d8a", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "d82aba360937c288f6a7c70182a20b5a", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "688261618d3dfcaad36813794f3574ac", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "37904f43d7b995044e783f0fe48dfb5d", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "5ccbe5ed00e56319070d59e820a2c589", "src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c", "src/assets/ba_data/python/babase/_mgen/enums.py": "28323912b56ec07701eda3d41a6a4101", "src/ballistica/base/mgen/pyembed/binding_base.inc": "72bfed2cce8ff19741989dec28302f3f", diff --git a/CHANGELOG.md b/CHANGELOG.md index 95fbf22b..b33c54cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.32 (build 21735, api 8, 2023-12-19) +### 1.7.32 (build 21737, api 8, 2023-12-19) - Fixed a screen message that no one will ever see (Thanks vishal332008?...) - Plugins window now displays 'No Plugins Installed' when no plugins are present (Thanks vishal332008!) - Old messages are now displayed as soon as you press 'Unmute Chat' (Thanks vishal332008!) diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index f3fdabfe..0cd16640 100644 --- a/src/assets/ba_data/python/baenv.py +++ b/src/assets/ba_data/python/baenv.py @@ -52,7 +52,7 @@ if TYPE_CHECKING: # Build number and version of the ballistica binary we expect to be # using. -TARGET_BALLISTICA_BUILD = 21735 +TARGET_BALLISTICA_BUILD = 21737 TARGET_BALLISTICA_VERSION = '1.7.32' diff --git a/src/ballistica/base/audio/audio_server.cc b/src/ballistica/base/audio/audio_server.cc index 6ecf0c91..f51df1ae 100644 --- a/src/ballistica/base/audio/audio_server.cc +++ b/src/ballistica/base/audio/audio_server.cc @@ -322,7 +322,7 @@ void AudioServer::OnAppStartInThread_() { openalsoft_android_log_.clear(); } alcCloseDevice(device); - g_core->platform->SleepSeconds(1.0); + g_core->platform->SleepSeconds(2.0); device = alcOpenDevice(al_device_name); alGetError(); // Clear any errors. @@ -906,6 +906,11 @@ void AudioServer::ProcessDeviceDisconnects_(seconds_t real_time_seconds) { ALCint connected{-1}; alcGetIntegerv(device, ALC_CONNECTED, sizeof(connected), &connected); CHECK_AL_ERROR; + if (connected == 0) { + reconnect_fail_count_++; + } else { + reconnect_fail_count_ = 0; + } if (connected == 0 && real_time_seconds - last_reset_attempt_time_ > 10.0) { Log(LogLevel::kInfo, "OpenAL device disconnected; resetting..."); if (g_buildconfig.ostype_android()) { @@ -918,50 +923,70 @@ void AudioServer::ProcessDeviceDisconnects_(seconds_t real_time_seconds) { auto result = alcResetDeviceSOFT(device, nullptr); CHECK_AL_ERROR; - Log(LogLevel::kInfo, std::string("alcResetDeviceSOFT returned ") - + (result == ALC_TRUE ? "ALC_TRUE" : "ALC_FALSE")); + // Log(LogLevel::kInfo, std::string("alcResetDeviceSOFT returned ") + // + (result == ALC_TRUE ? "ALC_TRUE" : + // "ALC_FALSE")); // Check to see if this brought the device back. - ALCint connected{-1}; - alcGetIntegerv(device, ALC_CONNECTED, sizeof(connected), &connected); - CHECK_AL_ERROR; + // ALCint connected{-1}; + // alcGetIntegerv(device, ALC_CONNECTED, sizeof(connected), &connected); + // CHECK_AL_ERROR; // If we were successful, clear out the wait for the next reset. // Otherwise plugging in headphones and then unplugging them immediately // will result in 10 seconds of silence. - if (connected == 1) { - if (result == ALC_FALSE) { - Log(LogLevel::kWarning, - "Got ALC_FALSE for alcResetDeviceSOFT but device is now connected. " - "Odd."); - } + if (result == ALC_TRUE) { last_reset_attempt_time_ = -999.0; + if (g_buildconfig.ostype_android()) { + std::scoped_lock lock(openalsoft_android_log_mutex_); + openalsoft_android_log_ += "DEVICE RESET SUCCESSFUL\n"; + } + } else { + if (g_buildconfig.ostype_android()) { + std::scoped_lock lock(openalsoft_android_log_mutex_); + openalsoft_android_log_ += "DEVICE RESET FAILED\n"; + } } // If we're ever *not* immediately successful, flip on reporting to try - // and figure out what's going on. We then report the next few attempt - // results regardless of outcome. - if (connected == 0) { - report_reset_results_ = true; - } - if (report_reset_results_ && reset_result_reports_remaining_ > 0) { - reset_result_reports_remaining_ -= 1; - if (connected != 0) { - Log(LogLevel::kInfo, - "alcResetDeviceSOFT successfully reconnected device."); - } else { - Log(LogLevel::kError, "alcResetDeviceSOFT failed to reconnect device."); - } - if (g_buildconfig.ostype_android()) { - std::scoped_lock lock(openalsoft_android_log_mutex_); - Log(LogLevel::kWarning, + // and figure out what's going on. After that point we'll report subsequent + // if (connected == 0) { + // report_reset_results_ = true; + // } + // if (report_reset_results_ && reset_result_reports_remaining_ > 0) { + // reset_result_reports_remaining_ -= 1; + // if (connected != 0) { + // Log(LogLevel::kInfo, + // "alcResetDeviceSOFT successfully reconnected device."); + // } else { + // Log(LogLevel::kError, "alcResetDeviceSOFT failed to reconnect + // device."); + // } + // if (g_buildconfig.ostype_android()) { + // std::scoped_lock lock(openalsoft_android_log_mutex_); + // Log(LogLevel::kWarning, + // "------------------------" + // " OPENALSOFT-RECONNECT-LOG-BEGIN ----------------------\n" + // + openalsoft_android_log_ + // + "\n-------------------------" + // " OPENALSOFT-RECONNECT-LOG-END -----------------------"); + // openalsoft_android_log_.clear(); + // } + // } + } + + // If we've failed at reconnecting a few times in a row, ship logs. + if (reconnect_fail_count_ == 3) { + if (g_buildconfig.ostype_android()) { + std::scoped_lock lock(openalsoft_android_log_mutex_); + Log(LogLevel::kWarning, + "Got 3 reconnect fails in a row; dumping OpenAL log.\n" "------------------------" " OPENALSOFT-RECONNECT-LOG-BEGIN ----------------------\n" + openalsoft_android_log_ + "\n-------------------------" " OPENALSOFT-RECONNECT-LOG-END -----------------------"); - openalsoft_android_log_.clear(); - } + openalsoft_android_log_.clear(); } } #endif // BA_OPENAL_IS_SOFT diff --git a/src/ballistica/base/audio/audio_server.h b/src/ballistica/base/audio/audio_server.h index 75edec2e..ba7b08b6 100644 --- a/src/ballistica/base/audio/audio_server.h +++ b/src/ballistica/base/audio/audio_server.h @@ -123,8 +123,9 @@ class AudioServer { bool suspended_{}; bool shutdown_completed_{}; bool shutting_down_{}; - bool report_reset_results_{}; - int reset_result_reports_remaining_{3}; + // bool report_reset_results_{}; + // int reset_result_reports_remaining_{3}; + int reconnect_fail_count_{}; int al_source_count_{}; seconds_t last_reset_attempt_time_{-999.0}; seconds_t shutdown_start_time_{}; diff --git a/src/ballistica/core/platform/core_platform.cc b/src/ballistica/core/platform/core_platform.cc index 2050f32e..0d8bbbdb 100644 --- a/src/ballistica/core/platform/core_platform.cc +++ b/src/ballistica/core/platform/core_platform.cc @@ -2,6 +2,8 @@ #include "ballistica/core/platform/core_platform.h" +#include + #if !BA_OSTYPE_WINDOWS #include #endif @@ -966,12 +968,26 @@ class NativeStackTraceExecInfo : public NativeStackTrace { // construction but should do the bare minimum amount of work to store it. Any // expensive operations such as symbolification should be deferred until // FormatForDisplay(). - NativeStackTraceExecInfo() { nsize_ = backtrace(array_, kMaxStackLevels); } + NativeStackTraceExecInfo() { + nsize_ = backtrace(array_, kMaxStackLevels); + // backtrace() is supposed to clamp return values to the size of + // array we passed; make sure that's happening (debugging odd crash). + if (nsize_ > kMaxStackLevels) { + g_core->platform->LowLevelDebugLog( + "backtrace() yielded " + std::to_string(nsize_) + + " which is larger than our available size " + + std::to_string(kMaxStackLevels)); + nsize_ = kMaxStackLevels; + } + } auto FormatForDisplay() noexcept -> std::string override { try { std::string s; char** symbols = backtrace_symbols(array_, nsize_); + if (symbols == nullptr) { + return "backtrace_symbols yielded nullptr"; + } for (int i = 0; i < nsize_; i++) { const char* symbol = symbols[i]; // Special case for Android: there's usually a horrific mess of a diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index a3de8d2a..d101f182 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 = 21735; +const int kEngineBuildNumber = 21737; const char* kEngineVersion = "1.7.32"; const int kEngineApiVersion = 8; diff --git a/tools/efrotools/openalbuild.py b/tools/efrotools/openalbuild.py index 36935c1d..19518381 100644 --- a/tools/efrotools/openalbuild.py +++ b/tools/efrotools/openalbuild.py @@ -50,6 +50,8 @@ def build_openal(arch: str, mode: str) -> None: # Inject an env var to force Oboe to use OpenSL backend. opensl_fallback_option = True + # set_game_usage = True + # Get ndk path. ndk_path = ( subprocess.run( @@ -75,7 +77,8 @@ def build_openal(arch: str, mode: str) -> None: 'checkout', # '1.23.1', # '1381a951bea78c67281a2e844e6db1dedbd5ed7c', - 'bc83c874ff15b29fdab9b6c0bf40b268345b3026', + # 'bc83c874ff15b29fdab9b6c0bf40b268345b3026', + '59c466077fd6f16af64afcc6260bb61aa4e632dc', ], check=True, cwd=builddir, @@ -96,7 +99,7 @@ def build_openal(arch: str, mode: str) -> None: ) subprocess.run(['git', 'checkout', '1.8.0'], check=True, cwd=builddir_oboe) - if opensl_fallback_option: + if bool(True): oboepath = f'{builddir}/alc/backends/oboe.cpp' with open(oboepath, encoding='utf-8') as infile: txt = infile.read() @@ -134,22 +137,39 @@ def build_openal(arch: str, mode: str) -> None: ' // oboe::convertToText(result)};\n' ), ) - txt = replace_exact( - txt, - ( - ' builder.setPerformanceMode(' - 'oboe::PerformanceMode::LowLatency);\n' - ), - ( - ' builder.setPerformanceMode(' - 'oboe::PerformanceMode::LowLatency);\n' - ' if (getenv("BA_OBOE_USE_OPENSLES")) {\n' - ' TRACE("BA_OBOE_USE_OPENSLES set;' - ' Using OpenSLES\\n");\n' - ' builder.setAudioApi(oboe::AudioApi::OpenSLES);\n' - ' }\n' - ), - ) + # Add our fallback option. + if opensl_fallback_option: + txt = replace_exact( + txt, + ( + ' builder.setPerformanceMode(' + 'oboe::PerformanceMode::LowLatency);\n' + ), + ( + ' builder.setPerformanceMode(' + 'oboe::PerformanceMode::LowLatency);\n' + ' if (getenv("BA_OBOE_USE_OPENSLES")) {\n' + ' TRACE("BA_OBOE_USE_OPENSLES set;' + ' Using OpenSLES\\n");\n' + ' builder.setAudioApi(oboe::AudioApi::OpenSLES);\n' + ' }\n' + ), + ) + # Set game mode. + # if set_game_usage: + # txt = replace_exact( + # txt, + # ( + # ' builder.setPerformanceMode(' + # 'oboe::PerformanceMode::LowLatency);\n' + # ), + # ( + # ' builder.setPerformanceMode(' + # 'oboe::PerformanceMode::LowLatency);\n' + # ' builder.setUsage(' + # 'oboe::Usage::Game);\n' + # ), + # ) with open(oboepath, 'w', encoding='utf-8') as outfile: outfile.write(txt)