Cleanup for PR
This commit is contained in:
+1
-1
@@ -72,4 +72,4 @@ void card_object_set_selected(CardObject* card_object, bool selected);
|
|||||||
bool card_object_is_selected(CardObject* card_object);
|
bool card_object_is_selected(CardObject* card_object);
|
||||||
Sprite* card_object_get_sprite(CardObject* card_object);
|
Sprite* card_object_get_sprite(CardObject* card_object);
|
||||||
|
|
||||||
#endif // CARD_H
|
#endif // CARD_H
|
||||||
@@ -1,20 +1,29 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
POOL_DEF_FILE='./include/pools.def'
|
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'
|
READELF='/opt/devkitpro/devkitARM/bin/arm-none-eabi-readelf'
|
||||||
TOTAL_BYTES=0
|
TOTAL_BYTES=0
|
||||||
|
|
||||||
get_pool_names() {
|
if [ ! -f "$ELF_FILE" ]; then
|
||||||
grep POOL_ENTRY "$POOL_DEF_FILE" | sed -n 's@.*(\(.*\)).*@\1@p' | sed 's@,@@g' | cut -d ' ' -f 1
|
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() {
|
print_line_break() {
|
||||||
echo "--------------------------------------------------------------------"
|
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
|
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
|
print_line_break
|
||||||
|
|
||||||
for name in $(get_pool_names); do
|
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)"
|
pool_size="$(cut -d ' ' -f 3 <<< $output_pool)"
|
||||||
func_size="$(cut -d ' ' -f 3 <<< $output_func)"
|
func_size="$(cut -d ' ' -f 3 <<< $output_func)"
|
||||||
bm_size=16 #always gonna be 16, 4 * sizeof(u32)
|
bm_size=16 #always gonna be 16, 4 * sizeof(u32)
|
||||||
|
|
||||||
TOTAL_BYTES=$(( TOTAL_BYTES + pool_size + func_size + bm_size ))
|
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
|
done
|
||||||
|
|
||||||
print_line_break
|
print_line_break
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ static bool used_layers[MAX_JOKER_OBJECTS] = {false}; // Track used layers for j
|
|||||||
|
|
||||||
// Maps the spritesheet index to the palette bank index allocated to it.
|
// Maps the spritesheet index to the palette bank index allocated to it.
|
||||||
// Spritesheets that were not allocated are
|
// Spritesheets that were not allocated are
|
||||||
static int joker_spritesheet_pb_map[128];
|
static int joker_spritesheet_pb_map[MAX_SPRITES];
|
||||||
static int joker_pb_num_sprite_users[JOKER_LAST_PB - JOKER_BASE_PB + 1] = { 0 };
|
static int joker_pb_num_sprite_users[JOKER_LAST_PB - JOKER_BASE_PB + 1] = { 0 };
|
||||||
|
|
||||||
static int get_num_spritesheets()
|
static int get_num_spritesheets()
|
||||||
|
|||||||
+2
-3
@@ -5,7 +5,7 @@ void pool_bm_clear_idx(PoolBitmap *bm, int idx)
|
|||||||
// Divide by 32 to get the word index
|
// Divide by 32 to get the word index
|
||||||
u32 i = idx >> 5;
|
u32 i = idx >> 5;
|
||||||
// Get last 5-bits, same as a modulo (% 32) operation on positive numbers
|
// Get last 5-bits, same as a modulo (% 32) operation on positive numbers
|
||||||
u32 b = idx & 31;
|
u32 b = idx & 0x1F;
|
||||||
bm->w[i] &= ~((u32)1 << b);
|
bm->w[i] &= ~((u32)1 << b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ int pool_bm_get_free_idx(PoolBitmap *bm)
|
|||||||
{
|
{
|
||||||
u32 inv = ~bm->w[i];
|
u32 inv = ~bm->w[i];
|
||||||
|
|
||||||
// guard so we don't cal `ctz` with 0, since __builtin_ctz(0) is undefined
|
// guard so we don't call `ctz` with 0, since __builtin_ctz(0) is undefined
|
||||||
// https://gcc.gnu.org/onlinedocs/gcc/Bit-Operation-Builtins.html#index-_005f_005fbuiltin_005fctz
|
// https://gcc.gnu.org/onlinedocs/gcc/Bit-Operation-Builtins.html#index-_005f_005fbuiltin_005fctz
|
||||||
//
|
//
|
||||||
// By using the bitwise inverse of the word, you can skip words that are full
|
// By using the bitwise inverse of the word, you can skip words that are full
|
||||||
@@ -38,6 +38,5 @@ int pool_bm_get_free_idx(PoolBitmap *bm)
|
|||||||
|
|
||||||
#define POOL_ENTRY(name, capacity) \
|
#define POOL_ENTRY(name, capacity) \
|
||||||
POOL_DEFINE_TYPE(name, capacity);
|
POOL_DEFINE_TYPE(name, capacity);
|
||||||
#include "sprite.h"
|
|
||||||
#include "pools.def"
|
#include "pools.def"
|
||||||
#undef POOL_ENTRY
|
#undef POOL_ENTRY
|
||||||
|
|||||||
Reference in New Issue
Block a user