support all versions; rename output directories

This commit is contained in:
Connor Olding 2018-08-11 15:09:01 +02:00
parent 88430c89f0
commit 155682e209
1 changed files with 10 additions and 3 deletions

13
fs.py
View File

@ -14,6 +14,12 @@ DEBUG = False
lament = lambda *args, **kwargs: print(*args, file=sys.stderr, **kwargs) lament = lambda *args, **kwargs: print(*args, file=sys.stderr, **kwargs)
heresay = os.path.split(sys.argv[0])[0] heresay = os.path.split(sys.argv[0])[0]
known_versions = {
"01e50f41733994bf229bee3b3d8aa9fd46441175": "(E)",
"4813b147d552f72fdb0b306469bf9aa0f820fd5b": "(J)",
"8a7648d8105ac4fc1ad942291b2ef89aeca921c9": "(U)",
}
# TODO: don't hardcode this? look into how the game handles it. # TODO: don't hardcode this? look into how the game handles it.
blocks = ( blocks = (
(0x120000, 0x20000), (0x120000, 0x20000),
@ -370,12 +376,13 @@ def dump_rom(fp):
return return
f.seek(0) f.seek(0)
romhash = sha1(f.read()).hexdigest() hash = sha1(f.read()).hexdigest()
if romhash != "8a7648d8105ac4fc1ad942291b2ef89aeca921c9": version = known_versions.get(hash, None)
if version is None:
raise Exception("unknown/unsupported ROM") raise Exception("unknown/unsupported ROM")
with SubDir(romhash): with SubDir(version):
f.seek(0) f.seek(0)
dump_files(f) dump_files(f)