ref: aee281aa1fd1ec50acc1c1de00bb0c5c832fd68e
parent: 95f757309cbf87679ac71a45c106ef57bdba49f5
author: Snesrev <snesrev@protonmail.com>
date: Thu Mar 9 22:45:19 EST 2023
Add support for extracting dialogue from some more roms
--- a/tables/restool.py
+++ b/tables/restool.py
@@ -8,7 +8,7 @@
optional = parser.add_argument_group('Language settings')
optional.add_argument('--extract-dialogue', action='store_true', help = 'Extract dialogue from the german ROM')
-optional.add_argument('--languages', action='store', metavar='L1,L2', help = 'Comma separated list of additional languages to build (de,fr).')
+optional.add_argument('--languages', action='store', metavar='L1,L2', help = 'Comma separated list of additional languages to build (de,fr,fr-c,en).')
optional = parser.add_argument_group('Debug things')
optional.add_argument('--no-build', action='store_true', help="Don't actually build zelda3_assets.dat")
--- a/tables/sprite_sheets.py
+++ b/tables/sprite_sheets.py
@@ -137,9 +137,11 @@
save_as_png((128, 64 * 3), dst, 'hud_icons.png', convert_snes_palette(get_hud_snes_palette()[:128]))
kFontTypes = {
- 'us' : (0xe8000, 256, 'font.png', (0x8ECADF, 99)),
- 'de' : (0xCC6E8, 256, 'font_de.png', (0x8CDECF, 112)),
- 'fr' : (0xCC6E8, 256, 'font_fr.png', (0x8CDEAF, 112)),
+ 'us' : (0xe8000, 256, 'font.png', (0x8ECADF, 99)),
+ 'de' : (0xCC6E8, 256, 'font_de.png', (0x8CDECF, 112)),
+ 'fr' : (0xCC6E8, 256, 'font_fr.png', (0x8CDEAF, 112)),
+ 'fr-c' : (0xCD078, 256, 'font_fr_c.png', (0x8CE83F, 112)),
+ 'en' : (0x8E8000, 256, 'font_en.png', (0x8ECAFF, 102)),
}
def decode_font():
lang = util.ROM.language
--- a/tables/text_compression.py
+++ b/tables/text_compression.py
@@ -160,6 +160,11 @@
return [cmd_index + self.COMMAND_START]
return [cmd_index + self.COMMAND_START, int(param)]
+class LangEN(LangUS):
+ alphabet = kTextAlphabet_DE
+ dictionary = kTextDictionary_US
+ rom_addrs = [0x9c8000, 0x8edf60]
+
class LangEU:
command_lengths = kText_CommandLengths_EU
command_names = kText_CommandNames_EU
@@ -202,7 +207,6 @@
r = info[1][param]
return (info[0], r) if r != None else ()
-
class LangDE(LangEU):
alphabet = kTextAlphabet_DE
dictionary = kTextDictionary_DE
@@ -213,12 +217,19 @@
dictionary = kTextDictionary_FR
rom_addrs = [0x9c8000, 0x8CE800]
+class LangFR_C(LangEU):
+ alphabet = kTextAlphabet_FR
+ dictionary = kTextDictionary_FR
+ rom_addrs = [0x9c8000, 0x8CF150]
+
kLanguages = {
'us' : LangUS(),
'de' : LangDE(),
'fr' : LangFR(),
+ 'fr-c' : LangFR_C(),
+ 'en' : LangEN(),
}
kDialogueFilenames = {
@@ -225,6 +236,8 @@
'us' : 'dialogue.txt',
'de' : 'dialogue_de.txt',
'fr' : 'dialogue_fr.txt',
+ 'fr-c' : 'dialogue_fr_c.txt',
+ 'en' : 'dialogue_en.txt',
}
dict_expansion = []
@@ -261,7 +274,6 @@
else:
s += info.dictionary[c - info.DICT_BASE_DEC]
dict_expansion.append(len(info.dictionary[c - info.DICT_BASE_DEC]))
-
result.append((s, srcdata))
--- a/tables/util.py
+++ b/tables/util.py
@@ -14,9 +14,11 @@
ZELDA3_SHA256_US = '66871d66be19ad2c34c927d6b14cd8eb6fc3181965b6e517cb361f7316009cfb'
ZELDA3_SHA256 = {
- '030ff80d0087bca440094cd914c03da0aa199dc6edb9adfb43f1267e99fde45f' : 'de',
- '29a0d5812ccbb4b11bdb55d8f751a2a797b4110bf402ca8ba15eb2bf85db7b39' : 'fr',
+ '030ff80d0087bca440094cd914c03da0aa199dc6edb9adfb43f1267e99fde45f' : 'de', # German
+ '29a0d5812ccbb4b11bdb55d8f751a2a797b4110bf402ca8ba15eb2bf85db7b39' : 'fr', # French
+ '170d4963a3f5854b2ab3b8203a75ee93034e8f2fff8ff587d9c1bdef9bd04984' : 'fr-c', # French Canadian
ZELDA3_SHA256_US : 'us',
+ 'b7640393ff2cb47ec7c4c061b78f9f34df14663f1d52e171697661a542d01d0d' : 'en', # English PAL ROM
}
def load_rom(filename, support_multilanguage = False):
@@ -55,6 +57,9 @@
self.ROM = open(rom_path, 'rb').read()
hash = hashlib.sha256(self.ROM).hexdigest()
self.language = ZELDA3_SHA256.get(hash)
+
+ if len(self.ROM) == 1049088:
+ self.ROM = self.ROM[0x200:]
if support_multilanguage:
if self.language == None: