2020-03-17 04:31:30 +00:00
|
|
|
#!/usr/bin/python3
|
|
|
|
import os
|
|
|
|
from shutil import copyfile
|
2020-12-26 11:39:52 +00:00
|
|
|
from multiprocessing import Pool
|
|
|
|
from multiprocessing import cpu_count
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-12-26 11:39:52 +00:00
|
|
|
def Extract(xmlPath, outputPath):
|
|
|
|
ExtractFile(xmlPath, outputPath, 1, 0)
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-12-26 11:39:52 +00:00
|
|
|
def ExtractScene(xmlPath, outputPath):
|
|
|
|
ExtractFile(xmlPath, outputPath, 1, 1)
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-12-26 11:39:52 +00:00
|
|
|
def ExtractFile(xmlPath, outputPath, genSrcFile, incFilePrefix):
|
|
|
|
execStr = "tools/ZAP2/ZAP2.out e -eh -i %s -b baserom/ -o %s -gsf %i -ifp %i -sm tools/ZAP2/SymbolMap_OoTMqDbg.txt" % (xmlPath, outputPath, genSrcFile, incFilePrefix)
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-12-26 11:39:52 +00:00
|
|
|
print(execStr)
|
|
|
|
os.system(execStr)
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-12-26 11:39:52 +00:00
|
|
|
def ExtractFunc(fullPath):
|
|
|
|
outPath = ("assets/" + fullPath.split("assets/xml/")[1]).split(".xml")[0]
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-12-26 11:39:52 +00:00
|
|
|
if (fullPath.startswith("assets/xml/scenes/")):
|
|
|
|
ExtractScene(fullPath, outPath)
|
|
|
|
else:
|
|
|
|
Extract(fullPath, outPath)
|
2020-05-26 16:53:53 +00:00
|
|
|
|
2020-12-28 23:37:52 +00:00
|
|
|
def main():
|
|
|
|
xmlFiles = []
|
2020-05-26 16:53:53 +00:00
|
|
|
|
2020-12-28 23:37:52 +00:00
|
|
|
for currentPath, folders, files in os.walk("assets"):
|
|
|
|
for file in files:
|
|
|
|
fullPath = os.path.join(currentPath, file)
|
|
|
|
if file.endswith(".xml") and currentPath.startswith("assets/xml/"):
|
|
|
|
outPath = ("assets/" + fullPath.split("assets/xml/")[1]).split(".xml")[0]
|
|
|
|
xmlFiles.append(fullPath)
|
2020-05-26 16:53:53 +00:00
|
|
|
|
2020-12-28 23:37:52 +00:00
|
|
|
numCores = cpu_count()
|
|
|
|
print("Extracting assets with " + str(numCores) + " CPU cores.")
|
|
|
|
p = Pool(numCores)
|
|
|
|
p.map(ExtractFunc, xmlFiles)
|
2020-05-26 16:53:53 +00:00
|
|
|
|
|
|
|
|
2020-12-28 23:37:52 +00:00
|
|
|
#os.system("make resources")
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|