diff --git a/.efrocachemap b/.efrocachemap index 1edb879f..9ce7928f 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4103,22 +4103,22 @@ "build/assets/windows/Win32/ucrtbased.dll": "bfd1180c269d3950b76f35a63655e9e1", "build/assets/windows/Win32/vc_redist.x86.exe": "15a5f1f876503885adbdf5b3989b3718", "build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "f9803c96c92f7d4dd345603076b3ae72", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "759dc34f67f5d03b90b8aa282f6fe4e4", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "a07cb32525e62f3c608f97cd055c40fa", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "981086385bca1e94252e4840ea9e54a4", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "2e3e7b291de093fe1b90054770b22677", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "1524792f23cb310c22dff77fab4bf44c", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "6ac767ac37d32016240344895cb6974d", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "7bd189a692b78bb9e965a5ca567e316c", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "38d28b24348a815c91ed939e9e92e3af", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "0fa5c2ac8b4d00e41c489c8c8e477690", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "141a7e706c53a56cb266106a8506113b", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "f83f3c9f75266ee12871a4617abeaf4c", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "741045af91f2086f9477fbc0fc41b8dc", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "bba009880748eec4e98dc4f0053de041", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "9664c41727f66a5abbc8ee6d8c894707", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "63b99b77bb6c032f95e01660492a60b7", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "1c6d09241842fc53d62646cc662b5788", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "cdd335f35c449a6ef92a6a30c16a0085", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "cf604039da1f3d28d6bc1ea7c7b5be6f", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "ead609fc3fa3645e6233f29da0129fa0", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "a7ecf0c835d4601e392351722af45e91", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "0435e351e411ad582efa9edb4cbfacae", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "77d0eafc54b09616dfde834ace398af4", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "cde652ed341ef18534373d6a084c73e4", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "ed5c1f1fc1b27c337d3d7ab52ea6f80d", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "4b4455542be4cc68a2faa77e08856546", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "16038e4aee7fad2ef7d7dfaa20fc1e77", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "9791d3a106473204df3c075912b88627", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "9579daa473553d9b3184e8d6e2449d1a", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "1bd63a757fc1936048baabb67cd78ae0", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "5788412d3b6f5b40094f7f1e7871ed5e", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "2d852ebf53692fac186e851864d30ecf", "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "8e0d4fe40c9d3f78dc353b855c36033d", "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "7a523edeaea9e8e222e3d9daafd53d3a", "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "8e0d4fe40c9d3f78dc353b855c36033d", @@ -4131,14 +4131,14 @@ "build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "b57964942b8ca52efdf51582adc26aee", "build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "3516e46d80d01cab8b93d3c50a5947bc", "build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "b57964942b8ca52efdf51582adc26aee", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "14d6093a5de1c5d862b4b7586b8ab7b4", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "5050be44e2391c60654d99a81accf28e", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "763f1f32df0092cded564856ccaa5eee", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "c7904ea044dd0b11510d4f52aae48c1c", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "bdd683789643cef7d01c186ab8d767a2", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "bcd2cc9ae3baa73a7a72f82cbb2aabb8", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "ac256750318d76da7d9fcee90e9bc808", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "f103638e32e70b08af0e79e604cf055d", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "fb8b453ef08c338a3021c409c9b92cd7", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "2e37c8cc89e0c7d3921de1dac2fa9248", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "d49436a80df5bc4620a5fac8ce8dd905", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "7fbe2f445f79975909484da424f50fff", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "93a68477b999f022cdfeaf8bb358c9a7", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "e75d0ea19ce9a2012da65bba6d391fb7", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "87ab5928f2703ff308f976c162d4f6e4", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "d950ed6388747fce98c7c8c8d412d103", "src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c", "src/assets/ba_data/python/babase/_mgen/enums.py": "794d258d59fd17a61752843a9a0551ad", "src/ballistica/base/mgen/pyembed/binding_base.inc": "06042d31df0ff9af96b99477162e2a91", diff --git a/CHANGELOG.md b/CHANGELOG.md index cbfd08c6..d3d042d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.37 (build 22137, api 9, 2024-12-18) +### 1.7.37 (build 22138, api 9, 2024-12-19) - Bumping api version to 9. As you'll see below, there's some UI changes that will require a bit of work for any UI mods to adapt to. If your mods don't touch UI stuff at all you can simply bump your api version and call it a day. diff --git a/src/assets/ba_data/python/babase/__init__.py b/src/assets/ba_data/python/babase/__init__.py index 4efe6758..cb659fab 100644 --- a/src/assets/ba_data/python/babase/__init__.py +++ b/src/assets/ba_data/python/babase/__init__.py @@ -111,6 +111,7 @@ from _babase import ( SimpleSound, supports_max_fps, supports_vsync, + supports_unicode_display, unlock_all_input, update_internal_logger_levels, user_agent_string, @@ -351,6 +352,7 @@ __all__ = [ 'StringEditSubsystem', 'supports_max_fps', 'supports_vsync', + 'supports_unicode_display', 'TeamNotFoundError', 'timestring', 'UIScale', diff --git a/src/assets/ba_data/python/babase/_language.py b/src/assets/ba_data/python/babase/_language.py index 5f393557..1381e799 100644 --- a/src/assets/ba_data/python/babase/_language.py +++ b/src/assets/ba_data/python/babase/_language.py @@ -433,7 +433,7 @@ class LanguageSubsystem(AppSubsystem): 'Thai', 'Tamil', } - and not _babase.can_display_full_unicode() + and not _babase.supports_unicode_display() ): return False return True @@ -524,8 +524,10 @@ class Lstr: ... subs=[('${NAME}', babase.Lstr(resource='res_b'))]) """ - # pylint: disable=dangerous-default-value - # noinspection PyDefaultArgument + # This class is used a lot in UI stuff and doesn't need to be + # flexible, so let's optimize its performance a bit. + __slots__ = ['args'] + @overload def __init__( self, @@ -533,29 +535,28 @@ class Lstr: resource: str, fallback_resource: str = '', fallback_value: str = '', - subs: Sequence[tuple[str, str | Lstr]] = [], + subs: Sequence[tuple[str, str | Lstr]] | None = None, ) -> None: """Create an Lstr from a string resource.""" - # noinspection PyShadowingNames,PyDefaultArgument @overload def __init__( self, *, translate: tuple[str, str], - subs: Sequence[tuple[str, str | Lstr]] = [], + subs: Sequence[tuple[str, str | Lstr]] | None = None, ) -> None: """Create an Lstr by translating a string in a category.""" - # noinspection PyDefaultArgument @overload def __init__( - self, *, value: str, subs: Sequence[tuple[str, str | Lstr]] = [] + self, + *, + value: str, + subs: Sequence[tuple[str, str | Lstr]] | None = None, ) -> None: """Create an Lstr from a raw string value.""" - # pylint: enable=redefined-outer-name, dangerous-default-value - def __init__(self, *args: Any, **keywds: Any) -> None: """Instantiate a Lstr. @@ -583,14 +584,16 @@ class Lstr: if isinstance(self.args.get('value'), our_type): raise TypeError("'value' must be a regular string; not an Lstr") - if 'subs' in self.args: - subs_new = [] - for key, value in keywds['subs']: - if isinstance(value, our_type): - subs_new.append((key, value.args)) - else: - subs_new.append((key, value)) - self.args['subs'] = subs_new + if 'subs' in keywds: + subs = keywds.get('subs') + subs_filtered = [] + if subs is not None: + for key, value in keywds['subs']: + if isinstance(value, our_type): + subs_filtered.append((key, value.args)) + else: + subs_filtered.append((key, value)) + self.args['subs'] = subs_filtered # As of protocol 31 we support compact key names # ('t' instead of 'translate', etc). Convert as needed. diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index 9a08d772..df422a85 100644 --- a/src/assets/ba_data/python/baenv.py +++ b/src/assets/ba_data/python/baenv.py @@ -53,7 +53,7 @@ if TYPE_CHECKING: # Build number and version of the ballistica binary we expect to be # using. -TARGET_BALLISTICA_BUILD = 22137 +TARGET_BALLISTICA_BUILD = 22138 TARGET_BALLISTICA_VERSION = '1.7.37' diff --git a/src/assets/ba_data/python/bauiv1/__init__.py b/src/assets/ba_data/python/bauiv1/__init__.py index 313b377b..4feaa848 100644 --- a/src/assets/ba_data/python/bauiv1/__init__.py +++ b/src/assets/ba_data/python/bauiv1/__init__.py @@ -92,6 +92,7 @@ from babase import ( SpecialChar, supports_max_fps, supports_vsync, + supports_unicode_display, timestring, UIScale, unlock_all_input, @@ -228,6 +229,7 @@ __all__ = [ 'SpecialChar', 'supports_max_fps', 'supports_vsync', + 'supports_unicode_display', 'Texture', 'textwidget', 'timestring', diff --git a/src/assets/ba_data/python/bauiv1lib/inbox.py b/src/assets/ba_data/python/bauiv1lib/inbox.py index f350cd19..5668711e 100644 --- a/src/assets/ba_data/python/bauiv1lib/inbox.py +++ b/src/assets/ba_data/python/bauiv1lib/inbox.py @@ -269,6 +269,7 @@ class InboxWindow(bui.MainWindow): process_type: bacommon.cloud.BSInboxEntryProcessType, response: bacommon.cloud.BSInboxEntryProcessResponse | Exception, ) -> None: + # pylint: disable=too-many-branches entry = entry_weak() if entry is None: return @@ -315,20 +316,25 @@ class InboxWindow(bui.MainWindow): # Whee; no error. Mark as done. if button is not None: - # For positive claim buttons, say 'success'. - # Otherwise default to 'done.' - if ( - entry.type - in { - bacommon.cloud.BSInboxEntryType.CLAIM, - bacommon.cloud.BSInboxEntryType.CLAIM_DISCARD, - } - and process_type - is bacommon.cloud.BSInboxEntryProcessType.POSITIVE - ): - label = bui.Lstr(resource='successText') + # If we have full unicode, just show a checkmark in all cases. + label: str | bui.Lstr + if bui.supports_unicode_display(): + label = '✓' else: - label = bui.Lstr(resource='doneText') + # For positive claim buttons, say 'success'. + # Otherwise default to 'done.' + if ( + entry.type + in { + bacommon.cloud.BSInboxEntryType.CLAIM, + bacommon.cloud.BSInboxEntryType.CLAIM_DISCARD, + } + and process_type + is bacommon.cloud.BSInboxEntryProcessType.POSITIVE + ): + label = bui.Lstr(resource='successText') + else: + label = bui.Lstr(resource='doneText') bui.buttonwidget(edit=button, label=label) def _on_inbox_request_response( diff --git a/src/ballistica/base/python/methods/python_methods_base_1.cc b/src/ballistica/base/python/methods/python_methods_base_1.cc index a0c925ba..a7a923f2 100644 --- a/src/ballistica/base/python/methods/python_methods_base_1.cc +++ b/src/ballistica/base/python/methods/python_methods_base_1.cc @@ -167,27 +167,6 @@ static PyMethodDef PyIsXCodeBuildDef = { "(internal)\n", }; -// ----------------------- can_display_full_unicode ---------------------------- - -static auto PyCanDisplayFullUnicode(PyObject* self) -> PyObject* { - BA_PYTHON_TRY; - if (g_buildconfig.enable_os_font_rendering()) { - Py_RETURN_TRUE; - } - Py_RETURN_FALSE; - BA_PYTHON_CATCH; -} - -static PyMethodDef PyCanDisplayFullUnicodeDef = { - "can_display_full_unicode", // name - (PyCFunction)PyCanDisplayFullUnicode, // method - METH_NOARGS, // flags - - "can_display_full_unicode() -> bool\n" - "\n" - "(internal)", -}; - // -------------------------- app_instance_uuid -------------------------------- static auto PyAppInstanceUUID(PyObject* self, PyObject* args, PyObject* keywds) @@ -1695,7 +1674,6 @@ auto PythonMethodsBase1::GetMethods() -> std::vector { PyRunAppDef, PyAppNameUpperDef, PyIsXCodeBuildDef, - PyCanDisplayFullUnicodeDef, PyEmitLogDef, PyV1CloudLogDef, PyEnvDef, diff --git a/src/ballistica/base/python/methods/python_methods_base_2.cc b/src/ballistica/base/python/methods/python_methods_base_2.cc index e2009fa6..e235e954 100644 --- a/src/ballistica/base/python/methods/python_methods_base_2.cc +++ b/src/ballistica/base/python/methods/python_methods_base_2.cc @@ -905,6 +905,28 @@ static PyMethodDef PySupportsMaxFPSDef = { "(internal)\n", }; +// ---------------------- supports_unicode_display ----------------------------- + +static auto PySupportsUnicodeDisplay(PyObject* self) -> PyObject* { + BA_PYTHON_TRY; + + if (g_buildconfig.enable_os_font_rendering()) { + Py_RETURN_TRUE; + } + Py_RETURN_FALSE; + BA_PYTHON_CATCH; +} + +static PyMethodDef PySupportsUnicodeDisplayDef = { + "supports_unicode_display", // name + (PyCFunction)PySupportsUnicodeDisplay, // method + METH_NOARGS, // flags + + "supports_unicode_display() -> bool\n" + "\n" + "Return whether we can display all unicode characters in the gui.\n", +}; + // --------------------------- show_progress_bar ------------------------------- static auto PyShowProgressBar(PyObject* self, PyObject* args, PyObject* keywds) @@ -994,6 +1016,7 @@ auto PythonMethodsBase2::GetMethods() -> std::vector { PyAllowsTicketSalesDef, PySupportsVSyncDef, PySupportsMaxFPSDef, + PySupportsUnicodeDisplayDef, PyShowProgressBarDef, PyFullscreenControlKeyShortcutDef, PyFullscreenControlGetDef, diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index db38d18c..ab2e3f7b 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 = 22137; +const int kEngineBuildNumber = 22138; const char* kEngineVersion = "1.7.37"; const int kEngineApiVersion = 9;