[FF1] Client fix and improvement (#5390)

* FF1 Client fixes.

* Strip leading/trailing spaces from rom-stored player name.

* FF1R encodes the name as utf-8, as it happens.

* UTF-8 is four bytes per character, so we need 64 bytes for the name, not 16.
This commit is contained in:
Rosalie
2025-10-17 10:34:10 -04:00
committed by GitHub
parent 3f2942c599
commit f5f554cb3d

View File

@@ -16,6 +16,7 @@ logger = logging.getLogger("Client")
rom_name_location = 0x07FFE3 rom_name_location = 0x07FFE3
player_name_location = 0x07BCC0
locations_array_start = 0x200 locations_array_start = 0x200
locations_array_length = 0x100 locations_array_length = 0x100
items_obtained = 0x03 items_obtained = 0x03
@@ -111,6 +112,12 @@ class FF1Client(BizHawkClient):
return True return True
async def set_auth(self, ctx: "BizHawkClientContext") -> None:
auth_raw = (await bizhawk.read(
ctx.bizhawk_ctx,
[(player_name_location, 0x40, self.rom)]))[0]
ctx.auth = str(auth_raw, "utf-8").replace("\x00", "").strip()
async def game_watcher(self, ctx: "BizHawkClientContext") -> None: async def game_watcher(self, ctx: "BizHawkClientContext") -> None:
if ctx.server is None: if ctx.server is None:
return return
@@ -204,7 +211,7 @@ class FF1Client(BizHawkClient):
write_list.append((location, [0], self.sram)) write_list.append((location, [0], self.sram))
elif current_item_name in no_overworld_items: elif current_item_name in no_overworld_items:
if current_item_name == "Sigil": if current_item_name == "Sigil":
location = 0x28 location = 0x2B
else: else:
location = 0x12 location = 0x12
write_list.append((location, [1], self.sram)) write_list.append((location, [1], self.sram))