Compare commits
53 Commits
main
...
a019fa6478
| Author | SHA1 | Date | |
|---|---|---|---|
| a019fa6478 | |||
| a51be12a4a | |||
| 9e5db19c73 | |||
| 640a5bc3a7 | |||
| c946981c38 | |||
| 9733da9f44 | |||
| a3f67a39ab | |||
| 1d4c5f1884 | |||
| a8dc25e59d | |||
| 0f7253c94e | |||
| ddda8aeddf | |||
| ae1744f0dd | |||
| f2d07c98b7 | |||
| 67307a872c | |||
| 3255c75828 | |||
| 9db2a3b64b | |||
| d424505677 | |||
| 2a7141d24e | |||
| 80a64b884e | |||
| 5e0deadf55 | |||
| dd98e55d36 | |||
| 6c8a8e18e0 | |||
| e058fd1961 | |||
| bfd791fc87 | |||
| b10c700836 | |||
| f5d5860af0 | |||
| da0cef6dfe | |||
| 36eb171d24 | |||
| 2ce245c430 | |||
| e8bc0d81c4 | |||
| 5f66483d98 | |||
| 30e85c1256 | |||
| 402c9a5f76 | |||
| 34b5dfb4e8 | |||
| 54e73c0b99 | |||
| affa210802 | |||
| ea62a5bcb7 | |||
| bd5fd9ec56 | |||
| 8df39da2bd | |||
| 9b98f59292 | |||
| 870d981eab | |||
| a895fe158b | |||
| 409c6d9a4e | |||
| 42b4374bd3 | |||
| 74739347e7 | |||
| c94d556c4b | |||
| 2195adca64 | |||
| e5ad81861a | |||
| 5418dbfb88 | |||
| 507f4170c8 | |||
| b038ee6cbe | |||
| 2d91647794 | |||
| 7d95405252 |
4
Rom.py
4
Rom.py
@@ -2788,7 +2788,7 @@ def write_strings(rom, world, player, team):
|
|||||||
tt['sign_ganon'] = 'Three ways to victory! %s Get to it!' % trinity_crystal_text
|
tt['sign_ganon'] = 'Three ways to victory! %s Get to it!' % trinity_crystal_text
|
||||||
tt['murahdahla'] = "Hello @. I\nam Murahdahla, brother of\nSahasrahla and Aginah. Behold the power of\ninvisibility.\n\n\n\n… … …\n\nWait! You can see me? I knew I should have\nhidden in a hollow tree. If you bring\n%d triforce pieces, I can reassemble it." % int(world.treasure_hunt_count[player])
|
tt['murahdahla'] = "Hello @. I\nam Murahdahla, brother of\nSahasrahla and Aginah. Behold the power of\ninvisibility.\n\n\n\n… … …\n\nWait! You can see me? I knew I should have\nhidden in a hollow tree. If you bring\n%d triforce pieces, I can reassemble it." % int(world.treasure_hunt_count[player])
|
||||||
elif world.goal[player] == 'ganonhunt':
|
elif world.goal[player] == 'ganonhunt':
|
||||||
tt['sign_ganon'] = 'Go find the Triforce pieces to beat Ganon.'
|
tt['sign_ganon'] = 'Go find the Triforce pieces to beat Ganon'
|
||||||
elif world.goal[player] == 'bosshunt':
|
elif world.goal[player] == 'bosshunt':
|
||||||
bosshunt_count = '%d guardian%s of %sdungeons' % \
|
bosshunt_count = '%d guardian%s of %sdungeons' % \
|
||||||
(world.bosses_ganon[player],
|
(world.bosses_ganon[player],
|
||||||
@@ -2796,7 +2796,7 @@ def write_strings(rom, world, player, team):
|
|||||||
'' if world.bosshunt_include_agas[player] else 'prize ')
|
'' if world.bosshunt_include_agas[player] else 'prize ')
|
||||||
tt['sign_ganon'] = 'To beat Ganon you must defeat %s.' % bosshunt_count
|
tt['sign_ganon'] = 'To beat Ganon you must defeat %s.' % bosshunt_count
|
||||||
elif world.goal[player] == 'completionist':
|
elif world.goal[player] == 'completionist':
|
||||||
tt['sign_ganon'] = 'Ganon only respects those who have done everything.'
|
tt['sign_ganon'] = 'Ganon only respects those who have done everything'
|
||||||
tt['ganon_fall_in'] = Ganon1_texts[random.randint(0, len(Ganon1_texts) - 1)]
|
tt['ganon_fall_in'] = Ganon1_texts[random.randint(0, len(Ganon1_texts) - 1)]
|
||||||
tt['ganon_fall_in_alt'] = 'You cannot defeat me until you finish your goal!'
|
tt['ganon_fall_in_alt'] = 'You cannot defeat me until you finish your goal!'
|
||||||
tt['ganon_phase_3_alt'] = 'Got wax in\nyour ears?\nI can not die!'
|
tt['ganon_phase_3_alt'] = 'Got wax in\nyour ears?\nI can not die!'
|
||||||
|
|||||||
36
Utils.py
36
Utils.py
@@ -8,7 +8,6 @@ import urllib.parse
|
|||||||
import urllib.request
|
import urllib.request
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from hashlib import md5
|
|
||||||
from itertools import count
|
from itertools import count
|
||||||
from math import factorial
|
from math import factorial
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -103,13 +102,31 @@ def close_console():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def get_new_romhash(new_rom='working.sfc'):
|
def make_new_base2current(old_rom='Zelda no Densetsu - Kamigami no Triforce (Japan).sfc', new_rom='working.sfc'):
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
from collections import OrderedDict
|
||||||
|
with open(old_rom, 'rb') as stream:
|
||||||
|
old_rom_data = bytearray(stream.read())
|
||||||
with open(new_rom, 'rb') as stream:
|
with open(new_rom, 'rb') as stream:
|
||||||
new_rom_data = bytearray(stream.read())
|
new_rom_data = bytearray(stream.read())
|
||||||
|
# extend to 2 mb
|
||||||
|
old_rom_data.extend(bytearray([0x00] * (2097152 - len(old_rom_data))))
|
||||||
|
|
||||||
basemd5 = md5()
|
out_data = OrderedDict()
|
||||||
|
for idx, old in enumerate(old_rom_data):
|
||||||
|
new = new_rom_data[idx]
|
||||||
|
if old != new:
|
||||||
|
out_data[idx] = [int(new)]
|
||||||
|
for offset in reversed(list(out_data.keys())):
|
||||||
|
if offset - 1 in out_data:
|
||||||
|
out_data[offset-1].extend(out_data.pop(offset))
|
||||||
|
with open('data/base2current.json', 'wt') as outfile:
|
||||||
|
json.dump([{key: value} for key, value in out_data.items()], outfile, separators=(",", ":"))
|
||||||
|
|
||||||
|
basemd5 = hashlib.md5()
|
||||||
basemd5.update(new_rom_data)
|
basemd5.update(new_rom_data)
|
||||||
return basemd5.hexdigest()
|
return "New Rom Hash: " + basemd5.hexdigest()
|
||||||
|
|
||||||
|
|
||||||
def kth_combination(k, l, r):
|
def kth_combination(k, l, r):
|
||||||
@@ -751,18 +768,18 @@ class bidict(dict):
|
|||||||
super(bidict, self).__init__(*args, **kwargs)
|
super(bidict, self).__init__(*args, **kwargs)
|
||||||
self.inverse = {}
|
self.inverse = {}
|
||||||
for key, value in self.items():
|
for key, value in self.items():
|
||||||
self.inverse.setdefault(value,[]).append(key)
|
self.inverse.setdefault(value,[]).append(key)
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
if key in self:
|
if key in self:
|
||||||
self.inverse[self[key]].remove(key)
|
self.inverse[self[key]].remove(key)
|
||||||
super(bidict, self).__setitem__(key, value)
|
super(bidict, self).__setitem__(key, value)
|
||||||
self.inverse.setdefault(value,[]).append(key)
|
self.inverse.setdefault(value,[]).append(key)
|
||||||
|
|
||||||
def __delitem__(self, key):
|
def __delitem__(self, key):
|
||||||
value = self[key]
|
value = self[key]
|
||||||
self.inverse.setdefault(value,[]).remove(key)
|
self.inverse.setdefault(value,[]).remove(key)
|
||||||
if value in self.inverse and not self.inverse[value]:
|
if value in self.inverse and not self.inverse[value]:
|
||||||
del self.inverse[value]
|
del self.inverse[value]
|
||||||
super(bidict, self).__delitem__(key)
|
super(bidict, self).__delitem__(key)
|
||||||
|
|
||||||
@@ -770,11 +787,12 @@ class bidict(dict):
|
|||||||
class HexInt(int): pass
|
class HexInt(int): pass
|
||||||
|
|
||||||
def hex_representer(dumper, data):
|
def hex_representer(dumper, data):
|
||||||
|
import yaml
|
||||||
return yaml.ScalarNode('tag:yaml.org,2002:int', f"{data:#0{4}x}")
|
return yaml.ScalarNode('tag:yaml.org,2002:int', f"{data:#0{4}x}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print("New Rom Hash:", get_new_romhash())
|
print(make_new_base2current())
|
||||||
# read_entrance_data(old_rom=sys.argv[1])
|
# read_entrance_data(old_rom=sys.argv[1])
|
||||||
# room_palette_data(old_rom=sys.argv[1])
|
# room_palette_data(old_rom=sys.argv[1])
|
||||||
# extract_data_from_us_rom(sys.argv[1])
|
# extract_data_from_us_rom(sys.argv[1])
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
"""Setlist class definitions."""
|
"""Setlist class definitions."""
|
||||||
import random as random_
|
import random as random_
|
||||||
from collections import (
|
from collections import Hashable, MutableSequence, MutableSet, Sequence, Set
|
||||||
Hashable,
|
|
||||||
MutableSequence,
|
|
||||||
MutableSet,
|
|
||||||
Sequence,
|
|
||||||
Set,
|
|
||||||
)
|
|
||||||
|
|
||||||
from . import _util
|
from . import _util
|
||||||
|
|
||||||
|
|||||||
@@ -471,6 +471,10 @@ vanilla_sheets = [
|
|||||||
(0x00, 0x00, 0x00, 0x00), (0x00, 0x00, 0x00, 0x00), (0x00, 0x00, 0x00, 0x00), (0x00, 0x00, 0x00, 0x00),
|
(0x00, 0x00, 0x00, 0x00), (0x00, 0x00, 0x00, 0x00), (0x00, 0x00, 0x00, 0x00), (0x00, 0x00, 0x00, 0x00),
|
||||||
(0x00, 0x00, 0x00, 0x00), (0x00, 0x00, 0x00, 0x00), (0x00, 0x00, 0x00, 0x00), (0x00, 0x00, 0x00, 0x00),
|
(0x00, 0x00, 0x00, 0x00), (0x00, 0x00, 0x00, 0x00), (0x00, 0x00, 0x00, 0x00), (0x00, 0x00, 0x00, 0x00),
|
||||||
(0x00, 0x00, 0x00, 0x00), (0x00, 0x00, 0x00, 0x08), (0x5D, 0x49, 0x00, 0x52), (0x55, 0x49, 0x42, 0x43),
|
(0x00, 0x00, 0x00, 0x00), (0x00, 0x00, 0x00, 0x08), (0x5D, 0x49, 0x00, 0x52), (0x55, 0x49, 0x42, 0x43),
|
||||||
|
# (0x61, 0x62, 0x63, 0x50), (0x61, 0x62, 0x63, 0x50), (0x61, 0x62, 0x63, 0x50), (0x61, 0x62, 0x63, 0x50),
|
||||||
|
# (0x61, 0x62, 0x63, 0x50), (0x61, 0x62, 0x63, 0x50), (0x61, 0x56, 0x57, 0x50), (0x61, 0x62, 0x63, 0x50),
|
||||||
|
# (0x61, 0x62, 0x63, 0x50), (0x61, 0x56, 0x57, 0x50), (0x61, 0x56, 0x63, 0x50), (0x61, 0x56, 0x57, 0x50),
|
||||||
|
# (0x61, 0x56, 0x33, 0x50), (0x61, 0x56, 0x57, 0x50), (0x61, 0x62, 0x63, 0x50), (0x61, 0x62, 0x63, 0x50)
|
||||||
]
|
]
|
||||||
|
|
||||||
required_boss_sheets = {EnemySprite.ArmosKnight: 9, EnemySprite.Lanmolas: 11, EnemySprite.Moldorm: 12,
|
required_boss_sheets = {EnemySprite.ArmosKnight: 9, EnemySprite.Lanmolas: 11, EnemySprite.Moldorm: 12,
|
||||||
|
|||||||
Reference in New Issue
Block a user