From 4da9cdd91cf0f7dec8e2bdd0a655d1112d67465b Mon Sep 17 00:00:00 2001 From: LiquidCat64 <74896918+LiquidCat64@users.noreply.github.com> Date: Wed, 15 May 2024 15:50:04 -0600 Subject: [PATCH] CV64: Fix items with weird characters landing on Renon's shop crashing (#3305) --- worlds/cv64/text.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/worlds/cv64/text.py b/worlds/cv64/text.py index 76ffaf1f..3ba0b915 100644 --- a/worlds/cv64/text.py +++ b/worlds/cv64/text.py @@ -31,7 +31,7 @@ def cv64_string_to_bytearray(cv64text: str, a_advance: bool = False, append_end: if char in cv64_char_dict: text_bytes.extend([0x00, cv64_char_dict[char][0]]) else: - text_bytes.extend([0x00, 0x41]) + text_bytes.extend([0x00, 0x21]) if a_advance: text_bytes.extend([0xA3, 0x00]) @@ -45,7 +45,10 @@ def cv64_text_truncate(cv64text: str, textbox_len_limit: int) -> str: line_len = 0 for i in range(len(cv64text)): - line_len += cv64_char_dict[cv64text[i]][1] + if cv64text[i] in cv64_char_dict: + line_len += cv64_char_dict[cv64text[i]][1] + else: + line_len += 5 if line_len > textbox_len_limit: return cv64text[0x00:i]