-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathutil.py
163 lines (149 loc) · 6.64 KB
/
util.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
import json
import collections
import struct
def toStr(bytestr):
return bytestr.split(b'\x00',1)[0].decode('shift-jis')
def encodeBytes(bytestr):
return ' '.join(['%02X'%x for x in bytestr])
def objToJson(parsed):
return json.dumps(parsed,indent=4,ensure_ascii=True,allow_nan=False,default=encodeBytes)
def unpack(fields, formatstr, item):
return collections.namedtuple('_',fields)._make(struct.unpack(formatstr,item))._asdict()
def printHex(bytestr):
print(' '.join('%02X'%x for x in bytestr))
def bitOr(bytestr1, bytestr2):
return bytes([a|b for a,b in list(zip(bytestr1,bytestr2))])
def setBit(bytestr, bitindex):
assert 0<=bitindex<=127
bits = [0]*16
bits[(bitindex//8)^1] |= (1 << (bitindex%8))
return bitOr(bytestr, bits)
flagindex_names = ["Skyloft",
"Faron Woods",
"Lake Floria",
"Flooded Faron Woods",
"Eldin Volcano",
"Eldin Volcano Summit",
"-Unused-",
"Lanayru Desert",
"Lanayru Sand Sea",
"Lanayru Gorge",
"Sealed Grounds",
"Faron: Skyview Temple",
"Faron: Ancient Cistern",
"-Unused-",
"Eldin: Earth Temple",
"Eldin: Fire Sanctuary",
"-Unused-",
"Lanayru: Mining Facility",
"Lanayru: Sandship",
"-Unused-",
"Skyloft: Sky Keep",
"The Sky",
"Faron: Silent Realm",
"Eldin: Silent Realm",
"Lanayru: Silent Realm",
"Skyloft: Silent Realm"]
stagenames = {
"F000": "Skyloft: Skyloft",
"F001r": "Skyloft: Knight's Academy",
"F002r": "Skyloft: Beedle's Airshop",
"F004r": "Skyloft: Bazaar",
"F005r": "Skyloft: Orielle & Parrow’s House",
"F006r": "Skyloft: Repairman Kukiel’s House",
"F007r": "Skyloft: Piper’s House",
"F008r": "Skyloft: Inside the Statue of the Goddess",
"F009r": "Skyloft: Sparring Hall",
"F010r": "Skyloft: Isle of Songs Tower",
"F011r": "Skyloft: The Lumpy Pumpkin",
"F012r": "Skyloft: Demon Guy Batreaux’s House",
"F013r": "Skyloft: Fortune-teller Sparrot’s House",
"F014r": "Skyloft: Potion Shop Owner Bertie’s House",
"F015r": "Skyloft: Scrap Shop Owner Gondo’s House",
"F016r": "Skyloft: Pipit's House",
"F017r": "Skyloft: Gear Peddler Rupin’s House",
"F018r": "Skyloft: Item Check Girl Peatrice’s House",
"F019r": "Skyloft: Bamboo Island",
"F020": "The Sky: Sky Field",
"F021": "The Sky: Cutscene Sky",
"F023": "The Sky: Thunderhead",
"D000": "Skyloft: Waterfall Cave",
"D003_0": "Skyloft: Sky Keep R00 (Enemy)",
"D003_1": "Skyloft: Sky Keep R01 (Underground)",
"D003_2": "Skyloft: Sky Keep R02 (Lava)",
"D003_3": "Skyloft: Sky Keep R03 (Timeshift 2)",
"D003_4": "Skyloft: Sky Keep R04 (Timeshift 1)",
"D003_5": "Skyloft: Sky Keep R05 (ツタ系)",
"D003_6": "Skyloft: Sky Keep R06 (Captain 2)",
"D003_7": "Skyloft: Sky Keep R07 (Entrance)",
"D003_8": "Skyloft: Sky Keep R08 Tri Get",
"S000": "Skyloft: Town Silent Realm",
"F100": "Faron Woods: Faron Woods",
"F100_1": "Faron Woods: Inside the Great Tree",
"F101": "Faron Woods: Deep Woods",
"F102": "Faron Woods: Lake Floria",
"F102_1": "Faron Woods: Outside Ancient Cistern",
"F102_2": "Faron Woods: Faron's Lair",
"F103": "Faron Woods: Faron Woods (Flooded)",
"F103_1": "Faron Woods: Forest F3 (Tree Interior)",
"D100": "Faron Woods: Skyview Temple",
"D101": "Faron Woods: Ancient Cistern",
"B100": "Faron Woods: Forest Boss (R00 Ghirahim)",
"B100_1": "Faron Woods: After Forest Boss (R00 Skyview Spring)",
"B101": "Faron Woods: Forest Boss (Asura)",
"B101_1": "Faron Woods: Farore's Candle Room",
"S100": "Faron Woods: Forest Silent Realm",
"F200": "Eldin Volcano: Eldin Volcano",
"F201_1": "Eldin Volcano: Inside Volcano",
"F201_2": "Eldin Volcano: Volcano F3 (Crater)",
"F201_3": "Eldin Volcano: Fire Sanctuary Entrance",
"F201_4": "Eldin Volcano: Volcano Summit - Waterfall",
"F202": "Eldin Volcano: Volcano F3",
"F202_1": "Eldin Volcano: Volcano F3 (Fire Dragon Dummy 1)",
"F202_2": "Eldin Volcano: Volcano F3 (Fire Dragon Dummy 2)",
"F202_3": "Eldin Volcano: Volcano F3 Completed (Fire Dragon Dummy 1)",
"F202_4": "Eldin Volcano: Volcano F3 Completed (Fire Dragon Dummy 2)",
"F210": "Eldin Volcano: Caves",
"F211": "Eldin Volcano: Thrill Digger",
"F221": "Eldin Volcano: Volcano F2 (Fire Dragon Room)",
"D200": "Eldin Volcano: Earth Temple",
"D201": "Eldin Volcano: Fire Sanctuary (A)",
"D201_1": "Eldin Volcano: Fire Sanctuary (B)",
"B200": "Eldin Volcano: Volcano D1 Boss",
"B201": "Eldin Volcano: Volcano D2 Boss (Ghirahim 2nd Fight)",
"B201_1": "Eldin Volcano: Volcano D2 Boss (Din's Fire)",
"B210": "Eldin Volcano: Volcano D1 Boss (Earth Spring)",
"S200": "Eldin Volcano: Mountain Silent Realm",
"F300": "Lanayru Desert: Lanayru Desert",
"F300_1": "Lanayru Desert: Ancient Harbor",
"F300_2": "Lanayru Desert: Lanayru Mine",
"F300_3": "Lanayru Desert: Power Generator #1",
"F300_4": "Lanayru Desert: Power Generator #2",
"F300_5": "Lanayru Desert: Temple of Time",
"F301": "Lanayru Desert: Sand Sea Docks",
"F301_1": "Lanayru Desert: Sand Sea",
"F301_2": "Lanayru Desert: Pirate Stronghold",
"F301_3": "Lanayru Desert: Skipper's Retreat",
"F301_4": "Lanayru Desert: Shipyard",
"F301_5": "Lanayru Desert: Skipper's Retreat Shack",
"F301_6": "Lanayru Desert: Desert F2 Timeshift Island",
"F301_7": "Lanayru Desert: Shipyard Construction Bay",
"F302": "Lanayru Desert: Lanayru Gorge",
"F303": "Lanayru Desert: Lanayru Caves",
"D300": "Lanayru Desert: Lanayru Mining Facility (A)",
"D300_1": "Lanayru Desert: Lanayru Mining Facility (B)",
"D301": "Lanayru Desert: Sandship (A)",
"D301_1": "Lanayru Desert: Sandship (B)",
"B300": "Lanayru Desert: Desert Boss 00 (Moldarach)",
"B301": "Lanayru Desert: Desert Boss Kraken",
"S300": "Lanayru Desert: Sand Silent Realm",
"F400": "Sealed Grounds: Forest",
"F401": "Sealed Grounds: Whirlpool",
"F402": "Sealed Grounds: Temple",
"F403": "Sealed Grounds: Whirlpool (Past)",
"F404": "Sealed Grounds: Temple (Past)",
"F405": "Sealed Grounds: Whirlpool (Cutscene)",
"F406": "Sealed Grounds: Whirlpool (With Statue)",
"F407": "Sealed Grounds: Temple (Cutscene)",
"B400": "Sealed Grounds: Last Boss",
"Demo": "Staff Roll"}