CV64: Fix items with weird characters landing on Renon's shop crashing (#3305)

This commit is contained in:
LiquidCat64
2024-05-15 15:50:04 -06:00
committed by GitHub
parent 6576b069f2
commit 4da9cdd91c

View File

@@ -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)):
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]