Revising GetDeviceName() functionality

This commit is contained in:
Eric 2022-08-22 15:50:07 -07:00
parent 5bf8f52d20
commit 4913722d75
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
13 changed files with 95 additions and 93 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/83/93/527ea9520e3d20f238d2d1817583",
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/fa/1d/9c3dc164b0f5d3e515f705e9b104",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ff/7a/a380a58018132a4fae9089ecd904",
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b4/0c/c817cfb796ffc58963791af0c182",
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/60/4b/a59247cfaa6705f477370291a11d",
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/13/37/196be3a305722add72d2f6f5b57a",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/54/2c/dabb59bc1a4d9df35b88bf3e48a1",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/99/6b/4f1dcfcb9545c72c9504966c0ea2",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/b0/75/9116dd3cbb7cf2f45a8ab10c64bc",
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/5a/71/0702ba8c30311bb4f2c3d2eda9bd",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2f/ab/09d35eeed98750f65ed01846d899",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/08/ee/9213176a91299ae95ed794c23aaa",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/2d/c7/04dd9d271b3f60639cf6632345f2",
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/b5/c5/b983542dbae0237d11734cd6ab6d",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/db/14/362a8fcb83d0e75e31c1c40dba6a",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/32/71/e81e6e05527dd32b657226e325dd",
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/55/8c/93549bc85070fcd2ec672a118f14",
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/8e/cf/af24ac4b3835864d56f8803a341e",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/53/58/6a422be2330cee165b4ca7510119",
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/22/50/92b0b2562f0b1b0d836c31a7388a",
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d1/b6/7ba91978167ee1756024f24258ac",
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/57/24/9f56b62f3d49ffcab8813e155311",
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/66/e3/1a585eacdefece2f452b94a57002",
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/04/99/1e0054b7a9199fc313d20952af45",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e5/fe/a62e0d0f08dd3bb20621e179bb72",
"build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/21/9d/772eb55d5cbb25c0e9471c61967d",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/bc/13/52caf3e55379170b8c8ecf9d0841",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/de/ba/1add5652343a83bc06fae3bd411d",
"build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f8/10/ecf1b5012ecd48deff5f3862f1b0",
"build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ef/d6/767762326fd30e0e20e705d21caa",
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/47/95/fb42dfc3f5095be3ef641734115e",
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/bc/06/f1751e618eb4165824feea6fda3f",
"build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/53/b6/b83fb64aca6ab4a08e3439e2c8bb",
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a6/4a/1fb1e55d6e5961857da796af7c66",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/cb/60/b4c9719b4d21edddf495a6e0d4b9",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/08/d6/59928c3bd2de09e1d5ae5c17a2ab",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/0d/92/f17ccc8bd555f02c7fd30b36f6ed",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/33/f2/e4efb06731a2f417433b590659cb",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/69/24/7d3a60f2f9ed506c6a93722ac0ab",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/97/18/24c848cf8cc7c5022d83be5c4854",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/7b/19/8edd10663705311593ba35101912",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/77/e5/4c460c6a817968e12f1741d64801",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/40/f3/5a8e98b512cf9236686670d5044f",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/ad/93/576e126263499f7b48628a585b84",
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/64/57/bce7a68d30b264db87875ae438d0",
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/a0/13/d1acf158dfd7a488c3f205e1b295",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e4/2f/13992cbb0828dfd2a89aee9b95ce",
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2a/8c/b7eea27a4af451d0702293fcbe5a",
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/bd/ea/d9f13cd18a36730bdfb36270f5bb",
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/6f/3f/3cdbfba6bc0958e75dfa2e3b6504",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2f/a0/856648775a2b52adc76f34710ad7",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/5b/17/5939ad716f1dbb1bc102cafff607",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/29/f1/778a93a30aa31b974b4535663a37",
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/c5/08/f1b0557a07db1514b524be6e291e",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/12/a5/77bd5d22844aed9bce4c75fc4b04",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/8b/eb/78c12a631a351d4426feb7a6aa53",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/b6/fb/f42a2961818723b3d371ce0d99b3",
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/72/59/051f60df54f0300a0db56518fdb1",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c2/d5/5233133e52ec03d5fd96f835a866",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/3a/9e/e169647cce45ed806b7dd85d61f1",
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/af/5f/9c48d18bfe713bab14a847e21bfa",
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/55/bf/37e1d0376ae2c822193c8bc97f10",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/bf/0b/04c322afed1c65cf03fcb692b8ee",
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/17/b3/6b3d6b121fdb676422f762c018bb",
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/6a/91/ddafd190b867e23110b18ddce9ab",
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/07/5f/246e5ef83e81f516aa82033470c5",
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/18/04/ed17d0ac8813451038b4831dd3c1",
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/89/2c/dff3e4546d2ea36f3853ecd0cd06",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8e/7f/aba0521a34f1fe7936582b9d4da3",
"build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/af/06/b5134d7549f9d1f02f649a5e6a93",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/05/e1/5edb910cecfec50be64e2030812f",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/3a/da/e3fe2a1e856877c2ba53e5363c17",
"build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/33/b5/1fef96a86e5d980d6f84b5f02781",
"build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/fd/68/32542d9d813d1921b80deae34edb",
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/1c/72/e660714f6b4e10059aa2519502a9",
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/80/04/907120ad1dc7d9449c6e2091c6ad",
"build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9e/96/3c364ad5ab2947c208c5466a7fec",
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8a/db/36b9f3de6a8fb6f358f3fc0bfc41",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/1d/fd/9f1656647d932b132cb8bea1168b",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/da/d4/5d6c747dd129f806311e8771e083",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/13/3f/573c4a13ee18a6267e2df2a805b1",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/33/72/d9bea96546dd84540a5a71b238a4",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/04/83/5099c75807fe4f15c99f850eae14",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/ff/d5/fa3365c7204cc8532e2f8455b826",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/89/a9/4e966834c8e061dd08f860007bc7",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/93/c7/f094fcced2ef8a9c52be349b9121",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/9c/d2/446c957509385e324ac33888b7d7",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/c3/47/a3ad5a86f6ddd95f36ff4aee0f94",
"src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/7d/3e/229a581cb2454ed856f1d8b564a7",
"src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/d3/db/e73d4dcf1280d5f677c3cf8b47c3"
}

View File

@ -110,6 +110,7 @@
<option value="xml.dom.*" />
<option value="type.__getitem__" />
<option value="typing_extensions.assert_type" />
<option value="float.__getitem__" />
</list>
</option>
</inspection_tool>

View File

@ -1,8 +1,9 @@
### 1.7.7 (build 20698, api 7, 2022-08-21)
### 1.7.7 (build 20700, api 7, 2022-08-22)
- 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.
- Added simple check for incoming packets (should increase security level a bit).
- Simplified logic for C++ `Platform::GetDeviceName()` and made it accessible to Python via `ba.app.device_name`.
### 1.7.6 (build 20687, api 7, 2022-08-11)
- Cleaned up da MetaSubsystem code.

View File

@ -18,7 +18,7 @@ The Ballistica project is the foundation for [BombSquad](https://www.froemling.n
* **Python tomfoolery**
Ballistica is built on a C++ core for performance-sensitive code with a Python layer for high level game/app logic. This Python layer is designed to be mucked with. Users can override core game functionality, write their own mini games, or anything else they can dream up, either by directly accessing files on disk or by working through an integrated web-based editor. It can be a fun way to learn Python without the danger of getting useful work done.
Ballistica is built on a C++ core for performance-sensitive code with a Python layer for high level game/app logic. This Python layer is designed to be mucked with. Users can override core game functionality, write their own mini games, or anything else they can dream up, either by directly accessing files on disk or by working through an integrated web-based editor. It can be a fun way to learn Python without the danger of getting actual work done.
* **Physics-y goodness**

View File

@ -1 +1 @@
58062653605658487107918437258195542763
120978581248089054368878884309615767758

View File

@ -91,6 +91,12 @@ class App:
assert isinstance(self._env['build_number'], int)
return self._env['build_number']
@property
def device_name(self) -> str:
"""Name of the device running the game."""
assert isinstance(self._env['device_name'], str)
return self._env['device_name']
@property
def config_file_path(self) -> str:
"""Where the game's config file is stored on disk."""

View File

@ -21,7 +21,7 @@
namespace ballistica {
// These are set automatically via script; don't modify them here.
const int kAppBuildNumber = 20698;
const int kAppBuildNumber = 20700;
const char* kAppVersion = "1.7.7";
// Our standalone globals.

View File

@ -453,7 +453,7 @@ auto ConnectionSet::UDPConnectionPacket(const std::vector<uint8_t>& data_in,
// Client is telling us (host) that it wants to disconnect.
uint8_t client_id = data[1];
if (!VerifyClientAddr(client_id, addr)) {
Log("VerifyClientAddr() failed");
BA_LOG_ONCE("VerifyClientAddr() failed.");
break;
}
@ -500,7 +500,7 @@ auto ConnectionSet::UDPConnectionPacket(const std::vector<uint8_t>& data_in,
if (data_size > 2) {
uint8_t client_id = data[1];
if (!VerifyClientAddr(client_id, addr)) {
Log("VerifyClientAddr() failed");
BA_LOG_ONCE("VerifyClientAddr() failed.");
break;
}

View File

@ -4,6 +4,7 @@
#include "ballistica/app/app_globals.h"
#include "ballistica/game/account.h"
#include "ballistica/game/game.h"
#include "ballistica/generic/json.h"
#include "ballistica/generic/utils.h"
#include "ballistica/platform/platform.h"
@ -80,8 +81,16 @@ auto PlayerSpec::GetAccountPlayerSpec() -> PlayerSpec {
spec.name_ =
Utils::GetValidUTF8(g_account->GetLoginName().c_str(), "bsgaps");
} else {
spec.name_ =
Utils::GetValidUTF8(g_platform->GetDeviceName().c_str(), "bsgaps2");
// Headless builds fall back to V1 public-party name if that's available.
if (g_buildconfig.headless_build()
&& !g_game->public_party_name().empty()) {
spec.name_ =
Utils::GetValidUTF8(g_game->public_party_name().c_str(), "bsgp3r");
} else {
// Or lastly fall back to device name.
spec.name_ =
Utils::GetValidUTF8(g_platform->GetDeviceName().c_str(), "bsgaps2");
}
}
if (spec.name_.size() > 100) {
// FIXME should perhaps clamp this in unicode space

View File

@ -9,9 +9,11 @@
namespace ballistica {
// a PlayerSpec is a portable description of an entity such as a player or
// client. It can contain long and short names, optional info linking it to a
// real account, and can be passed around easily in string form.
/// a PlayerSpec is a portable description of an entity such as a player or
/// client. It can contain long and short names, optional info linking it to a
/// V1 account, and can be passed around easily in string form.
/// Note: usage of this should be phased out during the V2 era; the C++ layer
/// should not know or care about V2 accounts.
class PlayerSpec {
public:
/// Init an invalid player-spec
@ -35,9 +37,10 @@ class PlayerSpec {
/// Return the full string form to be passed around.
auto GetSpecString() const -> std::string;
/// Return a PlayerSpec for the currently logged in account.
/// If there is no current logged in account, a dummy-spec is created
/// using the device name (so this always returns something reasonable).
/// Return a PlayerSpec for the currently logged in v1 account.
/// If there is no current logged in v1 account, a dummy-spec is created
/// using the current party name or device name (so this always returns
/// something reasonable).
static auto GetAccountPlayerSpec() -> PlayerSpec;
/// Return a 'dummy' PlayerSpec using the given name; can be

View File

@ -107,12 +107,19 @@ namespace ballistica {
auto Platform::Create() -> Platform* {
auto platform = new BA_PLATFORM_CLASS();
platform->PostInit();
assert(platform->ran_base_post_init_);
return platform;
}
Platform::Platform() : starttime_(GetCurrentMilliseconds()) {}
auto Platform::PostInit() -> void {}
auto Platform::PostInit() -> void {
// Hmm; we seem to get some funky invalid utf8 out of
// this sometimes (mainly on windows). Should look into that
// more closely or at least log it somewhere.
device_name_ = Utils::GetValidUTF8(DoGetDeviceName().c_str(), "dn");
ran_base_post_init_ = true;
}
Platform::~Platform() = default;
@ -478,41 +485,11 @@ auto Platform::GetLocale() -> std::string {
}
auto Platform::GetDeviceName() -> std::string {
static std::string device_name;
static bool have_device_name = false;
// In headless-mode we always return our party name if that's available
// (otherwise everything will just be BallisticaCore Game).
// UPDATE: hmm don't think I like this. Device-name is supposed to go into
// user-agent-strings and whatnot.
// Should probably inject public party name at a higher level.
if (g_buildconfig.headless_build()) {
// Hmm this might be called from non-main threads; should
// think about ensuring this is thread-safe perhaps.
if (g_python != nullptr) {
std::string pname = g_game->public_party_name();
if (!pname.empty()) {
device_name = pname;
have_device_name = true;
}
}
}
if (!have_device_name) {
device_name = DoGetDeviceName();
// Hmm seem to get some funky invalid utf8 out of
// this sometimes (mainly on windows). Should look into that
// more closely or at least log it somewhere.
device_name = Utils::GetValidUTF8(device_name.c_str(), "dn");
have_device_name = true;
}
return device_name;
assert(ran_base_post_init_);
return device_name_;
}
auto Platform::DoGetDeviceName() -> std::string {
return "BallisticaCore Game";
}
auto Platform::DoGetDeviceName() -> std::string { return "Untitled Device"; }
auto Platform::IsRunningOnTV() -> bool { return false; }

View File

@ -579,7 +579,9 @@ class Platform {
bool attempted_to_make_user_scripts_dir_{};
bool made_volatile_data_dir_{};
bool have_device_uuid_{};
bool ran_base_post_init_{};
millisecs_t starttime_{};
std::string device_name_;
std::string legacy_device_uuid_;
std::string config_dir_;
std::string user_scripts_dir_;

View File

@ -780,6 +780,7 @@ auto PyEnv(PyObject* self) -> PyObject* {
"si" // protocol_version
"sO" // headless_mode
"ss" // python_directory_app_site
"ss" // device_name
"}",
"build_number", kAppBuildNumber,
"config_file_path", config_path.c_str(),
@ -802,7 +803,9 @@ auto PyEnv(PyObject* self) -> PyObject* {
"protocol_version", kProtocolVersion,
"headless_mode", HeadlessMode() ? Py_True : Py_False,
"python_directory_app_site",
g_platform->GetSitePythonDirectory().c_str());
g_platform->GetSitePythonDirectory().c_str(),
"device_name",
g_platform->GetDeviceName().c_str());
// clang-format on
}
Py_INCREF(env_obj);