successful decomp of one pokemon data func and struct.. making headway

This commit is contained in:
Seth Barberee 2020-10-01 13:32:53 -05:00
parent 70c644dfdd
commit 96fdd3aae0
6 changed files with 75 additions and 23 deletions

View File

@ -2309,23 +2309,4 @@ _0808DE0A:
bx r1
thumb_func_end sub_808DDD0
thumb_func_start sub_808DE10
sub_808DE10:
lsls r0, 16
asrs r0, 16
ldr r2, _0808DE2C
ldr r3, [r2]
lsls r2, r0, 3
adds r2, r0
lsls r2, 3
adds r2, r3
ldrh r0, [r2, 0x10]
asrs r0, r1
movs r1, 0x1
ands r0, r1
bx lr
.align 2, 0
_0808DE2C: .4byte gMonsterParameters
thumb_func_end sub_808DE10
.align 2,0

View File

@ -3,7 +3,42 @@
struct gPokemon
{
/* 0x0 */ u8* unk0;
/* 0x0 */ u8* species; // verified
/* 0x4 */ u8* category;
/* 0x8 */ u8 overworld_sprite; // verified
/* 0x9 */ u8 size;
/* 0x9 */ u8 unkA;
/* 0xB */ u8 unkB;
/* 0xC */ s32 move_speed;
/* 0x10 */ u16 dialogue_sprites; // verified
/* 0x12 */ u8 unk12; //verified
/* 0x13 */ u8 type_1;
/* 0x14 */ u8 type_2;
/* 0x15 */ u8 walkable_tiles;
/* 0x16 */ u8 friend_area; // verified
/* 0x16 */ u8 ability_1;
/* 0x18 */ u8 ability_2;
/* 0x19 */ u8 shadow_size;
/* 0x1A */ u8 unk1A;
/* 0x1B */ u16 unk1B;
/* 0x1D */ u8 unk1D;
/* 0x1E */ u16 base_hp;
/* 0x20 */ u16 base_exp; // verified
/* 0x22 */ u16 unk22; // verified
/* 0x24 */ u16 base_att;
/* 0x26 */ u16 base_spatt;
/* 0x28 */ u16 base_def;
/* 0x2A */ u16 base_spdef;
/* 0x2C */ u16 lowkick_dmg;
/* 0x2E */ u16 sizeorb_dmg;
/* 0x30 */ u16 unk30;
/* 0x32 */ u16 unk32;
/* 0x34 */ u16 unk34; //verified
/* 0x36 */ u16 evolve_type;
/* 0x38 */ u32 evolve_need1; // verified
/* 0x3C */ u16 unk3C;
/* 0x3E */ s16 unk3E; // verified
/* 0x40 */ s16 base_recruit; // verified
};
#endif // POKEMON_H

View File

@ -87,6 +87,7 @@ SECTIONS {
asm/code_80521D0.o(.text);
src/pokemon.o(.text);
asm/pokemon.o(.text);
src/pokemon_1.o(.text);
src/code_808DAB4.o(.text);
asm/code_808DAB4.o(.text);
src/dungeon.o(.text);

View File

@ -13,7 +13,9 @@ struct UnkEventStruct
struct UnkEventStruct2
{
/* 0x0 */ u32 unk0;
/* 0x4 */ u32 unk4;
/* 0x4 */ u32 *unk4;
/* 0x8 */ u16 unk8;
/* 0xA */ s16 unkA;
};
extern void sub_800226C(u8 r0, u8 r1, u32* r2, u8 u3);
@ -22,6 +24,7 @@ extern void sub_800160C(struct UnkEventStruct2 *r0, u32 r1, u32 r2);
extern u8 gUnknown_2000A88;
// TODO fix stack allocation from 0xC to 0x8 to make this match
//u8 sub_8002718(struct UnkEventStruct *r0)
//{
// struct UnkEventStruct2 temp;
@ -29,7 +32,7 @@ extern u8 gUnknown_2000A88;
// MemoryCopy8(&gUnknown_2000A88, (u8 *)r0, (0x80 << 3));
//
// // TODO fix this comparison to make it match
// if(r0->unkA != temp.unk4)
// if(temp.unkA != *(temp.unk4))
// return 0;
// return 1;
//}

View File

@ -14,7 +14,8 @@ void LoadMonsterParameters(void)
{
gUnknown_203B45C = &gUnknown_202F400;
gMonsterParametersFile = OpenFileAndGetFileDataPtr(&gUnknown_81075F4, &gUnknown_8300500);
gMonsterParameters.unk0 = gMonsterParametersFile->data;
// TODO verify this... other parts imply this is an array
gMonsterParameters.species = gMonsterParametersFile->data;
gUnknown_20384E8 = 0;
}

31
src/pokemon_1.c Normal file
View File

@ -0,0 +1,31 @@
#include "global.h"
#include "pokemon.h"
#include "file_system.h"
extern int sprintf(char *, const char *, ...);
extern struct gPokemon *gMonsterParameters;
extern struct FileArchive gUnknown_8510000;
extern const char gUnknown_8107684;
//u8 sub_808DDD0(s16 r0)
//{
// // Looks like this loads the dialogue sprite for the pokemon
//
// // TODO stack is being added instead of being substracted
// // Else this matches
// char buffer[0xC];
// if(gMonsterParameters[r0].dialogue_sprites != 0)
// {
// sprintf(buffer, &gUnknown_8107684);
// OpenFileAndGetFileDataPtr(buffer, &gUnknown_8510000);
// return;
// }
// return 0;
//}
bool8 sub_808DE10(s16 r0, s32 r1)
{
// checking to see if dialogue sprite is available??
return (gMonsterParameters[r0].dialogue_sprites >> r1) & 1;
}