mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Decompiled sub_81C756C
Also discovered a constant that may be useful for future decompiling. Comments were added in the asm that references the constant.
This commit is contained in:
parent
3d73f7c48c
commit
112fc47017
@ -5,55 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_81C756C
|
||||
sub_81C756C: @ 81C756C
|
||||
push {r4-r6,lr}
|
||||
ldr r1, =0xfffe7960
|
||||
adds r6, r0, r1
|
||||
bl sub_81C75F4
|
||||
ldr r5, =gUnknown_0861F3EC
|
||||
lsls r0, r6, 3
|
||||
subs r0, r6
|
||||
lsls r4, r0, 2
|
||||
adds r0, r4, r5
|
||||
ldr r0, [r0]
|
||||
bl _call_via_r0
|
||||
cmp r0, 0
|
||||
beq _081C75CC
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x8
|
||||
adds r0, r4, r0
|
||||
ldr r0, [r0]
|
||||
bl _call_via_r0
|
||||
cmp r0, 0
|
||||
beq _081C75CC
|
||||
adds r0, r5, 0
|
||||
adds r0, 0xC
|
||||
adds r0, r4, r0
|
||||
ldr r0, [r0]
|
||||
adds r1, r5, 0
|
||||
adds r1, 0x10
|
||||
adds r1, r4, r1
|
||||
ldr r1, [r1]
|
||||
bl sub_81C7834
|
||||
ldr r0, =gUnknown_0203CF40
|
||||
ldr r1, [r0]
|
||||
adds r0, r5, 0x4
|
||||
adds r0, r4, r0
|
||||
ldr r0, [r0]
|
||||
str r0, [r1]
|
||||
str r6, [r1, 0x4]
|
||||
movs r0, 0x1
|
||||
b _081C75CE
|
||||
.pool
|
||||
_081C75CC:
|
||||
movs r0, 0
|
||||
_081C75CE:
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81C756C
|
||||
|
||||
thumb_func_start sub_81C75D4
|
||||
sub_81C75D4: @ 81C75D4
|
||||
push {lr}
|
||||
@ -9441,7 +9392,7 @@ sub_81CBE50: @ 81CBE50
|
||||
movs r0, 0x9
|
||||
bl GetGameStat
|
||||
adds r1, r0, 0
|
||||
ldr r0, =0x0001869f
|
||||
ldr r0, =0x0001869f @ Note to decompiler: See UNKNOWN_OFFSET
|
||||
cmp r1, r0
|
||||
ble _081CBE68
|
||||
adds r1, r0, 0
|
||||
|
@ -27181,7 +27181,7 @@ sub_8024700: @ 8024700
|
||||
adds r0, r5, 0
|
||||
bl sub_8024668
|
||||
adds r1, r0, r4
|
||||
ldr r2, =0x0001869f
|
||||
ldr r2, =0x0001869f @ Note to decompiler: See UNKNOWN_OFFSET
|
||||
cmp r1, r2
|
||||
bhi _08024730
|
||||
adds r0, r5, 0
|
||||
|
@ -4036,7 +4036,7 @@ void sub_80C0460(u16 weight, u8 left, u8 top)
|
||||
lsls r2, 24\n\
|
||||
lsrs r2, 24\n\
|
||||
str r2, [sp, 0x10]\n\
|
||||
ldr r5, =0x000186a0\n\
|
||||
ldr r5, =0x000186a0 @ Note to decompiler: See UNKNOWN_OFFSET\n\
|
||||
muls r0, r5\n\
|
||||
ldr r1, =0x000011b8\n\
|
||||
bl __divsi3\n\
|
||||
@ -4070,7 +4070,7 @@ _080C04C0:\n\
|
||||
mov r8, r1\n\
|
||||
movs r6, 0x1\n\
|
||||
_080C04C6:\n\
|
||||
ldr r1, =0x000186a0\n\
|
||||
ldr r1, =0x000186a0 @ Note to decompiler: See UNKNOWN_OFFSET\n\
|
||||
adds r0, r7, 0\n\
|
||||
bl __umodsi3\n\
|
||||
adds r7, r0, 0\n\
|
||||
|
@ -7,8 +7,10 @@
|
||||
#include "palette.h"
|
||||
#include "pokemon_storage_system.h"
|
||||
|
||||
#define UNKNOWN_OFFSET 100000
|
||||
|
||||
struct UnknownStruct_0203CF40 {
|
||||
u32 field0;
|
||||
u32 (*field0)(void);
|
||||
u32 field4;
|
||||
u16 field8;
|
||||
u32 fieldC;
|
||||
@ -17,7 +19,7 @@ struct UnknownStruct_0203CF40 {
|
||||
};
|
||||
|
||||
struct UnknownStruct_0861F3EC {
|
||||
void (*data[7])(void);
|
||||
u32 (*data[7])(void);
|
||||
};
|
||||
|
||||
extern struct UnknownStruct_0203CF40 *gUnknown_0203CF40;
|
||||
@ -29,13 +31,15 @@ extern void sub_81C76C4(void);
|
||||
extern void sub_81C7710(void);
|
||||
extern void sub_81C7850(u32 a0);
|
||||
extern void sub_81C9430(void);
|
||||
extern u32 sub_81C756C(u32 a0);
|
||||
extern void sub_81C75F4(void);
|
||||
extern void sub_81C7834(u32 (*a0)(void), u32(*a1)(void));
|
||||
extern u32 sub_81C76FC(void);
|
||||
extern u32 sub_81C786C(void);
|
||||
extern u32 sub_81C75E0(void);
|
||||
extern u32 sub_81C75D4(void);
|
||||
extern u32 sub_81C7738(void);
|
||||
|
||||
bool32 sub_81C756C(u32 a0);
|
||||
u32 AnyMonHasRibbon(void);
|
||||
void sub_81C7334(void);
|
||||
void sub_81C71E4(u8 a0);
|
||||
@ -220,7 +224,7 @@ void sub_81C7360(struct UnknownStruct_0203CF40 *a0) {
|
||||
a0->field8 = 0;
|
||||
a0->field4 = 0;
|
||||
a0->fieldC = AnyMonHasRibbon();
|
||||
a0->field0 = 0;
|
||||
a0->field0 = NULL;
|
||||
}
|
||||
|
||||
bool32 AnyMonHasRibbon() {
|
||||
@ -278,7 +282,7 @@ void sub_81C742C(u8 taskId) {
|
||||
if (sub_81C76FC()) {
|
||||
break;
|
||||
}
|
||||
sub_81C756C(0x186a0);
|
||||
sub_81C756C(UNKNOWN_OFFSET);
|
||||
dataPtr[0] = 4;
|
||||
break;
|
||||
case 2:
|
||||
@ -291,7 +295,7 @@ void sub_81C742C(u8 taskId) {
|
||||
if (v1 == -1) {
|
||||
sub_81C7710();
|
||||
dataPtr[0] = 5;
|
||||
} else if (v1 > 0x1869F) {
|
||||
} else if (v1 >= UNKNOWN_OFFSET) {
|
||||
gUnknown_0861F3EC[gUnknown_0203CF40->field4].data[6]();
|
||||
gUnknown_0861F3EC[gUnknown_0203CF40->field4].data[5]();
|
||||
if (sub_81C756C(v1)) {
|
||||
@ -324,4 +328,21 @@ void sub_81C742C(u8 taskId) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool32 sub_81C756C(u32 a0) {
|
||||
u32 index;
|
||||
|
||||
index = a0 - UNKNOWN_OFFSET;
|
||||
sub_81C75F4();
|
||||
if (!gUnknown_0861F3EC[index].data[0]()) {
|
||||
return FALSE;
|
||||
}
|
||||
if (!gUnknown_0861F3EC[index].data[2]()) {
|
||||
return FALSE;
|
||||
}
|
||||
sub_81C7834(gUnknown_0861F3EC[index].data[3], gUnknown_0861F3EC[index].data[4]);
|
||||
gUnknown_0203CF40->field0 = gUnknown_0861F3EC[index].data[1];
|
||||
gUnknown_0203CF40->field4 = index;
|
||||
return TRUE;
|
||||
}
|
Loading…
Reference in New Issue
Block a user