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)
|
||||
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
|
||||
/***
|
||||
Wii Joystick (classic, nunchuk) input
|
||||
|
@ -78,7 +78,6 @@ bool8 S9xOpenSoundDevice(void)
|
||||
/* eke-eke */
|
||||
void S9xInitSync()
|
||||
{
|
||||
FrameTimer = 0;
|
||||
prev = gettime();
|
||||
}
|
||||
|
||||
@ -86,6 +85,8 @@ void S9xInitSync()
|
||||
|
||||
void S9xSyncSpeed ()
|
||||
{
|
||||
unsigned int timediffallowed = Settings.TurboMode ? 0 : Settings.FrameTime;
|
||||
|
||||
while (!S9xSyncSound())
|
||||
usleep(10);
|
||||
|
||||
@ -94,17 +95,12 @@ void S9xSyncSpeed ()
|
||||
if (Settings.TurboMode)
|
||||
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)
|
||||
{
|
||||
usleep(50);
|
||||
}
|
||||
|
||||
if (FrameTimer > skipFrms)
|
||||
FrameTimer = skipFrms;
|
||||
|
||||
if ((FrameTimer > 1) && (IPPU.SkippedFrames < skipFrms))
|
||||
/* Timer has already expired */
|
||||
if (IPPU.SkippedFrames < skipFrms)
|
||||
{
|
||||
IPPU.SkippedFrames++;
|
||||
IPPU.RenderThisFrame = FALSE;
|
||||
@ -115,42 +111,20 @@ void S9xSyncSpeed ()
|
||||
IPPU.RenderThisFrame = TRUE;
|
||||
}
|
||||
}
|
||||
else /* use internal timer for PAL roms */
|
||||
else
|
||||
{
|
||||
unsigned int timediffallowed = Settings.TurboMode ? 0 : Settings.FrameTime;
|
||||
now = gettime();
|
||||
|
||||
if (diff_usec(prev, now) > timediffallowed)
|
||||
/*** Ahead - so hold up ***/
|
||||
while (diff_usec(prev, now) < timediffallowed)
|
||||
{
|
||||
/* Timer has already expired */
|
||||
if (IPPU.SkippedFrames < skipFrms)
|
||||
{
|
||||
IPPU.SkippedFrames++;
|
||||
IPPU.RenderThisFrame = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
IPPU.SkippedFrames = 0;
|
||||
IPPU.RenderThisFrame = TRUE;
|
||||
}
|
||||
now = gettime();
|
||||
usleep(50);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*** Ahead - so hold up ***/
|
||||
while (diff_usec(prev, now) < timediffallowed)
|
||||
{
|
||||
now = gettime();
|
||||
usleep(50);
|
||||
}
|
||||
IPPU.RenderThisFrame = TRUE;
|
||||
IPPU.SkippedFrames = 0;
|
||||
}
|
||||
|
||||
prev = now;
|
||||
IPPU.RenderThisFrame = TRUE;
|
||||
IPPU.SkippedFrames = 0;
|
||||
}
|
||||
|
||||
if (!Settings.TurboMode)
|
||||
FrameTimer--;
|
||||
prev = now;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -182,31 +182,6 @@ void ipl_set_config(unsigned char c)
|
||||
}
|
||||
#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
|
||||
***************************************************************************/
|
||||
@ -449,9 +424,6 @@ main(int argc, char *argv[])
|
||||
|
||||
AudioStart ();
|
||||
|
||||
FrameTimer = 0;
|
||||
setFrameTimerMethod (); // set frametimer method every time a ROM is loaded
|
||||
|
||||
CheckVideo = 2; // force video update
|
||||
prevRenderedFrameCount = IPPU.RenderedFramesCount;
|
||||
currentMode = GCSettings.render;
|
||||
|
@ -67,8 +67,7 @@ int gameScreenPngSize = 0;
|
||||
|
||||
u32 FrameTimer = 0;
|
||||
|
||||
bool vmode_60hz = true;
|
||||
int timerstyle = 0;
|
||||
static bool vmode_60hz = true;
|
||||
bool progressive = 0;
|
||||
|
||||
#define HASPECT 320
|
||||
|
@ -36,8 +36,6 @@ extern bool progressive;
|
||||
extern u8 * gameScreenPng;
|
||||
extern int gameScreenPngSize;
|
||||
extern u32 FrameTimer;
|
||||
extern bool vmode_60hz;
|
||||
extern int timerstyle;
|
||||
extern int CheckVideo;
|
||||
|
||||
#endif
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <ppc/timebase.h>
|
||||
#include <xenon_sound/sound.h>
|
||||
|
||||
int FrameTimer, timerstyle = 1;
|
||||
int FrameTimer = 0;
|
||||
unsigned long long prev, now;
|
||||
|
||||
unsigned long long gettime(void)
|
||||
@ -128,7 +128,6 @@ void S9xGenerateSound()
|
||||
/* eke-eke */
|
||||
void S9xInitSync()
|
||||
{
|
||||
FrameTimer = 0;
|
||||
prev = gettime();
|
||||
}
|
||||
|
||||
@ -140,18 +139,15 @@ void S9xSyncSpeed ()
|
||||
|
||||
if (Settings.TurboMode)
|
||||
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)
|
||||
{
|
||||
udelay(50);
|
||||
}
|
||||
|
||||
if (FrameTimer > skipFrms)
|
||||
FrameTimer = skipFrms;
|
||||
|
||||
if ((FrameTimer > 1) && (IPPU.SkippedFrames < skipFrms))
|
||||
printf("L\n");
|
||||
/* Timer has already expired */
|
||||
if (IPPU.SkippedFrames < skipFrms)
|
||||
{
|
||||
IPPU.SkippedFrames++;
|
||||
IPPU.RenderThisFrame = FALSE;
|
||||
@ -162,43 +158,20 @@ void S9xSyncSpeed ()
|
||||
IPPU.RenderThisFrame = TRUE;
|
||||
}
|
||||
}
|
||||
else /* use internal timer for PAL roms */
|
||||
else
|
||||
{
|
||||
unsigned int timediffallowed = Settings.TurboMode ? 0 : Settings.FrameTime;
|
||||
now = gettime();
|
||||
|
||||
if (diff_usec(prev, now) > timediffallowed)
|
||||
/*** Ahead - so hold up ***/
|
||||
while (diff_usec(prev, now) < timediffallowed)
|
||||
{
|
||||
printf("L\n");
|
||||
/* Timer has already expired */
|
||||
if (IPPU.SkippedFrames < skipFrms)
|
||||
{
|
||||
IPPU.SkippedFrames++;
|
||||
IPPU.RenderThisFrame = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
IPPU.SkippedFrames = 0;
|
||||
IPPU.RenderThisFrame = TRUE;
|
||||
}
|
||||
now = gettime();
|
||||
udelay(50);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*** Ahead - so hold up ***/
|
||||
while (diff_usec(prev, now) < timediffallowed)
|
||||
{
|
||||
now = gettime();
|
||||
udelay(50);
|
||||
}
|
||||
IPPU.RenderThisFrame = TRUE;
|
||||
IPPU.SkippedFrames = 0;
|
||||
}
|
||||
|
||||
prev = now;
|
||||
IPPU.RenderThisFrame = TRUE;
|
||||
IPPU.SkippedFrames = 0;
|
||||
}
|
||||
|
||||
if (!Settings.TurboMode)
|
||||
FrameTimer--;
|
||||
prev = now;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user