mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-27 21:14:21 +01:00
change video callbacks to avoid over-reading pads
This commit is contained in:
parent
5f3c4ad61d
commit
ff46a17373
@ -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
|
||||
|
@ -34,5 +34,6 @@ void NGCReportButtons ();
|
||||
void SetControllers ();
|
||||
void SetDefaultButtonMap ();
|
||||
bool MenuRequested();
|
||||
void UpdatePads();
|
||||
|
||||
#endif
|
||||
|
@ -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);
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <wiiuse/wpad.h>
|
||||
#include <ogc/texconv.h>
|
||||
|
||||
#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);
|
||||
|
Loading…
Reference in New Issue
Block a user