mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-22 10:22:48 +01:00
- [Psy-X] fix shutdown
This commit is contained in:
parent
a299a002a0
commit
54177774a8
@ -91,9 +91,6 @@ extern void PsyX_EndScene();
|
||||
/* Explicitly updates emulator input loop */
|
||||
extern void PsyX_UpdateInput();
|
||||
|
||||
/* Usually called at the end if main function */
|
||||
extern void PsyX_ShutDown();
|
||||
|
||||
/* Screen size of emulated PSX viewport with widescreen offsets */
|
||||
extern void PsyX_GetPSXWidescreenMappedViewport(struct _RECT16* rect);
|
||||
|
||||
|
@ -97,11 +97,14 @@ int g_enableSPUReverb = 0;
|
||||
int g_ALEffectsSupported = 0;
|
||||
|
||||
LPALGENEFFECTS alGenEffects = NULL;
|
||||
LPALDELETEEFFECTS alDeleteEffects = NULL;
|
||||
LPALEFFECTI alEffecti = NULL;
|
||||
LPALEFFECTF alEffectf = NULL;
|
||||
LPALGENAUXILIARYEFFECTSLOTS alGenAuxiliaryEffectSlots = NULL;
|
||||
LPALDELETEAUXILIARYEFFECTSLOTS alDeleteAuxiliaryEffectSlots = NULL;
|
||||
LPALAUXILIARYEFFECTSLOTI alAuxiliaryEffectSloti = NULL;
|
||||
|
||||
|
||||
void InitOpenAlEffects()
|
||||
{
|
||||
g_ALEffectsSupported = 0;
|
||||
@ -113,9 +116,11 @@ void InitOpenAlEffects()
|
||||
}
|
||||
|
||||
alGenEffects = (LPALGENEFFECTS)alGetProcAddress("alGenEffects");
|
||||
alDeleteEffects = (LPALDELETEEFFECTS)alGetProcAddress("alDeleteEffects");
|
||||
alEffecti = (LPALEFFECTI)alGetProcAddress("alEffecti");
|
||||
alEffectf = (LPALEFFECTF)alGetProcAddress("alEffectf");
|
||||
alGenAuxiliaryEffectSlots = (LPALGENAUXILIARYEFFECTSLOTS)alGetProcAddress("alGenAuxiliaryEffectSlots");
|
||||
alDeleteAuxiliaryEffectSlots = (LPALDELETEAUXILIARYEFFECTSLOTS)alGetProcAddress("alDeleteAuxiliaryEffectSlots");
|
||||
alAuxiliaryEffectSloti = (LPALAUXILIARYEFFECTSLOTI)alGetProcAddress("alAuxiliaryEffectSloti");
|
||||
|
||||
int max_sends = 0;
|
||||
@ -234,10 +239,18 @@ void PsyX_ShutdownSound()
|
||||
for (int i = 0; i < SPU_VOICES; i++)
|
||||
{
|
||||
SPUVoice& voice = g_SpuVoices[i];
|
||||
alGenSources(1, &voice.alSource);
|
||||
alGenBuffers(1, &voice.alBuffer);
|
||||
alDeleteSources(1, &voice.alSource);
|
||||
alDeleteBuffers(1, &voice.alBuffer);
|
||||
}
|
||||
|
||||
if (g_ALEffectsSupported)
|
||||
{
|
||||
alDeleteEffects(1, &g_nAlReverbEffect);
|
||||
g_ALEffectsSupported = AL_NONE;
|
||||
}
|
||||
|
||||
alDeleteAuxiliaryEffectSlots(1, g_ALEffectSlots);
|
||||
|
||||
alcDestroyContext(g_ALCcontext);
|
||||
alcCloseDevice(g_ALCdevice);
|
||||
|
||||
|
@ -419,35 +419,35 @@ void PsyX_Initialise(char* appName, int width, int height, int fullscreen)
|
||||
if (SDL_Init(SDL_INIT_VIDEO) != 0)
|
||||
{
|
||||
eprinterr("Failed to initialise SDL\n");
|
||||
PsyX_ShutDown();
|
||||
PsyX_Shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GR_InitialiseRender(windowNameStr, width, height, fullscreen))
|
||||
{
|
||||
eprinterr("Failed to Intialise Window\n");
|
||||
PsyX_ShutDown();
|
||||
PsyX_Shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!PsyX_Sys_InitialiseCore())
|
||||
{
|
||||
eprinterr("Failed to Intialise Psy-X Core.\n");
|
||||
PsyX_ShutDown();
|
||||
PsyX_Shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GR_InitialisePSX())
|
||||
{
|
||||
eprinterr("Failed to Intialise PSX.\n");
|
||||
PsyX_ShutDown();
|
||||
PsyX_Shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
PsyX_Sys_InitialiseInput();
|
||||
|
||||
// set shutdown function (PSX apps usualy don't exit)
|
||||
atexit(PsyX_ShutDown);
|
||||
atexit(PsyX_Shutdown);
|
||||
}
|
||||
|
||||
void PsyX_GetScreenSize(int& screenWidth, int& screenHeight)
|
||||
@ -722,7 +722,7 @@ void PsyX_Exit()
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void PsyX_ShutDown()
|
||||
void PsyX_Shutdown()
|
||||
{
|
||||
if (!g_window)
|
||||
return;
|
||||
|
@ -430,7 +430,7 @@ int GR_InitialiseRender(char* windowName, int width, int height, int fullscreen)
|
||||
if (!GR_InitialiseGLExt())
|
||||
{
|
||||
eprinterr("Failed to Intialise GL extensions\n");
|
||||
PsyX_ShutDown();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -681,5 +681,7 @@ int main(int argc, char** argv)
|
||||
|
||||
DeinitStringMng();
|
||||
|
||||
PsyX_Shutdown();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user