mirror of
https://github.com/pret/pmd-sky.git
synced 2026-09-11 21:07:58 -05:00
Decomp five leftover single-function asm files
Tenth cleanup sweep. Five asm files and their includes removed:
asm/overlay_29_0232CE7C.s DoMoveReviver
asm/overlay_29_02327940.s DoMoveRapidSpin
asm/overlay_29_022EFA74.s TryActivateIqBooster
asm/main_02027AA0.s sub_02027AA0
asm/main_020568DC.s sub_020568DC
All five merged into an adjacent source rather than splitting one. Four of the
five carry a region conditional, so all three ROMs were built; sub_020568DC is
the exception and US alone would have covered it.
TryActivateIqBooster sat at 60 with r6/r7/r8 rotated one place and every
differing row an r-marked register swap. Moving the IQ local's declaration ahead
of the other two takes it to 0. This contradicts the MATCHING_TIPS entry claiming
declaration order never moves callee-saved assignment; that measurement was on
SetLeaderAction's ~75 locals, where register pressure decides the colouring. On
four locals with no pressure, first-definition order is what is left.
DoMoveRapidSpin sets its return to 1 before the random-outcome call, so a failed
random check still returns TRUE. The early-return spelling scores 570; a result
variable set inside the damage branch scores 0.
sub_02027AA0's region difference is not an offset shift: JP writes slot 3 where
the others write slot 0 and vice versa, mirrored for the second case. The rodata
a few symbols away corroborates it -- _020AFD94 and _020AFD98 are defined in
swapped order under the same #ifdef.
sub_020568DC follows GetAppointedLeaderMemberIdx, which lives in the file it
merged into and is the same function specialised to the active team. The
(&t->number_active_team_members_main)[team] idiom is already used by three
existing files.
DoMoveReviver was on the stalled list from 4d2a484c but had never been attempted;
it was set aside for needing region-conditional C, which is one #define.
sub_020568DC and TryActivateIqBooster were likewise untried rather than stuck.
Authored by Claude (Opus 5) under human direction. All five verified at score 0.
Confirmed by matching builds of all three ROMs: US, EU and JP.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
#pragma once
|
||||
.public _020AFD4C
|
||||
.public _020AFD94
|
||||
.public _020AFD9C
|
||||
@@ -1,2 +0,0 @@
|
||||
#pragma once
|
||||
.public TEAM_MEMBER_TABLE_PTR
|
||||
@@ -1,4 +0,0 @@
|
||||
#pragma once
|
||||
.public BoostIQ
|
||||
.public DUNGEON_PTR
|
||||
.public TeamMemberHasItemActive
|
||||
@@ -1,4 +0,0 @@
|
||||
#pragma once
|
||||
.public DealDamage
|
||||
.public DungeonRandOutcomeUserAction
|
||||
.public RAPID_SPIN_BINDING_REMOVAL
|
||||
@@ -1,2 +0,0 @@
|
||||
#pragma once
|
||||
.public LogMessageByIdWithPopupCheckUserTarget
|
||||
@@ -1,37 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "main_02027AA0.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start sub_02027AA0
|
||||
sub_02027AA0: ; 0x02027AA0
|
||||
cmp r0, #1
|
||||
ldreq r0, _02027AE4 ; =_020AFD4C
|
||||
moveq r1, #1
|
||||
#ifdef JAPAN
|
||||
streqb r1, [r0, #3]
|
||||
#else
|
||||
streqb r1, [r0]
|
||||
#endif
|
||||
bxeq lr
|
||||
cmp r0, #2
|
||||
ldreq r0, _02027AE4 ; =_020AFD4C
|
||||
moveq r1, #1
|
||||
#ifdef JAPAN
|
||||
streqb r1, [r0]
|
||||
#else
|
||||
streqb r1, [r0, #3]
|
||||
#endif
|
||||
bxeq lr
|
||||
ldr r0, _02027AE8 ; =_020AFD9C
|
||||
ldr r1, _02027AEC ; =_020AFD94
|
||||
ldrh r0, [r0]
|
||||
mov r2, #1
|
||||
eor r0, r0, #1
|
||||
strb r2, [r1, r0]
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_02027AE4: .word _020AFD4C
|
||||
_02027AE8: .word _020AFD9C
|
||||
_02027AEC: .word _020AFD94
|
||||
arm_func_end sub_02027AA0
|
||||
@@ -1,23 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "main_020568DC.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start sub_020568DC
|
||||
sub_020568DC: ; 0x020568DC
|
||||
ldr r1, _02056910 ; =TEAM_MEMBER_TABLE_PTR
|
||||
mvn r3, #0
|
||||
ldr r2, [r1]
|
||||
add r1, r2, r0, lsl #1
|
||||
add r1, r1, #0x9800
|
||||
ldrsh r1, [r1, #0x50]
|
||||
cmp r1, r3
|
||||
addne r0, r2, r0, lsl #3
|
||||
addne r0, r0, r1, lsl #1
|
||||
addne r0, r0, #0x9800
|
||||
ldrnesh r3, [r0, #0x56]
|
||||
mov r0, r3
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_02056910: .word TEAM_MEMBER_TABLE_PTR
|
||||
arm_func_end sub_020568DC
|
||||
@@ -1,45 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "overlay_29_022EFA74.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start TryActivateIqBooster
|
||||
TryActivateIqBooster: ; 0x022EFA74
|
||||
stmdb sp!, {r4, r5, r6, r7, r8, lr}
|
||||
sub sp, sp, #0x10
|
||||
ldr r1, _022EFAE0 ; =DUNGEON_PTR
|
||||
ldr r0, _022EFAE4 ; =0x000286D0
|
||||
ldr r1, [r1]
|
||||
ldrsh r6, [r1, r0]
|
||||
cmp r6, #0
|
||||
ble _022EFAD8
|
||||
add r0, sp, #0
|
||||
mov r1, #0x44
|
||||
bl TeamMemberHasItemActive
|
||||
mov r7, r0
|
||||
cmp r7, #0
|
||||
ble _022EFAD8
|
||||
mov r8, #0
|
||||
add r5, sp, #0
|
||||
mov r4, r8
|
||||
b _022EFAD0
|
||||
_022EFABC:
|
||||
ldr r0, [r5, r8, lsl #2]
|
||||
mov r1, r6
|
||||
mov r2, r4
|
||||
bl BoostIQ
|
||||
add r8, r8, #1
|
||||
_022EFAD0:
|
||||
cmp r8, r7
|
||||
blt _022EFABC
|
||||
_022EFAD8:
|
||||
add sp, sp, #0x10
|
||||
ldmia sp!, {r4, r5, r6, r7, r8, pc}
|
||||
.align 2, 0
|
||||
_022EFAE0: .word DUNGEON_PTR
|
||||
#ifdef JAPAN
|
||||
_022EFAE4: .word 0x0002862C
|
||||
#else
|
||||
_022EFAE4: .word 0x000286D0
|
||||
#endif
|
||||
arm_func_end TryActivateIqBooster
|
||||
@@ -1,41 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "overlay_29_02327940.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start DoMoveRapidSpin
|
||||
DoMoveRapidSpin: ; 0x02327940
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
str r3, [sp]
|
||||
mov r3, #0x100
|
||||
mov r5, r0
|
||||
mov r4, #0
|
||||
bl DealDamage
|
||||
cmp r0, #0
|
||||
beq _023279A0
|
||||
mov r1, r4
|
||||
mov r0, r5
|
||||
mov r4, #1
|
||||
bl DungeonRandOutcomeUserAction
|
||||
cmp r0, #0
|
||||
beq _023279A0
|
||||
ldr r0, [r5, #0xb4]
|
||||
add r0, r0, #0x100
|
||||
#ifdef JAPAN
|
||||
ldrh r0, [r0, #0x8e]
|
||||
#else
|
||||
ldrh r0, [r0, #0x92]
|
||||
#endif
|
||||
tst r0, #2
|
||||
ldrne r0, _023279A8 ; =RAPID_SPIN_BINDING_REMOVAL
|
||||
movne r1, #0
|
||||
strneb r1, [r0]
|
||||
ldreq r0, _023279A8 ; =RAPID_SPIN_BINDING_REMOVAL
|
||||
moveq r1, r4
|
||||
streqb r1, [r0]
|
||||
_023279A0:
|
||||
mov r0, r4
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
.align 2, 0
|
||||
_023279A8: .word RAPID_SPIN_BINDING_REMOVAL
|
||||
arm_func_end DoMoveRapidSpin
|
||||
@@ -1,19 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "overlay_29_0232CE7C.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start DoMoveReviver
|
||||
DoMoveReviver: ; 0x0232CE7C
|
||||
stmdb sp!, {r3, lr}
|
||||
ldr r2, _0232CE90 ; =0x00000F09
|
||||
bl LogMessageByIdWithPopupCheckUserTarget
|
||||
mov r0, #0
|
||||
ldmia sp!, {r3, pc}
|
||||
.align 2, 0
|
||||
#ifdef JAPAN
|
||||
_0232CE90: .word 0x00000C4B
|
||||
#else
|
||||
_0232CE90: .word 0x00000F09
|
||||
#endif
|
||||
arm_func_end DoMoveReviver
|
||||
@@ -1,8 +1,11 @@
|
||||
#ifndef PMDSKY_MAIN_02027A80_H
|
||||
#define PMDSKY_MAIN_02027A80_H
|
||||
|
||||
#include "util.h"
|
||||
|
||||
void sub_02027A08(s32 window_id, s32 value);
|
||||
void SetScreenWindowsColor(s32 color, s32 screen);
|
||||
void SetBothScreensWindowsColor(s32 color);
|
||||
void sub_02027AA0(s32 a);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#ifndef PMDSKY_MAIN_020568A4_H
|
||||
#define PMDSKY_MAIN_020568A4_H
|
||||
|
||||
#include "util.h"
|
||||
|
||||
u32 GetAppointedLeaderMemberIdx(void);
|
||||
s16 sub_020568DC(s32 team);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
#ifndef PMDSKY_OVERLAY_29_022EFA6C_H
|
||||
#define PMDSKY_OVERLAY_29_022EFA6C_H
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include "dungeon_mode.h"
|
||||
#include "item.h"
|
||||
#include "move.h"
|
||||
|
||||
bool8 DebugRecruitingEnabled(u32 monster_id);
|
||||
void TryActivateIqBooster(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
#ifndef PMDSKY_OVERLAY_29_02327928_H
|
||||
#define PMDSKY_OVERLAY_29_02327928_H
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include "dungeon_mode.h"
|
||||
#include "item.h"
|
||||
#include "move.h"
|
||||
|
||||
bool8 DoMoveBoostSpeed1(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id);
|
||||
bool8 DoMoveRapidSpin(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
#ifndef PMDSKY_OVERLAY_29_0232CE40_H
|
||||
#define PMDSKY_OVERLAY_29_0232CE40_H
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include "dungeon_mode.h"
|
||||
#include "item.h"
|
||||
#include "move.h"
|
||||
|
||||
bool8 DoMoveHpGauge(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id);
|
||||
bool8 DoMoveVacuumCut(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id);
|
||||
bool8 DoMoveReviver(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id);
|
||||
|
||||
#endif
|
||||
|
||||
5
main.lsf
5
main.lsf
@@ -143,7 +143,6 @@ Static main
|
||||
Object src/main_020278A8.o
|
||||
Object asm/main_020278C4.o
|
||||
Object src/main_02027A80.o
|
||||
Object asm/main_02027AA0.o
|
||||
Object src/main_02027AF0.o
|
||||
Object asm/main_02027B88.o
|
||||
Object src/main_02028080.o
|
||||
@@ -292,7 +291,6 @@ Static main
|
||||
Object src/main_020564B0.o
|
||||
Object asm/main_02056504.o
|
||||
Object src/main_020568A4.o
|
||||
Object asm/main_020568DC.o
|
||||
Object src/main_02056914.o
|
||||
Object asm/main_02056960.o
|
||||
Object src/main_02056D70.o
|
||||
@@ -831,7 +829,6 @@ Overlay OVY_29
|
||||
Object src/dungeon_ai_movement.o
|
||||
Object asm/overlay_29_rodata_0235179C.o
|
||||
Object src/overlay_29_022EFA6C.o
|
||||
Object asm/overlay_29_022EFA74.o
|
||||
Object src/dungeon_logic_6.o
|
||||
Object asm/overlay_29_022EFB20.o
|
||||
Object src/overlay_29_022F0590.o
|
||||
@@ -1044,7 +1041,6 @@ Overlay OVY_29
|
||||
Object src/overlay_29_02327744.o
|
||||
Object asm/overlay_29_0232776C.o
|
||||
Object src/overlay_29_02327928.o
|
||||
Object asm/overlay_29_02327940.o
|
||||
Object src/overlay_29_023279AC.o
|
||||
Object asm/overlay_29_023279E4.o
|
||||
Object src/overlay_29_02327BE0.o
|
||||
@@ -1122,7 +1118,6 @@ Overlay OVY_29
|
||||
Object src/overlay_29_0232CD90.o
|
||||
Object asm/overlay_29_0232CDA4.o
|
||||
Object src/overlay_29_0232CE40.o
|
||||
Object asm/overlay_29_0232CE7C.o
|
||||
Object src/overlay_29_0232CE94.o
|
||||
Object asm/overlay_29_0232CEAC.o
|
||||
Object src/overlay_29_0232CF74.o
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#include "main_02027A80.h"
|
||||
#include "window.h"
|
||||
|
||||
extern u8 _020AFD94[];
|
||||
|
||||
extern u16 _020AFD9C;
|
||||
|
||||
extern u8 _020AFD98[2];
|
||||
|
||||
void sub_02027A08(s32 window_id, s32 value)
|
||||
@@ -31,3 +35,26 @@ void SetBothScreensWindowsColor(s32 color)
|
||||
SetScreenWindowsColor(color, 0);
|
||||
SetScreenWindowsColor(color, 1);
|
||||
}
|
||||
|
||||
void sub_02027AA0(s32 a)
|
||||
{
|
||||
if (a == 1) {
|
||||
#ifdef JAPAN
|
||||
_020AFD4C.field_0x0[3] = 1;
|
||||
#else
|
||||
_020AFD4C.field_0x0[0] = 1;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
if (a == 2) {
|
||||
#ifdef JAPAN
|
||||
_020AFD4C.field_0x0[0] = 1;
|
||||
#else
|
||||
_020AFD4C.field_0x0[3] = 1;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
_020AFD94[_020AFD9C ^ 1] = 1;
|
||||
}
|
||||
|
||||
@@ -12,3 +12,13 @@ u32 GetAppointedLeaderMemberIdx(void)
|
||||
}
|
||||
return t->active_roster_member_idxs[count];
|
||||
}
|
||||
|
||||
s16 sub_020568DC(s32 team)
|
||||
{
|
||||
struct team_member_table *t = TEAM_MEMBER_TABLE_PTR;
|
||||
s16 count = (&t->number_active_team_members_main)[team];
|
||||
if (count == -1) {
|
||||
return -1;
|
||||
}
|
||||
return t->active_team_roster_member_idxs[team][count];
|
||||
}
|
||||
|
||||
@@ -1,6 +1,35 @@
|
||||
#include "overlay_29_022EFA6C.h"
|
||||
#include "dungeon.h"
|
||||
|
||||
extern struct dungeon *DUNGEON_PTR[];
|
||||
|
||||
extern s32 TeamMemberHasItemActive(struct entity **buf, enum item_id item_id);
|
||||
|
||||
extern void BoostIQ(struct entity *entity, s16 iq, bool8 a);
|
||||
|
||||
bool8 DebugRecruitingEnabled(u32 monster_id)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TryActivateIqBooster(void)
|
||||
{
|
||||
struct entity *members[4];
|
||||
s16 iq;
|
||||
s32 n;
|
||||
s32 i;
|
||||
|
||||
iq = DUNGEON_PTR[0]->floor_properties.iq_booster_value;
|
||||
if (iq <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
n = TeamMemberHasItemActive(members, ITEM_IQ_BOOSTER);
|
||||
if (n <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
BoostIQ(members[i], iq, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
#include "overlay_29_02327928.h"
|
||||
#include "move_orb_effects.h"
|
||||
#include "dungeon_util_static.h"
|
||||
|
||||
extern s32 DealDamage(struct entity *attacker, struct entity *defender, struct move *move, s32 damageMultiplier, enum item_id item_id);
|
||||
|
||||
extern bool8 DungeonRandOutcomeUserAction(struct entity *user, s32 chance);
|
||||
|
||||
extern bool8 RAPID_SPIN_BINDING_REMOVAL;
|
||||
|
||||
bool8 DoMoveBoostSpeed1(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id)
|
||||
{
|
||||
@@ -7,3 +14,21 @@ bool8 DoMoveBoostSpeed1(struct entity* attacker, struct entity* defender, struct
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 DoMoveRapidSpin(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id)
|
||||
{
|
||||
bool8 result = FALSE;
|
||||
|
||||
if (DealDamage(attacker, defender, move, 0x100, item_id) != 0) {
|
||||
result = TRUE;
|
||||
if (DungeonRandOutcomeUserAction(attacker, 0)) {
|
||||
if (GetEntInfo(attacker)->contact_ability_trigger_bitflags & 2) {
|
||||
RAPID_SPIN_BINDING_REMOVAL = FALSE;
|
||||
} else {
|
||||
RAPID_SPIN_BINDING_REMOVAL = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
#include "overlay_29_0232CE40.h"
|
||||
|
||||
#ifdef JAPAN
|
||||
#define REVIVER_LOG_MESSAGE 0xC4B
|
||||
#else
|
||||
#define REVIVER_LOG_MESSAGE 0xF09
|
||||
#endif
|
||||
|
||||
|
||||
extern void LogMessageByIdWithPopupCheckUserTarget(struct entity *user, struct entity *target, u32 message_id);
|
||||
|
||||
extern s16 ov10_022C456C;
|
||||
|
||||
extern s32 ov29_02332F18(struct entity *attacker, struct entity *defender, struct move *move, s16 a, enum item_id item_id);
|
||||
@@ -17,3 +26,10 @@ bool8 DoMoveVacuumCut(struct entity* attacker, struct entity* defender, struct m
|
||||
{
|
||||
return ov29_02332F18(attacker, defender, move, ov10_022C456C, item_id) != 0;
|
||||
}
|
||||
|
||||
bool8 DoMoveReviver(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id)
|
||||
{
|
||||
LogMessageByIdWithPopupCheckUserTarget(attacker, defender, REVIVER_LOG_MESSAGE);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user