diff --git a/src/plugins.cpp b/src/plugins.cpp index b77d5f3..e6e6644 100644 --- a/src/plugins.cpp +++ b/src/plugins.cpp @@ -39,8 +39,8 @@ int LoadPlugins(void) { /* If we are using per-disk memory cards, defer * loading until after the disk ID has been determined */ if ((Config.McdSlot1 != 0) && (Config.McdSlot2 != 0)) { - LoadMcd(MCD1, (char*)GetMemcardPath(1)); //Memcard 1 - LoadMcd(MCD2, (char*)GetMemcardPath(2)); //Memcard 2 + LoadMcd(MCD1, GetMemcardPath(1)); //Memcard 1 + LoadMcd(MCD2, GetMemcardPath(2)); //Memcard 2 } ret = CDR_init(); diff --git a/src/plugins.h b/src/plugins.h index d9cb3e4..b57cfd3 100644 --- a/src/plugins.h +++ b/src/plugins.h @@ -200,6 +200,6 @@ s64 GetCdOpenCaseTime(void); int ReloadCdromPlugin(); // Memcard functions -const char *GetMemcardPath(int slot); +char *GetMemcardPath(int slot); #endif /* __PLUGINS_H__ */ diff --git a/src/port/sdl/frontend.cpp b/src/port/sdl/frontend.cpp index 15b67b2..afbdccb 100755 --- a/src/port/sdl/frontend.cpp +++ b/src/port/sdl/frontend.cpp @@ -1389,12 +1389,12 @@ static int McdSlot1_alter(u32 keys) int slot = Config.McdSlot1; if (keys & KEY_RIGHT) { - if (++slot > 15) slot = 0; + if (++slot > 16) slot = -1; } else if (keys & KEY_LEFT) { - if (--slot < 0) slot = 15; + if (--slot < -1) slot = 16; } Config.McdSlot1 = slot; update_memcards(1); @@ -1404,7 +1404,9 @@ static int McdSlot1_alter(u32 keys) static char *McdSlot1_show() { static char buf[32] = "\0"; - if (Config.McdSlot1 == 0) { + if (Config.McdSlot1 == -1) { + strcpy(buf, "empty"); + } else if (Config.McdSlot1 == 0) { if (string_is_empty(CdromId)) { strcpy(buf, "per-disk"); } else { @@ -1421,12 +1423,12 @@ static int McdSlot2_alter(u32 keys) int slot = Config.McdSlot2; if (keys & KEY_RIGHT) { - if (++slot > 16) slot = 0; + if (++slot > 16) slot = -1; } else if (keys & KEY_LEFT) { - if (--slot < 0) slot = 16; + if (--slot < -1) slot = 16; } Config.McdSlot2 = slot; update_memcards(2); @@ -1436,7 +1438,9 @@ static int McdSlot2_alter(u32 keys) static char *McdSlot2_show() { static char buf[32] = "\0"; - if (Config.McdSlot2 == 0) { + if (Config.McdSlot2 == -1) { + strcpy(buf, "empty"); + } else if (Config.McdSlot2 == 0) { if (string_is_empty(CdromId)) { strcpy(buf, "per-disk"); } else { diff --git a/src/port/sdl/port.cpp b/src/port/sdl/port.cpp index eb5047e..d1fed5b 100755 --- a/src/port/sdl/port.cpp +++ b/src/port/sdl/port.cpp @@ -1132,19 +1132,29 @@ void video_clear_cache() #endif } -const char *GetMemcardPath(int slot) { +char *GetMemcardPath(int slot) { switch(slot) { case 1: - return McdPath1; + if (Config.McdSlot1 == -1) { + return NULL; + } else { + return McdPath1; + } case 2: - return McdPath2; + if (Config.McdSlot2 == -1) { + return NULL; + } else { + return McdPath2; + } } return NULL; } void update_memcards(int load_mcd) { - if (Config.McdSlot1 == 0) { + if (Config.McdSlot1 == -1) { + McdPath1[0] = '\0'; + } else if (Config.McdSlot1 == 0) { if (string_is_empty(CdromId)) { /* Fallback */ sprintf(McdPath1, "%s/%s", memcardsdir, "card1.mcd"); @@ -1155,7 +1165,9 @@ void update_memcards(int load_mcd) { sprintf(McdPath1, "%s/mcd%03d.mcr", memcardsdir, (int)Config.McdSlot1); } - if (Config.McdSlot2 == 0) { + if (Config.McdSlot2 == -1) { + McdPath2[0] = '\0'; + } else if (Config.McdSlot2 == 0) { if (string_is_empty(CdromId)) { /* Fallback */ sprintf(McdPath2, "%s/%s", memcardsdir, "card2.mcd"); @@ -1167,9 +1179,9 @@ void update_memcards(int load_mcd) { } if (load_mcd & 1) - LoadMcd(MCD1, McdPath1); //Memcard 1 + LoadMcd(MCD1, GetMemcardPath(1)); //Memcard 1 if (load_mcd & 2) - LoadMcd(MCD2, McdPath2); //Memcard 2 + LoadMcd(MCD2, GetMemcardPath(2)); //Memcard 2 } const char *bios_file_get() { @@ -2004,8 +2016,8 @@ int main (int argc, char **argv) * them now */ if ((Config.McdSlot1 == 0) || (Config.McdSlot2 == 0)) { update_memcards(0); - LoadMcd(MCD1, (char*)GetMemcardPath(1)); //Memcard 1 - LoadMcd(MCD2, (char*)GetMemcardPath(2)); //Memcard 2 + LoadMcd(MCD1, GetMemcardPath(1)); //Memcard 1 + LoadMcd(MCD2, GetMemcardPath(2)); //Memcard 2 } Rumble_Init(); diff --git a/src/psxcommon.h b/src/psxcommon.h index 85ef6af..1f1c170 100644 --- a/src/psxcommon.h +++ b/src/psxcommon.h @@ -139,8 +139,8 @@ typedef struct { boolean VSyncWA; /* 1=InuYasha Sengoku Battle Fix */ u8 Cpu; /* 0=recompiler, 1=interpreter */ u8 PsxType; /* 0=ntsc, 1=pal */ - u8 McdSlot1; /* mcd slot 1, 0=CdromId.1.mcr, otherwise mcd%03u.mcr */ - u8 McdSlot2; /* mcd slot 2, 0=CdromId.2.mcr, otherwise mcd%03u.mcr */ + s8 McdSlot1; /* mcd slot 1, -1=empty, 0=CdromId.1.mcr, otherwise mcd%03u.mcr */ + s8 McdSlot2; /* mcd slot 2, -1=empty, 0=CdromId.2.mcr, otherwise mcd%03u.mcr */ /* Gamepad combo used to open menu * 0: L3 + R3