mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-01 08:25:18 +01:00
trigger button press when GameCube L/R are 50%+ depressed
remove sync using vsync - use timers for sync only
This commit is contained in:
parent
6cb97df316
commit
f65c3d01c3
@ -416,6 +416,13 @@ static void decodepad (int chan)
|
|||||||
else if(sin(angle) < -THRES)
|
else if(sin(angle) < -THRES)
|
||||||
jp |= PAD_BUTTON_DOWN;
|
jp |= PAD_BUTTON_DOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Count as pressed if down far enough (~50% down)
|
||||||
|
if (userInput[chan].pad.triggerL > 0x80)
|
||||||
|
jp |= PAD_TRIGGER_L;
|
||||||
|
if (userInput[chan].pad.triggerR > 0x80)
|
||||||
|
jp |= PAD_TRIGGER_R;
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
/***
|
/***
|
||||||
Wii Joystick (classic, nunchuk) input
|
Wii Joystick (classic, nunchuk) input
|
||||||
|
@ -78,7 +78,6 @@ bool8 S9xOpenSoundDevice(void)
|
|||||||
/* eke-eke */
|
/* eke-eke */
|
||||||
void S9xInitSync()
|
void S9xInitSync()
|
||||||
{
|
{
|
||||||
FrameTimer = 0;
|
|
||||||
prev = gettime();
|
prev = gettime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,6 +85,8 @@ void S9xInitSync()
|
|||||||
|
|
||||||
void S9xSyncSpeed ()
|
void S9xSyncSpeed ()
|
||||||
{
|
{
|
||||||
|
unsigned int timediffallowed = Settings.TurboMode ? 0 : Settings.FrameTime;
|
||||||
|
|
||||||
while (!S9xSyncSound())
|
while (!S9xSyncSound())
|
||||||
usleep(10);
|
usleep(10);
|
||||||
|
|
||||||
@ -94,17 +95,12 @@ void S9xSyncSpeed ()
|
|||||||
if (Settings.TurboMode)
|
if (Settings.TurboMode)
|
||||||
skipFrms = Settings.TurboSkipFrames;
|
skipFrms = Settings.TurboSkipFrames;
|
||||||
|
|
||||||
if (timerstyle == 0) /* use Wii vertical sync (VSYNC) with NTSC roms */
|
now = gettime();
|
||||||
|
|
||||||
|
if (diff_usec(prev, now) > timediffallowed)
|
||||||
{
|
{
|
||||||
while (FrameTimer == 0)
|
/* Timer has already expired */
|
||||||
{
|
if (IPPU.SkippedFrames < skipFrms)
|
||||||
usleep(50);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FrameTimer > skipFrms)
|
|
||||||
FrameTimer = skipFrms;
|
|
||||||
|
|
||||||
if ((FrameTimer > 1) && (IPPU.SkippedFrames < skipFrms))
|
|
||||||
{
|
{
|
||||||
IPPU.SkippedFrames++;
|
IPPU.SkippedFrames++;
|
||||||
IPPU.RenderThisFrame = FALSE;
|
IPPU.RenderThisFrame = FALSE;
|
||||||
@ -115,42 +111,20 @@ void S9xSyncSpeed ()
|
|||||||
IPPU.RenderThisFrame = TRUE;
|
IPPU.RenderThisFrame = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* use internal timer for PAL roms */
|
else
|
||||||
{
|
{
|
||||||
unsigned int timediffallowed = Settings.TurboMode ? 0 : Settings.FrameTime;
|
/*** Ahead - so hold up ***/
|
||||||
now = gettime();
|
while (diff_usec(prev, now) < timediffallowed)
|
||||||
|
|
||||||
if (diff_usec(prev, now) > timediffallowed)
|
|
||||||
{
|
{
|
||||||
/* Timer has already expired */
|
now = gettime();
|
||||||
if (IPPU.SkippedFrames < skipFrms)
|
usleep(50);
|
||||||
{
|
|
||||||
IPPU.SkippedFrames++;
|
|
||||||
IPPU.RenderThisFrame = FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IPPU.SkippedFrames = 0;
|
|
||||||
IPPU.RenderThisFrame = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
IPPU.RenderThisFrame = TRUE;
|
||||||
{
|
IPPU.SkippedFrames = 0;
|
||||||
/*** Ahead - so hold up ***/
|
|
||||||
while (diff_usec(prev, now) < timediffallowed)
|
|
||||||
{
|
|
||||||
now = gettime();
|
|
||||||
usleep(50);
|
|
||||||
}
|
|
||||||
IPPU.RenderThisFrame = TRUE;
|
|
||||||
IPPU.SkippedFrames = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
prev = now;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Settings.TurboMode)
|
prev = now;
|
||||||
FrameTimer--;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,31 +182,6 @@ void ipl_set_config(unsigned char c)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* setFrameTimerMethod()
|
|
||||||
* change frametimer method depending on whether ROM is NTSC or PAL
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
void setFrameTimerMethod()
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Set frametimer method
|
|
||||||
(timerstyle: 0=NTSC vblank, 1=PAL int timer)
|
|
||||||
*/
|
|
||||||
if ( Settings.PAL ) {
|
|
||||||
if(vmode_60hz)
|
|
||||||
timerstyle = 1;
|
|
||||||
else
|
|
||||||
timerstyle = 0;
|
|
||||||
} else {
|
|
||||||
if(vmode_60hz)
|
|
||||||
timerstyle = 0;
|
|
||||||
else
|
|
||||||
timerstyle = 1;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* IOS Check
|
* IOS Check
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -449,9 +424,6 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
AudioStart ();
|
AudioStart ();
|
||||||
|
|
||||||
FrameTimer = 0;
|
|
||||||
setFrameTimerMethod (); // set frametimer method every time a ROM is loaded
|
|
||||||
|
|
||||||
CheckVideo = 2; // force video update
|
CheckVideo = 2; // force video update
|
||||||
prevRenderedFrameCount = IPPU.RenderedFramesCount;
|
prevRenderedFrameCount = IPPU.RenderedFramesCount;
|
||||||
currentMode = GCSettings.render;
|
currentMode = GCSettings.render;
|
||||||
|
@ -67,8 +67,7 @@ int gameScreenPngSize = 0;
|
|||||||
|
|
||||||
u32 FrameTimer = 0;
|
u32 FrameTimer = 0;
|
||||||
|
|
||||||
bool vmode_60hz = true;
|
static bool vmode_60hz = true;
|
||||||
int timerstyle = 0;
|
|
||||||
bool progressive = 0;
|
bool progressive = 0;
|
||||||
|
|
||||||
#define HASPECT 320
|
#define HASPECT 320
|
||||||
|
@ -36,8 +36,6 @@ extern bool progressive;
|
|||||||
extern u8 * gameScreenPng;
|
extern u8 * gameScreenPng;
|
||||||
extern int gameScreenPngSize;
|
extern int gameScreenPngSize;
|
||||||
extern u32 FrameTimer;
|
extern u32 FrameTimer;
|
||||||
extern bool vmode_60hz;
|
|
||||||
extern int timerstyle;
|
|
||||||
extern int CheckVideo;
|
extern int CheckVideo;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <ppc/timebase.h>
|
#include <ppc/timebase.h>
|
||||||
#include <xenon_sound/sound.h>
|
#include <xenon_sound/sound.h>
|
||||||
|
|
||||||
int FrameTimer, timerstyle = 1;
|
int FrameTimer = 0;
|
||||||
unsigned long long prev, now;
|
unsigned long long prev, now;
|
||||||
|
|
||||||
unsigned long long gettime(void)
|
unsigned long long gettime(void)
|
||||||
@ -128,7 +128,6 @@ void S9xGenerateSound()
|
|||||||
/* eke-eke */
|
/* eke-eke */
|
||||||
void S9xInitSync()
|
void S9xInitSync()
|
||||||
{
|
{
|
||||||
FrameTimer = 0;
|
|
||||||
prev = gettime();
|
prev = gettime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,18 +139,15 @@ void S9xSyncSpeed ()
|
|||||||
|
|
||||||
if (Settings.TurboMode)
|
if (Settings.TurboMode)
|
||||||
skipFrms = Settings.TurboSkipFrames;
|
skipFrms = Settings.TurboSkipFrames;
|
||||||
|
|
||||||
if (timerstyle == 0) /* use NGC vertical sync (VSYNC) with NTSC roms */
|
unsigned int timediffallowed = Settings.TurboMode ? 0 : Settings.FrameTime;
|
||||||
|
now = gettime();
|
||||||
|
|
||||||
|
if (diff_usec(prev, now) > timediffallowed)
|
||||||
{
|
{
|
||||||
while (FrameTimer == 0)
|
printf("L\n");
|
||||||
{
|
/* Timer has already expired */
|
||||||
udelay(50);
|
if (IPPU.SkippedFrames < skipFrms)
|
||||||
}
|
|
||||||
|
|
||||||
if (FrameTimer > skipFrms)
|
|
||||||
FrameTimer = skipFrms;
|
|
||||||
|
|
||||||
if ((FrameTimer > 1) && (IPPU.SkippedFrames < skipFrms))
|
|
||||||
{
|
{
|
||||||
IPPU.SkippedFrames++;
|
IPPU.SkippedFrames++;
|
||||||
IPPU.RenderThisFrame = FALSE;
|
IPPU.RenderThisFrame = FALSE;
|
||||||
@ -162,43 +158,20 @@ void S9xSyncSpeed ()
|
|||||||
IPPU.RenderThisFrame = TRUE;
|
IPPU.RenderThisFrame = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* use internal timer for PAL roms */
|
else
|
||||||
{
|
{
|
||||||
unsigned int timediffallowed = Settings.TurboMode ? 0 : Settings.FrameTime;
|
/*** Ahead - so hold up ***/
|
||||||
now = gettime();
|
while (diff_usec(prev, now) < timediffallowed)
|
||||||
|
|
||||||
if (diff_usec(prev, now) > timediffallowed)
|
|
||||||
{
|
{
|
||||||
printf("L\n");
|
now = gettime();
|
||||||
/* Timer has already expired */
|
udelay(50);
|
||||||
if (IPPU.SkippedFrames < skipFrms)
|
|
||||||
{
|
|
||||||
IPPU.SkippedFrames++;
|
|
||||||
IPPU.RenderThisFrame = FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IPPU.SkippedFrames = 0;
|
|
||||||
IPPU.RenderThisFrame = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
IPPU.RenderThisFrame = TRUE;
|
||||||
{
|
IPPU.SkippedFrames = 0;
|
||||||
/*** Ahead - so hold up ***/
|
|
||||||
while (diff_usec(prev, now) < timediffallowed)
|
|
||||||
{
|
|
||||||
now = gettime();
|
|
||||||
udelay(50);
|
|
||||||
}
|
|
||||||
IPPU.RenderThisFrame = TRUE;
|
|
||||||
IPPU.SkippedFrames = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
prev = now;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Settings.TurboMode)
|
prev = now;
|
||||||
FrameTimer--;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user