diff --git a/README.md b/README.md index b33d8ae7..f7e2b76b 100755 --- a/README.md +++ b/README.md @@ -113,23 +113,24 @@ s32 is_drumstick_unlocked(void) { } ``` -As of July 10th 2021, this is our current score: +As of July 15th 2021, this is our current score: ``` ======================================================= ADVENTURE ONE (ASM -> C Decompilation) - ------------------- 10.02% Complete ------------------- - # Decompiled functions: 725 - # GLOBAL_ASM remaining: 1036 + ------------------- 10.57% Complete ------------------- + # Decompiled functions: 742 + # GLOBAL_ASM remaining: 1020 + # NON_MATCHING functions: 39 --------------------- Game Status --------------------- Balloons: 6/47, Keys: 1/4, Trophies: 0/5 T.T. Amulets: 0/4, Wizpig Amulets: 0/4 ------------------------------------------------------- - We are racing in Jungle Falls. (Lap 2/3) + We are racing in Jungle Falls. (Lap 3/3) ======================================================= ADVENTURE TWO (Cleanup & Documentation) - ------------------- 0.59% Complete ------------------- - # Documented functions: 47 - # Undocumented remaining: 1714 + ------------------- 0.69% Complete ------------------- + # Documented functions: 56 + # Undocumented remaining: 1706 --------------------- Game Status --------------------- Balloons: 0/47, Keys: 0/4, Trophies: 0/5 T.T. Amulets: 0/4, Wizpig Amulets: 0/4 diff --git a/tools/python/score.py b/tools/python/score.py index 9e6d78cf..b5e3f386 100644 --- a/tools/python/score.py +++ b/tools/python/score.py @@ -33,6 +33,7 @@ LIB_SRC_DIRECTORY = './lib/src' FUNCTION_REGEX = r'(?:(\/[*][*!][*]*\n(?:[^/]*\n)+?\s*[*]\/\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[(]".*(?=\/)\/([^.]+).s"[)]' WIP_REGEX = r'#if(?:.|\n)*?(GLOBAL_ASM[(][^)]*[)])(.|\n)*?#endif' +NON_MATCHING_REGEX = re.compile(r'^#ifdef[ ]+NON_MATCHING', re.MULTILINE) CODE_START = 0x80000400 CODE_END = 0x800D75F4 @@ -84,6 +85,7 @@ class ScoreFile: def read_file(self): with open(self.path, "r") as inFile: self.text = inFile.read() + self.numNonMatchings = len(re.findall(NON_MATCHING_REGEX, self.text)) self.text = re.sub(WIP_REGEX, r"GLOBAL_ASM(\1)", self.text) def get_matches(self): @@ -99,7 +101,7 @@ class ScoreFile: self.unfinishedSize += MAP_FILE.functionSizes[groups[0]] except Exception: pass - + def get_number_of_documented_functions(self): count = 0 for func in self.functions: @@ -137,6 +139,7 @@ def main(): totalNumberOfDecompiledFunctions = 0 totalNumberOfDocumentedFunctions = 0 totalNumberOfGlobalAsms = 0 + totalNumberOfNonMatching = 0 totalSizeOfDecompiledFunctions = 0 totalSizeOfDocumentedFunctions = 0 @@ -145,6 +148,7 @@ def main(): scoreFile = ScoreFile(SRC_DIRECTORY + '/' + filename) totalNumberOfDecompiledFunctions += len(scoreFile.functions) totalNumberOfGlobalAsms += scoreFile.numGlobalAsms + totalNumberOfNonMatching += scoreFile.numNonMatchings totalNumberOfDocumentedFunctions += scoreFile.get_number_of_documented_functions() totalSizeOfDecompiledFunctions += scoreFile.get_size_of_functions() totalSizeOfDocumentedFunctions += scoreFile.get_size_of_documented_functions() @@ -169,7 +173,7 @@ def main(): adventureTwoPercentage = (totalSizeOfDocumentedFunctions / CODE_SIZE) * 100 scoreDisplay = ScoreDisplay() - print(scoreDisplay.getDisplay(adventureOnePercentage, adventureTwoPercentage, adventureSelect, totalNumberOfDecompiledFunctions, totalNumberOfGlobalAsms, totalNumberOfDocumentedFunctions, totalNumberOfFunctions - totalNumberOfDocumentedFunctions)) + print(scoreDisplay.getDisplay(adventureOnePercentage, adventureTwoPercentage, adventureSelect, totalNumberOfDecompiledFunctions, totalNumberOfGlobalAsms, totalNumberOfNonMatching, totalNumberOfDocumentedFunctions, totalNumberOfFunctions - totalNumberOfDocumentedFunctions)) if showTopFiles > 0: if showTopFiles > len(scoreFiles): diff --git a/tools/python/score_display.py b/tools/python/score_display.py index 5b3a35ba..4cc6c75b 100644 --- a/tools/python/score_display.py +++ b/tools/python/score_display.py @@ -106,7 +106,7 @@ class ScoreDisplay: out += self.makeLine(' ', dashLen, status['Msg']) return [out, dashLen] - def getDisplay(self, advOnePer, advTwoPer, showFlags=3, totalDecompFunctions=0, totalGlobalAsm=0, totalDocumented=0, totalUndocumented=0): + def getDisplay(self, advOnePer, advTwoPer, showFlags=3, totalDecompFunctions=0, totalGlobalAsm=0, totalNonMatching=0, totalDocumented=0, totalUndocumented=0): advOneStatus = self.getStatus(advOnePer) advTwoStatus = self.getStatus(advTwoPer) if showFlags == 3: @@ -129,6 +129,7 @@ class ScoreDisplay: out += self.makeLine('-', dashLen, '{:5.2f}% Complete'.format(advOnePer)) out += self.makeLine(' ', dashLen, '# Decompiled functions: ' + str(totalDecompFunctions)) out += self.makeLine(' ', dashLen, '# GLOBAL_ASM remaining: ' + str(totalGlobalAsm)) + out += self.makeLine(' ', dashLen, '# NON_MATCHING functions: ' + str(totalNonMatching)) out += advOneGameStatusDisplay[0] if showFlags & 2: out += self.makeLine('=', dashLen)