From 25fdeb330fb4347af4d4f1e0e4bffb0fa12fd137 Mon Sep 17 00:00:00 2001 From: gaithern Date: Wed, 4 Sep 2024 21:07:29 -0500 Subject: [PATCH] Update OpenKH.py --- worlds/khbbs/OpenKH.py | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/worlds/khbbs/OpenKH.py b/worlds/khbbs/OpenKH.py index ee50ed51f338..c368f5d3100b 100644 --- a/worlds/khbbs/OpenKH.py +++ b/worlds/khbbs/OpenKH.py @@ -70,10 +70,10 @@ def get_lua_header(): LUAGUI_AUTH = "Gicu" LUAGUI_DESC = "BBS FM AP Seed" -game_version = 1 --1 for 1.0.0.9 EGS, 2 for Steam -IsEpicGLVersion = 0x6107D4 -IsSteamGLVersion = 0x6107B4 -IsSteamJPVersion = 0x610534 +game_version = 1 --1: EGS GL v1.0.0.10, 2: Steam GL v1.0.0.2, 3: Steam JP v1.0.0.2 +IsEpicGLVersion = 0x68D229 +IsSteamGLVersion = 0x68D451 +IsSteamJPVersion = 0x68C401 can_execute = false frame_count = 0 patched = false @@ -84,14 +84,19 @@ def get_lua_header(): end function _OnInit() - if ReadByte(IsEpicGLVersion) == 0xFF then + if ReadLong(IsEpicGLVersion) == 0x7265737563697065 then game_version = 1 - ConsolePrint("EGS Version Detected") + ConsolePrint("EGS GL v1.0.0.10 Detected") can_execute = true end - if ReadByte(IsSteamGLVersion) == 0xFF then + if ReadLong(IsSteamGLVersion) == 0x7265737563697065 then game_version = 2 - ConsolePrint("Steam Version Detected") + ConsolePrint("Steam GL v1.0.0.2 Detected") + can_execute = true + end + if ReadLong(IsSteamJPVersion) == 0x7265737563697065 then + game_version = 3 + ConsolePrint("Steam JP v1.0.0.2 Detected") can_execute = true end if can_execute then @@ -101,15 +106,15 @@ def get_lua_header(): function _OnFrame() frame_count = (frame_count + 1) % 30 if can_execute and frame_count == 0 then - if ReadInt(version_choice({0x81911F, 0x81711F}, game_version)) ~= 0xFFFFFF00 then --Not on Title Screen - if ReadInt(version_choice({0x81911F, 0x81711F}, game_version)) ~= 0xD0100 then - if ReadInt(version_choice({0x81911F, 0x81711F}, game_version)) ~= 0x20100 or ReadInt(version_choice({0x819123, 0x817123}, game_version)) ~= 0x100 or ReadShort(version_choice({0x819127, 0x817127}, game_version)) ~= 0x100 then\n""" + if ReadInt(version_choice({0x81911F, 0x81811F}, game_version)) ~= 0xFFFFFF00 then --Not on Title Screen + if ReadInt(version_choice({0x81911F, 0x81811F}, game_version)) ~= 0xD0100 then + if ReadInt(version_choice({0x81911F, 0x81811F}, game_version)) ~= 0x20100 or ReadInt(version_choice({0x819123, 0x818123}, game_version)) ~= 0x100 or ReadShort(version_choice({0x819127, 0x818127}, game_version)) ~= 0x100 then\n""" def get_lua_character_check(character): - return """ if ReadByte(version_choice({0x10FA0F80, 0x10F9F800}, game_version)) == 0x0""" + str(character) + """ then\n""" + return """ if ReadByte(version_choice({0x10FA0F80, 0x10FA0880}, game_version)) == 0x0""" + str(character) + """ then\n""" def get_lua_field_item_pointer(self): - return """ field_item_address_pointer = GetPointer(version_choice({0x10FA0B40, 0x10F9F3C0}, game_version)) + return """ field_item_address_pointer = GetPointer(version_choice({0x10FA0B40, 0x10FA0440}, game_version)) if field_item_address_pointer > 0 and not patched then\n""" def get_sticker_replace(self):