From 586db8bd5ecc1df668fdc65abb503582356d1657 Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 31 Oct 2023 21:34:59 -0700 Subject: [PATCH] implemented language autoselect for new apple builds --- .efrocachemap | 94 +++++++++---------- CHANGELOG.md | 2 +- config/spinoffconfig.py | 1 + src/assets/ba_data/python/babase/__init__.py | 2 - .../ba_data/python/baclassic/macmusicapp.py | 8 +- src/assets/ba_data/python/baenv.py | 2 +- .../base/app_adapter/app_adapter.cc | 23 ----- src/ballistica/base/app_adapter/app_adapter.h | 6 +- .../base/app_adapter/app_adapter_sdl.cc | 7 +- src/ballistica/base/base.cc | 4 + src/ballistica/base/base.h | 2 + src/ballistica/base/input/input.cc | 18 ++-- src/ballistica/base/input/input.h | 2 +- .../base/python/methods/python_methods_app.cc | 20 ---- src/ballistica/base/ui/dev_console.cc | 7 +- .../platform/apple/core_platform_apple.cc | 20 ++-- .../core/platform/apple/core_platform_apple.h | 8 +- src/ballistica/core/platform/core_platform.cc | 4 - src/ballistica/core/platform/core_platform.h | 5 +- src/ballistica/core/support/base_soft.h | 1 + src/ballistica/shared/ballistica.cc | 2 +- .../shared/foundation/fatal_error.cc | 58 +++++++----- tools/batools/xcodeproject.py | 10 +- 23 files changed, 143 insertions(+), 163 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 4d5f5d4d..800cb9af 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -424,7 +424,7 @@ "build/assets/ba_data/data/langdata.json": "0b15d171ebcc56d324875b48436b58c2", "build/assets/ba_data/data/languages/arabic.json": "c21378ee214a9dd0cb2971cd46b74374", "build/assets/ba_data/data/languages/belarussian.json": "4d89ed5f9c615771d4fa2bb1834942d3", - "build/assets/ba_data/data/languages/chinese.json": "0a9d9534e7329d1e886adae6fdc007c4", + "build/assets/ba_data/data/languages/chinese.json": "1ff4350df6d81c3b1b765fddace6b4c8", "build/assets/ba_data/data/languages/chinesetraditional.json": "f858da49be0a5374157c627857751078", "build/assets/ba_data/data/languages/croatian.json": "766532c67af5bd0144c2d63cab0516fa", "build/assets/ba_data/data/languages/czech.json": "93c5fe0d884d95435da6c675f64e30e0", @@ -439,12 +439,12 @@ "build/assets/ba_data/data/languages/greek.json": "287c0ec437b38772284ef9d3e4fb2fc3", "build/assets/ba_data/data/languages/hindi.json": "8ea0c58a44a24edb131d0e53b074d1f6", "build/assets/ba_data/data/languages/hungarian.json": "796a290a8c44a1e7635208c2ff5fdc6e", - "build/assets/ba_data/data/languages/indonesian.json": "d7f1cafecad05e0dcd34345e0088c4de", + "build/assets/ba_data/data/languages/indonesian.json": "15a50690e5588d4acd3e07dfdaf755b0", "build/assets/ba_data/data/languages/italian.json": "e4acd4e58ef8db78f3369bf881f84c55", "build/assets/ba_data/data/languages/korean.json": "ca1122a9ee551da3f75ae632012bd0e2", "build/assets/ba_data/data/languages/malay.json": "832562ce997fc70704b9234c95fb2e38", "build/assets/ba_data/data/languages/persian.json": "4585070bd509600019ec8dc3bb47bfb8", - "build/assets/ba_data/data/languages/polish.json": "6677925c370390f1f53bcb737cb00fa8", + "build/assets/ba_data/data/languages/polish.json": "5e25428554893155a5f81f3eeb418bae", "build/assets/ba_data/data/languages/portuguese.json": "51e362956f89da3eec980f587c092253", "build/assets/ba_data/data/languages/romanian.json": "aeebdd54f65939c2facc6ac50c117826", "build/assets/ba_data/data/languages/russian.json": "6e524210149d95479d6cbfd3506c630b", @@ -4056,50 +4056,50 @@ "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": "ad6316e04f09de546d25171512f783b2", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "19495e4313121d5574ab69efcbbcedd7", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "d8f215de52d492ce1790d9e1714b4cec", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "b057d6d9627c7400496080c48dd344cd", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "1bd60c4476b7471364be2534d3cb8185", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "011bceb35c7f53b98f2ab79798409679", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "0055dfac758acdeb5a39e436da5d71be", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "2daa69d1df9927e6fc17b0aabd5c62f6", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "2159ce4b648b1172e3d2f349e61f2b1b", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "26163f755e45586da35c1ed6499c0416", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "410c70d8d833458616a0056972e558c4", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "6e4473952a022e30340b6decae9da58a", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "0c63291b5842dafcfae558ef3c36d35a", - "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "7195da4e4abae862f41c28764b35662b", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "5a6ad8a9f0d5cd964661df32ac4efb47", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "376059ea5f812ace7629ad29a8d77a9a", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "7a0c87d9e673b28157845f71ff957df6", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "3603019e3dbf055c37f5fabbe9538c48", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "14f6e17cc5698341ed5607834107e608", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "679703f9ec7c6f9c0708c9b13c9c6c06", - "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "e4952c83427611c5a66a864d8bb3bc4f", - "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "55df380ad6f3b38094bc82f6bb2a34bb", - "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "e4952c83427611c5a66a864d8bb3bc4f", - "build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "55df380ad6f3b38094bc82f6bb2a34bb", - "build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "f37c917e8336be6afe86842fc0cd1586", - "build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "aaf0413c15988e332d27b7fd6eb1ba1f", - "build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "f37c917e8336be6afe86842fc0cd1586", - "build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "aaf0413c15988e332d27b7fd6eb1ba1f", - "build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "f66008360fc266ada358731656dfa91a", - "build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "712cd1dda7661826129b8023949ebebe", - "build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "f66008360fc266ada358731656dfa91a", - "build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "712cd1dda7661826129b8023949ebebe", - "build/prefab/lib/mac_x86_64_gui/debug/libballisticaplus.a": "5488eb05a8c45904243ff5cb1fc483cd", - "build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "55aef97c30ade6b21e93b7d8a45ae670", - "build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "519d0d2895489e5905e65e53384b96ba", - "build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "55aef97c30ade6b21e93b7d8a45ae670", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "c9e82195e722512599ec7edcb456c78d", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "18b47849e222dd7b1bef9bd1a07473c9", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "6c44557f5392bb3cd2d9a983add52d0b", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "0bd4099b6b594f62b806c9d74a84095a", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "a36752eee64f76c1868937247aaaee32", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "9ac33f02579ee14e4ad6a0b6b5a82a36", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "87bc0ff42442b60c817805ab07c65769", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "cedd1f2c367b84c20377c282453825f2", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "437a7184a3f56da917ec92e0f1d08392", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "c990f7765be45e603eaa1040a11d20f2", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "b891b240768e0c1961d82a05357f36fb", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "7778d9df2d0c4e07d2ea46b3c6b8ca1f", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "eac8b98c72cd8edbf1ed97237052ac05", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "6ee06879d656a68802dc42c483ea5a2b", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "58b8437cc04dbc63587e8c379bcdb316", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "40422d250bc84faf876642f8c6181132", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "0c5d44d847c3df3178e5b890c234bccd", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "8e58ab0f0faa58b6bdc8130062171a1d", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "18e33eab40af6efc10454206249b5b91", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "0465c41b9364c56494768ac41766529b", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "2bb0a2f4402ee90e1c2e03f75dd6e090", + "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "328d7b3a7ce3564dc7d1b4f315842291", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "079097fc77e50024f6231de94c9e1fbc", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "9bb781a88ecddf84ca84cbdc14ee0a78", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "17ca9956767731b2cce7c12ec15e37f4", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "c0c9a0e54434f54bad8cd057bacab4e2", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "ab77f95bd46cae158aaccd53091c3bfb", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "bd05a3124893ff649a48afc6ff9fdf20", + "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "d9f919fe87d497529cd8aed24a961ea3", + "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "56972014971024060e6014c2027debd2", + "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "d9f919fe87d497529cd8aed24a961ea3", + "build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "56972014971024060e6014c2027debd2", + "build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "3b0da9dfd7b2efe967aaafd3e68d4a86", + "build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "d4889e0f44a762e4bf067af33e8885e1", + "build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "3b0da9dfd7b2efe967aaafd3e68d4a86", + "build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "d4889e0f44a762e4bf067af33e8885e1", + "build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "5d6b77d2280ad8366f1386f7af0d8e6b", + "build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "0c8ab52403a77eb7a11137afb6946f8b", + "build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "5d6b77d2280ad8366f1386f7af0d8e6b", + "build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "0c8ab52403a77eb7a11137afb6946f8b", + "build/prefab/lib/mac_x86_64_gui/debug/libballisticaplus.a": "85ab9b2e82eb2ddca6e915b4a3c3589e", + "build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "39a0f3efabd9d2f62202ef9790e5cecd", + "build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "2609429078b69b48c3cda49abac7065c", + "build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "39a0f3efabd9d2f62202ef9790e5cecd", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "7f3de02f9481408b02ebfd1253452b30", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "a56a0aecab25961be71f364bd29eecaf", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "cbc394d29f300aac67374c586f07e3dd", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "ceba6e421ed2ccd51114bfdd239881d9", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "eaa568b2aee0f4cd4e186cee7ac98a9a", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "e13fdefc582d9c86a3b5f9cb4e5781f5", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "1f1065b864ddd2e6b376835c09bf809b", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "9eab26a8053f011ab0247e67bf59ecf3", "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": "6df0f34207346d89a72924249ddd4706", diff --git a/CHANGELOG.md b/CHANGELOG.md index ad501f17..827e1817 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.28 (build 21543, api 8, 2023-10-31) +### 1.7.28 (build 21551, api 8, 2023-10-31) - Massively cleaned up code related to rendering and window systems (OpenGL, SDL, etc). This code had been growing into a nasty tangle for 15 years diff --git a/config/spinoffconfig.py b/config/spinoffconfig.py index 490697b0..3fe2bca1 100644 --- a/config/spinoffconfig.py +++ b/config/spinoffconfig.py @@ -274,6 +274,7 @@ ctx.filter_file_extensions = { '.frag', '.vert', '.xcsettings', + '.xcstrings', '.filters', } diff --git a/src/assets/ba_data/python/babase/__init__.py b/src/assets/ba_data/python/babase/__init__.py index e15a774a..a511d570 100644 --- a/src/assets/ba_data/python/babase/__init__.py +++ b/src/assets/ba_data/python/babase/__init__.py @@ -64,7 +64,6 @@ from _babase import ( is_running_on_fire_tv, is_xcode_build, lock_all_input, - mac_music_app_get_library_source, mac_music_app_get_playlists, mac_music_app_get_volume, mac_music_app_init, @@ -265,7 +264,6 @@ __all__ = [ 'lock_all_input', 'LoginAdapter', 'Lstr', - 'mac_music_app_get_library_source', 'mac_music_app_get_playlists', 'mac_music_app_get_volume', 'mac_music_app_init', diff --git a/src/assets/ba_data/python/baclassic/macmusicapp.py b/src/assets/ba_data/python/baclassic/macmusicapp.py index 1b87fbf1..27b0e126 100644 --- a/src/assets/ba_data/python/baclassic/macmusicapp.py +++ b/src/assets/ba_data/python/baclassic/macmusicapp.py @@ -80,14 +80,13 @@ class _MacMusicAppThread(threading.Thread): def run(self) -> None: """Run the Music.app thread.""" babase.set_thread_name('BA_MacMusicAppThread') - babase.mac_music_app_init() # Let's mention to the user we're launching Music.app in case # it causes any funny business (this used to background the app # sometimes, though I think that is fixed now) def do_print() -> None: babase.apptimer( - 1.0, + 0.5, babase.Call( babase.screenmessage, babase.Lstr(resource='usingItunesText'), @@ -97,9 +96,8 @@ class _MacMusicAppThread(threading.Thread): babase.pushcall(do_print, from_other_thread=True) - # Here we grab this to force the actual launch. - babase.mac_music_app_get_volume() - babase.mac_music_app_get_library_source() + babase.mac_music_app_init() + done = False while not done: self._commands_available.wait() diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index f3969a7d..963ee465 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 = 21543 +TARGET_BALLISTICA_BUILD = 21551 TARGET_BALLISTICA_VERSION = '1.7.28' diff --git a/src/ballistica/base/app_adapter/app_adapter.cc b/src/ballistica/base/app_adapter/app_adapter.cc index b781b04b..7aba2807 100644 --- a/src/ballistica/base/app_adapter/app_adapter.cc +++ b/src/ballistica/base/app_adapter/app_adapter.cc @@ -20,31 +20,8 @@ AppAdapter::~AppAdapter() = default; auto AppAdapter::ManagesMainThreadEventLoop() const -> bool { return true; } void AppAdapter::OnMainThreadStartApp() { - assert(g_base); assert(g_core); assert(g_core->InMainThread()); - - // Add some common input devices where applicable. More specific ones (SDL - // Joysticks, etc.) get added in subclasses. - - // FIXME: This stuff should probably go elsewhere. - if (!g_core->HeadlessMode()) { - // If we've got a nice themed hardware cursor, show it. Otherwise we'll - // render it manually, which is laggier but gets the job done. - // g_base->platform->SetHardwareCursorVisible(g_buildconfig.hardware_cursor()); - - // On desktop systems we just assume keyboard input exists and add it - // immediately. - if (g_core->platform->IsRunningOnDesktop()) { - g_base->input->PushCreateKeyboardInputDevices(); - } - - // On non-tv, non-desktop, non-vr systems, create a touchscreen input. - if (!g_core->platform->IsRunningOnTV() && !g_core->IsVRMode() - && !g_core->platform->IsRunningOnDesktop()) { - g_base->input->CreateTouchInput(); - } - } } void AppAdapter::OnAppStart() { assert(g_base->InLogicThread()); } diff --git a/src/ballistica/base/app_adapter/app_adapter.h b/src/ballistica/base/app_adapter/app_adapter.h index 6570d8a4..5c2ce998 100644 --- a/src/ballistica/base/app_adapter/app_adapter.h +++ b/src/ballistica/base/app_adapter/app_adapter.h @@ -222,9 +222,6 @@ class AppAdapter { /// clipboard is unsupported or if there's no text on the clipboard. auto ClipboardGetText() -> std::string; - protected: - virtual ~AppAdapter(); - /// Push a raw pointer Runnable to the platform's 'main' thread. The main /// thread should call its RunAndLogErrors() method and then delete it. virtual void DoPushMainThreadRunnable(Runnable* runnable) = 0; @@ -233,6 +230,9 @@ class AppAdapter { /// context. By default this is simply the main thread. virtual void DoPushGraphicsContextRunnable(Runnable* runnable); + protected: + virtual ~AppAdapter(); + virtual auto DoClipboardIsSupported() -> bool; virtual auto DoClipboardHasText() -> bool; virtual void DoClipboardSetText(const std::string& text); diff --git a/src/ballistica/base/app_adapter/app_adapter_sdl.cc b/src/ballistica/base/app_adapter/app_adapter_sdl.cc index 5c432800..6921f82d 100644 --- a/src/ballistica/base/app_adapter/app_adapter_sdl.cc +++ b/src/ballistica/base/app_adapter/app_adapter_sdl.cc @@ -51,6 +51,8 @@ AppAdapterSDL::AppAdapterSDL() { } void AppAdapterSDL::OnMainThreadStartApp() { + AppAdapter::OnMainThreadStartApp(); + // App is starting. Let's fire up the ol' SDL. uint32_t sdl_flags{SDL_INIT_VIDEO | SDL_INIT_JOYSTICK}; @@ -79,9 +81,8 @@ void AppAdapterSDL::OnMainThreadStartApp() { sdl_runnable_event_id_ = SDL_RegisterEvents(1); assert(sdl_runnable_event_id_ != (uint32_t)-1); - // Note: parent class can add some input devices so need to bring up sdl - // before we let it run. That code should maybe be relocated/refactored. - AppAdapter::OnMainThreadStartApp(); + // SDL builds just assume keyboard input is available. + g_base->input->PushCreateKeyboardInputDevices(); if (g_buildconfig.enable_sdl_joysticks()) { // We want events from joysticks. diff --git a/src/ballistica/base/base.cc b/src/ballistica/base/base.cc index 00953ffa..644d3125 100644 --- a/src/ballistica/base/base.cc +++ b/src/ballistica/base/base.cc @@ -722,4 +722,8 @@ void BaseFeatureSet::QuitApp(bool confirm, QuitType quit_type) { } } +void BaseFeatureSet::PushMainThreadRunnable(Runnable* runnable) { + app_adapter->DoPushMainThreadRunnable(runnable); +} + } // namespace ballistica::base diff --git a/src/ballistica/base/base.h b/src/ballistica/base/base.h index 2503a134..c452e739 100644 --- a/src/ballistica/base/base.h +++ b/src/ballistica/base/base.h @@ -723,6 +723,8 @@ class BaseFeatureSet : public FeatureSetNativeComponent, /// loading. void OnAssetsAvailable(); + void PushMainThreadRunnable(Runnable* runnable) override; + // Const subsystems. AppAdapter* const app_adapter; AppConfig* const app_config; diff --git a/src/ballistica/base/input/input.cc b/src/ballistica/base/input/input.cc index 5b33f2a4..fe66c1a9 100644 --- a/src/ballistica/base/input/input.cc +++ b/src/ballistica/base/input/input.cc @@ -144,12 +144,9 @@ auto Input::GetNewNumberedIdentifier_(const std::string& name, return full_id; } -void Input::CreateTouchInput() { - assert(g_core->InMainThread()); - assert(touch_input_ == nullptr); - touch_input_ = Object::NewDeferred(); - PushAddInputDeviceCall(touch_input_, false); -} +// void Input::CreateTouchInput() { +// assert(g_core->InMainThread()); +// } void Input::AnnounceConnects_() { assert(g_base->InLogicThread()); @@ -559,7 +556,14 @@ void Input::UpdateEnabledControllerSubsystems_() { // } } -void Input::OnAppStart() { assert(g_base->InLogicThread()); } +void Input::OnAppStart() { + assert(g_base->InLogicThread()); + if (g_core->platform->HasTouchScreen()) { + assert(touch_input_ == nullptr); + touch_input_ = Object::NewDeferred(); + PushAddInputDeviceCall(touch_input_, false); + } +} void Input::OnAppPause() { assert(g_base->InLogicThread()); } diff --git a/src/ballistica/base/input/input.h b/src/ballistica/base/input/input.h index 9c33ecd2..aa404385 100644 --- a/src/ballistica/base/input/input.h +++ b/src/ballistica/base/input/input.h @@ -116,7 +116,7 @@ class Input { auto HaveRemoteAppController() -> bool; auto keyboard_input() const -> KeyboardInput* { return keyboard_input_; } auto keyboard_input_2() const -> KeyboardInput* { return keyboard_input_2_; } - void CreateTouchInput(); + // void CreateTouchInput(); void PushTextInputEvent(const std::string& text); void PushKeyPressEventSimple(int keycode); diff --git a/src/ballistica/base/python/methods/python_methods_app.cc b/src/ballistica/base/python/methods/python_methods_app.cc index 265906fd..2d13c813 100644 --- a/src/ballistica/base/python/methods/python_methods_app.cc +++ b/src/ballistica/base/python/methods/python_methods_app.cc @@ -1088,25 +1088,6 @@ static PyMethodDef PyMacMusicAppSetVolumeDef = { "(internal)", }; -// ------------------------ mac_music_app_get_library -------------------------- - -static auto PyMacMusicAppGetLibrarySource(PyObject* self, PyObject* args, - PyObject* keywds) -> PyObject* { - BA_PYTHON_TRY; - g_core->platform->MacMusicAppGetLibrarySource(); - Py_RETURN_NONE; - BA_PYTHON_CATCH; -} - -static PyMethodDef PyMacMusicAppGetLibrarySourceDef = { - "mac_music_app_get_library_source", // name - (PyCFunction)PyMacMusicAppGetLibrarySource, // method - METH_VARARGS | METH_KEYWORDS, // flags - - "mac_music_app_get_library_source() -> None\n" - "\n" - "(internal)"}; - // --------------------------- mac_music_app_stop ------------------------------ static auto PyMacMusicAppStop(PyObject* self, PyObject* args, PyObject* keywds) @@ -1695,7 +1676,6 @@ auto PythonMethodsApp::GetMethods() -> std::vector { PyMacMusicAppInitDef, PyMacMusicAppGetVolumeDef, PyMacMusicAppSetVolumeDef, - PyMacMusicAppGetLibrarySourceDef, PyMacMusicAppStopDef, PyMacMusicAppPlayPlaylistDef, PyMacMusicAppGetPlaylistsDef, diff --git a/src/ballistica/base/ui/dev_console.cc b/src/ballistica/base/ui/dev_console.cc index 1f0ccab8..7ea9fd67 100644 --- a/src/ballistica/base/ui/dev_console.cc +++ b/src/ballistica/base/ui/dev_console.cc @@ -1295,7 +1295,10 @@ void DevConsole::Draw(FrameDef* frame_def) { } // Carat. - if (!carat_mesh_.Exists()) { + if (!carat_mesh_.Exists() || carat_dirty_) { + // Note: we explicitly update here if carat is dirty because + // that updates last_carat_change_time_ which affects whether + // we draw or not. GetCaratX_() only updates it *if* we draw. UpdateCarat_(); } millisecs_t app_time = pass->frame_def()->app_time_millisecs(); @@ -1457,6 +1460,7 @@ auto DevConsole::PasteFromClipboard() -> bool { } void DevConsole::UpdateCarat_() { + last_carat_x_change_time_ = g_core->GetAppTimeMillisecs(); auto unichars = Utils::UnicodeFromUTF8(input_string_, "fjfwef"); auto unichars_clamped = unichars; @@ -1508,7 +1512,6 @@ void DevConsole::UpdateCarat_() { auto DevConsole::GetCaratX_() -> float { if (carat_dirty_) { - last_carat_x_change_time_ = g_core->GetAppTimeMillisecs(); UpdateCarat_(); carat_dirty_ = false; } diff --git a/src/ballistica/core/platform/apple/core_platform_apple.cc b/src/ballistica/core/platform/apple/core_platform_apple.cc index 5c9d4cd6..2ddce42d 100644 --- a/src/ballistica/core/platform/apple/core_platform_apple.cc +++ b/src/ballistica/core/platform/apple/core_platform_apple.cc @@ -10,7 +10,6 @@ #include #if BA_XCODE_BUILD -#include "ballistica/base/platform/apple/apple_utils.h" #include "ballistica/base/platform/apple/from_swift.h" #include "ballistica/shared/math/rect.h" #endif @@ -358,14 +357,6 @@ void CorePlatformApple::MacMusicAppSetVolume(int volume) { #endif } -// KILL THIS. -void CorePlatformApple::MacMusicAppGetLibrarySource() { -#if BA_OSTYPE_MACOS && BA_XCODE_BUILD - // base::AppleUtils::MacMusicAppGetLibrarySource(); -#else - CorePlatform::MacMusicAppGetLibrarySource(); -#endif -} void CorePlatformApple::MacMusicAppStop() { #if BA_OSTYPE_MACOS && BA_XCODE_BUILD return BallisticaKit::CocoaFromCpp::MacMusicAppStop(); @@ -422,6 +413,17 @@ auto CorePlatformApple::GetSubplatformName() -> std::string { #endif } +auto CorePlatformApple::GetLocale() -> std::string { +#if BA_XCODE_BUILD + if (!locale_.has_value()) { + locale_ = std::string(BallisticaKit::FromCpp::GetLocaleString()); + } + return *locale_; +#else + return CorePlatform::GetLocale(); +#endif +} + } // namespace ballistica::core #endif // BA_OSTYPE_MACOS || BA_OSTYPE_IOS_TVOS diff --git a/src/ballistica/core/platform/apple/core_platform_apple.h b/src/ballistica/core/platform/apple/core_platform_apple.h index bfbb019e..000f79f1 100644 --- a/src/ballistica/core/platform/apple/core_platform_apple.h +++ b/src/ballistica/core/platform/apple/core_platform_apple.h @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -42,8 +43,6 @@ class CorePlatformApple : public CorePlatform { -> bool override; void ShowOnlineScoreUI(const std::string& show, const std::string& game, const std::string& game_version) override; - // auto NewAutoReleasePool() -> void* override; - // void DrainAutoReleasePool(void* pool) override; void ResetAchievements() override; void GameCenterLogin() override; auto IsOSPlayingMusic() -> bool override; @@ -52,7 +51,6 @@ class CorePlatformApple : public CorePlatform { void MacMusicAppInit() override; auto MacMusicAppGetVolume() -> int override; void MacMusicAppSetVolume(int volume) override; - void MacMusicAppGetLibrarySource() override; void MacMusicAppStop() override; auto MacMusicAppPlayPlaylist(const std::string& playlist) -> bool override; auto MacMusicAppGetPlaylists() -> std::list override; @@ -60,9 +58,13 @@ class CorePlatformApple : public CorePlatform { auto GetSubplatformName() -> std::string override; auto GetDeviceUUIDInputs() -> std::list override; + auto GetLocale() -> std::string override; protected: auto DoGetDataDirectoryMonolithicDefault() -> std::string override; + + private: + std::optional locale_; }; } // namespace ballistica::core diff --git a/src/ballistica/core/platform/core_platform.cc b/src/ballistica/core/platform/core_platform.cc index f4303b89..787b517f 100644 --- a/src/ballistica/core/platform/core_platform.cc +++ b/src/ballistica/core/platform/core_platform.cc @@ -814,10 +814,6 @@ void CorePlatform::MacMusicAppSetVolume(int volume) { Log(LogLevel::kError, "MacMusicAppSetVolume() unimplemented"); } -void CorePlatform::MacMusicAppGetLibrarySource() { - Log(LogLevel::kError, "MacMusicAppGetLibrarySource() unimplemented"); -} - void CorePlatform::MacMusicAppStop() { Log(LogLevel::kError, "MacMusicAppStop() unimplemented"); } diff --git a/src/ballistica/core/platform/core_platform.h b/src/ballistica/core/platform/core_platform.h index 96a1bbe8..03a5d20a 100644 --- a/src/ballistica/core/platform/core_platform.h +++ b/src/ballistica/core/platform/core_platform.h @@ -211,10 +211,9 @@ class CorePlatform { virtual void MacMusicAppInit(); virtual auto MacMusicAppGetVolume() -> int; virtual void MacMusicAppSetVolume(int volume); - virtual void MacMusicAppGetLibrarySource(); - virtual void MacMusicAppStop(); - virtual auto MacMusicAppPlayPlaylist(const std::string& playlist) -> bool; virtual auto MacMusicAppGetPlaylists() -> std::list; + virtual auto MacMusicAppPlayPlaylist(const std::string& playlist) -> bool; + virtual void MacMusicAppStop(); #pragma mark TEXT RENDERING ---------------------------------------------------- diff --git a/src/ballistica/core/support/base_soft.h b/src/ballistica/core/support/base_soft.h index 31c83d30..1a9ba259 100644 --- a/src/ballistica/core/support/base_soft.h +++ b/src/ballistica/core/support/base_soft.h @@ -44,6 +44,7 @@ class BaseSoftInterface { virtual auto IsAppStarted() const -> bool = 0; virtual auto IsAppBootstrapped() const -> bool = 0; virtual auto GetReturnValue() const -> int = 0; + virtual void PushMainThreadRunnable(Runnable* runnable) = 0; }; } // namespace ballistica::core diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index 57058bcc..eb9b8922 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 = 21543; +const int kEngineBuildNumber = 21551; const char* kEngineVersion = "1.7.28"; const int kEngineApiVersion = 8; diff --git a/src/ballistica/shared/foundation/fatal_error.cc b/src/ballistica/shared/foundation/fatal_error.cc index 71bac44c..967e6a30 100644 --- a/src/ballistica/shared/foundation/fatal_error.cc +++ b/src/ballistica/shared/foundation/fatal_error.cc @@ -5,6 +5,8 @@ #include "ballistica/core/platform/core_platform.h" #include "ballistica/core/support/base_soft.h" #include "ballistica/shared/foundation/logging.h" +#include "ballistica/shared/generic/lambda_runnable.h" +#include "ballistica/shared/python/python.h" namespace ballistica { @@ -131,32 +133,38 @@ void FatalError::DoBlockingFatalErrorDialog(const std::string& message) { // done. if (g_core->InMainThread()) { g_core->platform->BlockingFatalErrorDialog(message); - } else { - printf("FIXME REIMPLEMENT BLOCKING FATAL ERROR FOR BG THREAD\n"); - // bool started{}; - // bool finished{}; - // bool* startedptr{&started}; - // bool* finishedptr{&finished}; - // g_core->main_event_loop()->PushCall([message, startedptr, finishedptr] { - // *startedptr = true; - // g_core->platform->BlockingFatalErrorDialog(message); - // *finishedptr = true; - // }); + } else if (g_base_soft) { + bool started{}; + bool finished{}; + bool* startedptr{&started}; + bool* finishedptr{&finished}; - // // Wait a short amount of time for the main thread to take action. - // // There's a chance that it can't (if threads are paused, if it is - // // blocked on a synchronous call to another thread, etc.) so if we don't - // // see something happening soon, just give up on showing a dialog. - // auto starttime = core::CorePlatform::GetCurrentMillisecs(); - // while (!started) { - // if (core::CorePlatform::GetCurrentMillisecs() - starttime > 1000) { - // return; - // } - // core::CorePlatform::SleepMillisecs(10); - // } - // while (!finished) { - // core::CorePlatform::SleepMillisecs(10); - // } + // If our thread is holding the GIL, release it to give the main + // thread a better chance to get to the point of displaying the fatal error. + if (Python::HaveGIL()) { + Python::PermanentlyReleaseGIL(); + } + g_base_soft->PushMainThreadRunnable( + NewLambdaRunnableUnmanaged([message, startedptr, finishedptr] { + *startedptr = true; + g_core->platform->BlockingFatalErrorDialog(message); + *finishedptr = true; + })); + + // Wait a short amount of time for the main thread to take action. + // There's a chance that it can't (if threads are paused, if it is + // blocked on a synchronous call to another thread, etc.) so if we don't + // see something happening soon, just give up on showing a dialog. + auto starttime = core::CorePlatform::GetCurrentMillisecs(); + while (!started) { + if (core::CorePlatform::GetCurrentMillisecs() - starttime > 3000) { + return; + } + core::CorePlatform::SleepMillisecs(10); + } + while (!finished) { + core::CorePlatform::SleepMillisecs(10); + } } } diff --git a/tools/batools/xcodeproject.py b/tools/batools/xcodeproject.py index 42ba6339..0d331df6 100644 --- a/tools/batools/xcodeproject.py +++ b/tools/batools/xcodeproject.py @@ -416,11 +416,15 @@ class Updater: ) def _target_names_for_file(self, filename: str) -> list[str] | None: - # Cocoa stuff only applies to our macOS build. + # Cocoa stuff only applies to our macOS targets. if filename.startswith('Cocoa') and filename.endswith('.swift'): - return [f'{self.pnameu} macOS'] + return [ + f'{self.pnameu} macOS TestBuild', + f'{self.pnameu} macOS AppStore', + f'{self.pnameu} macOS Steam', + ] - # UIKit stuff applies to our iOS/tvOS builds. + # UIKit stuff applies to our iOS/tvOS targets. if filename.startswith('UIKit') and filename.endswith('.swift'): return [f'{self.pnameu} iOS', f'{self.pnameu} tvOS']