mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-28 18:15:45 +08:00
various cleanup
This commit is contained in:
parent
1dfc78e6dd
commit
fb9c2de47e
88
.efrocachemap
generated
88
.efrocachemap
generated
@ -4056,50 +4056,50 @@
|
||||
"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": "202a2e3e7dbb0fd70f631826c1dbaf0a",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "22ecb313cd505be3cd636b40b82aaf4e",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "5c885286ec7d31db5beec842e0d74f04",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "fa8322a1fc0b158db47f22f8f67bce40",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "026341fd254d8192d6593c78ed106f9e",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "c48a68814f8c4f9c14f75857ac721756",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "74da3142016212cd6ec612d3f4a04461",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "d0efb84cfb947c901c4b371a68c4983e",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "5a34c14e75fe4cb23c15866e622a95b9",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "55eb23b8e4c58366a9206d19b7583b59",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "14c485729c8c8dee8208e303eaa9c149",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "a0f44a88e6452866610c77b988e82fbf",
|
||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "d9e990f175d61d32e825b9c9704a5883",
|
||||
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "cf9a0ca90fad523d38aeafa4aa6d8abb",
|
||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "6a2df7fa5d02d4b353a408e33716d532",
|
||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "6cf962925756084b5dfde18a8ec46ecd",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "39a7a8b26bfb1241af1983f478a32e17",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "ecc017287c8665d20724b50d1d9fc114",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "c64f407e7f134b6961379f09b0b45f30",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "68e9c85cb35bbf3bf44a81b913ba7d20",
|
||||
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "ed4f56d8c3f411d4ee509d688fa75ed2",
|
||||
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "7703e63545add0d6baf9a2c0c48a8ff0",
|
||||
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "ed4f56d8c3f411d4ee509d688fa75ed2",
|
||||
"build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "7703e63545add0d6baf9a2c0c48a8ff0",
|
||||
"build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "a676d837abdc390988bb02822371cb8a",
|
||||
"build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "325716db5f765632c41098245e13f016",
|
||||
"build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "a676d837abdc390988bb02822371cb8a",
|
||||
"build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "325716db5f765632c41098245e13f016",
|
||||
"build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "d29c1a27fe79b6bec68b2bae8cd824ab",
|
||||
"build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "13ba6c75f4cef904927092584668652a",
|
||||
"build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "d29c1a27fe79b6bec68b2bae8cd824ab",
|
||||
"build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "13ba6c75f4cef904927092584668652a",
|
||||
"build/prefab/lib/mac_x86_64_gui/debug/libballisticaplus.a": "0cc7c23d18c9af1339799e10bb17c452",
|
||||
"build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "7b1e17863d20f12dd11f13e0e9e94726",
|
||||
"build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "4b5b600e7f830a92ed41e165afba0d29",
|
||||
"build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "7b1e17863d20f12dd11f13e0e9e94726",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "3283c623553f920fa2f3a9ec0030ac0d",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "fbe90d6ae5948402094786f0f3780a43",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "da351ad49a02bf9ea47173971258aba4",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "8f2bec2e58845179da06bb3846ef1009",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "2997bb1199bee10e628e4c05e8e3f91a",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "1439c19607ba8ecafbc601a848fe51da",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "503be144a9e8836f71eff0abbd29c5ad",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "ee250e8c6a40bcfeda25cbc0df88486c",
|
||||
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "bc76c6a34a367df5874a1806d3380730",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "0d84d2854b2418bc72d0402fa20fb2d6",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "9ed7e0a8e0fb50d0938e22179b95dc3b",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "4ffe100e34d497f9b05927ca446c2eb1",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "978b1fa602bc48d814c8051b6e3a5ef0",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "0f5435e98f8f2cd2ab9ddd07974e4dab",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "04118a4d5a9ed3ef0bde328b553df122",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "3a6b0376fa55dd7973c991e4593a5e94",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "f77111f3a4e48696456bd70a8cdfcf1b",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "c2608d781507d8e95961e80f9a2f3e98",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "1e64d28f0c44651df685cc40b8f7542c",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "a346c666b51f29a7cd6b4edbc35cba24",
|
||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "1f4352145abac6cb90a92024734d7647",
|
||||
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "84cf028c26c40952722c1312d8f6fb13",
|
||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "7545800c0ff817d58239a58cbcec043d",
|
||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "d846a8092d61577fc888396962a7d01d",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "6f0c8e9154730666866886235159128c",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "753fe097bbe82ff89589c29606fbba66",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "4a72d99954e642a87d9edb767bcb6103",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "185219931d4dc82ee7b8c33f26299c54",
|
||||
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "5156f353592c4211f25ee238afe038fc",
|
||||
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "dd16f8d0f18ef126d051c5cd725b1568",
|
||||
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "5156f353592c4211f25ee238afe038fc",
|
||||
"build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "dd16f8d0f18ef126d051c5cd725b1568",
|
||||
"build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "d81a643b59391309b04187879cd045aa",
|
||||
"build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "050b8028c1b14c314dc44ad33bf66cb7",
|
||||
"build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "d81a643b59391309b04187879cd045aa",
|
||||
"build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "050b8028c1b14c314dc44ad33bf66cb7",
|
||||
"build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "19dd80f1ff879e120b89fb94767418a4",
|
||||
"build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "81dd9ab9d64e8f3a038b5942a90c7ec5",
|
||||
"build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "19dd80f1ff879e120b89fb94767418a4",
|
||||
"build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "81dd9ab9d64e8f3a038b5942a90c7ec5",
|
||||
"build/prefab/lib/mac_x86_64_gui/debug/libballisticaplus.a": "fa8a5b2de21d629d7542b0c7335ffdf0",
|
||||
"build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "b4f192949f671e0d20536bfbb04591e3",
|
||||
"build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "0f6bd992d92d00526ce8746aee66dc9e",
|
||||
"build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "b4f192949f671e0d20536bfbb04591e3",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "62927dee99eaf521daf0872af4bfb36c",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "90a17d2a0b125923252a8760c9ba369c",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "4a3e691967151431ebbae1138442c2e7",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "5f4e2c8d39e1f547fd0b3a1d093bf6c7",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "5f2ba19d5ac0dee8cb46f2e19214a9ce",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "eff64f1be917c44f189c4d812ace22d5",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "ba281d69f264f64f471b1127e4189edc",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "99aefd9fc4c01bd63e1cd3af116b9040",
|
||||
"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": "9f71f171464dc004dbaab87e9bb4b03b",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
### 1.7.28 (build 21409, api 8, 2023-10-03)
|
||||
### 1.7.28 (build 21410, api 8, 2023-10-03)
|
||||
|
||||
- Massively cleaned up code related to rendering and window systems (OpenGL,
|
||||
SDL, etc). This code had been growing into a nasty tangle for 15 years
|
||||
@ -95,7 +95,8 @@
|
||||
Thanks SoK05 and Dliwk!
|
||||
- In cases where there's no browser available, the v2 account sign-in URL can
|
||||
now be tapped to copy it (Thanks vishal332008!).
|
||||
|
||||
- Removed the bits from `babase.app` that were deprecated in 1.7.27. I know that
|
||||
was only one version ago, but this version has been cooking for a while now.
|
||||
|
||||
### 1.7.27 (build 21282, api 8, 2023-08-30)
|
||||
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
# Released under the MIT License. See LICENSE for details.
|
||||
#
|
||||
"""Functionality related to the high level state of the app."""
|
||||
# pylint: disable=too-many-lines
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import logging
|
||||
import warnings
|
||||
from enum import Enum
|
||||
from typing import TYPE_CHECKING
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
@ -158,7 +156,10 @@ class App:
|
||||
# processing. It should also be passed to any additional asyncio
|
||||
# loops we create so that everything shares the same single set
|
||||
# of worker threads.
|
||||
self.threadpool = ThreadPoolExecutor(thread_name_prefix='baworker')
|
||||
self.threadpool = ThreadPoolExecutor(
|
||||
thread_name_prefix='baworker',
|
||||
initializer=self._thread_pool_thread_init,
|
||||
)
|
||||
|
||||
self.meta = MetadataSubsystem()
|
||||
self.net = NetworkSubsystem()
|
||||
@ -198,6 +199,7 @@ class App:
|
||||
self._shutdown_tasks: list[Coroutine[None, None, None]] = [
|
||||
self._wait_for_shutdown_suppressions()
|
||||
]
|
||||
self._pool_thread_count = 0
|
||||
|
||||
def postinit(self) -> None:
|
||||
"""Called after we've been inited and assigned to babase.app.
|
||||
@ -890,243 +892,7 @@ class App:
|
||||
'Error in work submitted via threadpool_submit_no_wait()'
|
||||
)
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# THE FOLLOWING ARE DEPRECATED AND WILL BE REMOVED IN A FUTURE UPDATE.
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
@property
|
||||
def build_number(self) -> int:
|
||||
"""Integer build number.
|
||||
|
||||
This value increases by at least 1 with each release of the engine.
|
||||
It is independent of the human readable babase.App.version string.
|
||||
"""
|
||||
warnings.warn(
|
||||
'app.build_number is deprecated; use app.env.build_number',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.env.build_number
|
||||
|
||||
@property
|
||||
def device_name(self) -> str:
|
||||
"""Name of the device running the app."""
|
||||
warnings.warn(
|
||||
'app.device_name is deprecated; use app.env.device_name',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.env.device_name
|
||||
|
||||
@property
|
||||
def config_file_path(self) -> str:
|
||||
"""Where the app's config file is stored on disk."""
|
||||
warnings.warn(
|
||||
'app.config_file_path is deprecated;'
|
||||
' use app.env.config_file_path',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.env.config_file_path
|
||||
|
||||
@property
|
||||
def version(self) -> str:
|
||||
"""Human-readable engine version string; something like '1.3.24'.
|
||||
|
||||
This should not be interpreted as a number; it may contain
|
||||
string elements such as 'alpha', 'beta', 'test', etc.
|
||||
If a numeric version is needed, use `build_number`.
|
||||
"""
|
||||
warnings.warn(
|
||||
'app.version is deprecated; use app.env.version',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.env.version
|
||||
|
||||
@property
|
||||
def debug_build(self) -> bool:
|
||||
"""Whether the app was compiled in debug mode.
|
||||
|
||||
Debug builds generally run substantially slower than non-debug
|
||||
builds due to compiler optimizations being disabled and extra
|
||||
checks being run.
|
||||
"""
|
||||
warnings.warn(
|
||||
'app.debug_build is deprecated; use app.env.debug',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.env.debug
|
||||
|
||||
@property
|
||||
def test_build(self) -> bool:
|
||||
"""Whether the app was compiled in test mode.
|
||||
|
||||
Test mode enables extra checks and features that are useful for
|
||||
release testing but which do not slow the game down significantly.
|
||||
"""
|
||||
warnings.warn(
|
||||
'app.test_build is deprecated; use app.env.test',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.env.test
|
||||
|
||||
@property
|
||||
def data_directory(self) -> str:
|
||||
"""Path where static app data lives."""
|
||||
warnings.warn(
|
||||
'app.data_directory is deprecated; use app.env.data_directory',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.env.data_directory
|
||||
|
||||
@property
|
||||
def python_directory_user(self) -> str | None:
|
||||
"""Path where the app expects its user scripts (mods) to live.
|
||||
|
||||
Be aware that this value may be None if ballistica is running in
|
||||
a non-standard environment, and that python-path modifications may
|
||||
cause modules to be loaded from other locations.
|
||||
"""
|
||||
warnings.warn(
|
||||
'app.python_directory_user is deprecated;'
|
||||
' use app.env.python_directory_user',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.env.python_directory_user
|
||||
|
||||
@property
|
||||
def python_directory_app(self) -> str | None:
|
||||
"""Path where the app expects its bundled modules to live.
|
||||
|
||||
Be aware that this value may be None if Ballistica is running in
|
||||
a non-standard environment, and that python-path modifications may
|
||||
cause modules to be loaded from other locations.
|
||||
"""
|
||||
warnings.warn(
|
||||
'app.python_directory_app is deprecated;'
|
||||
' use app.env.python_directory_app',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.env.python_directory_app
|
||||
|
||||
@property
|
||||
def python_directory_app_site(self) -> str | None:
|
||||
"""Path where the app expects its bundled pip modules to live.
|
||||
|
||||
Be aware that this value may be None if Ballistica is running in
|
||||
a non-standard environment, and that python-path modifications may
|
||||
cause modules to be loaded from other locations.
|
||||
"""
|
||||
warnings.warn(
|
||||
'app.python_directory_app_site is deprecated;'
|
||||
' use app.env.python_directory_app_site',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.env.python_directory_app_site
|
||||
|
||||
@property
|
||||
def api_version(self) -> int:
|
||||
"""The app's api version.
|
||||
|
||||
Only Python modules and packages associated with the current API
|
||||
version number will be detected by the game (see the ba_meta tag).
|
||||
This value will change whenever substantial backward-incompatible
|
||||
changes are introduced to ballistica APIs. When that happens,
|
||||
modules/packages should be updated accordingly and set to target
|
||||
the newer API version number.
|
||||
"""
|
||||
warnings.warn(
|
||||
'app.api_version is deprecated; use app.env.api_version',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.env.api_version
|
||||
|
||||
@property
|
||||
def on_tv(self) -> bool:
|
||||
"""Whether the app is currently running on a TV."""
|
||||
warnings.warn(
|
||||
'app.on_tv is deprecated; use app.env.tv',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.env.tv
|
||||
|
||||
@property
|
||||
def vr_mode(self) -> bool:
|
||||
"""Whether the app is currently running in VR."""
|
||||
warnings.warn(
|
||||
'app.vr_mode is deprecated; use app.env.vr',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.env.vr
|
||||
|
||||
# __SPINOFF_REQUIRE_UI_V1_BEGIN__
|
||||
|
||||
@property
|
||||
def toolbar_test(self) -> bool:
|
||||
"""(internal)."""
|
||||
warnings.warn(
|
||||
'app.toolbar_test is deprecated; use app.ui_v1.use_toolbars',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.ui_v1.use_toolbars
|
||||
|
||||
# __SPINOFF_REQUIRE_UI_V1_END__
|
||||
|
||||
@property
|
||||
def arcade_mode(self) -> bool:
|
||||
"""Whether the app is currently running on arcade hardware."""
|
||||
warnings.warn(
|
||||
'app.arcade_mode is deprecated; use app.env.arcade',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.env.arcade
|
||||
|
||||
@property
|
||||
def headless_mode(self) -> bool:
|
||||
"""Whether the app is running headlessly."""
|
||||
warnings.warn(
|
||||
'app.headless_mode is deprecated; use app.env.headless',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.env.headless
|
||||
|
||||
@property
|
||||
def demo_mode(self) -> bool:
|
||||
"""Whether the app is targeting a demo experience."""
|
||||
warnings.warn(
|
||||
'app.demo_mode is deprecated; use app.env.demo',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.env.demo
|
||||
|
||||
# __SPINOFF_REQUIRE_SCENE_V1_BEGIN__
|
||||
|
||||
@property
|
||||
def protocol_version(self) -> int:
|
||||
"""(internal)."""
|
||||
# pylint: disable=cyclic-import
|
||||
import bascenev1
|
||||
|
||||
warnings.warn(
|
||||
'app.protocol_version is deprecated;'
|
||||
' use bascenev1.protocol_version()',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return bascenev1.protocol_version()
|
||||
|
||||
# __SPINOFF_REQUIRE_SCENE_V1_END__
|
||||
def _thread_pool_thread_init(self) -> None:
|
||||
# Help keep things clear in profiling tools/etc.
|
||||
self._pool_thread_count += 1
|
||||
_babase.set_thread_name(f'ballistica worker-{self._pool_thread_count}')
|
||||
|
||||
@ -384,6 +384,7 @@ class AppHealthMonitor(AppSubsystem):
|
||||
log_dumped_app_state()
|
||||
|
||||
def _app_monitor_thread_main(self) -> None:
|
||||
_babase.set_thread_name('ballistica app-monitor')
|
||||
try:
|
||||
self._monitor_app()
|
||||
except Exception:
|
||||
|
||||
@ -40,6 +40,11 @@ def on_native_module_import() -> None:
|
||||
if envconfig.log_handler is not None:
|
||||
_feed_logs_to_babase(envconfig.log_handler)
|
||||
|
||||
# Also let's name the log-handler thread to help in profiling.
|
||||
envconfig.log_handler.call_in_thread(
|
||||
lambda: _babase.set_thread_name('ballistica logging')
|
||||
)
|
||||
|
||||
env = _babase.pre_env()
|
||||
|
||||
# Give a soft warning if we're being used with a different binary
|
||||
|
||||
@ -52,7 +52,7 @@ if TYPE_CHECKING:
|
||||
|
||||
# Build number and version of the ballistica binary we expect to be
|
||||
# using.
|
||||
TARGET_BALLISTICA_BUILD = 21409
|
||||
TARGET_BALLISTICA_BUILD = 21410
|
||||
TARGET_BALLISTICA_VERSION = '1.7.28'
|
||||
|
||||
|
||||
|
||||
@ -561,7 +561,8 @@ void AppAdapterSDL::SetScreen_(
|
||||
// thread where we read it, but let's be pedantic and keep everything to
|
||||
// the main thread.
|
||||
max_fps_ = max_fps;
|
||||
// Allow -1 to mean no max.
|
||||
|
||||
// Take -1 to mean no max. Otherwise clamp to a reasonable range.
|
||||
if (max_fps_ != -1) {
|
||||
max_fps_ = std::max(10, max_fps_);
|
||||
max_fps_ = std::min(99999, max_fps_);
|
||||
|
||||
@ -22,7 +22,7 @@ void NetworkReader::SetPort(int port) {
|
||||
return;
|
||||
}
|
||||
port4_ = port6_ = port;
|
||||
thread_ = new std::thread(RunThreadStatic, this);
|
||||
thread_ = new std::thread(RunThreadStatic_, this);
|
||||
}
|
||||
|
||||
void NetworkReader::OnAppPause() {
|
||||
@ -36,7 +36,7 @@ void NetworkReader::OnAppPause() {
|
||||
// Ok now attempt to send a quick ping to ourself to wake us up so we can kill
|
||||
// our socket.
|
||||
if (port4_ != -1) {
|
||||
PokeSelf();
|
||||
PokeSelf_();
|
||||
} else {
|
||||
Log(LogLevel::kError, "NetworkReader port is -1 on pause");
|
||||
}
|
||||
@ -55,7 +55,7 @@ void NetworkReader::OnAppResume() {
|
||||
paused_cv_.notify_all();
|
||||
}
|
||||
|
||||
void NetworkReader::PokeSelf() {
|
||||
void NetworkReader::PokeSelf_() {
|
||||
int sd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (sd < 0) {
|
||||
Log(LogLevel::kError, "Unable to create sleep ping socket; errno "
|
||||
@ -88,7 +88,7 @@ void NetworkReader::PokeSelf() {
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkReader::DoPoll(bool* can_read_4, bool* can_read_6) {
|
||||
void NetworkReader::DoPoll_(bool* can_read_4, bool* can_read_6) {
|
||||
struct pollfd fds[2]{};
|
||||
int i{};
|
||||
int index_4{-1};
|
||||
@ -124,7 +124,7 @@ void NetworkReader::DoPoll(bool* can_read_4, bool* can_read_6) {
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkReader::DoSelect(bool* can_read_4, bool* can_read_6) {
|
||||
void NetworkReader::DoSelect_(bool* can_read_4, bool* can_read_6) {
|
||||
fd_set readset;
|
||||
FD_ZERO(&readset);
|
||||
|
||||
@ -173,7 +173,9 @@ void NetworkReader::DoSelect(bool* can_read_4, bool* can_read_6) {
|
||||
}
|
||||
}
|
||||
|
||||
auto NetworkReader::RunThread() -> int {
|
||||
auto NetworkReader::RunThread_() -> int {
|
||||
g_core->platform->SetCurrentThreadName("ballistica network-read");
|
||||
|
||||
if (!g_core->HeadlessMode()) {
|
||||
remote_server_ = std::make_unique<RemoteAppServer>();
|
||||
}
|
||||
@ -186,7 +188,7 @@ auto NetworkReader::RunThread() -> int {
|
||||
paused_cv_.wait(lock, [this] { return (!paused_); });
|
||||
}
|
||||
|
||||
OpenSockets();
|
||||
OpenSockets_();
|
||||
|
||||
// Now just listen and forward messages along.
|
||||
char buffer[10000];
|
||||
@ -203,9 +205,9 @@ auto NetworkReader::RunThread() -> int {
|
||||
// limit size of ~1000 or whatnot. So switching to poll() instead which
|
||||
// sounds like it
|
||||
if (explicit_bool(true)) {
|
||||
DoPoll(&can_read_4, &can_read_6);
|
||||
DoPoll_(&can_read_4, &can_read_6);
|
||||
} else {
|
||||
DoSelect(&can_read_4, &can_read_6);
|
||||
DoSelect_(&can_read_4, &can_read_6);
|
||||
}
|
||||
|
||||
for (int s_index : {0, 1}) {
|
||||
@ -344,7 +346,7 @@ auto NetworkReader::RunThread() -> int {
|
||||
// connections.. pass them to the logic thread to wrangle.
|
||||
std::vector<uint8_t> msg_buffer(rresult2);
|
||||
memcpy(msg_buffer.data(), buffer, rresult2);
|
||||
PushIncomingUDPPacketCall(msg_buffer, SockAddr(from));
|
||||
PushIncomingUDPPacketCall_(msg_buffer, SockAddr(from));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -372,8 +374,8 @@ auto NetworkReader::RunThread() -> int {
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkReader::PushIncomingUDPPacketCall(const std::vector<uint8_t>& data,
|
||||
const SockAddr& addr) {
|
||||
void NetworkReader::PushIncomingUDPPacketCall_(const std::vector<uint8_t>& data,
|
||||
const SockAddr& addr) {
|
||||
// Avoid buffer-full errors if something is causing us to write too often;
|
||||
// these are unreliable messages so its ok to just drop them.
|
||||
if (!g_base->logic->event_loop()->CheckPushSafety()) {
|
||||
@ -389,7 +391,7 @@ void NetworkReader::PushIncomingUDPPacketCall(const std::vector<uint8_t>& data,
|
||||
});
|
||||
}
|
||||
|
||||
void NetworkReader::OpenSockets() {
|
||||
void NetworkReader::OpenSockets_() {
|
||||
// This needs to be locked during any socket-descriptor changes/writes.
|
||||
std::scoped_lock lock(sd_mutex_);
|
||||
|
||||
|
||||
@ -33,32 +33,31 @@ class NetworkReader {
|
||||
auto sd6() const { return sd6_; }
|
||||
|
||||
private:
|
||||
void DoSelect(bool* can_read_4, bool* can_read_6);
|
||||
void DoPoll(bool* can_read_4, bool* can_read_6);
|
||||
void OpenSockets();
|
||||
void PokeSelf();
|
||||
auto RunThread() -> int;
|
||||
void PushIncomingUDPPacketCall(const std::vector<uint8_t>& data,
|
||||
const SockAddr& addr);
|
||||
static auto RunThreadStatic(void* self) -> int {
|
||||
return static_cast<NetworkReader*>(self)->RunThread();
|
||||
void DoSelect_(bool* can_read_4, bool* can_read_6);
|
||||
void DoPoll_(bool* can_read_4, bool* can_read_6);
|
||||
void OpenSockets_();
|
||||
void PokeSelf_();
|
||||
auto RunThread_() -> int;
|
||||
void PushIncomingUDPPacketCall_(const std::vector<uint8_t>& data,
|
||||
const SockAddr& addr);
|
||||
static auto RunThreadStatic_(void* self) -> int {
|
||||
return static_cast<NetworkReader*>(self)->RunThread_();
|
||||
}
|
||||
std::unique_ptr<RemoteAppServer> remote_server_;
|
||||
int sd4_{-1};
|
||||
int sd6_{-1};
|
||||
std::mutex sd_mutex_;
|
||||
|
||||
// This needs to be locked while modifying or writing to either the ipv4 or
|
||||
// ipv6 socket. The one exception is when the network-reader thread is reading
|
||||
// from them, since there is no chance of anyone else reading or modifying
|
||||
// them. (that is all handled by the net-reader thread).
|
||||
// This needs to be locked while modifying or writing to either the ipv4
|
||||
// or ipv6 socket. The one exception is when the network-reader thread is
|
||||
// reading from them, since there is no chance of anyone else reading or
|
||||
// modifying them. (that is all handled by the net-reader thread).
|
||||
std::mutex sd_mutex_;
|
||||
int port4_{-1};
|
||||
int port6_{-1};
|
||||
std::thread* thread_{};
|
||||
int sd4_{-1};
|
||||
int sd6_{-1};
|
||||
bool paused_{};
|
||||
std::thread* thread_{};
|
||||
std::mutex paused_mutex_;
|
||||
std::condition_variable paused_cv_;
|
||||
bool passed_fd_threshold_{};
|
||||
std::unique_ptr<RemoteAppServer> remote_server_;
|
||||
};
|
||||
|
||||
} // namespace ballistica::base
|
||||
|
||||
@ -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 = 21409;
|
||||
const int kEngineBuildNumber = 21410;
|
||||
const char* kEngineVersion = "1.7.28";
|
||||
const int kEngineApiVersion = 8;
|
||||
|
||||
|
||||
@ -371,7 +371,7 @@ void EventLoop::BootstrapThread_() {
|
||||
break;
|
||||
case EventLoopID::kNetworkWrite:
|
||||
name = "networkwrite";
|
||||
id_string = "ballistica network writing";
|
||||
id_string = "ballistica network-write";
|
||||
break;
|
||||
default:
|
||||
throw Exception();
|
||||
|
||||
@ -302,6 +302,10 @@ class LogHandler(logging.Handler):
|
||||
return all(cls._is_immutable_log_data(x) for x in data)
|
||||
return False
|
||||
|
||||
def call_in_thread(self, call: Callable[[], Any]) -> None:
|
||||
"""Submit a call to be run in the logging background thread."""
|
||||
self._event_loop.call_soon_threadsafe(call)
|
||||
|
||||
def emit(self, record: logging.LogRecord) -> None:
|
||||
# pylint: disable=too-many-branches
|
||||
if __debug__:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user