From 7e112b0f0ddcc05fcbe08855114e6fea810fc3a6 Mon Sep 17 00:00:00 2001
From: Eduardo Quezada <eduardo602002@gmail.com>
Date: Thu, 22 Sep 2022 21:43:33 -0300
Subject: [PATCH] Added missing uses of JOY_xx macros

---
 src/intro.c           | 2 +-
 src/list_menu.c       | 8 ++++----
 src/main.c            | 6 +++---
 src/title_screen.c    | 4 ++--
 src/union_room_chat.c | 2 +-
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/intro.c b/src/intro.c
index b06789142..bc81bcbb6 100644
--- a/src/intro.c
+++ b/src/intro.c
@@ -1039,7 +1039,7 @@ static void MainCB2_Intro(void)
     AnimateSprites();
     BuildOamBuffer();
     UpdatePaletteFade();
-    if (gMain.newKeys && !gPaletteFade.active)
+    if (gMain.newKeys != 0 && !gPaletteFade.active)
         SetMainCallback2(MainCB2_EndIntro);
     else if (gIntroFrameCounter != -1)
         gIntroFrameCounter++;
diff --git a/src/list_menu.c b/src/list_menu.c
index 64692ce1f..112fca753 100644
--- a/src/list_menu.c
+++ b/src/list_menu.c
@@ -440,13 +440,13 @@ s32 ListMenu_ProcessInput(u8 listTaskId)
             break;
         case LIST_MULTIPLE_SCROLL_DPAD:
             // note: JOY_REPEAT won't match here
-            leftButton = gMain.newAndRepeatedKeys & DPAD_LEFT;
-            rightButton = gMain.newAndRepeatedKeys & DPAD_RIGHT;
+            leftButton = JOY_REPEAT(DPAD_LEFT);
+            rightButton = JOY_REPEAT(DPAD_RIGHT);
             break;
         case LIST_MULTIPLE_SCROLL_L_R:
             // same as above
-            leftButton = gMain.newAndRepeatedKeys & L_BUTTON;
-            rightButton = gMain.newAndRepeatedKeys & R_BUTTON;
+            leftButton = JOY_REPEAT(L_BUTTON);
+            rightButton = JOY_REPEAT(R_BUTTON);
             break;
         }
 
diff --git a/src/main.c b/src/main.c
index 5fd236447..29494043f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -124,8 +124,8 @@ void AgbMain()
         ReadKeys();
 
         if (gSoftResetDisabled == FALSE
-         && (gMain.heldKeysRaw & A_BUTTON)
-         && (gMain.heldKeysRaw & B_START_SELECT) == B_START_SELECT)
+         && JOY_HELD_RAW(A_BUTTON)
+         && JOY_HELD_RAW(B_START_SELECT) == B_START_SELECT)
         {
             rfu_REQ_stopMode();
             rfu_waitREQComplete();
@@ -278,7 +278,7 @@ static void ReadKeys(void)
             gMain.heldKeys |= A_BUTTON;
     }
 
-    if (gMain.newKeys & gMain.watchedKeysMask)
+    if (JOY_NEW(gMain.watchedKeysMask))
         gMain.watchedKeysPressed = TRUE;
 }
 
diff --git a/src/title_screen.c b/src/title_screen.c
index 25a1d60d0..689c96863 100644
--- a/src/title_screen.c
+++ b/src/title_screen.c
@@ -634,7 +634,7 @@ static void MainCB2(void)
 static void Task_TitleScreenPhase1(u8 taskId)
 {
     // Skip to next phase when A, B, Start, or Select is pressed
-    if ((gMain.newKeys & A_B_START_SELECT) || gTasks[taskId].data[1] != 0)
+    if (JOY_NEW(A_B_START_SELECT) || gTasks[taskId].data[1] != 0)
     {
         gTasks[taskId].tSkipToNext = TRUE;
         gTasks[taskId].tCounter = 0;
@@ -681,7 +681,7 @@ static void Task_TitleScreenPhase2(u8 taskId)
     u32 yPos;
 
     // Skip to next phase when A, B, Start, or Select is pressed
-    if ((gMain.newKeys & A_B_START_SELECT) || gTasks[taskId].tSkipToNext)
+    if (JOY_NEW(A_B_START_SELECT) || gTasks[taskId].tSkipToNext)
     {
         gTasks[taskId].tSkipToNext = TRUE;
         gTasks[taskId].tCounter = 0;
diff --git a/src/union_room_chat.c b/src/union_room_chat.c
index 5c26d1ea3..e1ca7c0b0 100755
--- a/src/union_room_chat.c
+++ b/src/union_room_chat.c
@@ -1044,7 +1044,7 @@ static void Chat_HandleInput(void)
         {
             SetChatFunction(CHAT_FUNC_SWITCH);
         }
-        else if (gMain.newAndRepeatedKeys & B_BUTTON)
+        else if (JOY_REPEAT(B_BUTTON))
         {
             if (sChat->bufferCursorPos)
             {