From 65ab7d14ee6f53fed8453f2ff4adc617cb23333d Mon Sep 17 00:00:00 2001 From: tonyspumoni <94409037+tonyspumoni@users.noreply.github.com> Date: Fri, 10 Feb 2023 16:39:25 -0700 Subject: [PATCH] Score summary (#370) * update README with score summary * use spaces instead of tabs for markdown * one more newline so it looks good * test emsp * emsp seems good --- README.md | 10 +++++++++- tools/python/score.py | 7 ++++++- update-score.sh | 26 +++++++++++++++++++------- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 8a79d4ed..e563cddc 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,14 @@ This repo contains a work-in-progress decompilation of Diddy Kong Racing for the Currently, only the US 1.0 version of the game is supported. US 1.1, EU 1.0, EU 1.1, and JP are not supported at this time. + +As of February 10, 2023, this is our current score: + +    Decomp progress: 49.78% + +    Documentation progress: 23.09% + + --- ## Dependencies @@ -120,7 +128,7 @@ s32 is_drumstick_unlocked(void) { ``` -As of January 30, 2023, this is our current score: +As of February 10, 2023, this is our current score: ``` =================================================================== ADVENTURE ONE (ASM -> C Decompilation) diff --git a/tools/python/score.py b/tools/python/score.py index 59276460..d915c596 100644 --- a/tools/python/score.py +++ b/tools/python/score.py @@ -155,6 +155,7 @@ def main(): parser = argparse.ArgumentParser(description="") parser.add_argument("-t", "--top", help="(Optional) Shows the top N files remaining.") parser.add_argument("-a", "--adventure", help="(Optional) Only shows adventure 1 or 2 based on passed in value.", choices=['1', '2']) + parser.add_argument("-s", "--summary", help="(Optional) Only prints the percentages for adventure 1 and 2", action='store_true') args = parser.parse_args() adventureSelect = 3 # Show both adventures by default if args.adventure != None: @@ -213,6 +214,10 @@ def main(): adventureOnePercentage = (totalSizeOfDecompiledFunctions / CODE_SIZE) * 100 adventureTwoPercentage = (totalSizeOfDocumentedFunctions / (CODE_SIZE - ignoreSizeDocumentedFunctions)) * 100 + if args.summary: + print(f"Decomp progress: {adventureOnePercentage:5.2f}%") + print(f"Documentation progress: {adventureTwoPercentage:5.2f}%") + sys.exit(0) scoreDisplay = ScoreDisplay() print(scoreDisplay.getDisplay(adventureOnePercentage, adventureTwoPercentage, adventureSelect, totalNumberOfDecompiledFunctions, totalNumberOfGlobalAsms, totalNumberOfNonMatching, totalNumberOfNonEquivalent, totalNumberOfDocumentedFunctions, (totalNumberOfFunctions - ignoreNumberDocumentedFunctions) - totalNumberOfDocumentedFunctions)) @@ -233,4 +238,4 @@ def main(): print("", funcName, (" " * (24 - len(funcName))), "| {:5.2f}% | {:5.2f}% |".format(percentageRemaining, percentageDone)) -main() \ No newline at end of file +main() diff --git a/update-score.sh b/update-score.sh index 5df193f6..dac5a3c2 100755 --- a/update-score.sh +++ b/update-score.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash + export NEW_SCORE="$(python3 ./tools/python/score.py)" +export NEW_SCORE_SUMMARY="$(python3 ./tools/python/score.py --summary)" + python3 - <<'EOF' > README.md.tmp import sys import os @@ -8,14 +11,23 @@ from datetime import datetime BEGIN = '' END = '' +BEGIN_SUMMARY = '' +END_SUMMARY = '' DATE_STR = datetime.now().strftime('As of %B %-d, %Y, this is our current score:') -print( - re.sub( - fr'(?s).{BEGIN}.*{END}', - f'\n{BEGIN}\n{DATE_STR}\n```\n{os.environ["NEW_SCORE"]}\n```\n{END}', - open('README.md', 'r').read() - ), - end='' + +score_updated = re.sub( + fr'(?s).{BEGIN}.*{END}', + f'\n{BEGIN}\n{DATE_STR}\n```\n{os.environ["NEW_SCORE"]}\n```\n{END}', + open('README.md', 'r').read() ) + +tabbed_summary = '\n\n'.join([(' ' * 4) + line for line in os.environ["NEW_SCORE_SUMMARY"].split('\n')]) + +summary_updated = re.sub( + fr'(?s).{BEGIN_SUMMARY}.*{END_SUMMARY}', + f'\n{BEGIN_SUMMARY}\n{DATE_STR}\n\n{tabbed_summary}\n{END_SUMMARY}', + score_updated +) +print(summary_updated, end='') EOF mv README.md.tmp README.md