diff --git a/.efrocachemap b/.efrocachemap index 652de54a..82b5303a 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -444,7 +444,7 @@ "build/assets/ba_data/data/languages/korean.json": "03fd99d5e1155e81053fc028f69df982", "build/assets/ba_data/data/languages/malay.json": "832562ce997fc70704b9234c95fb2e38", "build/assets/ba_data/data/languages/persian.json": "d9de4a0b17331434859e0a6a9ae160c5", - "build/assets/ba_data/data/languages/polish.json": "b9a58b70ed5e99d8b7fa2392b2eb0cda", + "build/assets/ba_data/data/languages/polish.json": "df97beb156e03a3f9c932c9a600d58a1", "build/assets/ba_data/data/languages/portuguese.json": "bc3b97a8213427ebbd1cfa43b4c5e6b6", "build/assets/ba_data/data/languages/romanian.json": "aeebdd54f65939c2facc6ac50c117826", "build/assets/ba_data/data/languages/russian.json": "e93713be12870dd0a01e2d1359d7c792", @@ -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": "4d6df65a5417a0eb23f4838b26054ce6", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "d4c5bd03eda639f73b769664fae9691b", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "8837eed81869a6d9404afc890a99aeda", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "906ca39550dc91235ebdf1c217b3116b", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "e54895522cdd27f020b66260acdcc42d", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "a293a3b7af38f265c995beba6027be93", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "380a18b86065840c44285dc8762f42c4", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "2dc321ce47a02190e51c2f6f4f807449", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "117f585f14bb816ed0ec5bac792077c0", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "124b14dbca819bfc300ec6c521641f78", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "4df0f5f8183b325f5be25f2f9d5fa17e", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "023558d9028ba3250384f9d7d9ef9a17", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "4990e055b064408ede929a4c57253344", - "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "439574bda6d8d320ce38968886e83181", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "d62da566c946136a746d55ec04c28020", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "def8d189ca344df21b0a5bb9619fef12", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "b75406a2f66d2cb74359b78356f89710", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "cc1dccb6c5e63acf7bc42ee4346df9c6", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "27028549259c2f3843d54c3d29fad470", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "656d50ed1514203e967dcf90a594fe66", + "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/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": "dfb0839e79411869b196bc48565a36bc", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "e2beda37ec0d3efde860d0c2e248b9e0", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "2adae2522084e571c51595c7d31ac1dc", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "4ef71e752bfb318db84e88dfdd51d955", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "a123d9ecd0d53d9ad2f13abdf9842ade", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "6afeb02344f2faf2979188e54c6d2dc4", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "abedb44a923a4845fdc350fd979a1dc8", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "c728bfecc990701ce831644fb43520f1", + "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", "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 f5010a82..1787d798 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.32 (build 21728, api 8, 2023-12-17) +### 1.7.32 (build 21735, api 8, 2023-12-19) ### 1.7.31 (build 21727, api 8, 2023-12-17) - Added `bascenev1.get_connection_to_host_info_2()` which is an improved diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index 00089375..f3fdabfe 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 = 21728 +TARGET_BALLISTICA_BUILD = 21735 TARGET_BALLISTICA_VERSION = '1.7.32' diff --git a/src/assets/ba_data/python/bauiv1/_hooks.py b/src/assets/ba_data/python/bauiv1/_hooks.py index 30903564..b26b9fd3 100644 --- a/src/assets/ba_data/python/bauiv1/_hooks.py +++ b/src/assets/ba_data/python/bauiv1/_hooks.py @@ -99,8 +99,8 @@ def double_transition_out_warning() -> None: 'ContainerWidget was set to transition out twice;' ' this often implies buggy code (%s line %s).\n' ' Generally you should check the value of' - ' _root_widget.transitioning_out and only kick off transitions' - ' when that is False.', + ' _root_widget.transitioning_out and perform no actions if that' + ' is True.', caller_filename, caller_line_number, ) diff --git a/src/assets/ba_data/python/bauiv1lib/account/v2proxy.py b/src/assets/ba_data/python/bauiv1lib/account/v2proxy.py index a9ba5279..756ea612 100644 --- a/src/assets/ba_data/python/bauiv1lib/account/v2proxy.py +++ b/src/assets/ba_data/python/bauiv1lib/account/v2proxy.py @@ -239,4 +239,7 @@ class V2ProxySignInWindow(bui.Window): ) def _done(self) -> None: + # no-op if our underlying widget is dead or on its way out. + if not self._root_widget or self._root_widget.transitioning_out: + return bui.containerwidget(edit=self._root_widget, transition='out_scale') diff --git a/src/assets/ba_data/python/bauiv1lib/party.py b/src/assets/ba_data/python/bauiv1lib/party.py index f9250334..b1bf58a2 100644 --- a/src/assets/ba_data/python/bauiv1lib/party.py +++ b/src/assets/ba_data/python/bauiv1lib/party.py @@ -512,9 +512,17 @@ class PartyWindow(bui.Window): def close(self) -> None: """Close the window.""" + # no-op if our underlying widget is dead or on its way out. + if not self._root_widget or self._root_widget.transitioning_out: + return + bui.containerwidget(edit=self._root_widget, transition='out_scale') def close_with_sound(self) -> None: """Close the window and make a lovely sound.""" + # no-op if our underlying widget is dead or on its way out. + if not self._root_widget or self._root_widget.transitioning_out: + return + bui.getsound('swish').play() self.close() diff --git a/src/ballistica/base/audio/audio_server.cc b/src/ballistica/base/audio/audio_server.cc index 16994b03..6ecf0c91 100644 --- a/src/ballistica/base/audio/audio_server.cc +++ b/src/ballistica/base/audio/audio_server.cc @@ -4,6 +4,8 @@ #include +#include "ballistica/shared/buildconfig/buildconfig_common.h" + // Ew fixme. #if BA_OSTYPE_ANDROID #include @@ -199,14 +201,15 @@ void ALCustomLogCallback_(void* userptr, char level, const char* message, void AudioServer::OpenALSoftLogCallback(const std::string& msg) { size_t log_cap{1024 * 11}; - std::scoped_lock lock(openalsoft_log_mutex_); + std::scoped_lock lock(openalsoft_android_log_mutex_); - if (openalsoft_log_.size() < log_cap) { - openalsoft_log_ += "openal-log(" - + std::to_string(g_core->GetAppTimeSeconds()) - + "s): " + msg; - if (openalsoft_log_.size() >= log_cap) { - openalsoft_log_ += "\n\n"; + if (openalsoft_android_log_.size() < log_cap) { + openalsoft_android_log_ += "openal-log(" + + std::to_string(g_core->GetAppTimeSeconds()) + + "s): " + msg; + if (openalsoft_android_log_.size() >= log_cap) { + openalsoft_android_log_ += + "\n\n"; } } } @@ -223,6 +226,25 @@ void AudioServer::OnAppStartInThread_() { // Bring up OpenAL stuff. { + // Android-specific workaround; seeing lots of random crashes on Xiaomi + // Android 11 since switching from OpenALSoft's OpenSL backend to it's + // Oboe backend (which itself uses AAudio on newer Androids). Trying + // Oboe's OpenSL backend to see if it heads off the crashes. + { + std::string prefix = "Xiaomi "; + if (g_core->platform->GetDeviceName().compare(0, prefix.size(), prefix) + == 0) { + std::string prefix2 = "11"; + if (g_core->platform->GetOSVersionString().compare(0, prefix2.size(), + prefix2) + == 0) { + Log(LogLevel::kInfo, + "Xiaomi Android 11 detected; using OpenSL instead of AAudio."); + g_core->platform->SetEnv("BA_OBOE_USE_OPENSLES", "1"); + } + } + } + const char* al_device_name{}; // On the rift build in vr mode we need to make sure we open the rift audio @@ -269,28 +291,106 @@ void AudioServer::OnAppStartInThread_() { auto* device = alcOpenDevice(al_device_name); if (!device) { if (g_buildconfig.ostype_android()) { - std::scoped_lock lock(openalsoft_log_mutex_); + std::scoped_lock lock(openalsoft_android_log_mutex_); Log(LogLevel::kError, "------------------------" " OPENALSOFT-FATAL-ERROR-LOG-BEGIN ----------------------\n" - + openalsoft_log_ + + openalsoft_android_log_ + "\n-------------------------" " OPENALSOFT-FATAL-ERROR-LOG-END -----------------------"); + openalsoft_android_log_.clear(); } FatalError( "No audio devices found. Do you have speakers/headphones/etc. " "connected?"); } + impl_->alc_context = alcCreateContext(device, nullptr); - if (!impl_->alc_context) { - if (g_buildconfig.ostype_android()) { - std::scoped_lock lock(openalsoft_log_mutex_); + + // Android special case: if we fail, try again after a few seconds. + if (!impl_->alc_context && g_buildconfig.ostype_android()) { + Log(LogLevel::kError, + "Failed creating AL context; waiting and trying again."); + { + std::scoped_lock lock(openalsoft_android_log_mutex_); + Log(LogLevel::kWarning, + "------------------------" + " OPENALSOFT-ERROR-LOG-BEGIN ----------------------\n" + + openalsoft_android_log_ + + "\n-------------------------" + " OPENALSOFT-ERROR-LOG-END -----------------------"); + openalsoft_android_log_.clear(); + } + alcCloseDevice(device); + g_core->platform->SleepSeconds(1.0); + device = alcOpenDevice(al_device_name); + alGetError(); // Clear any errors. + + if (!device) { + std::scoped_lock lock(openalsoft_android_log_mutex_); Log(LogLevel::kError, "------------------------" " OPENALSOFT-FATAL-ERROR-LOG-BEGIN ----------------------\n" - + openalsoft_log_ + + openalsoft_android_log_ + "\n-------------------------" " OPENALSOFT-FATAL-ERROR-LOG-END -----------------------"); + openalsoft_android_log_.clear(); + FatalError("Fallback attempt device create failed."); + } + impl_->alc_context = alcCreateContext(device, nullptr); + if (impl_->alc_context) { + // For now want to explicitly know if this works. + Log(LogLevel::kWarning, "Backup AL context creation successful!"); + } + } + + // Android special case: if we fail, try OpenSL back-end. + if (!impl_->alc_context && g_buildconfig.ostype_android()) { + Log(LogLevel::kError, + "Failed second time creating AL context; trying OpenSL backend."); + { + std::scoped_lock lock(openalsoft_android_log_mutex_); + Log(LogLevel::kWarning, + "------------------------" + " OPENALSOFT-ERROR-LOG-BEGIN ----------------------\n" + + openalsoft_android_log_ + + "\n-------------------------" + " OPENALSOFT-ERROR-LOG-END -----------------------"); + openalsoft_android_log_.clear(); + } + alcCloseDevice(device); + g_core->platform->SetEnv("BA_OBOE_USE_OPENSLES", "1"); + device = alcOpenDevice(al_device_name); + alGetError(); // Clear any errors. + if (!device) { + std::scoped_lock lock(openalsoft_android_log_mutex_); + Log(LogLevel::kError, + "------------------------" + " OPENALSOFT-FATAL-ERROR-LOG-BEGIN ----------------------\n" + + openalsoft_android_log_ + + "\n-------------------------" + " OPENALSOFT-FATAL-ERROR-LOG-END -----------------------"); + openalsoft_android_log_.clear(); + FatalError("Fallback attempt 2 device create failed."); + } + impl_->alc_context = alcCreateContext(device, nullptr); + if (impl_->alc_context) { + // For now want to explicitly know if this works. + Log(LogLevel::kWarning, "Backup AL context creation 2 successful!"); + } + } + + // Fail at this point if we've got nothing. + if (!impl_->alc_context) { + if (g_buildconfig.ostype_android()) { + std::scoped_lock lock(openalsoft_android_log_mutex_); + Log(LogLevel::kError, + "------------------------" + " OPENALSOFT-FATAL-ERROR-LOG-BEGIN ----------------------\n" + + openalsoft_android_log_ + + "\n-------------------------" + " OPENALSOFT-FATAL-ERROR-LOG-END -----------------------"); + openalsoft_android_log_.clear(); } FatalError( "Unable to init audio. Do you have speakers/headphones/etc. " @@ -808,26 +908,60 @@ void AudioServer::ProcessDeviceDisconnects_(seconds_t real_time_seconds) { CHECK_AL_ERROR; if (connected == 0 && real_time_seconds - last_reset_attempt_time_ > 10.0) { Log(LogLevel::kInfo, "OpenAL device disconnected; resetting..."); + if (g_buildconfig.ostype_android()) { + std::scoped_lock lock(openalsoft_android_log_mutex_); + openalsoft_android_log_ += + "DEVICE DISCONNECT DETECTED; ATTEMPTING RESET\n"; + } last_reset_attempt_time_ = real_time_seconds; BA_PRECONDITION_FATAL(alcResetDeviceSOFT != nullptr); - alcResetDeviceSOFT(device, nullptr); + auto result = alcResetDeviceSOFT(device, nullptr); CHECK_AL_ERROR; - // Make noise if this ever fails to bring the device back. + 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; - // If we were successful, don't require a wait for the next reset. - // (otherwise plugging in headphones and then unplugging will stay quiet - // for 10 seconds). + // 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."); + } last_reset_attempt_time_ = -999.0; } - if (connected == 0 && !reported_reset_fail_) { - reported_reset_fail_ = true; - Log(LogLevel::kError, "alcResetDeviceSOFT failed to reconnect device."); + // 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, + "------------------------" + " OPENALSOFT-RECONNECT-LOG-BEGIN ----------------------\n" + + openalsoft_android_log_ + + "\n-------------------------" + " OPENALSOFT-RECONNECT-LOG-END -----------------------"); + 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 8f132eab..75edec2e 100644 --- a/src/ballistica/base/audio/audio_server.h +++ b/src/ballistica/base/audio/audio_server.h @@ -123,15 +123,16 @@ class AudioServer { bool suspended_{}; bool shutdown_completed_{}; bool shutting_down_{}; - bool reported_reset_fail_{}; + bool report_reset_results_{}; + int reset_result_reports_remaining_{3}; int al_source_count_{}; seconds_t last_reset_attempt_time_{-999.0}; seconds_t shutdown_start_time_{}; seconds_t last_started_playing_time_{}; millisecs_t last_sound_fade_process_time_{}; - std::mutex openalsoft_log_mutex_; - std::string openalsoft_log_; + std::mutex openalsoft_android_log_mutex_; + std::string openalsoft_android_log_; /// Indexed list of sources. std::vector sources_; diff --git a/src/ballistica/base/graphics/graphics.cc b/src/ballistica/base/graphics/graphics.cc index 53871876..77f30abf 100644 --- a/src/ballistica/base/graphics/graphics.cc +++ b/src/ballistica/base/graphics/graphics.cc @@ -385,7 +385,11 @@ void Graphics::DrawMiscOverlays(FrameDef* frame_def) { c.SetMaskUV2Texture(fps_text_group_->GetElementMaskUV2Texture(e)); } c.SetFlatness(1.0f); - c.DrawMesh(fps_text_group_->GetElementMesh(e)); + { + auto xf = c.ScopedTransform(); + c.Translate(6.0f, 6.0f, kScreenTextZDepth); + c.DrawMesh(fps_text_group_->GetElementMesh(e)); + } } c.Submit(); } @@ -418,7 +422,7 @@ void Graphics::DrawMiscOverlays(FrameDef* frame_def) { c.SetFlatness(1.0f); { auto xf = c.ScopedTransform(); - c.Translate(14.0f + (show_fps_ ? 30.0f : 0.0f), 0.1f, + c.Translate(6.0f + 14.0f + (show_fps_ ? 35.0f : 0.0f), 6.0f + 1.0f, kScreenTextZDepth); c.Scale(0.7f, 0.7f); c.DrawMesh(ping_text_group_->GetElementMesh(e)); diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index 1fb955d8..a3de8d2a 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 = 21728; +const int kEngineBuildNumber = 21735; const char* kEngineVersion = "1.7.32"; const int kEngineApiVersion = 8; diff --git a/tools/efrotools/openalbuild.py b/tools/efrotools/openalbuild.py index cfa7f225..36935c1d 100644 --- a/tools/efrotools/openalbuild.py +++ b/tools/efrotools/openalbuild.py @@ -47,6 +47,9 @@ def build_openal(arch: str, mode: str) -> None: # Inject a function to reroute OpenAL logs to ourself. reroute_logs = True + # Inject an env var to force Oboe to use OpenSL backend. + opensl_fallback_option = True + # Get ndk path. ndk_path = ( subprocess.run( @@ -71,7 +74,8 @@ def build_openal(arch: str, mode: str) -> None: 'git', 'checkout', # '1.23.1', - '1381a951bea78c67281a2e844e6db1dedbd5ed7c', + # '1381a951bea78c67281a2e844e6db1dedbd5ed7c', + 'bc83c874ff15b29fdab9b6c0bf40b268345b3026', ], check=True, cwd=builddir, @@ -92,11 +96,69 @@ def build_openal(arch: str, mode: str) -> None: ) subprocess.run(['git', 'checkout', '1.8.0'], check=True, cwd=builddir_oboe) - # One bit of filtering: by default, openalsoft sends all sorts of - # log messages to the android log. This is reasonable since its - # possible to filter by tag/level. However I'd prefer it to send - # only the ones that it would send to stderr so I don't always have - # to worry about filtering. + if opensl_fallback_option: + oboepath = f'{builddir}/alc/backends/oboe.cpp' + with open(oboepath, encoding='utf-8') as infile: + txt = infile.read() + + # Also disable opening a stream just to test that it works. + txt = replace_exact( + txt, + ( + ' /* Open a basic output stream, just to ensure' + ' it can work. */\n' + ' oboe::ManagedStream stream;\n' + ' oboe::Result result{oboe::AudioStreamBuilder{}' + '.setDirection(oboe::Direction::Output)\n' + ' ->setPerformanceMode(oboe::PerformanceMode::' + 'LowLatency)\n' + ' ->openManagedStream(stream)};\n' + ' if(result != oboe::Result::OK)\n' + ' throw al::backend_exception{al::backend_error::' + 'DeviceError, "Failed to create stream: %s",\n' + ' oboe::convertToText(result)};\n' + ), + ( + ' /* Open a basic output stream, just to ensure' + ' it can work. */\n' + ' // DISABLED BY ERICF\n' + ' // oboe::ManagedStream stream;\n' + ' // oboe::Result result{oboe::AudioStreamBuilder{}' + '.setDirection(oboe::Direction::Output)\n' + ' // ->setPerformanceMode(oboe::PerformanceMode::' + 'LowLatency)\n' + ' // ->openManagedStream(stream)};\n' + ' // if(result != oboe::Result::OK)\n' + ' // throw al::backend_exception{al::backend_error::' + 'DeviceError, "Failed to create stream: %s",\n' + ' // 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' + ), + ) + + with open(oboepath, 'w', encoding='utf-8') as outfile: + outfile.write(txt) + + # By default, openalsoft sends all sorts of log messages to the + # android log. This is reasonable since its possible to filter by + # tag/level. However I'd prefer it to send only the ones that it + # would send to stderr so I don't always have to worry about + # filtering. if reduce_logs or reroute_logs: loggingpath = f'{builddir}/core/logging.cpp' with open(loggingpath, encoding='utf-8') as infile: