-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAddJsonMaps.py
36 lines (35 loc) · 897 Bytes
/
AddJsonMaps.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
#@author Elias Kotlyar
#@category Tuning
#@keybinding
#@menupath
#@toolbar
import os
import json
pathname = os.path.dirname(__file__)
f = open(pathname+"/golf5.json", "r")
content = f.read()
print(content)
content = content.encode('utf-8')
contentJson = json.loads(content)
for map in contentJson["maps"]:
startAddr = map["Fieldvalues.StartAddr"]
startAddr = startAddr.replace("$","")
startAddr = int(startAddr, 16)
startAddr = startAddr + 0x400000
rows = int(map["Rows"])
columns = int(map["Columns"])
size = rows * columns
if map["DataOrg"] == "eHiLo":
size = size * 2
size = size - 2
pass
else:
size = size - 1;
name = map["IdName"]
endAddr = startAddr + size
print(hex(startAddr),hex(endAddr),size,name)
setPreComment(toAddr(startAddr),name + " START")
setPostComment(toAddr(endAddr),name + " END")
for i in range(startAddr,endAddr):
createByte(toAddr(i))
pass