mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
More documentation in memory & unknown_077A0
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import argparse
|
||||
import hashlib
|
||||
import subprocess
|
||||
from file_util import FileUtil
|
||||
|
||||
parser = argparse.ArgumentParser(description="")
|
||||
parser.add_argument("version", help="DKR version.", choices=['us_1.0'])
|
||||
args = parser.parse_args()
|
||||
|
||||
version = args.version
|
||||
|
||||
extractConfigsDirectory = './extract-ver'
|
||||
assetsDirectory = './assets'
|
||||
ucodeDirectory = './assets'
|
||||
extractConfigFilename = extractConfigsDirectory + '/' + version + '.config.json'
|
||||
configChecksumFilename = extractConfigFilename + '.md5'
|
||||
|
||||
needToExtract = False
|
||||
|
||||
if not FileUtil.does_file_exist(assetsDirectory):
|
||||
needToExtract = True
|
||||
elif not FileUtil.does_file_exist(ucodeDirectory):
|
||||
needToExtract = True
|
||||
elif not FileUtil.does_file_exist(configChecksumFilename):
|
||||
needToExtract = True
|
||||
else:
|
||||
md5Calculated = hashlib.md5(FileUtil.get_bytes_from_file(extractConfigFilename)).hexdigest()
|
||||
md5Saved = FileUtil.get_text_from_file(configChecksumFilename)
|
||||
if md5Calculated != md5Saved:
|
||||
needToExtract = True
|
||||
|
||||
if needToExtract:
|
||||
md5Calculated = hashlib.md5(FileUtil.get_bytes_from_file(extractConfigFilename)).hexdigest()
|
||||
FileUtil.write_text_to_file(configChecksumFilename, md5Calculated)
|
||||
subprocess.run(['./extract.sh', version])
|
||||
|
||||
@@ -5,6 +5,9 @@ import os
|
||||
|
||||
from file_util import FileUtil
|
||||
|
||||
INCLUDE_DIRECTORY = './include'
|
||||
ASSETS_INCLUDE = INCLUDE_DIRECTORY + '/asset_sections.h'
|
||||
|
||||
class GenerateAssets:
|
||||
def __init__(self, rootDir, version):
|
||||
self.ASSETS_FILENAME = rootDir + '/asm/assets/assets.s'
|
||||
@@ -22,6 +25,8 @@ class GenerateAssets:
|
||||
assetsJSON = json.load(jsonFile)
|
||||
assets = assetsJSON['assets']
|
||||
|
||||
self.generate_asset_sections_header_file(assets)
|
||||
|
||||
assetsTextFinal = '# This file was generated by generate_ld.py\n\n'
|
||||
assetsTextFinal += '.include "macros.inc"\n\n'
|
||||
|
||||
@@ -132,4 +137,14 @@ class GenerateAssets:
|
||||
def generate_ucode_file(self, label, path):
|
||||
return 'glabel ' + label + '\n.incbin "' + self.BUILD_DIR + '/' + path + '"\n'
|
||||
|
||||
def generate_asset_sections_header_file(self, assets):
|
||||
out = '/* This file was generated by generate_ld.py */\n'
|
||||
out += '\n#ifndef _ASSET_SECTIONS_H_\n#define _ASSET_SECTIONS_H_\n\n'
|
||||
|
||||
for i in range(0, len(assets)):
|
||||
asset = assets[i]
|
||||
out += '#define ASSET_' + asset['name'] + ' ' + str(i) + '\n'
|
||||
|
||||
out += '\n#endif\n'
|
||||
with open(ASSETS_INCLUDE, "w") as assetSectionsFile:
|
||||
assetSectionsFile.write(out)
|
||||
|
||||
Reference in New Issue
Block a user