Fix disk append/replace.

This commit is contained in:
Themaister 2013-04-27 15:48:36 +02:00
parent 3a42eeeafb
commit 30babf07cc
2 changed files with 9 additions and 1 deletions

View File

@ -163,6 +163,8 @@ static void check_system_specs(void)
} }
#if defined(WANT_PSX_EMU) #if defined(WANT_PSX_EMU)
// Ugly poking. There's no public interface for this.
#include "mednafen/psx/psx.h" #include "mednafen/psx/psx.h"
namespace MDFN_IEN_PSX namespace MDFN_IEN_PSX
{ {
@ -170,6 +172,8 @@ namespace MDFN_IEN_PSX
extern std::vector<CDIF*> *cdifs; extern std::vector<CDIF*> *cdifs;
} }
// Poke into psx.cpp
unsigned CalcDiscSCEx();
using MDFN_IEN_PSX::CD_SelectedDisc; using MDFN_IEN_PSX::CD_SelectedDisc;
using MDFN_IEN_PSX::cdifs; using MDFN_IEN_PSX::cdifs;
@ -229,6 +233,9 @@ static bool disk_replace_image_index(unsigned index, const struct retro_game_inf
cdifs->erase(cdifs->begin() + index); cdifs->erase(cdifs->begin() + index);
if (index < CD_SelectedDisc) if (index < CD_SelectedDisc)
CD_SelectedDisc--; CD_SelectedDisc--;
// Poke into psx.cpp
CalcDiscSCEx();
return true; return true;
} }
@ -237,6 +244,7 @@ static bool disk_replace_image_index(unsigned index, const struct retro_game_inf
CDIF *iface = CDIF_Open(info->path, false); CDIF *iface = CDIF_Open(info->path, false);
delete cdifs->at(index); delete cdifs->at(index);
cdifs->at(index) = iface; cdifs->at(index) = iface;
CalcDiscSCEx();
return true; return true;
} }
catch (const std::exception &e) catch (const std::exception &e)

View File

@ -994,7 +994,7 @@ static const char *CalcDiscSCEx_BySYSTEMCNF(CDIF *c, unsigned *rr)
return(ret); return(ret);
} }
static unsigned CalcDiscSCEx(void) unsigned CalcDiscSCEx()
{ {
const char *prev_valid_id = NULL; const char *prev_valid_id = NULL;
unsigned ret_region = MDFN_GetSettingI("psx.region_default"); unsigned ret_region = MDFN_GetSettingI("psx.region_default");