mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-26 04:12:34 +01:00
- [Psy-X] proper SetVideoMode/GetVideoMode, NTSC or PAL timestep
This commit is contained in:
parent
d0d21ee687
commit
9d7f707a99
@ -758,7 +758,7 @@ void LaunchGame(void)
|
||||
fakeOtherPlayer = 0;
|
||||
|
||||
ResetGraph(1);
|
||||
SetVideoMode(1);
|
||||
SetVideoMode(video_mode);
|
||||
|
||||
gMissionCompletionState = PAUSEMODE_GAMEOVER;
|
||||
|
||||
|
@ -15,11 +15,8 @@
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#if defined(NTSC_VERSION)
|
||||
#define FIXED_TIME_STEP (1.0/60.0) // 60 FPS clock
|
||||
#else
|
||||
#define FIXED_TIME_STEP (1.0/50.0) // 50 FPS clock
|
||||
#endif
|
||||
#define FIXED_TIME_STEP_NTSC (1.0/60.0) // 60 FPS clock
|
||||
#define FIXED_TIME_STEP_PAL (1.0/50.0) // 50 FPS clock
|
||||
|
||||
#define SWAP_INTERVAL 1
|
||||
|
||||
@ -340,12 +337,15 @@ int Emulator_DoVSyncCallback()
|
||||
int vblankThreadMain(void* data)
|
||||
{
|
||||
Emulator_InitHPCTimer(&g_vblankTimer);
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
const long vmode = GetVideoMode();
|
||||
const double timestep = vmode == MODE_NTSC ? FIXED_TIME_STEP_NTSC : FIXED_TIME_STEP_PAL;
|
||||
|
||||
double delta = Emulator_GetHPCTime(&g_vblankTimer, 0);
|
||||
|
||||
if (delta > FIXED_TIME_STEP)
|
||||
if (delta > timestep)
|
||||
{
|
||||
// do vblank events
|
||||
SDL_LockMutex(g_vblankMutex);
|
||||
@ -1901,6 +1901,9 @@ void Emulator_SwapWindow()
|
||||
|
||||
void Emulator_WaitForTimestep(int count)
|
||||
{
|
||||
const long vmode = GetVideoMode();
|
||||
const double timestep = vmode == MODE_NTSC ? FIXED_TIME_STEP_NTSC : FIXED_TIME_STEP_PAL;
|
||||
|
||||
// additional wait for swap
|
||||
if (g_swapInterval > 0)
|
||||
{
|
||||
@ -1909,7 +1912,7 @@ void Emulator_WaitForTimestep(int count)
|
||||
{
|
||||
SDL_Delay(0); // yield
|
||||
delta = Emulator_GetHPCTime(&g_swapTimer, 0);
|
||||
} while (delta < FIXED_TIME_STEP * count);
|
||||
} while (delta < timestep * count);
|
||||
|
||||
Emulator_GetHPCTime(&g_swapTimer, 1);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include <SDL_timer.h>
|
||||
|
||||
int vmode = MODE_NTSC;
|
||||
void(*vsync_callback)(void) = NULL;
|
||||
|
||||
int StopCallback(void)
|
||||
@ -15,8 +16,9 @@ int StopCallback(void)
|
||||
|
||||
int ResetCallback(void)
|
||||
{
|
||||
int old = (int)vsync_callback;
|
||||
vsync_callback = NULL;
|
||||
return 0;
|
||||
return old;
|
||||
}
|
||||
|
||||
extern unsigned int g_swapTime;
|
||||
@ -44,26 +46,19 @@ int VSync(int mode)
|
||||
|
||||
int VSyncCallback(void(*f)(void))
|
||||
{
|
||||
int old = (int)vsync_callback;
|
||||
vsync_callback = f;
|
||||
return 0;
|
||||
}
|
||||
|
||||
long GetVideoMode(void)
|
||||
{
|
||||
#ifdef NTSC_VERSION
|
||||
return MODE_NTSC;
|
||||
#else
|
||||
return MODE_PAL;
|
||||
#endif
|
||||
return old;
|
||||
}
|
||||
|
||||
long SetVideoMode(long mode)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
#ifdef NTSC_VERSION
|
||||
return MODE_NTSC;
|
||||
#else
|
||||
return MODE_PAL;
|
||||
#endif
|
||||
int old = vmode;
|
||||
vmode = mode;
|
||||
return old;
|
||||
}
|
||||
|
||||
long GetVideoMode()
|
||||
{
|
||||
return vmode;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user