Skip to content

Commit

Permalink
Add decompilation progress
Browse files Browse the repository at this point in the history
  • Loading branch information
lhsazevedo committed Jul 17, 2024
1 parent 16f145e commit ddda814
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
[![Build](https://github.com/lhsazevedo/tokyo-bus-guide-decomp/actions/workflows/build.yml/badge.svg)](https://github.com/lhsazevedo/tokyo-bus-guide-decomp/actions/workflows/build.yml)
[![Build Matching](https://github.com/lhsazevedo/tokyo-bus-guide-decomp/actions/workflows/build_matching.yml/badge.svg)](https://github.com/lhsazevedo/tokyo-bus-guide-decomp/actions/workflows/build_matching.yml)

## Decompilation progress: 12.64%

![Main function hero](./tbg.png)

_Yup, [this is a real file](https://github.com/lhsazevedo/tokyo-bus-guide-decomp/blob/88fb8f87500f9474780cd9a0f7dafa00b14b0be7/src/010080_main.c)!_
Expand Down
33 changes: 33 additions & 0 deletions scripts/progress.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

LC_NUMERIC=C

matched_lines=$(grep -lE "SECTION\s+P" src/asm/matched/*.src | xargs cat | grep -vE ".IMPORT|.EXPORT" | wc -l)
decompiled_lines=$(grep -lE "SECTION\s+P" src/asm/decompiled/*.src | xargs cat | grep -vE ".IMPORT|.EXPORT" | wc -l)
remaining_lines=$(grep -lE "SECTION\s+P" src/asm/*.src | xargs cat | grep -vE ".IMPORT|.EXPORT" | wc -l)

decompiled_total=$((matched_lines + decompiled_lines))
total_lines=$((decompiled_total + remaining_lines))

if [ $total_lines -ne 0 ]; then
progress_percentage=$(echo "scale=4; $decompiled_total / $total_lines * 100" | bc)
progress_percentage=$(printf "%.2f" $progress_percentage)
else
progress_percentage=0
fi

echo "Matched lines: $matched_lines"
echo "Decompiled lines: $decompiled_lines"
echo "Decompiled total: $decompiled_total"
echo "Total lines: $total_lines"
echo "Progress percentage: $progress_percentage%"

# Update README file with progress
readme_file="README.md"

if grep -q "Decompilation Progress:" "$readme_file"; then
sed -i "s/Decompilation Progress: [0-9.]\+%/Decompilation progress: $progress_percentage%/" "$readme_file"
echo "README file updated with current progress."
else
echo "Progress not found in README file!"
fi

0 comments on commit ddda814

Please sign in to comment.