This commit is contained in:
Edouard Veyrier 2018-04-03 00:07:55 +02:00
parent b2e8ee836d
commit 2f96282c7f
3 changed files with 69 additions and 135 deletions

View File

@ -67,6 +67,7 @@ _08160688:
thumb_func_end sub_8160664 thumb_func_end sub_8160664
*/ */
/*
thumb_func_start sub_81606A0 thumb_func_start sub_81606A0
sub_81606A0: @ 81606A0 sub_81606A0: @ 81606A0
push {r4-r6,lr} push {r4-r6,lr}
@ -120,14 +121,16 @@ sub_81606A0: @ 81606A0
bx r0 bx r0
.pool .pool
thumb_func_end sub_81606A0 thumb_func_end sub_81606A0
*/
/*
thumb_func_start sub_8160740 thumb_func_start sub_8160740
sub_8160740: @ 8160740 sub_8160740: @ 8160740
push {r4,r5,lr} push {r4,r5,lr}
bl ResetSpriteData bl ResetSpriteData
bl FreeAllSpritePalettes bl FreeAllSpritePalettes
bl ResetTasks bl ResetTasks
bl clear_scheduled_bg_copies_to_vram // bl clear_scheduled_bg_copies_to_vram
ldr r5, =gUnknown_0203BC34 ldr r5, =gUnknown_0203BC34
movs r0, 0x8C movs r0, 0x8C
lsls r0, 1 lsls r0, 1
@ -146,7 +149,7 @@ sub_8160740: @ 8160740
adds r0, 0x45 adds r0, 0x45
strb r1, [r0] strb r1, [r0]
ldr r0, =sub_8160624 ldr r0, =sub_8160624
bl SetVBlankCallback // bl SetVBlankCallback
bl sub_81607EC bl sub_81607EC
ldr r4, =gUnknown_0203BC38 ldr r4, =gUnknown_0203BC38
ldrb r0, [r4, 0x4] ldrb r0, [r4, 0x4]
@ -155,7 +158,7 @@ sub_8160740: @ 8160740
ldr r0, =gUnknown_085CEBB0 ldr r0, =gUnknown_085CEBB0
bl LoadSpriteSheet bl LoadSpriteSheet
ldr r0, =gUnknown_085CEBB8 ldr r0, =gUnknown_085CEBB8
bl LoadSpritePalette // bl LoadSpritePalette
bl sub_81610B8 bl sub_81610B8
ldr r0, =gMultiuseListMenuTemplate ldr r0, =gMultiuseListMenuTemplate
ldrh r1, [r4] ldrh r1, [r4]
@ -177,6 +180,7 @@ sub_8160740: @ 8160740
bx r0 bx r0
.pool .pool
thumb_func_end sub_8160740 thumb_func_end sub_8160740
*/
/* /*
thumb_func_start sub_81607EC thumb_func_start sub_81607EC

View File

@ -1,47 +1,7 @@
#ifndef GUARD_LEARN_MOVE_H #ifndef GUARD_LEARN_MOVE_H
#define GUARD_LEARN_MOVE_H #define GUARD_LEARN_MOVE_H
//this struct is probably wrong
struct LearnMoveStruct
{
u8 state;
u8 filler1;
u8 unk2;
u8 spriteIDs[20];
u8 filler17[1];
u8 unk18;
u8 unk19;
u8 numMenuChoices;
u8 menuSelection;
u8 unk1C;
bool8 unk1D;
u8 unk1E;
u8 filler1F;
/*0x020*/ u16 movesToLearn[20];
u8 filler48[0x52-0x48];
u8 moveNames[6][0x19];
u8 fillerE8[0x2C3-0xE8];
bool8 unk2C3;
bool8 showContestInfo;
/*0x2C5*/ u8 partyMon;
u8 unk2C6;
};
//struct LearnMoveStruct *gUnknown_0203BC34 = NULL;
//extern u8 *gUnknown_0203BC34;
void sub_8160624(void); void sub_8160624(void);
void sub_8160638(void); void sub_8160638(void);
// Ew, just copied from pokeruby...
//const u16 gDexArrows_Pal[] = INCBIN_U16("graphics/pokedex/arrows.gbapal");
//const u8 gDexArrows_Gfx[] = INCBIN_U8("graphics/pokedex/arrows.4bpp");
//const struct SpritePalette gUnknown_085CEBB8 = {gDexArrows_Pal, 5526};
//const struct SpriteSheet gUnknown_085CEBB0 = {gDexArrows_Gfx, sizeof(gDexArrows_Gfx), 5525};
//u8 *gUnknown_0203BC38 = (void*)0x0203BC38;
//extern u8 gUnknown_0203BC38[8];
//u8 gUnknown_0203BC38;
#endif //GUARD_LEARN_MOVE_H #endif //GUARD_LEARN_MOVE_H

View File

@ -22,14 +22,15 @@ extern const struct SpritePalette gUnknown_085CEBB8;
extern const struct SpriteSheet gUnknown_085CEBB0; extern const struct SpriteSheet gUnknown_085CEBB0;
extern const struct BgTemplate gUnknown_085CEC28; extern const struct BgTemplate gUnknown_085CEC28;
extern void sub_81D2824(u16); extern void sub_81D2824(u16);
//extern struct LearnMoveStruct *gUnknown_0203BC34;
//static struct LearnMoveStruct *sLearnMoveStruct; void sub_8160868(void);
void sub_8161280(void);
void sub_81610B8(void);
void sub_816082C(void);
static void sub_8160664(u8 taskId); static void sub_8160664(u8 taskId);
void sub_81606A0(void); //CB2_InitLearnMove void sub_81606A0(void); //CB2_InitLearnMove
void sub_8160740(void); void sub_8160740(void);
void sub_81607EC(void); void sub_81607EC(void);
void sub_816082C(void); void sub_816082C(void);
@ -57,90 +58,63 @@ void sub_8160664(u8 taskId)
} }
} }
// void sub_81606A0(void) //CB2_InitLearnMove // Doesn't match
// { void sub_81606A0(void) //CB2_InitLearnMove
// //AGBPrint("test\n"); {
// //AGBPrintFlush(); ResetSpriteData();
// //NoCashGBAPrint("test\n"); FreeAllSpritePalettes();
// //Less calls than pokeruby, is it normal ? ResetTasks();
// ResetSpriteData(); clear_scheduled_bg_copies_to_vram();
// FreeAllSpritePalettes();
// ResetTasks();
// clear_scheduled_bg_copies_to_vram();
//
// //LearnMoveStruct**
// gUnknown_0203BC34 = AllocZeroed(0x118);//gUnknown_0203BC34 is a global pointer to LearnMoveStruct ?
// //gUnknown_0203BC34->movesToLearn[0] = gSpecialVar_0x8004;
// ((u8*)gUnknown_0203BC34)[68] = gSpecialVar_0x8004;
//
// SetVBlankCallback(sub_8160624);
// //SetVBlankCallback(/*FIXME sub_8160624*/ (void()(u16))0x081D2824);
// sub_81607EC();
// sub_81D2824(0);
//
// //gUnknown_0203BC38 ?
// // weird instruction
// (gUnknown_0203BC38)[0] = 0;
// (gUnknown_0203BC38)[2] = 0;
// (gUnknown_0203BC38)[4] = 0;
//
// //FIXME
// //sub_8161280();
// __asm__("bl sub_8161280");
//
// //LoadSpriteSheet(/*FIXME &gUnknown_085CEBB0*/(void*)0x085CEBB0);
// //LoadSpritePalette(/*FIXME &gUnknown_085CEBB8*/(void*)0x085CEBB8);
// LoadSpriteSheet(&gUnknown_085CEBB0);
// LoadSpritePalette(&gUnknown_085CEBB8);
// //sub_81610B8();
// //FIXME
// __asm__("bl sub_81610B8");
//
// ((u8*)gUnknown_0203BC34)[274] = ListMenuInit(&gMultiuseListMenuTemplate, gUnknown_0203BC38[0], gUnknown_0203BC38[2]);
// FillPalette(0, 0, 2);
// //SetMainCallback2(sub_816082C/*(void*)0x0816082C()*/);
// //SetMainCallback2(sub_816082C/*(void*)0x0816082C()*/);
// //FIXME
// __asm__(
// "ldr r0, =sub_816082C",
// "bl SetMainCallback2"
// );
// }
// void sub_8160740(void) gUnknown_0203BC34 = AllocZeroed(0x118); //gUnknown_0203BC34 ?
// { gUnknown_0203BC34[68] = gSpecialVar_0x8004;
// void (*sub_81D2824)(u16) = (void*)0x081D2824;
// void (*sub_81610B8)(void) = (void*)0x081610B8; SetVBlankCallback(sub_8160624);
// void (*sub_8161280)(void) = (void*)0x08161280; sub_81607EC();
// sub_81D2824(0);
// u8 data;
// //gUnknown_0203BC38 ?
// ResetSpriteData(); gUnknown_0203BC38[0] = 0;
// FreeAllSpritePalettes(); gUnknown_0203BC38[2] = 0;
// ResetTasks(); gUnknown_0203BC38[4] = 0;
// clear_scheduled_bg_copies_to_vram();
// sub_8161280();
// gUnknown_0203BC34 = AllocZeroed(0x118);//gUnknown_0203BC34 is a global pointer to LearnMoveStruct ?
// gUnknown_0203BC34->partyMon = gSpecialVar_0x8004; //gUnknown_0203BC34 + 68 LoadSpriteSheet(&gUnknown_085CEBB0);
// gUnknown_0203BC34->unk2C6 = gSpecialVar_0x8005; //gUnknown_0203BC34 + 69 LoadSpritePalette(&gUnknown_085CEBB8);
// sub_81610B8();
// SetVBlankCallback(sub_8160624);
// sub_81607EC(); gUnknown_0203BC34[274] = ListMenuInit(&gMultiuseListMenuTemplate, gUnknown_0203BC38[0], gUnknown_0203BC38[2]);
// FillPalette(0, 0, 2);
// //gUnknown_0203BC38 ? SetMainCallback2(sub_816082C);
// sub_81D2824(gUnknown_0203BC38[4]); }
// sub_8161280();
// // Doesn't match
// LoadSpriteSheet(&gUnknown_085CEBB0); void sub_8160740(void)
// LoadSpritePalette(&gUnknown_085CEBB8); {
// //LoadSpriteSheet(/*FIXME &gUnknown_085CEBB0*/(void*)0x085CEBB0); ResetSpriteData();
// //LoadSpritePalette(/*FIXME &gUnknown_085CEBB8*/(void*)0x085CEBB8); FreeAllSpritePalettes();
// ResetTasks();
// data = ListMenuInit(&gMultiuseListMenuTemplate, *gUnknown_0203BC38, *((u8*)gUnknown_0203BC38 + 2)); clear_scheduled_bg_copies_to_vram();
// *(u8*)(gUnknown_0203BC34 + 274) = data;
// FillPalette(0, 0, 2); gUnknown_0203BC34 = AllocZeroed(0x118); //gUnknown_0203BC34 ?
// SetMainCallback2(/*FIXME sub_816082C*/(void*)0x0816082C); gUnknown_0203BC34[68] = gSpecialVar_0x8004;
// } gUnknown_0203BC34[69] = gSpecialVar_0x8005;
SetVBlankCallback(sub_8160624);
sub_81607EC();
//gUnknown_0203BC38 ?
sub_81D2824(gUnknown_0203BC38[4]);
sub_8161280();
LoadSpriteSheet(&gUnknown_085CEBB0);
LoadSpritePalette(&gUnknown_085CEBB8);
gUnknown_0203BC34[274] = ListMenuInit(&gMultiuseListMenuTemplate, gUnknown_0203BC38[0], gUnknown_0203BC38[2]);
FillPalette(0, 0, 2);
SetMainCallback2(sub_816082C);
}
void sub_81607EC(void) void sub_81607EC(void)
{ {
@ -153,17 +127,13 @@ void sub_81607EC(void)
ShowBg(1); ShowBg(1);
SetGpuReg(0x50, 0); SetGpuReg(0x50, 0);
} }
void sub_816082C(void) void sub_816082C(void)
{ {
//FIXME sub_8160868();
//sub_8160868();
//void(*sub_8160868)(void) = (void (*)(void))0x08160868;
//sub_8160868();
__asm__("bl sub_8160868");
RunTasks(); RunTasks();
AnimateSprites(); AnimateSprites();
BuildOamBuffer(); BuildOamBuffer();
do_scheduled_bg_tilemap_copies_to_vram(); do_scheduled_bg_tilemap_copies_to_vram();
UpdatePaletteFade(); UpdatePaletteFade();
} }