mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-12-26 03:01:51 +01:00
restructure main loops
This commit is contained in:
parent
25b192c940
commit
4aefa04e9d
@ -1082,6 +1082,7 @@ MainMenu (int selectedMenu)
|
|||||||
|
|
||||||
case -1: // Button B
|
case -1: // Button B
|
||||||
// Return to Game
|
// Return to Game
|
||||||
|
if(SNESROMSize > 0)
|
||||||
quit = 1;
|
quit = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -78,9 +78,9 @@ void ExitCleanup()
|
|||||||
{
|
{
|
||||||
LWP_SuspendThread (devicethread);
|
LWP_SuspendThread (devicethread);
|
||||||
UnmountAllFAT();
|
UnmountAllFAT();
|
||||||
CloseShare();
|
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
|
CloseShare();
|
||||||
DI_Close();
|
DI_Close();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -192,16 +192,43 @@ void setFrameTimerMethod()
|
|||||||
extern void S9xInitSync();
|
extern void S9xInitSync();
|
||||||
bool CheckVideo = 0; // for forcing video reset in video.cpp
|
bool CheckVideo = 0; // for forcing video reset in video.cpp
|
||||||
extern uint32 prevRenderedFrameCount;
|
extern uint32 prevRenderedFrameCount;
|
||||||
|
static int selectedMenu = -1;
|
||||||
|
|
||||||
void
|
void
|
||||||
emulate ()
|
emulate ()
|
||||||
{
|
{
|
||||||
S9xSetSoundMute (TRUE);
|
while (1)
|
||||||
AudioStart ();
|
{
|
||||||
S9xInitSync(); // Eke-Eke: initialize frame Sync
|
// go back to checking if devices were inserted/removed
|
||||||
|
// since we're entering the menu
|
||||||
|
LWP_ResumeThread (devicethread);
|
||||||
|
|
||||||
|
ConfigRequested = 1;
|
||||||
|
|
||||||
|
if(SNESROMSize > 0 && selectedMenu != 2)
|
||||||
|
selectedMenu = 2;
|
||||||
|
|
||||||
|
MainMenu (selectedMenu); // go to menu
|
||||||
|
|
||||||
|
ConfigRequested = 0;
|
||||||
|
|
||||||
|
Settings.SuperScopeMaster = (GCSettings.Superscope > 0 ? true : false);
|
||||||
|
Settings.MouseMaster = (GCSettings.Mouse > 0 ? true : false);
|
||||||
|
Settings.JustifierMaster = (GCSettings.Justifier > 0 ? true : false);
|
||||||
|
SetControllers ();
|
||||||
|
|
||||||
|
// stop checking if devices were removed/inserted
|
||||||
|
// since we're starting emulation again
|
||||||
|
LWP_SuspendThread (devicethread);
|
||||||
|
|
||||||
|
ResetVideo_Emu();
|
||||||
|
|
||||||
|
FrameTimer = 0;
|
||||||
setFrameTimerMethod(); // set frametimer method every time a ROM is loaded
|
setFrameTimerMethod(); // set frametimer method every time a ROM is loaded
|
||||||
|
|
||||||
|
CheckVideo = 1; // force video update
|
||||||
|
prevRenderedFrameCount = IPPU.RenderedFramesCount;
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
S9xMainLoop ();
|
S9xMainLoop ();
|
||||||
@ -245,47 +272,12 @@ emulate ()
|
|||||||
ShutdownWii();
|
ShutdownWii();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// GUI Stuff
|
|
||||||
/*
|
|
||||||
gui_alloc();
|
|
||||||
gui_makebg ();
|
|
||||||
gui_clearscreen();
|
|
||||||
gui_draw ();
|
|
||||||
gui_showscreen ();
|
|
||||||
//gui_savescreen ();
|
|
||||||
*/
|
|
||||||
|
|
||||||
MainMenu (2); // go to game menu
|
|
||||||
|
|
||||||
// save zoom level
|
// save zoom level
|
||||||
SavePrefs(SILENT);
|
SavePrefs(SILENT);
|
||||||
|
break;
|
||||||
FrameTimer = 0;
|
}
|
||||||
setFrameTimerMethod (); // set frametimer method every time a ROM is loaded
|
}
|
||||||
|
}
|
||||||
Settings.SuperScopeMaster = (GCSettings.Superscope > 0 ? true : false);
|
|
||||||
Settings.MouseMaster = (GCSettings.Mouse > 0 ? true : false);
|
|
||||||
Settings.JustifierMaster = (GCSettings.Justifier > 0 ? true : false);
|
|
||||||
SetControllers ();
|
|
||||||
//S9xReportControllers ();
|
|
||||||
|
|
||||||
ConfigRequested = 0;
|
|
||||||
|
|
||||||
#ifdef _DEBUG_VIDEO
|
|
||||||
// log stuff
|
|
||||||
fprintf(debughandle, "\n\nPlaying ROM: %s", Memory.ROMFilename);
|
|
||||||
fprintf(debughandle, "\nrender: %u", GCSettings.render);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CheckVideo = 1; // force video update
|
|
||||||
prevRenderedFrameCount = IPPU.RenderedFramesCount;
|
|
||||||
|
|
||||||
// stop checking if devices were removed/inserted
|
|
||||||
// since we're starting emulation again
|
|
||||||
LWP_SuspendThread (devicethread);
|
|
||||||
}//if ConfigRequested
|
|
||||||
|
|
||||||
}//while
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateAppPath(char origpath[])
|
void CreateAppPath(char origpath[])
|
||||||
@ -337,8 +329,6 @@ main(int argc, char *argv[])
|
|||||||
DI_Init(); // first
|
DI_Init(); // first
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int selectedMenu = -1;
|
|
||||||
|
|
||||||
#ifdef DEBUG_WII
|
#ifdef DEBUG_WII
|
||||||
DEBUG_Init(GDBSTUB_DEVICE_USB, 1); // init debugging
|
DEBUG_Init(GDBSTUB_DEVICE_USB, 1); // init debugging
|
||||||
//_break();
|
//_break();
|
||||||
@ -464,16 +454,10 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Get the user to load a ROM
|
S9xSetSoundMute (TRUE);
|
||||||
while (SNESROMSize <= 0)
|
AudioStart ();
|
||||||
{
|
S9xInitSync(); // initialize frame sync
|
||||||
MainMenu (selectedMenu);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Emulate
|
// Emulate
|
||||||
emulate ();
|
emulate ();
|
||||||
|
|
||||||
// NO! - We're never leaving here!
|
|
||||||
while (1);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user