mirror of
https://github.com/dborth/vbagx.git
synced 2024-12-26 02:31:50 +01:00
fix GB <> GBA crash
This commit is contained in:
parent
1d9678fac8
commit
47365d258c
@ -94,6 +94,11 @@ void InitialiseSound()
|
|||||||
memset(soundbuffer, 0, 3200);
|
memset(soundbuffer, 0, 3200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResetAudio()
|
||||||
|
{
|
||||||
|
memset(soundbuffer, 0, 3200);
|
||||||
|
}
|
||||||
|
|
||||||
void StopAudio()
|
void StopAudio()
|
||||||
{
|
{
|
||||||
AUDIO_StopDMA();
|
AUDIO_StopDMA();
|
||||||
|
@ -15,6 +15,7 @@ void MIXER_AddSamples( u8 *sampledata, int len );
|
|||||||
int MIXER_GetSamples( u8 *dstbuffer, int maxlen );
|
int MIXER_GetSamples( u8 *dstbuffer, int maxlen );
|
||||||
void StopAudio();
|
void StopAudio();
|
||||||
void StartAudio();
|
void StartAudio();
|
||||||
|
void ResetAudio();
|
||||||
void InitialiseSound();
|
void InitialiseSound();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -267,9 +267,9 @@ u32 DecodeJoy(unsigned short pad)
|
|||||||
|
|
||||||
return J;
|
return J;
|
||||||
}
|
}
|
||||||
u32 GetJoy()
|
u32 GetJoy(int pad)
|
||||||
{
|
{
|
||||||
int pad = 0;
|
pad = 0;
|
||||||
|
|
||||||
s8 gc_px = PAD_SubStickX (0);
|
s8 gc_px = PAD_SubStickX (0);
|
||||||
s8 gc_py = PAD_SubStickY (0);
|
s8 gc_py = PAD_SubStickY (0);
|
||||||
@ -313,9 +313,7 @@ u32 GetJoy()
|
|||||||
SaveBatteryOrState(GCSettings.SaveMethod, 0, SILENT); // save battery
|
SaveBatteryOrState(GCSettings.SaveMethod, 0, SILENT); // save battery
|
||||||
SaveBatteryOrState(GCSettings.SaveMethod, 1, SILENT); // save state
|
SaveBatteryOrState(GCSettings.SaveMethod, 1, SILENT); // save state
|
||||||
}
|
}
|
||||||
// change to menu video mode
|
ConfigRequested = 1;
|
||||||
ResetVideo_Menu ();
|
|
||||||
MainMenu(3);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -24,6 +24,6 @@ extern unsigned int ncpadmap[];
|
|||||||
|
|
||||||
s8 WPAD_Stick(u8 chan,u8 right, int axis);
|
s8 WPAD_Stick(u8 chan,u8 right, int axis);
|
||||||
|
|
||||||
u32 GetJoy();
|
u32 GetJoy(int which);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -40,6 +40,7 @@ extern "C" {
|
|||||||
|
|
||||||
extern bool ROMLoaded;
|
extern bool ROMLoaded;
|
||||||
extern int emulating;
|
extern int emulating;
|
||||||
|
int ConfigRequested = 0;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -98,23 +99,22 @@ int main()
|
|||||||
selectedMenu = 2; // change to preferences menu
|
selectedMenu = 2; // change to preferences menu
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!ROMLoaded)
|
|
||||||
{
|
|
||||||
MainMenu (selectedMenu);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Main loop
|
//Main loop
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
ResetVideo_Menu (); // change to menu video mode
|
||||||
|
MainMenu(selectedMenu);
|
||||||
|
selectedMenu = 3; // return to game menu from now on
|
||||||
|
|
||||||
while (emulating)
|
while (emulating)
|
||||||
{
|
{
|
||||||
emulator.emuMain(emulator.emuCount);
|
emulator.emuMain(emulator.emuCount);
|
||||||
|
|
||||||
|
if(ConfigRequested)
|
||||||
|
{
|
||||||
|
ConfigRequested = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Never leaving here
|
|
||||||
while(1);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,5 +51,6 @@ struct SGCSettings{
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern struct SGCSettings GCSettings;
|
extern struct SGCSettings GCSettings;
|
||||||
|
extern int ConfigRequested;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -515,6 +515,7 @@ void systemWriteDataToSoundBuffer()
|
|||||||
|
|
||||||
bool systemSoundInit()
|
bool systemSoundInit()
|
||||||
{
|
{
|
||||||
|
ResetAudio();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,7 +539,7 @@ bool systemReadJoypads()
|
|||||||
|
|
||||||
u32 systemReadJoypad(int which)
|
u32 systemReadJoypad(int which)
|
||||||
{
|
{
|
||||||
return GetJoy();
|
return GetJoy(which);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user