mirror of
https://github.com/pret/pmd-sky.git
synced 2026-08-20 09:34:33 -05:00
Decomp five more leftover single-function asm files
Fifth cleanup sweep; five more asm files and their includes removed: asm/overlay_29_023491C4.s IsOutlawOrChallengeRequestFloor asm/main_0202AAE8.s sub_0202AAE8 asm/main_0202BC60.s sub_0202BC60 asm/overlay_29_023261A0.s DoMoveBubble asm/main_0205BCC4.s sub_0205BCC4 sub_0202AAE8 and sub_0202BC60 are the same function over different window states: check unk_0202AAA8::field_0x19C against a set, then set two flags, clear field_0x1A4, call sub_0202830C with -5 and advance the state. Both write a byte at 0x1A1 that the struct covered only as padding after field_0x1A0, so that gap is now named field_0x1A1 with field_0x1A2[2] holding the remainder -- same total size. Three spellings that mattered: - IsOutlawOrChallengeRequestFloor is three ORed predicates and only matches with each operand written `!= 0`; a plain || scores 300 and early returns 1300. - DoMoveBubble returns whether damage was dealt, not whether the speed drop landed, so the result is funnelled through one variable which is also passed as LowerSpeed's stage count. - sub_0205BCC4 must not hoist the destination pointer above its NULL check; a local shared by both branches scores 830, one declared inside the else branch matches. Authored by Claude (Opus 5) under human direction. All five verified at score 0. Confirmed by a matching build: build/pmdsky.us/pmdsky.us.nds: OK. None carries a region conditional, so US alone is sufficient. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
#pragma once
|
||||
.public GetWindowContents
|
||||
.public sub_0202830C
|
||||
@@ -1,3 +0,0 @@
|
||||
#pragma once
|
||||
.public GetWindowContents
|
||||
.public sub_0202830C
|
||||
@@ -1,3 +0,0 @@
|
||||
#pragma once
|
||||
.public _020B0A54
|
||||
.public MemsetSimple
|
||||
@@ -1,5 +0,0 @@
|
||||
#pragma once
|
||||
.public BUBBLE_LOWER_SPEED_CHANCE
|
||||
.public DealDamage
|
||||
.public DungeonRandOutcomeUserTargetInteraction
|
||||
.public LowerSpeed
|
||||
@@ -1,2 +0,0 @@
|
||||
#pragma once
|
||||
.public IsCurrentMissionType
|
||||
@@ -1,30 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "main_0202AAE8.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start sub_0202AAE8
|
||||
sub_0202AAE8: ; 0x0202AAE8
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
mov r5, r0
|
||||
bl GetWindowContents
|
||||
mov r4, r0
|
||||
ldr r0, [r4, #0x19c]
|
||||
cmp r0, #4
|
||||
cmpne r0, #5
|
||||
cmpne r0, #9
|
||||
movne r0, #0
|
||||
ldmneia sp!, {r3, r4, r5, pc}
|
||||
mov r0, #1
|
||||
strb r0, [r4, #0x1a0]
|
||||
mov r2, #0
|
||||
strb r0, [r4, #0x1a1]
|
||||
mov r0, r5
|
||||
sub r1, r2, #5
|
||||
str r2, [r4, #0x1a4]
|
||||
bl sub_0202830C
|
||||
mov r0, #7
|
||||
str r0, [r4, #0x19c]
|
||||
mov r0, #1
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
arm_func_end sub_0202AAE8
|
||||
@@ -1,31 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "main_0202BC60.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start sub_0202BC60
|
||||
sub_0202BC60: ; 0x0202BC60
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
mov r5, r0
|
||||
bl GetWindowContents
|
||||
mov r4, r0
|
||||
ldr r0, [r4, #0x19c]
|
||||
cmp r0, #3
|
||||
cmpne r0, #4
|
||||
cmpne r0, #0xa
|
||||
cmpne r0, #8
|
||||
movne r0, #0
|
||||
ldmneia sp!, {r3, r4, r5, pc}
|
||||
mov r0, #1
|
||||
strb r0, [r4, #0x1a0]
|
||||
mov r2, #0
|
||||
strb r0, [r4, #0x1a1]
|
||||
mov r0, r5
|
||||
sub r1, r2, #5
|
||||
str r2, [r4, #0x1a4]
|
||||
bl sub_0202830C
|
||||
mov r0, #6
|
||||
str r0, [r4, #0x19c]
|
||||
mov r0, #1
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
arm_func_end sub_0202BC60
|
||||
@@ -1,30 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "main_0205BCC4.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start sub_0205BCC4
|
||||
sub_0205BCC4: ; 0x0205BCC4
|
||||
stmdb sp!, {r3, lr}
|
||||
cmp r0, #0
|
||||
bne _0205BCEC
|
||||
ldr r0, _0205BD10 ; =_020B0A54
|
||||
mov r1, #0
|
||||
ldr r0, [r0, #8]
|
||||
mov r2, #6
|
||||
add r0, r0, #0x44
|
||||
bl MemsetSimple
|
||||
ldmia sp!, {r3, pc}
|
||||
_0205BCEC:
|
||||
ldr r1, _0205BD10 ; =_020B0A54
|
||||
ldrh r2, [r0]
|
||||
ldr r3, [r1, #8]
|
||||
strh r2, [r3, #0x44]
|
||||
ldrh r1, [r0, #2]
|
||||
strh r1, [r3, #0x46]
|
||||
ldrh r0, [r0, #4]
|
||||
strh r0, [r3, #0x48]
|
||||
ldmia sp!, {r3, pc}
|
||||
.align 2, 0
|
||||
_0205BD10: .word _020B0A54
|
||||
arm_func_end sub_0205BCC4
|
||||
@@ -1,37 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "overlay_29_023261A0.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start DoMoveBubble
|
||||
DoMoveBubble: ; 0x023261A0
|
||||
stmdb sp!, {r3, r4, r5, r6, lr}
|
||||
sub sp, sp, #4
|
||||
str r3, [sp]
|
||||
mov r3, #0x100
|
||||
mov r6, r0
|
||||
mov r5, r1
|
||||
mov r4, #0
|
||||
bl DealDamage
|
||||
cmp r0, #0
|
||||
beq _023261FC
|
||||
ldr r1, _02326208 ; =BUBBLE_LOWER_SPEED_CHANCE
|
||||
mov r0, r6
|
||||
ldrsh r2, [r1]
|
||||
mov r1, r5
|
||||
mov r4, #1
|
||||
bl DungeonRandOutcomeUserTargetInteraction
|
||||
cmp r0, #0
|
||||
beq _023261FC
|
||||
mov r0, r6
|
||||
mov r1, r5
|
||||
mov r2, r4
|
||||
mov r3, #0
|
||||
bl LowerSpeed
|
||||
_023261FC:
|
||||
mov r0, r4
|
||||
add sp, sp, #4
|
||||
ldmia sp!, {r3, r4, r5, r6, pc}
|
||||
.align 2, 0
|
||||
_02326208: .word BUBBLE_LOWER_SPEED_CHANCE
|
||||
arm_func_end DoMoveBubble
|
||||
@@ -1,27 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "overlay_29_023491C4.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start IsOutlawOrChallengeRequestFloor
|
||||
IsOutlawOrChallengeRequestFloor: ; 0x023491C4
|
||||
stmdb sp!, {r3, lr}
|
||||
mov r0, #0xb
|
||||
bl IsCurrentMissionType
|
||||
cmp r0, #0
|
||||
bne _023491F8
|
||||
mov r0, #0xa
|
||||
bl IsCurrentMissionType
|
||||
cmp r0, #0
|
||||
bne _023491F8
|
||||
mov r0, #9
|
||||
bl IsCurrentMissionType
|
||||
cmp r0, #0
|
||||
beq _02349200
|
||||
_023491F8:
|
||||
mov r0, #1
|
||||
ldmia sp!, {r3, pc}
|
||||
_02349200:
|
||||
mov r0, #0
|
||||
ldmia sp!, {r3, pc}
|
||||
arm_func_end IsOutlawOrChallengeRequestFloor
|
||||
@@ -15,6 +15,8 @@ struct unk_0202AAA8 {
|
||||
void *field_0x198;
|
||||
s32 field_0x19C;
|
||||
u8 field_0x1A0;
|
||||
u8 field_0x1A1;
|
||||
u8 field_0x1A2[2];
|
||||
s32 field_0x1A4;
|
||||
u8 field_0x1A8[4];
|
||||
s32 field_0x1AC;
|
||||
@@ -31,5 +33,6 @@ void *GetWindowContents(s32 window_id);
|
||||
|
||||
void SetParentMenuState7(s32 window_id);
|
||||
void CloseParentMenu(s32 window_id);
|
||||
bool8 sub_0202AAE8(s32 window_id);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#ifndef PMDSKY_MAIN_0202BC44_H
|
||||
#define PMDSKY_MAIN_0202BC44_H
|
||||
|
||||
#include "util.h"
|
||||
|
||||
void CloseAdvancedMenu(s32 window_id);
|
||||
bool8 sub_0202BC60(s32 window_id);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef PMDSKY_MAIN_0205BBFC_H
|
||||
#define PMDSKY_MAIN_0205BBFC_H
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct unkStruct_0205BC94 {
|
||||
@@ -12,5 +14,6 @@ struct unkStruct_0205BC94 {
|
||||
void sub_0205BBFC(struct ground_monster *dest);
|
||||
void sub_0205BC30(u32 a, u32 b);
|
||||
void sub_0205BC94(struct unkStruct_0205BC94 *p);
|
||||
void sub_0205BCC4(u16* src);
|
||||
|
||||
#endif //PMDSKY_MAIN_0205BBFC_H
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
#ifndef PMDSKY_OVERLAY_29_02326188_H
|
||||
#define PMDSKY_OVERLAY_29_02326188_H
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include "dungeon_mode.h"
|
||||
#include "item.h"
|
||||
#include "move.h"
|
||||
|
||||
bool8 DoMoveHealStatus(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id);
|
||||
bool8 DoMoveBubble(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,5 +7,6 @@
|
||||
void ov29_02349188(void);
|
||||
struct mission_destination_info* GetMissionDestination(void);
|
||||
s32 ov29_023491B8(void);
|
||||
bool8 IsOutlawOrChallengeRequestFloor(void);
|
||||
|
||||
#endif
|
||||
|
||||
5
main.lsf
5
main.lsf
@@ -164,7 +164,6 @@ Static main
|
||||
Object src/main_0202A66C.o
|
||||
Object asm/main_0202A690.o
|
||||
Object src/main_0202AAA8.o
|
||||
Object asm/main_0202AAE8.o
|
||||
Object src/main_0202AB40.o
|
||||
Object asm/main_0202AB94.o
|
||||
Object src/main_0202B4C4.o
|
||||
@@ -174,7 +173,6 @@ Static main
|
||||
Object src/main_0202BA0C.o
|
||||
Object asm/main_0202BA20.o
|
||||
Object src/main_0202BC44.o
|
||||
Object asm/main_0202BC60.o
|
||||
Object src/main_0202BCBC.o
|
||||
Object src/main_0202BCFC.o
|
||||
Object asm/main_0202BD10.o
|
||||
@@ -340,7 +338,6 @@ Static main
|
||||
Object src/main_0205B9C8.o
|
||||
Object asm/main_0205BA0C.o
|
||||
Object src/main_0205BBFC.o
|
||||
Object asm/main_0205BCC4.o
|
||||
Object src/main_0205BD14.o
|
||||
Object asm/main_0205C2A4.o
|
||||
Object src/main_0205C440.o
|
||||
@@ -1036,7 +1033,6 @@ Overlay OVY_29
|
||||
Object src/overlay_29_02326088.o
|
||||
Object asm/overlay_29_023260D0.o
|
||||
Object src/overlay_29_02326188.o
|
||||
Object asm/overlay_29_023261A0.o
|
||||
Object src/overlay_29_0232620C.o
|
||||
Object asm/overlay_29_02326220.o
|
||||
Object src/overlay_29_02326550.o
|
||||
@@ -1230,7 +1226,6 @@ Overlay OVY_29
|
||||
Object src/overlay_29_02348D00.o
|
||||
Object asm/overlay_29_02348D3C.o
|
||||
Object src/overlay_29_02349188.o
|
||||
Object asm/overlay_29_023491C4.o
|
||||
Object src/overlay_29_02349208.o
|
||||
Object asm/overlay_29_0234921C.o
|
||||
Object src/overlay_29_0234928C.o
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include "main_0202AAA8.h"
|
||||
#include "main_020282F4.h"
|
||||
#include "main_02028080.h"
|
||||
#include "main_02001188.h"
|
||||
|
||||
void SetParentMenuState7(s32 window_id)
|
||||
@@ -16,3 +18,20 @@ void CloseParentMenu(s32 window_id)
|
||||
MemFree(menu);
|
||||
DeleteWindow(window_id);
|
||||
}
|
||||
|
||||
bool8 sub_0202AAE8(s32 window_id)
|
||||
{
|
||||
struct unk_0202AAA8 *w = GetWindowContents(window_id);
|
||||
|
||||
if (w->field_0x19C != 4 && w->field_0x19C != 5 && w->field_0x19C != 9) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
w->field_0x1A0 = TRUE;
|
||||
w->field_0x1A1 = TRUE;
|
||||
w->field_0x1A4 = 0;
|
||||
sub_0202830C(window_id, -5);
|
||||
w->field_0x19C = 7;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include "main_0202BC44.h"
|
||||
#include "main_020282F4.h"
|
||||
#include "main_02028080.h"
|
||||
#include "main_0202AAA8.h"
|
||||
#include "main_02001188.h"
|
||||
|
||||
@@ -7,3 +9,20 @@ void CloseAdvancedMenu(s32 window_id)
|
||||
MemFree(GetWindowContents(window_id));
|
||||
DeleteWindow(window_id);
|
||||
}
|
||||
|
||||
bool8 sub_0202BC60(s32 window_id)
|
||||
{
|
||||
struct unk_0202AAA8 *w = GetWindowContents(window_id);
|
||||
|
||||
if (w->field_0x19C != 3 && w->field_0x19C != 4 && w->field_0x19C != 10 && w->field_0x19C != 8) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
w->field_0x1A0 = TRUE;
|
||||
w->field_0x1A1 = TRUE;
|
||||
w->field_0x1A4 = 0;
|
||||
sub_0202830C(window_id, -5);
|
||||
w->field_0x19C = 6;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -39,3 +39,16 @@ void sub_0205BC94(struct unkStruct_0205BC94 *p)
|
||||
p->unk4 = inner->unk48;
|
||||
*(u8 *)p = 1;
|
||||
}
|
||||
|
||||
void sub_0205BCC4(u16* src)
|
||||
{
|
||||
if (src == NULL) {
|
||||
MemsetSimple((u8 *) _020B0A54.struct1.unk8.unk8 + 0x44, 0, 6);
|
||||
} else {
|
||||
u16 *dst = (u16 *) ((u8 *) _020B0A54.struct1.unk8.unk8 + 0x44);
|
||||
|
||||
dst[0] = src[0];
|
||||
dst[1] = src[1];
|
||||
dst[2] = src[2];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,14 @@
|
||||
#include "overlay_29_02326188.h"
|
||||
#include "dungeon_mode.h"
|
||||
#include "item.h"
|
||||
#include "move.h"
|
||||
#include "move_orb_effects.h"
|
||||
|
||||
extern const s16 BUBBLE_LOWER_SPEED_CHANCE;
|
||||
|
||||
extern s32 DealDamage(struct entity *attacker, struct entity *defender, struct move *move, s32 damageMultiplier, enum item_id item_id);
|
||||
|
||||
extern bool8 DungeonRandOutcomeUserTargetInteraction(struct entity *user, struct entity *target, s16 chance);
|
||||
|
||||
extern void EndNegativeStatusConditionWrapper(struct entity *user, struct entity *target, bool8 displayMessage, bool8 fromMove);
|
||||
|
||||
@@ -8,3 +18,17 @@ bool8 DoMoveHealStatus(struct entity* attacker, struct entity* defender, struct
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 DoMoveBubble(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 (DungeonRandOutcomeUserTargetInteraction(attacker, defender, BUBBLE_LOWER_SPEED_CHANCE)) {
|
||||
LowerSpeed(attacker, defender, result, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#include "overlay_29_02349188.h"
|
||||
#include "mission.h"
|
||||
|
||||
extern bool8 IsCurrentMissionType(enum mission_type type);
|
||||
#include "dungeon.h"
|
||||
|
||||
extern struct dungeon *DUNGEON_PTR;
|
||||
@@ -20,3 +23,14 @@ s32 ov29_023491B8(void)
|
||||
{
|
||||
return GetFirstExperienceLockedTeamMember();
|
||||
}
|
||||
|
||||
bool8 IsOutlawOrChallengeRequestFloor(void)
|
||||
{
|
||||
if (IsCurrentMissionType(MISSION_CHALLENGE_REQUEST) != 0 ||
|
||||
IsCurrentMissionType(MISSION_ARREST_OUTLAW) != 0 ||
|
||||
IsCurrentMissionType(MISSION_TAKE_ITEM_FROM_OUTLAW) != 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user