diff --git a/scripts/progress.py b/scripts/progress.py index 86e9bcfe0..2c274b8d7 100644 --- a/scripts/progress.py +++ b/scripts/progress.py @@ -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 @@ -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 @@ -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': diff --git a/src/game/bosses/boss_3.c b/src/game/bosses/boss_3.c index 9a80d6523..00ec9b1f8 100644 --- a/src/game/bosses/boss_3.c +++ b/src/game/bosses/boss_3.c @@ -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 *); diff --git a/src/game/bosses/boss_4.c b/src/game/bosses/boss_4.c index fa35153c3..669142a02 100644 --- a/src/game/bosses/boss_4.c +++ b/src/game/bosses/boss_4.c @@ -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); @@ -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; @@ -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; diff --git a/src/game/bosses/boss_7.c b/src/game/bosses/boss_7.c index b2608e0b5..b425a6a46 100644 --- a/src/game/bosses/boss_7.c +++ b/src/game/bosses/boss_7.c @@ -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); @@ -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; diff --git a/src/game/bosses/boss_8.c b/src/game/bosses/boss_8.c index e08d9ef37..7143dcc58 100644 --- a/src/game/bosses/boss_8.c +++ b/src/game/bosses/boss_8.c @@ -102,7 +102,7 @@ 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); @@ -110,10 +110,10 @@ 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); @@ -121,7 +121,7 @@ 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); @@ -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); @@ -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; @@ -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; @@ -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; @@ -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; diff --git a/src/game/interactables_1/rotating_handle.c b/src/game/interactables_1/rotating_handle.c index b87923fda..06aef3de4 100644 --- a/src/game/interactables_1/rotating_handle.c +++ b/src/game/interactables_1/rotating_handle.c @@ -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) { @@ -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; diff --git a/src/game/interactables_2/egg_utopia/cannon.c b/src/game/interactables_2/egg_utopia/cannon.c index b89ec98bd..c78b1cd80 100644 --- a/src/game/interactables_2/egg_utopia/cannon.c +++ b/src/game/interactables_2/egg_utopia/cannon.c @@ -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; diff --git a/src/game/sa1_sa2_shared/interactables/platform_thin.c b/src/game/sa1_sa2_shared/interactables/platform_thin.c index 676f34c8d..443219208 100644 --- a/src/game/sa1_sa2_shared/interactables/platform_thin.c +++ b/src/game/sa1_sa2_shared/interactables/platform_thin.c @@ -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] = { @@ -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); diff --git a/src/game/stage/intro.c b/src/game/stage/intro.c index 8c5b6d501..b69ad9777 100644 --- a/src/game/stage/intro.c +++ b/src/game/stage/intro.c @@ -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 *); diff --git a/src/game/stage/player_super_sonic.c b/src/game/stage/player_super_sonic.c index 992310d33..c6bfe2996 100644 --- a/src/game/stage/player_super_sonic.c +++ b/src/game/stage/player_super_sonic.c @@ -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); @@ -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;