mirror of
https://github.com/pret/pmd-red.git
synced 2026-04-19 21:47:34 -05:00
84 lines
1.5 KiB
C
84 lines
1.5 KiB
C
#include "global.h"
|
|
#include "code_800C9CC.h"
|
|
#include "cpu.h"
|
|
#include "random.h"
|
|
#include "reg_control.h"
|
|
|
|
// Todo: Figure out if this file could be merged with bg_control and cpu?
|
|
EWRAM_INIT u32 gUnknown_203B0B8 = {0};
|
|
|
|
// Should be arm9.bin02008A00, but it's way different
|
|
void WaitForNextFrameAndAdvanceRNG(void)
|
|
{
|
|
sub_800BA5C();
|
|
gUnknown_203B0B8++;
|
|
|
|
if (gRawKeyInput & (A_BUTTON | SELECT_BUTTON))
|
|
Rand32Bit();
|
|
|
|
Rand32Bit();
|
|
}
|
|
|
|
UNUSED static u32 sub_800CB50(void)
|
|
{
|
|
return gUnknown_203B0B8;
|
|
}
|
|
|
|
UNUSED static void nullsub_180(void)
|
|
{
|
|
}
|
|
|
|
// Should be arm9.bin::020084D4, but it's way different
|
|
void xxx_call_update_bg_sound_input(void)
|
|
{
|
|
xxx_update_bg_sound_input();
|
|
}
|
|
|
|
UNUSED static void nullsub_181(void)
|
|
{
|
|
}
|
|
|
|
UNUSED static bool8 sub_800CB70(void)
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
void ReadKeyInput(Inputs *r0)
|
|
{
|
|
u16 keyInput = REG_KEYINPUT ^ KEYS_MASK;
|
|
r0->held = 0;
|
|
|
|
if (keyInput & DPAD_UP)
|
|
r0->held = DPAD_UP;
|
|
|
|
if (keyInput & DPAD_DOWN)
|
|
r0->held |= DPAD_DOWN;
|
|
|
|
if (keyInput & DPAD_LEFT)
|
|
r0->held |= DPAD_LEFT;
|
|
|
|
if (keyInput & DPAD_RIGHT)
|
|
r0->held |= DPAD_RIGHT;
|
|
|
|
if (keyInput & A_BUTTON)
|
|
r0->held |= A_BUTTON;
|
|
|
|
if (keyInput & B_BUTTON)
|
|
r0->held |= B_BUTTON;
|
|
|
|
if (keyInput & START_BUTTON)
|
|
r0->held |= START_BUTTON;
|
|
|
|
if (keyInput & SELECT_BUTTON)
|
|
r0->held |= SELECT_BUTTON;
|
|
|
|
if (keyInput & R_BUTTON)
|
|
r0->held |= R_BUTTON;
|
|
|
|
if (keyInput & L_BUTTON)
|
|
r0->held |= L_BUTTON;
|
|
|
|
gRawKeyInput = keyInput;
|
|
}
|
|
|