spinoff and efrocache improvements

This commit is contained in:
Eric 2023-06-19 11:45:26 -07:00
parent 89e0d22755
commit 71d322747f
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
14 changed files with 224 additions and 51 deletions

88
.efrocachemap generated
View File

@ -4072,50 +4072,50 @@
"build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/7f/b0/d7426f678c1fee642855e391f1b9",
"build/assets/workspace/onslaughtplug.py": "https://files.ballistica.net/cache/ba1/21/26/7a4f7252ef70fdb86c734acacc42",
"build/assets/workspace/runaroundplug.py": "https://files.ballistica.net/cache/ba1/53/0b/df2f7aaaf3cf4d9578c2bc5d4ad9",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/19/75/9fbe480209c77b5898046943ea3d",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/c1/ef/5d0044bac759e97ada66aafcda79",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/cd/e0/99277bf0c12830ce049895d88043",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/67/cb/3fd5f9a3baf0d4cbf5e75b27e083",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/88/9c/c54e212d42117dc28d24f4fd181e",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/d1/a5/56943ceed9175d9e34483c3719ed",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/95/29/d2490c2441a9d704277510dbcda6",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/0f/6e/6e31ab87d1fbf58e58560b4a0d53",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/4e/7c/05758eb5445369da7986e35fb5ee",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/5f/1f/7821f6cadb4ea90dae9e9fdc7c59",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/27/40/68e80f9cf2dd229925e0806d0468",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/b6/c0/39a942ef6828645334b621841db5",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/fb/ac/e1ad4e40fb47d8fcc0c3c6b6e3fc",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/3c/f3/e79a8c595b04b2fdd219944709b3",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/1e/97/bdeb10965302553540078f637fa6",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/54/8d/fd7f14f8531f23feea8867278b59",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/fe/5f/a8e1c29913b9103b49362aabc6ff",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/01/55/e173d9374f5a37ae2fcc74d7849b",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/f2/44/ba4d943c7ecfce31c8c16c8f1dc7",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/84/76/940ea447e332a8ebede04635c2e2",
"build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/7a/ea/fa6040009c223d91afaa6614b4e7",
"build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/7c/08/762483a72f2d7edae71de082bdf0",
"build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/7a/ea/fa6040009c223d91afaa6614b4e7",
"build/prefab/lib/linux_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/7c/08/762483a72f2d7edae71de082bdf0",
"build/prefab/lib/linux_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/7c/1f/ecd8e3b52591634699785c585441",
"build/prefab/lib/linux_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/b9/0a/05aa6113e0394be3fef45433ea7a",
"build/prefab/lib/linux_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/7c/1f/ecd8e3b52591634699785c585441",
"build/prefab/lib/linux_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/b9/0a/05aa6113e0394be3fef45433ea7a",
"build/prefab/lib/mac_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/3b/02/e8a8117b088ea64a290c6f2f587b",
"build/prefab/lib/mac_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/9e/ab/af046751e8a3ae7fcedd4ffc1c99",
"build/prefab/lib/mac_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/3b/02/e8a8117b088ea64a290c6f2f587b",
"build/prefab/lib/mac_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/9e/ab/af046751e8a3ae7fcedd4ffc1c99",
"build/prefab/lib/mac_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/6c/78/9cfde201572f84c22f370d926e3b",
"build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/7c/5c/c57146f19fb9d4099dec460ef3e5",
"build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/5e/f9/9968e9f8efbfcbd964c38e414d16",
"build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/7c/5c/c57146f19fb9d4099dec460ef3e5",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/f4/56/6748980c7a9d147bae55cc14c379",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/08/f7/a86c4338ad115edb9de573e9d5c6",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/5e/05/ce74a4df4c6061289b0bdcb76b17",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/1a/84/c0f85acd6c4193c73824d5780fd3",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/73/1f/eed2312ade9c2075e71805869021",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/91/5e/895494e9b970cbd53481b2d204d7",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/6d/6b/dc5a305f3e300acf7b45ad16e934",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/90/82/2ca9b14633f6769a3930cffae599",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/e1/a1/d42abacd67fd548e3b1f8b00f9a5",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/4f/c9/f1a5c91d4c0990f598e20a258a49",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/eb/c1/6531d164691a93333daa9ddb36a6",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/32/70/3dd061ca3a3d6cd63cdb7da0aac2",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/1d/47/451cd70a1d6646ae6f83d3567d48",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/26/fd/59b9afd53ea515391679f52ceef2",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/ac/df/6b01d65881d294bd8c6a98959f16",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/70/54/7f06ca7b2df9c726f9c2e1f04dde",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/58/ab/785f7f653651693412920ad13917",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/6c/c2/4fb8516a5d6a2bf0de7f2fb81e53",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/77/98/3c44eb98b11f13fd6b52c892ef13",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/42/07/3bd8d1d7f66af19ac319cbad65e8",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/55/ab/734424c359aed021aa63c1946968",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/f4/55/5d365e04925bdf8ec252bc83be64",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/28/f4/4656cd794aa594a5c48343f5a7f9",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/62/7c/9a68c5870bcba7a44e2fcacf7315",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/e9/99/9c08b84d1d834eb2a791f384bc9f",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/27/da/6f90dc8db2ab1710abbf409bc07a",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/39/05/c7a223069592a0435c8556f9f9e9",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/f7/1d/44bb58085c25565b6e1684600b73",
"build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/8a/39/82acd22444cdde966df4838b3235",
"build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/82/23/3da9e812f6d9d83e9c4678645792",
"build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/8a/39/82acd22444cdde966df4838b3235",
"build/prefab/lib/linux_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/82/23/3da9e812f6d9d83e9c4678645792",
"build/prefab/lib/linux_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/75/99/d4fbdf644fe76b609fe8d0dbdeec",
"build/prefab/lib/linux_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/b4/77/b699106d5380ce3e93c5242e59be",
"build/prefab/lib/linux_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/75/99/d4fbdf644fe76b609fe8d0dbdeec",
"build/prefab/lib/linux_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/b4/77/b699106d5380ce3e93c5242e59be",
"build/prefab/lib/mac_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/57/51/4b9175c993b186c3f438c3a8adcd",
"build/prefab/lib/mac_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/6d/7c/7212f3b2b5edd32d891cb37a8a11",
"build/prefab/lib/mac_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/57/51/4b9175c993b186c3f438c3a8adcd",
"build/prefab/lib/mac_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/6d/7c/7212f3b2b5edd32d891cb37a8a11",
"build/prefab/lib/mac_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/87/56/2528df7fd11bd4117ea453caa523",
"build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/2b/1d/067ca5d1bc54339f2b8682ef1aed",
"build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/65/49/cdbaca8ea343d79992618514438c",
"build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/2b/1d/067ca5d1bc54339f2b8682ef1aed",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/79/c7/83db855938ea3d1343bf75067dff",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/6e/c9/5c77b0e28645c07e85bc7b95792e",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/7a/58/46402790b89843834edbb6fea0f9",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/1d/7f/792413ec5fab4ac2f558a0a77439",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/39/34/83936b5765902edf6b6c22c73e36",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/67/85/3973e71bf296ca8c36361083145a",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/51/5f/ba670684aeaf9ea29cb3542a3e2c",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/ff/aa/cebeccfde0758048d068a14ec477",
"src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/f8/85/fed7f2ed98ff2ba271f9dbe3391c",
"src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/48/4b/e6974f0a4d14be8213dc00d971c3",
"src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/3e/7a/203e2a5d2b5bb42cfe3fd2fe16c2",

View File

@ -1,4 +1,4 @@
### 1.7.20 (build 21126, api 8, 2023-06-18)
### 1.7.20 (build 21127, api 8, 2023-06-19)
- This seems like a good time for a `refactoring` release in anticipation of
changes coming in 1.8. Basically this means that a lot of things will be
@ -360,6 +360,14 @@
DoApplyConfig callbacks called in C++, which was causing the server-mode
`idle_exit_minutes` value to be ignored. Servers should now properly exit
after being idle for this length of time.
- (build 21126) Reworked the efrocache system used by public builds for
downloading built assets and binaries. It should now be faster and more
efficient (though I have not tested this). Most importantly, it now supports
spinoff, which means that spinoff projects created from the public github repo
should now build and run. So if you run `make spinoff-test-base` and then `cd
build/spinofftest/base`, you should be able to do `make cmake` from that
spinoff project and get a running app (though it will be just a blank window).
But the app at that point *is* 100% open source; woohoo!
### 1.7.19 (build 20997, api 7, 2023-01-19)

View File

@ -14,6 +14,7 @@
"ba_data/python/babase/__pycache__/_assetmanager.cpython-311.opt-1.pyc",
"ba_data/python/babase/__pycache__/_asyncio.cpython-311.opt-1.pyc",
"ba_data/python/babase/__pycache__/_cloud.cpython-311.opt-1.pyc",
"ba_data/python/babase/__pycache__/_emptyappmode.cpython-311.opt-1.pyc",
"ba_data/python/babase/__pycache__/_env.cpython-311.opt-1.pyc",
"ba_data/python/babase/__pycache__/_error.cpython-311.opt-1.pyc",
"ba_data/python/babase/__pycache__/_general.cpython-311.opt-1.pyc",
@ -40,6 +41,7 @@
"ba_data/python/babase/_assetmanager.py",
"ba_data/python/babase/_asyncio.py",
"ba_data/python/babase/_cloud.py",
"ba_data/python/babase/_emptyappmode.py",
"ba_data/python/babase/_env.py",
"ba_data/python/babase/_error.py",
"ba_data/python/babase/_general.py",

View File

@ -158,6 +158,7 @@ SCRIPT_TARGETS_PY_PUBLIC = \
$(BUILD_DIR)/ba_data/python/babase/_assetmanager.py \
$(BUILD_DIR)/ba_data/python/babase/_asyncio.py \
$(BUILD_DIR)/ba_data/python/babase/_cloud.py \
$(BUILD_DIR)/ba_data/python/babase/_emptyappmode.py \
$(BUILD_DIR)/ba_data/python/babase/_env.py \
$(BUILD_DIR)/ba_data/python/babase/_error.py \
$(BUILD_DIR)/ba_data/python/babase/_general.py \
@ -428,6 +429,7 @@ SCRIPT_TARGETS_PYC_PUBLIC = \
$(BUILD_DIR)/ba_data/python/babase/__pycache__/_assetmanager.cpython-311.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/babase/__pycache__/_asyncio.cpython-311.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/babase/__pycache__/_cloud.cpython-311.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/babase/__pycache__/_emptyappmode.cpython-311.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/babase/__pycache__/_env.cpython-311.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/babase/__pycache__/_error.cpython-311.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/babase/__pycache__/_general.cpython-311.opt-1.pyc \

View File

@ -100,6 +100,7 @@ from babase._apputils import (
get_remote_app_name,
)
from babase._cloud import CloudSubsystem
from babase._emptyappmode import EmptyAppMode
from babase._error import (
print_exception,
print_error,
@ -193,6 +194,7 @@ __all__ = [
'displaytimer',
'DisplayTimer',
'do_once',
'EmptyAppMode',
'env',
'Existable',
'existing',

View File

@ -651,9 +651,14 @@ class App:
# order?
import bascenev1
import babase
if bascenev1.SceneV1AppMode.supports_intent(intent):
return bascenev1.SceneV1AppMode
if babase.EmptyAppMode.supports_intent(intent):
return babase.EmptyAppMode
raise RuntimeError(f'No handler found for intent {type(intent)}.')
# __DEFAULT_APP_MODE_SELECTION_END__

View File

@ -0,0 +1,37 @@
# Released under the MIT License. See LICENSE for details.
#
"""Provides AppMode functionality."""
from __future__ import annotations
from typing import TYPE_CHECKING
import _babase
from babase._appmode import AppMode
from babase._appintent import AppIntentExec, AppIntentDefault
if TYPE_CHECKING:
from babase import AppIntent
class EmptyAppMode(AppMode):
"""An empty app mode that can be used as a fallback/etc."""
@classmethod
def supports_intent(cls, intent: AppIntent) -> bool:
# We support default and exec intents currently.
return isinstance(intent, AppIntentExec | AppIntentDefault)
def handle_intent(self, intent: AppIntent) -> None:
if isinstance(intent, AppIntentExec):
_babase.empty_app_mode_handle_intent_exec(intent.code)
return
assert isinstance(intent, AppIntentDefault)
_babase.empty_app_mode_handle_intent_default()
def on_activate(self) -> None:
# Let the native layer do its thing.
_babase.empty_app_mode_activate()
def on_deactivate(self) -> None:
# Let the native layer do its thing.
_babase.empty_app_mode_deactivate()

View File

@ -28,7 +28,7 @@ if TYPE_CHECKING:
# Build number and version of the ballistica binary we expect to be
# using.
TARGET_BALLISTICA_BUILD = 21126
TARGET_BALLISTICA_BUILD = 21127
TARGET_BALLISTICA_VERSION = '1.7.20'
_g_env_config: EnvConfig | None = None

View File

@ -17,4 +17,8 @@ auto AppModeEmpty::GetSingleton() -> AppModeEmpty* {
return g_app_mode_empty;
}
void AppModeEmpty::Reset() {
// Nothing here currently.
}
} // namespace ballistica::base

View File

@ -14,6 +14,7 @@ class AppModeEmpty : public AppMode {
AppModeEmpty();
static auto GetSingleton() -> AppModeEmpty*;
void Reset();
};
} // namespace ballistica::base

View File

@ -221,7 +221,9 @@ void BaseFeatureSet::LogVersionInfo() {
void BaseFeatureSet::set_app_mode(AppMode* mode) {
assert(InLogicThread());
if (mode == app_mode_) {
// Make an exception here for empty mode since that's in place before an
// app mode is officially set.
if (mode == app_mode_ && mode != AppModeEmpty::GetSingleton()) {
Log(LogLevel::kWarning,
"set_app_mode called with already-current app-mode; unexpected.");
}

View File

@ -4,6 +4,7 @@
#include "ballistica/base/app/app.h"
#include "ballistica/base/app/app_mode.h"
#include "ballistica/base/app/app_mode_empty.h"
#include "ballistica/base/graphics/graphics_server.h"
#include "ballistica/base/logic/logic.h"
#include "ballistica/base/python/base_python.h"
@ -13,6 +14,7 @@
#include "ballistica/shared/foundation/event_loop.h"
#include "ballistica/shared/foundation/logging.h"
#include "ballistica/shared/python/python.h"
#include "ballistica/shared/python/python_command.h"
#include "ballistica/shared/python/python_sys.h"
namespace ballistica::base {
@ -1354,6 +1356,102 @@ static PyMethodDef PyUserAgentStringDef = {
"(internal)\n",
};
// ----------------------- empty_app_mode_activate -----------------------------
static auto PyEmptyAppModeActivate(PyObject* self) -> PyObject* {
BA_PYTHON_TRY;
BA_PRECONDITION(g_base->InLogicThread());
g_base->set_app_mode(AppModeEmpty::GetSingleton());
Py_RETURN_NONE;
BA_PYTHON_CATCH;
}
static PyMethodDef PyEmptyAppModeActivateDef = {
"empty_app_mode_activate", // name
(PyCFunction)PyEmptyAppModeActivate, // method
METH_NOARGS, // flags
"empty_app_mode_activate() -> None\n"
"\n"
"(internal)\n",
};
// ----------------------- empty_app_mode_deactivate ---------------------------
static auto PyEmptyAppModeDeactivate(PyObject* self) -> PyObject* {
BA_PYTHON_TRY;
BA_PRECONDITION(g_base->InLogicThread());
// Currently doing nothing.
Py_RETURN_NONE;
BA_PYTHON_CATCH;
}
static PyMethodDef PyEmptyAppModeDeactivateDef = {
"empty_app_mode_deactivate", // name
(PyCFunction)PyEmptyAppModeDeactivate, // method
METH_NOARGS, // flags
"empty_app_mode_deactivate() -> None\n"
"\n"
"(internal)\n",
};
// ----------------- empty_app_mode_handle_intent_default ----------------------
static auto PyEmptyAppModeHandleIntentDefault(PyObject* self) -> PyObject* {
BA_PYTHON_TRY;
BA_PRECONDITION(g_base->InLogicThread());
AppModeEmpty::GetSingleton()->Reset();
Py_RETURN_NONE;
BA_PYTHON_CATCH;
}
static PyMethodDef PyEmptyAppModeHandleIntentDefaultDef = {
"empty_app_mode_handle_intent_default", // name
(PyCFunction)PyEmptyAppModeHandleIntentDefault, // method
METH_NOARGS, // flags
"empty_app_mode_handle_intent_default() -> None\n"
"\n"
"(internal)\n",
};
// ------------------ empty_app_mode_handle_intent_exec ------------------------
static auto PyEmptyAppModeHandleIntentExec(PyObject* self, PyObject* args,
PyObject* keywds) -> PyObject* {
BA_PYTHON_TRY;
const char* command;
static const char* kwlist[] = {"command", nullptr};
if (!PyArg_ParseTupleAndKeywords(args, keywds, "s",
const_cast<char**>(kwlist), &command)) {
return nullptr;
}
// Simply run the command.
if (g_core->core_config().exec_command.has_value()) {
bool success = PythonCommand(*g_core->core_config().exec_command,
BA_BUILD_COMMAND_FILENAME)
.Exec(true, nullptr, nullptr);
if (!success) {
// TODO(ericf): what should we do in this case?
// Obviously if we add return/success values for intents we should set
// that here.
}
}
Py_RETURN_NONE;
BA_PYTHON_CATCH;
}
static PyMethodDef PyEmptyAppModeHandleIntentExecDef = {
"empty_app_mode_handle_intent_exec", // name
(PyCFunction)PyEmptyAppModeHandleIntentExec, // method
METH_VARARGS | METH_KEYWORDS, // flags
"empty_app_mode_handle_intent_exec(command: str) -> None\n"
"\n"
"(internal)",
};
// -----------------------------------------------------------------------------
auto PythonMethodsApp::GetMethods() -> std::vector<PyMethodDef> {
@ -1397,6 +1495,10 @@ auto PythonMethodsApp::GetMethods() -> std::vector<PyMethodDef> {
PyOnInitialAppModeSetDef,
PyReachedEndOfBaBaseDef,
PyUserAgentStringDef,
PyEmptyAppModeActivateDef,
PyEmptyAppModeDeactivateDef,
PyEmptyAppModeHandleIntentDefaultDef,
PyEmptyAppModeHandleIntentExecDef,
};
}

View File

@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int {
namespace ballistica {
// These are set automatically via script; don't modify them here.
const int kEngineBuildNumber = 21126;
const int kEngineBuildNumber = 21127;
const char* kEngineVersion = "1.7.20";
auto MonolithicMain(const core::CoreConfig& core_config) -> int {

View File

@ -3,7 +3,7 @@
"""Generates parts of babase._app.py.
This includes things like subsystem attributes for all feature-sets that
define them.
want them and default app-intent handling.
"""
from __future__ import annotations
@ -159,13 +159,21 @@ def generate_app_module(
'# should we determine which app modes to check and in what\n'
'# order?\n'
)
if 'scene_v1' in fsets:
contents += 'import bascenev1\n\n'
if 'base' in fsets:
contents += 'import babase\n\n'
if 'scene_v1' in fsets:
contents += (
'import bascenev1\n'
'\n'
'if bascenev1.SceneV1AppMode.supports_intent(intent):\n'
' return bascenev1.SceneV1AppMode\n\n'
)
if 'base' in fsets:
contents += (
'if babase.EmptyAppMode.supports_intent(intent):\n'
' return babase.EmptyAppMode\n\n'
)
contents += (
"raise RuntimeError(f'No handler found for"
" intent {type(intent)}.')\n"