mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
Slightly improve progress messages in score display (#687)
* Slightly improve progress messages in score display * Add specific counts of undocumented functions * Roll back redundant calculations * More concise Trophy Race descriptions * Fix score locally
This commit is contained in:
@@ -7,9 +7,9 @@ All versions are supported, and the US 1.0 version (SHA1 = 0cb115d8716dbbc2922fd
|
||||
<!-- README_SCORE_SUMMARY_BEGIN -->
|
||||
As of July 20, 2025, this is our current score:
|
||||
|
||||
    Decomp progress: 96.63%
|
||||
    Decomp progress: 96.77%
|
||||
|
||||
    Documentation progress: 63.41%
|
||||
    Documentation progress: 63.57%
|
||||
<!-- README_SCORE_SUMMARY_END -->
|
||||
|
||||
---
|
||||
@@ -119,28 +119,30 @@ s32 is_drumstick_unlocked(void) {
|
||||
<!-- README_SCORE_BEGIN -->
|
||||
As of July 20, 2025, this is our current score:
|
||||
```
|
||||
=======================================================================
|
||||
ADVENTURE ONE (ASM -> C Decompilation)
|
||||
---------------- 96.63% Complete (97.63% NON_MATCHING) ----------------
|
||||
# Decompiled functions: 1941
|
||||
# GLOBAL_ASM remaining: 11
|
||||
# NON_MATCHING functions: 5
|
||||
# NON_EQUIVALENT WIP functions: 6
|
||||
----------------------------- Game Status -----------------------------
|
||||
Balloons: 46/47, Keys: 4/4, Trophies: 4/5
|
||||
T.T. Amulets: 4/4, Wizpig Amulets: 4/4
|
||||
-----------------------------------------------------------------------
|
||||
We are collecting silver coins in Star City. (6/8 silver coins)
|
||||
=======================================================================
|
||||
ADVENTURE TWO (Cleanup & Documentation)
|
||||
--------------------------- 63.41% Complete ---------------------------
|
||||
# Documented functions: 1241
|
||||
# Undocumented remaining: 411
|
||||
----------------------------- Game Status -----------------------------
|
||||
Balloons: 30/47, Keys: 3/4, Trophies: 2/5
|
||||
T.T. Amulets: 3/4, Wizpig Amulets: 3/4
|
||||
-----------------------------------------------------------------------
|
||||
We are participating in the Trophy Race of Sherbet Island. (Round Four)
|
||||
=======================================================================
|
||||
=============================================================================
|
||||
ADVENTURE ONE (ASM -> C Decompilation)
|
||||
------------------- 96.77% Complete (97.77% NON_MATCHING) -------------------
|
||||
# Decompiled functions: 1941
|
||||
# GLOBAL_ASM remaining: 11
|
||||
# NON_MATCHING functions: 5
|
||||
# NON_EQUIVALENT WIP functions: 6
|
||||
-------------------------------- Game Status --------------------------------
|
||||
Balloons: 46/47, Keys: 4/4, Trophies: 4/5
|
||||
T.T. Amulets: 4/4, Wizpig Amulets: 4/4
|
||||
-----------------------------------------------------------------------------
|
||||
We are collecting silver coins in Star City. (7/8 silver coins)
|
||||
=============================================================================
|
||||
ADVENTURE TWO (Cleanup & Documentation)
|
||||
------------------------------ 63.57% Complete ------------------------------
|
||||
# Documented functions: 1241
|
||||
# Undocumented remaining: 411
|
||||
# Functions named `func_*`: 250
|
||||
# Functions without comments: 411
|
||||
-------------------------------- Game Status --------------------------------
|
||||
Balloons: 30/47, Keys: 3/4, Trophies: 2/5
|
||||
T.T. Amulets: 3/4, Wizpig Amulets: 3/4
|
||||
-----------------------------------------------------------------------------
|
||||
We are participating in the Sherbet Island Trophy Race. (Round Four, Lap 3/3)
|
||||
=============================================================================
|
||||
```
|
||||
<!-- README_SCORE_END -->
|
||||
|
||||
+23
-2
@@ -123,7 +123,8 @@ class ScoreFileMatch:
|
||||
def __init__(self, comment, functionName):
|
||||
self.comment = comment
|
||||
self.functionName = functionName
|
||||
self.isDocumented = (comment != None) and not functionName.startswith("func_")
|
||||
self.isProperlyNamed = not functionName.startswith("func_")
|
||||
self.isDocumented = (comment != None) and self.isProperlyNamed
|
||||
if functionName in MAP_FILE.functionSizes:
|
||||
self.size = MAP_FILE.functionSizes[functionName]
|
||||
else:
|
||||
@@ -186,6 +187,20 @@ class ScoreFile:
|
||||
if func.isDocumented:
|
||||
count += 1
|
||||
return count
|
||||
|
||||
def get_number_of_properly_named_functions(self):
|
||||
count = 0
|
||||
for func in self.functions:
|
||||
if func.isProperlyNamed:
|
||||
count += 1
|
||||
return count
|
||||
|
||||
def get_number_of_functions_with_comments(self):
|
||||
count = 0
|
||||
for func in self.functions:
|
||||
if func.comment != None:
|
||||
count += 1
|
||||
return count
|
||||
|
||||
def get_size_of_functions(self):
|
||||
size = 0
|
||||
@@ -221,6 +236,8 @@ def main():
|
||||
scoreFiles = []
|
||||
totalNumberOfDecompiledFunctions = 0
|
||||
totalNumberOfDocumentedFunctions = 0
|
||||
totalNumberOfProperlyNamedFunctions = 0
|
||||
totalNumberOfCommentedFunctions = 0
|
||||
totalNumberOfGlobalAsms = 0
|
||||
totalNumberOfNonMatching = 0
|
||||
totalNumberOfNonEquivalent = 0
|
||||
@@ -245,6 +262,8 @@ def main():
|
||||
totalNumberOfNonMatching += scoreFile.numNonMatchings
|
||||
totalNumberOfNonEquivalent += scoreFile.numNonEquivalents
|
||||
totalNumberOfDocumentedFunctions += scoreFile.get_number_of_documented_functions()
|
||||
totalNumberOfCommentedFunctions += scoreFile.get_number_of_functions_with_comments()
|
||||
totalNumberOfProperlyNamedFunctions += scoreFile.get_number_of_properly_named_functions()
|
||||
totalSizeOfDecompiledFunctions += scoreFile.get_size_of_functions()
|
||||
totalSizeOfDecompiledAndNonMatchingFunctions += scoreFile.get_size_of_functions_with_nonmatching()
|
||||
totalSizeOfDocumentedFunctions += scoreFile.get_size_of_documented_functions()
|
||||
@@ -381,9 +400,11 @@ def main():
|
||||
# This will raise an error if writing fails
|
||||
fig.write_html(output_path)
|
||||
sys.exit(0)
|
||||
|
||||
displayedNumberOfDocumentedFunctions = totalNumberOfFunctions - ignoreNumberDocumentedFunctions
|
||||
|
||||
scoreDisplay = ScoreDisplay()
|
||||
print(scoreDisplay.getDisplay(adventureOnePercentage, adventureOnePercentageWithNonMatching, adventureTwoPercentage, adventureSelect, totalNumberOfDecompiledFunctions, totalNumberOfGlobalAsms, totalNumberOfNonMatching, totalNumberOfNonEquivalent, totalNumberOfDocumentedFunctions, (totalNumberOfFunctions - ignoreNumberDocumentedFunctions) - totalNumberOfDocumentedFunctions))
|
||||
print(scoreDisplay.getDisplay(adventureOnePercentage, adventureOnePercentageWithNonMatching, adventureTwoPercentage, adventureSelect, totalNumberOfDecompiledFunctions, totalNumberOfGlobalAsms, totalNumberOfNonMatching, totalNumberOfNonEquivalent, totalNumberOfDocumentedFunctions, displayedNumberOfDocumentedFunctions - totalNumberOfDocumentedFunctions, displayedNumberOfDocumentedFunctions - totalNumberOfProperlyNamedFunctions, displayedNumberOfDocumentedFunctions - totalNumberOfCommentedFunctions))
|
||||
|
||||
if showTopFiles > 0:
|
||||
if showTopFiles > len(scoreFiles):
|
||||
|
||||
@@ -13,6 +13,8 @@ TOTAL_NUMBER_OF_TROPHIES = 5
|
||||
|
||||
DEFAULT_MAX_LENGTH = 42
|
||||
|
||||
ROUND_NAMES = ['One', 'Two', 'Three', 'Four']
|
||||
|
||||
class ScoreDisplay:
|
||||
def __init__(self):
|
||||
self.progressNodes = readScoreDisplayJson()
|
||||
@@ -48,22 +50,15 @@ class ScoreDisplay:
|
||||
#if nodeType != 'Task':
|
||||
# out['Msg'] += '\n'
|
||||
if nodeType == 'Race':
|
||||
out['Msg'] += ' (Lap ' + str(int(currentNodeProgress*3)+1) + '/3)'
|
||||
out['Msg'] += f' (Lap {int(currentNodeProgress*3)+1}/3)'
|
||||
elif nodeType == 'Collecting':
|
||||
collectingName = self.progressNodes[numberOfCompletedNodes]['collecting']['name']
|
||||
collectingMax = self.progressNodes[numberOfCompletedNodes]['collecting']['max']
|
||||
out['Msg'] += ' (' + str(int(currentNodeProgress * collectingMax)) + '/' + str(collectingMax) + ' ' + collectingName + 's)'
|
||||
out['Msg'] += f' ({int(currentNodeProgress * collectingMax)}/{collectingMax} {collectingName}s)'
|
||||
elif nodeType == 'SilverCoinsRace':
|
||||
out['Msg'] += ' (' + str(int(currentNodeProgress*9)) + '/8 silver coins)'
|
||||
out['Msg'] += f' ({int(currentNodeProgress*9)}/8 silver coins)'
|
||||
elif nodeType == 'TrophyRace':
|
||||
if currentNodeProgress < 0.25:
|
||||
out['Msg'] += ' (Round One)'
|
||||
elif currentNodeProgress < 0.50:
|
||||
out['Msg'] += ' (Round Two)'
|
||||
elif currentNodeProgress < 0.75:
|
||||
out['Msg'] += ' (Round Three)'
|
||||
elif currentNodeProgress < 1.00:
|
||||
out['Msg'] += ' (Round Four)'
|
||||
out['Msg'] += f' (Round {ROUND_NAMES[int(min(currentNodeProgress, 1.0)*4)]}, Lap {int(currentNodeProgress*12)%3+1}/3)'
|
||||
elif nodeType == 'Battle':
|
||||
if currentNodeProgress < 0.34:
|
||||
out['Msg'] += ' (3 opponents remain)'
|
||||
@@ -107,7 +102,7 @@ class ScoreDisplay:
|
||||
out += self.makeLine(' ', dashLen, status['Msg'])
|
||||
return [out, dashLen]
|
||||
|
||||
def getDisplay(self, advOnePer, advOneNonMatchPer, advTwoPer, showFlags=3, totalDecompFunctions=0, totalGlobalAsm=0, totalNonMatching=0, totalNonEquivalent=0, totalDocumented=0, totalUndocumented=0):
|
||||
def getDisplay(self, advOnePer, advOneNonMatchPer, advTwoPer, showFlags=3, totalDecompFunctions=0, totalGlobalAsm=0, totalNonMatching=0, totalNonEquivalent=0, totalDocumented=0, totalUndocumented=0, totalNamedFunc=0, totalUncommented=0):
|
||||
advOneStatus = self.getStatus(advOnePer)
|
||||
advTwoStatus = self.getStatus(advTwoPer)
|
||||
if showFlags == 3:
|
||||
@@ -142,6 +137,8 @@ class ScoreDisplay:
|
||||
out += self.makeLine('-', dashLen, '{:5.2f}% Complete'.format(advTwoPer))
|
||||
out += self.makeLine(' ', dashLen, '# Documented functions: ' + str(totalDocumented))
|
||||
out += self.makeLine(' ', dashLen, '# Undocumented remaining: ' + str(totalUndocumented))
|
||||
out += self.makeLine(' ', dashLen, '# Functions named `func_*`: ' + str(totalNamedFunc))
|
||||
out += self.makeLine(' ', dashLen, '# Functions without comments: ' + str(totalUncommented))
|
||||
out += advTwoGameStatusDisplay[0]
|
||||
out += self.makeLine('=', dashLen)[:-1]
|
||||
return out
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
"type": "Task"
|
||||
},
|
||||
{
|
||||
"msg": "We are participating in the Trophy Race of Dino Domain.",
|
||||
"msg": "We are participating in the Dino Domain Trophy Race.",
|
||||
"rewards": { "Trophy": 1 },
|
||||
"type": "TrophyRace"
|
||||
},
|
||||
@@ -141,7 +141,7 @@
|
||||
"type": "Task"
|
||||
},
|
||||
{
|
||||
"msg": "We are participating in the Trophy Race of Snowflake Mountain.",
|
||||
"msg": "We are participating in the Snowflake Mountain Trophy Race.",
|
||||
"rewards": { "Trophy": 1 },
|
||||
"type": "TrophyRace"
|
||||
},
|
||||
@@ -206,7 +206,7 @@
|
||||
"type": "Race"
|
||||
},
|
||||
{
|
||||
"msg": "We are participating in the Trophy Race of Sherbet Island.",
|
||||
"msg": "We are participating in the Sherbet Island Trophy Race.",
|
||||
"rewards": { "Trophy": 1 },
|
||||
"type": "TrophyRace"
|
||||
},
|
||||
@@ -272,7 +272,7 @@
|
||||
"type": "Race"
|
||||
},
|
||||
{
|
||||
"msg": "We are participating in the Trophy Race of Dragon Forest.",
|
||||
"msg": "We are participating in the Dragon Forest Trophy Race.",
|
||||
"rewards": { "Trophy": 1 },
|
||||
"type": "TrophyRace"
|
||||
},
|
||||
@@ -327,7 +327,7 @@
|
||||
"type": "Race"
|
||||
},
|
||||
{
|
||||
"msg": "We are participating in the Trophy Race of Future Fun Land.",
|
||||
"msg": "We are participating in the Future Fun Land Trophy Race.",
|
||||
"rewards": {},
|
||||
"type": "TrophyRace"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user