fix GB <> GBA crash

This commit is contained in:
dborth 2008-10-18 20:40:48 +00:00
parent 1d9678fac8
commit 47365d258c
7 changed files with 24 additions and 18 deletions

View File

@ -94,6 +94,11 @@ void InitialiseSound()
memset(soundbuffer, 0, 3200);
}
void ResetAudio()
{
memset(soundbuffer, 0, 3200);
}
void StopAudio()
{
AUDIO_StopDMA();

View File

@ -15,6 +15,7 @@ void MIXER_AddSamples( u8 *sampledata, int len );
int MIXER_GetSamples( u8 *dstbuffer, int maxlen );
void StopAudio();
void StartAudio();
void ResetAudio();
void InitialiseSound();
#endif

View File

@ -267,9 +267,9 @@ u32 DecodeJoy(unsigned short pad)
return J;
}
u32 GetJoy()
u32 GetJoy(int pad)
{
int pad = 0;
pad = 0;
s8 gc_px = PAD_SubStickX (0);
s8 gc_py = PAD_SubStickY (0);
@ -313,9 +313,7 @@ u32 GetJoy()
SaveBatteryOrState(GCSettings.SaveMethod, 0, SILENT); // save battery
SaveBatteryOrState(GCSettings.SaveMethod, 1, SILENT); // save state
}
// change to menu video mode
ResetVideo_Menu ();
MainMenu(3);
ConfigRequested = 1;
return 0;
}
else

View File

@ -24,6 +24,6 @@ extern unsigned int ncpadmap[];
s8 WPAD_Stick(u8 chan,u8 right, int axis);
u32 GetJoy();
u32 GetJoy(int which);
#endif

View File

@ -40,6 +40,7 @@ extern "C" {
extern bool ROMLoaded;
extern int emulating;
int ConfigRequested = 0;
/****************************************************************************
@ -98,23 +99,22 @@ int main()
selectedMenu = 2; // change to preferences menu
}
while (!ROMLoaded)
{
MainMenu (selectedMenu);
}
//Main loop
while(1)
{
ResetVideo_Menu (); // change to menu video mode
MainMenu(selectedMenu);
selectedMenu = 3; // return to game menu from now on
while (emulating)
{
emulator.emuMain(emulator.emuCount);
if(ConfigRequested)
{
ConfigRequested = 0;
break;
}
}
}
// Never leaving here
while(1);
return 0;
}

View File

@ -51,5 +51,6 @@ struct SGCSettings{
};
extern struct SGCSettings GCSettings;
extern int ConfigRequested;
#endif

View File

@ -515,6 +515,7 @@ void systemWriteDataToSoundBuffer()
bool systemSoundInit()
{
ResetAudio();
return true;
}
@ -538,7 +539,7 @@ bool systemReadJoypads()
u32 systemReadJoypad(int which)
{
return GetJoy();
return GetJoy(which);
}
/****************************************************************************