From a6181cb776d0d381bf5a172e25c8d4a6cd49ad4b Mon Sep 17 00:00:00 2001 From: Luke Hubmayer-Werner Date: Fri, 25 Aug 2023 18:29:15 +0930 Subject: [PATCH] Fix zone_names block size --- data/string_blocks.tsv | 2 +- scripts/loaders/StringLoader.gd | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/data/string_blocks.tsv b/data/string_blocks.tsv index dfe7632..e754ccf 100644 --- a/data/string_blocks.tsv +++ b/data/string_blocks.tsv @@ -10,4 +10,4 @@ job_and_ability_descs 133 0x117140 2 0x110000 0x110000 True magics 87 0x111C80 6 magics2 73 0x111E8A 9 menu_strings 139 0x00F987 2 0x270000 0x000000 True -zone_names 0x100 0x107000 2 0x270000 0x107200 True \ No newline at end of file +zone_names 164 0x107000 2 0x270000 0x107200 True \ No newline at end of file diff --git a/scripts/loaders/StringLoader.gd b/scripts/loaders/StringLoader.gd index e4a22e0..9d9e928 100644 --- a/scripts/loaders/StringLoader.gd +++ b/scripts/loaders/StringLoader.gd @@ -71,7 +71,12 @@ func load_snes_rom(buffer: StreamPeerBuffer, is_RPGe: bool = false) -> void: else: for i in num_entries-1: buffer.seek(ptrs[i]) - raw_strings.append(buffer.get_data(ptrs[i+1] - ptrs[i])[0]) + var size: int = ptrs[i+1] - ptrs[i] + if size > 0: + raw_strings.append(buffer.get_data(size)[0]) + else: + print_debug('String pointer mismatch: "%s" index %d: 0x%06X:0x%06X, effective size of %d bytes' % [block_name, i, ptrs[i], ptrs[i+1], size]) + raw_strings.append(PoolByteArray()) else: # Get first level of data for i in num_entries: