mirror of
https://github.com/jiangzhengwenjz/katam.git
synced 2024-11-23 21:20:19 +00:00
sub_08152E40
This commit is contained in:
parent
18d2ffcb35
commit
5c3072f7a5
@ -5,75 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_08152E40
|
||||
sub_08152E40: @ 0x08152E40
|
||||
push {r4, r5, lr}
|
||||
adds r2, r0, #0
|
||||
subs r2, #4
|
||||
ldr r1, _08152EB8 @ =gUnk_03003A20
|
||||
adds r3, r1, #0
|
||||
cmp r2, r1
|
||||
beq _08152E5C
|
||||
movs r4, #0xc0
|
||||
lsls r4, r4, #0x12
|
||||
_08152E52:
|
||||
adds r1, r3, #0
|
||||
ldrh r0, [r1]
|
||||
adds r3, r0, r4
|
||||
cmp r2, r3
|
||||
bne _08152E52
|
||||
_08152E5C:
|
||||
ldrh r4, [r2, #2]
|
||||
movs r5, #2
|
||||
ldrsh r0, [r2, r5]
|
||||
cmp r0, #0
|
||||
bge _08152E6A
|
||||
rsbs r0, r4, #0
|
||||
strh r0, [r2, #2]
|
||||
_08152E6A:
|
||||
movs r4, #2
|
||||
ldrsh r0, [r1, r4]
|
||||
adds r0, r1, r0
|
||||
cmp r0, r2
|
||||
bne _08152E8A
|
||||
ldrh r4, [r1, #2]
|
||||
movs r5, #2
|
||||
ldrsh r0, [r1, r5]
|
||||
cmp r0, #0
|
||||
ble _08152E8A
|
||||
ldrh r0, [r3]
|
||||
strh r0, [r1]
|
||||
ldrh r0, [r2, #2]
|
||||
adds r0, r4, r0
|
||||
strh r0, [r1, #2]
|
||||
adds r2, r1, #0
|
||||
_08152E8A:
|
||||
movs r1, #2
|
||||
ldrsh r0, [r2, r1]
|
||||
adds r3, r2, r0
|
||||
ldrh r0, [r2]
|
||||
movs r1, #0xc0
|
||||
lsls r1, r1, #0x12
|
||||
adds r0, r0, r1
|
||||
cmp r3, r0
|
||||
bne _08152EB0
|
||||
ldrh r1, [r3, #2]
|
||||
movs r4, #2
|
||||
ldrsh r0, [r3, r4]
|
||||
cmp r0, #0
|
||||
ble _08152EB0
|
||||
ldrh r5, [r2, #2]
|
||||
adds r0, r1, r5
|
||||
strh r0, [r2, #2]
|
||||
ldrh r0, [r3]
|
||||
strh r0, [r2]
|
||||
_08152EB0:
|
||||
pop {r4, r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_08152EB8: .4byte gUnk_03003A20
|
||||
|
||||
thumb_func_start sub_08152EBC
|
||||
sub_08152EBC: @ 0x08152EBC
|
||||
push {r4, r5, r6, r7, lr}
|
||||
|
@ -39,11 +39,11 @@ extern struct Unk_03003A20 gUnk_03003A20[];
|
||||
extern u8 gUnk_030068D4;
|
||||
extern u32 gUnk_03006CC4;
|
||||
|
||||
extern void sub_081590EC(u32*);
|
||||
extern void sub_08152E40(u8*);
|
||||
extern void sub_08152E40(struct Unk_03003A20* arg0);
|
||||
extern struct GameState* sub_08152F88(void);
|
||||
extern void nullsub_143(void);
|
||||
extern void nullsub_144(void);
|
||||
extern void nullsub_145(void);
|
||||
extern void sub_081590EC(u32*);
|
||||
|
||||
#endif
|
||||
|
@ -158,7 +158,7 @@ void sub_08152C3C(struct GameState* arg0) {
|
||||
sub_081590EC(arg0->unk6 + (u32*)EWRAM_START);
|
||||
}
|
||||
else {
|
||||
sub_08152E40(arg0->unk6 + (u8*)IWRAM_START);
|
||||
sub_08152E40(arg0->unk6 + (void*)IWRAM_START);
|
||||
}
|
||||
}
|
||||
|
||||
@ -246,5 +246,43 @@ struct Unk_03003A20* sub_08152DD8(u16 arg0) {
|
||||
return NULL;
|
||||
}
|
||||
r3 = (struct Unk_03003A20*)(r3->unk0 + IWRAM_START);
|
||||
} while(1);
|
||||
} while (1);
|
||||
}
|
||||
|
||||
void sub_08152E40(struct Unk_03003A20* arg0) {
|
||||
struct Unk_03003A20* r2 = arg0, *r3;
|
||||
#ifndef NONMATCHING
|
||||
register struct Unk_03003A20* r1 asm("r1");
|
||||
#else
|
||||
struct Unk_03003A20* r1;
|
||||
#endif
|
||||
r2 -= 1;
|
||||
r1 = gUnk_03003A20;
|
||||
r3 = r1;
|
||||
|
||||
|
||||
if (r2 != r1) {
|
||||
do {
|
||||
r1 = r3;
|
||||
r3 = (struct Unk_03003A20*)(IWRAM_START + r1->unk0);
|
||||
} while (r2 != r3);
|
||||
}
|
||||
if (r2->unk2 < 0) {
|
||||
r2->unk2 = -r2->unk2;
|
||||
}
|
||||
if ((struct Unk_03003A20*)(r1->unk2 + (u8*)r1) == r2) {
|
||||
u16 r4 = r1->unk2; // not actual code. only for handling side effect of inline asm
|
||||
if (r1->unk2 > 0) {
|
||||
r1->unk0 = r3->unk0;
|
||||
r1->unk2 = r4 + r2->unk2;
|
||||
r2 = r1;
|
||||
}
|
||||
}
|
||||
r3 = (struct Unk_03003A20*)((u8*)r2 + r2->unk2);
|
||||
if (r3 == (struct Unk_03003A20*)(IWRAM_START + r2->unk0)) {
|
||||
if (r3->unk2 > 0) {
|
||||
r2->unk2 += r3->unk2;
|
||||
r2->unk0 = r3->unk0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user