Skip to content

Commit

Permalink
better matching progress value
Browse files Browse the repository at this point in the history
  • Loading branch information
freshollie committed Jan 10, 2025
1 parent f8065be commit bf240fd
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 30 deletions.
22 changes: 18 additions & 4 deletions scripts/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,22 @@ def collect_non_matching_funcs():
if file.endswith('.c'):
with open(os.path.join(root, file), 'r') as f:
data = f.read()
# Find all NONMATCH and ASM_FUNC macros
for match in re.findall(r'(NONMATCH|ASM_FUNC)\(".*",\W*\w*\W*(\w*).*\)', data):
result.append(match)
lines = data.split("\n")
for i in range(len(lines)):
line = lines[i]
if "NONMATCH" in line:
# if "unused" in line.lower():
# continue
matcher = r'(NONMATCH|ASM_FUNC)\(".*",\W*\w*\W*(\w*).*\)'
match = re.findall(matcher, line)
if match:
result.append(match[0])
else:
if i < len(lines) - 1:
line = lines[i + 1]
match = re.findall(r'\W*\w*\W*(\w*).*\)', line)
if match:
result.append(('NONMATCH', match[0]))
return result


Expand Down Expand Up @@ -75,6 +88,7 @@ def parse_map(non_matching_funcs):
if len(arr) == 2 and arr[1] != '': # It is actually a symbol

if prev_symbol in non_matching_funcs:
non_matching_funcs.remove(prev_symbol)
# Calculate the length for non matching function
non_matching += int(arr[0], 16) - prev_addr

Expand Down Expand Up @@ -141,7 +155,7 @@ def main():
"schemaVersion": 1,
"label": "progress" if not args.matching else "matching",
"message": f"{src_percent:.3g}%",
"color": 'yellow',
"color": 'yellow' if src_percent < 100 else "green",
}))

elif args.format == 'text':
Expand Down
4 changes: 2 additions & 2 deletions src/game/bosses/boss_3.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ static void sub_803F5E0(EggTotem *);
static void sub_803F698(EggTotem *);
static bool32 sub_803F878(EggTotem *totem);
static void sub_803FB88(EggTotem *);
static void sub_803FC14(EggTotem *);
static void sub_803FF44(EggTotem *);
void sub_803FC14(EggTotem *);
void sub_803FF44(EggTotem *);
static bool32 sub_8040B30(EggTotem *totem, u8 i);
static void sub_804063C(EggTotem *);
static void sub_80407A4(EggTotem *);
Expand Down
8 changes: 4 additions & 4 deletions src/game/bosses/boss_4.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ static void Task_AeroEggBombHitGround(void);
static void sub_8041B44(AeroEgg *boss);
static void sub_8041880(AeroEgg *boss);
static void sub_8041A08(AeroEgg *boss);
static void sub_8041D34(AeroEgg *boss);
void sub_8041D34(AeroEgg *boss);
static void AeroEgg_CreateBombIfReady(AeroEgg *boss);
static void AeroEgg_InitPartsDefeated(AeroEgg *boss);
void AeroEgg_InitPartsDefeated(AeroEgg *boss);
static bool32 sub_80423EC(AeroEgg *boss);
static void sub_80424EC(AeroEgg *boss);
static void sub_8042560(AeroEgg *boss);
Expand Down Expand Up @@ -485,7 +485,7 @@ static void AeroEgg_UpdateBossSpritesOnDefeat(AeroEgg *boss)
}

// (93.54%) https://decomp.me/scratch/PPILk
NONMATCH("asm/non_matching/game/bosses/boss_4__sub_8041D34.inc", static void sub_8041D34(AeroEgg *boss))
NONMATCH("asm/non_matching/game/bosses/boss_4__sub_8041D34.inc", void sub_8041D34(AeroEgg *boss))
{
ExplosionPartsInfo partsInfo;
s32 res;
Expand Down Expand Up @@ -619,7 +619,7 @@ NONMATCH("asm/non_matching/game/bosses/boss_4__sub_8041D34.inc", static void sub
END_NONMATCH

// (99.64%) https://decomp.me/scratch/WJcpn
NONMATCH("asm/non_matching/game/bosses/AeroEgg_InitPartsDefeated.inc", static void AeroEgg_InitPartsDefeated(AeroEgg *boss))
NONMATCH("asm/non_matching/game/bosses/AeroEgg_InitPartsDefeated.inc", void AeroEgg_InitPartsDefeated(AeroEgg *boss))
{
Sprite *s;
AeroEggSub *sub = &boss->sub;
Expand Down
4 changes: 2 additions & 2 deletions src/game/bosses/boss_7.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static void sub_8048654(EggFrog *);
static void sub_8048F44(void);
static void sub_8048D78(EggFrog *);
static void sub_804928C(EggFrog *);
static bool8 sub_8048C7C(EggFrog *);
bool8 sub_8048C7C(EggFrog *);
static void sub_80493F8(EggFrog *, s32 x, s32 y, u8);
static void sub_804920C(EggFrog *);
static void sub_80494EC(void);
Expand Down Expand Up @@ -842,7 +842,7 @@ static void sub_8048BF0(EggFrog *boss)

// https://decomp.me/scratch/aDy46
// 98.5%, some register hacks get it very close. All instructions match
NONMATCH("asm/non_matching/game/bosses/boss_7__sub_8048C7C.inc", static bool8 sub_8048C7C(EggFrog *boss))
NONMATCH("asm/non_matching/game/bosses/boss_7__sub_8048C7C.inc", bool8 sub_8048C7C(EggFrog *boss))
{
const u16 **unk60 = (void *)boss->unk60;
s16 *unk28 = boss->unk28;
Expand Down
18 changes: 9 additions & 9 deletions src/game/bosses/boss_8.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,26 +102,26 @@ static void TaskDestructor_SuperEggRoboZMain(struct Task *);
static void Task_BossRunManagerMain(void);
static void TaskDestructor_BossRunManager(struct Task *);

static void Task_804AB24(void);
void Task_804AB24(void);
static void Task_804AD68(void);
static u8 sub_804B0EC(SuperEggRoboZ *boss, u8 arm);
static void sub_804B43C(SuperEggRoboZ *boss, u8 p1);
static void sub_804B594(SuperEggRoboZ *boss, u8 p1);
static void sub_804B734(SuperEggRoboZ *boss, u8 p1);
static void sub_804B984(SuperEggRoboZ *boss, u8 p1);
static void sub_804BAC0(SuperEggRoboZ *boss, u8 p1);
static void sub_804BC44(SuperEggRoboZ *boss, u8 p1);
void sub_804BC44(SuperEggRoboZ *boss, u8 p1);
static void sub_804BE6C(SuperEggRoboZ *boss, u8 p1);
static void sub_804C080(SuperEggRoboZ *boss);
static void sub_804C240(SuperEggRoboZ *boss, u8 p1);
void sub_804C240(SuperEggRoboZ *boss, u8 p1);
static void sub_804C3AC(SuperEggRoboZ *boss);
static void sub_804C5B8(SuperEggRoboZ *boss);
static void sub_804C830(SuperEggRoboZ *boss);
static void sub_804CA08(SuperEggRoboZ *boss);
static void sub_804CA70(SuperEggRoboZ *boss);
static void Task_ShowResultsAndDelete(void);
static void sub_804CC98(SuperEggRoboZ *boss);
static void sub_804AE40(SuperEggRoboZ *boss);
void sub_804AE40(SuperEggRoboZ *boss);
static void Boss8_HitCockpit(SuperEggRoboZ *boss);
static void sub_804C8F4(SuperEggRoboZ *boss);
static void sub_804CCD0(SuperEggRoboZ *boss, s32 qP1);
Expand Down Expand Up @@ -891,7 +891,7 @@ static void Task_804A9D8(void)
}

// (99.89%) https://decomp.me/scratch/kiah8
NONMATCH("asm/non_matching/game/bosses/boss_8__Task_804AB24.inc", static void Task_804AB24(void))
NONMATCH("asm/non_matching/game/bosses/boss_8__Task_804AB24.inc", void Task_804AB24(void))
{
s32 speed;
SuperEggRoboZ *boss = TASK_DATA(gCurTask);
Expand Down Expand Up @@ -1020,7 +1020,7 @@ static void Task_804AD68(void)
// (95.06%) https://decomp.me/scratch/of4k0
// (98.77%) https://decomp.me/scratch/Kzx1m
// (99.59%) https://decomp.me/scratch/IzRyM
NONMATCH("asm/non_matching/game/bosses/boss_8__sub_804AE40.inc", static void sub_804AE40(SuperEggRoboZ *boss))
NONMATCH("asm/non_matching/game/bosses/boss_8__sub_804AE40.inc", void sub_804AE40(SuperEggRoboZ *boss))
{
Sprite *s;

Expand Down Expand Up @@ -1260,7 +1260,7 @@ static u8 sub_804B0EC(SuperEggRoboZ *boss, u8 arm)
// ...
// }
// (93.51%) https://decomp.me/scratch/ecqNB
NONMATCH("asm/non_matching/game/bosses/boss_8__sub_804B2EC.inc", static bool8 sub_804B2EC(SuperEggRoboZ *boss, u8 arm))
NONMATCH("asm/non_matching/game/bosses/boss_8__sub_804B2EC.inc", bool8 sub_804B2EC(SuperEggRoboZ *boss, u8 arm))
{
u8 result = 0;
s32 sp04, ip;
Expand Down Expand Up @@ -1518,7 +1518,7 @@ static void sub_804BAC0(SuperEggRoboZ *boss, u8 arm)
}

// (81.31%) https://decomp.me/scratch/432q4
NONMATCH("asm/non_matching/game/bosses/boss_8__sub_804BC44.inc", static void sub_804BC44(SuperEggRoboZ *boss, u8 arm))
NONMATCH("asm/non_matching/game/bosses/boss_8__sub_804BC44.inc", void sub_804BC44(SuperEggRoboZ *boss, u8 arm))
{
ExplosionPartsInfo info;
s32 speed0;
Expand Down Expand Up @@ -1683,7 +1683,7 @@ static void sub_804C080(SuperEggRoboZ *boss)
}

// (87.37%) https://decomp.me/scratch/98Mjg
NONMATCH("asm/non_matching/game/bosses/boss_8__sub_804C240.inc", static void sub_804C240(SuperEggRoboZ *boss, u8 arm))
NONMATCH("asm/non_matching/game/bosses/boss_8__sub_804C240.inc", void sub_804C240(SuperEggRoboZ *boss, u8 arm))
{
ExplosionPartsInfo info;
s32 x, y;
Expand Down
4 changes: 2 additions & 2 deletions src/game/interactables_1/rotating_handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ typedef struct {

static void Task_AfterJump(void);
static void Task_Idle(void);
static void Task_Rotating(void);
void Task_Rotating(void);

void CreateEntity_RotatingHandle(MapEntity *me, u16 spriteRegionX, u16 spriteRegionY, u8 spriteY)
{
Expand Down Expand Up @@ -145,7 +145,7 @@ static void Task_Idle(void)
}

// (95.52%) https://decomp.me/scratch/RaPDV
NONMATCH("asm/non_matching/game/interactables_1/Task_Rotating.inc", static void Task_Rotating())
NONMATCH("asm/non_matching/game/interactables_1/Task_Rotating.inc", void Task_Rotating())
{
Sprite_RotatingHandle *rotatingHandle = TASK_DATA(gCurTask);
Sprite *s = &rotatingHandle->s;
Expand Down
2 changes: 1 addition & 1 deletion src/game/interactables_2/egg_utopia/cannon.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ static void sub_807E5F0(Sprite_Cannon *cannon)
// (68.07%) https://decomp.me/scratch/TDVLh
// (72.09%) https://decomp.me/scratch/sgt5z
// (87.28%) https://decomp.me/scratch/pAFRx
NONMATCH("asm/non_matching/game/interactables_2/egg_utopia/sub_807E66C.inc", static bool32 sub_807E66C(Sprite_Cannon *cannon))
NONMATCH("asm/non_matching/game/interactables_2/egg_utopia/sub_807E66C.inc", bool32 sub_807E66C(Sprite_Cannon *cannon))
{
s16 x;
s16 y;
Expand Down
4 changes: 2 additions & 2 deletions src/game/sa1_sa2_shared/interactables/platform_thin.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static void TaskDestructor_PlatformThin(struct Task *);
static void Task_PlatformBreakParticlesMain(void);
static void TaskDestructor_PlatformBreakParticles(struct Task *);

static void CreatePlatformBreakParticles(s16, s16);
void CreatePlatformBreakParticles(s16, s16);
static u32 sub_80111F0(Sprite *, s32, s32, Player *);

static const ALIGNED(4) u16 sPlatformThinAnimations[][3] = {
Expand Down Expand Up @@ -211,7 +211,7 @@ static void Task_PlatformThinMain(void)
}
// (95.35%) https://decomp.me/scratch/8xD3v
NONMATCH("asm/non_matching/game/sa1_sa2_shared/interactables/CreatePlatformBreakParticles.inc",
static void CreatePlatformBreakParticles(s16 x, s16 y))
void CreatePlatformBreakParticles(s16 x, s16 y))
{
struct Task *t = TaskCreate(Task_PlatformBreakParticlesMain, sizeof(Platform_D1C), 0x2011, 0, TaskDestructor_PlatformBreakParticles);
Platform_D1C *platform = TASK_DATA(t);
Expand Down
4 changes: 2 additions & 2 deletions src/game/stage/intro.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ typedef struct {
} IntroActLetters; /* size: 0xC4 */

static void Task_IntroControllerMain(void);
static void Task_802F9F8(void);
void Task_802F9F8(void);
static void Task_IntroColorAnimation(void);
static void Task_IntroZoneNameAndIconAnimations(void);
void Task_IntroZoneNameAndIconAnimations(void);
static void Task_IntroActLettersAnimations(void);
static void Task_UpdateStageLoadingScreen(void);
static void TaskDestructor_IntroController(struct Task *);
Expand Down
4 changes: 2 additions & 2 deletions src/game/stage/player_super_sonic.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static void sub_802C8A0(struct SuperSonic *sonic);
static void sub_802C8EC(struct SuperSonic *);
static void sub_802C92C(struct SuperSonic *sonic);
static void sub_802C9B0(struct SuperSonic *sonic);
static void sub_802BCCC(struct SuperSonic *sonic);
void sub_802BCCC(struct SuperSonic *sonic);
static u8 SuperSonicHandleDirectionalInput(struct SuperSonic *sonic);
static void sub_802C058(struct SuperSonic *sonic);
static void sub_802C988(struct SuperSonic *sonic);
Expand Down Expand Up @@ -343,7 +343,7 @@ static void Task_802BC10(void)
}

// (99.25%) https://decomp.me/scratch/2dbbE
NONMATCH("asm/non_matching/game/super_sonic__sub_802BCCC.inc", static void sub_802BCCC(struct SuperSonic *sonic))
NONMATCH("asm/non_matching/game/super_sonic__sub_802BCCC.inc", void sub_802BCCC(struct SuperSonic *sonic))
{
s32 ssx, ssx2;
u8 i;
Expand Down

0 comments on commit bf240fd

Please sign in to comment.