From dbc33a8c07626d458f4cadb1df3700f41cfadd31 Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 6 Jun 2023 13:20:40 -0700 Subject: [PATCH] work on untangling plus from classic --- .efrocachemap | 88 +++++++-------- CHANGELOG.md | 2 +- src/assets/ba_data/python/baenv.py | 2 +- src/ballistica/base/support/classic_soft.h | 22 ++++ src/ballistica/classic/classic.cc | 124 ++++++++++++++++++++- src/ballistica/classic/classic.h | 17 +++ src/ballistica/shared/ballistica.cc | 2 +- 7 files changed, 206 insertions(+), 51 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 2cff1d9b..2cc680dc 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4072,50 +4072,50 @@ "build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/c5/09/4f10b8a21ba87aa5509cff7a164b", "build/assets/workspace/onslaughtplug.py": "https://files.ballistica.net/cache/ba1/ff/0a/a354984f9c074dab0676ac7e4877", "build/assets/workspace/runaroundplug.py": "https://files.ballistica.net/cache/ba1/2a/1c/9ee5db6d1bceca7fa6638fb8abde", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/62/e9/b412163b4e092088efa29e550cd4", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/81/fd/c5801cc71a91d20ef7b6b7526f3d", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/b3/56/d164cdda04a395651bfc4a3da0c6", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/0c/7b/7e10e6a46365b51540bc262a4c43", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/0f/5f/04db76cebd93efe7faab6b4dba39", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/f4/6f/aa2b417a9797fe0f11c4f542aeb3", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/b4/07/fb400d012c9cc329c3a217852e26", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/0f/3c/d1b770ff37a9b53c860362f05400", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/f1/e1/94fd20bfea79c3cb3242ceddea03", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/a5/7e/9ceb3f55b731cffbc328ea743491", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/39/e8/cebc735a26df34d69627349c823e", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/c5/54/ec4fd0499ca54baa05cd9bef5c78", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/a8/17/ad97e7f9bee23ac71fd410a4e2b1", - "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/3e/a3/13891776879d294ab560c47e5053", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/27/b5/e0612387e2ab52fc92780ede6147", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/b2/34/0e687a8fca611ec2caa43bab1170", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/33/48/4daa0a62b8452df8f4b965ea43ab", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/d8/53/f71b51592fda6b77c00b0e890555", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/2e/04/cba21154a7db3af8e7d19f3ec50b", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/66/73/42068db7cd3aca15f5746eb6c21b", - "build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/98/32/43c61f1e11520f764158cf0e76d2", - "build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/ca/65/cba463f21a8f76c5bbfe27cae124", - "build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/73/20/119211f1700bb5a410cedf4e76f2", - "build/prefab/lib/linux_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/8d/55/58ffef5d09ca7c847ad2e674f9f9", - "build/prefab/lib/linux_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/80/18/f77f052c4514d3bcc0299594285c", - "build/prefab/lib/linux_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/a3/8f/2c7069902d3f9fa98c7f9c345884", - "build/prefab/lib/linux_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/22/7d/d1e7667acdf504c29c54eda43d00", - "build/prefab/lib/linux_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/8e/02/3f64deedf1c0c88f781881728bdb", - "build/prefab/lib/mac_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/0a/6f/8bd8cc4ce90122b36cfb118d3836", - "build/prefab/lib/mac_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/22/18/7b1cbe406b13912238de646a60d1", - "build/prefab/lib/mac_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/4a/44/4611522a4b8b990bf1b68fe99d63", - "build/prefab/lib/mac_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/db/08/eb66fb1cad77c1254cb68b1fc654", - "build/prefab/lib/mac_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/c0/f5/4754225adea89e17231c924cfd96", - "build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/90/9b/94f733c3a48691e02240e04dc792", - "build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/2e/c7/873af48627997b6fab4b2c4ba6bc", - "build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/3a/94/4780fada10f0fc3f43a54f29c86f", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/31/c2/41f93fcaeb1019b114892a214fc8", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/98/63/a37e4160b5339fb6ea003a0532af", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/3e/c1/0c244bed327a50e918106935dfd5", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/c3/78/dc1aa3faafebe98f69a92dcf8608", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/a2/dc/4f5fbedbf52e14f8df6c6c6e4faa", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/ae/db/d7c4471cabc81948b60a070c2a21", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/df/63/693593431de89ec86f54c01daff4", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/f6/99/c20882e36313168110a7fa8eb5df", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/6b/9a/6313a4b212c36f53da9cdf32c38b", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/70/b4/8975e0b0a26bf9ced5a34401f1a6", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/32/7c/85b0ff2d37185544834f41820fdc", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/fb/9f/4f01c15d0262ab0501a8f253678f", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/46/f2/2d1f5d7b391dc65d37157910d1b7", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/0b/81/0396d9b854ca8617c6bcc7ff168b", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d9/bc/05432a5b597d79e3e3235f876e39", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/81/6f/ce631321ef56e17894e92546e30b", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/79/48/9931cf04a947980bd2ff5222de3c", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/b1/ab/ae134a5729ef40798494ecdf7920", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/27/54/b0ba89c5e647fea81ba764920875", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/58/fb/a36f01a572e14459ff71c17b14b9", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/9a/d7/507f8d0f9919bdfe281f5fd01bd0", + "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/bb/24/276541840cfe0a056ba7e50d55a9", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/0f/b6/4f3936ca3d59ecec5104d41cf175", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/0b/88/1febae9b9580d363af9d3d8f8227", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/87/c1/94208864f2693c2246136163c094", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/26/41/007819d0c0e0e4a1146b95362e92", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/97/e6/af19bc7077a7da6fb77b0778e96c", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/e8/8c/9c6829f71380c0cf8832b512887a", + "build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/11/1a/3667710b9386d92c9867f7a70eaf", + "build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/d9/f5/ef44ac4c74d42a32c829e17ae0af", + "build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/60/64/3c8138a61d1b3ebe943fe2385f96", + "build/prefab/lib/linux_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/51/1b/3205488128538b30306525c5f08c", + "build/prefab/lib/linux_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/f1/db/431afc311160bde1f89f903b1660", + "build/prefab/lib/linux_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/a4/7a/0a308d6e411d49bd33cc54274ba9", + "build/prefab/lib/linux_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/ff/64/92bd8763912c28f2250f7effa2a3", + "build/prefab/lib/linux_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/a7/18/c957bed67a148f18de6bb222c988", + "build/prefab/lib/mac_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/f8/10/09b6fb3f3bd16f0fcede8948a6dc", + "build/prefab/lib/mac_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/4b/18/a198680c2c8ecb25d5f3fb4241c3", + "build/prefab/lib/mac_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/fd/4a/f0f197715791d07789f487478f90", + "build/prefab/lib/mac_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/fc/ea/241a8fafc2058049166159d24b63", + "build/prefab/lib/mac_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/c2/9d/8c5ecfb247c17177444ae9f36066", + "build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/9e/a2/ebf7b34ed27aa208ace67f41cea4", + "build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/f7/3f/385af37f9370f3d78fe95d0ef2a4", + "build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/cb/a7/a441cd41c0ce091553c5d8b7e43a", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/12/17/3fdb8e5b836b53c9a0380de3b4c3", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/24/38/aa1c0b874e1bbf4ef39de365d671", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/f4/d1/437232324bb82dfdd8d25a92befb", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/0c/8d/1f3ad27b14a8c8d2367e40e2bdf3", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/d9/88/23b717cfc87b5f17f4de686794bb", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/ec/91/859a8a531fce018bdc1c6de2f6ce", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/ad/4a/8756ad59a58070171927002dea14", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/38/72/418c7442db80f1bbc5bfbfab4f10", "src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/52/c6/c11130af7b10d6c0321add5518fa", "src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/38/c3/1dedd5e74f2508efc5974c8815a1", "src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/75/9f/bcf597b362c9f2480cb348188bdd", diff --git a/CHANGELOG.md b/CHANGELOG.md index 006d0a77..4233f7c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.20 (build 21050, api 8, 2023-06-06) +### 1.7.20 (build 21051, api 8, 2023-06-06) - This seems like a good time for a `refactoring` release in anticipation of changes coming in 1.8. Basically this means that a lot of things will be diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index 34ac0775..773bd4ac 100644 --- a/src/assets/ba_data/python/baenv.py +++ b/src/assets/ba_data/python/baenv.py @@ -28,7 +28,7 @@ if TYPE_CHECKING: # Build number and version of the ballistica binary we expect to be # using. -TARGET_BALLISTICA_BUILD = 21050 +TARGET_BALLISTICA_BUILD = 21051 TARGET_BALLISTICA_VERSION = '1.7.20' _g_env_config: EnvConfig | None = None diff --git a/src/ballistica/base/support/classic_soft.h b/src/ballistica/base/support/classic_soft.h index caec2343..a05c3045 100644 --- a/src/ballistica/base/support/classic_soft.h +++ b/src/ballistica/base/support/classic_soft.h @@ -3,6 +3,11 @@ #ifndef BALLISTICA_BASE_SUPPORT_CLASSIC_SOFT_H_ #define BALLISTICA_BASE_SUPPORT_CLASSIC_SOFT_H_ +#include +#include + +#include "ballistica/base/base.h" + namespace ballistica::base { /// 'Soft' interface to the classic feature-set. @@ -16,6 +21,23 @@ class ClassicSoftInterface { virtual auto GetControllerFloatValue(base::InputDevice* device, const std::string& value_name) -> float = 0; + virtual auto IsV1AccountSignedIn() -> bool = 0; + virtual auto HandleSignOutV1() -> bool = 0; + virtual void V2SetV1AccountState(const char* statestr, const char* loginid, + const char* tag) = 0; + virtual auto GetV1AccountToken() -> std::string = 0; + virtual auto GetV1AccountExtra() -> std::string = 0; + virtual auto GetV1AccountExtra2() -> std::string = 0; + virtual auto GetV1AccountLoginName() -> std::string = 0; + virtual auto GetV1AccountTypeString() -> std::string = 0; + virtual auto GetV1AccountLoginStateString() -> std::string = 0; + virtual auto GetV1AccountLoginStateNum() -> int = 0; + virtual auto GetV1AccountLoginID() -> std::string = 0; + virtual void SetV1AccountProductsPurchased( + const std::vector& purchases) = 0; + virtual auto GetV1AccountProductPurchased(const char* item) -> bool = 0; + virtual auto GetV1AccountProductPurchasesState() -> int = 0; + virtual void SetV1DeviceAccount(const std::string& name) = 0; }; } // namespace ballistica::base diff --git a/src/ballistica/classic/classic.cc b/src/ballistica/classic/classic.cc index a6b730e0..9dbf61ca 100644 --- a/src/ballistica/classic/classic.cc +++ b/src/ballistica/classic/classic.cc @@ -4,6 +4,7 @@ #include "ballistica/classic/python/classic_python.h" #include "ballistica/classic/support/v1_account.h" +#include "ballistica/core/platform/core_platform.h" namespace ballistica::classic { @@ -58,14 +59,129 @@ auto ClassicFeatureSet::Import() -> ClassicFeatureSet* { return ImportThroughPythonModule("_baclassic"); } -int ClassicFeatureSet::GetControllerValue(base::InputDevice* device, - const std::string& value_name) { +auto ClassicFeatureSet::GetControllerValue(base::InputDevice* device, + const std::string& value_name) + -> int { return python->GetControllerValue(device, value_name); } -float ClassicFeatureSet::GetControllerFloatValue( - base::InputDevice* device, const std::string& value_name) { +auto ClassicFeatureSet::GetControllerFloatValue(base::InputDevice* device, + const std::string& value_name) + -> float { return python->GetControllerFloatValue(device, value_name); } +auto ClassicFeatureSet::IsV1AccountSignedIn() -> bool { + return v1_account->GetLoginState() == classic::V1LoginState::kSignedIn; +} + +auto ClassicFeatureSet::HandleSignOutV1() -> bool { + // For particular account types we can simply set our state; no need to + // bring any other parties in to play. + if (g_classic->account_type == classic::V1AccountType::kDevice + || g_classic->account_type == classic::V1AccountType::kServer + || g_classic->account_type == classic::V1AccountType::kV2) { + g_classic->v1_account->PushSetV1LoginCall( + g_classic->account_type, classic::V1LoginState::kSignedOut, "", ""); + return true; // We handled it. + } + // We didn't handle it. + return false; +} +void ClassicFeatureSet::V2SetV1AccountState(const char* statestr, + const char* loginid, + const char* tag) { + V1LoginState state; + if (statestr == std::string("signing_in")) { + state = classic::V1LoginState::kSigningIn; + } else if (statestr == std::string("signed_in")) { + state = classic::V1LoginState::kSignedIn; + } else { + throw Exception("Invalid state value."); + } + g_classic->v1_account->PushSetV1LoginCall(classic::V1AccountType::kV2, state, + tag, loginid); +} + +auto ClassicFeatureSet::GetV1AccountToken() -> std::string { + return g_classic->v1_account->GetToken(); +} + +auto ClassicFeatureSet::GetV1AccountExtra() -> std::string { + return g_classic->v1_account->GetExtra(); +} + +auto ClassicFeatureSet::GetV1AccountExtra2() -> std::string { + return g_classic->v1_account->GetExtra2(); +} + +auto ClassicFeatureSet::GetV1AccountLoginName() -> std::string { + return g_classic->v1_account->GetLoginName(); +} + +auto ClassicFeatureSet::GetV1AccountTypeString() -> std::string { + return V1Account::AccountTypeToString(g_classic->account_type); +} + +auto ClassicFeatureSet::GetV1AccountLoginStateString() -> std::string { + const char* out; + auto state{g_classic->v1_account->GetLoginState()}; + switch (state) { + case classic::V1LoginState::kSignedIn: + out = "signed_in"; + break; + case classic::V1LoginState::kSignedOut: + out = "signed_out"; + break; + case classic::V1LoginState::kSigningIn: + out = "signing_in"; + break; + default: + Log(LogLevel::kError, "Unknown V1LoginState '" + + std::to_string(static_cast(state)) + + "'"); + out = "signed_out"; + break; + } + return out; +} + +auto ClassicFeatureSet::GetV1AccountLoginStateNum() -> int { + int num; + g_classic->v1_account->GetLoginState(&num); + return num; +} + +auto ClassicFeatureSet::GetV1AccountLoginID() -> std::string { + return g_classic->v1_account->GetLoginID(); +} + +void ClassicFeatureSet::SetV1AccountProductsPurchased( + const std::vector& purchases) { + g_classic->v1_account->SetProductsPurchased(purchases); +} + +auto ClassicFeatureSet::GetV1AccountProductPurchased(const char* item) -> bool { + return g_classic->v1_account->GetProductPurchased(item); +} + +auto ClassicFeatureSet::GetV1AccountProductPurchasesState() -> int { + return g_classic->v1_account->product_purchases_state(); +} + +void ClassicFeatureSet::SetV1DeviceAccount(const std::string& name) { + classic::V1AccountType acc_type; + + // on headless builds we keep these distinct from regular + // device accounts (so we get a 'ServerXXX' name, etc) + if (g_buildconfig.headless_build()) { + acc_type = classic::V1AccountType::kServer; + } else { + acc_type = classic::V1AccountType::kDevice; + } + g_classic->v1_account->PushSetV1LoginCall( + acc_type, classic::V1LoginState::kSignedIn, name, + g_core->platform->GetDeviceV1AccountID()); +} + } // namespace ballistica::classic diff --git a/src/ballistica/classic/classic.h b/src/ballistica/classic/classic.h index 16972ee1..89b9fd0c 100644 --- a/src/ballistica/classic/classic.h +++ b/src/ballistica/classic/classic.h @@ -71,6 +71,23 @@ class ClassicFeatureSet : public FeatureSetNativeComponent, const std::string& value_name) -> int override; auto GetControllerFloatValue(base::InputDevice* device, const std::string& value_name) -> float override; + auto IsV1AccountSignedIn() -> bool override; + auto HandleSignOutV1() -> bool override; + void V2SetV1AccountState(const char* statestr, const char* loginid, + const char* tag) override; + auto GetV1AccountToken() -> std::string override; + auto GetV1AccountExtra() -> std::string override; + auto GetV1AccountExtra2() -> std::string override; + auto GetV1AccountLoginName() -> std::string override; + auto GetV1AccountTypeString() -> std::string override; + auto GetV1AccountLoginStateString() -> std::string override; + auto GetV1AccountLoginStateNum() -> int override; + auto GetV1AccountLoginID() -> std::string override; + void SetV1AccountProductsPurchased( + const std::vector& purchases) override; + auto GetV1AccountProductPurchased(const char* item) -> bool override; + auto GetV1AccountProductPurchasesState() -> int override; + void SetV1DeviceAccount(const std::string& name) override; ClassicPython* const python; V1Account* const v1_account; diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index 8d4a3b17..9c27f854 100644 --- a/src/ballistica/shared/ballistica.cc +++ b/src/ballistica/shared/ballistica.cc @@ -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 = 21050; +const int kEngineBuildNumber = 21051; const char* kEngineVersion = "1.7.20"; auto MonolithicMain(const core::CoreConfig& core_config) -> int {