diff --git a/source/ngc/input.cpp b/source/ngc/input.cpp index 1e2bbc3..991ea6f 100644 --- a/source/ngc/input.cpp +++ b/source/ngc/input.cpp @@ -192,6 +192,37 @@ void ResetControls(int consoleCtrl, int wiiCtrl) } } +/**************************************************************************** + * UpdatePads + * + * called by postRetraceCallback in InitGCVideo - scans pad and wpad + ***************************************************************************/ +void UpdatePads() +{ + #ifdef HW_RVL + WPAD_ScanPads(); + #endif + PAD_ScanPads(); + + for(int i=3; i >= 0; i--) + { + #ifdef HW_RVL + memcpy(&userInput[i].wpad, WPAD_Data(i), sizeof(WPADData)); + #endif + + userInput[i].chan = i; + userInput[i].pad.btns_d = PAD_ButtonsDown(i); + userInput[i].pad.btns_u = PAD_ButtonsUp(i); + userInput[i].pad.btns_h = PAD_ButtonsHeld(i); + userInput[i].pad.stickX = PAD_StickX(i); + userInput[i].pad.stickY = PAD_StickY(i); + userInput[i].pad.substickX = PAD_SubStickX(i); + userInput[i].pad.substickY = PAD_SubStickY(i); + userInput[i].pad.triggerL = PAD_TriggerL(i); + userInput[i].pad.triggerR = PAD_TriggerR(i); + } +} + #ifdef HW_RVL /**************************************************************************** @@ -607,6 +638,8 @@ void NGCReportButtons () { int i, j; + UpdatePads(); + Settings.TurboMode = ( userInput[0].pad.substickX > 70 || userInput[0].WPAD_Stick(1,0) > 70 @@ -614,9 +647,9 @@ void NGCReportButtons () /* Check for menu: * CStick left - * OR "L+R+X+Y" (eg. Hombrew/Adapted SNES controllers) + * OR "L+R+X+Y" (eg. Homebrew/Adapted SNES controllers) * OR "Home" on the wiimote or classic controller - * OR LEFT on classic right analog stick + * OR Left on classic right analog stick */ if(MenuRequested()) ScreenshotRequested = 1; // go to the menu diff --git a/source/ngc/input.h b/source/ngc/input.h index a394c96..fbe1c41 100644 --- a/source/ngc/input.h +++ b/source/ngc/input.h @@ -34,5 +34,6 @@ void NGCReportButtons (); void SetControllers (); void SetDefaultButtonMap (); bool MenuRequested(); +void UpdatePads(); #endif diff --git a/source/ngc/menu.cpp b/source/ngc/menu.cpp index bd768b5..33c11ef 100644 --- a/source/ngc/menu.cpp +++ b/source/ngc/menu.cpp @@ -1525,7 +1525,7 @@ static int MenuGameSaves(int action) GuiImage backBtnImgOver(&btnOutlineOver); GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); backBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); - backBtn.SetPosition(100, -35); + backBtn.SetPosition(50, -35); backBtn.SetLabel(&backBtnTxt); backBtn.SetImage(&backBtnImg); backBtn.SetImageOver(&backBtnImgOver); @@ -1873,7 +1873,7 @@ static int MenuGameSettings() GuiImage backBtnImgOver(&btnOutlineOver); GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); backBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); - backBtn.SetPosition(100, -35); + backBtn.SetPosition(50, -35); backBtn.SetLabel(&backBtnTxt); backBtn.SetImage(&backBtnImg); backBtn.SetImageOver(&backBtnImgOver); @@ -1992,7 +1992,7 @@ static int MenuGameCheats() GuiImage backBtnImgOver(&btnOutlineOver); GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); backBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); - backBtn.SetPosition(100, -35); + backBtn.SetPosition(50, -35); backBtn.SetLabel(&backBtnTxt); backBtn.SetImage(&backBtnImg); backBtn.SetImageOver(&backBtnImgOver); @@ -2139,7 +2139,7 @@ static int MenuSettingsMappings() GuiImage backBtnImgOver(&btnOutlineOver); GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); backBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); - backBtn.SetPosition(100, -35); + backBtn.SetPosition(50, -35); backBtn.SetLabel(&backBtnTxt); backBtn.SetImage(&backBtnImg); backBtn.SetImageOver(&backBtnImgOver); @@ -2306,7 +2306,7 @@ static int MenuSettingsMappingsController() GuiImage backBtnImgOver(&btnOutlineOver); GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); backBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); - backBtn.SetPosition(100, -35); + backBtn.SetPosition(50, -35); backBtn.SetLabel(&backBtnTxt); backBtn.SetImage(&backBtnImg); backBtn.SetImageOver(&backBtnImgOver); @@ -2533,7 +2533,7 @@ static int MenuSettingsMappingsMap() GuiImage backBtnImgOver(&btnOutlineOver); GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); backBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); - backBtn.SetPosition(100, -35); + backBtn.SetPosition(50, -35); backBtn.SetLabel(&backBtnTxt); backBtn.SetImage(&backBtnImg); backBtn.SetImageOver(&backBtnImgOver); @@ -2916,7 +2916,7 @@ static int MenuSettingsVideo() GuiImage backBtnImgOver(&btnOutlineOver); GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); backBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); - backBtn.SetPosition(100, -35); + backBtn.SetPosition(50, -35); backBtn.SetLabel(&backBtnTxt); backBtn.SetImage(&backBtnImg); backBtn.SetImageOver(&backBtnImgOver); diff --git a/source/ngc/video.cpp b/source/ngc/video.cpp index 5a979b6..93c8dfb 100644 --- a/source/ngc/video.cpp +++ b/source/ngc/video.cpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include "snes9x.h" @@ -417,38 +416,6 @@ void StopGX() VIDEO_Flush(); } -/**************************************************************************** - * UpdatePadsCB - * - * called by postRetraceCallback in InitGCVideo - scans gcpad and wpad - ***************************************************************************/ -static void -UpdatePadsCB () -{ - #ifdef HW_RVL - WPAD_ScanPads(); - #endif - PAD_ScanPads(); - - for(int i=3; i >= 0; i--) - { - #ifdef HW_RVL - memcpy(&userInput[i].wpad, WPAD_Data(i), sizeof(WPADData)); - #endif - - userInput[i].chan = i; - userInput[i].pad.btns_d = PAD_ButtonsDown(i); - userInput[i].pad.btns_u = PAD_ButtonsUp(i); - userInput[i].pad.btns_h = PAD_ButtonsHeld(i); - userInput[i].pad.stickX = PAD_StickX(i); - userInput[i].pad.stickY = PAD_StickY(i); - userInput[i].pad.substickX = PAD_SubStickX(i); - userInput[i].pad.substickY = PAD_SubStickY(i); - userInput[i].pad.triggerL = PAD_TriggerL(i); - userInput[i].pad.triggerR = PAD_TriggerR(i); - } -} - /**************************************************************************** * SetupVideoMode * @@ -589,8 +556,7 @@ InitGCVideo () VIDEO_SetNextFramebuffer (xfb[0]); // video callbacks - VIDEO_SetPostRetraceCallback ((VIRetraceCallback)UpdatePadsCB); - VIDEO_SetPreRetraceCallback ((VIRetraceCallback)copy_to_xfb); + VIDEO_SetPostRetraceCallback ((VIRetraceCallback)copy_to_xfb); VIDEO_SetBlack (FALSE); VIDEO_Flush (); @@ -659,6 +625,8 @@ ResetVideo_Emu () while (VIDEO_GetNextField()) VIDEO_WaitVSync(); + VIDEO_SetPreRetraceCallback(NULL); + GXColor background = {0, 0, 0, 255}; GX_SetCopyClear (background, 0x00ffffff); @@ -968,6 +936,8 @@ ResetVideo_Menu () while (VIDEO_GetNextField()) VIDEO_WaitVSync(); + VIDEO_SetPreRetraceCallback((VIRetraceCallback)UpdatePads); + // clears the bg to color and clears the z buffer GXColor background = {0, 0, 0, 255}; GX_SetCopyClear (background, 0x00ffffff);