cloud console now fully operational

This commit is contained in:
Eric 2022-09-15 20:02:46 -07:00
parent fdeb180e9d
commit b0f0cc63f5
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
12 changed files with 145 additions and 82 deletions

View File

@ -3995,50 +3995,50 @@
"assets/src/ba_data/python/ba/_generated/__init__.py": "https://files.ballistica.net/cache/ba1/ee/e8/cad05aa531c7faf7ff7b96db7f6e",
"assets/src/ba_data/python/ba/_generated/enums.py": "https://files.ballistica.net/cache/ba1/b2/e5/0ee0561e16257a32830645239f34",
"ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/89/c0/e32c7d2a35dc9aef57cc73b0911a",
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/f3/e1/0ee9ade5e9943dc4749aa4cc2182",
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/32/4e/a7c1b096c62864641a59e65e7778",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/6a/f4/8b86611cbaa7237c8a52e8fe6428",
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/13/f5/fa3c97269613316994f0c2134860",
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/f8/7a/87877003ee3a13ff7cbbf1ec76a2",
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/81/0c/708a16fff55ee37338b2d87f7620",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/4a/91/89523b8f155261e0045a6bb6e277",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a9/04/da76c8e848852fef1e58577f59e3",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/dd/ac/33aed9cc1396ccba2111dfed02f6",
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/1a/5a/0f1e671137a2ec60c2df8e95e078",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/92/50/ec5fbb3f8b9f4a60934f2dacf180",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/7c/77/a430bf182d5210792716b6dbd8ee",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/ef/6b/de6c811fa70bf4d5d1cdfe49eaae",
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/92/e0/b9b1053231d7323d185298f8caaa",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/08/ef/c70efcd89a666758437f0736d956",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/9d/94/1f0d32c943b64ff558f28ad89653",
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/a6/fb/a6e6a78d7b04d547c9c716ff0a8e",
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/5a/b0/d0e087fcdf1756a0b9b5bf805f10",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/34/fb/e6c9fb0e20af0ba3376ca2abba29",
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/b1/8b/5ba626c39ef586f3ba4bfd508181",
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d5/f6/d62e6e6d5e7fe1945f08ccbb9a8f",
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/02/c5/44d0082442b06153a7d7dce4c8ce",
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d0/00/61378fb26ddcbf023fd3c40e4ffb",
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/0a/e2/a01a2de0835fee06fd7b357c700f",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7a/dd/8a8f84d8ed28fec12137f632e9f7",
"build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/6d/b1/34d06bce1b93bcefc4896bd2700a",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/63/61/f48cc804658071c759398f9c00dd",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a2/b7/a28b8ed7c1f13b53dea1c878c5fc",
"build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a5/b2/f29c2fe15f33441de94331743353",
"build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c2/63/bf93d39adb82748decfdb980b562",
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/00/6d/ac55bffd774cf75c5944b679194a",
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7b/dd/af154cabc6779257a38ea6c9e833",
"build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/54/88/2de2dfa2c0c0a1766fa0d5f26ed6",
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ff/26/da4a58abecf5d9275477eaec0c17",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/62/5d/8658a206b8c9b741be2422162784",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/fc/57/d59920e098d23a2d150c899cde29",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/39/a1/bce547622da143fcf9ea970cd3ab",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/d6/f3/8ca052a667342e316fa09655bc51",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/e0/b4/99c403ccbfd0c4b9b071e656d480",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/11/a0/e06103dae63a4648850bd089aacb",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/77/17/99eba0c7d42a9452306f7927ae4e",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/92/da/2faf9031e7c5ba5a99dd9e0c609d",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/64/2a/1b30ee7b4e8238ec2ea16bcacdeb",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/41/92/35b689da32ee45a4e7483feae8f8",
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/be/84/d4a9f2698852d47204eaf7f989f9",
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/9d/07/10910a8e3de0506be787ef3ecc48",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/8d/f7/74d2f4c962b7797e05e15241deac",
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ea/34/0929f2c03752ac2a4a08a09941ce",
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/ea/28/a19ef25c15ee6befb9ed2bac5ebc",
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/38/ad/c3b76ff4f8ca715c394b3a96a68e",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/f6/8a/98649959fb2bed45dcdc31e841f1",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/44/97/9d70590ffcde8df0f2f45f0d649a",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/e2/38/12cf8e7010aa0f4217b0da33786a",
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/c0/a4/c4d1a04cd841065bf2c7a6e8328a",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/22/f3/613572189769a6d22e00f28125ae",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ae/e1/c81f46c7b2933a4caa4e028de174",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/90/f7/c2f34b478a63e4d6a48804fec09e",
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/7d/e5/df47bf427dcb312a85359e4aa15a",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/49/7d/1a911685c12684b0bb44d85d91b5",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/49/12/cb7f8ab099507df99d36447bb091",
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/72/de/79b34ded132e59aa48f2c1badd3f",
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/3e/91/085afe517b6e54087a746e980cab",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/f8/1b/996fb6d29251b1dd4f72da7d3cdf",
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/ea/f6/b68573135f10e1c22b60b4b924b7",
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f2/f2/5d17e1c169a07365442920c41d5b",
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b4/c3/d87cbbb96ae6b8d04c2e47575493",
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9c/b1/63bb857c299b7df59bf8c7a839b3",
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e5/55/152d7f63e1c7fa017fdbaf6cd01b",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7c/42/25dd5f85ac0766821786b56356dd",
"build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4b/3d/cbeddd984dd7bbf651489eaf73d4",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/90/6a/93e4582a5fccca73245a6339c876",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/38/91/32d4dd319c6de2e1202160be1cdb",
"build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/93/65/8de22b09531bbd52f3c248dcf479",
"build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c0/c7/18c3deef4709d9e6dc7c02b8e957",
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/dd/75/443cea54dd7011aded225197675e",
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c2/ed/8683ec69a8b55c056808474388d4",
"build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/0d/ad/107f9828c8b195ab08a0a777d1b9",
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/49/c3/4dd10b0ac3c1ce9cd3c565e62e4f",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2f/e6/cf0b3c061fe0428f11f19ab71cd3",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c5/63/af3ae0a72c0802afaa3fd20bc72d",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/43/bb/33be7bb757f0419a626c72a2aca5",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/35/28/94b54429a9f282007dcba702684b",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/cf/89/8d35a30a72386d6753dd5a9568cb",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/d9/1f/0924eea724878da3d60fda65a73f",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/1f/e4/2dd5f92598580490a86b1dd36443",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/ba/12/35d07a2bda668aec5d99813e1f67",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/a5/b0/f014e1bc0a352fe9402d4c879a04",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/63/ed/9565716b18e47dbb13752e68e068",
"src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/c0/32/b7907e3859a5c5013a3d97b6b523",
"src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/2d/4f/f4fe67827f36cd59cd5193333a02",
"src/ballistica/generated/python_embedded/bootstrap_monolithic.inc": "https://files.ballistica.net/cache/ba1/ef/c1/aa5f1aa10af89f5c0b1e616355fd"

View File

@ -1,4 +1,4 @@
### 1.7.7 (build 20857, api 7, 2022-09-15)
### 1.7.7 (build 20858, api 7, 2022-09-15)
- Added `ba.app.meta.load_exported_classes()` for loading classes discovered by the meta subsystem cleanly in a background thread.
- Improved logging of missing playlist game types.
- Some ba.Lstr functionality can now be used in background threads.
@ -35,8 +35,8 @@
- Added `_ba.display_log()` function which ships a log message to the in-game terminal and platform-specific places like the Android log. The engine wires up standard Python logging output to go through this.
- Added `_ba.v1_cloud_log()` which ships a message to the old v1-cloud-log (the log which is gathered and sent to the v1 master server to help me identify problems people are seeing). This is presently wired up to a subset of Python logging output to approximate how it used to work.
- Note: Previously in the C++ layer some code would mix Python print calls (such as PyErr_PrintEx()) with ballistica::Log() calls. Previously these all wound up going to the same place (Python's sys.stderr) so it worked, but now they no longer do and so this sort of mixing should be avoided. So if you see a weird combination of colored log output lines with non-colored lines that seem to go together, please holler as it means something needs to be fixed.
- Builds for Apple devices now set a thread stack size of 1MB. The default there is 512k and I was seeing some stack overflows for heavy Physics sims or very recursive Python stuff.
- If you want to grab recent logs, you can now use `ba.app.log_handler.get_cached()` This will give you everything that has gone through Python logging, Python stdout/stderr, and the C++ Log() call (up to the max cache size that is).
- Builds for Apple devices now explicitly set a thread stack size of 1MB. The default there is 512k and I was seeing some stack overflows for heavy physics sims or very recursive Python stuff.
- If you want to grab recent logs, you can now use `ba.app.log_handler.get_cached()`. This will give you everything that has gone through Python logging, Python stdout/stderr, and the C++ Log() call (up to the max cache size that is).
### 1.7.6 (build 20687, api 7, 2022-08-11)

View File

@ -1 +1 @@
41453813326605937968225345803585801012
202727985408399627040353071391998113840

View File

@ -1131,6 +1131,11 @@ def android_show_wifi_settings() -> None:
return None
def app_instance_uuid() -> str:
"""(internal)"""
return str()
def apply_config() -> None:
"""(internal)"""
return None
@ -2388,7 +2393,8 @@ def printobjects() -> None:
def pushcall(call: Callable,
from_other_thread: bool = False,
suppress_other_thread_warning: bool = False) -> None:
suppress_other_thread_warning: bool = False,
other_thread_use_fg_context: bool = False) -> None:
"""Pushes a call onto the event loop to be run during the next cycle.
Category: **General Utility Functions**
@ -2401,7 +2407,9 @@ def pushcall(call: Callable,
If you want to push a call from outside of the logic thread,
however, you can pass 'from_other_thread' as True. In this case
the call will always run in the UI context on the logic thread.
the call will always run in the UI context on the logic thread
or whichever context is in the foreground if
other_thread_use_fg_context is True.
"""
return None
@ -2972,6 +2980,11 @@ def unlock_all_input() -> None:
return None
def user_ran_commands() -> None:
"""(internal)"""
return None
def v1_cloud_log(message: str) -> None:
"""(internal)

View File

@ -44,7 +44,7 @@ def bootstrap() -> None:
# Give a soft warning if we're being used with a different binary
# version than we expect.
expected_build = 20857
expected_build = 20858
running_build: int = env['build_number']
if running_build != expected_build:
print(

View File

@ -368,16 +368,19 @@ void AppFlavor::OnAppStart() {
assert(g_input);
// If we're running in a terminal, print some info.
if (g_platform->is_stdin_a_terminal()) {
// if (g_platform->is_stdin_a_terminal()) {
{
char buffer[256];
if (g_buildconfig.headless_build()) {
printf("BallisticaCore Headless %s build %d.\n", kAppVersion,
kAppBuildNumber);
fflush(stdout);
snprintf(buffer, sizeof(buffer), "BallisticaCore Headless %s build %d.",
kAppVersion, kAppBuildNumber);
} else {
printf("BallisticaCore %s build %d.\n", kAppVersion, kAppBuildNumber);
fflush(stdout);
snprintf(buffer, sizeof(buffer), "BallisticaCore %s build %d.",
kAppVersion, kAppBuildNumber);
}
Log(LogLevel::kInfo, buffer);
}
// }
// If we've got a nice themed hardware cursor, show it.
// Otherwise, hide the hardware cursor; we'll draw it in software.

View File

@ -32,7 +32,7 @@
namespace ballistica {
// These are set automatically via script; don't modify them here.
const int kAppBuildNumber = 20857;
const int kAppBuildNumber = 20858;
const char* kAppVersion = "1.7.7";
// Our standalone globals.
@ -252,32 +252,35 @@ auto FatalError(const std::string& message) -> void {
BA_PRECONDITION(handled);
}
// FIXME: move this to g_app or whatnot.
auto GetAppInstanceUUID() -> const std::string& {
static std::string session_id;
static bool have_session_id = false;
static std::string app_instance_uuid;
static bool have_app_instance_uuid = false;
if (!have_session_id) {
if (!have_app_instance_uuid) {
if (g_python) {
Python::ScopedInterpreterLock gil;
auto uuid = g_python->obj(Python::ObjID::kUUIDStrCall).Call();
if (uuid.exists()) {
session_id = uuid.ValueAsString().c_str();
have_session_id = true;
app_instance_uuid = uuid.ValueAsString().c_str();
have_app_instance_uuid = true;
}
}
if (!have_session_id) {
if (!have_app_instance_uuid) {
// As an emergency fallback simply use a single random number.
// We should probably simply disallow this before Python is up.
Log(LogLevel::kWarning, "GetSessionUUID() using rand fallback.");
srand(static_cast<unsigned int>(
Platform::GetCurrentMilliseconds())); // NOLINT
session_id = std::to_string(static_cast<uint32_t>(rand())); // NOLINT
have_session_id = true;
Platform::GetCurrentMilliseconds())); // NOLINT
app_instance_uuid =
std::to_string(static_cast<uint32_t>(rand())); // NOLINT
have_app_instance_uuid = true;
}
if (session_id.size() >= 100) {
if (app_instance_uuid.size() >= 100) {
Log(LogLevel::kWarning, "session id longer than it should be.");
}
}
return session_id;
return app_instance_uuid;
}
auto InMainThread() -> bool {

View File

@ -913,7 +913,7 @@ void Logic::PushInGameConsoleScriptCommand(const std::string& command) {
thread()->PushCall([this, command] {
// These are always run in whichever context is 'visible'.
ScopedSetContext cp(GetForegroundContext());
PythonCommand cmd(command, "<in-game-console>");
PythonCommand cmd(command, "<console>");
if (!g_app->user_ran_commands) {
g_app->user_ran_commands = true;
}
@ -1046,13 +1046,13 @@ void Logic::PushPythonWeakCallArgs(
});
}
void Logic::PushPythonRawCallable(PyObject* callable) {
thread()->PushCall([this, callable] {
void Logic::PushPythonRawCallable(PyObject* callable, bool fg_context) {
thread()->PushCall([this, callable, fg_context] {
assert(InLogicThread());
// Lets run this in the UI context.
// (can add other options if we need later)
ScopedSetContext cp(GetUIContext());
ScopedSetContext cp(fg_context ? GetForegroundContext() : GetUIContext());
// This event contains a raw python obj with an incremented ref-count.
auto call(Object::New<PythonContextCall>(callable));

View File

@ -85,7 +85,8 @@ class Logic {
// Push a raw Python call, decrements its refcount after running.
// Can be pushed from any thread.
auto PushPythonRawCallable(PyObject* callable) -> void;
auto PushPythonRawCallable(PyObject* callable, bool fg_context = false)
-> void;
auto PushScreenMessage(const std::string& message, const Vector3f& color)
-> void;
auto RemovePlayer(Player* player) -> void;

View File

@ -128,7 +128,7 @@ static auto HandleGameQuery(const char* buffer, size_t size,
memcpy(&query_id, buffer + 1, 4);
// Ship them a response packet containing the query id,
// our protocol version, our unique-session-id, and our
// our protocol version, our unique-app-instance-id, and our
// player_spec.
char msg[400];

View File

@ -543,7 +543,7 @@ static void HandleArgs(int argc, char** argv) {
// If there's just one arg and it's "--version", return the version.
if (argc == 2 && !strcmp(argv[1], "--version")) {
printf("Ballistica %s build %d\n", kAppVersion, kAppBuildNumber);
printf("BallisticaCore %s build %d\n", kAppVersion, kAppBuildNumber);
fflush(stdout);
exit(0);
}

View File

@ -145,6 +145,31 @@ auto PyIsInReplay(PyObject* self, PyObject* args, PyObject* keywds)
BA_PYTHON_CATCH;
}
auto PyAppInstanceUUID(PyObject* self, PyObject* args, PyObject* keywds)
-> PyObject* {
BA_PYTHON_TRY;
static const char* kwlist[] = {nullptr};
if (!PyArg_ParseTupleAndKeywords(args, keywds, "",
const_cast<char**>(kwlist))) {
return nullptr;
}
return PyUnicode_FromString(GetAppInstanceUUID().c_str());
BA_PYTHON_CATCH;
}
auto PyUserRanCommands(PyObject* self, PyObject* args, PyObject* keywds)
-> PyObject* {
BA_PYTHON_TRY;
static const char* kwlist[] = {nullptr};
if (!PyArg_ParseTupleAndKeywords(args, keywds, "",
const_cast<char**>(kwlist))) {
return nullptr;
}
g_app->user_ran_commands = true;
Py_RETURN_NONE;
BA_PYTHON_CATCH;
}
auto PyRegisterSession(PyObject* self, PyObject* args, PyObject* keywds)
-> PyObject* {
BA_PYTHON_TRY;
@ -282,11 +307,14 @@ auto PyPushCall(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* {
PyObject* call_obj;
int from_other_thread{};
int suppress_warning{};
int other_thread_use_fg_context{};
static const char* kwlist[] = {"call", "from_other_thread",
"suppress_other_thread_warning", nullptr};
if (!PyArg_ParseTupleAndKeywords(args, keywds, "O|ip",
"suppress_other_thread_warning",
"other_thread_use_fg_context", nullptr};
if (!PyArg_ParseTupleAndKeywords(args, keywds, "O|ppp",
const_cast<char**>(kwlist), &call_obj,
&from_other_thread, &suppress_warning)) {
&from_other_thread, &suppress_warning,
&other_thread_use_fg_context)) {
return nullptr;
}
@ -303,7 +331,7 @@ auto PyPushCall(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* {
// just increment the python object's refcount and pass it along raw;
// the logic thread decrements it on the other end.
Py_INCREF(call_obj);
g_logic->PushPythonRawCallable(call_obj);
g_logic->PushPythonRawCallable(call_obj, other_thread_use_fg_context);
} else {
if (!InLogicThread()) {
throw Exception("You must use from_other_thread mode.");
@ -1103,7 +1131,8 @@ auto PythonMethodsApp::GetMethods() -> std::vector<PyMethodDef> {
{"pushcall", (PyCFunction)PyPushCall, METH_VARARGS | METH_KEYWORDS,
"pushcall(call: Callable, from_other_thread: bool = False,\n"
" suppress_other_thread_warning: bool = False ) -> None\n"
" suppress_other_thread_warning: bool = False,\n"
" other_thread_use_fg_context: bool = False) -> None\n"
"\n"
"Pushes a call onto the event loop to be run during the next cycle.\n"
"\n"
@ -1118,7 +1147,9 @@ auto PythonMethodsApp::GetMethods() -> std::vector<PyMethodDef> {
"\n"
"If you want to push a call from outside of the logic thread,\n"
"however, you can pass 'from_other_thread' as True. In this case\n"
"the call will always run in the UI context on the logic thread."},
"the call will always run in the UI context on the logic thread\n"
"or whichever context is in the foreground if\n"
"other_thread_use_fg_context is True."},
{"getactivity", (PyCFunction)PyGetActivity,
METH_VARARGS | METH_KEYWORDS,
@ -1175,6 +1206,18 @@ auto PythonMethodsApp::GetMethods() -> std::vector<PyMethodDef> {
"\n"
"(internal)"},
{"app_instance_uuid", (PyCFunction)PyAppInstanceUUID,
METH_VARARGS | METH_KEYWORDS,
"app_instance_uuid() -> str\n"
"\n"
"(internal)"},
{"user_ran_commands", (PyCFunction)PyUserRanCommands,
METH_VARARGS | METH_KEYWORDS,
"user_ran_commands() -> None\n"
"\n"
"(internal)"},
{"new_replay_session", (PyCFunction)PyNewReplaySession,
METH_VARARGS | METH_KEYWORDS,
"new_replay_session(file_name: str) -> None\n"