Skip to content

Commit

Permalink
Update OpenKH.py
Browse files Browse the repository at this point in the history
  • Loading branch information
gaithern committed Sep 5, 2024
1 parent 6906352 commit 25fdeb3
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions worlds/khbbs/OpenKH.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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):
Expand Down

0 comments on commit 25fdeb3

Please sign in to comment.