mirror of
https://github.com/dborth/fceugx.git
synced 2024-11-01 06:55:05 +01:00
timing changes
This commit is contained in:
parent
f641aba760
commit
a17c9f74a5
@ -41,12 +41,6 @@ int ConfigRequested = 0;
|
||||
bool isWii;
|
||||
uint8 *xbsave=NULL;
|
||||
|
||||
long long prev;
|
||||
long long now;
|
||||
|
||||
long long gettime();
|
||||
u32 diff_usec(long long start,long long end);
|
||||
|
||||
extern bool romLoaded;
|
||||
|
||||
extern int cleanSFMDATA();
|
||||
@ -55,44 +49,6 @@ extern uint8 FDSBIOS[8192];
|
||||
|
||||
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count);
|
||||
|
||||
/****************************************************************************
|
||||
* setFrameTimer()
|
||||
* change frame timings depending on whether ROM is NTSC or PAL
|
||||
***************************************************************************/
|
||||
|
||||
int normaldiff;
|
||||
|
||||
void setFrameTimer()
|
||||
{
|
||||
if (GCSettings.timing) // PAL
|
||||
{
|
||||
if(vmode_60hz == 1)
|
||||
normaldiff = 20000; // 50hz
|
||||
else
|
||||
normaldiff = 16667; // 60hz
|
||||
}
|
||||
else
|
||||
{
|
||||
if(vmode_60hz == 1)
|
||||
normaldiff = 16667; // 60hz
|
||||
else
|
||||
normaldiff = 20000; // 50hz
|
||||
}
|
||||
FrameTimer = 0;
|
||||
prev = gettime();
|
||||
}
|
||||
|
||||
void SyncSpeed()
|
||||
{
|
||||
now = gettime();
|
||||
int diff = normaldiff - diff_usec(prev, now);
|
||||
if (diff > 0) // ahead - take a nap
|
||||
usleep(diff);
|
||||
|
||||
prev = now;
|
||||
FrameTimer--;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* ipl_set_config
|
||||
* lowlevel Qoob Modchip disable
|
||||
@ -219,12 +175,8 @@ int main(int argc, char *argv[])
|
||||
ConfigRequested = 0;
|
||||
break; // leave emulation loop
|
||||
}
|
||||
|
||||
SyncSpeed();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "driver.h"
|
||||
|
||||
#include "gcvideo.h"
|
||||
#include "fceuconfig.h"
|
||||
#include "images/nesback.h"
|
||||
|
||||
extern unsigned int SMBTimer;
|
||||
@ -54,7 +55,39 @@ static Mtx projectionMatrix,modelViewMatrix;
|
||||
void CheesyScale(unsigned char *XBuf);
|
||||
int whichfb = 0;
|
||||
int copynow = GX_FALSE;
|
||||
u32 FrameTimer = 0;
|
||||
|
||||
long long prev;
|
||||
long long now;
|
||||
|
||||
long long gettime();
|
||||
u32 diff_usec(long long start,long long end);
|
||||
|
||||
/****************************************************************************
|
||||
* setFrameTimer()
|
||||
* change frame timings depending on whether ROM is NTSC or PAL
|
||||
***************************************************************************/
|
||||
|
||||
int normaldiff;
|
||||
|
||||
void setFrameTimer()
|
||||
{
|
||||
if (GCSettings.timing == 1) // PAL
|
||||
normaldiff = 20000; // 50hz
|
||||
else
|
||||
normaldiff = 16667; // 60hz
|
||||
|
||||
prev = gettime();
|
||||
}
|
||||
|
||||
void SyncSpeed()
|
||||
{
|
||||
now = gettime();
|
||||
int diff = normaldiff - diff_usec(prev, now);
|
||||
if (diff > 0) // ahead - take a nap
|
||||
usleep(diff);
|
||||
|
||||
prev = now;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* VideoThreading
|
||||
@ -67,8 +100,8 @@ static unsigned char vbstack[TSTACK];
|
||||
/****************************************************************************
|
||||
* vbgetback
|
||||
*
|
||||
* This callback enables the emulator to keep running while waiting for a
|
||||
* vertical blank.
|
||||
* This callback enables the emulator to keep running while managing proper
|
||||
* timing
|
||||
*
|
||||
* Putting LWP to good use :)
|
||||
***************************************************************************/
|
||||
@ -77,7 +110,7 @@ vbgetback (void *arg)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
VIDEO_WaitVSync (); /**< Wait for video vertical blank */
|
||||
SyncSpeed();
|
||||
LWP_SuspendThread (vbthread);
|
||||
}
|
||||
|
||||
@ -112,7 +145,6 @@ static void copy_to_xfb()
|
||||
copynow = GX_FALSE;
|
||||
}
|
||||
SMBTimer++;
|
||||
FrameTimer++;
|
||||
|
||||
// FDS switch disk requested - need to eject, select, and insert
|
||||
// but not all at once!
|
||||
|
@ -16,6 +16,7 @@ void clearscreen ();
|
||||
void showscreen ();
|
||||
void initDisplay();
|
||||
void RenderFrame(char *XBuf, int style);
|
||||
void setFrameTimer();
|
||||
|
||||
// color palettes
|
||||
#define MAXPAL 12
|
||||
@ -29,6 +30,5 @@ extern struct st_palettes palettes[];
|
||||
extern int FDSSwitchRequested;
|
||||
extern int vmode_60hz;
|
||||
extern bool progressive;
|
||||
extern u32 FrameTimer;
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user