mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
Found handwritten asm files
This commit is contained in:
@@ -68,8 +68,8 @@ class LD:
|
||||
def gen_main_section(self):
|
||||
self.gen_line('.main 0x80000400 : AT(romPos) SUBALIGN(16)')
|
||||
self.gen_open_block()
|
||||
for asmFile in self.files:
|
||||
self.gen_line(asmFile[0] + '(.text);')
|
||||
for file in self.files:
|
||||
self.gen_line(file[0] + '(.text);')
|
||||
self.gen_close_block()
|
||||
self.gen_line('romPos += SIZEOF(.main);')
|
||||
self.gen_newline()
|
||||
@@ -141,7 +141,7 @@ class LD:
|
||||
def get_code_files(self):
|
||||
files = []
|
||||
asmFilenames = FileUtil.get_filenames_from_directory(ASM_DIR, ('.s',))
|
||||
regex = r'[\/][*]\s*([0-9A-Fa-f]{6})\s*([0-9A-Fa-f]{8})\s*([0-9A-Fa-f]{8})\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
|
||||
@@ -152,7 +152,7 @@ class LD:
|
||||
line = asmFile.readline()
|
||||
continue
|
||||
matchedGroups = matches.groups()
|
||||
files.append(('build/asm/' + filename[:-2] + '.o', matchedGroups[0], matchedGroups[1], 1))
|
||||
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*[*]+[\/]'
|
||||
|
||||
@@ -2,6 +2,26 @@ import re
|
||||
import sys
|
||||
from file_util import FileUtil
|
||||
|
||||
ASM_FOLDERS = [
|
||||
'./asm/unknown_0251F0',
|
||||
'./asm/unknown_031D30',
|
||||
'./asm/unknown_062930',
|
||||
'./asm/unknown_070110',
|
||||
'./asm/gzip',
|
||||
]
|
||||
|
||||
# These will automatically be added to the adventure one percentage.
|
||||
ASM_FUNCTIONS = [ 'entrypoint' ]
|
||||
for folder in ASM_FOLDERS:
|
||||
GLABEL_REGEX = r'glabel ([0-9A-Za-z_]+)'
|
||||
filenames = FileUtil.get_filenames_from_directory(folder, extensions=('.s',))
|
||||
for filename in filenames:
|
||||
with open(folder + '/' + filename, 'r') as asmFile:
|
||||
text = asmFile.read()
|
||||
matches = re.finditer(GLABEL_REGEX, text, re.MULTILINE)
|
||||
for matchNum, match in enumerate(matches, start=1):
|
||||
ASM_FUNCTIONS.append(match.groups()[0])
|
||||
|
||||
SRC_DIRECTORY = './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\"[)]'
|
||||
@@ -121,6 +141,9 @@ def main():
|
||||
scoreFiles.append(scoreFile)
|
||||
totalNumberOfFunctions = MAP_FILE.numFunctions
|
||||
|
||||
for asm_function in ASM_FUNCTIONS:
|
||||
totalSizeOfDecompiledFunctions += MAP_FILE.functionSizes[asm_function]
|
||||
|
||||
adventureOnePercentage = (totalSizeOfDecompiledFunctions / CODE_SIZE) * 100
|
||||
adventureTwoPercentage = (totalSizeOfDocumentedFunctions / CODE_SIZE) * 100
|
||||
|
||||
|
||||
Reference in New Issue
Block a user