Fixed score script.

This commit is contained in:
David Benepe
2022-04-29 16:59:02 -04:00
parent d9bd7ff9bd
commit 1ff698f437
2 changed files with 12 additions and 9 deletions
+7 -7
View File
@@ -117,8 +117,8 @@ As of April 29th, 2022, this is our current score:
```
===================================================================
ADVENTURE ONE (ASM -> C Decompilation)
------------------------- 22.80% Complete -------------------------
# Decompiled functions: 1090
------------------------- 23.32% Complete -------------------------
# Decompiled functions: 1124
# GLOBAL_ASM remaining: 656
# NON_MATCHING functions: 8
# NON_EQUIVALENT WIP functions: 107
@@ -126,18 +126,18 @@ As of April 29th, 2022, this is our current score:
Balloons: 12/47, Keys: 1/4, Trophies: 0/5
T.T. Amulets: 1/4, Wizpig Amulets: 1/4
-------------------------------------------------------------------
We are participating in the Trophy Race of Dino Domain. (Round One)
We are participating in the Trophy Race of Dino Domain. (Round Two)
===================================================================
ADVENTURE TWO (Cleanup & Documentation)
------------------------- 2.98% Complete -------------------------
# Documented functions: 146
# Undocumented remaining: 1600
------------------------- 2.99% Complete -------------------------
# Documented functions: 147
# Undocumented remaining: 1633
--------------------------- Game Status ---------------------------
Balloons: 1/47, Keys: 0/4, Trophies: 0/5
T.T. Amulets: 0/4, Wizpig Amulets: 0/4
-------------------------------------------------------------------
We are collecting the second balloon on Timber's Island.
===================================================================
===================================================================
```
---
+5 -2
View File
@@ -30,7 +30,7 @@ for folder in ASM_FOLDERS:
BUILD_DIRECTORY = './build/us_1.0'
SRC_DIRECTORY = './src'
LIB_SRC_DIRECTORY = './lib/src'
FUNCTION_REGEX = r'(?<!static\s)(?:(\/[*][*!][*]*\n(?:[^/]*\n)+?\s*[*]\/\n)(?:\s*)*?)?(void|s64|s32|s16|s8|u64|u32|u16|u8|f32|f64|int|char|short|long)\s(?:\s|[*])*?([0-9A-Za-z_]+)\s*[(][^)]*[)]\s*{'
FUNCTION_REGEX = r'^(?<!static\s)(?:(\/[*][*!][*]*\n(?:[^/]*\n)+?\s*[*]\/\n)(?:\s*)*?)?([^\s]+)\s(?:\s|[*])*?([0-9A-Za-z_]+)\s*[(][^)]*[)]\s*{'
GLOBAL_ASM_REGEX = r'GLOBAL_ASM[(]".*(?=\/)\/([^.]+).s"[)]'
WIP_REGEX = r'#if(?:.|\n)*?(GLOBAL_ASM[(][^)]*[)])(.|\n)*?#endif'
NON_MATCHING_REGEX = re.compile(r'^#ifdef[ ]+NON_MATCHING', re.MULTILINE)
@@ -66,6 +66,8 @@ class DkrMapFile:
MAP_FILE = DkrMapFile()
NOT_FUNCTION_NAMES = ['if', 'else', 'switch', 'while', 'for']
class ScoreFileMatch:
def __init__(self, comment, functionName):
self.comment = comment
@@ -94,7 +96,8 @@ class ScoreFile:
matches = re.finditer(FUNCTION_REGEX, self.text, re.MULTILINE)
for matchNum, match in enumerate(matches, start=1):
groups = match.groups()
self.functions.append(ScoreFileMatch(groups[0], groups[2]))
if groups[2] not in NOT_FUNCTION_NAMES:
self.functions.append(ScoreFileMatch(groups[0], groups[2]))
matches = re.finditer(GLOBAL_ASM_REGEX, self.text, re.MULTILINE)
for matchNum, match in enumerate(matches, start=1):
groups = match.groups()