From ac498959e50c1edcc30dd0e6673f09cd8d38cb41 Mon Sep 17 00:00:00 2001 From: zarakava Date: Mon, 14 Apr 2025 18:11:07 -0500 Subject: [PATCH 1/3] Use the common function to store navigation/hint text. --- src/mars_patcher/navigation_text.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/mars_patcher/navigation_text.py b/src/mars_patcher/navigation_text.py index 0e7f9f8..4cf48c5 100644 --- a/src/mars_patcher/navigation_text.py +++ b/src/mars_patcher/navigation_text.py @@ -13,8 +13,6 @@ from mars_patcher.rom import Rom # Keep these in sync with base patch -HINT_TEXT_ADDR = 0x7F0000 -HINT_TEXT_END = 0x7FF000 class NavRoom(Enum): @@ -106,29 +104,24 @@ def from_json(cls, data: dict) -> NavigationText: return cls(navigation_text) def write(self, rom: Rom) -> None: - text_addr = HINT_TEXT_ADDR for lang, lang_texts in self.navigation_text.items(): base_text_address = rom.read_ptr(navigation_text_ptrs(rom) + lang.value * 4) # Info Text for info_place, text in lang_texts["ShipText"].items(): + encoded_text = encode_text(rom, MessageType.CONTINUOUS, text) + text_addr = rom.reserve_free_space(len(encoded_text) * 2) rom.write_ptr(base_text_address + info_place.value * 4, text_addr) rom.write_ptr(base_text_address + info_place.value * 4 + 4, text_addr) - - encoded_text = encode_text(rom, MessageType.CONTINUOUS, text) - text_addr = rom.write_16_list(text_addr, encoded_text) - if text_addr >= HINT_TEXT_END: - raise ValueError("Attempted to write too much text to ROM.") + rom.write_16_list(text_addr, encoded_text) # Navigation Text for nav_room, text in lang_texts["NavigationTerminals"].items(): + encoded_text = encode_text(rom, MessageType.CONTINUOUS, text) + text_addr = rom.reserve_free_space(len(encoded_text) * 2) rom.write_ptr(base_text_address + nav_room.value * 8, text_addr) rom.write_ptr(base_text_address + nav_room.value * 8 + 4, text_addr) - - encoded_text = encode_text(rom, MessageType.CONTINUOUS, text) - text_addr = rom.write_16_list(text_addr, encoded_text) - if text_addr >= HINT_TEXT_END: - raise ValueError("Attempted to write too much text to ROM.") + rom.write_16_list(text_addr, encoded_text) @classmethod def apply_hint_security( From 7a1c96ac735bbcc5029615722edd9f3722a75351 Mon Sep 17 00:00:00 2001 From: zarakava Date: Mon, 14 Apr 2025 18:39:32 -0500 Subject: [PATCH 2/3] Update navigation_text.py Remove extraneous comment. --- src/mars_patcher/navigation_text.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mars_patcher/navigation_text.py b/src/mars_patcher/navigation_text.py index 4cf48c5..b481e6c 100644 --- a/src/mars_patcher/navigation_text.py +++ b/src/mars_patcher/navigation_text.py @@ -12,7 +12,6 @@ from mars_patcher.auto_generated_types import Hintlocks, MarsschemaNavstationlocksKey from mars_patcher.rom import Rom -# Keep these in sync with base patch class NavRoom(Enum): From 9fd09c79358d0adfe36d146c2598de4b70b98187 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 23:40:22 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/mars_patcher/navigation_text.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mars_patcher/navigation_text.py b/src/mars_patcher/navigation_text.py index b481e6c..aa2539a 100644 --- a/src/mars_patcher/navigation_text.py +++ b/src/mars_patcher/navigation_text.py @@ -13,7 +13,6 @@ from mars_patcher.rom import Rom - class NavRoom(Enum): MAIN_DECK_WEST = 1 MAIN_DECK_EAST = 2