From 09e29a5cf8695cf43fe8ac18004049b07a59ccc5 Mon Sep 17 00:00:00 2001 From: Edouard Veyrier Date: Sun, 1 Apr 2018 18:22:09 +0200 Subject: [PATCH] Fix three functions to have the right checksum --- asm/learn_move.s | 6 +- include/learn_move.h | 2 +- src/learn_move.c | 129 +++++++++++++++++++++++++------------------ 3 files changed, 78 insertions(+), 59 deletions(-) diff --git a/asm/learn_move.s b/asm/learn_move.s index ab3c84ec23..5fd507c2d9 100644 --- a/asm/learn_move.s +++ b/asm/learn_move.s @@ -67,7 +67,6 @@ _08160688: thumb_func_end sub_8160664 */ -/* thumb_func_start sub_81606A0 sub_81606A0: @ 81606A0 push {r4-r6,lr} @@ -121,7 +120,6 @@ sub_81606A0: @ 81606A0 bx r0 .pool thumb_func_end sub_81606A0 -*/ thumb_func_start sub_8160740 sub_8160740: @ 8160740 @@ -148,7 +146,7 @@ sub_8160740: @ 8160740 adds r0, 0x45 strb r1, [r0] ldr r0, =sub_8160624 - bl SetVBlankCallback + bl SetVBlankCallback // bl sub_81607EC ldr r4, =gUnknown_0203BC38 ldrb r0, [r4, 0x4] @@ -157,7 +155,7 @@ sub_8160740: @ 8160740 ldr r0, =gUnknown_085CEBB0 bl LoadSpriteSheet ldr r0, =gUnknown_085CEBB8 - bl LoadSpritePalette + bl LoadSpritePalette // bl sub_81610B8 ldr r0, =gMultiuseListMenuTemplate ldrh r1, [r4] diff --git a/include/learn_move.h b/include/learn_move.h index ed95b62060..7779e85a0f 100644 --- a/include/learn_move.h +++ b/include/learn_move.h @@ -37,6 +37,6 @@ void sub_8160638(void); //const struct SpritePalette gUnknown_085CEBB8 = {gDexArrows_Pal, 5526}; //const struct SpriteSheet gUnknown_085CEBB0 = {gDexArrows_Gfx, sizeof(gDexArrows_Gfx), 5525}; -void *gUnknown_0203BC38 = (void*)0x0203BC38; +u8 *gUnknown_0203BC38 = (void*)0x0203BC38; #endif //GUARD_LEARN_MOVE_H diff --git a/src/learn_move.c b/src/learn_move.c index f837076249..faa73a2d0b 100644 --- a/src/learn_move.c +++ b/src/learn_move.c @@ -30,7 +30,7 @@ void sub_8160638(void) //TeachMoveTutorMove { ScriptContext2_Enable(); CreateTask(sub_8160664, 0xA); - BeginNormalPaletteFade(-1, 0, 0x10, 0, 0); + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); } void sub_8160664(u8 taskId) @@ -43,56 +43,77 @@ void sub_8160664(u8 taskId) } } -void sub_81606A0(void) //CB2_InitLearnMove -{ - //FIXME - void (*sub_81607EC)(void) = (void*)0x081607EC; - void (*sub_81D2824)(void*) = (void*)0x081D2824; - void (*sub_81610B8)(void) = (void*)0x081610B8; - void (*sub_8161280)(void) = (void*)0x08161280; - - //Less calls than pokeruby, is it normal ? - ResetSpriteData(); - FreeAllSpritePalettes(); - ResetTasks(); - clear_scheduled_bg_copies_to_vram(); - - //LearnMoveStruct** - //r1 = &gSpecialVar_0x8004; //What is this global ? - //u8* partyMon = gUnknown_0203BC34 + 0x44 //partyMon ? - //*partyMon = r1; - gUnknown_0203BC34 = AllocZeroed(0x118);//gUnknown_0203BC34 is a global pointer to LearnMoveStruct ? - gUnknown_0203BC34->partyMon = gSpecialVar_0x8004; - - SetVBlankCallback(sub_8160624); - sub_81607EC(); - sub_81D2824(0); - - //gUnknown_0203BC38 ? - (&gUnknown_0203BC38)[0] = 0; - (&gUnknown_0203BC38)[2] = 0; - (&gUnknown_0203BC38)[4] = 0; - - sub_8161280(); - LoadSpriteSheet(/*FIXME &gUnknown_085CEBB0*/(void*)0x085CEBB0); - LoadSpritePalette(/*FIXME &gUnknown_085CEBB8*/(void*)0x085CEBB8); - sub_81610B8(); - - ListMenuInit(&gMultiuseListMenuTemplate, 0, 0); - FillPalette(0, 0, 2); - SetMainCallback2(/*FIXME sub_816082C*/(void*)0x0816082C); -} - -/* -void sub_8160740(void) -{ - ResetSpriteData(); - FreeAllSpritePalettes(); - ResetTasks(); - clear_scheduled_bg_copies_to_vram(); - - gUnknown_0203BC34 = AllocZeroed(0x118);//gUnknown_0203BC34 is a global pointer to LearnMoveStruct ? - gUnknown_0203BC34->partyMon = gSpecialVar_0x8004; - gUnknown_0203BC34->unk2C6 = gSpecialVar_0x8005; -} -*/ +// void sub_81606A0(void) //CB2_InitLearnMove +// { +// //FIXME +// void (*sub_81607EC)(void) = (void*)0x081607EC; +// void (*sub_81D2824)(u16) = (void*)0x081D2824; +// void (*sub_81610B8)(void) = (void*)0x081610B8; +// void (*sub_8161280)(void) = (void*)0x08161280; +// +// //Less calls than pokeruby, is it normal ? +// ResetSpriteData(); +// FreeAllSpritePalettes(); +// ResetTasks(); +// clear_scheduled_bg_copies_to_vram(); +// +// //LearnMoveStruct** +// //r1 = &gSpecialVar_0x8004; //What is this global ? +// //u8* partyMon = gUnknown_0203BC34 + 0x44 //partyMon ? +// //*partyMon = r1; +// gUnknown_0203BC34 = AllocZeroed(0x118);//gUnknown_0203BC34 is a global pointer to LearnMoveStruct ? +// gUnknown_0203BC34->partyMon = gSpecialVar_0x8004; +// +// SetVBlankCallback(sub_8160624); +// sub_81607EC(); +// sub_81D2824(0); +// +// //gUnknown_0203BC38 ? +// (gUnknown_0203BC38)[0] = 0; +// (gUnknown_0203BC38)[2] = 0; +// (gUnknown_0203BC38)[4] = 0; +// +// sub_8161280(); +// LoadSpriteSheet(/*FIXME &gUnknown_085CEBB0*/(void*)0x085CEBB0); +// LoadSpritePalette(/*FIXME &gUnknown_085CEBB8*/(void*)0x085CEBB8); +// sub_81610B8(); +// +// ListMenuInit(&gMultiuseListMenuTemplate, 0, 0); +// FillPalette(0, 0, 2); +// SetMainCallback2(/*FIXME sub_816082C*/(void*)0x0816082C); +// } +// +// void sub_8160740(void) +// { +// void (*sub_81607EC)(void) = (void*)0x081607EC; +// void (*sub_81D2824)(u16) = (void*)0x081D2824; +// void (*sub_81610B8)(void) = (void*)0x081610B8; +// void (*sub_8161280)(void) = (void*)0x08161280; +// +// u8 data; +// +// ResetSpriteData(); +// FreeAllSpritePalettes(); +// ResetTasks(); +// clear_scheduled_bg_copies_to_vram(); +// +// gUnknown_0203BC34 = AllocZeroed(0x118);//gUnknown_0203BC34 is a global pointer to LearnMoveStruct ? +// gUnknown_0203BC34->partyMon = gSpecialVar_0x8004; //gUnknown_0203BC34 + 68 +// gUnknown_0203BC34->unk2C6 = gSpecialVar_0x8005; //gUnknown_0203BC34 + 69 +// +// SetVBlankCallback(sub_8160624); +// sub_81607EC(); +// +// //gUnknown_0203BC38 ? +// sub_81D2824(*((u8*)&gUnknown_0203BC38 + 4)); +// sub_8161280(); +// +// LoadSpriteSheet(/*FIXME &gUnknown_085CEBB0*/(void*)0x085CEBB0); +// LoadSpritePalette(/*FIXME &gUnknown_085CEBB8*/(void*)0x085CEBB8); +// +// data = ListMenuInit(&gMultiuseListMenuTemplate, *gUnknown_0203BC38, *((u8*)gUnknown_0203BC38 + 2)); +// *(u8*)(gUnknown_0203BC34 + 274) = data; +// FillPalette(0, 0, 2); +// SetMainCallback2(/*FIXME sub_816082C*/(void*)0x0816082C); +// } +// */