"""Play services' PlatformVersion checks folded to `true` crashed Titan Isles at start on Android 11 (GitHub #310).""" from __future__ import annotations import struct import zipfile from test_vivox_audio_route import build_dex from frameport.analysis import detect from frameport.apk.dex import Dex from frameport.patches.frame.gms_platform_version import PLATFORM_VERSION, GmsPlatformVersion, patch_dex from frameport.validate.triage import triage TRUE = [0x1012, 0x000F] # const/4 v0, #1 ; return v0 REAL = [0x0060, 0x0000, 0x0113, 0x0021, 0x1034, 0x0004, # sget SDK_INT; const/16 v1, 33; if-lt … 0x1012, 0x000F, 0x0012, 0x000F] def _dex(sv2=TRUE) -> bytes: return build_dex([(PLATFORM_VERSION, "isAtLeastR", "Z", TRUE), (PLATFORM_VERSION, "isAtLeastS", "Z", TRUE), (PLATFORM_VERSION, "isAtLeastSv2", "Z", sv2), (PLATFORM_VERSION, "isAtLeastT", "Z", REAL)]) def _code(dex: Dex, name: str) -> list[int]: off = dex.code_items(PLATFORM_VERSION, name)[0] n = struct.unpack_from("