mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-19 13:25:31 +08:00
app-modes now discoverable for testing via meta-tags
This commit is contained in:
parent
8b88d62e8a
commit
d9024b9d06
72
.efrocachemap
generated
72
.efrocachemap
generated
@ -4099,42 +4099,42 @@
|
||||
"build/assets/windows/Win32/ucrtbased.dll": "bfd1180c269d3950b76f35a63655e9e1",
|
||||
"build/assets/windows/Win32/vc_redist.x86.exe": "15a5f1f876503885adbdf5b3989b3718",
|
||||
"build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599",
|
||||
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "c933e9fa75e0852ffb19f4980bdc4fbc",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "8f2ee725f54034f995057b4d3ad4520e",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "18790bb9de9c00fb1f6d7c1224ee6186",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "792dca3022d0173aaba44a49ecbfb780",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "bdb0dabe81f3081adfdef2b4f263b733",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "dbd5ce0b4af918c693cb89d8fde11d48",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "4a5a81688df1771f4871648f91a3f0c0",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "b9bc795bfeec565181c6985c09eae809",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "d3dbadc2a27f1cd6ec8a17b754290321",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "8f8d56a18eac08a092fea3168397c465",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "b1ae4b2e789600f44bb4ce15aa2e2848",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "45ef289a4291c79f9caf6c13769418f7",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "945ab6076d2c24b9480403c5a01bb558",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "553424754c2336abaa0f921cf89bb664",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "e1000aacfe672cedb0a73525a6e9a277",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "6bf81ae3af014a26c4b29cc54b40cdaa",
|
||||
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "45b1203c8f48993bb49cb5ede270cbbf",
|
||||
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "462796ac70e26fe008fc0930753e8036",
|
||||
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "45b1203c8f48993bb49cb5ede270cbbf",
|
||||
"build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "462796ac70e26fe008fc0930753e8036",
|
||||
"build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "5be54ca87f60ffd6430108322a3b2751",
|
||||
"build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "7f6452f6dea8fe19e32de7a7b1dc1fff",
|
||||
"build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "5be54ca87f60ffd6430108322a3b2751",
|
||||
"build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "7f6452f6dea8fe19e32de7a7b1dc1fff",
|
||||
"build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "0aa4c2291dbe7816e7b2eb09ed601ed5",
|
||||
"build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "97e07be89d10a5c224d0ac3dca502e7b",
|
||||
"build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "0aa4c2291dbe7816e7b2eb09ed601ed5",
|
||||
"build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "97e07be89d10a5c224d0ac3dca502e7b",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "feaed1063af13244171db9c61157b9a9",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "a7dceed0a0f334be43831f3864567fc4",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "85822d126ffd2b4db23bd906a6b5b1dd",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "bac58b7621986d34574ec80b116a8b1b",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "b3cb346360fe9a756e7e14fe187f597e",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "2ae6dbf71ea9641283a4e4169384efea",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "48c3ae178cf929bce8b74f30bd42a85a",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "f55ec3ed54fd4704ee51be98ce1fea38",
|
||||
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "ecce51fae568b9707c40a39fbf3a3c5f",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "55e2a22a34a9be909e26c994fb8ea04e",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "5e7ad42b0231a8e9ed021b1c389da269",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "9d0fc45c65d34d595af470cf83694bf5",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "63159906ae9af2b667bd70effd4dabe7",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "bff1c5b6386348a6182707f2b3cdae62",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "fa4e52fa3d0d9e18d6700bd8057b196d",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "0158103f20133191f92dbd5f9f4db6b5",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "0b28e5294e7f5e75265fdf23b9aacf73",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "3db1de36fc4bc7779a96abe5d5e08af5",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "ca92fc0dbae8d0257eafcedbd7253f71",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "5e4d1ff3c9f1eae795ff22d378ac00f9",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "3053e0bada8af66f14dd057f92149219",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "7a1b405aa133401a170f07e5eefe9117",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "94bf374b52eeee75056f2df342fcbc6e",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "ec4d6375e15add5f09eff1548b270084",
|
||||
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "1d372863f6743d0e402252625039347a",
|
||||
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "d33f46eee6acbbb23ced2fde0b3c8617",
|
||||
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "1d372863f6743d0e402252625039347a",
|
||||
"build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "d33f46eee6acbbb23ced2fde0b3c8617",
|
||||
"build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "dff40e5da979f86971b81a82753b35c7",
|
||||
"build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "3e3b687f20740625087efd9b206605f8",
|
||||
"build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "dff40e5da979f86971b81a82753b35c7",
|
||||
"build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "3e3b687f20740625087efd9b206605f8",
|
||||
"build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "3c0e995c26af01aed002e720b2498302",
|
||||
"build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "e8df0adda61c64e63b8755d909f0113b",
|
||||
"build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "3c0e995c26af01aed002e720b2498302",
|
||||
"build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "e8df0adda61c64e63b8755d909f0113b",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "0d6db8516440603342edae1efed0cd52",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "a2f95c8bb1fd261bbc2d47b7559e7d4e",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "b81c189c2c6a79e92dbfe3d0dd5c6adf",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "673f2b052879488544dc1d0b6e46ae27",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "5cbaad5b761638f0c23505504739790b",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "121bc8047b8f0b20cdc7139a92fcb50b",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "3fc2c917f416dad9e4c2413a96da5702",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "667d6372dbd8862fd9542ee4b3d1ae88",
|
||||
"src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c",
|
||||
"src/assets/ba_data/python/babase/_mgen/enums.py": "794d258d59fd17a61752843a9a0551ad",
|
||||
"src/ballistica/base/mgen/pyembed/binding_base.inc": "3a583e7e03bd4907b21adc3bf5729d15",
|
||||
|
||||
10
CHANGELOG.md
10
CHANGELOG.md
@ -1,4 +1,4 @@
|
||||
### 1.7.37 (build 22101, api 9, 2024-11-13)
|
||||
### 1.7.37 (build 22102, api 9, 2024-11-14)
|
||||
- Bumping api version to 9. As you'll see below, there's some UI changes that
|
||||
will require a bit of work for any UI mods to adapt to. If your mods don't
|
||||
touch UI stuff at all you can simply bump your api version and call it a day.
|
||||
@ -156,6 +156,14 @@
|
||||
up `make preflight` to use this to keep things moving a bit faster. If you are
|
||||
not familiar with it, the `preflight` target is handy to run before committing
|
||||
code to git.
|
||||
- The app-modes tab in the dev-console now uses the meta tag system to discover
|
||||
testable app-modes. Previously this would simply list the `default_app_modes`
|
||||
listed in the projectconfig.json. So now it is possible to make and explicitly
|
||||
test new app modes via mod scripts on vanilla game builds. Note that the game
|
||||
still uses the `default_app_modes` projectconfig.json value when selecting
|
||||
app-modes at runtime; to change this you need to either change your
|
||||
projectconfig and rebuild or replace `ba*.app.mode_selector` at runtime with
|
||||
a custom selector that selects your custom app-mode(s).
|
||||
|
||||
### 1.7.36 (build 21944, api 8, 2024-07-26)
|
||||
- Wired up Tokens, BombSquad's new purchasable currency. The first thing these
|
||||
|
||||
@ -9,6 +9,8 @@ a more focused way.
|
||||
"""
|
||||
# pylint: disable=redefined-builtin
|
||||
|
||||
# ba_meta require api 9
|
||||
|
||||
# The stuff we expose here at the top level is our 'public' api for use
|
||||
# from other modules/packages. Code *within* this package should import
|
||||
# things from this package's submodules directly to reduce the chance of
|
||||
|
||||
@ -152,24 +152,6 @@ class App:
|
||||
|
||||
# __DEFAULT_APP_MODE_SELECTION_END__
|
||||
|
||||
@override
|
||||
def testable_app_modes(self) -> list[type[AppMode]]:
|
||||
# pylint: disable=cyclic-import
|
||||
|
||||
# __DEFAULT_TESTABLE_APP_MODES_BEGIN__
|
||||
# This section generated by batools.appmodule; do not edit.
|
||||
|
||||
# Return all our default_app_modes as testable.
|
||||
# (generated from 'default_app_modes' in projectconfig).
|
||||
import baclassic
|
||||
import babase
|
||||
|
||||
return [
|
||||
baclassic.ClassicAppMode,
|
||||
babase.EmptyAppMode,
|
||||
]
|
||||
# __DEFAULT_TESTABLE_APP_MODES_END__
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""(internal)
|
||||
|
||||
|
||||
@ -30,15 +30,3 @@ class AppModeSelector:
|
||||
limited to logic thread use/etc.
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def testable_app_modes(self) -> list[type[AppMode]]:
|
||||
"""Return a list of modes to appear in the dev-console app-mode ui.
|
||||
|
||||
The user can switch between these app modes for testing. App-modes
|
||||
will be passed an AppIntentDefault when selected by the user.
|
||||
|
||||
Note that in normal circumstances AppModes should never be
|
||||
selected explicitly by the user but rather determined implicitly
|
||||
based on AppIntents.
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
@ -33,13 +33,43 @@ class DevConsoleTabPython(DevConsoleTab):
|
||||
class DevConsoleTabAppModes(DevConsoleTab):
|
||||
"""Tab to switch app modes."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self._app_modes: list[type[AppMode]] | None = None
|
||||
self._app_modes_loading = False
|
||||
|
||||
def _on_app_modes_loaded(self, modes: list[type[AppMode]]) -> None:
|
||||
from babase._appintent import AppIntentDefault
|
||||
|
||||
intent = AppIntentDefault()
|
||||
|
||||
# Limit to modes that can handle default intents since that's
|
||||
# what we use.
|
||||
self._app_modes = [
|
||||
mode for mode in modes if mode.can_handle_intent(intent)
|
||||
]
|
||||
self.request_refresh()
|
||||
|
||||
@override
|
||||
def refresh(self) -> None:
|
||||
from babase import AppMode
|
||||
|
||||
# Kick off a load if applicable.
|
||||
if self._app_modes is None and not self._app_modes_loading:
|
||||
_babase.app.meta.load_exported_classes(
|
||||
AppMode, self._on_app_modes_loaded
|
||||
)
|
||||
|
||||
# Just say 'loading' if we don't have app-modes yet.
|
||||
if self._app_modes is None:
|
||||
self.text(
|
||||
'Loading...', pos=(0, 30), h_anchor='center', h_align='center'
|
||||
)
|
||||
return
|
||||
|
||||
bwidth = 260
|
||||
bpadding = 5
|
||||
modes = _babase.app.mode_selector.testable_app_modes()
|
||||
xoffs = -0.5 * bwidth * len(modes)
|
||||
|
||||
xoffs = -0.5 * bwidth * len(self._app_modes)
|
||||
|
||||
self.text(
|
||||
'Available AppModes:',
|
||||
@ -49,7 +79,7 @@ class DevConsoleTabAppModes(DevConsoleTab):
|
||||
v_align='center',
|
||||
)
|
||||
# pylint: disable=protected-access
|
||||
for i, mode in enumerate(modes):
|
||||
for i, mode in enumerate(self._app_modes):
|
||||
self.button(
|
||||
f'{mode.__module__}.{mode.__qualname__}',
|
||||
pos=(xoffs + i * bwidth + bpadding, 10),
|
||||
@ -78,7 +108,8 @@ class DevConsoleTabAppModes(DevConsoleTab):
|
||||
_babase.app.set_intent(intent)
|
||||
|
||||
# Slight hackish: need to wait a moment before refreshing to
|
||||
# pick up the new mode, as mode switches are asynchronous.
|
||||
# pick up the newly current mode, as mode switches are
|
||||
# asynchronous.
|
||||
_babase.apptimer(0.1, self.request_refresh)
|
||||
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@ if TYPE_CHECKING:
|
||||
from babase import AppIntent
|
||||
|
||||
|
||||
# ba_meta export babase.AppMode
|
||||
class EmptyAppMode(AppMode):
|
||||
"""An AppMode that does not do much at all."""
|
||||
|
||||
|
||||
@ -279,7 +279,7 @@ class DirectoryScan:
|
||||
except Exception:
|
||||
logging.exception("metascan: Error scanning '%s'.", subpath)
|
||||
|
||||
# Sort our results
|
||||
# Sort our results.
|
||||
for exportlist in self.results.exports.values():
|
||||
exportlist.sort()
|
||||
|
||||
@ -384,12 +384,16 @@ class DirectoryScan:
|
||||
# meta_lines is just anything containing '# ba_meta '; make sure
|
||||
# the ba_meta is in the right place.
|
||||
if mline[0] != 'ba_meta':
|
||||
logging.warning(
|
||||
'metascan: %s:%d: malformed ba_meta statement.',
|
||||
subpath,
|
||||
lindex + 1,
|
||||
)
|
||||
self.results.announce_errors_occurred = True
|
||||
# Make an exception for this specific file, otherwise we
|
||||
# get lots of warnings about ba_meta showing up in weird
|
||||
# places here.
|
||||
if str(subpath) not in ('babase/_meta.py',):
|
||||
logging.warning(
|
||||
'metascan: %s:%d: malformed ba_meta statement.',
|
||||
subpath,
|
||||
lindex + 1,
|
||||
)
|
||||
self.results.announce_errors_occurred = True
|
||||
elif (
|
||||
len(mline) == 4 and mline[1] == 'require' and mline[2] == 'api'
|
||||
):
|
||||
|
||||
@ -93,7 +93,7 @@ class PluginSubsystem(AppSubsystem):
|
||||
# that weren't covered by the meta stuff above, either creating
|
||||
# plugin-specs for them or clearing them out. This covers
|
||||
# plugins with api versions not matching ours, plugins without
|
||||
# ba_meta tags, and plugins that have since disappeared.
|
||||
# ba_*meta tags, and plugins that have since disappeared.
|
||||
assert isinstance(plugstates, dict)
|
||||
wrong_api_prefixes = [f'{m}.' for m in results.incorrect_api_modules]
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@ if TYPE_CHECKING:
|
||||
from bauiv1 import UIV1AppSubsystem, MainWindow, MainWindowState
|
||||
|
||||
|
||||
# ba_meta export babase.AppMode
|
||||
class ClassicAppMode(AppMode):
|
||||
"""AppMode for the classic BombSquad experience."""
|
||||
|
||||
@ -156,7 +157,7 @@ class ClassicAppMode(AppMode):
|
||||
"""Update subscriptions/etc. for a new primary account state."""
|
||||
assert in_logic_thread()
|
||||
|
||||
if bool(False):
|
||||
if bool(True):
|
||||
assert app.plus is not None
|
||||
if account is None:
|
||||
self._test_sub = None
|
||||
|
||||
@ -53,7 +53,7 @@ if TYPE_CHECKING:
|
||||
|
||||
# Build number and version of the ballistica binary we expect to be
|
||||
# using.
|
||||
TARGET_BALLISTICA_BUILD = 22101
|
||||
TARGET_BALLISTICA_BUILD = 22102
|
||||
TARGET_BALLISTICA_VERSION = '1.7.37'
|
||||
|
||||
|
||||
|
||||
@ -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 = 22101;
|
||||
const int kEngineBuildNumber = 22102;
|
||||
const char* kEngineVersion = "1.7.37";
|
||||
const int kEngineApiVersion = 9;
|
||||
|
||||
|
||||
@ -226,24 +226,27 @@ def generate_app_module(
|
||||
keep_markers=True,
|
||||
)
|
||||
|
||||
contents = (
|
||||
'# Return all our default_app_modes as testable.\n'
|
||||
"# (generated from 'default_app_modes' in projectconfig).\n"
|
||||
)
|
||||
for mode in default_app_modes:
|
||||
contents += f'import {_module_for_app_mode(mode)}\n'
|
||||
contents += '\n'
|
||||
contents += 'return [\n'
|
||||
for mode in default_app_modes:
|
||||
contents += f' {mode},\n'
|
||||
contents += ']'
|
||||
out = replace_section(
|
||||
out,
|
||||
f'{indent}# __DEFAULT_TESTABLE_APP_MODES_BEGIN__\n',
|
||||
f'{indent}# __DEFAULT_TESTABLE_APP_MODES_END__\n',
|
||||
textwrap.indent(f'{info}\n\n{contents}\n', indent),
|
||||
keep_markers=True,
|
||||
)
|
||||
# Disabling this for now; will probably remove permanently. Testable
|
||||
# app mode discovery now uses meta discovery system.
|
||||
if bool(False):
|
||||
contents = (
|
||||
'# Return all our default_app_modes as testable.\n'
|
||||
"# (generated from 'default_app_modes' in projectconfig).\n"
|
||||
)
|
||||
for mode in default_app_modes:
|
||||
contents += f'import {_module_for_app_mode(mode)}\n'
|
||||
contents += '\n'
|
||||
contents += 'return [\n'
|
||||
for mode in default_app_modes:
|
||||
contents += f' {mode},\n'
|
||||
contents += ']'
|
||||
out = replace_section(
|
||||
out,
|
||||
f'{indent}# __DEFAULT_TESTABLE_APP_MODES_BEGIN__\n',
|
||||
f'{indent}# __DEFAULT_TESTABLE_APP_MODES_END__\n',
|
||||
textwrap.indent(f'{info}\n\n{contents}\n', indent),
|
||||
keep_markers=True,
|
||||
)
|
||||
|
||||
# Note: we *should* format this string, but because this code
|
||||
# runs with every project update I'm just gonna try to keep the
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user