fixed an issue that could cause a 3 second pause at shutdown

This commit is contained in:
Eric 2023-09-09 23:19:30 -07:00
parent e4dfcd2680
commit a34a78f4e6
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
32 changed files with 232 additions and 100 deletions

108
.efrocachemap generated
View File

@ -421,10 +421,10 @@
"build/assets/ba_data/audio/zoeOw.ogg": "74befe45a8417e95b6a2233c51992a26",
"build/assets/ba_data/audio/zoePickup01.ogg": "48ab8cddfcde36a750856f3f81dd20c8",
"build/assets/ba_data/audio/zoeScream01.ogg": "2b468aedfa8741090247f04eb9e6df55",
"build/assets/ba_data/data/langdata.json": "0f4630cc7c78222e782da9cedd4df284",
"build/assets/ba_data/data/langdata.json": "44b7cb7d2ce62346834ab48d0d1e81bc",
"build/assets/ba_data/data/languages/arabic.json": "db961f7fe0541a31880929e1c17ea957",
"build/assets/ba_data/data/languages/belarussian.json": "5e373ddcfa6e1f771b74c02298a6599a",
"build/assets/ba_data/data/languages/chinese.json": "6520f793066c95773002b4e9a920fd1d",
"build/assets/ba_data/data/languages/belarussian.json": "995ee0abd5bc05704e9f5a7712774663",
"build/assets/ba_data/data/languages/chinese.json": "8fc810e920164f3d7374aaab8000e9ae",
"build/assets/ba_data/data/languages/chinesetraditional.json": "3fe960a8f0ca529aa57b4f9cb7385abc",
"build/assets/ba_data/data/languages/croatian.json": "766532c67af5bd0144c2d63cab0516fa",
"build/assets/ba_data/data/languages/czech.json": "f3ce219840946cb8f9aa6d3e25927ab3",
@ -439,22 +439,22 @@
"build/assets/ba_data/data/languages/greek.json": "a65d78f912e9a89f98de004405167a6a",
"build/assets/ba_data/data/languages/hindi.json": "88ee0cda537bab9ac827def5e236fe1a",
"build/assets/ba_data/data/languages/hungarian.json": "796a290a8c44a1e7635208c2ff5fdc6e",
"build/assets/ba_data/data/languages/indonesian.json": "583bae1ecc04375cee089a82359110b7",
"build/assets/ba_data/data/languages/italian.json": "8d9332d461fa5b84780818bf6c2978b5",
"build/assets/ba_data/data/languages/indonesian.json": "00b351a98d6fc301df604e1e9d56a055",
"build/assets/ba_data/data/languages/italian.json": "11f0a95abce8ef7b667b0d557746ecbe",
"build/assets/ba_data/data/languages/korean.json": "ca1122a9ee551da3f75ae632012bd0e2",
"build/assets/ba_data/data/languages/malay.json": "832562ce997fc70704b9234c95fb2e38",
"build/assets/ba_data/data/languages/persian.json": "5119aec9cbb2f8d00f2afaccf5fd5410",
"build/assets/ba_data/data/languages/persian.json": "0cf93f27181dd3ef4b0d03b88bf899cf",
"build/assets/ba_data/data/languages/polish.json": "826c5b0402c2f0bcc29bc6f48b833545",
"build/assets/ba_data/data/languages/portuguese.json": "99b27c598c90fd522132af3536aef0ee",
"build/assets/ba_data/data/languages/romanian.json": "aeebdd54f65939c2facc6ac50c117826",
"build/assets/ba_data/data/languages/russian.json": "aa99f9f597787fe4e09c8ab53fe2e081",
"build/assets/ba_data/data/languages/russian.json": "75ee4f36356f4f8a8413d4e0b6f5e268",
"build/assets/ba_data/data/languages/serbian.json": "d7452dd72ac0e51680cb39b5ebaa1c69",
"build/assets/ba_data/data/languages/slovak.json": "27962d53dc3f7dd4e877cd40faafeeef",
"build/assets/ba_data/data/languages/spanish.json": "b5390c76f3475c8b6dd64ab9f170b4d8",
"build/assets/ba_data/data/languages/spanish.json": "b59d7ad1a98831afbc4ab162af08ec51",
"build/assets/ba_data/data/languages/swedish.json": "77d671f10613291ebf9c71da66f18a18",
"build/assets/ba_data/data/languages/tamil.json": "b9d4b4e107456ea6420ee0f9d9d7a03e",
"build/assets/ba_data/data/languages/thai.json": "33f63753c9af9a5b238d229a0bf23fbc",
"build/assets/ba_data/data/languages/turkish.json": "0a97f1f948f6587ea7d40b639aba67ce",
"build/assets/ba_data/data/languages/turkish.json": "a5347d5f7fc9dc994053001a936964a4",
"build/assets/ba_data/data/languages/ukrainian.json": "f72eb51abfbbb56e27866895d7e947d2",
"build/assets/ba_data/data/languages/venetian.json": "b0e3d73ccf96c5fa490a54f090ee77a5",
"build/assets/ba_data/data/languages/vietnamese.json": "921cd1e50f60fe3e101f246e172750ba",
@ -4064,54 +4064,54 @@
"build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1",
"build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae",
"build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "6e8c0b5c28b62540f046c2ba38168608",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "b097a52e72eb501bc33585a3bd54b988",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "fcfda4425d3ce0d60e82660dc5e3660a",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "1ae03e80c9ac8a0caddbaa52d6675f37",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "872caac576c0c8fed8c7f591edb035db",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "d1b2ebe83c2ce40af748e9f98c6ac179",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "2d27be5a852c7f5321b4d83c02dfd050",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "7c1f46daa627b16b36ef29d1ff28c1a3",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "f152ea8d6f80de022ed9332f361139b5",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "a172802fb8a1f9e07460f12a0ac4f863",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "38f35f3b37cd9696639c34b0d6e74505",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "fc3cd78f2f6820ffffdbf3fe7bb64c19",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "1e9bf4419bb99d6cde7237c0d9f7f810",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "f243db567e1b19997460568b585a0584",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "3593beacdda3443066feb96ed5805b0e",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "37e2b26a57a9240a81ea2ff77c09d800",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "f8a8e15b53645a3c1b0b2173a9682200",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "ba56e540170084daff5686efb3f53cd0",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "7f852d4ff1372722087ca4b07ba31bcf",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "6a9ae109fdbef22d975c536608419c9b",
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "6ccd6f2bd0e20520063d4bf8e2c016d0",
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "82e76d58eab4962ee7567fbc655072d6",
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "6ccd6f2bd0e20520063d4bf8e2c016d0",
"build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "82e76d58eab4962ee7567fbc655072d6",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "e2ca657abc7945934c4b33602ecfbace",
"build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "5b24b2e91fb5c6eca673b0c35bbaf4ca",
"build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "e2ca657abc7945934c4b33602ecfbace",
"build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "5b24b2e91fb5c6eca673b0c35bbaf4ca",
"build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "cfa1c3ca813c3974316cc0abbb56277b",
"build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "73a49adbf5e205d927eda1a2272a3e98",
"build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "cfa1c3ca813c3974316cc0abbb56277b",
"build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "73a49adbf5e205d927eda1a2272a3e98",
"build/prefab/lib/mac_x86_64_gui/debug/libballisticaplus.a": "a882153cd74bdb5c1b84d2c46a290527",
"build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "6b00cce1baf5f95d36ae911cdcb23dba",
"build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "8708149fb6208e4e5889b4742784623d",
"build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "6b00cce1baf5f95d36ae911cdcb23dba",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "4d37d8db6457ea6fe36a8a1f8937f17d",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "8272e1708fae9ffbb2fbccab2fe33b66",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "e03d37a1cd44b30ab15dd8170ed13c23",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "2582464cd41de669ec508f55b992910f",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "c9849e097b112f073eff906610c35ee0",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "34cb97fc702b45ca805a651d4a96513b",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "ee693eb5f303cfe5df15d8cb6ee6f0ee",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "575fedd00692a44a3f958cf06f3d9d7b",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "be7456a804d5eb5d2ff3e3b0530b0017",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "b399f5228f71d01ad463f9adf6f9f3e3",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "c4571dc43b79a99f26a4063fe99cd24c",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "26e0d031dbb08e82f7972a605a00f54b",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "dfa74ed91d8a078ce7b1f55b81eef757",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "8e3910433139fefbe38aa1c82860a74d",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "21bc802d885c62fd08e5401c194d9ade",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "c197698cbf697bc2a9dcde4360e77774",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "15a86a0b661bdc17dd45e090499f543a",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "fa7e82973a3c7c3c65ab34289dcf1347",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "d90df2394233c26521a95fd28480eea7",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "fa6046684edee83a2e284713fa95d429",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "0705a4932544b892d270211232635d40",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "400866a75e8e2e7c585c52ab1d1d31e7",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "935d50a2ed3a47b7e91a31f9270702c5",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "cb26b566d37c2855f76d4e5d0d282389",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "67030df7a210f36f7bc0440c710aabd3",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "76febafca7f3234053af1b9aec0c2e17",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "679e7c1cc7429e7d6e3d2c3acf7af7e5",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "4a05fa84099fdb1ac4a1079e80c2820c",
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "c60d7bbdc75fc714a982213c8ca8dddb",
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "38c3726c684e5a87c9b875ba33d416d2",
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "c60d7bbdc75fc714a982213c8ca8dddb",
"build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "38c3726c684e5a87c9b875ba33d416d2",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "ed4ba7cce56cc2b91d344f03b22ec23d",
"build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "b2a242985db24c2d486d72e0c4d06bde",
"build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "ed4ba7cce56cc2b91d344f03b22ec23d",
"build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "b2a242985db24c2d486d72e0c4d06bde",
"build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "57d5225333eaf9e0df25cd54a1f58411",
"build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "e17654c90848f85140030c45e5a6ed6b",
"build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "57d5225333eaf9e0df25cd54a1f58411",
"build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "e17654c90848f85140030c45e5a6ed6b",
"build/prefab/lib/mac_x86_64_gui/debug/libballisticaplus.a": "8d4d62bb78e1bae5947a9e1c5f602425",
"build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "e00d5c375cabf7026557f2780edc6589",
"build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "cafeecd06961bee4ca51e2c34a25f137",
"build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "e00d5c375cabf7026557f2780edc6589",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "202043a4df67abe971cb887cc9ab40ce",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "73aada04161cc1e64306ba8964b65273",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "808a7fe357ceb8fc3f387d44b9c82890",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "5e757aa1dcdc5a66826c1f21e31a85fd",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "aec6cbbbaff1be15c197999b4a2adb76",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "b6dc26173fd02722a96e6994a775a3f6",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "e799ebd0d74fec947b2d8696701b5719",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "fd08bc9cc162d1339394145d20516447",
"src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c",
"src/assets/ba_data/python/babase/_mgen/enums.py": "f8cd3af311ac63147882590123b78318",
"src/ballistica/base/mgen/pyembed/binding_base.inc": "ad347097a38e0d7ede9eb6dec6a80ee9",
"src/ballistica/base/mgen/pyembed/binding_base_app.inc": "077bf63282b23d1880287200c9f6035f",
"src/ballistica/base/mgen/pyembed/binding_base_app.inc": "b67add3e1346f63491bf3450148e60d4",
"src/ballistica/classic/mgen/pyembed/binding_classic.inc": "3ceb412513963f0818ab39c58bf292e3",
"src/ballistica/core/mgen/pyembed/binding_core.inc": "9d0a3c9636138e35284923e0c8311c69",
"src/ballistica/core/mgen/pyembed/env.inc": "8be46e5818f360d10b7b0224a9e91d07",

View File

@ -2834,6 +2834,7 @@
<w>storename</w>
<w>stot</w>
<w>strftime</w>
<w>stringedit</w>
<w>stringified</w>
<w>stringifying</w>
<w>stringprep</w>

View File

@ -1,4 +1,4 @@
### 1.7.28 (build 21326, api 8, 2023-09-09)
### 1.7.28 (build 21328, api 8, 2023-09-09)
- Renamed Console to DevConsole, and added an option under advanced settings to
always show an ugly 'dev' button onscreen which can be used to toggle it. The
@ -28,6 +28,11 @@
is now true, so a raw `babase.quit()` should now be a good citizen on mobile
platforms. Also added the `g_base->QuitApp()` call which gives the C++ layer
an equivalent to the Python call.
- (build 21326) Fixed an uninitialized variable that could cause V1 networking
to fail in some builds/runs (thanks Rikko for the heads-up).
- (build 21327) Fixed an issue that could cause the app to pause for 3 seconds
at shutdown.
### 1.7.27 (build 21282, api 8, 2023-08-30)

View File

@ -1687,6 +1687,7 @@
<w>strchr</w>
<w>strcpy</w>
<w>strdup</w>
<w>stringedit</w>
<w>stringi</w>
<w>stringified</w>
<w>stringifying</w>

View File

@ -26,6 +26,7 @@
"ba_data/python/babase/__pycache__/_meta.cpython-311.opt-1.pyc",
"ba_data/python/babase/__pycache__/_net.cpython-311.opt-1.pyc",
"ba_data/python/babase/__pycache__/_plugin.cpython-311.opt-1.pyc",
"ba_data/python/babase/__pycache__/_stringedit.cpython-311.opt-1.pyc",
"ba_data/python/babase/__pycache__/_text.cpython-311.opt-1.pyc",
"ba_data/python/babase/__pycache__/_workspace.cpython-311.opt-1.pyc",
"ba_data/python/babase/__pycache__/modutils.cpython-311.opt-1.pyc",
@ -57,6 +58,7 @@
"ba_data/python/babase/_mgen/enums.py",
"ba_data/python/babase/_net.py",
"ba_data/python/babase/_plugin.py",
"ba_data/python/babase/_stringedit.py",
"ba_data/python/babase/_text.py",
"ba_data/python/babase/_workspace.py",
"ba_data/python/babase/modutils.py",

View File

@ -186,6 +186,7 @@ SCRIPT_TARGETS_PY_PUBLIC = \
$(BUILD_DIR)/ba_data/python/babase/_mgen/enums.py \
$(BUILD_DIR)/ba_data/python/babase/_net.py \
$(BUILD_DIR)/ba_data/python/babase/_plugin.py \
$(BUILD_DIR)/ba_data/python/babase/_stringedit.py \
$(BUILD_DIR)/ba_data/python/babase/_text.py \
$(BUILD_DIR)/ba_data/python/babase/_workspace.py \
$(BUILD_DIR)/ba_data/python/babase/modutils.py \
@ -457,6 +458,7 @@ SCRIPT_TARGETS_PYC_PUBLIC = \
$(BUILD_DIR)/ba_data/python/babase/_mgen/__pycache__/enums.cpython-311.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/babase/__pycache__/_net.cpython-311.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/babase/__pycache__/_plugin.cpython-311.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/babase/__pycache__/_stringedit.cpython-311.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/babase/__pycache__/_text.cpython-311.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/babase/__pycache__/_workspace.cpython-311.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/babase/__pycache__/modutils.cpython-311.opt-1.pyc \

View File

@ -23,6 +23,7 @@ from babase._workspace import WorkspaceSubsystem
from babase._appcomponent import AppComponentSubsystem
from babase._appmodeselector import AppModeSelector
from babase._appintent import AppIntentDefault, AppIntentExec
from babase._stringedit import StringEditSubsystem
if TYPE_CHECKING:
import asyncio
@ -136,8 +137,9 @@ class App:
def __init__(self) -> None:
"""(internal)
Do not instantiate this class; use babase.app to access
the single shared instance.
Do not instantiate this class; access the single shared instance
of it as 'app' which is available in various Ballistica
feature-set modules such as babase.
"""
# Hack for docs-generation.
@ -157,6 +159,7 @@ class App:
self.net = NetworkSubsystem()
self.workspaces = WorkspaceSubsystem()
self.components = AppComponentSubsystem()
self.stringedit = StringEditSubsystem()
# This is incremented any time the app is backgrounded or
# foregrounded; can be a simple way to determine if network data
@ -196,9 +199,9 @@ class App:
if os.environ.get('BA_RUNNING_WITH_DUMMY_MODULES') == '1':
return
# NOTE: the reason we need a postinit here is that
# some of this stuff accesses babase.app and that doesn't
# exist yet as of our __init__() call.
# NOTE: the reason we need a postinit here is that some of this
# stuff accesses babase.app and that doesn't exist yet as of our
# __init__() call.
self.lang = LanguageSubsystem()
self.plugins = PluginSubsystem()
@ -392,6 +395,10 @@ class App:
self._native_shutdown_called = True
self._update_state()
def on_native_shutdown_complete(self) -> None:
"""Called by the native layer when the app is done shutting down."""
assert _babase.in_logic_thread()
def read_config(self) -> None:
"""(internal)"""
from babase._appconfig import read_app_config
@ -754,7 +761,12 @@ class App:
except* Exception:
logging.exception('Unexpected error(s) in shutdown.')
_babase.complete_shutdown()
# Note: ideally we should run this directly here, but currently
# it does some legacy stuff which blocks, so running it here
# gives us asyncio task-took-too-long warnings. If we can
# convert those to nice graceful async tasks we should revert
# this to a direct call.
_babase.pushcall(_babase.complete_shutdown)
async def _run_shutdown_task(
self, coro: Coroutine[None, None, None]

View File

@ -0,0 +1,67 @@
# Released under the MIT License. See LICENSE for details.
#
"""Functionality for editing text strings.
This abstracts native edit dialogs as well as ones implemented via our
own ui toolkits.
"""
from __future__ import annotations
from typing import TYPE_CHECKING, final
import _babase
if TYPE_CHECKING:
pass
class StringEditSubsystem:
"""Full string-edit state for the app."""
def __init__(self) -> None:
pass
# print('HELLO FROM STRING EDIT')
class StringEdit:
"""Represents a string editing operation on some object.
Editable objects such as text widgets or in-app-consoles can
subclass this to make their contents editable on all platforms.
"""
def __init__(self, initial_text: str) -> None:
pass
@final
def apply(self, new_text: str) -> None:
"""Should be called by the owner when editing is complete.
Note that in some cases this call may be a no-op (such as if
this StringEdit is no longer the globally active one).
"""
if not _babase.in_logic_thread():
raise RuntimeError('This must be called from the logic thread.')
self._do_apply(new_text)
@final
def cancel(self) -> None:
"""Should be called by the owner when editing is cancelled."""
if not _babase.in_logic_thread():
raise RuntimeError('This must be called from the logic thread.')
self._do_cancel()
def _do_apply(self, new_text: str) -> None:
"""Should be overridden by subclasses to handle apply.
Will always be called in the logic thread.
"""
raise NotImplementedError('Subclasses must override this.')
def _do_cancel(self) -> None:
"""Should be overridden by subclasses to handle cancel.
Will always be called in the logic thread.
"""
raise NotImplementedError('Subclasses must override this.')

View File

@ -52,7 +52,7 @@ if TYPE_CHECKING:
# Build number and version of the ballistica binary we expect to be
# using.
TARGET_BALLISTICA_BUILD = 21326
TARGET_BALLISTICA_BUILD = 21328
TARGET_BALLISTICA_VERSION = '1.7.28'

View File

@ -16,6 +16,7 @@ void AppMode::OnAppStart() {}
void AppMode::OnAppPause() {}
void AppMode::OnAppResume() {}
void AppMode::OnAppShutdown() {}
void AppMode::OnAppShutdownComplete() {}
auto AppMode::CreateInputDeviceDelegate(InputDevice* device)
-> InputDeviceDelegate* {

View File

@ -37,6 +37,7 @@ class AppMode {
virtual void OnAppPause();
virtual void OnAppResume();
virtual void OnAppShutdown();
virtual void OnAppShutdownComplete();
/// Apply the app config.
virtual void DoApplyAppConfig();

View File

@ -25,6 +25,8 @@ void Audio::OnAppResume() { assert(g_base->InLogicThread()); }
void Audio::OnAppShutdown() { assert(g_base->InLogicThread()); }
void Audio::OnAppShutdownComplete() { assert(g_base->InLogicThread()); }
void Audio::StepDisplayTime() { assert(g_base->InLogicThread()); }
void Audio::DoApplyAppConfig() {

View File

@ -24,6 +24,7 @@ class Audio {
virtual void OnAppPause();
virtual void OnAppResume();
virtual void OnAppShutdown();
virtual void OnAppShutdownComplete();
virtual void DoApplyAppConfig();
virtual void OnScreenSizeChange();
virtual void StepDisplayTime();

View File

@ -101,6 +101,8 @@ void Graphics::OnAppResume() {
void Graphics::OnAppShutdown() { assert(g_base->InLogicThread()); }
void Graphics::OnAppShutdownComplete() { assert(g_base->InLogicThread()); }
void Graphics::DoApplyAppConfig() {
assert(g_base->InLogicThread());

View File

@ -56,6 +56,7 @@ class Graphics {
void OnAppPause();
void OnAppResume();
void OnAppShutdown();
void OnAppShutdownComplete();
void OnScreenSizeChange();
void DoApplyAppConfig();

View File

@ -560,6 +560,8 @@ void Input::OnAppResume() { assert(g_base->InLogicThread()); }
void Input::OnAppShutdown() { assert(g_base->InLogicThread()); }
void Input::OnAppShutdownComplete() { assert(g_base->InLogicThread()); }
// Tells all inputs to update their controls based on the app config.
void Input::DoApplyAppConfig() {
assert(g_base->InLogicThread());

View File

@ -23,6 +23,7 @@ class Input {
void OnAppPause();
void OnAppResume();
void OnAppShutdown();
void OnAppShutdownComplete();
void StepDisplayTime();
void DoApplyAppConfig();

View File

@ -257,10 +257,26 @@ void Logic::CompleteShutdown() {
void Logic::OnAppShutdownComplete() {
assert(g_base->InLogicThread());
// Wrap up any last business here in the logic thread and then
// kick things over to the main thread to exit out of the main loop.
// Wrap up any last business here in the logic thread and then kick things
// over to the main thread to exit out of the main loop.
g_core->LifecycleLog("app shutdown complete");
// Let our logic subsystems know in case there's any last thing they'd
// like to do right before we exit.
// Note: Keep these in opposite order of OnAppStart.
// Note2: Any shutdown processes that take a non-zero amount of time
// should be registered as shutdown-tasks
g_base->python->OnAppShutdownComplete();
if (g_base->HavePlus()) {
g_base->plus()->OnAppShutdownComplete();
}
g_base->app_mode()->OnAppShutdownComplete();
g_base->ui->OnAppShutdownComplete();
g_base->input->OnAppShutdownComplete();
g_base->audio->OnAppShutdownComplete();
g_base->graphics->OnAppShutdownComplete();
g_base->platform->OnAppShutdownComplete();
g_core->main_event_loop()->PushCall([] { g_base->OnAppShutdownComplete(); });
}

View File

@ -318,6 +318,7 @@ void BasePlatform::OnAppStart() { assert(g_base->InLogicThread()); }
void BasePlatform::OnAppPause() { assert(g_base->InLogicThread()); }
void BasePlatform::OnAppResume() { assert(g_base->InLogicThread()); }
void BasePlatform::OnAppShutdown() { assert(g_base->InLogicThread()); }
void BasePlatform::OnAppShutdownComplete() { assert(g_base->InLogicThread()); }
void BasePlatform::OnScreenSizeChange() { assert(g_base->InLogicThread()); }
void BasePlatform::DoApplyAppConfig() { assert(g_base->InLogicThread()); }

View File

@ -30,6 +30,7 @@ class BasePlatform {
virtual void OnAppPause();
virtual void OnAppResume();
virtual void OnAppShutdown();
virtual void OnAppShutdownComplete();
virtual void OnScreenSizeChange();
virtual void DoApplyAppConfig();

View File

@ -164,6 +164,11 @@ void BasePython::OnAppShutdown() {
objs().Get(BasePython::ObjID::kAppOnNativeShutdownCall).Call();
}
void BasePython::OnAppShutdownComplete() {
assert(g_base->InLogicThread());
objs().Get(BasePython::ObjID::kAppOnNativeShutdownCompleteCall).Call();
}
void BasePython::DoApplyAppConfig() { assert(g_base->InLogicThread()); }
void BasePython::OnScreenSizeChange() { assert(g_base->InLogicThread()); }

View File

@ -18,6 +18,7 @@ class BasePython {
void OnAppPause();
void OnAppResume();
void OnAppShutdown();
void OnAppShutdownComplete();
void DoApplyAppConfig();
void OnScreenSizeChange();
void StepDisplayTime();
@ -73,6 +74,7 @@ class BasePython {
kAppOnNativePauseCall,
kAppOnNativeResumeCall,
kAppOnNativeShutdownCall,
kAppOnNativeShutdownCompleteCall,
kQuitCall,
kShowPostPurchaseMessageCall,
kContextError,

View File

@ -22,6 +22,7 @@ class PlusSoftInterface {
virtual void OnAppPause() = 0;
virtual void OnAppResume() = 0;
virtual void OnAppShutdown() = 0;
virtual void OnAppShutdownComplete() = 0;
virtual void DoApplyAppConfig() = 0;
virtual void OnScreenSizeChange() = 0;
virtual void StepDisplayTime() = 0;

View File

@ -83,6 +83,7 @@ void UI::OnAppResume() {
}
void UI::OnAppShutdown() { assert(g_base->InLogicThread()); }
void UI::OnAppShutdownComplete() { assert(g_base->InLogicThread()); }
void UI::DoApplyAppConfig() {
assert(g_base->InLogicThread());

View File

@ -27,6 +27,7 @@ class UI {
void OnAppPause();
void OnAppResume();
void OnAppShutdown();
void OnAppShutdownComplete();
void DoApplyAppConfig();
void OnScreenSizeChange();
void StepDisplayTime();

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 = 21326;
const int kEngineBuildNumber = 21328;
const char* kEngineVersion = "1.7.28";
const int kEngineApiVersion = 8;

View File

@ -276,8 +276,8 @@ void UIV1FeatureSet::DeleteWidget(Widget* widget) {
}
void UIV1FeatureSet::DoApplyAppConfig() {
TextWidget::set_always_use_internal_keyboard(g_base->app_config->Resolve(
base::AppConfig::BoolID::kAlwaysUseInternalKeyboard));
always_use_internal_on_screen_keyboard_ = g_base->app_config->Resolve(
base::AppConfig::BoolID::kAlwaysUseInternalKeyboard);
}
UIV1FeatureSet::UILock::UILock(bool write) {

View File

@ -130,13 +130,17 @@ class UIV1FeatureSet : public FeatureSetNativeComponent,
auto SendWidgetMessage(const base::WidgetMessage& m) -> int override;
void DoApplyAppConfig() override;
auto always_use_internal_on_screen_keyboard() const {
return always_use_internal_on_screen_keyboard_;
}
private:
UIV1FeatureSet();
RootUI* root_ui_{};
Object::Ref<ContainerWidget> screen_root_widget_;
Object::Ref<ContainerWidget> overlay_root_widget_;
Object::Ref<RootWidget> root_widget_;
bool always_use_internal_on_screen_keyboard_{};
int ui_lock_count_{};
};

View File

@ -23,7 +23,7 @@ namespace ballistica::ui_v1 {
const float kClearMargin{13.0f};
bool TextWidget::always_use_internal_keyboard_{false};
// bool TextWidget::always_use_internal_keyboard_{false};
// FIXME: Move this to g_ui or something; not a global.
Object::WeakRef<TextWidget> TextWidget::android_string_edit_widget_;
@ -522,21 +522,25 @@ auto TextWidget::GetHeight() -> float {
auto TextWidget::ShouldUseStringEditDialog() const -> bool {
if (g_core->HeadlessMode()) {
// Shouldn't really get here, but if we do, keep things simple.
return false;
}
if (force_internal_editing_) {
// Obscure cases such as the text-widget *on* our built-in on-screen
// keyboard.
return false;
}
if (always_use_internal_keyboard_) {
if (g_ui_v1->always_use_internal_on_screen_keyboard()) {
return true;
}
// On most platforms we always want to do this. On desktop, however, we
// use inline editing if the current UI input-device is the mouse or
// keyboard.
// On most platforms we always want to use an edit dialog. On desktop,
// however, we use inline editing *if* the current UI input-device is the
// mouse or keyboard. For anything else, like game controllers, we bust
// out the dialog.
if (g_buildconfig.ostype_macos() || g_buildconfig.ostype_windows()
|| g_buildconfig.ostype_linux()) {
base::InputDevice* ui_input_device = g_base->ui->GetUIInputDevice();
auto* ui_input_device = g_base->ui->GetUIInputDevice();
return !(ui_input_device == nullptr
|| ui_input_device == g_base->input->keyboard_input());
} else {
@ -544,29 +548,27 @@ auto TextWidget::ShouldUseStringEditDialog() const -> bool {
}
}
void TextWidget::BringUpEditDialog() {
bool use_internal_dialog = true;
void TextWidget::InvokeStringEditDialog() {
bool use_internal_dialog{true};
// in vr we always use our own dialog..
// In VR we always use our own dialog.
if (g_core->IsVRMode()) {
use_internal_dialog = true;
} else {
// on android, use the android keyboard unless the user want to use ours..
if (!always_use_internal_keyboard_) {
// on android we pull up a native dialog
// (FIXME - abstract this to platform so we can use it elsewhere)
// on Android, use the Android keyboard *unless* the user want to use
// our built-in one.
if (!g_ui_v1->always_use_internal_on_screen_keyboard()) {
if (g_buildconfig.ostype_android()) {
use_internal_dialog = false;
// store ourself as the current text-widget and kick off an edit
// Store ourself as the current text-widget and kick off an edit.
android_string_edit_widget_ = this;
g_core->main_event_loop()->PushCall(
[name = description_, value = text_raw_, max_chars = max_chars_] {
static millisecs_t last_edit_time = 0;
millisecs_t t = g_core->GetAppTimeMillisecs();
// Ignore if too close together.
// (in case second request comes in before first takes effect).
// Ignore if too close together (in case second request comes
// in before first takes effect).
if (t - last_edit_time < 1000) {
return;
}
@ -577,7 +579,7 @@ void TextWidget::BringUpEditDialog() {
}
}
}
if (explicit_bool(use_internal_dialog)) {
if (use_internal_dialog) {
g_ui_v1->python->LaunchStringEdit(this);
}
}
@ -587,14 +589,13 @@ void TextWidget::Activate() {
static_cast<millisecs_t>(g_base->logic->display_time() * 1000.0);
if (auto* call = on_activate_call_.Get()) {
// Call this in the next cycle (don't wanna risk mucking with UI from within
// a UI loop).
// Call this in the next cycle (don't wanna risk mucking with UI from
// within a UI loop).
call->ScheduleWeak();
}
// If we're on ouya and this is editable, it brings up our string-editor.
if (editable_ && ShouldUseStringEditDialog()) {
BringUpEditDialog();
InvokeStringEditDialog();
}
}
@ -795,7 +796,7 @@ auto TextWidget::HandleMessage(const base::WidgetMessage& m) -> bool {
// If we're using an edit dialog, any attempted text input just kicks us
// over to that.
if (editable() && ShouldUseStringEditDialog()) {
BringUpEditDialog();
InvokeStringEditDialog();
} else {
// Otherwise apply the text directly.
if (editable() && m.sval != nullptr) {
@ -907,7 +908,7 @@ auto TextWidget::HandleMessage(const base::WidgetMessage& m) -> bool {
&& (y >= (-bottom_overlap)) && (y < (height_ + top_overlap))
&& !claimed) {
// With dialog-editing, a click/tap brings up our editor.
BringUpEditDialog();
InvokeStringEditDialog();
}
// Pressed buttons always claim mouse-ups presented to them.

View File

@ -79,11 +79,8 @@ class TextWidget : public Widget {
auto force_internal_editing() const -> bool {
return force_internal_editing_;
}
// set whether to attempt to use big font (if possible)
// Set whether to attempt to use big font (if possible).
void SetBig(bool big);
static void set_always_use_internal_keyboard(bool val) {
always_use_internal_keyboard_ = val;
}
void set_extra_touch_border_scale(float scale) {
extra_touch_border_scale_ = scale;
}
@ -93,9 +90,9 @@ class TextWidget : public Widget {
auto ScaleAdjustedY(float y) -> float;
void AddCharsToText(const std::string& addchars);
auto ShouldUseStringEditDialog() const -> bool;
void BringUpEditDialog();
void InvokeStringEditDialog();
void UpdateTranslation();
static bool always_use_internal_keyboard_;
// static bool always_use_internal_keyboard_;
static Object::WeakRef<TextWidget> android_string_edit_widget_;
float res_scale_{1.0f};
bool enabled_{true};

View File

@ -17,5 +17,6 @@ values = [
app.on_native_pause, # kAppOnNativePauseCall
app.on_native_resume, # kAppOnNativeResumeCall
app.on_native_shutdown, # kAppOnNativeShutdownCall
app.on_native_shutdown_complete, # kAppOnNativeShutdownCompleteCall
app.read_config, # kAppReadConfigCall
]

View File

@ -706,7 +706,7 @@ def cmake_prep_dir(dirname: str, verbose: bool = False) -> None:
# away all cmake builds everywhere (to keep things clean if we
# rename or move something in the build dir or if we change
# something cmake doesn't properly handle without a fresh start).
entries: list[Entry] = [Entry('explicit cmake rebuild', '2')]
entries: list[Entry] = [Entry('explicit cmake rebuild', '3')]
# Start fresh if cmake version changes.
cmake_ver_output = subprocess.run(
@ -723,7 +723,7 @@ def cmake_prep_dir(dirname: str, verbose: bool = False) -> None:
)
entries.append(Entry('cmake path', cmake_path))
# ...or if python's version changes.
# ...or if Python's version changes.
python_ver_output = (
subprocess.run(
[f'python{PYVER}', '--version'], check=True, capture_output=True