mirror of
https://github.com/libretro/beetle-pce-fast-libretro.git
synced 2024-11-23 07:50:03 +00:00
Reimplement MDFNI_CloseGame - will properly clean up CDInterfaces
(and thread with it) before shutdown of libretro side
This commit is contained in:
parent
2242570d21
commit
fee9719855
14
libretro.cpp
14
libretro.cpp
@ -870,15 +870,7 @@ void retro_unload_game()
|
||||
if (!game)
|
||||
return;
|
||||
|
||||
MDFN_FlushGameCheats(0);
|
||||
|
||||
game->CloseGame();
|
||||
|
||||
if (game->name)
|
||||
free(game->name);
|
||||
game->name = 0;
|
||||
|
||||
MDFNMP_Kill();
|
||||
MDFNI_CloseGame();
|
||||
}
|
||||
|
||||
|
||||
@ -887,7 +879,7 @@ void retro_unload_game()
|
||||
// See mednafen/psx/input/gamepad.cpp
|
||||
static void update_input(void)
|
||||
{
|
||||
MDFNGI *currgame = game;
|
||||
MDFNGI *currgame = (MDFNGI*)game;
|
||||
#if defined(WANT_PSX_EMU)
|
||||
input_buf[0] = 0;
|
||||
input_buf[1] = 0;
|
||||
@ -1537,7 +1529,7 @@ static size_t serialize_size;
|
||||
|
||||
size_t retro_serialize_size(void)
|
||||
{
|
||||
MDFNGI *curgame = game;
|
||||
MDFNGI *curgame = (MDFNGI*)game;
|
||||
//if (serialize_size)
|
||||
// return serialize_size;
|
||||
|
||||
|
@ -150,14 +150,14 @@ static void ReadM3U(std::vector<std::string> &file_list, std::string path, unsig
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NEED_CD
|
||||
static std::vector<CDIF *> CDInterfaces; // FIXME: Cleanup on error out.
|
||||
#endif
|
||||
// TODO: LoadCommon()
|
||||
|
||||
MDFNGI *MDFNI_LoadCD(const char *force_module, const char *devicename)
|
||||
{
|
||||
uint8 LayoutMD5[16];
|
||||
#ifdef NEED_CD
|
||||
static std::vector<CDIF *> CDInterfaces; // FIXME: Cleanup on error out.
|
||||
#endif
|
||||
|
||||
MDFN_printf(_("Loading %s...\n\n"), devicename ? devicename : _("PHYSICAL CD"));
|
||||
|
||||
@ -344,6 +344,29 @@ MDFNGI *MDFNI_LoadGame(const char *force_module, const char *name)
|
||||
return(MDFNGameInfo);
|
||||
}
|
||||
|
||||
void MDFNI_CloseGame(void)
|
||||
{
|
||||
if(!MDFNGameInfo)
|
||||
return;
|
||||
|
||||
MDFN_FlushGameCheats(0);
|
||||
|
||||
MDFNGameInfo->CloseGame();
|
||||
if(MDFNGameInfo->name)
|
||||
{
|
||||
free(MDFNGameInfo->name);
|
||||
MDFNGameInfo->name = NULL;
|
||||
}
|
||||
MDFNMP_Kill();
|
||||
|
||||
MDFNGameInfo = NULL;
|
||||
|
||||
#ifdef NEED_CD
|
||||
for(unsigned i = 0; i < CDInterfaces.size(); i++)
|
||||
delete CDInterfaces[i];
|
||||
CDInterfaces.clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool MDFNI_InitializeModule(void)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user