mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-12-24 02:01:48 +01:00
fixed weird exception occuring
This commit is contained in:
parent
3ee65ad74b
commit
e822832b99
@ -1139,7 +1139,6 @@ void MainMenu ()
|
||||
{
|
||||
crccheck = crc32 (0, &sram.sram[0], 0x10000);
|
||||
if (genromsize && (crccheck != sram.crc)) strcpy (menutitle, "*** SRAM has been modified ***");
|
||||
else sprintf(menutitle, "%d FPS", FramesPerSecond);
|
||||
|
||||
ret = domenu (&items[0], count, 0);
|
||||
switch (ret)
|
||||
|
@ -119,7 +119,6 @@ void reloadrom ()
|
||||
* M A I N
|
||||
*
|
||||
***************************************************************************/
|
||||
int FramesPerSecond = 0;
|
||||
int frameticker = 0;
|
||||
bool fat_enabled = 0;
|
||||
|
||||
@ -131,10 +130,6 @@ int main (int argc, char *argv[])
|
||||
DI_Init();
|
||||
#endif
|
||||
|
||||
long long now, prev;
|
||||
int RenderedFrameCount = 0;
|
||||
int FrameCount = 0;
|
||||
|
||||
/* initialize OGC subsystems */
|
||||
ogc_video__init();
|
||||
ogc_input__init();
|
||||
@ -183,67 +178,12 @@ int main (int argc, char *argv[])
|
||||
reloadrom ();
|
||||
}
|
||||
|
||||
/* Show Menu */
|
||||
MainMenu();
|
||||
ConfigRequested = 0;
|
||||
|
||||
/* Reset frame sync */
|
||||
frameticker = 0;
|
||||
FrameCount = 0;
|
||||
RenderedFrameCount = 0;
|
||||
|
||||
/* Start Audio & Video */
|
||||
ogc_audio__start();
|
||||
ogc_video__start();
|
||||
/* Show Menu first */
|
||||
ConfigRequested = 1;
|
||||
|
||||
/* Emulation Loop */
|
||||
while (1)
|
||||
{
|
||||
if (gc_pal < 0)
|
||||
{
|
||||
/* this code is NEVER executed */
|
||||
/* strangely, when removing it, this makes the program crashing (why ?) */
|
||||
prev = now = gettime();
|
||||
while (diff_usec(prev, now) < 1) now = gettime();
|
||||
prev = now;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (frameticker > 1)
|
||||
{
|
||||
/* frameskipping */
|
||||
frameticker--;
|
||||
system_frame (1);
|
||||
|
||||
/* update audio only */
|
||||
ogc_audio__update();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* frame sync */
|
||||
while (!frameticker) usleep(1);
|
||||
|
||||
/* frame rendering */
|
||||
system_frame (0);
|
||||
RenderedFrameCount++;
|
||||
|
||||
/* update video & audio */
|
||||
ogc_audio__update();
|
||||
ogc_video__update();
|
||||
}
|
||||
|
||||
frameticker--;
|
||||
}
|
||||
|
||||
/* check rendered frames (FPS) */
|
||||
FrameCount++;
|
||||
if (FrameCount == vdp_rate)
|
||||
{
|
||||
FramesPerSecond = RenderedFrameCount;
|
||||
RenderedFrameCount = 0;
|
||||
FrameCount = 0;
|
||||
}
|
||||
|
||||
/* Check for Menu request */
|
||||
if (ConfigRequested)
|
||||
{
|
||||
@ -257,13 +197,35 @@ int main (int argc, char *argv[])
|
||||
|
||||
/* reset frame sync */
|
||||
frameticker = 0;
|
||||
FrameCount = 0;
|
||||
RenderedFrameCount = 0;
|
||||
|
||||
/* restart Audio & Video */
|
||||
/* start Audio & Video */
|
||||
ogc_audio__start();
|
||||
ogc_video__start();
|
||||
}
|
||||
|
||||
if (frameticker > 1)
|
||||
{
|
||||
/* frameskipping */
|
||||
frameticker--;
|
||||
system_frame (1);
|
||||
|
||||
/* update audio only */
|
||||
ogc_audio__update();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* frame sync */
|
||||
while (!frameticker) usleep(1);
|
||||
|
||||
/* frame rendering */
|
||||
system_frame (0);
|
||||
|
||||
/* update video & audio */
|
||||
ogc_audio__update();
|
||||
ogc_video__update();
|
||||
}
|
||||
|
||||
frameticker--;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -28,8 +28,8 @@ extern u8 soundbuffer[2][3840];
|
||||
extern int mixbuffer;
|
||||
|
||||
extern void ogc_audio__init(void);
|
||||
extern void ogc_audio__stop(void);
|
||||
extern void ogc_audio__start(void);
|
||||
extern void ogc_audio__stop(void);
|
||||
extern void ogc_audio__update(void);
|
||||
|
||||
#endif
|
||||
|
@ -536,7 +536,6 @@ static void gxReset(void)
|
||||
|
||||
/* resynchronize field & restore VSYNC handler */
|
||||
whichfb = odd_frame;
|
||||
VIDEO_SetNextFramebuffer (xfb[whichfb]);
|
||||
VIDEO_SetPreRetraceCallback(xfb_swap);
|
||||
VIDEO_Flush();
|
||||
VIDEO_WaitVSync();
|
||||
@ -655,9 +654,18 @@ void ogc_video__update()
|
||||
draw_square ();
|
||||
GX_DrawDone ();
|
||||
|
||||
/* copy EFB to current XFB */
|
||||
GX_CopyDisp (xfb[odd_frame], GX_TRUE);
|
||||
GX_Flush ();
|
||||
/* special case: interlaced display */
|
||||
if (interlaced && !config.render && (odd_frame == whichfb))
|
||||
{
|
||||
/* resynchronize frame emulation */
|
||||
odd_frame = whichfb ^1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* copy EFB to current XFB */
|
||||
GX_CopyDisp (xfb[whichfb], GX_TRUE);
|
||||
GX_Flush ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize VIDEO subsystem */
|
||||
|
@ -24,15 +24,16 @@
|
||||
#ifndef _GC_VIDEO_H_
|
||||
#define _GC_VIDEO_H_
|
||||
|
||||
extern unsigned int *xfb[2];
|
||||
extern int whichfb;
|
||||
extern int gc_pal;
|
||||
extern GXRModeObj *tvmodes[6];
|
||||
extern GXRModeObj *vmode;
|
||||
extern u8 *texturemem;
|
||||
|
||||
extern void ogc_video__init(void);
|
||||
extern void ogc_video__start(void);
|
||||
extern void ogc_video__stop(void);
|
||||
extern void ogc_video__update(void);
|
||||
|
||||
extern int gc_pal;
|
||||
extern unsigned int *xfb[2];
|
||||
extern int whichfb;
|
||||
extern GXRModeObj *tvmodes[6];
|
||||
extern GXRModeObj *vmode;
|
||||
extern u8 *texturemem;
|
||||
#endif
|
||||
|
@ -39,7 +39,6 @@ extern void memfile_autoload();
|
||||
|
||||
extern int peripherals;
|
||||
extern int frameticker;
|
||||
extern int FramesPerSecond;
|
||||
extern int Shutdown;
|
||||
extern bool fat_enabled;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user