mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-27 05:43:51 +01:00
sub_8009570
This commit is contained in:
parent
59eb766f47
commit
0709dc7e4c
62
asm/link.s
62
asm/link.s
@ -5,68 +5,6 @@
|
|||||||
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
thumb_func_start sub_8009570
|
|
||||||
sub_8009570: @ 8009570
|
|
||||||
push {r4,lr}
|
|
||||||
sub sp, 0x4
|
|
||||||
bl ResetSpriteData
|
|
||||||
bl FreeAllSpritePalettes
|
|
||||||
bl ResetTasks
|
|
||||||
ldr r0, =sub_80096BC
|
|
||||||
bl SetVBlankCallback
|
|
||||||
bl sub_800A2E0
|
|
||||||
ldr r1, =gUnknown_020229C6
|
|
||||||
ldr r2, =0x00001111
|
|
||||||
adds r0, r2, 0
|
|
||||||
strh r0, [r1]
|
|
||||||
bl sub_8009734
|
|
||||||
ldr r0, =gMain
|
|
||||||
ldrh r0, [r0, 0x24]
|
|
||||||
bl SeedRng
|
|
||||||
movs r4, 0
|
|
||||||
_080095A0:
|
|
||||||
bl Random
|
|
||||||
ldr r1, =gSaveBlock2Ptr
|
|
||||||
ldr r1, [r1]
|
|
||||||
adds r1, 0xA
|
|
||||||
adds r1, r4
|
|
||||||
strb r0, [r1]
|
|
||||||
adds r4, 0x1
|
|
||||||
cmp r4, 0x3
|
|
||||||
ble _080095A0
|
|
||||||
movs r4, 0
|
|
||||||
str r4, [sp]
|
|
||||||
movs r0, 0
|
|
||||||
movs r1, 0x2
|
|
||||||
movs r2, 0x4
|
|
||||||
movs r3, 0
|
|
||||||
bl sub_8009414
|
|
||||||
movs r1, 0xAA
|
|
||||||
lsls r1, 5
|
|
||||||
movs r0, 0
|
|
||||||
bl SetGpuReg
|
|
||||||
ldr r0, =sub_8009404
|
|
||||||
movs r1, 0
|
|
||||||
bl CreateTask
|
|
||||||
bl RunTasks
|
|
||||||
bl AnimateSprites
|
|
||||||
bl BuildOamBuffer
|
|
||||||
bl UpdatePaletteFade
|
|
||||||
ldr r0, =gUnknown_03000D60
|
|
||||||
str r4, [r0]
|
|
||||||
bl sub_8009638
|
|
||||||
ldr r0, =task00_link_test
|
|
||||||
movs r1, 0
|
|
||||||
bl CreateTask
|
|
||||||
ldr r0, =c2_08009A8C
|
|
||||||
bl SetMainCallback2
|
|
||||||
add sp, 0x4
|
|
||||||
pop {r4}
|
|
||||||
pop {r0}
|
|
||||||
bx r0
|
|
||||||
.pool
|
|
||||||
thumb_func_end sub_8009570
|
|
||||||
|
|
||||||
thumb_func_start sub_8009628
|
thumb_func_start sub_8009628
|
||||||
sub_8009628: @ 8009628
|
sub_8009628: @ 8009628
|
||||||
lsls r0, 24
|
lsls r0, 24
|
||||||
|
@ -196,6 +196,6 @@ void sub_800AC34(void);
|
|||||||
|
|
||||||
void sub_80097E8(void);
|
void sub_80097E8(void);
|
||||||
|
|
||||||
extern IWRAM_DATA u32 gUnknown_03003130[3]; // common
|
extern IWRAM_DATA struct LinkTestBGInfo gUnknown_03003130; // common
|
||||||
|
|
||||||
#endif // GUARD_LINK_H
|
#endif // GUARD_LINK_H
|
||||||
|
53
src/link.c
53
src/link.c
@ -2,6 +2,7 @@
|
|||||||
// Includes
|
// Includes
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "librfu.h"
|
#include "librfu.h"
|
||||||
|
#include "rng.h"
|
||||||
#include "gpu_regs.h"
|
#include "gpu_regs.h"
|
||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
@ -54,11 +55,18 @@ IWRAM_DATA void *gUnknown_03000DA8;
|
|||||||
IWRAM_DATA void *gUnknown_03000DAC;
|
IWRAM_DATA void *gUnknown_03000DAC;
|
||||||
IWRAM_DATA bool32 gUnknown_03000DB0;
|
IWRAM_DATA bool32 gUnknown_03000DB0;
|
||||||
|
|
||||||
|
u16 gUnknown_020229C6 = 0;
|
||||||
|
|
||||||
// Static ROM declarations
|
// Static ROM declarations
|
||||||
|
|
||||||
void sub_800E700(void);
|
void sub_8009638(void);
|
||||||
u32 sub_800BEC0(void);
|
void sub_80096BC(void);
|
||||||
|
void c2_08009A8C(void);
|
||||||
|
void sub_800A2E0(void);
|
||||||
|
void task00_link_test(u8 taskId);
|
||||||
void sub_800B4A4(void);
|
void sub_800B4A4(void);
|
||||||
|
u32 sub_800BEC0(void);
|
||||||
|
void sub_800E700(void);
|
||||||
|
|
||||||
// .rodata
|
// .rodata
|
||||||
|
|
||||||
@ -113,9 +121,9 @@ void sub_8009414(u8 a0, u8 a1, u8 a2, u8 a3, u16 a4)
|
|||||||
{
|
{
|
||||||
LoadPalette(gLinkTestDigitsPal, a0 * 16, 0x20);
|
LoadPalette(gLinkTestDigitsPal, a0 * 16, 0x20);
|
||||||
DmaCopy16(3, gLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(a3) + (16 * a4), sizeof gLinkTestDigitsGfx);
|
DmaCopy16(3, gLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(a3) + (16 * a4), sizeof gLinkTestDigitsGfx);
|
||||||
gUnknown_03003130[0] = a2;
|
gUnknown_03003130.screenBaseBlock = a2;
|
||||||
gUnknown_03003130[1] = a0;
|
gUnknown_03003130.paletteNum = a0;
|
||||||
gUnknown_03003130[2] = a4;
|
gUnknown_03003130.dummy_8 = a4;
|
||||||
switch (a1)
|
switch (a1)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
@ -136,8 +144,37 @@ void sub_80094EC(u8 a0, u8 a1, u8 a2, u8 a3)
|
|||||||
{
|
{
|
||||||
LoadPalette(gLinkTestDigitsPal, a0 * 16, 0x20);
|
LoadPalette(gLinkTestDigitsPal, a0 * 16, 0x20);
|
||||||
DmaCopy16(3, gLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(a3), sizeof gLinkTestDigitsGfx);
|
DmaCopy16(3, gLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(a3), sizeof gLinkTestDigitsGfx);
|
||||||
gUnknown_03003130[0] = a2;
|
gUnknown_03003130.screenBaseBlock = a2;
|
||||||
gUnknown_03003130[1] = a0;
|
gUnknown_03003130.paletteNum = a0;
|
||||||
gUnknown_03003130[2] = 0;
|
gUnknown_03003130.dummy_8 = 0;
|
||||||
SetGpuReg(gUnknown_082ED1D0[a1], BGCNT_SCREENBASE(a2) | BGCNT_CHARBASE(a3));
|
SetGpuReg(gUnknown_082ED1D0[a1], BGCNT_SCREENBASE(a2) | BGCNT_CHARBASE(a3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sub_8009570(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
ResetSpriteData();
|
||||||
|
FreeAllSpritePalettes();
|
||||||
|
ResetTasks();
|
||||||
|
SetVBlankCallback(sub_80096BC);
|
||||||
|
sub_800A2E0();
|
||||||
|
gUnknown_020229C6 = 0x1111;
|
||||||
|
sub_8009734();
|
||||||
|
SeedRng(gMain.vblankCounter2);
|
||||||
|
for (i = 0; i < 4; i ++)
|
||||||
|
{
|
||||||
|
gSaveBlock2Ptr->playerTrainerId[i] = Random() % 256;
|
||||||
|
}
|
||||||
|
sub_8009414(0, 2, 4, 0, 0);
|
||||||
|
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG2_ON | DISPCNT_OBJ_ON);
|
||||||
|
CreateTask(sub_8009404, 0);
|
||||||
|
RunTasks();
|
||||||
|
AnimateSprites();
|
||||||
|
BuildOamBuffer();
|
||||||
|
UpdatePaletteFade();
|
||||||
|
gUnknown_03000D60 = 0;
|
||||||
|
sub_8009638();
|
||||||
|
CreateTask(task00_link_test, 0);
|
||||||
|
SetMainCallback2(c2_08009A8C);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user