diff --git a/.efrocachemap b/.efrocachemap index d33e32cc..b48e339d 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4068,50 +4068,50 @@ "build/assets/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/2d/ef/5335207d41b21b9823f6805997f1", "build/assets/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/b0/8a/55e2e77623fe657bea24f223a3ae", "build/assets/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/86/5b/2af4d1e26a1a8073c89acb06e599", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/59/35/c9ba716b720aedc7d54e9c83fdc4", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/f8/58/e1200d725edb25877ddb03beb5ea", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/7b/2f/61d28afa0a9675add2c51e6dfd00", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/41/b8/6b4a0592bcf8c92aa2d1412a7288", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/0f/62/44f31d9bc7547754a8c79ec17141", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/e1/85/b3dd2968bd85c2e0c449fe036111", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/60/89/7d935c2046c494e588ce6761125e", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/06/e4/4a46b2659ff56e018190240de396", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/c4/0d/50883b77f756641fbd80092d35b7", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/34/2f/a6deb8563e4cd29dff8f11c788bb", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e7/cc/431b21630eb325f068d472dad763", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/b9/b9/33463ca1f078854d2e015df65b66", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/e9/80/b1483328b1ae0876fa63dbde529b", - "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/9f/19/9ed55ca8ed416273415024a58191", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d6/08/e08e3380f18c5dd476ad0bf082f3", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e4/6a/525b520d455f042bff170f663319", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/bb/22/2f948b1a6b5aac27e91f40ee6f06", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/4e/8c/f9b308b586a926bf855dba2e2509", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/4f/22/3a06c12dac1628f0761afb421122", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/b9/3a/e6a05acad4ea2325df5eae6c3fc8", - "build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/be/19/b5458933dfc7371d91ecfcd2e06f", - "build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/4e/48/123b806cbe6ddb3d9a8368bbb4f8", - "build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/be/19/b5458933dfc7371d91ecfcd2e06f", - "build/prefab/lib/linux_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/4e/48/123b806cbe6ddb3d9a8368bbb4f8", - "build/prefab/lib/linux_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/4c/81/bbc5c1f231cb267467caa5b3ad1a", - "build/prefab/lib/linux_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/81/01/ce348c68f8ac5db0d3b230fb3dc5", - "build/prefab/lib/linux_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/4c/81/bbc5c1f231cb267467caa5b3ad1a", - "build/prefab/lib/linux_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/81/01/ce348c68f8ac5db0d3b230fb3dc5", - "build/prefab/lib/mac_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/cc/d0/539ee0799f578b8cad9f45ab5628", - "build/prefab/lib/mac_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/d9/a8/c1f0ea1acc03b4e24db733eb3f9a", - "build/prefab/lib/mac_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/cc/d0/539ee0799f578b8cad9f45ab5628", - "build/prefab/lib/mac_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/d9/a8/c1f0ea1acc03b4e24db733eb3f9a", - "build/prefab/lib/mac_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/a2/bc/b1a1ba8d843420b3a585dcd8f0b9", - "build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/7e/fa/291fd7e935502ced7e99b8c8f7f0", - "build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/e1/cb/7e8440699e59e8646da25aa5782b", - "build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/7e/fa/291fd7e935502ced7e99b8c8f7f0", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/de/7c/be80b73558c5ce768b0084926910", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/e5/a1/644901f5d239aeab9fb976f79ffd", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/33/6e/5d5eb648ccb1646eaef4c626caa8", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/7a/1f/24348f323cfe76d907ef9d4b554e", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/95/0b/2bd52e8669d06f0a6729f1c2d8e0", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/a2/41/48a2c40099e3a27f283b3de9d5b5", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/e7/af/912d52ca415fe16b893eb4b92e70", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/d4/63/45858118d88aca3ed4f3bfec9cca", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/1d/0f/70a89ae3502347d236e378b96478", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/95/1c/66da52726fded0d10fceaac6bdfb", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/7b/45/1ff4d4db9287f0bfb42b7985a50d", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/b5/d0/7f72be8d8333e65bf6e1336ea337", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/3b/d7/15bbf535dad9ab0919cbdfabc060", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/47/a9/402b59ac65251689f294fbd58279", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/42/77/80bde1040987656495825cb3a88a", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/43/33/060081505fc18876aeab4cd4f80e", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/6f/2f/2ca892a9d9329fa6a2f1f2f19616", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/7f/5b/c23e5960ba2f2fede0bd2ab550ce", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/91/95/5d004ab02d197d9c21e171c03757", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/a7/3e/f18397067b466d4444710235b925", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/1d/1f/85e0365f349cc8c290fa16066c52", + "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/9b/d7/6356440b07526010df042aab1b71", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/da/0f/7cf9fb220f15928e650a1bfaf6a0", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/0c/e6/463117d06d455a1af122f56c49ba", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/bd/4f/4906878dd86169d1adf6a285c706", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/e0/9e/a183475d559473a9c09d826be487", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/97/c2/9fdbefefc7e9eea8400c09cffec0", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/ec/04/773b6ac1941c2efd3fc9aa36f08a", + "build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/69/6c/da91eefb50528ce9bfbdc058a40e", + "build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/29/ea/f0379258c5ed179ccb3ac26a8efb", + "build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/69/6c/da91eefb50528ce9bfbdc058a40e", + "build/prefab/lib/linux_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/29/ea/f0379258c5ed179ccb3ac26a8efb", + "build/prefab/lib/linux_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/a5/e2/c4d222bf67a79595a057f270f59e", + "build/prefab/lib/linux_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/f7/a6/00e23403bf63888378746fa917b4", + "build/prefab/lib/linux_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/a5/e2/c4d222bf67a79595a057f270f59e", + "build/prefab/lib/linux_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/f7/a6/00e23403bf63888378746fa917b4", + "build/prefab/lib/mac_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/6f/f5/fc698e25298568f0a604c2781116", + "build/prefab/lib/mac_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/2d/07/4ea1598affd99542fd23066f8bb2", + "build/prefab/lib/mac_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/6f/f5/fc698e25298568f0a604c2781116", + "build/prefab/lib/mac_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/2d/07/4ea1598affd99542fd23066f8bb2", + "build/prefab/lib/mac_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/9f/cf/6bd3295b6410ab60098095e60016", + "build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/30/1b/7a4da727c2f949d79aa0cbe9db4a", + "build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/29/04/fd9f3d6188c40d787cfb8ea6179f", + "build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/30/1b/7a4da727c2f949d79aa0cbe9db4a", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/1b/49/76d9f72d6ea7e687ec66d1046607", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/66/95/543f2d0d4cdd2318c06c1b5440d8", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/a6/d1/7dff5844f3411876f5bd3c1da597", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/25/78/36ab7acadece48db6fb87934ad7e", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/72/b3/5b9836fd4954c9aba8ae52459ee2", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/a2/3d/1a259518360dfac8c0b1d6c5e96c", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/96/0e/65e69416d3bc6ae5e22beef49154", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/ad/9d/bdd2d65375d381ccba6f5ec10cc6", "src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/f8/85/fed7f2ed98ff2ba271f9dbe3391c", "src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/f8/cd/3af311ac63147882590123b78318", "src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/3e/7a/203e2a5d2b5bb42cfe3fd2fe16c2", diff --git a/.idea/dictionaries/ericf.xml b/.idea/dictionaries/ericf.xml index 508e635b..147886bb 100644 --- a/.idea/dictionaries/ericf.xml +++ b/.idea/dictionaries/ericf.xml @@ -2614,6 +2614,7 @@ sitebuiltins skey sleepsecs + slen sline slist slists diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fc13f71..aea056fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ -### 1.7.22 (build 21159, api 8, 2023-07-10) +### 1.7.23 (build 21164, api 8, 2023-07-11) + +### 1.7.22 (build 21162, api 8, 2023-07-11) - Fixed a very rare race condition when launching threads or sending synchronous cross-thread messages. This was manifesting as one out of several thousand @@ -11,6 +13,8 @@ see any graphics wonkiness with this update. - Added SoK's explodinary icon to the game's custom text drawing because SoK is awesome. +- (build 21161) Fixed an issue on Android that could lead to crashes if device + events occurred very early at launch (button presses, joystick movement, etc.) ### 1.7.21 (build 21152, api 8, 2023-06-27) diff --git a/ballisticakit-cmake/.idea/dictionaries/ericf.xml b/ballisticakit-cmake/.idea/dictionaries/ericf.xml index 6d589261..f7bfac48 100644 --- a/ballisticakit-cmake/.idea/dictionaries/ericf.xml +++ b/ballisticakit-cmake/.idea/dictionaries/ericf.xml @@ -1518,6 +1518,7 @@ sisssssssss sixteenbits sleepsecs + slen slist slists smod diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index d1e26f6a..d7d6ffab 100644 --- a/src/assets/ba_data/python/baenv.py +++ b/src/assets/ba_data/python/baenv.py @@ -28,8 +28,8 @@ if TYPE_CHECKING: # Build number and version of the ballistica binary we expect to be # using. -TARGET_BALLISTICA_BUILD = 21159 -TARGET_BALLISTICA_VERSION = '1.7.22' +TARGET_BALLISTICA_BUILD = 21164 +TARGET_BALLISTICA_VERSION = '1.7.23' _g_env_config: EnvConfig | None = None g_paths_set_failed = False # pylint: disable=invalid-name diff --git a/src/ballistica/base/base.cc b/src/ballistica/base/base.cc index 8e422976..a1f6ed03 100644 --- a/src/ballistica/base/base.cc +++ b/src/ballistica/base/base.cc @@ -73,45 +73,45 @@ BaseFeatureSet::BaseFeatureSet() } void BaseFeatureSet::OnModuleExec(PyObject* module) { - // Ok, our feature-set's Python module is getting imported. - // Like any normal Python module, we take this opportunity to - // import/create the stuff we use. + // Ok, our feature-set's Python module is getting imported. Like any + // normal Python module, we take this opportunity to import/create the + // stuff we use. - // Importing core should always be the first thing we do. - // Various ballistica functionality will fail if this has not been done. + // Importing core should always be the first thing we do. Various + // ballistica functionality will fail if this has not been done. assert(g_core == nullptr); g_core = core::CoreFeatureSet::Import(); g_core->LifecycleLog("_babase exec begin"); - // Want to run this at the last possible moment before spinning up - // our BaseFeatureSet. This locks in baenv customizations. + // Want to run this at the last possible moment before spinning up our + // BaseFeatureSet. This locks in baenv customizations. g_core->python->ApplyBaEnvConfig(); // Create our feature-set's C++ front-end. assert(g_base == nullptr); g_base = new BaseFeatureSet(); - // Core uses some of our functionality when we're present. Let them - // know we're now present. + // Core uses some of our functionality when we're present. Let them know + // we're now present. core::g_base_soft = g_base; - // Define our classes. - // NOTE: Normally we'd define our classes *after* we import stuff - // (like a regular Python module generally would) but for now we need - // FeatureSetData to exist or no modules can call StoreOnPythonModule - // which causes problems so we have to do this early. Maybe can revisit - // later when things are more untangled. + // Define our native Python classes. + // + // NOTE: Normally we'd define our classes *after* we import stuff (like a + // regular Python module generally would) but we need FeatureSetData to + // exist *before* we call StoreOnPythonModule, so we have to do this + // early. g_base->python->AddPythonClasses(module); - // Store our C++ front-end with our Python module. - // This is what allows others to 'import' our C++ front end. + // Store our C++ front-end with our Python module. This is what allows + // others to 'import' our C++ front end. g_base->StoreOnPythonModule(module); // Import all the Python stuff we use. g_base->python->ImportPythonObjs(); - // Run some sanity checks/etc. + // Run some sanity checks, wire up our log handler, etc. auto result = g_base->python->objs() .Get(BasePython::ObjID::kOnNativeModuleImportCall) .Call(); @@ -119,8 +119,9 @@ void BaseFeatureSet::OnModuleExec(PyObject* module) { FatalError("babase._env.on_native_module_import() call failed."); } - // ..and because baenv is now feeding us logs, we can push any logs through - // that we've been holding on to. + // ..and because Python is now feeding us logs, we can push any logs + // through that we've been holding on to and start forwarding log calls as + // they happen. g_core->python->EnablePythonLoggingCalls(); // Marker we pop down at the very end so other modules can run sanity @@ -170,7 +171,7 @@ void BaseFeatureSet::StartApp() { // Currently limiting this to once per process. BA_PRECONDITION(!called_start_app_); called_start_app_ = true; - assert(!app_running_); // Shouldn't be possible. + assert(!app_started_); // Shouldn't be possible. g_core->LifecycleLog("start-app begin (main thread)"); @@ -196,13 +197,15 @@ void BaseFeatureSet::StartApp() { network_writer->OnMainThreadStartApp(); audio_server->OnMainThreadStartApp(); assets_server->OnMainThreadStartApp(); - g_core->platform->OnMainThreadStartApp(); // FIXME SHOULD NOT NEED THIS app->OnMainThreadStartApp(); // Take note that we're now 'running'. Various code such as anything that // pushes messages to threads can watch for this state to avoid crashing // if called early. - app_running_ = true; + app_started_ = true; + + // Inform anyone who wants to know that we're done starting. + platform->OnMainThreadStartAppComplete(); // As the last step of this phase, tell the logic thread to apply the app // config which will kick off screen creation and otherwise get the ball @@ -504,7 +507,7 @@ void BaseFeatureSet::DoV1CloudLog(const std::string& msg) { // Let the Python layer handle this if possible. PushCall functionality // requires the app to be running, and the call itself requires plus. - if (app_running_ && HavePlus()) { + if (app_started_ && HavePlus()) { python->objs().PushCall(BasePython::ObjID::kHandleV1CloudLogCall); return; } @@ -654,7 +657,7 @@ void BaseFeatureSet::PrintContextUnavailable() { void BaseFeatureSet::DoPushObjCall(const PythonObjectSetBase* objset, int id) { // Watch for uses before we've created our event loop; // should fix them at the source. - assert(IsAppRunning()); + assert(IsAppStarted()); if (auto* loop = logic->event_loop()) { logic->event_loop()->PushCall([objset, id] { @@ -672,7 +675,7 @@ void BaseFeatureSet::DoPushObjCall(const PythonObjectSetBase* objset, int id, const std::string& arg) { // Watch for uses before we've created our event loop; // should fix them at the source. - assert(IsAppRunning()); + assert(IsAppStarted()); logic->event_loop()->PushCall([objset, id, arg] { ScopedSetContext ssc(nullptr); @@ -682,6 +685,6 @@ void BaseFeatureSet::DoPushObjCall(const PythonObjectSetBase* objset, int id, }); } -auto BaseFeatureSet::IsAppRunning() const -> bool { return app_running_; } +auto BaseFeatureSet::IsAppStarted() const -> bool { return app_started_; } } // namespace ballistica::base diff --git a/src/ballistica/base/base.h b/src/ballistica/base/base.h index b9f61095..fd8d1c62 100644 --- a/src/ballistica/base/base.h +++ b/src/ballistica/base/base.h @@ -665,10 +665,10 @@ class BaseFeatureSet : public FeatureSetNativeComponent, /// High level screen-message call usable from any thread. void ScreenMessage(const std::string& s, const Vector3f& color) override; - /// Have we bootstrapped and started running an app? + /// Has StartApp been called (and completely finished its work)? /// Code that sends calls/messages to other threads or otherwise uses /// app functionality may want to check this to avoid crashes. - auto IsAppRunning() const -> bool override; + auto IsAppStarted() const -> bool override; void PlusDirectSendV1CloudLogs(const std::string& prefix, const std::string& suffix, bool instant, @@ -741,7 +741,7 @@ class BaseFeatureSet : public FeatureSetNativeComponent, bool tried_importing_classic_{}; bool tried_importing_ui_v1_{}; bool called_start_app_{}; - bool app_running_{}; + bool app_started_{}; bool called_run_app_to_completion_{}; bool base_import_completed_{}; bool base_native_import_completed_{}; diff --git a/src/ballistica/base/input/device/input_device.h b/src/ballistica/base/input/device/input_device.h index 31948616..8d566a2f 100644 --- a/src/ballistica/base/input/device/input_device.h +++ b/src/ballistica/base/input/device/input_device.h @@ -113,9 +113,9 @@ class InputDevice : public Object { /// a string. virtual auto GetDeviceIdentifier() -> std::string { return ""; } - /// Called for all devices when they've successfully been added - /// to the input-device list, have a valid ID, name, etc. - virtual void ConnectionComplete() {} + /// Called for all devices in the logic thread when they've successfully + /// been added to the input-device list, have a valid ID, name, etc. + virtual void OnAdded() {} void UpdateLastInputTime(); diff --git a/src/ballistica/base/input/device/joystick_input.cc b/src/ballistica/base/input/device/joystick_input.cc index 77a63ad7..4b769ed1 100644 --- a/src/ballistica/base/input/device/joystick_input.cc +++ b/src/ballistica/base/input/device/joystick_input.cc @@ -317,7 +317,7 @@ JoystickInput::~JoystickInput() { } } -void JoystickInput::ConnectionComplete() { assert(g_base->InLogicThread()); } +void JoystickInput::OnAdded() { assert(g_base->InLogicThread()); } auto JoystickInput::ShouldBeHiddenFromUser() -> bool { std::string d_name = GetDeviceName(); diff --git a/src/ballistica/base/input/device/joystick_input.h b/src/ballistica/base/input/device/joystick_input.h index dcbb1ccf..e6133154 100644 --- a/src/ballistica/base/input/device/joystick_input.h +++ b/src/ballistica/base/input/device/joystick_input.h @@ -77,7 +77,7 @@ class JoystickInput : public InputDevice { auto GetRawDeviceName() -> std::string override; auto GetDeviceExtraDescription() -> std::string override; auto GetDeviceIdentifier() -> std::string override; - void ConnectionComplete() override; + void OnAdded() override; auto start_button_activates_default_widget() -> bool override { return start_button_activates_default_widget_; diff --git a/src/ballistica/base/input/input.cc b/src/ballistica/base/input/input.cc index 0e2878c4..df7f669c 100644 --- a/src/ballistica/base/input/input.cc +++ b/src/ballistica/base/input/input.cc @@ -23,16 +23,20 @@ Input::Input() = default; template void SafePushCall(const char* desc, const F& lambda) { + // Note: originally this call was created to silently ignore early events + // coming in before app stuff was up and running, but that was a bad idea, + // as it caused us to ignore device-create messages sometimes which lead + // to other issues later. So now I'm trying to fix those problems at the + // source, but am leaving this intact for now as a clean way to catch + // anything that needs fixing. if (!g_base) { - BA_LOG_ONCE(LogLevel::kError, - std::string(desc) + " called with null g_base."); + FatalError(std::string(desc) + " called with null g_base."); return; } if (auto* loop = g_base->logic->event_loop()) { loop->PushCall(lambda); } else { - BA_LOG_ONCE(LogLevel::kError, - std::string(desc) + " called before logic event loop created."); + FatalError(std::string(desc) + " called before logic event loop created."); } } @@ -322,7 +326,9 @@ void Input::AddInputDevice(InputDevice* device, bool standard_message) { // based off how many are connected. device->set_number(GetNewNumberedIdentifier(device->GetRawDeviceName(), device->GetDeviceIdentifier())); - device->ConnectionComplete(); // Let it do any announcing it wants to. + + // Let the device know it's been added (for custom announcements, etc.) + device->OnAdded(); // Immediately apply controls if initial app-config has already been // applied; otherwise it'll happen as part of that. diff --git a/src/ballistica/base/platform/base_platform.cc b/src/ballistica/base/platform/base_platform.cc index 4ce933c5..38fb3f81 100644 --- a/src/ballistica/base/platform/base_platform.cc +++ b/src/ballistica/base/platform/base_platform.cc @@ -296,4 +296,6 @@ void BasePlatform::GetCursorPosition(float* x, float* y) { *y = g_base->input->cursor_pos_y(); } +void BasePlatform::OnMainThreadStartAppComplete() {} + } // namespace ballistica::base diff --git a/src/ballistica/base/platform/base_platform.h b/src/ballistica/base/platform/base_platform.h index 7147fa6b..9b02a056 100644 --- a/src/ballistica/base/platform/base_platform.h +++ b/src/ballistica/base/platform/base_platform.h @@ -21,6 +21,12 @@ class BasePlatform { /// Instantiate the appropriate Graphics subclass for the current environment. static auto CreateGraphics() -> Graphics*; +#pragma mark APP LIFECYCLE ----------------------------------------------------- + + /// Inform the platform that all subsystems are up and running and it can + /// start talking to them. + virtual void OnMainThreadStartAppComplete(); + #pragma mark IN APP PURCHASES -------------------------------------------------- void Purchase(const std::string& item); diff --git a/src/ballistica/core/core.cc b/src/ballistica/core/core.cc index 1ae694ab..39d8cb5c 100644 --- a/src/ballistica/core/core.cc +++ b/src/ballistica/core/core.cc @@ -110,6 +110,7 @@ void CoreFeatureSet::PostInit() { } // Enable extra timing logs via env var. + // FIXME: Kill this or move it to CoreConfig. const char* debug_timing_env = getenv("BA_DEBUG_TIMING"); if (debug_timing_env != nullptr && !strcmp(debug_timing_env, "1")) { debug_timing = true; diff --git a/src/ballistica/core/platform/core_platform.cc b/src/ballistica/core/platform/core_platform.cc index 59163621..2c95cc5f 100644 --- a/src/ballistica/core/platform/core_platform.cc +++ b/src/ballistica/core/platform/core_platform.cc @@ -669,8 +669,6 @@ auto CorePlatform::GetTextTextureData(void* tex) -> uint8_t* { throw Exception(); } -void CorePlatform::OnMainThreadStartApp() {} - void CorePlatform::OnAppStart() { // assert(g_base_soft && g_base_soft->InLogicThread()); } diff --git a/src/ballistica/core/platform/core_platform.h b/src/ballistica/core/platform/core_platform.h index c80ff1bc..794d9a11 100644 --- a/src/ballistica/core/platform/core_platform.h +++ b/src/ballistica/core/platform/core_platform.h @@ -51,10 +51,6 @@ class CorePlatform { virtual void WillExitMain(bool errored); - /// Inform the platform that all subsystems are up and running and it can - /// start talking to them. - virtual void OnMainThreadStartApp(); - virtual void OnAppStart(); virtual void OnAppPause(); virtual void OnAppResume(); diff --git a/src/ballistica/core/support/base_soft.h b/src/ballistica/core/support/base_soft.h index 02ef8499..005d5291 100644 --- a/src/ballistica/core/support/base_soft.h +++ b/src/ballistica/core/support/base_soft.h @@ -43,7 +43,7 @@ class BaseSoftInterface { virtual void DoPushObjCall(const PythonObjectSetBase* objset, int id) = 0; virtual void DoPushObjCall(const PythonObjectSetBase* objset, int id, const std::string& arg) = 0; - virtual auto IsAppRunning() const -> bool = 0; + virtual auto IsAppStarted() const -> bool = 0; }; } // namespace ballistica::core diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index 3637157f..f9c9ecd6 100644 --- a/src/ballistica/shared/ballistica.cc +++ b/src/ballistica/shared/ballistica.cc @@ -39,8 +39,8 @@ auto main(int argc, char** argv) -> int { namespace ballistica { // These are set automatically via script; don't modify them here. -const int kEngineBuildNumber = 21159; -const char* kEngineVersion = "1.7.22"; +const int kEngineBuildNumber = 21164; +const char* kEngineVersion = "1.7.23"; auto MonolithicMain(const core::CoreConfig& core_config) -> int { // This code is meant to be run standalone so won't inherit any diff --git a/tools/efro/log.py b/tools/efro/log.py index 94b117b3..f48b54ce 100644 --- a/tools/efro/log.py +++ b/tools/efro/log.py @@ -17,7 +17,7 @@ from threading import Thread, current_thread, Lock from efro.util import utc_now from efro.call import tpartial -from efro.terminal import TerminalColor +from efro.terminal import Clr from efro.dataclassio import ioprepped, IOAttrs, dataclass_to_json if TYPE_CHECKING: @@ -69,16 +69,11 @@ LEVELNO_LOG_LEVELS = { } LEVELNO_COLOR_CODES: dict[int, tuple[str, str]] = { - logging.DEBUG: (TerminalColor.CYAN.value, TerminalColor.RESET.value), + logging.DEBUG: (Clr.CYN, Clr.RST), logging.INFO: ('', ''), - logging.WARNING: (TerminalColor.YELLOW.value, TerminalColor.RESET.value), - logging.ERROR: (TerminalColor.RED.value, TerminalColor.RESET.value), - logging.CRITICAL: ( - TerminalColor.STRONG_MAGENTA.value - + TerminalColor.BOLD.value - + TerminalColor.BG_BLACK.value, - TerminalColor.RESET.value, - ), + logging.WARNING: (Clr.YLW, Clr.RST), + logging.ERROR: (Clr.RED, Clr.RST), + logging.CRITICAL: (Clr.SMAG + Clr.BLD + Clr.BLK, Clr.RST), } @@ -365,10 +360,7 @@ class LogHandler(logging.Handler): # make tight debugging harder. if self._echofile is not None: ends = LEVELNO_COLOR_CODES.get(record.levelno) - namepre = ( - f'{TerminalColor.WHITE.value}{record.name}:' - f'{TerminalColor.RESET.value} ' - ) + namepre = f'{Clr.WHT}{record.name}:{Clr.RST} ' if ends is not None: self._echofile.write(f'{namepre}{ends[0]}{msg}{ends[1]}\n') else: diff --git a/tools/efro/terminal.py b/tools/efro/terminal.py index 38ec78ed..666adb32 100644 --- a/tools/efro/terminal.py +++ b/tools/efro/terminal.py @@ -68,7 +68,7 @@ class TerminalColor(Enum): def _default_color_enabled() -> bool: - """Return whether we should enable ANSI color codes by default.""" + """Return whether we enable ANSI color codes by default.""" import platform # If we're not attached to a terminal, go with no-color. @@ -307,15 +307,11 @@ class ClrNever(ClrBase): _envval = os.environ.get('EFRO_TERMCOLORS') -_color_enabled: bool = ( +color_enabled: bool = ( True if _envval == '1' else False if _envval == '0' else _default_color_enabled() ) -Clr: type[ClrBase] -if _color_enabled: - Clr = ClrAlways -else: - Clr = ClrNever +Clr: type[ClrBase] = ClrAlways if color_enabled else ClrNever diff --git a/tools/efrotools/pybuild.py b/tools/efrotools/pybuild.py index 5c66cf20..f9641209 100644 --- a/tools/efrotools/pybuild.py +++ b/tools/efrotools/pybuild.py @@ -717,9 +717,11 @@ def _patch_py_wreadlink_test() -> None: txt, " cbuf[res] = '\\0'; /* buf will be null terminated */", ( - ' char dlog[256];\n' - ' snprintf(dlog, sizeof(dlog), "hello world res=%d mpl=%d",' - ' (int)res, (int)MAXPATHLEN);\n' + ' char dlog[512];\n' + ' snprintf(dlog, sizeof(dlog), "hello world1 res=%d mpl=%d' + ' eq1=%d eq2=%d slen=%d path=\'%s\'",' + ' (int)res, (int)MAXPATHLEN, (int)(res == -1),' + ' (int)((size_t)res == cbuf_len), strlen(cpath), cpath);\n' ' Py_BallisticaLowLevelDebugLog(dlog);\n' " cbuf[res] = '\\0'; /* buf will be null terminated */" ),