tidying and work on cleaner shutdown

This commit is contained in:
Eric 2023-08-21 16:08:48 -07:00
parent 721a57c085
commit 16ef618a93
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
61 changed files with 456 additions and 426 deletions

56
.efrocachemap generated
View File

@ -4068,26 +4068,26 @@
"build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1", "build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1",
"build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae", "build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae",
"build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599", "build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "e90f3bcd2f94dd910220e15a42550966", "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "60b5c6ab04b194345ff6257b70d69a5c",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "969a2f87c4e7863dac65b26269101099", "build/prefab/full/linux_arm64_gui/release/ballisticakit": "b9c878e7396fd1426c2a99fffd600aab",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "5514b6c86406ddddf5b651f8f3f55fe7", "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "6619693fb688c49e3fd87ef9c9c5211a",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "1aae03c6da0ba129356a2cad35a7f662", "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "a1f18844189de4fe40a56f345b33ef62",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "927adc17b55984179e79c513dd02f255", "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "f04b028c0bdfbc84ce1d646977d0c06a",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "c14f956a37c6c4b854528431f69d97a3", "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "8e96e29356cc8157e5aa1cb30e597c78",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "fd57912de1a8c12d23b9f19729b963d8", "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "d4cc2f2ed1648c310aba235b30b43c79",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "3e21f3f57cd594dcd4e4b4ed14546cd8", "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "2c246e46c453d94e60be71f3f0d5eefe",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "205aca87311597d93946d2002c20b886", "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "7b25f37a94583dfdf277d5d55d4c8ee2",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "f3d980a36605c34dca3b12184326163a", "build/prefab/full/mac_arm64_gui/release/ballisticakit": "2ce3e00ae6d5ff8e65697b68438e213e",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "50288dc0a0949cd8dacf30a2a7b2f616", "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "9a26cab66c09e657c0ac3233b1ecf0d7",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "badf5f08cbcb64742114ca048c6b7727", "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "b20ad6abed43e7bec2de8fa04bff71e2",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "b8d0fc747eaf3ee018197debe08070be", "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "29999f55a9ccb252c621e714a1d15c9c",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "8977914f6658821d8f2e4bd5ddd01072", "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "3f75965547ef911e2ad85a7b1786eb43",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "3f8030273ba43450ece98a32f49535fb", "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "7257acfca19121cc25be53e698c73d9c",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "f8b4ac0346f70ff11ede342cc411f488", "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "8b45af314375a63d939a906d9f211bda",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "6ca8a627e66d8afaafa8a4bfe86e6611", "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "736b5398e8396be443695e8b2bd572d9",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "6cb944d5071845f6c1a08df540001f0d", "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "56e73294a44f2d1f5bff3f4a9f973c2e",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "d6c5b9a6526a3eddb9db427510e228e6", "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "5630f2dd810cf19d1c309a579a0febde",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "a2b9d7f28f1292dd57c428721ecc0db3", "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "4c5506d6eb64252f0fb7275e13e3912c",
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "85ba4e81a1f7ae2cff4b1355eb49904f", "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "85ba4e81a1f7ae2cff4b1355eb49904f",
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "498921f7eb2afd327d4b900cb70e31f9", "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "498921f7eb2afd327d4b900cb70e31f9",
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "85ba4e81a1f7ae2cff4b1355eb49904f", "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "85ba4e81a1f7ae2cff4b1355eb49904f",
@ -4104,14 +4104,14 @@
"build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "0ab638b6602610bdaf432e3cc2464080", "build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "0ab638b6602610bdaf432e3cc2464080",
"build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "92394eb19387c363471ce134ac9e6a1b", "build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "92394eb19387c363471ce134ac9e6a1b",
"build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "0ab638b6602610bdaf432e3cc2464080", "build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "0ab638b6602610bdaf432e3cc2464080",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "5d9be2a7f56e5ceff27dad1ac61b9cbe", "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "ac1e455123d1c71aa09a16f1e6c4ecad",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "457d66c8095b9730be34a6882ccd9fb4", "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "68323b0304b2158b09d1af9573fc6d85",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "c4dccb80b2697860a86867d7a0ab83a7", "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "0f9b59502d1faf0b783420f78ee383f0",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "4f847c6193dedac5c22f51790d4673b6", "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "e5df1b61f11ec0e2b7a1b28b22390574",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "bff441f8f95a256aa8d425bb2511b4be", "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "4d097132b48f21c218b7129ad4d5f9a4",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "6512b8d9980e7ce3367c71ca7f6787a3", "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "6dc492eb1c9bf2e9e9fb591ea81fa253",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "1c2dda04a2e3c3a408dafce8a052bffa", "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "ad53f8041a683789e5f16d762a3d3b2c",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "0b973869db3eff21bbcd566511675f46", "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "5d161b0abe97805381be809c0b5da828",
"src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c", "src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c",
"src/assets/ba_data/python/babase/_mgen/enums.py": "f8cd3af311ac63147882590123b78318", "src/assets/ba_data/python/babase/_mgen/enums.py": "f8cd3af311ac63147882590123b78318",
"src/ballistica/base/mgen/pyembed/binding_base.inc": "eeddad968b176000e31c65be6206a2bc", "src/ballistica/base/mgen/pyembed/binding_base.inc": "eeddad968b176000e31c65be6206a2bc",

View File

@ -1,4 +1,4 @@
### 1.7.26 (build 21215, api 8, 2023-08-18) ### 1.7.26 (build 21221, api 8, 2023-08-21)
- Various general improvements to the pcommand (project command) system. - Various general improvements to the pcommand (project command) system.
- Modules containing pcommand functions are now named with an 's' - so - Modules containing pcommand functions are now named with an 's' - so

View File

@ -205,20 +205,16 @@ set(BALLISTICA_SOURCES
# AUTOGENERATED_PUBLIC_BEGIN (this section is managed by the "update_project" tool) # AUTOGENERATED_PUBLIC_BEGIN (this section is managed by the "update_project" tool)
${BA_SRC_ROOT}/ballistica/base/app/app.cc ${BA_SRC_ROOT}/ballistica/base/app/app.cc
${BA_SRC_ROOT}/ballistica/base/app/app.h ${BA_SRC_ROOT}/ballistica/base/app/app.h
${BA_SRC_ROOT}/ballistica/base/app/app_config.cc
${BA_SRC_ROOT}/ballistica/base/app/app_config.h
${BA_SRC_ROOT}/ballistica/base/app/app_headless.cc ${BA_SRC_ROOT}/ballistica/base/app/app_headless.cc
${BA_SRC_ROOT}/ballistica/base/app/app_headless.h ${BA_SRC_ROOT}/ballistica/base/app/app_headless.h
${BA_SRC_ROOT}/ballistica/base/app/app_mode.cc ${BA_SRC_ROOT}/ballistica/base/app/app_sdl.cc
${BA_SRC_ROOT}/ballistica/base/app/app_mode.h ${BA_SRC_ROOT}/ballistica/base/app/app_sdl.h
${BA_SRC_ROOT}/ballistica/base/app/app_mode_empty.cc
${BA_SRC_ROOT}/ballistica/base/app/app_mode_empty.h
${BA_SRC_ROOT}/ballistica/base/app/app_vr.cc ${BA_SRC_ROOT}/ballistica/base/app/app_vr.cc
${BA_SRC_ROOT}/ballistica/base/app/app_vr.h ${BA_SRC_ROOT}/ballistica/base/app/app_vr.h
${BA_SRC_ROOT}/ballistica/base/app/sdl_app.cc ${BA_SRC_ROOT}/ballistica/base/app_mode/app_mode.cc
${BA_SRC_ROOT}/ballistica/base/app/sdl_app.h ${BA_SRC_ROOT}/ballistica/base/app_mode/app_mode.h
${BA_SRC_ROOT}/ballistica/base/app/stress_test.cc ${BA_SRC_ROOT}/ballistica/base/app_mode/app_mode_empty.cc
${BA_SRC_ROOT}/ballistica/base/app/stress_test.h ${BA_SRC_ROOT}/ballistica/base/app_mode/app_mode_empty.h
${BA_SRC_ROOT}/ballistica/base/assets/asset.cc ${BA_SRC_ROOT}/ballistica/base/assets/asset.cc
${BA_SRC_ROOT}/ballistica/base/assets/asset.h ${BA_SRC_ROOT}/ballistica/base/assets/asset.h
${BA_SRC_ROOT}/ballistica/base/assets/assets.cc ${BA_SRC_ROOT}/ballistica/base/assets/assets.cc
@ -412,6 +408,8 @@ set(BALLISTICA_SOURCES
${BA_SRC_ROOT}/ballistica/base/python/support/python_context_call.cc ${BA_SRC_ROOT}/ballistica/base/python/support/python_context_call.cc
${BA_SRC_ROOT}/ballistica/base/python/support/python_context_call.h ${BA_SRC_ROOT}/ballistica/base/python/support/python_context_call.h
${BA_SRC_ROOT}/ballistica/base/python/support/python_context_call_runnable.h ${BA_SRC_ROOT}/ballistica/base/python/support/python_context_call_runnable.h
${BA_SRC_ROOT}/ballistica/base/support/app_config.cc
${BA_SRC_ROOT}/ballistica/base/support/app_config.h
${BA_SRC_ROOT}/ballistica/base/support/app_timer.h ${BA_SRC_ROOT}/ballistica/base/support/app_timer.h
${BA_SRC_ROOT}/ballistica/base/support/classic_soft.h ${BA_SRC_ROOT}/ballistica/base/support/classic_soft.h
${BA_SRC_ROOT}/ballistica/base/support/context.cc ${BA_SRC_ROOT}/ballistica/base/support/context.cc
@ -421,6 +419,8 @@ set(BALLISTICA_SOURCES
${BA_SRC_ROOT}/ballistica/base/support/plus_soft.h ${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.cc
${BA_SRC_ROOT}/ballistica/base/support/stdio_console.h ${BA_SRC_ROOT}/ballistica/base/support/stdio_console.h
${BA_SRC_ROOT}/ballistica/base/support/stress_test.cc
${BA_SRC_ROOT}/ballistica/base/support/stress_test.h
${BA_SRC_ROOT}/ballistica/base/support/ui_v1_soft.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.cc
${BA_SRC_ROOT}/ballistica/base/ui/console.h ${BA_SRC_ROOT}/ballistica/base/ui/console.h

View File

@ -191,20 +191,16 @@
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\src\ballistica\base\app\app.cc" /> <ClCompile Include="..\..\src\ballistica\base\app\app.cc" />
<ClInclude Include="..\..\src\ballistica\base\app\app.h" /> <ClInclude Include="..\..\src\ballistica\base\app\app.h" />
<ClCompile Include="..\..\src\ballistica\base\app\app_config.cc" />
<ClInclude Include="..\..\src\ballistica\base\app\app_config.h" />
<ClCompile Include="..\..\src\ballistica\base\app\app_headless.cc" /> <ClCompile Include="..\..\src\ballistica\base\app\app_headless.cc" />
<ClInclude Include="..\..\src\ballistica\base\app\app_headless.h" /> <ClInclude Include="..\..\src\ballistica\base\app\app_headless.h" />
<ClCompile Include="..\..\src\ballistica\base\app\app_mode.cc" /> <ClCompile Include="..\..\src\ballistica\base\app\app_sdl.cc" />
<ClInclude Include="..\..\src\ballistica\base\app\app_mode.h" /> <ClInclude Include="..\..\src\ballistica\base\app\app_sdl.h" />
<ClCompile Include="..\..\src\ballistica\base\app\app_mode_empty.cc" />
<ClInclude Include="..\..\src\ballistica\base\app\app_mode_empty.h" />
<ClCompile Include="..\..\src\ballistica\base\app\app_vr.cc" /> <ClCompile Include="..\..\src\ballistica\base\app\app_vr.cc" />
<ClInclude Include="..\..\src\ballistica\base\app\app_vr.h" /> <ClInclude Include="..\..\src\ballistica\base\app\app_vr.h" />
<ClCompile Include="..\..\src\ballistica\base\app\sdl_app.cc" /> <ClCompile Include="..\..\src\ballistica\base\app_mode\app_mode.cc" />
<ClInclude Include="..\..\src\ballistica\base\app\sdl_app.h" /> <ClInclude Include="..\..\src\ballistica\base\app_mode\app_mode.h" />
<ClCompile Include="..\..\src\ballistica\base\app\stress_test.cc" /> <ClCompile Include="..\..\src\ballistica\base\app_mode\app_mode_empty.cc" />
<ClInclude Include="..\..\src\ballistica\base\app\stress_test.h" /> <ClInclude Include="..\..\src\ballistica\base\app_mode\app_mode_empty.h" />
<ClCompile Include="..\..\src\ballistica\base\assets\asset.cc" /> <ClCompile Include="..\..\src\ballistica\base\assets\asset.cc" />
<ClInclude Include="..\..\src\ballistica\base\assets\asset.h" /> <ClInclude Include="..\..\src\ballistica\base\assets\asset.h" />
<ClCompile Include="..\..\src\ballistica\base\assets\assets.cc" /> <ClCompile Include="..\..\src\ballistica\base\assets\assets.cc" />
@ -398,6 +394,8 @@
<ClCompile Include="..\..\src\ballistica\base\python\support\python_context_call.cc" /> <ClCompile Include="..\..\src\ballistica\base\python\support\python_context_call.cc" />
<ClInclude Include="..\..\src\ballistica\base\python\support\python_context_call.h" /> <ClInclude Include="..\..\src\ballistica\base\python\support\python_context_call.h" />
<ClInclude Include="..\..\src\ballistica\base\python\support\python_context_call_runnable.h" /> <ClInclude Include="..\..\src\ballistica\base\python\support\python_context_call_runnable.h" />
<ClCompile Include="..\..\src\ballistica\base\support\app_config.cc" />
<ClInclude Include="..\..\src\ballistica\base\support\app_config.h" />
<ClInclude Include="..\..\src\ballistica\base\support\app_timer.h" /> <ClInclude Include="..\..\src\ballistica\base\support\app_timer.h" />
<ClInclude Include="..\..\src\ballistica\base\support\classic_soft.h" /> <ClInclude Include="..\..\src\ballistica\base\support\classic_soft.h" />
<ClCompile Include="..\..\src\ballistica\base\support\context.cc" /> <ClCompile Include="..\..\src\ballistica\base\support\context.cc" />
@ -407,6 +405,8 @@
<ClInclude Include="..\..\src\ballistica\base\support\plus_soft.h" /> <ClInclude Include="..\..\src\ballistica\base\support\plus_soft.h" />
<ClCompile Include="..\..\src\ballistica\base\support\stdio_console.cc" /> <ClCompile Include="..\..\src\ballistica\base\support\stdio_console.cc" />
<ClInclude Include="..\..\src\ballistica\base\support\stdio_console.h" /> <ClInclude Include="..\..\src\ballistica\base\support\stdio_console.h" />
<ClCompile Include="..\..\src\ballistica\base\support\stress_test.cc" />
<ClInclude Include="..\..\src\ballistica\base\support\stress_test.h" />
<ClInclude Include="..\..\src\ballistica\base\support\ui_v1_soft.h" /> <ClInclude Include="..\..\src\ballistica\base\support\ui_v1_soft.h" />
<ClCompile Include="..\..\src\ballistica\base\ui\console.cc" /> <ClCompile Include="..\..\src\ballistica\base\ui\console.cc" />
<ClInclude Include="..\..\src\ballistica\base\ui\console.h" /> <ClInclude Include="..\..\src\ballistica\base\ui\console.h" />

View File

@ -7,28 +7,16 @@
<ClInclude Include="..\..\src\ballistica\base\app\app.h"> <ClInclude Include="..\..\src\ballistica\base\app\app.h">
<Filter>ballistica\base\app</Filter> <Filter>ballistica\base\app</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ballistica\base\app\app_config.cc">
<Filter>ballistica\base\app</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\base\app\app_config.h">
<Filter>ballistica\base\app</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\base\app\app_headless.cc"> <ClCompile Include="..\..\src\ballistica\base\app\app_headless.cc">
<Filter>ballistica\base\app</Filter> <Filter>ballistica\base\app</Filter>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ballistica\base\app\app_headless.h"> <ClInclude Include="..\..\src\ballistica\base\app\app_headless.h">
<Filter>ballistica\base\app</Filter> <Filter>ballistica\base\app</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ballistica\base\app\app_mode.cc"> <ClCompile Include="..\..\src\ballistica\base\app\app_sdl.cc">
<Filter>ballistica\base\app</Filter> <Filter>ballistica\base\app</Filter>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ballistica\base\app\app_mode.h"> <ClInclude Include="..\..\src\ballistica\base\app\app_sdl.h">
<Filter>ballistica\base\app</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\base\app\app_mode_empty.cc">
<Filter>ballistica\base\app</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\base\app\app_mode_empty.h">
<Filter>ballistica\base\app</Filter> <Filter>ballistica\base\app</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ballistica\base\app\app_vr.cc"> <ClCompile Include="..\..\src\ballistica\base\app\app_vr.cc">
@ -37,17 +25,17 @@
<ClInclude Include="..\..\src\ballistica\base\app\app_vr.h"> <ClInclude Include="..\..\src\ballistica\base\app\app_vr.h">
<Filter>ballistica\base\app</Filter> <Filter>ballistica\base\app</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ballistica\base\app\sdl_app.cc"> <ClCompile Include="..\..\src\ballistica\base\app_mode\app_mode.cc">
<Filter>ballistica\base\app</Filter> <Filter>ballistica\base\app_mode</Filter>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ballistica\base\app\sdl_app.h"> <ClInclude Include="..\..\src\ballistica\base\app_mode\app_mode.h">
<Filter>ballistica\base\app</Filter> <Filter>ballistica\base\app_mode</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ballistica\base\app\stress_test.cc"> <ClCompile Include="..\..\src\ballistica\base\app_mode\app_mode_empty.cc">
<Filter>ballistica\base\app</Filter> <Filter>ballistica\base\app_mode</Filter>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ballistica\base\app\stress_test.h"> <ClInclude Include="..\..\src\ballistica\base\app_mode\app_mode_empty.h">
<Filter>ballistica\base\app</Filter> <Filter>ballistica\base\app_mode</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ballistica\base\assets\asset.cc"> <ClCompile Include="..\..\src\ballistica\base\assets\asset.cc">
<Filter>ballistica\base\assets</Filter> <Filter>ballistica\base\assets</Filter>
@ -628,6 +616,12 @@
<ClInclude Include="..\..\src\ballistica\base\python\support\python_context_call_runnable.h"> <ClInclude Include="..\..\src\ballistica\base\python\support\python_context_call_runnable.h">
<Filter>ballistica\base\python\support</Filter> <Filter>ballistica\base\python\support</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ballistica\base\support\app_config.cc">
<Filter>ballistica\base\support</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\base\support\app_config.h">
<Filter>ballistica\base\support</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ballistica\base\support\app_timer.h"> <ClInclude Include="..\..\src\ballistica\base\support\app_timer.h">
<Filter>ballistica\base\support</Filter> <Filter>ballistica\base\support</Filter>
</ClInclude> </ClInclude>
@ -655,6 +649,12 @@
<ClInclude Include="..\..\src\ballistica\base\support\stdio_console.h"> <ClInclude Include="..\..\src\ballistica\base\support\stdio_console.h">
<Filter>ballistica\base\support</Filter> <Filter>ballistica\base\support</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ballistica\base\support\stress_test.cc">
<Filter>ballistica\base\support</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\base\support\stress_test.h">
<Filter>ballistica\base\support</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ballistica\base\support\ui_v1_soft.h"> <ClInclude Include="..\..\src\ballistica\base\support\ui_v1_soft.h">
<Filter>ballistica\base\support</Filter> <Filter>ballistica\base\support</Filter>
</ClInclude> </ClInclude>
@ -1866,6 +1866,7 @@
<Filter Include="ballistica" /> <Filter Include="ballistica" />
<Filter Include="ballistica\base" /> <Filter Include="ballistica\base" />
<Filter Include="ballistica\base\app" /> <Filter Include="ballistica\base\app" />
<Filter Include="ballistica\base\app_mode" />
<Filter Include="ballistica\base\assets" /> <Filter Include="ballistica\base\assets" />
<Filter Include="ballistica\base\audio" /> <Filter Include="ballistica\base\audio" />
<Filter Include="ballistica\base\dynamics" /> <Filter Include="ballistica\base\dynamics" />

View File

@ -186,20 +186,16 @@
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\src\ballistica\base\app\app.cc" /> <ClCompile Include="..\..\src\ballistica\base\app\app.cc" />
<ClInclude Include="..\..\src\ballistica\base\app\app.h" /> <ClInclude Include="..\..\src\ballistica\base\app\app.h" />
<ClCompile Include="..\..\src\ballistica\base\app\app_config.cc" />
<ClInclude Include="..\..\src\ballistica\base\app\app_config.h" />
<ClCompile Include="..\..\src\ballistica\base\app\app_headless.cc" /> <ClCompile Include="..\..\src\ballistica\base\app\app_headless.cc" />
<ClInclude Include="..\..\src\ballistica\base\app\app_headless.h" /> <ClInclude Include="..\..\src\ballistica\base\app\app_headless.h" />
<ClCompile Include="..\..\src\ballistica\base\app\app_mode.cc" /> <ClCompile Include="..\..\src\ballistica\base\app\app_sdl.cc" />
<ClInclude Include="..\..\src\ballistica\base\app\app_mode.h" /> <ClInclude Include="..\..\src\ballistica\base\app\app_sdl.h" />
<ClCompile Include="..\..\src\ballistica\base\app\app_mode_empty.cc" />
<ClInclude Include="..\..\src\ballistica\base\app\app_mode_empty.h" />
<ClCompile Include="..\..\src\ballistica\base\app\app_vr.cc" /> <ClCompile Include="..\..\src\ballistica\base\app\app_vr.cc" />
<ClInclude Include="..\..\src\ballistica\base\app\app_vr.h" /> <ClInclude Include="..\..\src\ballistica\base\app\app_vr.h" />
<ClCompile Include="..\..\src\ballistica\base\app\sdl_app.cc" /> <ClCompile Include="..\..\src\ballistica\base\app_mode\app_mode.cc" />
<ClInclude Include="..\..\src\ballistica\base\app\sdl_app.h" /> <ClInclude Include="..\..\src\ballistica\base\app_mode\app_mode.h" />
<ClCompile Include="..\..\src\ballistica\base\app\stress_test.cc" /> <ClCompile Include="..\..\src\ballistica\base\app_mode\app_mode_empty.cc" />
<ClInclude Include="..\..\src\ballistica\base\app\stress_test.h" /> <ClInclude Include="..\..\src\ballistica\base\app_mode\app_mode_empty.h" />
<ClCompile Include="..\..\src\ballistica\base\assets\asset.cc" /> <ClCompile Include="..\..\src\ballistica\base\assets\asset.cc" />
<ClInclude Include="..\..\src\ballistica\base\assets\asset.h" /> <ClInclude Include="..\..\src\ballistica\base\assets\asset.h" />
<ClCompile Include="..\..\src\ballistica\base\assets\assets.cc" /> <ClCompile Include="..\..\src\ballistica\base\assets\assets.cc" />
@ -393,6 +389,8 @@
<ClCompile Include="..\..\src\ballistica\base\python\support\python_context_call.cc" /> <ClCompile Include="..\..\src\ballistica\base\python\support\python_context_call.cc" />
<ClInclude Include="..\..\src\ballistica\base\python\support\python_context_call.h" /> <ClInclude Include="..\..\src\ballistica\base\python\support\python_context_call.h" />
<ClInclude Include="..\..\src\ballistica\base\python\support\python_context_call_runnable.h" /> <ClInclude Include="..\..\src\ballistica\base\python\support\python_context_call_runnable.h" />
<ClCompile Include="..\..\src\ballistica\base\support\app_config.cc" />
<ClInclude Include="..\..\src\ballistica\base\support\app_config.h" />
<ClInclude Include="..\..\src\ballistica\base\support\app_timer.h" /> <ClInclude Include="..\..\src\ballistica\base\support\app_timer.h" />
<ClInclude Include="..\..\src\ballistica\base\support\classic_soft.h" /> <ClInclude Include="..\..\src\ballistica\base\support\classic_soft.h" />
<ClCompile Include="..\..\src\ballistica\base\support\context.cc" /> <ClCompile Include="..\..\src\ballistica\base\support\context.cc" />
@ -402,6 +400,8 @@
<ClInclude Include="..\..\src\ballistica\base\support\plus_soft.h" /> <ClInclude Include="..\..\src\ballistica\base\support\plus_soft.h" />
<ClCompile Include="..\..\src\ballistica\base\support\stdio_console.cc" /> <ClCompile Include="..\..\src\ballistica\base\support\stdio_console.cc" />
<ClInclude Include="..\..\src\ballistica\base\support\stdio_console.h" /> <ClInclude Include="..\..\src\ballistica\base\support\stdio_console.h" />
<ClCompile Include="..\..\src\ballistica\base\support\stress_test.cc" />
<ClInclude Include="..\..\src\ballistica\base\support\stress_test.h" />
<ClInclude Include="..\..\src\ballistica\base\support\ui_v1_soft.h" /> <ClInclude Include="..\..\src\ballistica\base\support\ui_v1_soft.h" />
<ClCompile Include="..\..\src\ballistica\base\ui\console.cc" /> <ClCompile Include="..\..\src\ballistica\base\ui\console.cc" />
<ClInclude Include="..\..\src\ballistica\base\ui\console.h" /> <ClInclude Include="..\..\src\ballistica\base\ui\console.h" />

View File

@ -7,28 +7,16 @@
<ClInclude Include="..\..\src\ballistica\base\app\app.h"> <ClInclude Include="..\..\src\ballistica\base\app\app.h">
<Filter>ballistica\base\app</Filter> <Filter>ballistica\base\app</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ballistica\base\app\app_config.cc">
<Filter>ballistica\base\app</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\base\app\app_config.h">
<Filter>ballistica\base\app</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\base\app\app_headless.cc"> <ClCompile Include="..\..\src\ballistica\base\app\app_headless.cc">
<Filter>ballistica\base\app</Filter> <Filter>ballistica\base\app</Filter>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ballistica\base\app\app_headless.h"> <ClInclude Include="..\..\src\ballistica\base\app\app_headless.h">
<Filter>ballistica\base\app</Filter> <Filter>ballistica\base\app</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ballistica\base\app\app_mode.cc"> <ClCompile Include="..\..\src\ballistica\base\app\app_sdl.cc">
<Filter>ballistica\base\app</Filter> <Filter>ballistica\base\app</Filter>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ballistica\base\app\app_mode.h"> <ClInclude Include="..\..\src\ballistica\base\app\app_sdl.h">
<Filter>ballistica\base\app</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ballistica\base\app\app_mode_empty.cc">
<Filter>ballistica\base\app</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\base\app\app_mode_empty.h">
<Filter>ballistica\base\app</Filter> <Filter>ballistica\base\app</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ballistica\base\app\app_vr.cc"> <ClCompile Include="..\..\src\ballistica\base\app\app_vr.cc">
@ -37,17 +25,17 @@
<ClInclude Include="..\..\src\ballistica\base\app\app_vr.h"> <ClInclude Include="..\..\src\ballistica\base\app\app_vr.h">
<Filter>ballistica\base\app</Filter> <Filter>ballistica\base\app</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ballistica\base\app\sdl_app.cc"> <ClCompile Include="..\..\src\ballistica\base\app_mode\app_mode.cc">
<Filter>ballistica\base\app</Filter> <Filter>ballistica\base\app_mode</Filter>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ballistica\base\app\sdl_app.h"> <ClInclude Include="..\..\src\ballistica\base\app_mode\app_mode.h">
<Filter>ballistica\base\app</Filter> <Filter>ballistica\base\app_mode</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ballistica\base\app\stress_test.cc"> <ClCompile Include="..\..\src\ballistica\base\app_mode\app_mode_empty.cc">
<Filter>ballistica\base\app</Filter> <Filter>ballistica\base\app_mode</Filter>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ballistica\base\app\stress_test.h"> <ClInclude Include="..\..\src\ballistica\base\app_mode\app_mode_empty.h">
<Filter>ballistica\base\app</Filter> <Filter>ballistica\base\app_mode</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ballistica\base\assets\asset.cc"> <ClCompile Include="..\..\src\ballistica\base\assets\asset.cc">
<Filter>ballistica\base\assets</Filter> <Filter>ballistica\base\assets</Filter>
@ -628,6 +616,12 @@
<ClInclude Include="..\..\src\ballistica\base\python\support\python_context_call_runnable.h"> <ClInclude Include="..\..\src\ballistica\base\python\support\python_context_call_runnable.h">
<Filter>ballistica\base\python\support</Filter> <Filter>ballistica\base\python\support</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ballistica\base\support\app_config.cc">
<Filter>ballistica\base\support</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\base\support\app_config.h">
<Filter>ballistica\base\support</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ballistica\base\support\app_timer.h"> <ClInclude Include="..\..\src\ballistica\base\support\app_timer.h">
<Filter>ballistica\base\support</Filter> <Filter>ballistica\base\support</Filter>
</ClInclude> </ClInclude>
@ -655,6 +649,12 @@
<ClInclude Include="..\..\src\ballistica\base\support\stdio_console.h"> <ClInclude Include="..\..\src\ballistica\base\support\stdio_console.h">
<Filter>ballistica\base\support</Filter> <Filter>ballistica\base\support</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\ballistica\base\support\stress_test.cc">
<Filter>ballistica\base\support</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ballistica\base\support\stress_test.h">
<Filter>ballistica\base\support</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ballistica\base\support\ui_v1_soft.h"> <ClInclude Include="..\..\src\ballistica\base\support\ui_v1_soft.h">
<Filter>ballistica\base\support</Filter> <Filter>ballistica\base\support</Filter>
</ClInclude> </ClInclude>
@ -1866,6 +1866,7 @@
<Filter Include="ballistica" /> <Filter Include="ballistica" />
<Filter Include="ballistica\base" /> <Filter Include="ballistica\base" />
<Filter Include="ballistica\base\app" /> <Filter Include="ballistica\base\app" />
<Filter Include="ballistica\base\app_mode" />
<Filter Include="ballistica\base\assets" /> <Filter Include="ballistica\base\assets" />
<Filter Include="ballistica\base\audio" /> <Filter Include="ballistica\base\audio" />
<Filter Include="ballistica\base\dynamics" /> <Filter Include="ballistica\base\dynamics" />

View File

@ -64,13 +64,14 @@ class App:
# The app launch process has not yet begun. # The app launch process has not yet begun.
INITIAL = 0 INITIAL = 0
# Our app subsystems are being inited but should not yet interact. # Our app subsystems are being inited but should not yet
# interact.
LAUNCHING = 1 LAUNCHING = 1
# App subsystems are inited and interacting, but the app has not # App subsystems are inited and interacting, but the app has not
# yet embarked on a high level course of action. It is doing initial # yet embarked on a high level course of action. It is doing
# account logins, workspace & asset downloads, etc. in order to # initial account logins, workspace & asset downloads, etc. in
# prepare for this. # order to prepare for this.
LOADING = 2 LOADING = 2
# All pieces are in place and the app is now doing its thing. # All pieces are in place and the app is now doing its thing.
@ -158,7 +159,7 @@ class App:
@property @property
def python_directory_user(self) -> str | None: def python_directory_user(self) -> str | None:
"""Path where ballistica expects its custom user scripts (mods) to live. """Path where ballistica expects its user scripts (mods) to live.
Be aware that this value may be None if ballistica is running in Be aware that this value may be None if ballistica is running in
a non-standard environment, and that python-path modifications may a non-standard environment, and that python-path modifications may
@ -248,13 +249,14 @@ class App:
self._app_paused = False self._app_paused = False
self._subsystem_registration_ended = False self._subsystem_registration_ended = False
self._pending_apply_app_config = False self._pending_apply_app_config = False
self._shutdown_called = False
# Config. # Config.
self.config_file_healthy = False self.config_file_healthy = False
# This is incremented any time the app is backgrounded/foregrounded; # This is incremented any time the app is
# can be a simple way to determine if network data should be # backgrounded/foregrounded; can be a simple way to determine if
# refreshed/etc. # network data should be refreshed/etc.
self.fg_state = 0 self.fg_state = 0
self._aioloop: asyncio.AbstractEventLoop | None = None self._aioloop: asyncio.AbstractEventLoop | None = None
@ -273,9 +275,10 @@ class App:
self.iircade_mode: bool = self._env['iircade_mode'] self.iircade_mode: bool = self._env['iircade_mode']
assert isinstance(self.iircade_mode, bool) assert isinstance(self.iircade_mode, bool)
# Default executor which can be used for misc background processing. # Default executor which can be used for misc background
# It should also be passed to any additional asyncio loops we create # processing. It should also be passed to any additional asyncio
# so that everything shares the same single set of worker threads. # loops we create so that everything shares the same single set
# of worker threads.
self.threadpool = ThreadPoolExecutor(thread_name_prefix='baworker') self.threadpool = ThreadPoolExecutor(thread_name_prefix='baworker')
self._config: babase.AppConfig | None = None self._config: babase.AppConfig | None = None
@ -288,10 +291,10 @@ class App:
self._intent: AppIntent | None = None self._intent: AppIntent | None = None
self._mode: AppMode | None = None self._mode: AppMode | None = None
# Controls which app-modes we use for handling given app-intents. # Controls which app-modes we use for handling given
# Plugins can override this to change high level app behavior and # app-intents. Plugins can override this to change high level
# spinoff projects can change the default implementation for the # app behavior and spinoff projects can change the default
# same effect. # implementation for the same effect.
self.mode_selector: AppModeSelector | None = None self.mode_selector: AppModeSelector | None = None
self._asyncio_timer: babase.AppTimer | None = None self._asyncio_timer: babase.AppTimer | None = None
@ -492,7 +495,7 @@ class App:
self._app_bootstrapping_complete = True self._app_bootstrapping_complete = True
self._update_state() self._update_state()
def on_app_launching(self) -> None: def _on_app_launching(self) -> None:
"""Called when the app enters the launching state. """Called when the app enters the launching state.
Here we can put together subsystems and other pieces for the Here we can put together subsystems and other pieces for the
@ -520,8 +523,8 @@ class App:
return return
# For now on other systems we just overwrite the bum config. # For now on other systems we just overwrite the bum config.
# At this point settings are already set; lets just commit them # At this point settings are already set; lets just commit
# to disk. # them to disk.
_appconfig.commit_app_config(force=True) _appconfig.commit_app_config(force=True)
# __FEATURESET_APP_SUBSYSTEM_CREATE_BEGIN__ # __FEATURESET_APP_SUBSYSTEM_CREATE_BEGIN__
@ -537,7 +540,7 @@ class App:
self._launch_completed = True self._launch_completed = True
self._update_state() self._update_state()
def on_app_loading(self) -> None: def _on_app_loading(self) -> None:
"""Called when the app enters the loading state. """Called when the app enters the loading state.
At this point, all built-in pieces of the app should be in place At this point, all built-in pieces of the app should be in place
@ -551,7 +554,7 @@ class App:
assert _babase.in_logic_thread() assert _babase.in_logic_thread()
# Get meta-system scanning built-in stuff in the bg. # Get meta-system scanning built-in stuff in the bg.
self.meta.start_scan(scan_complete_cb=self.on_meta_scan_complete) self.meta.start_scan(scan_complete_cb=self._on_meta_scan_complete)
# If any traceback dumps happened last run, log and clear them. # If any traceback dumps happened last run, log and clear them.
log_dumped_app_state() log_dumped_app_state()
@ -567,13 +570,13 @@ class App:
'Error in on_app_loading for subsystem %s.', subsystem 'Error in on_app_loading for subsystem %s.', subsystem
) )
# Normally plus tells us when initial sign-in is done. If it's # Normally plus tells us when initial sign-in is done. If plus
# not present, however, we just do that ourself so we can # is not present, however, we just do it ourself so we can
# proceed on to the running state. # proceed on to the running state.
if self.plus is None: if self.plus is None:
_babase.pushcall(self.on_initial_sign_in_completed) _babase.pushcall(self.on_initial_sign_in_completed)
def on_meta_scan_complete(self) -> None: def _on_meta_scan_complete(self) -> None:
"""Called when meta-scan is done doing its thing.""" """Called when meta-scan is done doing its thing."""
assert _babase.in_logic_thread() assert _babase.in_logic_thread()
@ -584,7 +587,7 @@ class App:
self._meta_scan_completed = True self._meta_scan_completed = True
self._update_state() self._update_state()
def on_app_running(self) -> None: def _on_app_running(self) -> None:
"""Called when the app enters the running state. """Called when the app enters the running state.
At this point, all workspaces, initial accounts, etc. are in place At this point, all workspaces, initial accounts, etc. are in place
@ -636,7 +639,8 @@ class App:
_babase.lifecyclelog('apply-app-config') _babase.lifecyclelog('apply-app-config')
# If multiple apply calls have been made, only actually apply once. # If multiple apply calls have been made, only actually apply
# once.
if not self._pending_apply_app_config: if not self._pending_apply_app_config:
return return
@ -701,15 +705,22 @@ class App:
# pylint: disable=too-many-branches # pylint: disable=too-many-branches
assert _babase.in_logic_thread() assert _babase.in_logic_thread()
if self._app_paused: if self._shutdown_called:
# Entering shutdown state:
if self.state is not self.State.SHUTTING_DOWN:
self.state = self.State.SHUTTING_DOWN
_babase.lifecyclelog('app state shutting down')
self._on_app_shutdown()
elif self._app_paused:
# Entering paused state: # Entering paused state:
if self.state is not self.State.PAUSED: if self.state is not self.State.PAUSED:
self.state = self.State.PAUSED self.state = self.State.PAUSED
self.on_app_pause() self._on_app_pause()
else: else:
# Leaving paused state: # Leaving paused state:
if self.state is self.State.PAUSED: if self.state is self.State.PAUSED:
self.on_app_resume() self._on_app_resume()
# Handle initially entering or returning to other states. # Handle initially entering or returning to other states.
if self._initial_sign_in_completed and self._meta_scan_completed: if self._initial_sign_in_completed and self._meta_scan_completed:
@ -718,14 +729,14 @@ class App:
_babase.lifecyclelog('app state running') _babase.lifecyclelog('app state running')
if not self._called_on_app_running: if not self._called_on_app_running:
self._called_on_app_running = True self._called_on_app_running = True
self.on_app_running() self._on_app_running()
elif self._launch_completed: elif self._launch_completed:
if self.state is not self.State.LOADING: if self.state is not self.State.LOADING:
self.state = self.State.LOADING self.state = self.State.LOADING
_babase.lifecyclelog('app state loading') _babase.lifecyclelog('app state loading')
if not self._called_on_app_loading: if not self._called_on_app_loading:
self._called_on_app_loading = True self._called_on_app_loading = True
self.on_app_loading() self._on_app_loading()
else: else:
# Only thing left is launching. We shouldn't be getting # Only thing left is launching. We shouldn't be getting
# called before at least that is complete. # called before at least that is complete.
@ -735,7 +746,7 @@ class App:
_babase.lifecyclelog('app state launching') _babase.lifecyclelog('app state launching')
if not self._called_on_app_launching: if not self._called_on_app_launching:
self._called_on_app_launching = True self._called_on_app_launching = True
self.on_app_launching() self._on_app_launching()
def pause(self) -> None: def pause(self) -> None:
"""Should be called by the native layer when the app pauses.""" """Should be called by the native layer when the app pauses."""
@ -749,7 +760,12 @@ class App:
self._app_paused = False self._app_paused = False
self._update_state() self._update_state()
def on_app_pause(self) -> None: def shutdown(self) -> None:
"""Should be called by the native layer when the app wants to quit."""
self._shutdown_called = True
self._update_state()
def _on_app_pause(self) -> None:
"""Called when the app goes to a paused state.""" """Called when the app goes to a paused state."""
assert _babase.in_logic_thread() assert _babase.in_logic_thread()
@ -762,7 +778,7 @@ class App:
'Error in on_app_pause for subsystem %s.', subsystem 'Error in on_app_pause for subsystem %s.', subsystem
) )
def on_app_resume(self) -> None: def _on_app_resume(self) -> None:
"""Called when resuming.""" """Called when resuming."""
assert _babase.in_logic_thread() assert _babase.in_logic_thread()
self.fg_state += 1 self.fg_state += 1
@ -776,13 +792,12 @@ class App:
'Error in on_app_resume for subsystem %s.', subsystem 'Error in on_app_resume for subsystem %s.', subsystem
) )
def on_app_shutdown(self) -> None: def _on_app_shutdown(self) -> None:
"""(internal)""" """(internal)"""
assert _babase.in_logic_thread() assert _babase.in_logic_thread()
self.state = self.State.SHUTTING_DOWN
# Shutdown all app subsystems in the opposite order they were # Inform app subsystems that we're shutting down in the opposite
# inited. # order they were inited.
for subsystem in reversed(self._subsystems): for subsystem in reversed(self._subsystems):
try: try:
subsystem.on_app_shutdown() subsystem.on_app_shutdown()
@ -821,16 +836,16 @@ class App:
"""Callback to be run after initial sign-in (or lack thereof). """Callback to be run after initial sign-in (or lack thereof).
This normally gets called by the plus subsystem. This normally gets called by the plus subsystem.
This period includes things such as syncing account workspaces The initial-sign-in process may include tasks such as syncing
or other data so it may take a substantial amount of time. account workspaces or other data so it may take a substantial
This should also run after a short amount of time if no login amount of time. This should also run after a short amount of
has occurred. time if no login is occurring.
""" """
assert _babase.in_logic_thread() assert _babase.in_logic_thread()
assert not self._initial_sign_in_completed assert not self._initial_sign_in_completed
# Tell meta it can start scanning extra stuff that just showed up # Tell meta it can start scanning extra stuff that just showed
# (namely account workspaces). # up (namely account workspaces).
self.meta.start_extra_scan() self.meta.start_extra_scan()
self._initial_sign_in_completed = True self._initial_sign_in_completed = True

View File

@ -301,7 +301,7 @@ def do_quit() -> None:
def shutdown() -> None: def shutdown() -> None:
_babase.app.on_app_shutdown() _babase.app.shutdown()
def hash_strings(inputs: list[str]) -> str: def hash_strings(inputs: list[str]) -> str:

View File

@ -52,7 +52,7 @@ if TYPE_CHECKING:
# Build number and version of the ballistica binary we expect to be # Build number and version of the ballistica binary we expect to be
# using. # using.
TARGET_BALLISTICA_BUILD = 21215 TARGET_BALLISTICA_BUILD = 21221
TARGET_BALLISTICA_VERSION = '1.7.26' TARGET_BALLISTICA_VERSION = '1.7.26'
@ -476,7 +476,8 @@ def _modular_main() -> None:
# Deal with a few key things here ourself before even running # Deal with a few key things here ourself before even running
# configure. # configure.
# Extract stuff below modifies this so work with a copy. # The extract_arg stuff below modifies this so we work with a
# copy.
args = sys.argv.copy() args = sys.argv.copy()
# NOTE: We need to keep these arg long/short arg versions synced # NOTE: We need to keep these arg long/short arg versions synced
@ -496,8 +497,8 @@ def _modular_main() -> None:
mods_dir = extract_arg(args, ['--mods-dir', '-m'], is_dir=True) mods_dir = extract_arg(args, ['--mods-dir', '-m'], is_dir=True)
# We run configure() BEFORE importing babase. (part of its job # We run configure() BEFORE importing babase. (part of its job
# is to wrangle paths to determine where babase and everything # is to wrangle paths which can affect where babase and
# else gets loaded from). # everything else gets loaded from).
configure( configure(
config_dir=config_dir, config_dir=config_dir,
data_dir=data_dir, data_dir=data_dir,

View File

@ -2,7 +2,6 @@
#include "ballistica/base/app/app.h" #include "ballistica/base/app/app.h"
#include "ballistica/base/app/stress_test.h"
#include "ballistica/base/graphics/graphics_server.h" #include "ballistica/base/graphics/graphics_server.h"
#include "ballistica/base/graphics/renderer/renderer.h" #include "ballistica/base/graphics/renderer/renderer.h"
#include "ballistica/base/input/device/touch_input.h" #include "ballistica/base/input/device/touch_input.h"
@ -12,6 +11,7 @@
#include "ballistica/base/networking/networking.h" #include "ballistica/base/networking/networking.h"
#include "ballistica/base/platform/base_platform.h" #include "ballistica/base/platform/base_platform.h"
#include "ballistica/base/support/stdio_console.h" #include "ballistica/base/support/stdio_console.h"
#include "ballistica/base/support/stress_test.h"
#include "ballistica/base/ui/console.h" #include "ballistica/base/ui/console.h"
#include "ballistica/base/ui/ui.h" #include "ballistica/base/ui/ui.h"
#include "ballistica/shared/foundation/event_loop.h" #include "ballistica/shared/foundation/event_loop.h"
@ -134,7 +134,7 @@ void App::LogicThreadShutdownComplete() {
done_ = true; done_ = true;
// Kill our own event loop (or tell the OS to kill its). // Flag our own event loop to exit (or tell the OS to do so for its own).
if (ManagesEventLoop()) { if (ManagesEventLoop()) {
event_loop()->Quit(); event_loop()->Quit();
} else { } else {
@ -147,28 +147,29 @@ void App::RunEvents() {
stress_test_->Update(); stress_test_->Update();
// Give platforms a chance to pump/handle their own events. // Give platforms a chance to pump/handle their own events.
// FIXME: now that we have app class overrides, platform should really //
// not be doing event handling. (need to fix rift build). // FIXME: now that we have app class overrides, platform should really not
// be doing event handling. (need to fix Rift build in this regard).
g_core->platform->RunEvents(); g_core->platform->RunEvents();
} }
void App::UpdatePauseResume() { void App::UpdatePauseResume_() {
if (actually_paused_) { if (actually_paused_) {
// Unpause if no one wants pause. // Unpause if no one wants pause.
if (!sys_paused_app_) { if (!sys_paused_app_) {
OnAppResume(); OnAppResume_();
actually_paused_ = false; actually_paused_ = false;
} }
} else { } else {
// OnAppPause if anyone wants. // OnAppPause if anyone wants.
if (sys_paused_app_) { if (sys_paused_app_) {
OnAppPause(); OnAppPause_();
actually_paused_ = true; actually_paused_ = true;
} }
} }
} }
void App::OnAppPause() { void App::OnAppPause_() {
assert(g_core->InMainThread()); assert(g_core->InMainThread());
// IMPORTANT: Any pause related stuff that event-loop-threads need to do // IMPORTANT: Any pause related stuff that event-loop-threads need to do
@ -186,7 +187,7 @@ void App::OnAppPause() {
g_core->platform->OnAppPause(); g_core->platform->OnAppPause();
} }
void App::OnAppResume() { void App::OnAppResume_() {
assert(g_core->InMainThread()); assert(g_core->InMainThread());
last_app_resume_time_ = g_core->GetAppTimeMillisecs(); last_app_resume_time_ = g_core->GetAppTimeMillisecs();
@ -244,7 +245,7 @@ void App::PauseApp() {
"PauseApp@" + std::to_string(core::CorePlatform::GetCurrentMillisecs())); "PauseApp@" + std::to_string(core::CorePlatform::GetCurrentMillisecs()));
assert(!sys_paused_app_); assert(!sys_paused_app_);
sys_paused_app_ = true; sys_paused_app_ = true;
UpdatePauseResume(); UpdatePauseResume_();
// We assume that the OS will completely suspend our process the moment // We assume that the OS will completely suspend our process the moment
// we return from this call (though this is not technically true on all // we return from this call (though this is not technically true on all
@ -286,7 +287,7 @@ void App::ResumeApp() {
"ResumeApp@" + std::to_string(core::CorePlatform::GetCurrentMillisecs())); "ResumeApp@" + std::to_string(core::CorePlatform::GetCurrentMillisecs()));
assert(sys_paused_app_); assert(sys_paused_app_);
sys_paused_app_ = false; sys_paused_app_ = false;
UpdatePauseResume(); UpdatePauseResume_();
if (g_buildconfig.debug_build()) { if (g_buildconfig.debug_build()) {
Log(LogLevel::kDebug, Log(LogLevel::kDebug,
"ResumeApp() completed in " "ResumeApp() completed in "

View File

@ -8,48 +8,44 @@
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include "ballistica/base/app/stress_test.h"
#include "ballistica/base/base.h" #include "ballistica/base/base.h"
#include "ballistica/base/support/stress_test.h"
namespace ballistica::base { namespace ballistica::base {
/// Encapsulates high level app behavior based on platform, build type, or /// Encapsulates high level app behavior for regular apps, vr apps,
/// other factors determined at launch. A single binary can support multiple /// headless apps, etc.
/// app-flavors (standard, vr, headless, etc.), but the app will always have
/// a single constant flavor for a given run.
class App { class App {
public: public:
explicit App(EventLoop* event_loop); explicit App(EventLoop* event_loop);
/// Should be run after the instance is created and assigned. /// Should be run after the instance is created and assigned. Any setup
/// Any setup that may trigger virtual methods or lookups via global /// that may trigger virtual methods or lookups via global should go here.
/// should go here.
void PostInit(); void PostInit();
/// Gets called when the app config is being applied. /// Gets called when the app config is being applied. Note that this call
/// Note that this call happens in the logic thread, so we should /// happens in the logic thread, so we should do any reading that needs to
/// do any reading that needs to happen in the logic thread and then /// happen in the logic thread and then forward the values to ourself back
/// forward the values to ourself back in our main thread. /// in our main thread.
void DoLogicThreadApplyAppConfig(); void DoLogicThreadApplyAppConfig();
/// Return whether this class runs its own event loop. /// Return whether this class runs its own event loop. If true,
/// If true, MonolithicMain() will continuously ask the app for events /// MonolithicMain() will continuously ask the app for events until the
/// until the app is quit, at which point MonolithicMain() returns. /// app is quit, at which point MonolithicMain() returns. If false,
/// If false, MonolithicMain returns immediately and it is assumed /// MonolithicMain returns immediately and it is assumed that the OS
/// that the OS handles the app lifecycle and pushes events to the app /// handles the app lifecycle and pushes events to the app via
/// via callbacks/etc. /// callbacks/etc.
auto ManagesEventLoop() const -> bool; auto ManagesEventLoop() const -> bool;
/// Called for non-event-loop apps to give them an opportunity to /// Called for non-event-loop apps to give them an opportunity to ensure
/// ensure they are self-sustaining. For instance, an app relying on /// they are self-sustaining. For instance, an app relying on frame-draws
/// frame-draws for its main thread event processing may need to /// for its main thread event processing may need to manually pump events
/// manually pump events until frame rendering begins. /// until frame rendering begins.
virtual void PrimeMainThreadEventPump(); virtual void PrimeMainThreadEventPump();
/// Handle any pending OS events. /// Handle any pending OS events. On normal graphical builds this is
/// On normal graphical builds this is triggered by RunRenderUpkeepCycle(); /// triggered by RunRenderUpkeepCycle(); timer intervals for headless
/// timer intervals for headless builds, etc. /// builds, etc. Should process any pending OS events, etc.
/// Should process any pending OS events, etc.
virtual void RunEvents(); virtual void RunEvents();
/// Put the app into a paused state. Should be called from the main /// Put the app into a paused state. Should be called from the main
@ -62,8 +58,8 @@ class App {
auto paused() const -> bool { return actually_paused_; } auto paused() const -> bool { return actually_paused_; }
/// OnAppResume the app; corresponds to returning to foreground on mobile/etc. /// OnAppResume the app; corresponds to returning to foreground on
/// Spins threads back up, re-opens network sockets, etc. /// mobile/etc. Spins threads back up, re-opens network sockets, etc.
void ResumeApp(); void ResumeApp();
/// The last time the app was resumed (uses GetAppTimeMillisecs() value). /// The last time the app was resumed (uses GetAppTimeMillisecs() value).
@ -77,21 +73,20 @@ class App {
/// Attempt to draw a frame. /// Attempt to draw a frame.
void DrawFrame(bool during_resize = false); void DrawFrame(bool during_resize = false);
/// Run updates in the logic thread. Generally called once per frame rendered /// Run updates in the logic thread. Generally called once per frame
/// or at some fixed rate for headless builds. /// rendered or at some fixed rate for headless builds.
void LogicThreadStepDisplayTime(); void LogicThreadStepDisplayTime();
/// Used on platforms where our main thread event processing is driven by /// Used on platforms where our main thread event processing is driven by
/// frame-draw commands given to us. This should be called after drawing /// frame-draw commands given to us. This should be called after drawing a
/// a frame in order to bring game state up to date and process OS events. /// frame in order to bring game state up to date and process OS events.
void RunRenderUpkeepCycle(); void RunRenderUpkeepCycle();
/// Called by the graphics-server when drawing completes for a frame. /// Called by the graphics-server when drawing completes for a frame.
virtual void DidFinishRenderingFrame(FrameDef* frame); virtual void DidFinishRenderingFrame(FrameDef* frame);
/// Return the price of an IAP product as a human-readable string, /// Return the price of an IAP product as a human-readable string, or an
/// or an empty string if not found. /// empty string if not found. FIXME: move this to platform.
/// FIXME: move this to platform.
auto GetProductPrice(const std::string& product) -> std::string; auto GetProductPrice(const std::string& product) -> std::string;
void SetProductPrice(const std::string& product, const std::string& price); void SetProductPrice(const std::string& product, const std::string& price);
@ -124,15 +119,18 @@ class App {
void PushPurchaseAckCall(const std::string& purchase, void PushPurchaseAckCall(const std::string& purchase,
const std::string& order_id); const std::string& order_id);
auto event_loop() const -> EventLoop* { return event_loop_; } auto event_loop() const -> EventLoop* { return event_loop_; }
/// Called by the logic thread when all shutdown-related tasks are done
/// and it is safe to exit the main event loop.
void LogicThreadShutdownComplete(); void LogicThreadShutdownComplete();
void LogicThreadOnAppRunning(); void LogicThreadOnAppRunning();
void LogicThreadOnInitialAppModeSet(); void LogicThreadOnInitialAppModeSet();
private: private:
void UpdatePauseResume(); void UpdatePauseResume_();
void OnAppPause(); void OnAppPause_();
void OnAppResume(); void OnAppResume_();
EventLoop* event_loop_{}; EventLoop* event_loop_{};
bool done_{}; bool done_{};
bool server_wrapper_managed_{}; bool server_wrapper_managed_{};

View File

@ -2,9 +2,8 @@
#if BA_SDL_BUILD #if BA_SDL_BUILD
#include "ballistica/base/app/sdl_app.h" #include "ballistica/base/app/app_sdl.h"
#include "ballistica/base/app/stress_test.h"
#include "ballistica/base/dynamics/bg/bg_dynamics.h" #include "ballistica/base/dynamics/bg/bg_dynamics.h"
#include "ballistica/base/graphics/gl/gl_sys.h" #include "ballistica/base/graphics/gl/gl_sys.h"
#include "ballistica/base/graphics/graphics_server.h" #include "ballistica/base/graphics/graphics_server.h"
@ -12,6 +11,7 @@
#include "ballistica/base/input/input.h" #include "ballistica/base/input/input.h"
#include "ballistica/base/logic/logic.h" #include "ballistica/base/logic/logic.h"
#include "ballistica/base/python/base_python.h" #include "ballistica/base/python/base_python.h"
#include "ballistica/base/support/stress_test.h"
#include "ballistica/core/platform/core_platform.h" #include "ballistica/core/platform/core_platform.h"
#include "ballistica/shared/foundation/event_loop.h" #include "ballistica/shared/foundation/event_loop.h"
#include "ballistica/shared/python/python.h" #include "ballistica/shared/python/python.h"
@ -20,7 +20,7 @@ namespace ballistica::base {
// NOTE TO SELF: slowly try to phase everything out from here and into // NOTE TO SELF: slowly try to phase everything out from here and into
// non-sdl event/call pushes. // non-sdl event/call pushes.
void SDLApp::HandleSDLEvent(const SDL_Event& event) { void AppSDL::HandleSDLEvent(const SDL_Event& event) {
assert(g_core->InMainThread()); assert(g_core->InMainThread());
switch (event.type) { switch (event.type) {
@ -236,7 +236,7 @@ auto FilterSDLEvent(const SDL_Event* event) -> int {
try { try {
// If this event is coming from this thread, handle it immediately. // If this event is coming from this thread, handle it immediately.
if (std::this_thread::get_id() == g_core->main_thread_id) { if (std::this_thread::get_id() == g_core->main_thread_id) {
auto app = static_cast_check_type<SDLApp*>(g_base->app); auto app = static_cast_check_type<AppSDL*>(g_base->app);
assert(app); assert(app);
if (app) { if (app) {
app->HandleSDLEvent(*event); app->HandleSDLEvent(*event);
@ -260,9 +260,9 @@ inline auto FilterSDL2Event(void* user_data, SDL_Event* event) -> int {
} }
#endif #endif
// Note: can move this to SDLApp::SDLApp() once it is no longer needed by // Note: can move this to AppSDL::AppSDL() once it is no longer needed by
// the legacy mac build. // the legacy mac build.
void SDLApp::InitSDL() { void AppSDL::InitSDL() {
assert(g_core); assert(g_core);
if (g_buildconfig.ostype_macos()) { if (g_buildconfig.ostype_macos()) {
@ -287,8 +287,8 @@ void SDLApp::InitSDL() {
// KILL THIS ONCE MAC SDL1.2 BUILD IS DEAD. // KILL THIS ONCE MAC SDL1.2 BUILD IS DEAD.
// Register our hotplug callbacks in our funky custom mac build. // Register our hotplug callbacks in our funky custom mac build.
#if BA_OSTYPE_MACOS && BA_XCODE_BUILD && !BA_HEADLESS_BUILD #if BA_OSTYPE_MACOS && BA_XCODE_BUILD && !BA_HEADLESS_BUILD
SDL_JoystickSetHotPlugCallbacks(SDLApp::SDLJoystickConnected, SDL_JoystickSetHotPlugCallbacks(AppSDL::SDLJoystickConnected,
SDLApp::SDLJoystickDisconnected); AppSDL::SDLJoystickDisconnected);
#endif #endif
} }
} }
@ -322,7 +322,7 @@ void SDLApp::InitSDL() {
#endif #endif
} }
SDLApp::SDLApp(EventLoop* event_loop) : App(event_loop) { AppSDL::AppSDL(EventLoop* event_loop) : App(event_loop) {
InitSDL(); InitSDL();
// If we're not running our own even loop, we set up a filter to intercept // If we're not running our own even loop, we set up a filter to intercept
@ -351,7 +351,7 @@ SDLApp::SDLApp(EventLoop* event_loop) : App(event_loop) {
} }
} }
void SDLApp::RunEvents() { void AppSDL::RunEvents() {
App::RunEvents(); App::RunEvents();
// Now run all pending SDL events until we run out or we're told to quit. // Now run all pending SDL events until we run out or we're told to quit.
@ -361,12 +361,12 @@ void SDLApp::RunEvents() {
} }
} }
void SDLApp::DidFinishRenderingFrame(FrameDef* frame) { void AppSDL::DidFinishRenderingFrame(FrameDef* frame) {
App::DidFinishRenderingFrame(frame); App::DidFinishRenderingFrame(frame);
SwapBuffers(); SwapBuffers();
} }
void SDLApp::DoSwap() { void AppSDL::DoSwap() {
assert(g_base->InGraphicsThread()); assert(g_base->InGraphicsThread());
if (g_buildconfig.debug_build()) { if (g_buildconfig.debug_build()) {
@ -413,7 +413,7 @@ void SDLApp::DoSwap() {
last_swap_time_ = cur_time; last_swap_time_ = cur_time;
} }
void SDLApp::SwapBuffers() { void AppSDL::SwapBuffers() {
swap_start_time_ = g_core->GetAppTimeMillisecs(); swap_start_time_ = g_core->GetAppTimeMillisecs();
assert(event_loop()->ThreadIsCurrent()); assert(event_loop()->ThreadIsCurrent());
DoSwap(); DoSwap();
@ -431,7 +431,7 @@ void SDLApp::SwapBuffers() {
} }
} }
void SDLApp::UpdateAutoVSync(int diff) { void AppSDL::UpdateAutoVSync(int diff) {
assert(auto_vsync_); assert(auto_vsync_);
// If we're currently vsyncing, watch for slow frames. // If we're currently vsyncing, watch for slow frames.
@ -499,7 +499,7 @@ void SDLApp::UpdateAutoVSync(int diff) {
} }
} }
void SDLApp::SetAutoVSync(bool enable) { void AppSDL::SetAutoVSync(bool enable) {
auto_vsync_ = enable; auto_vsync_ = enable;
// If we're doing auto, start with vsync on. // If we're doing auto, start with vsync on.
if (enable) { if (enable) {
@ -510,7 +510,7 @@ void SDLApp::SetAutoVSync(bool enable) {
} }
} }
void SDLApp::OnMainThreadStartApp() { void AppSDL::OnMainThreadStartApp() {
App::OnMainThreadStartApp(); App::OnMainThreadStartApp();
if (!g_core->HeadlessMode() && g_buildconfig.enable_sdl_joysticks()) { if (!g_core->HeadlessMode() && g_buildconfig.enable_sdl_joysticks()) {
@ -521,7 +521,7 @@ void SDLApp::OnMainThreadStartApp() {
if (explicit_bool(true)) { if (explicit_bool(true)) {
int joystick_count = SDL_NumJoysticks(); int joystick_count = SDL_NumJoysticks();
for (int i = 0; i < joystick_count; i++) { for (int i = 0; i < joystick_count; i++) {
SDLApp::SDLJoystickConnected(i); AppSDL::SDLJoystickConnected(i);
} }
// We want events from joysticks. // We want events from joysticks.
@ -530,7 +530,7 @@ void SDLApp::OnMainThreadStartApp() {
} }
} }
void SDLApp::SDLJoystickConnected(int device_index) { void AppSDL::SDLJoystickConnected(int device_index) {
assert(g_core && g_core->InMainThread()); assert(g_core && g_core->InMainThread());
// We add all existing inputs when bootstrapping is complete; we should // We add all existing inputs when bootstrapping is complete; we should
@ -556,17 +556,17 @@ void SDLApp::SDLJoystickConnected(int device_index) {
} }
} }
void SDLApp::SDLJoystickDisconnected(int index) { void AppSDL::SDLJoystickDisconnected(int index) {
assert(g_core->InMainThread()); assert(g_core->InMainThread());
assert(index >= 0); assert(index >= 0);
get()->RemoveSDLInputDevice(index); get()->RemoveSDLInputDevice(index);
} }
void SDLApp::SetInitialScreenDimensions(const Vector2f& dimensions) { void AppSDL::SetInitialScreenDimensions(const Vector2f& dimensions) {
screen_dimensions_ = dimensions; screen_dimensions_ = dimensions;
} }
void SDLApp::AddSDLInputDevice(JoystickInput* input, int index) { void AppSDL::AddSDLInputDevice(JoystickInput* input, int index) {
assert(g_base && g_base->input != nullptr); assert(g_base && g_base->input != nullptr);
assert(input != nullptr); assert(input != nullptr);
assert(g_core->InMainThread()); assert(g_core->InMainThread());
@ -581,7 +581,7 @@ void SDLApp::AddSDLInputDevice(JoystickInput* input, int index) {
g_base->input->PushAddInputDeviceCall(input, true); g_base->input->PushAddInputDeviceCall(input, true);
} }
void SDLApp::RemoveSDLInputDevice(int index) { void AppSDL::RemoveSDLInputDevice(int index) {
assert(g_core->InMainThread()); assert(g_core->InMainThread());
assert(index >= 0); assert(index >= 0);
JoystickInput* j = GetSDLJoyStickInput(index); JoystickInput* j = GetSDLJoyStickInput(index);
@ -596,7 +596,7 @@ void SDLApp::RemoveSDLInputDevice(int index) {
g_base->input->PushRemoveInputDeviceCall(j, true); g_base->input->PushRemoveInputDeviceCall(j, true);
} }
auto SDLApp::GetSDLJoyStickInput(const SDL_Event* e) const -> JoystickInput* { auto AppSDL::GetSDLJoyStickInput(const SDL_Event* e) const -> JoystickInput* {
assert(g_core->InMainThread()); assert(g_core->InMainThread());
int joy_id; int joy_id;
@ -621,7 +621,7 @@ auto SDLApp::GetSDLJoyStickInput(const SDL_Event* e) const -> JoystickInput* {
return GetSDLJoyStickInput(joy_id); return GetSDLJoyStickInput(joy_id);
} }
auto SDLApp::GetSDLJoyStickInput(int sdl_joystick_id) const -> JoystickInput* { auto AppSDL::GetSDLJoyStickInput(int sdl_joystick_id) const -> JoystickInput* {
assert(g_core->InMainThread()); assert(g_core->InMainThread());
for (auto sdl_joystick : sdl_joysticks_) { for (auto sdl_joystick : sdl_joysticks_) {
if ((sdl_joystick != nullptr) && (*sdl_joystick).sdl_joystick_id() >= 0 if ((sdl_joystick != nullptr) && (*sdl_joystick).sdl_joystick_id() >= 0

View File

@ -1,7 +1,7 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_BASE_APP_SDL_APP_H_ #ifndef BALLISTICA_BASE_APP_APP_SDL_H_
#define BALLISTICA_BASE_APP_SDL_APP_H_ #define BALLISTICA_BASE_APP_APP_SDL_H_
#if BA_SDL_BUILD #if BA_SDL_BUILD
@ -12,10 +12,10 @@
namespace ballistica::base { namespace ballistica::base {
class SDLApp : public App { class AppSDL : public App {
public: public:
static void InitSDL(); static void InitSDL();
explicit SDLApp(EventLoop* event_loop); explicit AppSDL(EventLoop* event_loop);
void HandleSDLEvent(const SDL_Event& event); void HandleSDLEvent(const SDL_Event& event);
void RunEvents() override; void RunEvents() override;
void DidFinishRenderingFrame(FrameDef* frame) override; void DidFinishRenderingFrame(FrameDef* frame) override;
@ -24,12 +24,12 @@ class SDLApp : public App {
static void SDLJoystickDisconnected(int index); static void SDLJoystickDisconnected(int index);
void OnMainThreadStartApp() override; void OnMainThreadStartApp() override;
/// Return g_base->app as a SDLApp. (assumes it actually is one). /// Return g_base->app as a AppSDL. (assumes it actually is one).
static SDLApp* get() { static AppSDL* get() {
assert(g_base && g_base->app != nullptr); assert(g_base && g_base->app != nullptr);
assert(dynamic_cast<SDLApp*>(g_base->app) assert(dynamic_cast<AppSDL*>(g_base->app)
== static_cast<SDLApp*>(g_base->app)); == static_cast<AppSDL*>(g_base->app));
return static_cast<SDLApp*>(g_base->app); return static_cast<AppSDL*>(g_base->app);
} }
void SetInitialScreenDimensions(const Vector2f& dimensions); void SetInitialScreenDimensions(const Vector2f& dimensions);
@ -63,4 +63,4 @@ class SDLApp : public App {
#endif // BA_SDL_BUILD #endif // BA_SDL_BUILD
#endif // BALLISTICA_BASE_APP_SDL_APP_H_ #endif // BALLISTICA_BASE_APP_APP_SDL_H_

View File

@ -23,8 +23,8 @@ void AppVR::PushVRSimpleRemoteStateCall(const VRSimpleRemoteState& state) {
s.l.tz = -0.3f; s.l.tz = -0.3f;
// Hmm; for now lets always assign this as right hand even when its in // Hmm; for now lets always assign this as right hand even when its in
// left-handed mode to keep things simple on the back-end. Can change later // left-handed mode to keep things simple on the back-end. Can change
// if there's a downside to that. // later if there's a downside to that.
s.r.type = VRHandType::kDaydreamRemote; s.r.type = VRHandType::kDaydreamRemote;
s.r.tx = 0.2f; s.r.tx = 0.2f;
s.r.ty = -0.2f; s.r.ty = -0.2f;
@ -47,9 +47,9 @@ void AppVR::VRPreDraw() {
} }
assert(g_base->InGraphicsThread()); assert(g_base->InGraphicsThread());
if (FrameDef* frame_def = g_base->graphics_server->GetRenderFrameDef()) { if (FrameDef* frame_def = g_base->graphics_server->GetRenderFrameDef()) {
// Note: this could be part of PreprocessRenderFrameDef but // Note: this could be part of PreprocessRenderFrameDef but the non-vr
// the non-vr path needs it to be separate since preprocess doesn't // path needs it to be separate since preprocess doesn't happen
// happen sometimes. Should probably clean that up. // sometimes. Should probably clean that up.
g_base->graphics_server->RunFrameDefMeshUpdates(frame_def); g_base->graphics_server->RunFrameDefMeshUpdates(frame_def);
// store this for the duration of this frame // store this for the duration of this frame
@ -82,8 +82,8 @@ void AppVR::VRSetHead(float tx, float ty, float tz, float yaw, float pitch,
void AppVR::VRSetHands(const VRHandsState& state) { void AppVR::VRSetHands(const VRHandsState& state) {
assert(g_base->InGraphicsThread()); assert(g_base->InGraphicsThread());
// Pass this along to the renderer (in this same thread) for drawing // Pass this along to the renderer (in this same thread) for drawing (so
// (so hands can be drawn at their absolute most up-to-date positions, etc). // hands can be drawn at their absolute most up-to-date positions, etc).
Renderer* renderer = g_base->graphics_server->renderer(); Renderer* renderer = g_base->graphics_server->renderer();
if (renderer == nullptr) { if (renderer == nullptr) {
return; return;
@ -91,10 +91,10 @@ void AppVR::VRSetHands(const VRHandsState& state) {
renderer->VRSetHands(state); renderer->VRSetHands(state);
// ALSO ship it off to the logic thread to actually handle input from it. // ALSO ship it off to the logic thread to actually handle input from it.
//
// FIXME: This should get shipped to a logic or input variant once we have // FIXME: This should get shipped to a logic or input variant once we have
// that for vr; not the graphics variant. // that for vr; not the graphics variant. Shipping it to the renderer
// Shipping it to the renderer above covers graphics needs in a lower // above covers graphics needs in a lower latency way.
// latency way.
g_base->logic->event_loop()->PushCall( g_base->logic->event_loop()->PushCall(
[state] { GraphicsVR::get()->set_vr_hands_state(state); }); [state] { GraphicsVR::get()->set_vr_hands_state(state); });
} }

View File

@ -1,6 +1,6 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/base/app/app_mode.h" #include "ballistica/base/app_mode/app_mode.h"
#include "ballistica/base/input/device/input_device_delegate.h" #include "ballistica/base/input/device/input_device_delegate.h"
#include "ballistica/base/support/context.h" #include "ballistica/base/support/context.h"

View File

@ -1,7 +1,7 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_BASE_APP_APP_MODE_H_ #ifndef BALLISTICA_BASE_APP_MODE_APP_MODE_H_
#define BALLISTICA_BASE_APP_APP_MODE_H_ #define BALLISTICA_BASE_APP_MODE_APP_MODE_H_
#include <vector> #include <vector>
@ -19,9 +19,9 @@ const microsecs_t kAppModeMaxHeadlessDisplayStep{500000};
const microsecs_t kAppModeMinHeadlessDisplayStep{1000}; const microsecs_t kAppModeMinHeadlessDisplayStep{1000};
/// Represents 'what the app is doing'. The global app-mode can be switched /// Represents 'what the app is doing'. The global app-mode can be switched
/// as the app is running. Be aware that, unlike the App/App classes /// as the app is running. Be aware that, unlike the App classes which
/// which operate in the main thread, most functionality here is based in the /// primarily operate in the main thread, most functionality here is based
/// logic thread. /// in the logic thread.
class AppMode { class AppMode {
public: public:
AppMode(); AppMode();
@ -118,4 +118,4 @@ class AppMode {
} // namespace ballistica::base } // namespace ballistica::base
#endif // BALLISTICA_BASE_APP_APP_MODE_H_ #endif // BALLISTICA_BASE_APP_MODE_APP_MODE_H_

View File

@ -1,6 +1,6 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/base/app/app_mode_empty.h" #include "ballistica/base/app_mode/app_mode_empty.h"
#include "ballistica/base/graphics/component/simple_component.h" #include "ballistica/base/graphics/component/simple_component.h"
#include "ballistica/base/graphics/graphics.h" #include "ballistica/base/graphics/graphics.h"
@ -23,9 +23,9 @@ auto AppModeEmpty::GetSingleton() -> AppModeEmpty* {
} }
void AppModeEmpty::Reset() { void AppModeEmpty::Reset() {
// When we are first created (for use as a placeholder before any app-modes // When we are first created (for use as a placeholder before any
// are set) we just draw nothing. However once we actually get reset for use // app-modes are set) we just draw nothing. However once we actually get
// as a an explicit app mode, we do our hello thing. // reset for use as a an explicit app mode, we do our hello thing.
hello_mode_ = true; hello_mode_ = true;
// Fade in if we currently aren't. // Fade in if we currently aren't.
@ -37,7 +37,7 @@ void AppModeEmpty::DrawWorld(base::FrameDef* frame_def) {
return; return;
} }
// Just draw our spinning hello text. // Draw some lovely spinning text.
if (!hello_text_group_.Exists()) { if (!hello_text_group_.Exists()) {
hello_text_group_ = Object::New<TextGroup>(); hello_text_group_ = Object::New<TextGroup>();
hello_text_group_->set_text("Potato!"); hello_text_group_->set_text("Potato!");

View File

@ -1,15 +1,18 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_BASE_APP_APP_MODE_EMPTY_H_ #ifndef BALLISTICA_BASE_APP_MODE_APP_MODE_EMPTY_H_
#define BALLISTICA_BASE_APP_APP_MODE_EMPTY_H_ #define BALLISTICA_BASE_APP_MODE_APP_MODE_EMPTY_H_
#include <vector> #include <vector>
#include "ballistica/base/app/app_mode.h" #include "ballistica/base/app_mode/app_mode.h"
#include "ballistica/shared/foundation/object.h" #include "ballistica/shared/foundation/object.h"
namespace ballistica::base { namespace ballistica::base {
/// An app-mode that doesn't do much of anything in particular. It is set as
/// a default when starting the app, but can also be used for 'hello world'
/// type stuff.
class AppModeEmpty : public AppMode { class AppModeEmpty : public AppMode {
public: public:
AppModeEmpty(); AppModeEmpty();
@ -25,4 +28,4 @@ class AppModeEmpty : public AppMode {
} // namespace ballistica::base } // namespace ballistica::base
#endif // BALLISTICA_BASE_APP_APP_MODE_EMPTY_H_ #endif // BALLISTICA_BASE_APP_MODE_APP_MODE_EMPTY_H_

View File

@ -2,7 +2,7 @@
#include "ballistica/base/assets/assets.h" #include "ballistica/base/assets/assets.h"
#include "ballistica/base/app/app_mode.h" #include "ballistica/base/app_mode/app_mode.h"
#include "ballistica/base/assets/assets_server.h" #include "ballistica/base/assets/assets_server.h"
#include "ballistica/base/assets/collision_mesh_asset.h" #include "ballistica/base/assets/collision_mesh_asset.h"
#include "ballistica/base/assets/data_asset.h" #include "ballistica/base/assets/data_asset.h"

View File

@ -2,10 +2,10 @@
#include "ballistica/base/audio/audio.h" #include "ballistica/base/audio/audio.h"
#include "ballistica/base/app/app_config.h"
#include "ballistica/base/assets/sound_asset.h" #include "ballistica/base/assets/sound_asset.h"
#include "ballistica/base/audio/audio_server.h" #include "ballistica/base/audio/audio_server.h"
#include "ballistica/base/audio/audio_source.h" #include "ballistica/base/audio/audio_source.h"
#include "ballistica/base/support/app_config.h"
#include "ballistica/shared/foundation/event_loop.h" #include "ballistica/shared/foundation/event_loop.h"
namespace ballistica::base { namespace ballistica::base {

View File

@ -3,8 +3,7 @@
#include "ballistica/base/base.h" #include "ballistica/base/base.h"
#include "ballistica/base/app/app.h" #include "ballistica/base/app/app.h"
#include "ballistica/base/app/app_config.h" #include "ballistica/base/app_mode/app_mode_empty.h"
#include "ballistica/base/app/app_mode_empty.h"
#include "ballistica/base/assets/assets.h" #include "ballistica/base/assets/assets.h"
#include "ballistica/base/assets/assets_server.h" #include "ballistica/base/assets/assets_server.h"
#include "ballistica/base/audio/audio.h" #include "ballistica/base/audio/audio.h"
@ -22,6 +21,7 @@
#include "ballistica/base/python/base_python.h" #include "ballistica/base/python/base_python.h"
#include "ballistica/base/python/class/python_class_feature_set_data.h" #include "ballistica/base/python/class/python_class_feature_set_data.h"
#include "ballistica/base/python/support/python_context_call.h" #include "ballistica/base/python/support/python_context_call.h"
#include "ballistica/base/support/app_config.h"
#include "ballistica/base/support/huffman.h" #include "ballistica/base/support/huffman.h"
#include "ballistica/base/support/plus_soft.h" #include "ballistica/base/support/plus_soft.h"
#include "ballistica/base/support/stdio_console.h" #include "ballistica/base/support/stdio_console.h"
@ -237,8 +237,8 @@ void BaseFeatureSet::LogVersionInfo() {
void BaseFeatureSet::set_app_mode(AppMode* mode) { void BaseFeatureSet::set_app_mode(AppMode* mode) {
assert(InLogicThread()); assert(InLogicThread());
// Make an exception here for empty mode since that's in place before an // Redundant sets should not happen (make an exception here for empty mode
// app mode is officially set. // since that's in place before any app mode is officially set).
if (mode == app_mode_ && mode != AppModeEmpty::GetSingleton()) { if (mode == app_mode_ && mode != AppModeEmpty::GetSingleton()) {
Log(LogLevel::kWarning, Log(LogLevel::kWarning,
"set_app_mode called with already-current app-mode; unexpected."); "set_app_mode called with already-current app-mode; unexpected.");

View File

@ -99,7 +99,7 @@ class RenderTarget;
class RemoteAppServer; class RemoteAppServer;
class RemoteControlInput; class RemoteControlInput;
class ScoreToBeat; class ScoreToBeat;
class SDLApp; class AppSDL;
class SDLContext; class SDLContext;
class SoundAsset; class SoundAsset;
class SpriteMesh; class SpriteMesh;
@ -688,7 +688,8 @@ class BaseFeatureSet : public FeatureSetNativeComponent,
const std::string& arg) override; const std::string& arg) override;
void OnReachedEndOfBaBaseImport(); void OnReachedEndOfBaBaseImport();
/// Called in the logic thread once our screen is up and assets are loading. /// Called in the logic thread once our screen is up and assets are
/// loading.
void OnAssetsAvailable(); void OnAssetsAvailable();
// Const subsystems. // Const subsystems.

View File

@ -192,8 +192,8 @@ void CollisionCache::CollideAgainstGeom(dGeomID g1, void* data,
collideAABBs(g1, g2, data, callback); collideAABBs(g1, g2, data, callback);
} }
// While we're here, lets run one pass of tests on these cells to zero in on // While we're here, lets run one pass of tests on these cells to zero in
// the actual collide/empty cutoff. // on the actual collide/empty cutoff.
for (int z = z_min; z <= z_max; z++) { for (int z = z_min; z <= z_max; z++) {
int base_index = z * grid_width_; int base_index = z * grid_width_;
for (int x = x_min; x <= x_max; x++) { for (int x = x_min; x <= x_max; x++) {

View File

@ -10,8 +10,8 @@
namespace ballistica::base { namespace ballistica::base {
// Given geoms, creates/samples a height map on the fly // Given geoms, creates/samples a height map on the fly which can be used
// which can be used for very fast AABB tests against the geometry. // for very fast AABB tests against the geometry.
class CollisionCache { class CollisionCache {
public: public:
CollisionCache(); CollisionCache();
@ -23,8 +23,8 @@ class CollisionCache {
void CollideAgainstSpace(dSpaceID space, void* data, dNearCallback* callback); void CollideAgainstSpace(dSpaceID space, void* data, dNearCallback* callback);
void CollideAgainstGeom(dGeomID geom, void* data, dNearCallback* callback); void CollideAgainstGeom(dGeomID geom, void* data, dNearCallback* callback);
// Call this periodically (once per cycle or so) to slowly fill in // Call this periodically (once per sim step or so) to slowly fill in
// the cache so there's less to do during spurts of activity; // the cache so there's less to do during spurts of activity.
void Precalc(); void Precalc();
private: private:

View File

@ -3,7 +3,7 @@
#if BA_ENABLE_OPENGL #if BA_ENABLE_OPENGL
#include "ballistica/base/graphics/gl/gl_sys.h" #include "ballistica/base/graphics/gl/gl_sys.h"
#include "ballistica/base/app/sdl_app.h" #include "ballistica/base/app/app_sdl.h"
#include "ballistica/base/base.h" #include "ballistica/base/base.h"
#include "ballistica/core/core.h" #include "ballistica/core/core.h"
@ -149,7 +149,7 @@ GLContext::GLContext(int target_res_x, int target_res_y, bool fullscreen)
// devices. // devices.
int win_size_x, win_size_y; int win_size_x, win_size_y;
SDL_GetWindowSize(sdl_window_, &win_size_x, &win_size_y); SDL_GetWindowSize(sdl_window_, &win_size_x, &win_size_y);
SDLApp::get()->SetInitialScreenDimensions(Vector2f( AppSDL::get()->SetInitialScreenDimensions(Vector2f(
static_cast<float>(win_size_x), static_cast<float>(win_size_y))); static_cast<float>(win_size_x), static_cast<float>(win_size_y)));
#if BA_OSTYPE_IOS_TVOS || BA_OSTYPE_ANDROID #if BA_OSTYPE_IOS_TVOS || BA_OSTYPE_ANDROID
res_x_ = win_size_x; res_x_ = win_size_x;
@ -188,7 +188,7 @@ GLContext::GLContext(int target_res_x, int target_res_y, bool fullscreen)
} }
res_x_ = surface_->w; res_x_ = surface_->w;
res_y_ = surface_->h; res_y_ = surface_->h;
SDLApp::get()->SetInitialScreenDimensions(Vector2f(res_x_, res_y_)); AppSDL::get()->SetInitialScreenDimensions(Vector2f(res_x_, res_y_));
SDL_WM_SetCaption("BallisticaKit", "BallisticaKit"); SDL_WM_SetCaption("BallisticaKit", "BallisticaKit");
#elif BA_OSTYPE_ANDROID #elif BA_OSTYPE_ANDROID
// On Android the Java layer creates a GL setup before even calling us. // On Android the Java layer creates a GL setup before even calling us.

View File

@ -3,8 +3,7 @@
#include "ballistica/base/graphics/graphics.h" #include "ballistica/base/graphics/graphics.h"
#include "ballistica/base/app/app.h" #include "ballistica/base/app/app.h"
#include "ballistica/base/app/app_config.h" #include "ballistica/base/app_mode/app_mode.h"
#include "ballistica/base/app/app_mode.h"
#include "ballistica/base/dynamics/bg/bg_dynamics.h" #include "ballistica/base/dynamics/bg/bg_dynamics.h"
#include "ballistica/base/graphics/component/empty_component.h" #include "ballistica/base/graphics/component/empty_component.h"
#include "ballistica/base/graphics/component/object_component.h" #include "ballistica/base/graphics/component/object_component.h"
@ -20,6 +19,7 @@
#include "ballistica/base/input/input.h" #include "ballistica/base/input/input.h"
#include "ballistica/base/logic/logic.h" #include "ballistica/base/logic/logic.h"
#include "ballistica/base/python/support/python_context_call.h" #include "ballistica/base/python/support/python_context_call.h"
#include "ballistica/base/support/app_config.h"
#include "ballistica/base/ui/console.h" #include "ballistica/base/ui/console.h"
#include "ballistica/base/ui/ui.h" #include "ballistica/base/ui/ui.h"
#include "ballistica/core/core.h" #include "ballistica/core/core.h"
@ -1116,8 +1116,8 @@ void Graphics::BuildAndPushFrameDef() {
assert(!building_frame_def_); assert(!building_frame_def_);
building_frame_def_ = true; building_frame_def_ = true;
// We should not be building/pushing any frames until after // We should not be building/pushing any frames until the native
// app-launch-commands have been run. // layer is fully bootstrapped.
BA_PRECONDITION_FATAL(g_base->logic->app_bootstrapping_complete()); BA_PRECONDITION_FATAL(g_base->logic->app_bootstrapping_complete());
// This should no longer be necessary.. // This should no longer be necessary..

View File

@ -8,7 +8,7 @@
// FIXME: clear out this conditional stuff. // FIXME: clear out this conditional stuff.
#if BA_SDL_BUILD #if BA_SDL_BUILD
#include "ballistica/base/app/sdl_app.h" #include "ballistica/base/app/app_sdl.h"
#else #else
#include "ballistica/base/app/app.h" #include "ballistica/base/app/app.h"
#include "ballistica/base/assets/assets.h" #include "ballistica/base/assets/assets.h"
@ -799,12 +799,12 @@ void GraphicsServer::PushSetVSyncCall(bool sync, bool auto_sync) {
#if BA_SDL_BUILD #if BA_SDL_BUILD
// Currently only supported for SDLApp. // Currently only supported for AppSDL.
// May want to revisit this later. // May want to revisit this later.
if (g_buildconfig.sdl_build()) { if (g_buildconfig.sdl_build()) {
// Even if we were built with SDL, we may not be running in sdl-app-mode // Even if we were built with SDL, we may not be running in sdl-app-mode
// (for instance, Rift in VR mode). Only do this if we're an sdl app. // (for instance, Rift in VR mode). Only do this if we're an sdl app.
if (auto app = dynamic_cast<SDLApp*>(g_base->app)) { if (auto app = dynamic_cast<AppSDL*>(g_base->app)) {
v_sync_ = sync; v_sync_ = sync;
auto_vsync_ = auto_sync; auto_vsync_ = auto_sync;
if (gl_context_) { if (gl_context_) {

View File

@ -86,7 +86,7 @@ void InputDevice::UpdateLastInputTime() {
// the overall input system know something happened. // the overall input system know something happened.
last_input_time_millisecs_ = last_input_time_millisecs_ =
static_cast<millisecs_t>(g_base->logic->display_time() * 1000.0); static_cast<millisecs_t>(g_base->logic->display_time() * 1000.0);
g_base->input->mark_input_active(); g_base->input->MarkInputActive();
} }
void InputDevice::InputCommand(InputType type, float value) { void InputDevice::InputCommand(InputType type, float value) {

View File

@ -3,7 +3,7 @@
#include "ballistica/base/input/device/joystick_input.h" #include "ballistica/base/input/device/joystick_input.h"
#include "ballistica/base/app/app.h" #include "ballistica/base/app/app.h"
#include "ballistica/base/app/app_mode.h" #include "ballistica/base/app_mode/app_mode.h"
#include "ballistica/base/audio/audio.h" #include "ballistica/base/audio/audio.h"
#include "ballistica/base/graphics/renderer/renderer.h" #include "ballistica/base/graphics/renderer/renderer.h"
#include "ballistica/base/input/input.h" #include "ballistica/base/input/input.h"

View File

@ -2,11 +2,11 @@
#include "ballistica/base/input/device/touch_input.h" #include "ballistica/base/input/device/touch_input.h"
#include "ballistica/base/app/app_config.h"
#include "ballistica/base/graphics/component/simple_component.h" #include "ballistica/base/graphics/component/simple_component.h"
#include "ballistica/base/graphics/support/camera.h" #include "ballistica/base/graphics/support/camera.h"
#include "ballistica/base/input/input.h" #include "ballistica/base/input/input.h"
#include "ballistica/base/python/base_python.h" #include "ballistica/base/python/base_python.h"
#include "ballistica/base/support/app_config.h"
#include "ballistica/base/ui/ui.h" #include "ballistica/base/ui/ui.h"
namespace ballistica::base { namespace ballistica::base {

View File

@ -2,8 +2,7 @@
#include "ballistica/base/input/input.h" #include "ballistica/base/input/input.h"
#include "ballistica/base/app/app_config.h" #include "ballistica/base/app_mode/app_mode.h"
#include "ballistica/base/app/app_mode.h"
#include "ballistica/base/audio/audio.h" #include "ballistica/base/audio/audio.h"
#include "ballistica/base/graphics/support/camera.h" #include "ballistica/base/graphics/support/camera.h"
#include "ballistica/base/input/device/joystick_input.h" #include "ballistica/base/input/device/joystick_input.h"
@ -12,6 +11,7 @@
#include "ballistica/base/input/device/touch_input.h" #include "ballistica/base/input/device/touch_input.h"
#include "ballistica/base/logic/logic.h" #include "ballistica/base/logic/logic.h"
#include "ballistica/base/python/base_python.h" #include "ballistica/base/python/base_python.h"
#include "ballistica/base/support/app_config.h"
#include "ballistica/base/ui/console.h" #include "ballistica/base/ui/console.h"
#include "ballistica/base/ui/ui.h" #include "ballistica/base/ui/ui.h"
#include "ballistica/shared/foundation/event_loop.h" #include "ballistica/shared/foundation/event_loop.h"
@ -819,7 +819,7 @@ void Input::ProcessStressTesting(int player_count) {
void Input::PushTextInputEvent(const std::string& text) { void Input::PushTextInputEvent(const std::string& text) {
SafePushCall(__func__, [this, text] { SafePushCall(__func__, [this, text] {
mark_input_active(); MarkInputActive();
// Ignore if input is locked. // Ignore if input is locked.
if (IsInputLocked()) { if (IsInputLocked()) {
@ -854,7 +854,7 @@ void Input::HandleJoystickEvent(const SDL_Event& event,
} }
// Make note that we're not idle. // Make note that we're not idle.
mark_input_active(); MarkInputActive();
// And that this particular device isn't idle either. // And that this particular device isn't idle either.
input_device->UpdateLastInputTime(); input_device->UpdateLastInputTime();
@ -909,7 +909,7 @@ void Input::ReleaseJoystickInput() {
void Input::HandleKeyPress(const SDL_Keysym* keysym) { void Input::HandleKeyPress(const SDL_Keysym* keysym) {
assert(g_base->InLogicThread()); assert(g_base->InLogicThread());
mark_input_active(); MarkInputActive();
// Ignore all key presses if input is locked. // Ignore all key presses if input is locked.
if (IsInputLocked()) { if (IsInputLocked()) {
@ -1081,7 +1081,7 @@ void Input::HandleKeyRelease(const SDL_Keysym* keysym) {
// Note: we want to let these through even if input is locked. // Note: we want to let these through even if input is locked.
mark_input_active(); MarkInputActive();
// If someone is capturing these events, give them a crack at it. // If someone is capturing these events, give them a crack at it.
if (keyboard_input_capture_release_) { if (keyboard_input_capture_release_) {
@ -1160,7 +1160,7 @@ void Input::HandleMouseScroll(const Vector2f& amount) {
if (IsInputLocked()) { if (IsInputLocked()) {
return; return;
} }
mark_input_active(); MarkInputActive();
if (std::abs(amount.y) > 0.0001f) { if (std::abs(amount.y) > 0.0001f) {
g_base->ui->SendWidgetMessage( g_base->ui->SendWidgetMessage(
@ -1194,7 +1194,7 @@ void Input::HandleSmoothMouseScroll(const Vector2f& velocity, bool momentum) {
if (IsInputLocked()) { if (IsInputLocked()) {
return; return;
} }
mark_input_active(); MarkInputActive();
bool handled = false; bool handled = false;
handled = g_base->ui->SendWidgetMessage( handled = g_base->ui->SendWidgetMessage(
@ -1222,7 +1222,7 @@ void Input::PushMouseMotionEvent(const Vector2f& position) {
void Input::HandleMouseMotion(const Vector2f& position) { void Input::HandleMouseMotion(const Vector2f& position) {
assert(g_base->graphics); assert(g_base->graphics);
assert(g_base->InLogicThread()); assert(g_base->InLogicThread());
mark_input_active(); MarkInputActive();
float old_cursor_pos_x = cursor_pos_x_; float old_cursor_pos_x = cursor_pos_x_;
float old_cursor_pos_y = cursor_pos_y_; float old_cursor_pos_y = cursor_pos_y_;
@ -1285,7 +1285,7 @@ void Input::HandleMouseDown(int button, const Vector2f& position) {
// return; // return;
// } // }
mark_input_active(); MarkInputActive();
last_mouse_move_time_ = g_core->GetAppTimeMillisecs(); last_mouse_move_time_ = g_core->GetAppTimeMillisecs();
mouse_move_count_++; mouse_move_count_++;
@ -1350,7 +1350,7 @@ void Input::PushMouseUpEvent(int button, const Vector2f& position) {
void Input::HandleMouseUp(int button, const Vector2f& position) { void Input::HandleMouseUp(int button, const Vector2f& position) {
assert(g_base->InLogicThread()); assert(g_base->InLogicThread());
mark_input_active(); MarkInputActive();
// Convert normalized view coords to our virtual ones. // Convert normalized view coords to our virtual ones.
cursor_pos_x_ = g_base->graphics->PixelToVirtualX( cursor_pos_x_ = g_base->graphics->PixelToVirtualX(
@ -1407,7 +1407,7 @@ void Input::HandleTouchEvent(const TouchEvent& e) {
return; return;
} }
mark_input_active(); MarkInputActive();
// float x = e.x; // float x = e.x;
// float y = e.y; // float y = e.y;

View File

@ -96,7 +96,7 @@ class Input {
// Should be called whenever user-input of some form comes through. // Should be called whenever user-input of some form comes through.
// void ResetIdleTime() { last_input_time_ = GetAppTimeMillisecs(); } // void ResetIdleTime() { last_input_time_ = GetAppTimeMillisecs(); }
auto mark_input_active() { input_active_ = true; } auto MarkInputActive() { input_active_ = true; }
// returns true if more than one non-keyboard device has been active recently // returns true if more than one non-keyboard device has been active recently
// ..this is used to determine whether we need to have strict menu ownership // ..this is used to determine whether we need to have strict menu ownership

View File

@ -3,7 +3,7 @@
#include "ballistica/base/logic/logic.h" #include "ballistica/base/logic/logic.h"
#include "ballistica/base/app/app.h" #include "ballistica/base/app/app.h"
#include "ballistica/base/app/app_mode.h" #include "ballistica/base/app_mode/app_mode.h"
#include "ballistica/base/audio/audio.h" #include "ballistica/base/audio/audio.h"
#include "ballistica/base/input/input.h" #include "ballistica/base/input/input.h"
#include "ballistica/base/python/base_python.h" #include "ballistica/base/python/base_python.h"
@ -168,23 +168,33 @@ void Logic::DoApplyAppConfig() {
void Logic::OnInitialScreenCreated() { void Logic::OnInitialScreenCreated() {
assert(g_base->InLogicThread()); assert(g_base->InLogicThread());
// Ok; graphics-server is telling us we've got a screen // Ok; graphics-server is telling us we've got a screen (or no screen in
// (or no screen in the case of headless-mode). // the case of headless-mode). We use this as a cue to kick off our
// We use this as a cue to kick off our business logic. // business logic.
// Let the Python layer know what's up. It will probably flip to // Let the Python layer know the native layer is now fully functional.
// 'Launching' state. // This will probably result in the Python layer flipping to the LAUNCHING
// state.
CompleteAppBootstrapping(); 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()) { if (!g_core->HeadlessMode()) {
// In gui mode, push an initial frame to the graphics server. From this
// point it will be self-sustaining, sending us a frame request each
// time it receives a new frame from us.
g_base->graphics->BuildAndPushFrameDef(); g_base->graphics->BuildAndPushFrameDef();
} else {
// Normally we step display-time as part of our frame-drawing process.
// If we're headless, we're not drawing any frames, but we still want to
// do minimal processing on any display-time timers. Let's run at a
// low-ish rate (10hz) to keep things efficient. Anyone dealing in
// display-time should be able to handle a wide variety of rates anyway.
// NOTE: This length is currently milliseconds.
headless_display_time_step_timer_ = event_loop()->NewTimer(
kAppModeMinHeadlessDisplayStep / 1000, true,
NewLambdaRunnable([this] { StepDisplayTime(); }));
} }
} }
// Launch into main menu or whatever else.
void Logic::CompleteAppBootstrapping() { void Logic::CompleteAppBootstrapping() {
assert(g_base->InLogicThread()); assert(g_base->InLogicThread());
assert(g_base->CurrentContext().IsEmpty()); assert(g_base->CurrentContext().IsEmpty());
@ -201,7 +211,7 @@ void Logic::CompleteAppBootstrapping() {
// the renderer is ready and then seamlessly create renderer-specific // the renderer is ready and then seamlessly create renderer-specific
// ones once the renderer is up. We could likely at least get a lot // ones once the renderer is up. We could likely at least get a lot
// of preloads done in the meantime. Though this would require preloads // of preloads done in the meantime. Though this would require preloads
// to be renderer-agnostic; not sure if that's the case. // to be renderer-agnostic; not sure if that will always be the case.
g_base->assets->StartLoading(); g_base->assets->StartLoading();
// Let base know it can create the console or other asset-dependent things. // Let base know it can create the console or other asset-dependent things.
@ -213,17 +223,6 @@ void Logic::CompleteAppBootstrapping() {
asset_prune_timer_ = event_loop()->NewTimer( asset_prune_timer_ = event_loop()->NewTimer(
2345, true, NewLambdaRunnable([] { g_base->assets->Prune(); })); 2345, true, NewLambdaRunnable([] { g_base->assets->Prune(); }));
// Normally we step display-time as part of our frame-drawing process. If
// we're headless, we're not drawing any frames, but we still want to do
// minimal processing on any display-time timers. Let's run at a low-ish
// rate (10hz) to keep things efficient. Anyone dealing in display-time
// should be able to handle a wide variety of rates anyway.
if (g_core->HeadlessMode()) {
// NOTE: This length is currently milliseconds.
headless_display_time_step_timer_ = event_loop()->NewTimer(
kAppModeMinHeadlessDisplayStep / 1000, true,
NewLambdaRunnable([this] { StepDisplayTime(); }));
}
// Let our initial app-mode know it has become active. // Let our initial app-mode know it has become active.
g_base->app_mode()->OnActivate(); g_base->app_mode()->OnActivate();
@ -247,10 +246,10 @@ void Logic::OnScreenSizeChange(float virtual_width, float virtual_height,
float pixel_width, float pixel_height) { float pixel_width, float pixel_height) {
assert(g_base->InLogicThread()); assert(g_base->InLogicThread());
// First, pass the new values to the graphics subsystem. // First, pass the new values to the graphics subsystem. Then inform
// Then inform everyone else simply that they changed; they can ask // everyone else simply that they changed; they can ask g_graphics for
// g_graphics for whatever specific values they need. // whatever specific values they need. Note: keep these in the same order
// Note: keep these in the same order as OnAppStart. // as OnAppStart.
g_base->graphics->OnScreenSizeChange(virtual_width, virtual_height, g_base->graphics->OnScreenSizeChange(virtual_width, virtual_height,
pixel_width, pixel_height); pixel_width, pixel_height);
g_base->audio->OnScreenSizeChange(); g_base->audio->OnScreenSizeChange();
@ -306,8 +305,8 @@ void Logic::StepDisplayTime() {
void Logic::OnAppModeChanged() { void Logic::OnAppModeChanged() {
assert(g_base->InLogicThread()); assert(g_base->InLogicThread());
// Kick our headless stepping into high gear; this will snap us out of // Kick our headless stepping into high gear; this will snap us out of any
// any long sleep we're currently in the middle of. // long sleep we're currently in the middle of.
if (g_core->HeadlessMode()) { if (g_core->HeadlessMode()) {
if (debug_log_display_time_) { if (debug_log_display_time_) {
Log(LogLevel::kDebug, Log(LogLevel::kDebug,
@ -322,13 +321,13 @@ void Logic::OnAppModeChanged() {
void Logic::UpdateDisplayTimeForHeadlessMode() { void Logic::UpdateDisplayTimeForHeadlessMode() {
assert(g_base->InLogicThread()); assert(g_base->InLogicThread());
// In this case we just keep display time synced up with app time; we don't // In this case we just keep display time synced up with app time; we
// care about keeping the increments smooth or consistent. // don't care about keeping the increments smooth or consistent.
// The one thing we *do* try to do, however, is keep our timer length // The one thing we *do* try to do, however, is keep our timer length
// updated so that we fire exactly when the app mode has events scheduled // updated so that we fire exactly when the app mode has events scheduled
// (or at least close enough so we can fudge it and tell them its that exact // (or at least close enough so we can fudge it and tell them its that
// time). // exact time).
auto app_time_microsecs = g_core->GetAppTimeMicrosecs(); auto app_time_microsecs = g_core->GetAppTimeMicrosecs();
@ -352,9 +351,9 @@ void Logic::UpdateDisplayTimeForHeadlessMode() {
void Logic::PostUpdateDisplayTimeForHeadlessMode() { void Logic::PostUpdateDisplayTimeForHeadlessMode() {
assert(g_base->InLogicThread()); assert(g_base->InLogicThread());
// At this point we've stepped our app-mode, so let's ask it how // At this point we've stepped our app-mode, so let's ask it how long
// long we've got until the next event. We'll plug this into our // we've got until the next event. We'll plug this into our display-update
// display-update timer so we can try to sleep until that point. // timer so we can try to sleep until that point.
auto headless_display_step_microsecs = auto headless_display_step_microsecs =
std::max(std::min(g_base->app_mode()->GetHeadlessDisplayStep(), std::max(std::min(g_base->app_mode()->GetHeadlessDisplayStep(),
kAppModeMaxHeadlessDisplayStep), kAppModeMaxHeadlessDisplayStep),
@ -376,14 +375,14 @@ void Logic::PostUpdateDisplayTimeForHeadlessMode() {
} }
void Logic::UpdateDisplayTimeForFrameDraw() { void Logic::UpdateDisplayTimeForFrameDraw() {
// Here we update our smoothed display-time-increment based on how fast // Here we update our smoothed display-time-increment based on how fast we
// we are currently rendering frames. We want display-time to basically // are currently rendering frames. We want display-time to basically be
// be progressing at the same rate as app-time but in as constant // progressing at the same rate as app-time but in as constant of a manner
// of a manner as possible so that animations, simulation-stepping/etc. // as possible so that animations, simulation-stepping/etc. appears smooth
// appears smooth (app-time measurements at render times exhibit quite a bit // (app-time measurements at render times exhibit quite a bit of jitter).
// of jitter). Though we also don't want it to be *too* smooth; drops in // Though we also don't want it to be *too* smooth; drops in framerate
// framerate should still be reflected quickly in display-time-increment // should still be reflected quickly in display-time-increment otherwise
// otherwise it can look like the game is slowing down or speeding up. // it can look like the game is slowing down or speeding up.
// Flip this on to debug this stuff. // Flip this on to debug this stuff.
// Things to look for: // Things to look for:
@ -417,9 +416,9 @@ void Logic::UpdateDisplayTimeForFrameDraw() {
} }
// It seems that when things get thrown off it is often due to a single // It seems that when things get thrown off it is often due to a single
// rogue sample being unusually long and often the next one being unusually // rogue sample being unusually long and often the next one being
// short. Let's try to filter out some of these cases by ignoring both // unusually short. Let's try to filter out some of these cases by
// the longest and shortest sample in our set. // ignoring both the longest and shortest sample in our set.
int max_index{}; int max_index{};
int min_index{}; int min_index{};
double max_val{recent_display_time_increments_[0]}; double max_val{recent_display_time_increments_[0]};
@ -523,8 +522,8 @@ void Logic::UpdateDisplayTimeForFrameDraw() {
void Logic::UpdatePendingWorkTimer() { void Logic::UpdatePendingWorkTimer() {
assert(g_base->InLogicThread()); assert(g_base->InLogicThread());
// This might get called before we set up our timer in some cases. (such as // This might get called before we set up our timer in some cases. (such
// very early) should be safe to ignore since we update the interval // as very early) should be safe to ignore since we update the interval
// explicitly after creating the timers. // explicitly after creating the timers.
if (!process_pending_work_timer_) { if (!process_pending_work_timer_) {
return; return;
@ -535,7 +534,8 @@ void Logic::UpdatePendingWorkTimer() {
assert(process_pending_work_timer_); assert(process_pending_work_timer_);
process_pending_work_timer_->SetLength(1); process_pending_work_timer_->SetLength(1);
} else { } else {
// Otherwise we've got nothing to do; go to sleep until something changes. // Otherwise we've got nothing to do; go to sleep until something
// changes.
assert(process_pending_work_timer_); assert(process_pending_work_timer_);
process_pending_work_timer_->SetLength(-1); process_pending_work_timer_->SetLength(-1);
} }
@ -550,9 +550,9 @@ void Logic::HandleInterruptSignal() {
return; return;
} }
// Go with a low level process shutdown here. In situations // Go with a low level process shutdown here. In situations where we're
// where we're getting interrupt signals I don't think we'd ever want // getting interrupt signals I don't think we'd ever want high level
// high level 'soft' quits. // 'soft' quits.
Shutdown(); Shutdown();
} }
@ -560,17 +560,18 @@ void Logic::Draw() {
assert(g_base->InLogicThread()); assert(g_base->InLogicThread());
assert(!g_core->HeadlessMode()); assert(!g_core->HeadlessMode());
// Push a snapshot of our current state to be rendered in the graphics thread. // Push a snapshot of our current state to be rendered in the graphics
// thread.
g_base->graphics->BuildAndPushFrameDef(); g_base->graphics->BuildAndPushFrameDef();
// Now bring logic up to date. // Now bring logic up to date. By doing this *after* fulfilling the draw
// By doing this *after* fulfilling the draw request, we're minimizing the // request, we're minimizing the chance of long logic updates leading to
// chance of long logic updates leading to delays in frame-def delivery // delays in frame-def delivery leading to frame drops. The downside is
// leading to frame drops. The downside is that when logic updates are fast // that when logic updates are fast then logic is basically sitting around
// then logic is basically sitting around twiddling its thumbs and getting // twiddling its thumbs and getting a full frame out of date before being
// a full frame out of date before being drawn. But as high frame rates are // drawn. But as high frame rates are becoming more normal this becomes
// becoming more normal this becomes less and less meaningful and its probably // less and less meaningful and its probably best to prioritize smooth
// best to prioritize smooth visuals. // visuals.
StepDisplayTime(); StepDisplayTime();
} }

View File

@ -49,6 +49,7 @@ class Logic {
/// FIXME: I feel like this should be in one of the App classes. /// FIXME: I feel like this should be in one of the App classes.
void Shutdown(); void Shutdown();
/// Has CompleteAppBootstrapping been called?
auto app_bootstrapping_complete() const { auto app_bootstrapping_complete() const {
return app_bootstrapping_complete_; return app_bootstrapping_complete_;
} }

View File

@ -2,7 +2,7 @@
#include "ballistica/base/networking/network_reader.h" #include "ballistica/base/networking/network_reader.h"
#include "ballistica/base/app/app_mode.h" #include "ballistica/base/app_mode/app_mode.h"
#include "ballistica/base/input/support/remote_app_server.h" #include "ballistica/base/input/support/remote_app_server.h"
#include "ballistica/base/logic/logic.h" #include "ballistica/base/logic/logic.h"
#include "ballistica/base/python/base_python.h" #include "ballistica/base/python/base_python.h"

View File

@ -3,8 +3,8 @@
#include "ballistica/base/networking/networking.h" #include "ballistica/base/networking/networking.h"
#include "ballistica/base/app/app.h" #include "ballistica/base/app/app.h"
#include "ballistica/base/app/app_config.h"
#include "ballistica/base/networking/network_reader.h" #include "ballistica/base/networking/network_reader.h"
#include "ballistica/base/support/app_config.h"
#include "ballistica/shared/foundation/event_loop.h" #include "ballistica/shared/foundation/event_loop.h"
#include "ballistica/shared/networking/sockaddr.h" #include "ballistica/shared/networking/sockaddr.h"

View File

@ -25,7 +25,7 @@
#endif #endif
#include "ballistica/base/app/app.h" #include "ballistica/base/app/app.h"
#include "ballistica/base/app/sdl_app.h" #include "ballistica/base/app/app_sdl.h"
#include "ballistica/base/graphics/graphics.h" #include "ballistica/base/graphics/graphics.h"
#include "ballistica/base/graphics/graphics_vr.h" #include "ballistica/base/graphics/graphics_vr.h"
@ -113,7 +113,7 @@ auto BasePlatform::CreateApp() -> App* {
// TEMP - need to init sdl on our legacy mac build even though its not // TEMP - need to init sdl on our legacy mac build even though its not
// technically an SDL app. Kill this once the old mac build is gone. // technically an SDL app. Kill this once the old mac build is gone.
#if BA_LEGACY_MACOS_BUILD #if BA_LEGACY_MACOS_BUILD
SDLApp::InitSDL(); AppSDL::InitSDL();
#endif #endif
App* app{}; App* app{};
@ -125,12 +125,12 @@ auto BasePlatform::CreateApp() -> App* {
if (g_core->vr_mode) { if (g_core->vr_mode) {
app = new AppVR(g_core->main_event_loop()); app = new AppVR(g_core->main_event_loop());
} else { } else {
app = new SDLApp(g_core->main_event_loop()); app = new AppSDL(g_core->main_event_loop());
} }
#elif BA_CARDBOARD_BUILD #elif BA_CARDBOARD_BUILD
app = new AppVR(g_core->main_event_loop()); app = new AppVR(g_core->main_event_loop());
#elif BA_SDL_BUILD #elif BA_SDL_BUILD
app = new SDLApp(g_core->main_event_loop()); app = new AppSDL(g_core->main_event_loop());
#else #else
app = new App(g_core->main_event_loop()); app = new App(g_core->main_event_loop());
#endif #endif

View File

@ -3,8 +3,8 @@
#include "ballistica/base/python/methods/python_methods_app.h" #include "ballistica/base/python/methods/python_methods_app.h"
#include "ballistica/base/app/app.h" #include "ballistica/base/app/app.h"
#include "ballistica/base/app/app_mode.h" #include "ballistica/base/app_mode/app_mode.h"
#include "ballistica/base/app/app_mode_empty.h" #include "ballistica/base/app_mode/app_mode_empty.h"
#include "ballistica/base/graphics/graphics_server.h" #include "ballistica/base/graphics/graphics_server.h"
#include "ballistica/base/logic/logic.h" #include "ballistica/base/logic/logic.h"
#include "ballistica/base/python/base_python.h" #include "ballistica/base/python/base_python.h"

View File

@ -5,13 +5,13 @@
#include <list> #include <list>
#include <unordered_map> #include <unordered_map>
#include "ballistica/base/app/app_config.h"
#include "ballistica/base/assets/assets.h" #include "ballistica/base/assets/assets.h"
#include "ballistica/base/assets/sound_asset.h" #include "ballistica/base/assets/sound_asset.h"
#include "ballistica/base/input/input.h" #include "ballistica/base/input/input.h"
#include "ballistica/base/platform/base_platform.h" #include "ballistica/base/platform/base_platform.h"
#include "ballistica/base/python/base_python.h" #include "ballistica/base/python/base_python.h"
#include "ballistica/base/python/class/python_class_simple_sound.h" #include "ballistica/base/python/class/python_class_simple_sound.h"
#include "ballistica/base/support/app_config.h"
#include "ballistica/base/ui/ui.h" #include "ballistica/base/ui/ui.h"
#include "ballistica/shared/generic/utils.h" #include "ballistica/shared/generic/utils.h"

View File

@ -1,6 +1,6 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/base/app/app_config.h" #include "ballistica/base/support/app_config.h"
#include "ballistica/base/python/base_python.h" #include "ballistica/base/python/base_python.h"
#include "ballistica/core/core.h" #include "ballistica/core/core.h"

View File

@ -1,7 +1,7 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_BASE_APP_APP_CONFIG_H_ #ifndef BALLISTICA_BASE_SUPPORT_APP_CONFIG_H_
#define BALLISTICA_BASE_APP_APP_CONFIG_H_ #define BALLISTICA_BASE_SUPPORT_APP_CONFIG_H_
#include <map> #include <map>
#include <memory> #include <memory>
@ -139,4 +139,4 @@ class AppConfig {
} // namespace ballistica::base } // namespace ballistica::base
#endif // BALLISTICA_BASE_APP_APP_CONFIG_H_ #endif // BALLISTICA_BASE_SUPPORT_APP_CONFIG_H_

View File

@ -5,7 +5,7 @@
#include <cstring> #include <cstring>
#include "ballistica/base/app/app.h" #include "ballistica/base/app/app.h"
#include "ballistica/base/app/app_mode.h" #include "ballistica/base/app_mode/app_mode.h"
#include "ballistica/base/logic/logic.h" #include "ballistica/base/logic/logic.h"
#include "ballistica/base/support/context.h" #include "ballistica/base/support/context.h"
#include "ballistica/core/platform/core_platform.h" #include "ballistica/core/platform/core_platform.h"

View File

@ -1,6 +1,6 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#include "ballistica/base/app/stress_test.h" #include "ballistica/base/support/stress_test.h"
#include "ballistica/base/graphics/graphics_server.h" #include "ballistica/base/graphics/graphics_server.h"
#include "ballistica/base/graphics/renderer/renderer.h" #include "ballistica/base/graphics/renderer/renderer.h"

View File

@ -1,7 +1,7 @@
// Released under the MIT License. See LICENSE for details. // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_BASE_APP_STRESS_TEST_H_ #ifndef BALLISTICA_BASE_SUPPORT_STRESS_TEST_H_
#define BALLISTICA_BASE_APP_STRESS_TEST_H_ #define BALLISTICA_BASE_SUPPORT_STRESS_TEST_H_
#include "ballistica/shared/ballistica.h" #include "ballistica/shared/ballistica.h"
@ -22,4 +22,4 @@ class StressTest {
} // namespace ballistica::base } // namespace ballistica::base
#endif // BALLISTICA_BASE_APP_STRESS_TEST_H_ #endif // BALLISTICA_BASE_SUPPORT_STRESS_TEST_H_

View File

@ -2,7 +2,7 @@
#include "ballistica/base/ui/console.h" #include "ballistica/base/ui/console.h"
#include "ballistica/base/app/app_mode.h" #include "ballistica/base/app_mode/app_mode.h"
#include "ballistica/base/audio/audio.h" #include "ballistica/base/audio/audio.h"
#include "ballistica/base/graphics/component/simple_component.h" #include "ballistica/base/graphics/component/simple_component.h"
#include "ballistica/base/graphics/text/text_graphics.h" #include "ballistica/base/graphics/text/text_graphics.h"

View File

@ -2,12 +2,12 @@
#include "ballistica/base/ui/ui.h" #include "ballistica/base/ui/ui.h"
#include "ballistica/base/app/app_config.h"
#include "ballistica/base/audio/audio.h" #include "ballistica/base/audio/audio.h"
#include "ballistica/base/input/device/keyboard_input.h" #include "ballistica/base/input/device/keyboard_input.h"
#include "ballistica/base/input/input.h" #include "ballistica/base/input/input.h"
#include "ballistica/base/logic/logic.h" #include "ballistica/base/logic/logic.h"
#include "ballistica/base/python/base_python.h" #include "ballistica/base/python/base_python.h"
#include "ballistica/base/support/app_config.h"
#include "ballistica/base/support/ui_v1_soft.h" #include "ballistica/base/support/ui_v1_soft.h"
#include "ballistica/base/ui/console.h" #include "ballistica/base/ui/console.h"
#include "ballistica/shared/foundation/event_loop.h" #include "ballistica/shared/foundation/event_loop.h"
@ -147,17 +147,17 @@ void UI::PushBackButtonCall(InputDevice* input_device) {
} else { } else {
// If there's no main screen or overlay windows, ask for a menu owned by // If there's no main screen or overlay windows, ask for a menu owned by
// this device. // this device.
MainMenuPress(input_device); MainMenuPress_(input_device);
} }
}); });
} }
void UI::PushMainMenuPressCall(InputDevice* device) { void UI::PushMainMenuPressCall(InputDevice* device) {
g_base->logic->event_loop()->PushCall( g_base->logic->event_loop()->PushCall(
[this, device] { MainMenuPress(device); }); [this, device] { MainMenuPress_(device); });
} }
void UI::MainMenuPress(InputDevice* device) { void UI::MainMenuPress_(InputDevice* device) {
assert(g_base->InLogicThread()); assert(g_base->InLogicThread());
if (g_base->HaveUIV1()) { if (g_base->HaveUIV1()) {
g_base->ui_v1()->DoHandleDeviceMenuPress(device); g_base->ui_v1()->DoHandleDeviceMenuPress(device);

View File

@ -10,9 +10,9 @@
#include "ballistica/base/ui/widget_message.h" #include "ballistica/base/ui/widget_message.h"
#include "ballistica/shared/generic/timer_list.h" #include "ballistica/shared/generic/timer_list.h"
// UI-Locks: make sure widget-lists don't change under you. // UI-Locks: make sure widget-lists don't change under you. Use a read-lock
// Use a read-lock if you just need to ensure lists remain intact but won't be // if you just need to ensure lists remain intact but won't be changing
// changing anything. Use a write-lock whenever modifying a list. // anything. Use a write-lock whenever modifying a list.
#if BA_DEBUG_BUILD #if BA_DEBUG_BUILD
#define BA_DEBUG_UI_READ_LOCK ::ballistica::base::UI::UILock ui_lock(false) #define BA_DEBUG_UI_READ_LOCK ::ballistica::base::UI::UILock ui_lock(false)
#define BA_DEBUG_UI_WRITE_LOCK ::ballistica::base::UI::UILock ui_lock(true) #define BA_DEBUG_UI_WRITE_LOCK ::ballistica::base::UI::UILock ui_lock(true)
@ -30,7 +30,8 @@ class Widget;
namespace ballistica::base { namespace ballistica::base {
// Our global UI subsystem. This wrangles all app // Our global UI subsystem. This acts as a manager/wrapper for individual UI
// feature-sets that provide specific UI functionality.
class UI { class UI {
public: public:
UI(); UI();
@ -47,12 +48,12 @@ class UI {
void Reset(); void Reset();
/// Pop up an in-game window to show a url (NOT in a browser). /// Pop up an in-app window to show a url (NOT in a browser). Can be
/// Can be called from any thread. /// called from any thread.
void ShowURL(const std::string& url); void ShowURL(const std::string& url);
/// High level call to request a quit ui (or in some cases quit immediately). /// High level call to request a quit ui (or in some cases quit
/// This can be called from any thread. /// immediately). This can be called from any thread.
void ConfirmQuit(); void ConfirmQuit();
/// Return whether there is UI present in either the main or overlay /// Return whether there is UI present in either the main or overlay
@ -67,9 +68,9 @@ class UI {
void Draw(FrameDef* frame_def); void Draw(FrameDef* frame_def);
// Returns the widget an input should send commands to, if any. // Returns the widget an input should send commands to, if any. Also
// Also potentially locks other inputs out of controlling the UI, // potentially locks other inputs out of controlling the UI, so only call
// so only call this if you intend on sending a message to that widget. // this if you intend on sending a message to that widget.
auto GetWidgetForInput(InputDevice* input_device) -> ui_v1::Widget*; auto GetWidgetForInput(InputDevice* input_device) -> ui_v1::Widget*;
// Send message to the active widget. // Send message to the active widget.
@ -77,18 +78,19 @@ class UI {
void SetUIInputDevice(InputDevice* input_device); void SetUIInputDevice(InputDevice* input_device);
// Returns the input-device that currently owns the menu; otherwise nullptr. // Returns the input-device that currently owns the menu; otherwise
// nullptr.
auto GetUIInputDevice() const -> InputDevice*; auto GetUIInputDevice() const -> InputDevice*;
void PushBackButtonCall(InputDevice* input_device); void PushBackButtonCall(InputDevice* input_device);
// Returns whether currently selected widgets should flash. // Returns whether currently selected widgets should flash. This will be
// This will be false in some situations such as when only touch screen // false in some situations such as when only touch screen control is
// control is active. // active.
auto ShouldHighlightWidgets() const -> bool; auto ShouldHighlightWidgets() const -> bool;
// Same except for button shortcuts; these generally only get shown // Same except for button shortcuts; these generally only get shown if a
// if a joystick of some form is present. // joystick of some form is present.
auto ShouldShowButtonShortcuts() const -> bool; auto ShouldShowButtonShortcuts() const -> bool;
// Used to ensure widgets are not created or destroyed at certain times // Used to ensure widgets are not created or destroyed at certain times
@ -111,7 +113,7 @@ class UI {
void PushMainMenuPressCall(InputDevice* device); void PushMainMenuPressCall(InputDevice* device);
private: private:
void MainMenuPress(InputDevice* device); void MainMenuPress_(InputDevice* device);
Object::WeakRef<InputDevice> ui_input_device_; Object::WeakRef<InputDevice> ui_input_device_;
millisecs_t last_input_device_use_time_{}; millisecs_t last_input_device_use_time_{};
millisecs_t last_widget_input_reject_err_sound_time_{}; millisecs_t last_widget_input_reject_err_sound_time_{};

View File

@ -1,4 +1,4 @@
# Classic Feature Set # Classic Feature Set
This feature set contains bits which are required to keep old functionality going This feature set contains bits which are required to keep old functionality
but which should not generally be used for new features. going but which should not generally be used for new features.

View File

@ -3,13 +3,14 @@
This feature set contains basic state and functionality for the overall This feature set contains basic state and functionality for the overall
Ballistica system. Ballistica system.
**Core** is a unique feature set in that it is *not* associated with a Python module. **Core** is a unique feature set in that it is *not* associated with a Python
It instead directly allocates and/or returns itself when its `Import()` method is module. It instead directly allocates and/or returns itself when its `Import()`
called in C++. method is called in C++.
This is because, in 'monolithic' builds (where a complete Ballistica app is compiled into This is because, in 'monolithic' builds (where a complete Ballistica app is
a single binary), **core** itself is responsible for bootstrapping the Python environment. compiled into a single binary), **core** itself is responsible for bootstrapping
One can't import something through Python when there's no Python. the Python environment. One can't import something through Python when there's
no Python.
So the purpose of **core** is to be the bare minimum functionality that needs to exist So the purpose of **core** is to be the bare minimum functionality that needs to
to bootstrap Python. exist to bootstrap Python.

View File

@ -62,6 +62,7 @@ class CoreFeatureSet {
/// ensure we don't hang indefinitely. /// ensure we don't hang indefinitely.
void StartSuicideTimer(const std::string& action, millisecs_t delay); void StartSuicideTimer(const std::string& action, millisecs_t delay);
/// Apply the config set up by baenv to the engine.
void ApplyBaEnvConfig(); void ApplyBaEnvConfig();
// Call this if the main thread changes. // Call this if the main thread changes.

View File

@ -1,6 +1,8 @@
# Plus Feature Set # Plus Feature Set
Bits of the engine related to accounts and cloud functionality. In prefab builds Bits of the engine related to things like Ballistica accounts and cloud
the compiled code for this feature set is contained in the pre-compiled static functionality. Due to its sensitive nature, source code to this part of the
ballisticaplus library. The plus feature set can also be removed from engine is not available publicly. It is instead distributed as precompiled
spinoff projects if desired to remove the need for that library. static libraries which can be linked in with the rest of the open sourced
engine. The Plus feature can be removed from spinoff projects in order to create
a 100% open-source project.

View File

@ -1,3 +1,4 @@
# Scene V1 Feature Set # Scene V1 Feature Set
Gameplay code for classic BombSquad Gameplay code for classic BombSquad, as well as app-modes and other support
classes required to use it.

View File

@ -2,7 +2,6 @@
#include "ballistica/scene_v1/support/scene_v1_app_mode.h" #include "ballistica/scene_v1/support/scene_v1_app_mode.h"
#include "ballistica/base/app/app_config.h"
#include "ballistica/base/assets/assets.h" #include "ballistica/base/assets/assets.h"
#include "ballistica/base/audio/audio.h" #include "ballistica/base/audio/audio.h"
#include "ballistica/base/audio/audio_source.h" #include "ballistica/base/audio/audio_source.h"
@ -10,6 +9,7 @@
#include "ballistica/base/graphics/support/frame_def.h" #include "ballistica/base/graphics/support/frame_def.h"
#include "ballistica/base/networking/network_writer.h" #include "ballistica/base/networking/network_writer.h"
#include "ballistica/base/python/base_python.h" #include "ballistica/base/python/base_python.h"
#include "ballistica/base/support/app_config.h"
#include "ballistica/base/support/plus_soft.h" #include "ballistica/base/support/plus_soft.h"
#include "ballistica/base/ui/ui.h" #include "ballistica/base/ui/ui.h"
#include "ballistica/core/platform/core_platform.h" #include "ballistica/core/platform/core_platform.h"

View File

@ -10,7 +10,7 @@
#include <optional> #include <optional>
#include <set> #include <set>
#include "ballistica/base/app/app_mode.h" #include "ballistica/base/app_mode/app_mode.h"
#include "ballistica/base/base.h" #include "ballistica/base/base.h"
#include "ballistica/scene_v1/scene_v1.h" #include "ballistica/scene_v1/scene_v1.h"
#include "ballistica/shared/foundation/object.h" #include "ballistica/shared/foundation/object.h"

View File

@ -2,7 +2,7 @@
#include "ballistica/scene_v1/support/scene_v1_context.h" #include "ballistica/scene_v1/support/scene_v1_context.h"
#include "ballistica/base/app/app_mode.h" #include "ballistica/base/app_mode/app_mode.h"
#include "ballistica/scene_v1/support/host_activity.h" #include "ballistica/scene_v1/support/host_activity.h"
#include "ballistica/shared/generic/runnable.h" #include "ballistica/shared/generic/runnable.h"
#include "ballistica/shared/python/python_sys.h" #include "ballistica/shared/python/python_sys.h"

View File

@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int {
namespace ballistica { namespace ballistica {
// These are set automatically via script; don't modify them here. // These are set automatically via script; don't modify them here.
const int kEngineBuildNumber = 21215; const int kEngineBuildNumber = 21221;
const char* kEngineVersion = "1.7.26"; const char* kEngineVersion = "1.7.26";
#if BA_MONOLITHIC_BUILD #if BA_MONOLITHIC_BUILD

View File

@ -3,7 +3,7 @@
#include "ballistica/ui_v1/python/methods/python_methods_ui_v1.h" #include "ballistica/ui_v1/python/methods/python_methods_ui_v1.h"
#include "ballistica/base/app/app.h" #include "ballistica/base/app/app.h"
#include "ballistica/base/app/app_mode.h" #include "ballistica/base/app_mode/app_mode.h"
#include "ballistica/base/assets/sound_asset.h" #include "ballistica/base/assets/sound_asset.h"
#include "ballistica/base/input/input.h" #include "ballistica/base/input/input.h"
#include "ballistica/base/python/base_python.h" #include "ballistica/base/python/base_python.h"

View File

@ -2,7 +2,7 @@
#include "ballistica/ui_v1/support/root_ui.h" #include "ballistica/ui_v1/support/root_ui.h"
#include "ballistica/base/app/app_mode.h" #include "ballistica/base/app_mode/app_mode.h"
#include "ballistica/base/graphics/component/simple_component.h" #include "ballistica/base/graphics/component/simple_component.h"
#include "ballistica/base/input/device/keyboard_input.h" #include "ballistica/base/input/device/keyboard_input.h"
#include "ballistica/base/input/device/touch_input.h" #include "ballistica/base/input/device/touch_input.h"

View File

@ -2,11 +2,11 @@
#include "ballistica/ui_v1/ui_v1.h" #include "ballistica/ui_v1/ui_v1.h"
#include "ballistica/base/app/app_config.h" #include "ballistica/base/app_mode/app_mode.h"
#include "ballistica/base/app/app_mode.h"
#include "ballistica/base/graphics/component/empty_component.h" #include "ballistica/base/graphics/component/empty_component.h"
#include "ballistica/base/graphics/graphics.h" #include "ballistica/base/graphics/graphics.h"
#include "ballistica/base/input/input.h" #include "ballistica/base/input/input.h"
#include "ballistica/base/support/app_config.h"
#include "ballistica/base/ui/ui.h" #include "ballistica/base/ui/ui.h"
#include "ballistica/ui_v1/python/ui_v1_python.h" #include "ballistica/ui_v1/python/ui_v1_python.h"
#include "ballistica/ui_v1/support/root_ui.h" #include "ballistica/ui_v1/support/root_ui.h"

View File

@ -2,7 +2,7 @@
#include "ballistica/ui_v1/widget/root_widget.h" #include "ballistica/ui_v1/widget/root_widget.h"
#include "ballistica/base/app/app_mode.h" #include "ballistica/base/app_mode/app_mode.h"
#include "ballistica/base/graphics/renderer/renderer.h" #include "ballistica/base/graphics/renderer/renderer.h"
#include "ballistica/base/ui/ui.h" #include "ballistica/base/ui/ui.h"
#include "ballistica/ui_v1/python/ui_v1_python.h" #include "ballistica/ui_v1/python/ui_v1_python.h"