Connecting to a party via exec arg now works

This commit is contained in:
Eric Froemling 2021-03-03 16:00:08 -06:00
parent c91a07bd6b
commit 8007f7de42
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
21 changed files with 96 additions and 93 deletions

View File

@ -3932,26 +3932,26 @@
"assets/build/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/b5/85/f8b6d0558ddb87267f34254b1450", "assets/build/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/b5/85/f8b6d0558ddb87267f34254b1450",
"assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e", "assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e",
"assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f", "assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f",
"build/prefab/full/linux_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/46/ad/ce8ca86415841e139569bb3c1f8f", "build/prefab/full/linux_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/bd/13/4b8f2b347863747aeaab5d19ffbe",
"build/prefab/full/linux_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/7e/cd/849c232cd841cfcba662d9684e3c", "build/prefab/full/linux_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/20/00/4f13a3cf0cafd8f60a90008ce605",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b9/1c/6e85525c5de9bca9685a7c1d26e9", "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/4d/ae/c8e188c091474324e580ec94f4e0",
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/f8/d3/97dd8a8200380f589a705e720055", "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c0/e8/e9915433922b616281694b3c903d",
"build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/c2/76/cb60618d327e7e7536d00461b886", "build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/6c/52/090604f97715740cfff85f4c3f48",
"build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/fc/fa/fcca1e02ff3a47785abcf46f37f2", "build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/1e/e9/9de31a86255b65d7d89a02c257b4",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/fc/79/9c289328cf04042c28f449690cc3", "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/da/ce/a2db4cee1c1858143214c03d3a2c",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/32/f9/4e443b5e25cd319a386a7223d7ac", "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/17/70/b0b4a3853c5182121325de58e224",
"build/prefab/full/mac_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/14/aa/7de00108edbe74a83191feffd9f6", "build/prefab/full/mac_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/e4/42/aa2626b27e0c393b50ae57406bb2",
"build/prefab/full/mac_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/21/d2/655075853f455ee7f3640604635a", "build/prefab/full/mac_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/d7/dd/4b7fb2832972f49b01101aac0ca2",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2a/63/20338b8263c013cd095f9c42315b", "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d0/80/5a44a3728b56aafe499081d863b2",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/20/b9/50a276c94c32c122aa5d4e6fa2ac", "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/91/13/a46a521e933e4d8dc43f4997e238",
"build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/3e/e5/6383ca046609f0d5349243333474", "build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/88/e9/3c26f08c41f7c74db6e6495159ee",
"build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/23/1c/b85c95ea38daca6c780ca6735756", "build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/6f/42/49707eb374d25778fe9813963bcd",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/5f/53/fb376ece15f95659bfdfec34363a", "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/25/45/2de5c321525af7c3f152b11f1884",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/13/ae/353a1773ee4da017a9e3f9ca3684", "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ef/c1/94aab0266746ffb01fdc1cd47a08",
"build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/e5/d6/78ea684cc9a71e4546ec0349784c", "build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/b3/1d/a1d6998e968d27e7eecdf2526eb1",
"build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/dd/56/6106a0adf4002d69d3be14846d2b", "build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/34/47/9378839338629fe8e322a9ddb860",
"build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/fd/d3/e72d3b3e217bd3fd329106e88c2c", "build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/e0/dc/0bd676886c0a5391366edfad4bd4",
"build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/0e/b3/f440e97dab1b4ec890c0b8c91453", "build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/5d/5f/020bb8c78559871f9924042894ff",
"build/prefab/lib/linux_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4c/bf/393694ea67f3d590dd2706c9955e", "build/prefab/lib/linux_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4c/bf/393694ea67f3d590dd2706c9955e",
"build/prefab/lib/linux_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/78/cb/bb9ae4f896f862074057c8e36e1d", "build/prefab/lib/linux_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/78/cb/bb9ae4f896f862074057c8e36e1d",
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ae/bd/39d7b885f7f01e81d0e96f0f85ce", "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ae/bd/39d7b885f7f01e81d0e96f0f85ce",
@ -3960,12 +3960,12 @@
"build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/52/d9/563a6949d2c4db5a915c54460fbc", "build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/52/d9/563a6949d2c4db5a915c54460fbc",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d0/6a/42fe8d2e34f95e1b3282e8422344", "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d0/6a/42fe8d2e34f95e1b3282e8422344",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/50/cf/bad44b07a4022aee3001002086b5", "build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/50/cf/bad44b07a4022aee3001002086b5",
"build/prefab/lib/mac_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d1/d6/699843b13518be29ea1a370dc7b2", "build/prefab/lib/mac_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8e/d8/b00361f54ae023feb88cbf0ef78c",
"build/prefab/lib/mac_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/0c/88/bb8f8cc3b426b3ba9a15ed3697de", "build/prefab/lib/mac_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/42/68/fa75c5f75e97ae5214679c75bbc0",
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/3b/bf/31fcadf412a0ecf92e8cdc61a01a", "build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/62/b9/2e9fca8ae23035741fadd143a932",
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f5/4c/5f5c9d5a5e1985371a0f8f0e5aa6", "build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/eb/b1/4a527ce50b6d52e7970efb149fbb",
"build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/5f/75/b2490bcee215d922c7b250ea5bda", "build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/11/cf/3e89a9502fdec55eb218ecad26a2",
"build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c9/38/7695ffdddb2eba1f1d800c84dc04", "build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8a/80/2db47e59931fd4e663d4a62c0b5e",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/73/ab/6333cfc10a127265eb0f0c3fe4b1", "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f0/04/ba4cd87f743c35f3db8649a62ede",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/09/95/dd9f50fbc4eb499018713f3e32da" "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/fc/4d/a37663dbf38601f3daf924065747"
} }

View File

@ -12,6 +12,7 @@
- Server-wrapper improvements allowing config path and ba_root path to be passed explicitly. - Server-wrapper improvements allowing config path and ba_root path to be passed explicitly.
- Binary -cfgdir option now properly allows any path, not just './ba_root'. - Binary -cfgdir option now properly allows any path, not just './ba_root'.
- Additional server-wrapper options such as disabling auto-restart and automatic restarts on config file changes. - Additional server-wrapper options such as disabling auto-restart and automatic restarts on config file changes.
- Running a `_ba.connect_to_party` command via the -exec arg should now do the right thing.
### 1.5.29 (20246) ### 1.5.29 (20246)
- Exposed ba method/class initing in public C++ layer. - Exposed ba method/class initing in public C++ layer.

View File

@ -1,5 +1,5 @@
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND --> <!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
<h4><em>last updated on 2021-02-27 for Ballistica version 1.6.0 build 20312</em></h4> <h4><em>last updated on 2021-03-03 for Ballistica version 1.6.0 build 20319</em></h4>
<p>This page documents the Python classes and functions in the 'ba' module, <p>This page documents the Python classes and functions in the 'ba' module,
which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p> which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p>
<hr> <hr>

View File

@ -108,6 +108,7 @@ void App::PushShutdownCompleteCall() {
} }
void App::ShutdownComplete() { void App::ShutdownComplete() {
assert(InMainThread());
assert(g_platform); assert(g_platform);
// Need to call our cleanup stuff that would otherwise get called in main. // Need to call our cleanup stuff that would otherwise get called in main.

View File

@ -56,7 +56,7 @@ class AppGlobals {
UIScale ui_scale{UIScale::kLarge}; UIScale ui_scale{UIScale::kLarge};
AccountType account_type{AccountType::kInvalid}; AccountType account_type{AccountType::kInvalid};
bool remote_server_accepting_connections{true}; bool remote_server_accepting_connections{true};
std::string game_commands; std::string exec_command;
std::string user_agent_string{"BA_USER_AGENT_UNSET (" BA_PLATFORM_STRING ")"}; std::string user_agent_string{"BA_USER_AGENT_UNSET (" BA_PLATFORM_STRING ")"};
int return_value{}; int return_value{};
bool is_stdin_a_terminal{true}; bool is_stdin_a_terminal{true};

View File

@ -21,7 +21,7 @@
namespace ballistica { namespace ballistica {
// These are set automatically via script; don't change here. // These are set automatically via script; don't change here.
const int kAppBuildNumber = 20319; const int kAppBuildNumber = 20321;
const char* kAppVersion = "1.6.0"; const char* kAppVersion = "1.6.0";
// Our standalone globals. // Our standalone globals.
@ -87,7 +87,6 @@ auto BallisticaMain(int argc, char** argv) -> int {
g_app_globals = new AppGlobals(argc, argv); g_app_globals = new AppGlobals(argc, argv);
g_app_internal = CreateAppInternal(); g_app_internal = CreateAppInternal();
g_platform = Platform::Create(); g_platform = Platform::Create();
g_platform->PostInit();
g_account = new Account(); g_account = new Account();
g_utils = new Utils(); g_utils = new Utils();
Scene::Init(); Scene::Init();
@ -126,15 +125,15 @@ auto BallisticaMain(int argc, char** argv) -> int {
// Phase 2: Set things in motion. // Phase 2: Set things in motion.
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Ok; now that we're bootstrapped, tell the game thread to read and apply
// the config which should kick off the real action.
g_game->PushApplyConfigCall();
// Let the app and platform do whatever else it wants here such as adding // Let the app and platform do whatever else it wants here such as adding
// initial input devices/etc. // initial input devices/etc.
g_app->OnBootstrapComplete(); g_app->OnBootstrapComplete();
g_platform->OnBootstrapComplete(); g_platform->OnBootstrapComplete();
// Ok; now that we're bootstrapped, tell the game thread to read and apply
// the config which should kick off the real action.
g_game->PushApplyConfigCall();
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Phase 3/4: Create a screen and/or kick off game (in other threads). // Phase 3/4: Create a screen and/or kick off game (in other threads).
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@ -258,7 +257,7 @@ auto InNetworkWriteThread() -> bool {
&& g_network_write_module->thread()->IsCurrent()); && g_network_write_module->thread()->IsCurrent());
} }
auto GetInterfaceType() -> UIScale { return g_app_globals->ui_scale; } auto GetUIScale() -> UIScale { return g_app_globals->ui_scale; }
void Log(const std::string& msg, bool to_stdout, bool to_server) { void Log(const std::string& msg, bool to_stdout, bool to_server) {
Logging::Log(msg, to_stdout, to_server); Logging::Log(msg, to_stdout, to_server);

View File

@ -220,7 +220,7 @@ auto GetCurrentThreadName() -> std::string;
auto Log(const std::string& msg, bool to_stdout = true, bool to_server = true) auto Log(const std::string& msg, bool to_stdout = true, bool to_server = true)
-> void; -> void;
auto GetInterfaceType() -> UIScale; auto GetUIScale() -> UIScale;
/// Return true if stdin seems to be coming from a terminal /// Return true if stdin seems to be coming from a terminal
/// (so we know to print prompts, etc). /// (so we know to print prompts, etc).

View File

@ -317,6 +317,7 @@ void Game::Prune() { g_media->Prune(); }
// Launch into main menu or whatever else. // Launch into main menu or whatever else.
void Game::RunAppLaunchCommands() { void Game::RunAppLaunchCommands() {
assert(InGameThread());
assert(!ran_app_launch_commands_); assert(!ran_app_launch_commands_);
// First off, run our python app-launch call. // First off, run our python app-launch call.
@ -325,10 +326,11 @@ void Game::RunAppLaunchCommands() {
ScopedSetContext cp(GetUIContext()); ScopedSetContext cp(GetUIContext());
g_python->obj(Python::ObjID::kOnAppLaunchCall).Call(); g_python->obj(Python::ObjID::kOnAppLaunchCall).Call();
} }
ran_app_launch_commands_ = true;
// If we were passed launch command args, run them. // If we were passed launch command args, run them.
if (!g_app_globals->game_commands.empty()) { if (!g_app_globals->exec_command.empty()) {
bool success = PythonCommand(g_app_globals->game_commands, BA_BCFN).Run(); bool success = PythonCommand(g_app_globals->exec_command, BA_BCFN).Run();
if (!success) { if (!success) {
exit(1); exit(1);
} }
@ -340,8 +342,6 @@ void Game::RunAppLaunchCommands() {
} }
UpdateProcessTimer(); UpdateProcessTimer();
ran_app_launch_commands_ = true;
} }
Game::~Game() = default; Game::~Game() = default;
@ -353,7 +353,9 @@ void Game::UpdateProcessTimer() {
// This might get called before we set up our timer in some cases. (such as // This might get called before we set up our timer in some cases. (such as
// very early) should be safe to ignore since we update the interval // very early) should be safe to ignore since we update the interval
// explicitly after creating the timers. // explicitly after creating the timers.
if (!process_timer_) return; if (!process_timer_) {
return;
}
// If there's loading to do, keep at it rather vigorously. // If there's loading to do, keep at it rather vigorously.
if (have_pending_loads_) { if (have_pending_loads_) {
@ -883,18 +885,17 @@ void Game::LaunchHostSession(PyObject* session_type_obj,
} }
void Game::RunMainMenu() { void Game::RunMainMenu() {
PushCall([this] { assert(InGameThread());
if (g_app_globals->shutting_down) { if (g_app_globals->shutting_down) {
return; return;
} }
assert(g_python); assert(g_python);
assert(InGameThread()); assert(InGameThread());
PythonRef result = PythonRef result =
g_python->obj(Python::ObjID::kLaunchMainMenuSessionCall).Call(); g_python->obj(Python::ObjID::kLaunchMainMenuSessionCall).Call();
if (!result.exists()) { if (!result.exists()) {
throw Exception("error running main menu"); throw Exception("error running main menu");
} }
});
} }
// Commands run via the in-game console. These are a bit more 'casual' and run // Commands run via the in-game console. These are a bit more 'casual' and run

View File

@ -12,7 +12,7 @@ AreaOfInterest::~AreaOfInterest() = default;
void AreaOfInterest::SetRadius(float r_in) { void AreaOfInterest::SetRadius(float r_in) {
// We slightly scale this for phone situations. // We slightly scale this for phone situations.
float extrascale = (GetInterfaceType() == UIScale::kSmall) ? 0.85f : 1.0f; float extrascale = (GetUIScale() == UIScale::kSmall) ? 0.85f : 1.0f;
radius_ = r_in * extrascale; radius_ = r_in * extrascale;
} }

View File

@ -5833,7 +5833,7 @@ std::string RendererGL::GetAutoAndroidRes() {
if (strstr(renderer, "Adreno (TM) 4") || strstr(renderer, "Adreno (TM) 5")) { if (strstr(renderer, "Adreno (TM) 4") || strstr(renderer, "Adreno (TM) 5")) {
// for phones lets go with 1080p (phones most likely have 1920x1080-ish // for phones lets go with 1080p (phones most likely have 1920x1080-ish
// aspect ratios) // aspect ratios)
if (GetInterfaceType() == UIScale::kSmall) { if (GetUIScale() == UIScale::kSmall) {
return "1080p"; return "1080p";
} else { } else {
// tablets are more likely to have 1920x1200 so lets inch a bit higher // tablets are more likely to have 1920x1200 so lets inch a bit higher
@ -5845,7 +5845,7 @@ std::string RendererGL::GetAutoAndroidRes() {
if (is_extra_speedy_android_device_) { if (is_extra_speedy_android_device_) {
// for phones lets go with 1080p (phones most likely have 1920x1080-ish // for phones lets go with 1080p (phones most likely have 1920x1080-ish
// aspect ratios) // aspect ratios)
if (GetInterfaceType() == UIScale::kSmall) { if (GetUIScale() == UIScale::kSmall) {
return "1080p"; return "1080p";
} else { } else {
// tablets are more likely to have 1920x1200 so lets inch a bit higher // tablets are more likely to have 1920x1200 so lets inch a bit higher

View File

@ -431,7 +431,7 @@ void Graphics::DrawMiscOverlays(RenderPass* pass) {
// during gameplay. // during gameplay.
float start_v = g_graphics->screen_virtual_height() * 0.05f; float start_v = g_graphics->screen_virtual_height() * 0.05f;
float scale; float scale;
switch (GetInterfaceType()) { switch (GetUIScale()) {
case UIScale::kSmall: case UIScale::kSmall:
scale = 1.5f; scale = 1.5f;
break; break;

View File

@ -71,7 +71,7 @@ void TouchInput::HandleTouchEvent(TouchEvent::Type type, void* touch, float x,
} }
TouchInput::TouchInput() { TouchInput::TouchInput() {
switch (GetInterfaceType()) { switch (GetUIScale()) {
case UIScale::kSmall: case UIScale::kSmall:
base_controls_scale_ = 2.0f; base_controls_scale_ = 2.0f;
world_draw_scale_ = 1.2f; world_draw_scale_ = 1.2f;
@ -866,7 +866,7 @@ void TouchInput::UpdateMapping() {
g_app_config->Resolve(AppConfig::BoolID::kTouchControlsSwipeHidden); g_app_config->Resolve(AppConfig::BoolID::kTouchControlsSwipeHidden);
// Start with defaults. // Start with defaults.
switch (GetInterfaceType()) { switch (GetUIScale()) {
case UIScale::kSmall: case UIScale::kSmall:
buttons_default_frac_x_ = 0.88f; buttons_default_frac_x_ = 0.88f;
buttons_default_frac_y_ = 0.2f; buttons_default_frac_y_ = 0.2f;

View File

@ -23,7 +23,7 @@ class PlatformApple : public Platform {
auto GetLocale() -> std::string override; auto GetLocale() -> std::string override;
auto DoGetDeviceName() -> std::string override; auto DoGetDeviceName() -> std::string override;
auto DoHasTouchScreen() -> bool override; auto DoHasTouchScreen() -> bool override;
auto GetInterfaceType() -> UIScale override; auto GetUIScale() -> UIScale override;
auto IsRunningOnDesktop() -> bool override; auto IsRunningOnDesktop() -> bool override;
void HandleLog(const std::string& msg) override; void HandleLog(const std::string& msg) override;
void SetupDataDirectory() override; void SetupDataDirectory() override;

View File

@ -105,6 +105,7 @@ namespace ballistica {
auto Platform::Create() -> Platform* { auto Platform::Create() -> Platform* {
auto platform = new BA_PLATFORM_CLASS(); auto platform = new BA_PLATFORM_CLASS();
platform->PostInit();
return platform; return platform;
} }
@ -562,7 +563,7 @@ static void HandleArgs(int argc, char** argv) {
g_app_globals->vr_mode = false; g_app_globals->vr_mode = false;
} else if (!strcmp(argv[i], "-exec")) { } else if (!strcmp(argv[i], "-exec")) {
if (i + 1 < argc) { if (i + 1 < argc) {
g_app_globals->game_commands = argv[i + 1]; g_app_globals->exec_command = argv[i + 1];
} else { } else {
printf("%s", "Error: expected arg after -exec\n"); printf("%s", "Error: expected arg after -exec\n");
fflush(stdout); fflush(stdout);
@ -597,13 +598,13 @@ static void HandleArgs(int argc, char** argv) {
// In Android's case we have to pull our exec arg from the java/kotlin layer. // In Android's case we have to pull our exec arg from the java/kotlin layer.
if (g_buildconfig.ostype_android()) { if (g_buildconfig.ostype_android()) {
g_app_globals->game_commands = g_platform->GetAndroidExecArg(); g_app_globals->exec_command = g_platform->GetAndroidExecArg();
} }
// TEMP/HACK: hard code launch args. // TEMP/HACK: hard code launch args.
if (explicit_bool(false)) { if (explicit_bool(false)) {
if (g_buildconfig.ostype_android()) { if (g_buildconfig.ostype_android()) {
g_app_globals->game_commands = g_app_globals->exec_command =
"import ba.internal; ba.internal.run_stress_test()"; "import ba.internal; ba.internal.run_stress_test()";
} }
} }
@ -685,7 +686,7 @@ void Platform::CreateAuxiliaryModules() {
void Platform::WillExitMain(bool errored) {} void Platform::WillExitMain(bool errored) {}
auto Platform::GetInterfaceType() -> UIScale { auto Platform::GetUIScale() -> UIScale {
// Handles mac/pc/linux cases. // Handles mac/pc/linux cases.
return UIScale::kLarge; return UIScale::kLarge;
} }

View File

@ -148,7 +148,7 @@ class Platform {
virtual auto IsEventPushMode() -> bool; virtual auto IsEventPushMode() -> bool;
// Return the interface type based on the environment (phone, tablet, etc). // Return the interface type based on the environment (phone, tablet, etc).
virtual auto GetInterfaceType() -> UIScale; virtual auto GetUIScale() -> UIScale;
// Return a string *reasonably* likely to be unique and consistent for this // Return a string *reasonably* likely to be unique and consistent for this
// device. Do not assume this is globally unique and *do not* assume that it // device. Do not assume this is globally unique and *do not* assume that it

View File

@ -742,7 +742,7 @@ auto PyEnv(PyObject* self) -> PyObject* {
bool iircade_mode{g_buildconfig.arcade_build()}; bool iircade_mode{g_buildconfig.arcade_build()};
const char* ui_scale; const char* ui_scale;
switch (GetInterfaceType()) { switch (GetUIScale()) {
case UIScale::kLarge: case UIScale::kLarge:
ui_scale = "large"; ui_scale = "large";
break; break;

View File

@ -4934,7 +4934,7 @@ void SpazNode::Draw(FrameDef* frame_def) {
int elem_count = name_text_group_.GetElementCount(); int elem_count = name_text_group_.GetElementCount();
float s_extra = float s_extra =
(IsVRMode() || GetInterfaceType() == UIScale::kSmall) ? 1.2f : 1.0f; (IsVRMode() || GetUIScale() == UIScale::kSmall) ? 1.2f : 1.0f;
for (int e = 0; e < elem_count; e++) { for (int e = 0; e < elem_count; e++) {
// Gracefully skip unloaded textures. // Gracefully skip unloaded textures.

View File

@ -27,7 +27,7 @@ const float kMenuButtonDrawDepth = -0.07f;
RootUI::RootUI() { RootUI::RootUI() {
float base_scale; float base_scale;
switch (GetInterfaceType()) { switch (GetUIScale()) {
case UIScale::kLarge: case UIScale::kLarge:
base_scale = 1.0f; base_scale = 1.0f;
break; break;

View File

@ -56,7 +56,7 @@ UI::UI() {
// VR and tv builds always use medium. // VR and tv builds always use medium.
g_app_globals->ui_scale = UIScale::kMedium; g_app_globals->ui_scale = UIScale::kMedium;
} else { } else {
g_app_globals->ui_scale = g_platform->GetInterfaceType(); g_app_globals->ui_scale = g_platform->GetUIScale();
} }
} }

View File

@ -141,7 +141,7 @@ auto RootWidget::AddCover(float h_align, VAlign v_align, float x, float y,
// when the user specifies no backing it means they intend to cover the screen // when the user specifies no backing it means they intend to cover the screen
// with a flat-ish window texture.. however this only applies to phone-size; // with a flat-ish window texture.. however this only applies to phone-size;
// for other sizes we always draw a backing. // for other sizes we always draw a backing.
if (GetInterfaceType() != UIScale::kSmall) { if (GetUIScale() != UIScale::kSmall) {
bd.visibility_mask |= bd.visibility_mask |=
static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull); static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull);
} }
@ -152,7 +152,7 @@ auto RootWidget::AddCover(float h_align, VAlign v_align, float x, float y,
void RootWidget::AddMeter(float h_align, float x, int type, float r, float g, void RootWidget::AddMeter(float h_align, float x, int type, float r, float g,
float b, bool plus, const std::string& s) { float b, bool plus, const std::string& s) {
float yoffs = (GetInterfaceType() == UIScale::kSmall) ? 0.0f : -7.0f; float yoffs = (GetUIScale() == UIScale::kSmall) ? 0.0f : -7.0f;
float width = type == 1 ? 80.0f : 110.0f; float width = type == 1 ? 80.0f : 110.0f;
// bar // bar
@ -170,7 +170,7 @@ void RootWidget::AddMeter(float h_align, float x, int type, float r, float g,
bd.color_r = 0.32f; bd.color_r = 0.32f;
bd.color_g = 0.30f; bd.color_g = 0.30f;
bd.color_b = 0.4f; bd.color_b = 0.4f;
if (GetInterfaceType() != UIScale::kSmall) { if (GetUIScale() != UIScale::kSmall) {
bd.color_r *= TOOLBAR_COLOR_R; bd.color_r *= TOOLBAR_COLOR_R;
bd.color_g *= TOOLBAR_COLOR_G; bd.color_g *= TOOLBAR_COLOR_G;
bd.color_b *= TOOLBAR_COLOR_B; bd.color_b *= TOOLBAR_COLOR_B;
@ -286,7 +286,7 @@ void RootWidget::AddMeter(float h_align, float x, int type, float r, float g,
bd.color_r = 0.35f; bd.color_r = 0.35f;
bd.color_g = 0.35f; bd.color_g = 0.35f;
bd.color_b = 0.55f; bd.color_b = 0.55f;
if (GetInterfaceType() != UIScale::kSmall) { if (GetUIScale() != UIScale::kSmall) {
bd.color_r *= TOOLBAR_COLOR_R; bd.color_r *= TOOLBAR_COLOR_R;
bd.color_g *= TOOLBAR_COLOR_G; bd.color_g *= TOOLBAR_COLOR_G;
bd.color_b *= TOOLBAR_COLOR_B; bd.color_b *= TOOLBAR_COLOR_B;
@ -349,9 +349,9 @@ void RootWidget::Setup() {
// widen this a bit in small mode so it just covers most of the top // widen this a bit in small mode so it just covers most of the top
// - that looks funny in medium/large mode though // - that looks funny in medium/large mode though
// if (GetInterfaceType() == UIScale::kSmall) { // if (GetUIScale() == UIScale::kSmall) {
// AddCover(0.5f, VAlign::kTop, 0.0f, 320.0f, // AddCover(0.5f, VAlign::kTop, 0.0f, 320.0f,
// GetInterfaceType() == UIScale::kSmall ? 1000.0f : // GetUIScale() == UIScale::kSmall ? 1000.0f :
// 1000.0f, 800.0f, 0.4f); // 1000.0f, 800.0f, 0.4f);
// } // }
// if (c) { // if (c) {
@ -365,14 +365,14 @@ void RootWidget::Setup() {
bd.h_align = 0.5f; bd.h_align = 0.5f;
bd.v_align = VAlign::kTop; bd.v_align = VAlign::kTop;
bd.width = 370.0f; bd.width = 370.0f;
// if (GetInterfaceType() != UIScale::kSmall) { // if (GetUIScale() != UIScale::kSmall) {
// bd.width = 950.0f; // bd.width = 950.0f;
// } // }
bd.height = 90.0f; bd.height = 90.0f;
bd.x = 256.0f; bd.x = 256.0f;
bd.y = -20.0f; bd.y = -20.0f;
bd.img = "uiAtlas2"; bd.img = "uiAtlas2";
// if (GetInterfaceType() != UIScale::kSmall) { // if (GetUIScale() != UIScale::kSmall) {
// bd.model_transparent = "toolbarBackingTop"; // bd.model_transparent = "toolbarBackingTop";
// } else { // } else {
bd.model_transparent = "toolbarBackingTop2"; bd.model_transparent = "toolbarBackingTop2";
@ -382,7 +382,7 @@ void RootWidget::Setup() {
bd.color_g = 0.41f; bd.color_g = 0.41f;
bd.color_b = 0.56f; bd.color_b = 0.56f;
bd.opacity = 1.0f; bd.opacity = 1.0f;
// if (GetInterfaceType() != UIScale::kSmall) { // if (GetUIScale() != UIScale::kSmall) {
// bd.color_r *= TOOLBAR_COLOR_R; // bd.color_r *= TOOLBAR_COLOR_R;
// bd.color_g *= TOOLBAR_COLOR_G; // bd.color_g *= TOOLBAR_COLOR_G;
// bd.color_b *= TOOLBAR_COLOR_B; // bd.color_b *= TOOLBAR_COLOR_B;
@ -409,14 +409,14 @@ void RootWidget::Setup() {
bd.h_align = 0.5f; bd.h_align = 0.5f;
bd.v_align = VAlign::kTop; bd.v_align = VAlign::kTop;
bd.width = 850.0f; bd.width = 850.0f;
if (GetInterfaceType() != UIScale::kSmall) { if (GetUIScale() != UIScale::kSmall) {
bd.width = 850.0f; bd.width = 850.0f;
} }
bd.height = 90.0f; bd.height = 90.0f;
bd.x = 0.0f; bd.x = 0.0f;
bd.y = -20.0f; bd.y = -20.0f;
bd.img = "uiAtlas2"; bd.img = "uiAtlas2";
if (GetInterfaceType() != UIScale::kSmall) { if (GetUIScale() != UIScale::kSmall) {
bd.model_transparent = "toolbarBackingTop2"; bd.model_transparent = "toolbarBackingTop2";
} else { } else {
bd.model_transparent = "toolbarBackingTop2"; bd.model_transparent = "toolbarBackingTop2";
@ -426,7 +426,7 @@ void RootWidget::Setup() {
bd.color_g = 0.41f; bd.color_g = 0.41f;
bd.color_b = 0.56f; bd.color_b = 0.56f;
bd.opacity = 1.0f; bd.opacity = 1.0f;
if (GetInterfaceType() != UIScale::kSmall) { if (GetUIScale() != UIScale::kSmall) {
bd.color_r *= TOOLBAR_COLOR_R * TOOLBAR_BACK_COLOR_R; bd.color_r *= TOOLBAR_COLOR_R * TOOLBAR_BACK_COLOR_R;
bd.color_g *= TOOLBAR_COLOR_G * TOOLBAR_BACK_COLOR_G; bd.color_g *= TOOLBAR_COLOR_G * TOOLBAR_BACK_COLOR_G;
bd.color_b *= TOOLBAR_COLOR_B * TOOLBAR_BACK_COLOR_B; bd.color_b *= TOOLBAR_COLOR_B * TOOLBAR_BACK_COLOR_B;
@ -446,7 +446,7 @@ void RootWidget::Setup() {
AddButton(bd); AddButton(bd);
} }
float yoffs = (GetInterfaceType() == UIScale::kSmall) ? 0.0f : -10.0f; float yoffs = (GetUIScale() == UIScale::kSmall) ? 0.0f : -10.0f;
// account button // account button
{ {
@ -456,12 +456,12 @@ void RootWidget::Setup() {
bd.width = 160.0f; bd.width = 160.0f;
bd.height = 60.0f; bd.height = 60.0f;
bd.depth_min = 0.3f; bd.depth_min = 0.3f;
bd.x = (GetInterfaceType() == UIScale::kSmall) ? 100.0f : -50.0f; bd.x = (GetUIScale() == UIScale::kSmall) ? 100.0f : -50.0f;
bd.y = -24.0f + yoffs; bd.y = -24.0f + yoffs;
bd.color_r = 0.56f; bd.color_r = 0.56f;
bd.color_g = 0.5f; bd.color_g = 0.5f;
bd.color_b = 0.73f; bd.color_b = 0.73f;
if (GetInterfaceType() != UIScale::kSmall) { if (GetUIScale() != UIScale::kSmall) {
bd.color_r *= TOOLBAR_COLOR_R; bd.color_r *= TOOLBAR_COLOR_R;
bd.color_g *= TOOLBAR_COLOR_G; bd.color_g *= TOOLBAR_COLOR_G;
bd.color_b *= TOOLBAR_COLOR_B; bd.color_b *= TOOLBAR_COLOR_B;
@ -473,7 +473,7 @@ void RootWidget::Setup() {
| static_cast<int>(Widget::ToolbarVisibility::kMenuFullRoot)); | static_cast<int>(Widget::ToolbarVisibility::kMenuFullRoot));
// on desktop, stick this in the top left corner // on desktop, stick this in the top left corner
// if (GetInterfaceType() == UIScale::kLarge) { // if (GetUIScale() == UIScale::kLarge) {
// bd.h_align = 0.0f; // bd.h_align = 0.0f;
// bd.x = 120.0f; // bd.x = 120.0f;
// } // }
@ -511,7 +511,7 @@ void RootWidget::Setup() {
} }
} }
float anchorx = (GetInterfaceType() == UIScale::kSmall) ? 0.3f : 0.25f; float anchorx = (GetUIScale() == UIScale::kSmall) ? 0.3f : 0.25f;
AddMeter(anchorx, 200.0f - 148.0f, 0, 1.0f, 1.0f, 1.0f, false, "456/1000"); AddMeter(anchorx, 200.0f - 148.0f, 0, 1.0f, 1.0f, 1.0f, false, "456/1000");
AddMeter(anchorx, 200.0f, 1, 1.0f, 1.0f, 1.0f, false, "123"); AddMeter(anchorx, 200.0f, 1, 1.0f, 1.0f, 1.0f, false, "123");
@ -657,7 +657,7 @@ void RootWidget::Setup() {
float backingCoverG = backingG; float backingCoverG = backingG;
float backingCoverB = backingB; float backingCoverB = backingB;
float backingA = 1.0f; float backingA = 1.0f;
if (GetInterfaceType() != UIScale::kSmall) { if (GetUIScale() != UIScale::kSmall) {
backingR *= TOOLBAR_COLOR_R * TOOLBAR_BACK_COLOR_R; backingR *= TOOLBAR_COLOR_R * TOOLBAR_BACK_COLOR_R;
backingG *= TOOLBAR_COLOR_G * TOOLBAR_BACK_COLOR_G; backingG *= TOOLBAR_COLOR_G * TOOLBAR_BACK_COLOR_G;
backingB *= TOOLBAR_COLOR_B * TOOLBAR_BACK_COLOR_B; backingB *= TOOLBAR_COLOR_B * TOOLBAR_BACK_COLOR_B;
@ -685,7 +685,7 @@ void RootWidget::Setup() {
bd.x = 0.0f; bd.x = 0.0f;
bd.y = 41.0f; bd.y = 41.0f;
bd.img = "uiAtlas2"; bd.img = "uiAtlas2";
if (GetInterfaceType() != UIScale::kSmall) { if (GetUIScale() != UIScale::kSmall) {
bd.model_transparent = "toolbarBackingBottom2"; bd.model_transparent = "toolbarBackingBottom2";
} else { } else {
bd.model_transparent = "toolbarBackingBottom2"; bd.model_transparent = "toolbarBackingBottom2";
@ -945,7 +945,7 @@ void RootWidget::StepPositions(float dt) {
} }
if (&b == back_button_) { if (&b == back_button_) {
// back button is always disabled in medium/large UI // back button is always disabled in medium/large UI
if (GetInterfaceType() != UIScale::kSmall) { if (GetUIScale() != UIScale::kSmall) {
enable_button = false; enable_button = false;
} }
@ -1034,7 +1034,7 @@ void RootWidget::StepPositions(float dt) {
void RootWidget::UpdateLayout() { void RootWidget::UpdateLayout() {
// Now actually put things in place. // Now actually put things in place.
base_scale_ = 1.0f; base_scale_ = 1.0f;
switch (GetInterfaceType()) { switch (GetUIScale()) {
case UIScale::kLarge: case UIScale::kLarge:
base_scale_ = 0.6f; base_scale_ = 0.6f;
break; break;

View File

@ -230,7 +230,7 @@ void TextWidget::Draw(RenderPass* pass, bool draw_transparent) {
c.SetTexture(g_media->GetTexture(SystemTextureID::kTextClearButton)); c.SetTexture(g_media->GetTexture(SystemTextureID::kTextClearButton));
c.PushTransform(); c.PushTransform();
c.Translate(r - 20, b * 0.5f + t * 0.5f, 0.1f); c.Translate(r - 20, b * 0.5f + t * 0.5f, 0.1f);
if (GetInterfaceType() == UIScale::kSmall) { if (GetUIScale() == UIScale::kSmall) {
c.Scale(30, 30); c.Scale(30, 30);
} else { } else {
c.Scale(25, 25); c.Scale(25, 25);