From 0dbe83498722770842775f55667ccf0fafabed1d Mon Sep 17 00:00:00 2001 From: Eric Date: Sun, 18 Jun 2023 12:58:54 -0700 Subject: [PATCH] fixed quit-on-idle for servers --- .efrocachemap | 88 +++++++++---------- CHANGELOG.md | 6 +- .../ba_data/python/baclassic/_servermode.py | 4 +- src/assets/ba_data/python/baenv.py | 2 +- src/ballistica/base/app/app.cc | 4 +- src/ballistica/base/app/app.h | 4 +- src/ballistica/base/app/app_mode.cc | 2 +- src/ballistica/base/app/app_mode.h | 2 +- src/ballistica/base/audio/audio.cc | 2 +- src/ballistica/base/audio/audio.h | 2 +- src/ballistica/base/base.cc | 5 ++ src/ballistica/base/graphics/graphics.cc | 2 +- src/ballistica/base/graphics/graphics.h | 2 +- src/ballistica/base/input/input.cc | 2 +- src/ballistica/base/input/input.h | 2 +- src/ballistica/base/logic/logic.cc | 18 ++-- src/ballistica/base/networking/networking.cc | 2 +- src/ballistica/base/networking/networking.h | 2 +- src/ballistica/base/python/base_python.cc | 2 +- src/ballistica/base/python/base_python.h | 2 +- .../base/python/methods/python_methods_app.cc | 2 +- src/ballistica/base/support/plus_soft.h | 2 +- src/ballistica/base/support/ui_v1_soft.h | 2 +- src/ballistica/base/ui/ui.cc | 4 +- src/ballistica/base/ui/ui.h | 2 +- src/ballistica/core/platform/core_platform.cc | 2 +- src/ballistica/core/platform/core_platform.h | 2 +- .../scene_v1/support/scene_v1_app_mode.cc | 8 +- .../scene_v1/support/scene_v1_app_mode.h | 2 +- src/ballistica/shared/ballistica.cc | 2 +- src/ballistica/ui_v1/ui_v1.cc | 2 +- src/ballistica/ui_v1/ui_v1.h | 2 +- 32 files changed, 98 insertions(+), 89 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 07fb3f46..d4c4bdb4 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4072,50 +4072,50 @@ "build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/18/4b/787a9267e17be3c49966072581a5", "build/assets/workspace/onslaughtplug.py": "https://files.ballistica.net/cache/ba1/20/f6/4ce9bc3c1f3732f6adf8237fbe9b", "build/assets/workspace/runaroundplug.py": "https://files.ballistica.net/cache/ba1/a5/30/9058181df0b1255bf6950cbc7813", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/6a/42/b88d197a3de29d53a0600cbdb1ef", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/fa/12/fae2e5f0e89b2fdc4714bda6a1dc", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/4a/12/b66634b220927006c073fb33b4e0", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/de/91/eac9be7e7861cd3c55c57b26f064", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/13/48/b56c565b9a6712ed90f1d9dddd38", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/10/5e/06d49fe4b2e8fd829fb2ba323777", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/90/a7/ed96ee574a40d39a709111314564", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/46/f5/b98511cefe587edc2eddefdd7bf8", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/60/1f/f7632a84d7cd682cece84081a965", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/e2/e0/32e13cf436b16fc08aada5a5f0f3", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/ec/7e/ced54c19d29156862beb951acbcd", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/7c/08/b01016388bc443adce61506f757f", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/de/b2/467bab2e5ee702c05043550bf554", - "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/ea/da/219a2c518298c5bf00e9918b62d9", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/ca/bb/30a2598c3aad8d687e4d7a56c868", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/a8/d9/452bce81d43a544880dba9a7a84f", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/3c/a0/3ab7920b1225d42a5b127dce394b", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/ce/e0/5aac96f6aef80f2da1e4eb7318f7", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/f7/73/432ddfcab5d37e893350a21bb42e", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/92/7a/976a6f97db199315dc35b40e052a", - "build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/2f/47/41725589da4deec95cee1aadb5d7", - "build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/9c/43/013d60c82f071e30f6628d8a8c53", - "build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/63/1b/74234e9ffe039aab144b64fc1367", - "build/prefab/lib/linux_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/cc/bf/06896425648bf6f047d59d5703ae", - "build/prefab/lib/linux_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/28/e9/7bbfd532a37bfc48d551e119bab3", - "build/prefab/lib/linux_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/92/82/8f57f0d4e95be62debcc0aa03ab2", - "build/prefab/lib/linux_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/f2/28/903128a3301b0997d5e152f33737", - "build/prefab/lib/linux_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/18/ef/8977538a039818f76ef0f90352ce", - "build/prefab/lib/mac_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/4c/f3/b4ce11182cec5f368d53c5ee4df9", - "build/prefab/lib/mac_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/df/87/e9e35793cca422629c1203719f6f", - "build/prefab/lib/mac_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/d1/f5/d87f66ed4d72db81186107269c72", - "build/prefab/lib/mac_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/6e/d4/96d7edabbba3c15b29b902705b2c", - "build/prefab/lib/mac_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/f1/ab/81e232865fbc6992fcc856980e76", - "build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/1b/88/1acc3d873753e7ab20091a17f8e6", - "build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/85/7f/5037f541b8a68b46fb92e8516cb2", - "build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/3c/74/592b9f7ba0cc23d5abf2324fcdbd", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/49/3e/1334bb9ae22717520faf220aee8c", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/93/29/ff9334384556cb85a1747225830b", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/c5/fd/ab023b6be42cf08753928cfb4086", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/ed/df/7abb93c4da8032dc6811e0fab1fc", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/ac/a4/ae3439fb4638485a4c94eb245d03", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/dd/75/9a807fc3f236cc60ce8fcff0f519", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/46/b3/8e93fd8686e52b1584798879a1ee", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/5e/9d/b6a7212ffa0cc0891812c637f8d6", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/02/45/1748a3903dafb20dd0cfbed3f5bb", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/92/e9/fc686b9bc8ce4378c0ffb22ab84e", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/6d/83/89377b33b6c77ea3ba2a196ad31c", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/23/19/f1b5b330f9a2cfbbb06ea121c38f", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/87/f4/f486a1858d5a8b58470329d1afca", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/54/d4/e1b5c492b85eea0c336d161bbea6", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/37/d1/2c525af4ae3076dd8b700b621a67", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/c0/31/318f5ddf431861102501a24b9311", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/d9/de/6dda22728067d16af05d9d9007e8", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/52/c1/846d2e881853eab3ab240ecb6c47", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/24/dd/2f1376395636ec554ae148cffb38", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/cf/1c/4e03f93b35ee4eb046b1142d61da", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/b1/da/ebf6e0607638e892276a5d572f6a", + "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/32/c9/b5016e09b4092491f34b6561b1af", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/91/03/1ac1441cd60c3a39afb881805960", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/17/29/f23eca0e8507a0a9f47a59644288", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/63/fa/61531b575dfeff4f40613c8590ee", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/f1/bd/12d64962eb14ef43fd0a650450ae", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/e1/0b/90e0cab2bfd5477ddcadefb22ca8", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/39/c9/64209e8fc8582d873d69ff35f1e5", + "build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/86/48/3c609a88bece81cb33dfc7970739", + "build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/ce/eb/b904fb630f5271555639f67cbd1d", + "build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/7c/3b/ccf254ede242fc538e3858474d11", + "build/prefab/lib/linux_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/60/e0/e07f97ec0084eb150945b27284e5", + "build/prefab/lib/linux_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/04/26/3649b220dd17dab55ffdfc18ef03", + "build/prefab/lib/linux_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/2a/87/c28eb4d1b700194f2d6714fd58cd", + "build/prefab/lib/linux_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/8d/46/bc29c2f931a5105f11094420ebe4", + "build/prefab/lib/linux_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/01/b0/b6bc9fb997a7a2396f538c151e1b", + "build/prefab/lib/mac_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/23/78/588cb1441f24f6cd1bf3080941b2", + "build/prefab/lib/mac_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/80/03/0e86a5c70e8921531a5d8c0a0da6", + "build/prefab/lib/mac_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/1d/86/e10cd783d461332dcba8d5aabae6", + "build/prefab/lib/mac_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/cc/37/dadc19268a249173f4cc9b75adf9", + "build/prefab/lib/mac_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/69/90/498d5b6ae433282b83380fe3b7da", + "build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/28/5a/ac8da1fe2abed240afee77a6e8dd", + "build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/f0/1e/afb767e5a9f3641e8902ba726d90", + "build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/a9/50/e31c09ce0b4fffc720b4783c8572", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/a4/5d/3248586d7224c984332b83d97690", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/f5/5d/c2bff082d611dd50e1afdd65ea59", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/55/f4/15fea1f4bb88b5e6942fe25a9a27", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/90/1c/d4f326a37203c8c772d49f04b6c6", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/b0/4f/4ed45130baa2672f75ebce006062", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/31/d0/afcf0d54d08b88fa8d3f63b29140", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/47/19/a869e648ec012488c1bf29a2f479", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/fd/33/85c3a2b199ef4343f47a7c299a4f", "src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/52/c6/c11130af7b10d6c0321add5518fa", "src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/38/c3/1dedd5e74f2508efc5974c8815a1", "src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/ea/6a/6a4721b144e5e297b542d2a0eea2", diff --git a/CHANGELOG.md b/CHANGELOG.md index d8796b08..4453a785 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.20 (build 21125, api 8, 2023-06-18) +### 1.7.20 (build 21126, api 8, 2023-06-18) - 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 @@ -356,6 +356,10 @@ use log calls instead of prints. The environment vars to enable them are now `BA_DEBUG_LOG_CONNECTIVITY` and `BA_DEBUG_LOG_V2_TRANSPORT`. Set either to '1' to enable debug logging. +- (build 21125) Fixed a bug where feature-sets would not have their + DoApplyConfig callbacks called in C++, which was causing the server-mode + `idle_exit_minutes` value to be ignored. Servers should now properly exit + after being idle for this length of time. ### 1.7.19 (build 20997, api 7, 2023-01-19) diff --git a/src/assets/ba_data/python/baclassic/_servermode.py b/src/assets/ba_data/python/baclassic/_servermode.py index 25bc2c81..d9f0f443 100644 --- a/src/assets/ba_data/python/baclassic/_servermode.py +++ b/src/assets/ba_data/python/baclassic/_servermode.py @@ -188,7 +188,7 @@ class ServerController: self._executing_shutdown = True timestrval = time.strftime('%c') if self._shutdown_reason is ShutdownReason.RESTARTING: - babase.screenmessage( + bascenev1.broadcastmessage( babase.Lstr(resource='internal.serverRestartingText'), color=(1, 0.5, 0.0), ) @@ -197,7 +197,7 @@ class ServerController: f' at {timestrval}.{Clr.RST}' ) else: - babase.screenmessage( + bascenev1.broadcastmessage( babase.Lstr(resource='internal.serverShuttingDownText'), color=(1, 0.5, 0.0), ) diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index 7f3c3b70..dcd01319 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 = 21125 +TARGET_BALLISTICA_BUILD = 21126 TARGET_BALLISTICA_VERSION = '1.7.20' _g_env_config: EnvConfig | None = None diff --git a/src/ballistica/base/app/app.cc b/src/ballistica/base/app/app.cc index 60f3414f..7a495860 100644 --- a/src/ballistica/base/app/app.cc +++ b/src/ballistica/base/app/app.cc @@ -40,7 +40,7 @@ void App::PostInit() { g_core->platform->GetLegacyUserAgentString()); } -void App::LogicThreadApplyAppConfig() { +void App::DoLogicThreadApplyAppConfig() { // Note: this gets called in the logic thread since that's where // config reading happens. We should grab whatever values we need // and then forward them to ourself in the main thread. @@ -48,7 +48,7 @@ void App::LogicThreadApplyAppConfig() { // to do the same. assert(g_base->InLogicThread()); - g_base->networking->ApplyAppConfig(); + g_base->networking->DoApplyAppConfig(); } void App::LogicThreadStepDisplayTime() { assert(g_base->InLogicThread()); } diff --git a/src/ballistica/base/app/app.h b/src/ballistica/base/app/app.h index a478fc2e..73f98c69 100644 --- a/src/ballistica/base/app/app.h +++ b/src/ballistica/base/app/app.h @@ -26,11 +26,11 @@ class App { /// should go here. void PostInit(); - /// Gets called when the app config is being read. + /// Gets called when the app config is being applied. /// Note that this call happens in the logic thread, so we should /// do any reading that needs to happen in the logic thread and then /// forward the values to ourself back in our main thread. - void LogicThreadApplyAppConfig(); + void DoLogicThreadApplyAppConfig(); /// Return whether this class runs its own event loop. /// If true, MonolithicMain() will continuously ask the app for events diff --git a/src/ballistica/base/app/app_mode.cc b/src/ballistica/base/app/app_mode.cc index a93105ba..ff1c45c8 100644 --- a/src/ballistica/base/app/app_mode.cc +++ b/src/ballistica/base/app/app_mode.cc @@ -56,7 +56,7 @@ auto AppMode::HasConnectionToHost() const -> bool { return false; } auto AppMode::HasConnectionToClients() const -> bool { return false; } -void AppMode::ApplyAppConfig() {} +void AppMode::DoApplyAppConfig() {} auto AppMode::GetForegroundContext() -> ContextRef { return {}; } diff --git a/src/ballistica/base/app/app_mode.h b/src/ballistica/base/app/app_mode.h index f00f854b..69b26cd8 100644 --- a/src/ballistica/base/app/app_mode.h +++ b/src/ballistica/base/app/app_mode.h @@ -39,7 +39,7 @@ class AppMode { virtual void OnAppShutdown(); /// Apply the app config. - virtual void ApplyAppConfig(); + virtual void DoApplyAppConfig(); /// Update the logic thread for a new display-time. Can be called at any /// frequency. In gui builds, generally corresponds with frame drawing. In diff --git a/src/ballistica/base/audio/audio.cc b/src/ballistica/base/audio/audio.cc index e73e2c9b..bd7f64d3 100644 --- a/src/ballistica/base/audio/audio.cc +++ b/src/ballistica/base/audio/audio.cc @@ -27,7 +27,7 @@ void Audio::OnAppShutdown() { assert(g_base->InLogicThread()); } void Audio::StepDisplayTime() { assert(g_base->InLogicThread()); } -void Audio::ApplyAppConfig() { +void Audio::DoApplyAppConfig() { assert(g_base->InLogicThread()); SetVolumes(g_base->app_config->Resolve(AppConfig::FloatID::kMusicVolume), g_base->app_config->Resolve(AppConfig::FloatID::kSoundVolume)); diff --git a/src/ballistica/base/audio/audio.h b/src/ballistica/base/audio/audio.h index 6136296e..870948e6 100644 --- a/src/ballistica/base/audio/audio.h +++ b/src/ballistica/base/audio/audio.h @@ -24,7 +24,7 @@ class Audio { virtual void OnAppPause(); virtual void OnAppResume(); virtual void OnAppShutdown(); - virtual void ApplyAppConfig(); + virtual void DoApplyAppConfig(); virtual void OnScreenSizeChange(); virtual void StepDisplayTime(); diff --git a/src/ballistica/base/base.cc b/src/ballistica/base/base.cc index b8914d76..17478529 100644 --- a/src/ballistica/base/base.cc +++ b/src/ballistica/base/base.cc @@ -240,6 +240,11 @@ void BaseFeatureSet::set_app_mode(AppMode* mode) { app_mode_->OnActivate(); + // Since app-modes will mostly become active after the initial global + // apply-app-config happens, we need to tell them to do so explicitly when + // they spin up. + app_mode_->DoApplyAppConfig(); + // Let some stuff know. logic->OnAppModeChanged(); } catch (const Exception& exc) { diff --git a/src/ballistica/base/graphics/graphics.cc b/src/ballistica/base/graphics/graphics.cc index f77ff12b..01fc0aa7 100644 --- a/src/ballistica/base/graphics/graphics.cc +++ b/src/ballistica/base/graphics/graphics.cc @@ -102,7 +102,7 @@ void Graphics::OnAppResume() { void Graphics::OnAppShutdown() { assert(g_base->InLogicThread()); } -void Graphics::ApplyAppConfig() { +void Graphics::DoApplyAppConfig() { assert(g_base->InLogicThread()); // Not relevant for fullscreen anymore diff --git a/src/ballistica/base/graphics/graphics.h b/src/ballistica/base/graphics/graphics.h index 3626f3e3..8bdbde54 100644 --- a/src/ballistica/base/graphics/graphics.h +++ b/src/ballistica/base/graphics/graphics.h @@ -54,7 +54,7 @@ class Graphics { void OnAppPause(); void OnAppResume(); void OnAppShutdown(); - void ApplyAppConfig(); + void DoApplyAppConfig(); void OnScreenSizeChange(float virtual_width, float virtual_height, float physical_width, float physical_height); void StepDisplayTime(); diff --git a/src/ballistica/base/input/input.cc b/src/ballistica/base/input/input.cc index e2a39f4b..03105924 100644 --- a/src/ballistica/base/input/input.cc +++ b/src/ballistica/base/input/input.cc @@ -565,7 +565,7 @@ void Input::OnAppResume() { assert(g_base->InLogicThread()); } void Input::OnAppShutdown() { assert(g_base->InLogicThread()); } // Tells all inputs to update their controls based on the app config. -void Input::ApplyAppConfig() { +void Input::DoApplyAppConfig() { assert(g_base->InLogicThread()); UpdateEnabledControllerSubsystems(); diff --git a/src/ballistica/base/input/input.h b/src/ballistica/base/input/input.h index 4e265cd2..70fad87f 100644 --- a/src/ballistica/base/input/input.h +++ b/src/ballistica/base/input/input.h @@ -25,7 +25,7 @@ class Input { void OnAppShutdown(); void StepDisplayTime(); - void ApplyAppConfig(); + void DoApplyAppConfig(); void OnScreenSizeChange(); diff --git a/src/ballistica/base/logic/logic.cc b/src/ballistica/base/logic/logic.cc index 233f4523..aea5efad 100644 --- a/src/ballistica/base/logic/logic.cc +++ b/src/ballistica/base/logic/logic.cc @@ -147,21 +147,21 @@ void Logic::ApplyAppConfig() { // Give all our other subsystems a chance. // Note: keep these in the same order as OnAppStart. - g_base->graphics->ApplyAppConfig(); - g_base->audio->ApplyAppConfig(); - g_base->input->ApplyAppConfig(); - g_base->ui->ApplyAppConfig(); - g_core->platform->ApplyAppConfig(); - g_base->app_mode()->ApplyAppConfig(); + g_base->graphics->DoApplyAppConfig(); + g_base->audio->DoApplyAppConfig(); + g_base->input->DoApplyAppConfig(); + g_base->ui->DoApplyAppConfig(); + g_core->platform->DoApplyAppConfig(); + g_base->app_mode()->DoApplyAppConfig(); if (g_base->HavePlus()) { - g_base->plus()->ApplyAppConfig(); + g_base->plus()->DoApplyAppConfig(); } - g_base->python->ApplyAppConfig(); + g_base->python->DoApplyAppConfig(); // Give the app subsystem a chance too even though its main-thread based. // We call it here in the logic thread, allowing it to read whatever // it needs and pass it to itself in the main thread. - g_base->app->LogicThreadApplyAppConfig(); + g_base->app->DoLogicThreadApplyAppConfig(); applied_app_config_ = true; } diff --git a/src/ballistica/base/networking/networking.cc b/src/ballistica/base/networking/networking.cc index a3c7fc11..a7a4927a 100644 --- a/src/ballistica/base/networking/networking.cc +++ b/src/ballistica/base/networking/networking.cc @@ -12,7 +12,7 @@ namespace ballistica::base { Networking::Networking() = default; -void Networking::ApplyAppConfig() { +void Networking::DoApplyAppConfig() { // Be aware this runs in the logic thread; not the main thread like // most of our stuff. assert(g_base->InLogicThread()); diff --git a/src/ballistica/base/networking/networking.h b/src/ballistica/base/networking/networking.h index 5d8ef1c7..70aea41c 100644 --- a/src/ballistica/base/networking/networking.h +++ b/src/ballistica/base/networking/networking.h @@ -117,7 +117,7 @@ namespace ballistica::base { class Networking { public: // Called in the logic thread when the app is reading its config. - void ApplyAppConfig(); + void DoApplyAppConfig(); // Send a message to an address. This may block for a brief moment, so it can // be more efficient to send a SendToMessage to the NetworkWrite thread which diff --git a/src/ballistica/base/python/base_python.cc b/src/ballistica/base/python/base_python.cc index 1ea72fb0..1423a61f 100644 --- a/src/ballistica/base/python/base_python.cc +++ b/src/ballistica/base/python/base_python.cc @@ -160,7 +160,7 @@ void BasePython::OnAppShutdown() { objs().Get(BasePython::ObjID::kShutdownCall).Call(); } -void BasePython::ApplyAppConfig() { assert(g_base->InLogicThread()); } +void BasePython::DoApplyAppConfig() { assert(g_base->InLogicThread()); } void BasePython::OnScreenSizeChange() { assert(g_base->InLogicThread()); } diff --git a/src/ballistica/base/python/base_python.h b/src/ballistica/base/python/base_python.h index 321ba332..6691337b 100644 --- a/src/ballistica/base/python/base_python.h +++ b/src/ballistica/base/python/base_python.h @@ -18,7 +18,7 @@ class BasePython { void OnAppPause(); void OnAppResume(); void OnAppShutdown(); - void ApplyAppConfig(); + void DoApplyAppConfig(); void OnScreenSizeChange(); void StepDisplayTime(); diff --git a/src/ballistica/base/python/methods/python_methods_app.cc b/src/ballistica/base/python/methods/python_methods_app.cc index 143a6861..96f2fb0d 100644 --- a/src/ballistica/base/python/methods/python_methods_app.cc +++ b/src/ballistica/base/python/methods/python_methods_app.cc @@ -553,7 +553,7 @@ static PyMethodDef PyQuitDef = { static auto PyApplyConfig(PyObject* self, PyObject* args) -> PyObject* { BA_PYTHON_TRY; - // Hmm; python runs in the logic thread; technically we could just run + // Hmm; Python runs in the logic thread; technically we could just run // ApplyAppConfig() immediately (though pushing is probably safer). g_base->logic->event_loop()->PushCall( [] { g_base->logic->ApplyAppConfig(); }); diff --git a/src/ballistica/base/support/plus_soft.h b/src/ballistica/base/support/plus_soft.h index 473d0c5a..16d01544 100644 --- a/src/ballistica/base/support/plus_soft.h +++ b/src/ballistica/base/support/plus_soft.h @@ -22,7 +22,7 @@ class PlusSoftInterface { virtual void OnAppPause() = 0; virtual void OnAppResume() = 0; virtual void OnAppShutdown() = 0; - virtual void ApplyAppConfig() = 0; + virtual void DoApplyAppConfig() = 0; virtual void OnScreenSizeChange() = 0; virtual void StepDisplayTime() = 0; diff --git a/src/ballistica/base/support/ui_v1_soft.h b/src/ballistica/base/support/ui_v1_soft.h index d59cf9b5..e1a51170 100644 --- a/src/ballistica/base/support/ui_v1_soft.h +++ b/src/ballistica/base/support/ui_v1_soft.h @@ -37,7 +37,7 @@ class UIV1SoftInterface { virtual void OnLanguageChange() = 0; virtual auto GetRootWidget() -> ui_v1::Widget* = 0; virtual auto SendWidgetMessage(const WidgetMessage& m) -> int = 0; - virtual void ApplyAppConfig() = 0; + virtual void DoApplyAppConfig() = 0; }; } // namespace ballistica::base diff --git a/src/ballistica/base/ui/ui.cc b/src/ballistica/base/ui/ui.cc index 2bf7bfbd..3f166c1e 100644 --- a/src/ballistica/base/ui/ui.cc +++ b/src/ballistica/base/ui/ui.cc @@ -83,10 +83,10 @@ void UI::OnAppResume() { void UI::OnAppShutdown() { assert(g_base->InLogicThread()); } -void UI::ApplyAppConfig() { +void UI::DoApplyAppConfig() { assert(g_base->InLogicThread()); if (g_base->HaveUIV1()) { - g_base->ui_v1()->ApplyAppConfig(); + g_base->ui_v1()->DoApplyAppConfig(); } } diff --git a/src/ballistica/base/ui/ui.h b/src/ballistica/base/ui/ui.h index bb796f30..800d2f28 100644 --- a/src/ballistica/base/ui/ui.h +++ b/src/ballistica/base/ui/ui.h @@ -39,7 +39,7 @@ class UI { void OnAppPause(); void OnAppResume(); void OnAppShutdown(); - void ApplyAppConfig(); + void DoApplyAppConfig(); void OnScreenSizeChange(); void StepDisplayTime(); diff --git a/src/ballistica/core/platform/core_platform.cc b/src/ballistica/core/platform/core_platform.cc index 2b15b7e0..3ab8c87b 100644 --- a/src/ballistica/core/platform/core_platform.cc +++ b/src/ballistica/core/platform/core_platform.cc @@ -718,7 +718,7 @@ void CorePlatform::AndroidSetResString(const std::string& res) { throw Exception(); } -void CorePlatform::ApplyAppConfig() {} +void CorePlatform::DoApplyAppConfig() {} void CorePlatform::AndroidSynthesizeBackPress() { Log(LogLevel::kError, "AndroidSynthesizeBackPress() unimplemented"); diff --git a/src/ballistica/core/platform/core_platform.h b/src/ballistica/core/platform/core_platform.h index 391ad81d..c80ff1bc 100644 --- a/src/ballistica/core/platform/core_platform.h +++ b/src/ballistica/core/platform/core_platform.h @@ -59,7 +59,7 @@ class CorePlatform { virtual void OnAppPause(); virtual void OnAppResume(); virtual void OnAppShutdown(); - virtual void ApplyAppConfig(); + virtual void DoApplyAppConfig(); virtual void OnScreenSizeChange(); virtual void StepDisplayTime(); diff --git a/src/ballistica/scene_v1/support/scene_v1_app_mode.cc b/src/ballistica/scene_v1/support/scene_v1_app_mode.cc index 28572833..ce5e59d5 100644 --- a/src/ballistica/scene_v1/support/scene_v1_app_mode.cc +++ b/src/ballistica/scene_v1/support/scene_v1_app_mode.cc @@ -458,6 +458,8 @@ void SceneV1AppMode::StepDisplayTime() { UpdateKickVote(); + HandleQuitOnIdle(); + // Send the game roster to our clients if it's changed recently. if (game_roster_dirty_) { if (app_time > last_game_roster_send_time_ + 2500) { @@ -1149,7 +1151,7 @@ void SceneV1AppMode::LocalDisplayChatMessage( } } -void SceneV1AppMode::ApplyAppConfig() { +void SceneV1AppMode::DoApplyAppConfig() { // Kick-idle-players setting (hmm is this still relevant?). auto* host_session = dynamic_cast(foreground_session_.Get()); kick_idle_players_ = @@ -1367,11 +1369,9 @@ void SceneV1AppMode::HandleQuitOnIdle() { if (!idle_exiting_ && idle_seconds > (idle_exit_minutes_.value() * 60.0f)) { idle_exiting_ = true; + Log(LogLevel::kInfo, "Quitting due to reaching idle-exit-minutes."); g_base->logic->event_loop()->PushCall([] { assert(g_base->InLogicThread()); - - // Just go through _babase.quit() - // FIXME: Shouldn't need to go out to the python layer here... g_base->python->objs().Get(base::BasePython::ObjID::kQuitCall).Call(); }); } diff --git a/src/ballistica/scene_v1/support/scene_v1_app_mode.h b/src/ballistica/scene_v1/support/scene_v1_app_mode.h index b1ab1b4d..eb94e343 100644 --- a/src/ballistica/scene_v1/support/scene_v1_app_mode.h +++ b/src/ballistica/scene_v1/support/scene_v1_app_mode.h @@ -80,7 +80,7 @@ class SceneV1AppMode : public base::AppMode { auto chat_messages() const -> const std::list& { return chat_messages_; } - void ApplyAppConfig() override; + void DoApplyAppConfig() override; // Return whichever session is front and center. auto GetForegroundSession() const -> Session* { diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index 56164855..7be28773 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 = 21125; +const int kEngineBuildNumber = 21126; const char* kEngineVersion = "1.7.20"; auto MonolithicMain(const core::CoreConfig& core_config) -> int { diff --git a/src/ballistica/ui_v1/ui_v1.cc b/src/ballistica/ui_v1/ui_v1.cc index 0b0121e7..d0c8f3c0 100644 --- a/src/ballistica/ui_v1/ui_v1.cc +++ b/src/ballistica/ui_v1/ui_v1.cc @@ -279,7 +279,7 @@ void UIV1FeatureSet::DeleteWidget(Widget* widget) { } } -void UIV1FeatureSet::ApplyAppConfig() { +void UIV1FeatureSet::DoApplyAppConfig() { TextWidget::set_always_use_internal_keyboard(g_base->app_config->Resolve( base::AppConfig::BoolID::kAlwaysUseInternalKeyboard)); } diff --git a/src/ballistica/ui_v1/ui_v1.h b/src/ballistica/ui_v1/ui_v1.h index 2227c200..30fc3edc 100644 --- a/src/ballistica/ui_v1/ui_v1.h +++ b/src/ballistica/ui_v1/ui_v1.h @@ -101,7 +101,7 @@ class UIV1FeatureSet : public FeatureSetNativeComponent, void OnLanguageChange() override; auto GetRootWidget() -> ui_v1::Widget* override; auto SendWidgetMessage(const base::WidgetMessage& m) -> int override; - void ApplyAppConfig() override; + void DoApplyAppConfig() override; private: UIV1FeatureSet();