From 37deb4c3bda2614a52957f50bfff5174c6094f66 Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 30 May 2023 12:14:02 -0700 Subject: [PATCH] more feature-set untangling --- .efrocachemap | 64 +++++++++---------- CHANGELOG.md | 2 +- ballisticakit-cmake/CMakeLists.txt | 1 + .../Generic/BallisticaKitGeneric.vcxproj | 1 + .../BallisticaKitGeneric.vcxproj.filters | 3 + .../Headless/BallisticaKitHeadless.vcxproj | 1 + .../BallisticaKitHeadless.vcxproj.filters | 3 + src/assets/ba_data/python/baenv.py | 2 +- src/ballistica/base/base.cc | 12 ++-- src/ballistica/base/base.h | 6 +- src/ballistica/base/logic/logic.cc | 63 +++++++----------- src/ballistica/base/platform/base_platform.h | 7 +- src/ballistica/base/support/ui_v1_soft.h | 21 ++++++ src/ballistica/base/ui/ui.cc | 26 +++++--- src/ballistica/classic/classic.cc | 3 + src/ballistica/classic/classic.h | 6 +- src/ballistica/core/core.cc | 2 +- .../python/methods/python_methods_scene.cc | 5 +- src/ballistica/scene_v1/scene_v1.cc | 5 -- src/ballistica/shared/ballistica.cc | 2 +- src/ballistica/ui_v1/python/ui_v1_python.cc | 1 + src/ballistica/ui_v1/ui_v1.cc | 13 ++++ src/ballistica/ui_v1/ui_v1.h | 9 ++- 23 files changed, 153 insertions(+), 105 deletions(-) create mode 100644 src/ballistica/base/support/ui_v1_soft.h diff --git a/.efrocachemap b/.efrocachemap index 415f07a1..5efb04f7 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4072,33 +4072,33 @@ "build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/c5/09/4f10b8a21ba87aa5509cff7a164b", "build/assets/workspace/onslaughtplug.py": "https://files.ballistica.net/cache/ba1/ff/0a/a354984f9c074dab0676ac7e4877", "build/assets/workspace/runaroundplug.py": "https://files.ballistica.net/cache/ba1/2a/1c/9ee5db6d1bceca7fa6638fb8abde", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/08/e3/a0b9223475c7706681fad7968ba7", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/6d/ef/b6d1a6b9754d3036f71ad3fa77e2", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/2b/b1/6f30bc9be42939f9399d4a3f2b3a", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/0e/ef/1ce03a67174a21bb153ea7e8e27b", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/d0/26/46d5ff486b95aedaa3caf3c299c9", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/10/ea/b9aa9951192cbc45cccb4c3c2289", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e0/a0/32c52b4e83da434e22544bdda893", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/0b/09/2986300ce8c70c4e301da76a0533", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/b1/79/ba61f157a98f4ceab818d99edab9", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/09/78/0a5975081c617f7a52c6ddd3d7c0", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/36/91/561ed25a53dd05a321418ef95527", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/8d/27/ee747a3e85a28e124c21ac2b380d", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/a7/b8/ad830a02ee58f2e87466f011fb27", - "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/ca/71/6fd4afebc57e78d5986a2f657a3f", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/56/16/efa353be8adca6c233db12102463", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/85/98/0aa74afa4bfa7f12b4bb54fe76a3", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/e6/bb/308f33d3c4b549b8b701a6e94db1", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/68/c5/ad76162d865a7a14f2f2677300d1", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/c6/39/21bdc2e4e59855558bbc7d606f28", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/f9/eb/e2be79806312a8615a1e6da93078", - "build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/f4/e7/32cfbd534ac61e626f6c6fbe2b01", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/26/28/76adeaf883a0ce33dffdf2940d5b", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/62/f6/bf633c2dc38d61b73b8109cc002b", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d1/5b/7ce29036b8eae3226fa440761b11", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/8e/f4/5fd5e80bec1d9bda19f43932400a", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/b7/62/e50ab9f38db10874d32715c11e29", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/90/86/fc717a6aab51a451313da677a630", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/85/e3/72d4977a7238491402788eecc44d", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/46/be/0ca1d581bee963f3f2adc30bbdbc", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/5b/a4/68472d57ebe52dd72db1a78a302d", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/1c/49/78f788f23a025707360b23d7daf3", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/7b/f3/3e0101776643cff6bdbd3bbb089f", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/81/6a/6784af212260aef7375936705d08", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/3b/5a/fd4873250526f81d98acf374face", + "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/4f/e5/3554a91085d6c99cf4225991a49b", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/6c/7a/0a43c1a584fae923c7f9b006aa00", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d8/6e/b6c78fd05b4082a56101251d80a7", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/a0/10/73c560964fcc4834ab4d383166d7", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/de/46/fb9e06c434c2a4a2f9ef5b559d1b", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/f9/c2/634df05be8abea32da3e8ca3095e", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/76/16/8c323c36f0e5d37c667b78f6e164", + "build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/5f/35/b7d5e6c2446f339bdd61527ea735", "build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/f3/f8/52577356f2ff5229ed4e5a6764cf", - "build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/60/2b/35acb337afc2d997ffc94d2da757", + "build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/f1/f5/ee7230a33652160f1a69d37d0b1d", "build/prefab/lib/linux_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/3f/91/9d57b5688d3fdedc41ad0a91cfcc", - "build/prefab/lib/linux_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/a9/92/58c58ab93d71d77eac753c7632ed", + "build/prefab/lib/linux_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/3b/a8/25df998ef2e458e4b3df4f9e4bc3", "build/prefab/lib/linux_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/40/35/f0ce16f78cb98281471dc4fb1048", - "build/prefab/lib/linux_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/5b/b3/487175ffc786ab47da1220b95643", + "build/prefab/lib/linux_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/d3/f6/9b895fa7a559163f3ba301a5b082", "build/prefab/lib/linux_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/b6/e7/1d76994d633f5e189754b477da1d", "build/prefab/lib/mac_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/fb/7b/7a6549bb17264a5040d4db99a4cc", "build/prefab/lib/mac_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/eb/ab/4311e83907061aad56967531f41b", @@ -4108,14 +4108,14 @@ "build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/30/4a/aa281e0eb46722098ec29d7da4f8", "build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/0b/e4/a9d278c1bc9a5d731f865ac91a0b", "build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/92/f7/8898478ab4ef0a342c727dd64195", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/14/3f/8bffa39ee2e862bfd61886f8dd20", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/de/69/ff2d73feab522f0be693900c534b", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/2a/ac/8e4a2b322079d57a65cf5ec686eb", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/9b/d8/f5dbc2b76e5d6992e6e0f957699d", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/68/f9/0e55e33d9782d596d65770e943d8", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/b4/49/32ebdaa15a795c84e90c3d16fdee", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/e9/3c/b86de4797400df2a7bbba4e957f7", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/93/88/176702f3743aa143dcd2ee651c4a", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/54/37/fe9ce1e5ac553d1efbfe87f0b3db", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/14/9b/9339463649a9c9c4f5a17c8612c9", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/33/6a/1b57410d2fb4b0537ecec3648850", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/6d/f9/b35d9ebe3503c3f24cf6774d5458", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/de/ff/32c6e83e91a48cd9500d710ab1af", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/1f/7e/b8cf9ad9f8cd86a292e1609fdd93", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/19/7f/fa2c37a849648ada4bbaa4c826d4", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/65/32/b571911edfbbffa5263a29dbece2", "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/b4/3d/e352190a0e5673d101c0f3ee3ad2", diff --git a/CHANGELOG.md b/CHANGELOG.md index bcbbf597..74a76927 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.20 (build 21023, api 8, 2023-05-26) +### 1.7.20 (build 21025, api 8, 2023-05-30) - 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 diff --git a/ballisticakit-cmake/CMakeLists.txt b/ballisticakit-cmake/CMakeLists.txt index 99580ad9..c2a8b08c 100644 --- a/ballisticakit-cmake/CMakeLists.txt +++ b/ballisticakit-cmake/CMakeLists.txt @@ -416,6 +416,7 @@ add_executable(ballisticakit ${BA_SRC_ROOT}/ballistica/base/support/plus_soft.h ${BA_SRC_ROOT}/ballistica/base/support/stdio_console.cc ${BA_SRC_ROOT}/ballistica/base/support/stdio_console.h + ${BA_SRC_ROOT}/ballistica/base/support/ui_v1_soft.h ${BA_SRC_ROOT}/ballistica/base/ui/console.cc ${BA_SRC_ROOT}/ballistica/base/ui/console.h ${BA_SRC_ROOT}/ballistica/base/ui/ui.cc diff --git a/ballisticakit-windows/Generic/BallisticaKitGeneric.vcxproj b/ballisticakit-windows/Generic/BallisticaKitGeneric.vcxproj index 0f78b098..6eeed769 100644 --- a/ballisticakit-windows/Generic/BallisticaKitGeneric.vcxproj +++ b/ballisticakit-windows/Generic/BallisticaKitGeneric.vcxproj @@ -407,6 +407,7 @@ + diff --git a/ballisticakit-windows/Generic/BallisticaKitGeneric.vcxproj.filters b/ballisticakit-windows/Generic/BallisticaKitGeneric.vcxproj.filters index a2e3a7f1..44f7c590 100644 --- a/ballisticakit-windows/Generic/BallisticaKitGeneric.vcxproj.filters +++ b/ballisticakit-windows/Generic/BallisticaKitGeneric.vcxproj.filters @@ -655,6 +655,9 @@ ballistica\base\support + + ballistica\base\support + ballistica\base\ui diff --git a/ballisticakit-windows/Headless/BallisticaKitHeadless.vcxproj b/ballisticakit-windows/Headless/BallisticaKitHeadless.vcxproj index 2aa7f63c..1c77c124 100644 --- a/ballisticakit-windows/Headless/BallisticaKitHeadless.vcxproj +++ b/ballisticakit-windows/Headless/BallisticaKitHeadless.vcxproj @@ -402,6 +402,7 @@ + diff --git a/ballisticakit-windows/Headless/BallisticaKitHeadless.vcxproj.filters b/ballisticakit-windows/Headless/BallisticaKitHeadless.vcxproj.filters index a2e3a7f1..44f7c590 100644 --- a/ballisticakit-windows/Headless/BallisticaKitHeadless.vcxproj.filters +++ b/ballisticakit-windows/Headless/BallisticaKitHeadless.vcxproj.filters @@ -655,6 +655,9 @@ ballistica\base\support + + ballistica\base\support + ballistica\base\ui diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index 4f42aeb7..80c9ed22 100644 --- a/src/assets/ba_data/python/baenv.py +++ b/src/assets/ba_data/python/baenv.py @@ -31,7 +31,7 @@ if TYPE_CHECKING: # Build number and version of the ballistica binary we expect to be # using. -TARGET_BALLISTICA_BUILD = 21023 +TARGET_BALLISTICA_BUILD = 21025 TARGET_BALLISTICA_VERSION = '1.7.20' _g_env_config: EnvConfig | None = None diff --git a/src/ballistica/base/base.cc b/src/ballistica/base/base.cc index 9f0e172a..d6fd3f14 100644 --- a/src/ballistica/base/base.cc +++ b/src/ballistica/base/base.cc @@ -36,16 +36,15 @@ #include "ballistica/shared/python/python.h" #include "ballistica/shared/python/python_command.h" -// TEMP. -extern auto TempSV1CreateAppMode() -> ballistica::base::AppMode*; - namespace ballistica::base { core::CoreFeatureSet* g_core{}; BaseFeatureSet* g_base{}; PlusSoftInterface* g_plus_soft{}; classic::ClassicFeatureSet* g_classic{}; -ui_v1::UIV1FeatureSet* g_ui_v1{}; +ClassicSoftInterface* g_classic_soft{}; +// ui_v1::UIV1FeatureSet* g_ui_v1{}; +UIV1SoftInterface* g_ui_v1_soft{}; BaseFeatureSet::BaseFeatureSet() : python{new BasePython()}, @@ -71,7 +70,6 @@ BaseFeatureSet::BaseFeatureSet() text_graphics{new TextGraphics()}, audio_server{new AudioServer()}, assets{new Assets()}, - // app_mode{TempSV1CreateAppMode()}, app_mode_{AppModeEmpty::GetSingleton()}, stdio_console{g_buildconfig.enable_stdio_console() ? new StdioConsole() : nullptr} { @@ -121,8 +119,8 @@ void BaseFeatureSet::OnModuleExec(PyObject* module) { // FIXME: neither of these should be here. assert(g_classic == nullptr); g_classic = classic::ClassicFeatureSet::Import(); - assert(g_ui_v1 == nullptr); - g_ui_v1 = ui_v1::UIV1FeatureSet::Import(); + // assert(g_ui_v1 == nullptr); + // g_ui_v1 = ui_v1::UIV1FeatureSet::Import(); // let baenv know it can now feed us logs and run some checks. g_core->python->RunBaEnvOnBaBaseImport(); diff --git a/src/ballistica/base/base.h b/src/ballistica/base/base.h index 65ded963..a81a6fa3 100644 --- a/src/ballistica/base/base.h +++ b/src/ballistica/base/base.h @@ -58,6 +58,7 @@ struct BGDynamicsShadowData; class BGDynamicsVolumeLight; struct BGDynamicsVolumeLightData; class Camera; +class ClassicSoftInterface; class CollisionMeshAsset; class CollisionCache; class Console; @@ -124,6 +125,7 @@ class TextureAssetPreloadData; class TextureAssetRendererData; class TouchInput; class UI; +class UIV1SoftInterface; class AppVR; class GraphicsVR; @@ -593,7 +595,9 @@ extern core::CoreFeatureSet* g_core; extern base::BaseFeatureSet* g_base; extern PlusSoftInterface* g_plus_soft; extern classic::ClassicFeatureSet* g_classic; -extern ui_v1::UIV1FeatureSet* g_ui_v1; +extern base::ClassicSoftInterface* g_classic_soft; +extern base::UIV1SoftInterface* g_ui_v1_soft; +// extern ui_v1::UIV1FeatureSet* g_ui_v1; /// Our C++ front-end to our feature set. This is what other C++ /// feature-sets can 'Import' from us. diff --git a/src/ballistica/base/logic/logic.cc b/src/ballistica/base/logic/logic.cc index 4c359caa..a0effe00 100644 --- a/src/ballistica/base/logic/logic.cc +++ b/src/ballistica/base/logic/logic.cc @@ -174,6 +174,28 @@ void Logic::OnInitialScreenCreated() { // (or no screen in the case of headless-mode). // We use this as a cue to kick off our business logic. + // Let the Python layer know what's up. It will probably flip to + // 'Launching' state. + CompleteAppBootstrapping(); + + // Push an initial frame to the graphics thread. From this point it will be + // self-sustaining; sending us a request for a new one each time it receives + // one we send it. + if (!g_core->HeadlessMode()) { + g_base->graphics->BuildAndPushFrameDef(); + } +} + +// Launch into main menu or whatever else. +void Logic::CompleteAppBootstrapping() { + assert(g_base->InLogicThread()); + assert(g_base->CurrentContext().IsEmpty()); + + assert(!app_bootstrapping_complete_); + app_bootstrapping_complete_ = true; + + g_core->BootLog("app bootstrapping complete"); + // Let the assets system know it can start loading stuff now that // we have a screen and thus know texture formats/etc. // TODO(ericf): It might be nice to kick this off earlier if our logic is @@ -205,25 +227,6 @@ void Logic::OnInitialScreenCreated() { // Let our initial app-mode know it has become active. g_base->app_mode()->OnActivate(); - // Let the Python layer know what's up. It will probably flip to - // 'Launching' state. - CompleteAppBootstrapping(); - - // Deliver an initial frame-def to the graphics thread. It will send us a - // request for a new one each time it grabs one we send it. - if (!g_core->HeadlessMode()) { - g_base->graphics->BuildAndPushFrameDef(); - } -} - -// Launch into main menu or whatever else. -void Logic::CompleteAppBootstrapping() { - assert(g_base->InLogicThread()); - assert(!app_bootstrapping_complete_); - assert(g_base->CurrentContext().IsEmpty()); - - g_core->BootLog("app bootstrapping complete"); - // Reset our various subsystems to a default state. g_base->ui->Reset(); g_base->input->Reset(); @@ -236,28 +239,6 @@ void Logic::CompleteAppBootstrapping() { g_base->python->objs() .Get(BasePython::ObjID::kOnAppBootstrappingCompleteCall) .Call(); - app_bootstrapping_complete_ = true; - - // TODO(ericf): update this for the shiny new app-mode world. - if (explicit_bool(false)) { - // If we were passed launch command args, run them. - if (g_core->core_config().exec_command.has_value()) { - bool success = PythonCommand(*g_core->core_config().exec_command, - BA_BUILD_COMMAND_FILENAME) - .Exec(true, nullptr, nullptr); - if (!success) { - exit(1); - } - } - // If the stuff we just ran didn't result in a session, create a default - // one. - auto* appmode = scene_v1::SceneV1AppMode::GetActiveOrFatal(); - if (!appmode->GetForegroundSession()) { - appmode->RunMainMenu(); - } - } else { - // Reset various subsystems - } UpdatePendingWorkTimer(); } diff --git a/src/ballistica/base/platform/base_platform.h b/src/ballistica/base/platform/base_platform.h index efb8c7cd..7147fa6b 100644 --- a/src/ballistica/base/platform/base_platform.h +++ b/src/ballistica/base/platform/base_platform.h @@ -11,13 +11,14 @@ namespace ballistica::base { class BasePlatform { public: - /// Create the proper BasePlatform subclass for the current platform. + /// Instantiate the appropriate BasePlatform subclass for the current + /// environment. static auto CreatePlatform() -> BasePlatform*; - /// Create the proper App module and add it to the main_event_loop. + /// Instantiate the appropriate App subclass for the current environment. static auto CreateApp() -> App*; - /// Create the appropriate Graphics subclass for the app. + /// Instantiate the appropriate Graphics subclass for the current environment. static auto CreateGraphics() -> Graphics*; #pragma mark IN APP PURCHASES -------------------------------------------------- diff --git a/src/ballistica/base/support/ui_v1_soft.h b/src/ballistica/base/support/ui_v1_soft.h new file mode 100644 index 00000000..089ec33a --- /dev/null +++ b/src/ballistica/base/support/ui_v1_soft.h @@ -0,0 +1,21 @@ +// Released under the MIT License. See LICENSE for details. + +#ifndef BALLISTICA_BASE_SUPPORT_UI_V1_SOFT_H_ +#define BALLISTICA_BASE_SUPPORT_UI_V1_SOFT_H_ + +namespace ballistica::base { + +/// 'Soft' interface to the ui_v1 feature-set. +/// Feature-sets listing ui_v1 as a soft requirement must limit their use of +/// it to these methods and should be prepared to handle the not-present +/// case. +class UIV1SoftInterface { + public: + virtual void DoHandleDeviceMenuPress(base::InputDevice* device) = 0; + virtual void DoShowURL(const std::string& url) = 0; + virtual void DoQuitWindow() = 0; +}; + +} // namespace ballistica::base + +#endif // BALLISTICA_BASE_SUPPORT_UI_V1_SOFT_H_ diff --git a/src/ballistica/base/ui/ui.cc b/src/ballistica/base/ui/ui.cc index e33b423c..f7dbcff5 100644 --- a/src/ballistica/base/ui/ui.cc +++ b/src/ballistica/base/ui/ui.cc @@ -121,7 +121,12 @@ void UI::PushMainMenuPressCall(InputDevice* device) { void UI::MainMenuPress(InputDevice* device) { assert(g_base->InLogicThread()); - g_ui_v1->python->HandleDeviceMenuPress(device); + if (g_ui_v1_soft) { + g_ui_v1_soft->DoHandleDeviceMenuPress(device); + } else { + Log(LogLevel::kWarning, + "UI::MainMenuPress called without g_ui_v1_soft; unexpected."); + } } auto UI::IsWindowPresent() const -> bool { @@ -405,7 +410,14 @@ void UI::Draw(FrameDef* frame_def) { } } -void UI::ShowURL(const std::string& url) { g_ui_v1->python->ShowURL(url); } +void UI::ShowURL(const std::string& url) { + if (g_ui_v1_soft) { + g_ui_v1_soft->DoShowURL(url); + } else { + Log(LogLevel::kWarning, + "UI::ShowURL called without g_ui_v1_soft present; unexpected."); + } +} void UI::ConfirmQuit() { g_base->logic->event_loop()->PushCall([] { @@ -413,9 +425,9 @@ void UI::ConfirmQuit() { if (g_core->HeadlessMode()) { Log(LogLevel::kError, "UI::ConfirmQuit() unhandled on headless."); } else { - // If input is locked or the in-app-console is up, just quit immediately; - // a confirm screen wouldn't work anyway. - if (g_base->input->IsInputLocked() + // If input is locked or the in-app-console is up or we don't have ui-v1, + // just quit immediately; a confirm screen wouldn't work anyway. + if (g_base->input->IsInputLocked() || g_ui_v1_soft == nullptr || (g_base->console() != nullptr && g_base->console()->active())) { // Just go through _babase.quit(). // FIXME: Shouldn't need to go out to the Python layer here; @@ -426,9 +438,7 @@ void UI::ConfirmQuit() { } else { ScopedSetContext ssc(nullptr); g_base->audio->PlaySound(g_base->assets->SysSound(SysSoundID::kSwish)); - g_ui_v1->python->objs() - .Get(ui_v1::UIV1Python::ObjID::kQuitWindowCall) - .Call(); + g_ui_v1_soft->DoQuitWindow(); // If we have a keyboard, give it UI ownership. InputDevice* keyboard = g_base->input->keyboard_input(); diff --git a/src/ballistica/classic/classic.cc b/src/ballistica/classic/classic.cc index 93a72dc0..5bea6beb 100644 --- a/src/ballistica/classic/classic.cc +++ b/src/ballistica/classic/classic.cc @@ -38,6 +38,9 @@ void ClassicFeatureSet::OnModuleExec(PyObject* module) { assert(g_base == nullptr); // Should be getting set once here. g_base = base::BaseFeatureSet::Import(); + // Let base know that we exist. + base::g_classic_soft = g_classic; + g_core->BootLog("_baclassic exec end"); } diff --git a/src/ballistica/classic/classic.h b/src/ballistica/classic/classic.h index bca18446..10c1113a 100644 --- a/src/ballistica/classic/classic.h +++ b/src/ballistica/classic/classic.h @@ -3,6 +3,9 @@ #ifndef BALLISTICA_CLASSIC_CLASSIC_H_ #define BALLISTICA_CLASSIC_CLASSIC_H_ +#include + +#include "ballistica/base/support/classic_soft.h" #include "ballistica/shared/foundation/feature_set_native_component.h" // Common header that most everything using our feature-set should include. @@ -55,7 +58,8 @@ extern ClassicFeatureSet* g_classic; /// Our C++ front-end to our feature set. This is what other C++ /// feature-sets can 'Import' from us. -class ClassicFeatureSet : public FeatureSetNativeComponent { +class ClassicFeatureSet : public FeatureSetNativeComponent, + public base::ClassicSoftInterface { public: /// Instantiate our FeatureSet if needed and return the single /// instance of it. Basically a Python import statement. diff --git a/src/ballistica/core/core.cc b/src/ballistica/core/core.cc index 71bb20aa..ab765534 100644 --- a/src/ballistica/core/core.cc +++ b/src/ballistica/core/core.cc @@ -143,7 +143,7 @@ void CoreFeatureSet::PostInit() { // Grab whatever Python stuff we use. python->ImportPythonObjs(); - // FIXME - MOVE THIS TO A RUN_APP_TO_COMPLETION() SORT OF FUNCTION + // FIXME: MOVE THIS TO A RUN_APP_TO_COMPLETION() SORT OF PLACE. // For now it does the right thing here since all we have is monolithic // builds but this will need to account for more situations later. python->ReleaseMainThreadGIL(); diff --git a/src/ballistica/scene_v1/python/methods/python_methods_scene.cc b/src/ballistica/scene_v1/python/methods/python_methods_scene.cc index 90c69a9f..62b7974f 100644 --- a/src/ballistica/scene_v1/python/methods/python_methods_scene.cc +++ b/src/ballistica/scene_v1/python/methods/python_methods_scene.cc @@ -1692,8 +1692,9 @@ static auto PyHandleAppIntentExec(PyObject* self, PyObject* args, BA_BUILD_COMMAND_FILENAME) .Exec(true, nullptr, nullptr); if (!success) { - // FIXME: what should we do in this case? - // exit(1); + // TODO(ericf): what should we do in this case? + // Obviously if we add return/success values for intents we should set + // that here. } } // If the stuff we just ran didn't result in a session, create a default diff --git a/src/ballistica/scene_v1/scene_v1.cc b/src/ballistica/scene_v1/scene_v1.cc index a3f35991..cd6cc949 100644 --- a/src/ballistica/scene_v1/scene_v1.cc +++ b/src/ballistica/scene_v1/scene_v1.cc @@ -30,11 +30,6 @@ #include "ballistica/scene_v1/support/scene_v1_app_mode.h" #include "ballistica/shared/generic/utils.h" -// FIXME: TEMP; REMOVE THIS SOON. -auto TempSV1CreateAppMode() -> ballistica::base::AppMode* { - return ballistica::scene_v1::SceneV1AppMode::GetSingleton(); -} - namespace ballistica::scene_v1 { core::CoreFeatureSet* g_core{}; diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index 71d9a164..6d3d25e6 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 = 21023; +const int kEngineBuildNumber = 21025; const char* kEngineVersion = "1.7.20"; auto MonolithicMain(const core::CoreConfig& core_config) -> int { diff --git a/src/ballistica/ui_v1/python/ui_v1_python.cc b/src/ballistica/ui_v1/python/ui_v1_python.cc index 88e86d70..35acd744 100644 --- a/src/ballistica/ui_v1/python/ui_v1_python.cc +++ b/src/ballistica/ui_v1/python/ui_v1_python.cc @@ -69,6 +69,7 @@ auto UIV1Python::GetPyWidget(PyObject* o) -> Widget* { "Can't get widget from value: " + Python::ObjToString(o) + ".", PyExcType::kType); } + void UIV1Python::ShowURL(const std::string& url) { g_base->logic->event_loop()->PushCall([this, url] { assert(g_base->InLogicThread()); diff --git a/src/ballistica/ui_v1/ui_v1.cc b/src/ballistica/ui_v1/ui_v1.cc index 359178a2..67fffa9e 100644 --- a/src/ballistica/ui_v1/ui_v1.cc +++ b/src/ballistica/ui_v1/ui_v1.cc @@ -44,6 +44,9 @@ void UIV1FeatureSet::OnModuleExec(PyObject* module) { assert(g_base == nullptr); // Should be getting set once here. g_base = base::BaseFeatureSet::Import(); + // Let base know that we exist. + base::g_ui_v1_soft = g_ui_v1; + g_core->BootLog("_bauiv1 exec end"); } @@ -54,4 +57,14 @@ auto UIV1FeatureSet::Import() -> UIV1FeatureSet* { return ImportThroughPythonModule("_bauiv1"); } +void UIV1FeatureSet::DoHandleDeviceMenuPress(base::InputDevice* device) { + python->HandleDeviceMenuPress(device); +} + +void UIV1FeatureSet::DoShowURL(const std::string& url) { python->ShowURL(url); } + +void UIV1FeatureSet::DoQuitWindow() { + g_ui_v1->python->objs().Get(ui_v1::UIV1Python::ObjID::kQuitWindowCall).Call(); +} + } // namespace ballistica::ui_v1 diff --git a/src/ballistica/ui_v1/ui_v1.h b/src/ballistica/ui_v1/ui_v1.h index aedf39d3..243fcfef 100644 --- a/src/ballistica/ui_v1/ui_v1.h +++ b/src/ballistica/ui_v1/ui_v1.h @@ -3,6 +3,9 @@ #ifndef BALLISTICA_UI_V1_UI_V1_H_ #define BALLISTICA_UI_V1_UI_V1_H_ +#include + +#include "ballistica/base/support/ui_v1_soft.h" #include "ballistica/shared/foundation/feature_set_native_component.h" // Common header that most everything using our feature-set should include. @@ -42,7 +45,8 @@ extern UIV1FeatureSet* g_ui_v1; /// Our C++ front-end to our feature set. This is what other C++ /// feature-sets can 'Import' from us. -class UIV1FeatureSet : public FeatureSetNativeComponent { +class UIV1FeatureSet : public FeatureSetNativeComponent, + public base::UIV1SoftInterface { public: /// Instantiate our FeatureSet if needed and return the single /// instance of it. Basically a Python import statement. @@ -50,6 +54,9 @@ class UIV1FeatureSet : public FeatureSetNativeComponent { /// Called when our associated Python module is instantiated. static void OnModuleExec(PyObject* module); + void DoHandleDeviceMenuPress(base::InputDevice* device) override; + void DoShowURL(const std::string& url) override; + void DoQuitWindow() override; UIV1Python* const python;