forked from PeachyPeachSM64/sm64ex-omm
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathomm_map.py
More file actions
18 lines (16 loc) · 704 Bytes
/
Copy pathomm_map.py
File metadata and controls
18 lines (16 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env python3
import sys
if __name__ == "__main__":
omm_map_fn = sys.argv[1]
with open(omm_map_fn, "r", newline="\n", encoding="utf-8") as f:
lines = f.readlines()
with open(omm_map_fn, "w", newline="\n", encoding="utf-8") as f:
for line in lines:
line = line.replace(" ", "")
i0 = line.find("(sec1)(fl0x00)(ty20)(scl2)(nx0)0x")
i1 = line.find("(sec1)(fl0x00)(ty20)(scl3)(nx0)0x")
if i0 != -1 or i1 != -1:
i2 = max(i0, i1) + len("(sec1)(fl0x00)(ty20)(scl2)(nx0)0x")
addr = line[i2:i2 + 16]
name = line[i2 + 16:].strip()
f.write(addr + " " + name + "\n")