Found handwritten asm files

This commit is contained in:
David Benepe
2020-07-29 09:30:04 -05:00
parent 021940c9d5
commit cca87e34e0
75 changed files with 521 additions and 450 deletions
+23
View File
@@ -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