diff options
author | luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> | 2020-11-07 18:06:37 -0500 |
---|---|---|
committer | luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> | 2020-11-07 18:06:37 -0500 |
commit | a29b18ed2f27c2991b0894a69fa04738ba9522ca (patch) | |
tree | 4db08c6d6a2d585a0a42ee6f023faa9f6e8d13fb /src/main.c | |
parent | 8d2d34aae9767f283b3c34140920828e37540d23 (diff) | |
parent | 8b1c2c946b3b58cc938f0496a9af11a641749a1e (diff) |
Merge branch 'master' of https://github.com/pret/pokeemerald
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/src/main.c b/src/main.c index b3b76b1fb..9fd1d0a35 100644 --- a/src/main.c +++ b/src/main.c @@ -81,27 +81,13 @@ void InitIntrHandlers(void); static void WaitForVBlank(void); void EnableVCountIntrAtLine150(void); +#define B_START_SELECT (B_BUTTON | START_BUTTON | SELECT_BUTTON) + void AgbMain() { -#if MODERN // Modern compilers are liberal with the stack on entry to this function, // so RegisterRamReset may crash if it resets IWRAM. - RegisterRamReset(RESET_ALL & ~RESET_IWRAM); - asm("mov\tr1, #0xC0\n" - "\tlsl\tr1, r1, #0x12\n" - "\tmov r2, #0xFC\n" - "\tlsl r2, r2, #0x7\n" - "\tadd\tr2, r1, r2\n" - "\tmov\tr0, #0\n" - "\tmov\tr3, r0\n" - "\tmov\tr4, r0\n" - "\tmov\tr5, r0\n" - ".LCU0:\n" - "\tstmia r1!, {r0, r3, r4, r5}\n" - "\tcmp\tr1, r2\n" - "\tbcc\t.LCU0\n" - ); -#else +#if !MODERN RegisterRamReset(RESET_ALL); #endif //MODERN *(vu16 *)BG_PLTT = 0x7FFF; @@ -134,11 +120,9 @@ void AgbMain() { ReadKeys(); - if (!gSoftResetDisabled - && JOY_HELD_RAW(A_BUTTON) - && JOY_HELD_RAW(B_BUTTON) - && JOY_HELD_RAW(START_BUTTON) - && JOY_HELD_RAW(SELECT_BUTTON)) //The reset key combo A + B + START + SELECT + if (gSoftResetDisabled == FALSE + && (gMain.heldKeysRaw & A_BUTTON) + && (gMain.heldKeysRaw & B_START_SELECT) == B_START_SELECT) { rfu_REQ_stopMode(); rfu_waitREQComplete(); @@ -262,7 +246,9 @@ static void ReadKeys(void) if (keyInput != 0 && gMain.heldKeys == keyInput) { - if (--gMain.keyRepeatCounter == 0) + gMain.keyRepeatCounter--; + + if (gMain.keyRepeatCounter == 0) { gMain.newAndRepeatedKeys = keyInput; gMain.keyRepeatCounter = gKeyRepeatContinueDelay; @@ -341,7 +327,7 @@ static void VBlankIntr(void) { if (gWirelessCommType != 0) RfuVSync(); - else if (!gLinkVSyncDisabled) + else if (gLinkVSyncDisabled == FALSE) LinkVSync(); gMain.vblankCounter1++; |