some more moves decomp

This commit is contained in:
Dennis H 2023-01-14 17:58:01 +01:00
parent f629cd20a1
commit c08fbc2931
2 changed files with 81 additions and 119 deletions

View File

@ -5,121 +5,6 @@
.text
thumb_func_start sub_8093468
sub_8093468:
push {r4-r7,lr}
adds r6, r1, 0
movs r5, 0
adds r1, r0, 0x1
movs r4, 0
cmp r1, 0x7
bgt _080934A0
movs r0, 0x2
mov r12, r0
movs r7, 0xFD
lsls r0, r1, 3
adds r3, r0, r6
_08093480:
ldrb r2, [r3]
mov r0, r12
ands r0, r2
cmp r0, 0
beq _080934A0
adds r0, r7, 0
ands r0, r2
strb r0, [r3]
movs r5, 0x1
adds r3, 0x8
adds r1, 0x1
adds r4, 0x1
cmp r4, 0x7
bgt _080934A0
cmp r1, 0x7
ble _08093480
_080934A0:
adds r0, r6, 0
bl sub_809371C
adds r0, r5, 0
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_8093468
thumb_func_start sub_80934B0
sub_80934B0:
push {lr}
adds r2, r0, 0
adds r0, r2, 0x1
cmp r0, 0x7
bgt _080934D2
lsls r0, r2, 3
adds r0, 0x8
adds r0, r1, r0
ldrb r1, [r0]
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _080934D2
movs r0, 0x2
ands r0, r1
cmp r0, 0
bne _080934D6
_080934D2:
movs r0, 0
b _080934D8
_080934D6:
movs r0, 0x1
_080934D8:
pop {r1}
bx r1
thumb_func_end sub_80934B0
thumb_func_start sub_80934DC
sub_80934DC:
push {r4-r7,lr}
adds r5, r1, 0
lsls r0, 3
adds r4, r5, r0
ldrb r1, [r4]
movs r0, 0x8
ands r0, r1
cmp r0, 0
beq _080934F4
movs r0, 0xF7
ands r0, r1
b _0809351A
_080934F4:
movs r7, 0x1
movs r6, 0xF7
adds r1, r5, 0
movs r3, 0x3
_080934FC:
ldrb r2, [r1]
adds r0, r7, 0
ands r0, r2
cmp r0, 0
beq _0809350C
adds r0, r6, 0
ands r0, r2
strb r0, [r1]
_0809350C:
adds r1, 0x8
subs r3, 0x1
cmp r3, 0
bge _080934FC
ldrb r1, [r4]
movs r0, 0x8
orrs r0, r1
_0809351A:
strb r0, [r4]
adds r0, r5, 0
bl sub_809371C
movs r0, 0x1
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_80934DC
thumb_func_start sub_809352C
sub_809352C:
push {lr}

View File

@ -4,7 +4,7 @@
#include "moves.h"
#include "pokemon.h"
u8 sub_8093468(int param_1, void* src_struct);
u8 sub_8093468(int param_1, struct PokemonMove* src_struct);
u8 sub_8093400(int param_1, struct PokemonMove* src_struct);
u8 sub_80933D8(int param_1, void* src_struct);
bool8 DoesMoveCharge(u16 move);
@ -30,13 +30,13 @@ int sub_8093318(int param_1, void* src_struct)
{
struct PokemonMove dest_struct[8];
MemoryCopy8((void*)dest_struct, src_struct, 64);
return sub_8093400(param_1, (struct PokemonMove*)dest_struct);
return sub_8093400(param_1, dest_struct);
}
int sub_809333C(int param_1, void* src_struct)
{
u8 dest_struct[64];
MemoryCopy8(dest_struct, src_struct, 64);
struct PokemonMove dest_struct[8];
MemoryCopy8((void*)dest_struct, src_struct, 64);
return sub_8093468(param_1, dest_struct);
}
@ -106,3 +106,80 @@ u8 sub_8093400(int index, struct PokemonMove* moves) {
}
return 0;
}
NAKED
u8 sub_8093468(int index, struct PokemonMove* moves)
{
asm_unified(
" push {r4-r7,lr}\n"
" adds r6, r1, 0\n"
" movs r5, 0\n"
" adds r1, r0, 0x1\n"
" movs r4, 0\n"
" cmp r1, 0x7\n"
" bgt _080934A0\n"
" movs r0, 0x2\n"
" mov r12, r0\n"
" movs r7, 0xFD\n"
" lsls r0, r1, 3\n"
" adds r3, r0, r6\n"
"_08093480:\n"
" ldrb r2, [r3]\n"
" mov r0, r12\n"
" ands r0, r2\n"
" cmp r0, 0\n"
" beq _080934A0\n"
" adds r0, r7, 0\n"
" ands r0, r2\n"
" strb r0, [r3]\n"
" movs r5, 0x1\n"
" adds r3, 0x8\n"
" adds r1, 0x1\n"
" adds r4, 0x1\n"
" cmp r4, 0x7\n"
" bgt _080934A0\n"
" cmp r1, 0x7\n"
" ble _08093480\n"
"_080934A0:\n"
" adds r0, r6, 0\n"
" bl sub_809371C\n"
" adds r0, r5, 0\n"
" pop {r4-r7}\n"
" pop {r1}\n"
" bx r1\n");
}
u8 sub_80934B0(int index, struct PokemonMove* moves) {
struct PokemonMove* move;
if (index + 1 >= 8) {
return 0;
}
move = &moves[index + 1];
if (!(move->moveFlags & 1))
return 0;
if ((move->moveFlags & 2))
return 1;
return 0;
}
int sub_80934DC(int index, struct PokemonMove* moves) {
struct PokemonMove* move;
u8 flags;
int i;
move = &moves[index];
if (moves[index].moveFlags & 8) {
flags = move->moveFlags & ~8;
}
else {
for (i = 0; i < 4; i++) {
if (moves[i].moveFlags & 1) {
moves[i].moveFlags &= ~8;
}
}
flags = move->moveFlags | 8;
}
move->moveFlags = flags;
sub_809371C(moves);
return 1;
}