mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
Moved libultra files to /lib/ directory
This commit is contained in:
+23
-28
@@ -8,6 +8,8 @@ from file_util import FileUtil
|
||||
LD_NAME = 'dkr.ld'
|
||||
ASM_DIR = './asm'
|
||||
SRC_DIR = './src'
|
||||
LIB_ASM_DIR = './lib/asm'
|
||||
LIB_SRC_DIR = './lib/src'
|
||||
ASSETS_S_FILENAME = './asm/assets/assets.s'
|
||||
ASSETS_UCODE_S_FILENAME = './asm/assets/ucode.s'
|
||||
ASSETS_DIR = './assets/us_1.0'
|
||||
@@ -137,37 +139,30 @@ class LD:
|
||||
|
||||
def gen_newline(self):
|
||||
self.file.write('\n')
|
||||
|
||||
|
||||
def append_files(self, files, extensions, directory, outputDir):
|
||||
filenames = FileUtil.get_filenames_from_directory(directory, extensions)
|
||||
regex = r'[\/][*]+\s*RAM_POS:\s*0x([0-9a-fA-F]+)\s*[*]+[\/]'
|
||||
for filename in filenames:
|
||||
with open(directory + '/' + filename, 'r') as inFile:
|
||||
notDone = True
|
||||
line = inFile.readline()
|
||||
while line:
|
||||
matches = re.match(regex, line)
|
||||
if matches is None:
|
||||
line = inFile.readline()
|
||||
continue
|
||||
matchedGroups = matches.groups()
|
||||
files.append((outputDir + filename[:-2] + '.o', '', matchedGroups[0], 0))
|
||||
break
|
||||
|
||||
def get_code_files(self):
|
||||
files = []
|
||||
asmFilenames = FileUtil.get_filenames_from_directory(ASM_DIR, ('.s',))
|
||||
regex = r'[\/][*]+\s*RAM_POS:\s*0x([0-9a-fA-F]+)\s*[*]+[\/]'
|
||||
for filename in asmFilenames:
|
||||
with open(ASM_DIR + '/' + filename, 'r') as asmFile:
|
||||
notDone = True
|
||||
line = asmFile.readline()
|
||||
while line:
|
||||
matches = re.match(regex, line)
|
||||
if matches is None:
|
||||
line = asmFile.readline()
|
||||
continue
|
||||
matchedGroups = matches.groups()
|
||||
files.append(('build/asm/' + filename[:-2] + '.o', '', matchedGroups[0], 0))
|
||||
break
|
||||
srcFilenames = FileUtil.get_filenames_from_directory_recursive(SRC_DIR, ('.c','.2'))
|
||||
regex = r'[\/][*]+\s*RAM_POS:\s*0x([0-9a-fA-F]+)\s*[*]+[\/]'
|
||||
for filename in srcFilenames:
|
||||
with open(SRC_DIR + '/' + filename, 'r') as srcFile:
|
||||
notDone = True
|
||||
line = srcFile.readline()
|
||||
while line:
|
||||
matches = re.match(regex, line)
|
||||
if matches is None:
|
||||
line = srcFile.readline()
|
||||
continue
|
||||
matchedGroups = matches.groups()
|
||||
files.append(('build/src/' + filename[:-2] + '.o', '', matchedGroups[0], 0))
|
||||
break
|
||||
self.append_files(files, ('.s',), ASM_DIR, 'build/asm/')
|
||||
self.append_files(files, ('.c',), SRC_DIR, 'build/src/')
|
||||
self.append_files(files, ('.s',), LIB_ASM_DIR, 'build/lib/asm/')
|
||||
self.append_files(files, ('.c',), LIB_SRC_DIR, 'build/lib/src/')
|
||||
files.sort(key = lambda x: (x[2], x[3])) # Sort tuples by RAM address and prioritize src files first.
|
||||
return files
|
||||
|
||||
|
||||
+15
-2
@@ -8,6 +8,7 @@ ASM_FOLDERS = [
|
||||
'./asm/unknown_062930',
|
||||
'./asm/unknown_070110',
|
||||
'./asm/gzip',
|
||||
'./lib/asm',
|
||||
]
|
||||
|
||||
# These will automatically be added to the adventure one percentage.
|
||||
@@ -23,8 +24,9 @@ for folder in ASM_FOLDERS:
|
||||
ASM_FUNCTIONS.append(match.groups()[0])
|
||||
|
||||
SRC_DIRECTORY = './src'
|
||||
LIB_SRC_DIRECTORY = './lib/src'
|
||||
FUNCTION_REGEX = r'([/][*]([^*]|([*][^/]))*[*][/][\n]\s*)?(void|s64|s32|s16|s8|u64|u32|u16|u8|f32|f64)(\s|[*])*([0-9A-Za-z_]+)\s*[(][^)]*[)]\s*{'
|
||||
GLOBAL_ASM_REGEX = r'GLOBAL_ASM[(]\"[^/]*/[^/]*/[^/]*/([a-zA-Z0-9_]*).s\"[)]'
|
||||
GLOBAL_ASM_REGEX = r'GLOBAL_ASM[(]".*(?=\/)\/([^.]+).s"[)]'
|
||||
WIP_REGEX = r'#if(.|\n)*?(GLOBAL_ASM[(]([^)]*)[)])(.|\n)*?#else(.|\n)*?#endif'
|
||||
|
||||
CODE_START = 0x80000400
|
||||
@@ -125,12 +127,13 @@ def main():
|
||||
showTopFiles = int(num)
|
||||
|
||||
scoreFiles = []
|
||||
srcFilenames = FileUtil.get_filenames_from_directory_recursive(SRC_DIRECTORY, extensions=('.c'))
|
||||
totalNumberOfDecompiledFunctions = 0
|
||||
totalNumberOfDocumentedFunctions = 0
|
||||
totalNumberOfGlobalAsms = 0
|
||||
totalSizeOfDecompiledFunctions = 0
|
||||
totalSizeOfDocumentedFunctions = 0
|
||||
|
||||
srcFilenames = FileUtil.get_filenames_from_directory_recursive(SRC_DIRECTORY, extensions=('.c'))
|
||||
for filename in srcFilenames:
|
||||
scoreFile = ScoreFile(SRC_DIRECTORY + '/' + filename)
|
||||
totalNumberOfDecompiledFunctions += len(scoreFile.functions)
|
||||
@@ -139,6 +142,16 @@ def main():
|
||||
totalSizeOfDecompiledFunctions += scoreFile.get_size_of_functions()
|
||||
totalSizeOfDocumentedFunctions += scoreFile.get_size_of_documented_functions()
|
||||
scoreFiles.append(scoreFile)
|
||||
srcFilenames = FileUtil.get_filenames_from_directory_recursive(LIB_SRC_DIRECTORY, extensions=('.c'))
|
||||
for filename in srcFilenames:
|
||||
scoreFile = ScoreFile(LIB_SRC_DIRECTORY + '/' + filename)
|
||||
totalNumberOfDecompiledFunctions += len(scoreFile.functions)
|
||||
totalNumberOfGlobalAsms += scoreFile.numGlobalAsms
|
||||
totalNumberOfDocumentedFunctions += scoreFile.get_number_of_documented_functions()
|
||||
totalSizeOfDecompiledFunctions += scoreFile.get_size_of_functions()
|
||||
totalSizeOfDocumentedFunctions += scoreFile.get_size_of_documented_functions()
|
||||
scoreFiles.append(scoreFile)
|
||||
|
||||
totalNumberOfFunctions = MAP_FILE.numFunctions
|
||||
|
||||
for asm_function in ASM_FUNCTIONS:
|
||||
|
||||
Reference in New Issue
Block a user