Cleanup for PR
This commit is contained in:
@@ -1,20 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
POOL_DEF_FILE='./include/pools.def'
|
||||
ELF_FILE='./build/balatro.elf'
|
||||
ELF_FILE="${1-./build/balatro-gba.elf}"
|
||||
READELF='/opt/devkitpro/devkitARM/bin/arm-none-eabi-readelf'
|
||||
TOTAL_BYTES=0
|
||||
|
||||
get_pool_names() {
|
||||
grep POOL_ENTRY "$POOL_DEF_FILE" | sed -n 's@.*(\(.*\)).*@\1@p' | sed 's@,@@g' | cut -d ' ' -f 1
|
||||
}
|
||||
if [ ! -f "$ELF_FILE" ]; then
|
||||
echo "elf file not found: $ELF_FILE"
|
||||
echo "You can pass your elf file with:"
|
||||
echo " $(basename $0) <file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
print_line_break() {
|
||||
echo "--------------------------------------------------------------------"
|
||||
}
|
||||
|
||||
get_pool_names() {
|
||||
grep POOL_ENTRY "$POOL_DEF_FILE" | sed -n 's@.*(\(.*\)).*@\1@p' | sed 's@,@@g' | cut -d ' ' -f 1
|
||||
}
|
||||
|
||||
print_line_break
|
||||
printf "%-16s| %-10s | %-10s | %-10s | %-10s \n" "Object" "location" "pool size" "func size" "bitmap size"
|
||||
printf "%-16s| %-10s | %-10s | %-10s | %-10s \n" "Object" "address" "pool size" "func size" "bitmap size"
|
||||
print_line_break
|
||||
|
||||
for name in $(get_pool_names); do
|
||||
@@ -34,14 +43,14 @@ for name in $(get_pool_names); do
|
||||
)"
|
||||
|
||||
|
||||
location="$(cut -d ' ' -f 2 <<< $output_pool)"
|
||||
address="$(cut -d ' ' -f 2 <<< $output_pool)"
|
||||
pool_size="$(cut -d ' ' -f 3 <<< $output_pool)"
|
||||
func_size="$(cut -d ' ' -f 3 <<< $output_func)"
|
||||
bm_size=16 #always gonna be 16, 4 * sizeof(u32)
|
||||
|
||||
TOTAL_BYTES=$(( TOTAL_BYTES + pool_size + func_size + bm_size ))
|
||||
|
||||
printf "%-16s| 0x%8s | %-10u | %-10u | %-10u \n" "$name" "$location" "$pool_size" "$func_size" "$bm_size"
|
||||
printf "%-16s| 0x%8s | %-10u | %-10u | %-10u \n" "$name" "$address" "$pool_size" "$func_size" "$bm_size"
|
||||
done
|
||||
|
||||
print_line_break
|
||||
|
||||
Reference in New Issue
Block a user