From 3f53c70bebaa9abc2751fb354b9cf87ce1935dd4 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 12 Sep 2022 11:39:17 -0700 Subject: [PATCH] more c++ bootstrap refactoring --- .efrocachemap | 88 +++++++++---------- CHANGELOG.md | 2 +- assets/src/ba_data/python/ba/_bootstrap.py | 2 +- ballisticacore-cmake/CMakeLists.txt | 4 +- .../Generic/BallisticaCoreGeneric.vcxproj | 4 +- .../BallisticaCoreGeneric.vcxproj.filters | 12 +-- .../Headless/BallisticaCoreHeadless.vcxproj | 4 +- .../BallisticaCoreHeadless.vcxproj.filters | 12 +-- src/ballistica/app/app_flavor.cc | 46 ++++++++-- src/ballistica/app/app_flavor.h | 2 +- src/ballistica/assets/assets_server.cc | 8 +- src/ballistica/assets/assets_server.h | 2 +- src/ballistica/audio/audio_server.cc | 2 +- src/ballistica/audio/audio_server.h | 2 +- src/ballistica/ballistica.cc | 39 ++++---- src/ballistica/ballistica.h | 2 +- src/ballistica/config/config_cmake.h | 2 +- src/ballistica/config/config_common.h | 8 +- .../config/config_windows_generic.h | 2 +- .../config/config_windows_headless.h | 2 +- src/ballistica/core/types.h | 2 +- src/ballistica/game/game.cc | 2 +- src/ballistica/game/game.h | 2 +- src/ballistica/platform/platform.cc | 53 +---------- src/ballistica/platform/platform.h | 3 +- src/ballistica/platform/sdl/sdl_app.cc | 4 +- src/ballistica/platform/sdl/sdl_app.h | 2 +- .../stdio_console.cc} | 17 ++-- .../stdio_console.h} | 12 +-- 29 files changed, 161 insertions(+), 181 deletions(-) rename src/ballistica/{input/std_input_module.cc => platform/stdio_console.cc} (85%) rename src/ballistica/{input/std_input_module.h => platform/stdio_console.h} (54%) diff --git a/.efrocachemap b/.efrocachemap index 8c5552a0..754e3439 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -3995,50 +3995,50 @@ "assets/src/ba_data/python/ba/_generated/__init__.py": "https://files.ballistica.net/cache/ba1/ee/e8/cad05aa531c7faf7ff7b96db7f6e", "assets/src/ba_data/python/ba/_generated/enums.py": "https://files.ballistica.net/cache/ba1/b2/e5/0ee0561e16257a32830645239f34", "ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/89/c0/e32c7d2a35dc9aef57cc73b0911a", - "build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/10/4a/ffe015cc2ebd47d50975be3eeb0e", - "build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/cb/d7/75c584de816b729e6c3a9f736c4e", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/12/19/5845a35b791d8c7fdc0961857d0a", - "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/39/d8/2be8c0a549de0e65f31c5ad77152", - "build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/87/6b/680b1c0ac793a8cd136d92af70f6", - "build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/20/57/4c1bbeda1a616da1797b86c1bd61", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/1d/5d/ad1529c4eb1f55fdde0eb0c20490", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ee/be/588cc300939f4b3f696089297418", - "build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/22/b5/242086174808668e27b1959f4378", - "build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/0f/8a/ce4e2545160c97e46ac40c3cad5a", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ef/9b/aceebec46e3bdbfb48c851fffd84", - "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c6/2e/cb2d5cadd82a3dd5a218d9b00b1f", - "build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/cc/7d/8cfdc4cdaa0f746c38c95cc2846c", - "build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/8b/39/3ca21bc68eb05e8a0be3b9616de4", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/1c/be/c6a5f5fdb8bd179ff2ad3ebda239", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/72/f4/0d34c518ae2fee1c3c99c00aaf7f", - "build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/c5/ac/8a25d9a65fe146e1b461cff8d0b1", - "build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/7c/6d/5fe242ad6afc646aea1405f9d3db", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/41/51/9bbbc5007870d145b1ab4ca28c1e", - "build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/56/3a/1c798b5ac4f042af6221605a45c7", - "build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ec/2a/4d3ceb7b285b9a711cf7ca0ec0f7", - "build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d1/d9/66f7e4526e733ca085c2eb96877f", - "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b8/56/ee30665ae62ca08660845c9730c0", - "build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e1/82/ce530098283734eb34d0a78682a8", - "build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/66/e1/6aa3c3de153a5a50a06e35fe9134", - "build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7f/e5/2acde40bf16c08d037bfce2b502c", - "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b0/cb/300a523ef70690dc9b7b4fd91f21", - "build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/21/50/c4cfe81e571b40623ccd72fe77a6", - "build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/cb/6a/88729063e5f9857da695c4fe906d", - "build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/93/a7/6ba2b7509dbac96b43d5ebd51edb", - "build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/92/7c/78aa7dfb1f2aea8c984aa666cabc", - "build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c2/d0/65f8cc8676c3a31e6f02dcd79bf2", - "build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/39/39/84895810a54817053bbbc1c6851e", - "build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7c/21/578d14c74a46a3ddea3880964a73", - "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b2/e3/b529b59785149007257c47ffddf4", - "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b4/d6/7c5d71b41ee7d6373cb037ccb3ac", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/75/a6/82f3f6dd8dcb6cda1906a5c3f88b", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/c8/3b/232c5613ebb145cf2831a44c4a22", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/e1/6e/5df594275e30b61b9506b04a2bb4", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/70/4e/8b2fc5255a57055b7d6b5a357c9a", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/60/11/16f18674b12113f43cbe39027d19", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/f9/3b/6cca025ed2ec433facf6ceb4b6ec", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/af/a6/93fd32df5427917bf89a2ca4328e", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/58/a0/25ca5194d30f2449e85fe4fab215", + "build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/a1/66/39cac09bf6b06e56c530835eb181", + "build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/2b/cb/6dd8bdf3a077d3aa761f9b8fbd63", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b5/e9/5c0a89d56a6e483229da89281796", + "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/fe/f9/c33d7708c6186bfd96d5e47955a3", + "build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/73/5b/93a06dabd24015bb45150bf9b504", + "build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/cb/e0/a0da487b59ded7b3906f14bfa720", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d2/fe/bace2357c3c17373a474bb4c2550", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/bb/1c/8f71bc4449cd828817e7eb5e685e", + "build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/59/c0/562d9fdf5769951cd04f4389f0b8", + "build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/0a/7d/8a7148a088f5b2c7c1fa770368a9", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d8/d3/b107c0c0564b59544af598ebb975", + "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c2/10/e29b058f51d202b47315a78e9426", + "build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/1a/25/fd41d552ce3c4d3b6097ddf38575", + "build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/68/35/afcdb16cb02aee02aefecda09c18", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/89/a6/ed6fb097d9f5b7bf213750399b09", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c6/e0/ac51274e398c2d4c9ca96918ff24", + "build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/83/46/3a7a9981de261f0ade01976d5ff7", + "build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/a4/a9/0cfdc1a7499515d9ae1742a1556d", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/cd/9b/2b5530a52e1da3912f2b89f2de83", + "build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/24/32/c583f30ff2e5f77c02e1716033b8", + "build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/26/1d/c05986ea5543313a3d9ad8f87551", + "build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a9/30/62c8fa6369762561e87708d625ae", + "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/32/e2/27313549815bc9201818b4db6c10", + "build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/48/67/bac46275cec3dbdbee7d4c698406", + "build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/13/37/b2a85900f3d5f518cc7e67151282", + "build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7e/4f/2bc692ccdcb53a278ad9b06ddbf1", + "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/38/12/6e9a96f48a7af39f526dcd41ebce", + "build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8f/f3/deee23add01a2c2d8bb4b6197366", + "build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/83/4d/8bdc0827cf90d2cd09e56a1846ed", + "build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4a/55/b93f1eae564c146ca60f1a23b915", + "build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e7/fc/58cd588c4aecd56e1ef2bba7b11d", + "build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/21/83/f5bcb13224fec91b6139b7ae83ed", + "build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/69/1a/eb5f3c85fc8f8194cc96b19714b3", + "build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/27/75/a18262f80729191921e12da1b2dc", + "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4e/a5/7144c121faf50b2e6cf1db40e281", + "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/29/08/889f9f0cbd89b692cbcdc0dad96c", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/96/8e/6da028cf907b53fa621cf0275352", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/c3/81/6591a6f11570c598e5dee0d58586", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/ee/f9/e0c13708771197ee7f41db988d19", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/a2/66/c5433ea1cbd812a532d23895379d", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/c9/21/154dae08aceb0c162c1ba9580ceb", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/74/c9/fd45708e613a27dcf3782b3d9dfe", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/e1/8e/f5a16f655ae1f2b075e80fb3a981", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/02/73/2dd954ea8a85a542ce900047ab6c", "src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/7d/3e/229a581cb2454ed856f1d8b564a7", "src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/98/12/571b2160d69d42580e8f31fa6a8d" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 85de9a4c..1d9a38ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.7 (build 20823, api 7, 2022-09-12) +### 1.7.7 (build 20825, api 7, 2022-09-12) - Added `ba.app.meta.load_exported_classes()` for loading classes discovered by the meta subsystem cleanly in a background thread. - Improved logging of missing playlist game types. - Some ba.Lstr functionality can now be used in background threads. diff --git a/assets/src/ba_data/python/ba/_bootstrap.py b/assets/src/ba_data/python/ba/_bootstrap.py index ee4ffb00..039c0fcd 100644 --- a/assets/src/ba_data/python/ba/_bootstrap.py +++ b/assets/src/ba_data/python/ba/_bootstrap.py @@ -38,7 +38,7 @@ def bootstrap() -> None: # Give a soft warning if we're being used with a different binary # version than we expect. - expected_build = 20823 + expected_build = 20825 running_build: int = env['build_number'] if running_build != expected_build: print( diff --git a/ballisticacore-cmake/CMakeLists.txt b/ballisticacore-cmake/CMakeLists.txt index 34c4d99d..1cc4586d 100644 --- a/ballisticacore-cmake/CMakeLists.txt +++ b/ballisticacore-cmake/CMakeLists.txt @@ -484,8 +484,6 @@ add_executable(ballisticacore ${BA_SRC_ROOT}/ballistica/input/input.h ${BA_SRC_ROOT}/ballistica/input/remote_app.cc ${BA_SRC_ROOT}/ballistica/input/remote_app.h - ${BA_SRC_ROOT}/ballistica/input/std_input_module.cc - ${BA_SRC_ROOT}/ballistica/input/std_input_module.h ${BA_SRC_ROOT}/ballistica/internal/app_internal.h ${BA_SRC_ROOT}/ballistica/math/matrix44f.cc ${BA_SRC_ROOT}/ballistica/math/matrix44f.h @@ -516,6 +514,8 @@ add_executable(ballisticacore ${BA_SRC_ROOT}/ballistica/platform/platform.h ${BA_SRC_ROOT}/ballistica/platform/sdl/sdl_app.cc ${BA_SRC_ROOT}/ballistica/platform/sdl/sdl_app.h + ${BA_SRC_ROOT}/ballistica/platform/stdio_console.cc + ${BA_SRC_ROOT}/ballistica/platform/stdio_console.h ${BA_SRC_ROOT}/ballistica/platform/windows/platform_windows.cc ${BA_SRC_ROOT}/ballistica/platform/windows/platform_windows.h ${BA_SRC_ROOT}/ballistica/python/class/python_class.cc diff --git a/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj b/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj index 3e188941..504b79cc 100644 --- a/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj +++ b/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj @@ -475,8 +475,6 @@ - - @@ -507,6 +505,8 @@ + + diff --git a/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj.filters b/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj.filters index ba9bcbbd..7e1d56f9 100644 --- a/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj.filters +++ b/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj.filters @@ -859,12 +859,6 @@ ballistica\input - - ballistica\input - - - ballistica\input - ballistica\internal @@ -955,6 +949,12 @@ ballistica\platform\sdl + + ballistica\platform + + + ballistica\platform + ballistica\platform\windows diff --git a/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj b/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj index f99ff553..303289b0 100644 --- a/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj +++ b/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj @@ -470,8 +470,6 @@ - - @@ -502,6 +500,8 @@ + + diff --git a/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj.filters b/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj.filters index ba9bcbbd..7e1d56f9 100644 --- a/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj.filters +++ b/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj.filters @@ -859,12 +859,6 @@ ballistica\input - - ballistica\input - - - ballistica\input - ballistica\internal @@ -955,6 +949,12 @@ ballistica\platform\sdl + + ballistica\platform + + + ballistica\platform + ballistica\platform\windows diff --git a/src/ballistica/app/app_flavor.cc b/src/ballistica/app/app_flavor.cc index 6d01350a..4dfef290 100644 --- a/src/ballistica/app/app_flavor.cc +++ b/src/ballistica/app/app_flavor.cc @@ -18,20 +18,30 @@ namespace ballistica { AppFlavor::AppFlavor(Thread* thread) : thread_(thread), stress_test_(std::make_unique()) { - // assert(g_app_flavor == nullptr); - // g_app_flavor = this; - // We modify some app behavior when run under the server manager. auto* envval = getenv("BA_SERVER_WRAPPER_MANAGED"); server_wrapper_managed_ = (envval && strcmp(envval, "1") == 0); } void AppFlavor::PostInit() { - // If we've got a nice themed hardware cursor, show it. - // Otherwise, hide the hardware cursor; we'll draw it in software. - // (need to run this in postinit because SDL/etc. may not be inited yet - // as of AppFlavor::AppFlavor()). - g_platform->SetHardwareCursorVisible(g_buildconfig.hardware_cursor()); + // Sanity check: make sure asserts are stripped out of release builds + // (NDEBUG should do this). +#if !BA_DEBUG_BUILD +#ifndef NDEBUG +#error Expected NDEBUG to be defined for release builds. +#endif // NDEBUG + assert(true); +#endif // !BA_DEBUG_BUILD + + g_app->user_agent_string = g_platform->GetUserAgentString(); + + // Figure out where our data is and chdir there. + g_platform->SetupDataDirectory(); + + // Run these just to make sure these dirs exist. + // (otherwise they might not get made if nothing writes to them). + g_platform->GetConfigDirectory(); + g_platform->GetUserPythonDirectory(); } auto AppFlavor::ManagesEventLoop() const -> bool { @@ -357,10 +367,28 @@ void AppFlavor::PushResetAchievementsCall() { thread()->PushCall([] { g_platform->ResetAchievements(); }); } -void AppFlavor::OnBootstrapComplete() { +void AppFlavor::OnAppStart() { assert(InMainThread()); assert(g_input); + // If we're running in a terminal, print some info. + if (g_platform->is_stdin_a_terminal()) { + if (g_buildconfig.headless_build()) { + printf("BallisticaCore Headless %s build %d.\n", kAppVersion, + kAppBuildNumber); + fflush(stdout); + } else { + printf("BallisticaCore %s build %d.\n", kAppVersion, kAppBuildNumber); + fflush(stdout); + } + } + + // If we've got a nice themed hardware cursor, show it. + // Otherwise, hide the hardware cursor; we'll draw it in software. + // (need to run this in postinit because SDL/etc. may not be inited yet + // as of AppFlavor::AppFlavor()). + g_platform->SetHardwareCursorVisible(g_buildconfig.hardware_cursor()); + if (!HeadlessMode()) { // On desktop systems we just assume keyboard input exists and add it // immediately. diff --git a/src/ballistica/app/app_flavor.h b/src/ballistica/app/app_flavor.h index 65fcb317..fb1f013a 100644 --- a/src/ballistica/app/app_flavor.h +++ b/src/ballistica/app/app_flavor.h @@ -93,7 +93,7 @@ class AppFlavor { return server_wrapper_managed_; } - virtual auto OnBootstrapComplete() -> void; + virtual auto OnAppStart() -> void; // Deferred calls that can be made from other threads. diff --git a/src/ballistica/assets/assets_server.cc b/src/ballistica/assets/assets_server.cc index 8cd61f89..815318c9 100644 --- a/src/ballistica/assets/assets_server.cc +++ b/src/ballistica/assets/assets_server.cc @@ -12,11 +12,7 @@ namespace ballistica { -AssetsServer::AssetsServer() - : writing_replay_(false), - replay_message_bytes_(0), - replays_broken_(false), - replay_out_file_(nullptr) { +AssetsServer::AssetsServer() { // We're a singleton; make sure we don't already exist. assert(g_assets_server == nullptr); @@ -25,7 +21,7 @@ AssetsServer::AssetsServer() g_app->pausable_threads.push_back(thread_); } -auto AssetsServer::Start() -> void { +auto AssetsServer::OnAppStart() -> void { thread_->PushCallSynchronous([this] { StartInThread(); }); } diff --git a/src/ballistica/assets/assets_server.h b/src/ballistica/assets/assets_server.h index f482b966..1875c2d2 100644 --- a/src/ballistica/assets/assets_server.h +++ b/src/ballistica/assets/assets_server.h @@ -13,7 +13,7 @@ namespace ballistica { class AssetsServer { public: AssetsServer(); - auto Start() -> void; + auto OnAppStart() -> void; auto PushBeginWriteReplayCall() -> void; auto PushEndWriteReplayCall() -> void; auto PushAddMessageToReplayCall(const std::vector& data) -> void; diff --git a/src/ballistica/audio/audio_server.cc b/src/ballistica/audio/audio_server.cc index d162c1db..e6abaca9 100644 --- a/src/ballistica/audio/audio_server.cc +++ b/src/ballistica/audio/audio_server.cc @@ -330,7 +330,7 @@ AudioServer::AudioServer() : impl_{new AudioServer::Impl()} { g_app->pausable_threads.push_back(thread_); } -auto AudioServer::Start() -> void { +auto AudioServer::OnAppStart() -> void { thread_->PushCallSynchronous([this] { StartInThread(); }); } diff --git a/src/ballistica/audio/audio_server.h b/src/ballistica/audio/audio_server.h index da180dcc..026bda6a 100644 --- a/src/ballistica/audio/audio_server.h +++ b/src/ballistica/audio/audio_server.h @@ -23,7 +23,7 @@ class AudioServer { } AudioServer(); - auto Start() -> void; + auto OnAppStart() -> void; auto PushSetVolumesCall(float music_volume, float sound_volume) -> void; auto PushSetSoundPitchCall(float val) -> void; diff --git a/src/ballistica/ballistica.cc b/src/ballistica/ballistica.cc index eb7d1aff..3d2efe3a 100644 --- a/src/ballistica/ballistica.cc +++ b/src/ballistica/ballistica.cc @@ -24,6 +24,7 @@ #include "ballistica/networking/network_writer.h" #include "ballistica/networking/networking.h" #include "ballistica/platform/platform.h" +#include "ballistica/platform/stdio_console.h" #include "ballistica/python/python.h" #include "ballistica/scene/scene.h" #include "ballistica/ui/ui.h" @@ -31,7 +32,7 @@ namespace ballistica { // These are set automatically via script; don't modify them here. -const int kAppBuildNumber = 20823; +const int kAppBuildNumber = 20825; const char* kAppVersion = "1.7.7"; // Our standalone globals. @@ -61,7 +62,7 @@ NetworkReader* g_network_reader{}; NetworkWriter* g_network_writer{}; Platform* g_platform{}; Python* g_python{}; -StdInputModule* g_std_input_module{}; +StdioConsole* g_stdio_console{}; TextGraphics* g_text_graphics{}; UI* g_ui{}; Utils* g_utils{}; @@ -70,9 +71,9 @@ Utils* g_utils{}; // 1: All threads and globals are created and provisioned. Everything above // should exist at the end of this step (if it is going to exist). // Threads should not be talking to each other yet at this point. -// 2: The system is set in motion. Game thread is told to load/apply the config. -// This event kicks off an initial-screen-creation message sent to the -// graphics-server thread. Other systems are informed that bootstrapping +// 2: The system is set in motion. The logic thread is told to load/apply the +// config. This event kicks off an initial-screen-creation message sent to +// the graphics-server thread. Other systems are informed that bootstrapping // is complete and that they are free to talk to each other. Initial // input-devices are added, asset loads can begin (at least ones not // dependent on the screen/renderer), etc. @@ -97,8 +98,8 @@ auto BallisticaMain(int argc, char** argv) -> int { // ------------------------------------------------------------------------- // Absolute bare-bones basics. - g_app = new App(argc, argv); g_platform = Platform::Create(); + g_app = new App(argc, argv); // Create a Thread wrapper around the current (main) thread. g_main_thread = new Thread(ThreadIdentifier::kMain, ThreadType::kMain); @@ -134,13 +135,9 @@ auto BallisticaMain(int argc, char** argv) -> int { g_bg_dynamics = new BGDynamics(); g_bg_dynamics_server = new BGDynamicsServer(); } - - // FIXME - move this later but need to init Python earlier then. - g_game->Start(); - - // NOTE TO SELF: this starts reading stdin and py-init hangs if we do - // it after here. - g_platform->CreateAuxiliaryModules(); + if (g_buildconfig.enable_stdio_console()) { + g_stdio_console = new StdioConsole(); + } // Ok at this point we can be considered up-and-running. g_app->is_bootstrapped = true; @@ -149,14 +146,14 @@ auto BallisticaMain(int argc, char** argv) -> int { // Phase 2: Set things in motion. // ------------------------------------------------------------------------- - g_audio_server->Start(); - g_assets_server->Start(); - - // Let the app and platform do whatever else it wants here such as adding - // initial input devices/etc. - g_app_flavor->OnBootstrapComplete(); - g_platform->OnBootstrapComplete(); - + g_game->OnAppStart(); + g_audio_server->OnAppStart(); + g_assets_server->OnAppStart(); + g_platform->OnAppStart(); + g_app_flavor->OnAppStart(); + if (g_stdio_console) { + g_stdio_console->OnAppStart(); + } // Ok; now that we're bootstrapped, tell the game thread to read and apply // the config which should kick off the real action. g_game->PushApplyConfigCall(); diff --git a/src/ballistica/ballistica.h b/src/ballistica/ballistica.h index de4226af..ddba4f1c 100644 --- a/src/ballistica/ballistica.h +++ b/src/ballistica/ballistica.h @@ -125,7 +125,7 @@ extern NetworkReader* g_network_reader; extern NetworkWriter* g_network_writer; extern Platform* g_platform; extern Python* g_python; -extern StdInputModule* g_std_input_module; +extern StdioConsole* g_stdio_console; extern TextGraphics* g_text_graphics; extern UI* g_ui; extern Utils* g_utils; diff --git a/src/ballistica/config/config_cmake.h b/src/ballistica/config/config_cmake.h index 4c1fdb94..ececdaf0 100644 --- a/src/ballistica/config/config_cmake.h +++ b/src/ballistica/config/config_cmake.h @@ -62,7 +62,7 @@ #define BA_ENABLE_EXECINFO_BACKTRACES 1 // Allow stdin commands too. -#define BA_USE_STDIN_THREAD 1 +#define BA_ENABLE_STDIO_CONSOLE 1 #define BA_DEFINE_MAIN 1 diff --git a/src/ballistica/config/config_common.h b/src/ballistica/config/config_common.h index b807eacb..4a00f930 100644 --- a/src/ballistica/config/config_common.h +++ b/src/ballistica/config/config_common.h @@ -122,8 +122,8 @@ namespace ballistica { #error platform string undefined #endif -#ifndef BA_USE_STDIN_THREAD -#define BA_USE_STDIN_THREAD 0 +#ifndef BA_ENABLE_STDIO_CONSOLE +#define BA_ENABLE_STDIO_CONSOLE 0 #endif #ifndef BA_HARDWARE_CURSOR @@ -240,7 +240,9 @@ class BuildConfig { bool use_store_kit() const { return EXPBOOL_(BA_USE_STORE_KIT); } bool use_game_center() const { return EXPBOOL_(BA_USE_GAME_CENTER); } - bool use_stdin_thread() const { return EXPBOOL_(BA_USE_STDIN_THREAD); } + bool enable_stdio_console() const { + return EXPBOOL_(BA_ENABLE_STDIO_CONSOLE); + } bool enable_os_font_rendering() const { return EXPBOOL_(BA_ENABLE_OS_FONT_RENDERING); } diff --git a/src/ballistica/config/config_windows_generic.h b/src/ballistica/config/config_windows_generic.h index da1b56ee..eadd9a58 100644 --- a/src/ballistica/config/config_windows_generic.h +++ b/src/ballistica/config/config_windows_generic.h @@ -5,7 +5,7 @@ // note: define overrides BEFORE common makefile -#define BA_USE_STDIN_THREAD 1 +#define BA_ENABLE_STDIO_CONSOLE 1 #define BA_SDL_BUILD 1 #define BA_SDL2_BUILD 1 diff --git a/src/ballistica/config/config_windows_headless.h b/src/ballistica/config/config_windows_headless.h index cc98856d..1d205ed3 100644 --- a/src/ballistica/config/config_windows_headless.h +++ b/src/ballistica/config/config_windows_headless.h @@ -6,7 +6,7 @@ // note: define overrides BEFORE common header #define BA_HEADLESS_BUILD 1 -#define BA_USE_STDIN_THREAD 1 +#define BA_ENABLE_STDIO_CONSOLE 1 #define BA_MINSDL_BUILD 1 diff --git a/src/ballistica/core/types.h b/src/ballistica/core/types.h index f9ba491e..154bfe9a 100644 --- a/src/ballistica/core/types.h +++ b/src/ballistica/core/types.h @@ -173,7 +173,7 @@ class SoundData; class SpriteMesh; class StackWidget; class StressTest; -class StdInputModule; +class StdioConsole; class Module; class TelnetServer; class TestInput; diff --git a/src/ballistica/game/game.cc b/src/ballistica/game/game.cc index 4c458e95..c5efd18c 100644 --- a/src/ballistica/game/game.cc +++ b/src/ballistica/game/game.cc @@ -82,7 +82,7 @@ Game::Game() // bits of C++ logic. thread_->SetAcquiresPythonGIL(); } -auto Game::Start() -> void { +auto Game::OnAppStart() -> void { thread_->PushCallSynchronous([this] { StartInThread(); }); } diff --git a/src/ballistica/game/game.h b/src/ballistica/game/game.h index 9112158a..9685e5bf 100644 --- a/src/ballistica/game/game.h +++ b/src/ballistica/game/game.h @@ -25,7 +25,7 @@ const int kMaxPartyNameCombinedSize = 25; class Game { public: Game(); - auto Start() -> void; + auto OnAppStart() -> void; auto LaunchHostSession(PyObject* session_type_obj, BenchmarkType benchmark_type = BenchmarkType::kNone) diff --git a/src/ballistica/platform/platform.cc b/src/ballistica/platform/platform.cc index 55fb4df3..292355e0 100644 --- a/src/ballistica/platform/platform.cc +++ b/src/ballistica/platform/platform.cc @@ -30,9 +30,9 @@ #include "ballistica/graphics/mesh/sprite_mesh.h" #include "ballistica/graphics/vr_graphics.h" #include "ballistica/input/input.h" -#include "ballistica/input/std_input_module.h" #include "ballistica/networking/networking_sys.h" #include "ballistica/platform/sdl/sdl_app.h" +#include "ballistica/platform/stdio_console.h" #include "ballistica/python/python.h" #if BA_HEADLESS_BUILD @@ -120,7 +120,7 @@ auto Platform::PostInit() -> void { ran_base_post_init_ = true; // Are we running in a terminal? - if (g_buildconfig.use_stdin_thread()) { + if (g_buildconfig.enable_stdio_console()) { is_stdin_a_terminal_ = GetIsStdinATerminal(); } else { is_stdin_a_terminal_ = false; @@ -531,40 +531,6 @@ void Platform::SleepMS(millisecs_t ms) { std::this_thread::sleep_for(std::chrono::milliseconds(ms)); } -// General one-time initialization stuff -static void Init() { - // Sanity check: make sure asserts are stripped out of release builds - // (NDEBUG should do this). -#if !BA_DEBUG_BUILD -#ifndef NDEBUG -#error Expected NDEBUG to be defined for release builds. -#endif // NDEBUG - assert(true); -#endif // !BA_DEBUG_BUILD - - // If we're running in a terminal, print some info. - if (g_platform->is_stdin_a_terminal()) { - if (g_buildconfig.headless_build()) { - printf("BallisticaCore Headless %s build %d.\n", kAppVersion, - kAppBuildNumber); - fflush(stdout); - } else { - printf("BallisticaCore %s build %d.\n", kAppVersion, kAppBuildNumber); - fflush(stdout); - } - } - - g_app->user_agent_string = g_platform->GetUserAgentString(); - - // Figure out where our data is and chdir there. - g_platform->SetupDataDirectory(); - - // Run these just to make sure these dirs exist. - // (otherwise they might not get made if nothing writes to them). - g_platform->GetConfigDirectory(); - g_platform->GetUserPythonDirectory(); -} - #pragma clang diagnostic push #pragma ide diagnostic ignored "NullDereferences" @@ -649,7 +615,6 @@ auto Platform::CreateAppFlavor() -> AppFlavor* { // Hmm do these belong here?... HandleArgs(g_app->argc, g_app->argv); - Init(); // 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. @@ -700,18 +665,6 @@ auto Platform::GetKeyName(int keycode) -> std::string { #endif } -void Platform::CreateAuxiliaryModules() { - if (g_buildconfig.use_stdin_thread()) { - // Start listening for stdin commands (on platforms where that makes sense). - // Note: this thread blocks indefinitely for input so we don't add it to the - // pausable list. - auto* std_input_thread = new Thread(ThreadIdentifier::kStdin); - std_input_thread->PushCallSynchronous( - [std_input_thread] { new StdInputModule(std_input_thread); }); - g_std_input_module->PushBeginReadCall(); - } -} - void Platform::WillExitMain(bool errored) {} auto Platform::GetUIScale() -> UIScale { @@ -885,7 +838,7 @@ auto Platform::CreateTextTexture(int width, int height, auto Platform::GetTextTextureData(void* tex) -> uint8_t* { throw Exception(); } -void Platform::OnBootstrapComplete() {} +void Platform::OnAppStart() {} auto Platform::ConvertIncomingLeaderboardScore( const std::string& leaderboard_id, int score) -> int { diff --git a/src/ballistica/platform/platform.h b/src/ballistica/platform/platform.h index 248e285c..e1ced644 100644 --- a/src/ballistica/platform/platform.h +++ b/src/ballistica/platform/platform.h @@ -54,12 +54,11 @@ class Platform { /// Create the appropriate Graphics subclass for the app. auto CreateGraphics() -> Graphics*; - virtual auto CreateAuxiliaryModules() -> void; virtual auto WillExitMain(bool errored) -> void; /// Inform the platform that all subsystems are up and running and it can /// start talking to them. - virtual auto OnBootstrapComplete() -> void; + virtual auto OnAppStart() -> void; // Get/set values before standard game settings are available // (for values needed before SDL init/etc). diff --git a/src/ballistica/platform/sdl/sdl_app.cc b/src/ballistica/platform/sdl/sdl_app.cc index 589723ea..bda417c7 100644 --- a/src/ballistica/platform/sdl/sdl_app.cc +++ b/src/ballistica/platform/sdl/sdl_app.cc @@ -488,8 +488,8 @@ void SDLApp::SetAutoVSync(bool enable) { } } -void SDLApp::OnBootstrapComplete() { - AppFlavor::OnBootstrapComplete(); +void SDLApp::OnAppStart() { + AppFlavor::OnAppStart(); if (!HeadlessMode() && g_buildconfig.enable_sdl_joysticks()) { // Add initial sdl joysticks. any added/removed after this will be handled diff --git a/src/ballistica/platform/sdl/sdl_app.h b/src/ballistica/platform/sdl/sdl_app.h index 9215f266..367061e5 100644 --- a/src/ballistica/platform/sdl/sdl_app.h +++ b/src/ballistica/platform/sdl/sdl_app.h @@ -22,7 +22,7 @@ class SDLApp : public AppFlavor { auto SetAutoVSync(bool enable) -> void; static auto SDLJoystickConnected(int index) -> void; static auto SDLJoystickDisconnected(int index) -> void; - auto OnBootstrapComplete() -> void override; + auto OnAppStart() -> void override; /// Return g_app_flavor as a SDLApp. (assumes it actually is one). static SDLApp* get() { diff --git a/src/ballistica/input/std_input_module.cc b/src/ballistica/platform/stdio_console.cc similarity index 85% rename from src/ballistica/input/std_input_module.cc rename to src/ballistica/platform/stdio_console.cc index 5b50f78d..8b7b335b 100644 --- a/src/ballistica/input/std_input_module.cc +++ b/src/ballistica/platform/stdio_console.cc @@ -1,6 +1,6 @@ // Released under the MIT License. See LICENSE for details. -#include "ballistica/input/std_input_module.h" +#include "ballistica/platform/stdio_console.h" #if BA_OSTYPE_LINUX #include @@ -13,12 +13,17 @@ namespace ballistica { -StdInputModule::StdInputModule(Thread* thread) : thread_(thread) { - assert(g_std_input_module == nullptr); - g_std_input_module = this; +StdioConsole::StdioConsole() { + // We're a singleton; make sure we don't already exist. + assert(g_stdio_console == nullptr); + + // Spin up our thread. + thread_ = new Thread(ThreadIdentifier::kAssets); + g_app->pausable_threads.push_back(thread_); } -void StdInputModule::PushBeginReadCall() { +auto StdioConsole::OnAppStart() -> void { + // Tell our thread to start reading. thread()->PushCall([this] { bool stdin_is_terminal = g_platform->is_stdin_a_terminal(); @@ -72,7 +77,7 @@ void StdInputModule::PushBeginReadCall() { } } } else { - Log("StdInputModule got non-eof error reading stdin: " + Log("StdioConsole got non-eof error reading stdin: " + std::to_string(ferror(stdin))); } break; diff --git a/src/ballistica/input/std_input_module.h b/src/ballistica/platform/stdio_console.h similarity index 54% rename from src/ballistica/input/std_input_module.h rename to src/ballistica/platform/stdio_console.h index 7b8e04ee..1ff0f2d6 100644 --- a/src/ballistica/input/std_input_module.h +++ b/src/ballistica/platform/stdio_console.h @@ -1,16 +1,16 @@ // Released under the MIT License. See LICENSE for details. -#ifndef BALLISTICA_INPUT_STD_INPUT_MODULE_H_ -#define BALLISTICA_INPUT_STD_INPUT_MODULE_H_ +#ifndef BALLISTICA_PLATFORM_STDIO_CONSOLE_H_ +#define BALLISTICA_PLATFORM_STDIO_CONSOLE_H_ #include "ballistica/ballistica.h" namespace ballistica { -class StdInputModule { +class StdioConsole { public: - explicit StdInputModule(Thread* thread); - void PushBeginReadCall(); + StdioConsole(); + void OnAppStart(); auto thread() const -> Thread* { return thread_; } private: @@ -20,4 +20,4 @@ class StdInputModule { } // namespace ballistica -#endif // BALLISTICA_INPUT_STD_INPUT_MODULE_H_ +#endif // BALLISTICA_PLATFORM_STDIO_CONSOLE_H_