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
This commit is contained in:
tonyspumoni
2023-02-10 16:39:25 -07:00
committed by GitHub
parent 555f7ce0ae
commit 65ab7d14ee
3 changed files with 34 additions and 9 deletions
+9 -1
View File
@@ -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.
<!-- README_SCORE_SUMMARY_BEGIN -->
As of February 10, 2023, this is our current score:
&emsp;&emsp;&emsp;&emsp;Decomp progress: 49.78%
&emsp;&emsp;&emsp;&emsp;Documentation progress: 23.09%
<!-- README_SCORE_SUMMARY_END -->
---
## Dependencies
@@ -120,7 +128,7 @@ s32 is_drumstick_unlocked(void) {
```
<!-- README_SCORE_BEGIN -->
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)
+6 -1
View File
@@ -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()
main()
+19 -7
View File
@@ -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 = '<!-- README_SCORE_BEGIN -->'
END = '<!-- README_SCORE_END -->'
BEGIN_SUMMARY = '<!-- README_SCORE_SUMMARY_BEGIN -->'
END_SUMMARY = '<!-- README_SCORE_SUMMARY_END -->'
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([('&emsp;' * 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