ange how no memcards are specified
authornotaz <notasas@gmail.com>
Mon, 28 Jan 2013 18:14:54 +0000 (20:14 +0200)
committernotaz <notasas@gmail.com>
Mon, 28 Jan 2013 18:14:54 +0000 (20:14 +0200)
empty string now just means "don't save/load"

frontend/menu.c
libpcsxcore/sio.c

index 9ca5f95..8119505 100644 (file)
@@ -1700,10 +1700,10 @@ out:
 
 static void handle_memcard_sel(void)
 {
 
 static void handle_memcard_sel(void)
 {
-       Config.Mcd1[0] = 0;
+       strcpy(Config.Mcd1, "none");
        if (memcard1_sel != 0)
                snprintf(Config.Mcd1, sizeof(Config.Mcd1), ".%s%s", MEMCARD_DIR, memcards[memcard1_sel]);
        if (memcard1_sel != 0)
                snprintf(Config.Mcd1, sizeof(Config.Mcd1), ".%s%s", MEMCARD_DIR, memcards[memcard1_sel]);
-       Config.Mcd2[0] = 0;
+       strcpy(Config.Mcd2, "none");
        if (memcard2_sel != 0)
                snprintf(Config.Mcd2, sizeof(Config.Mcd2), ".%s%s", MEMCARD_DIR, memcards[memcard2_sel]);
        LoadMcds(Config.Mcd1, Config.Mcd2);
        if (memcard2_sel != 0)
                snprintf(Config.Mcd2, sizeof(Config.Mcd2), ".%s%s", MEMCARD_DIR, memcards[memcard2_sel]);
        LoadMcds(Config.Mcd1, Config.Mcd2);
index ea96e95..b3732d2 100644 (file)
@@ -409,10 +409,13 @@ void LoadMcd(int mcd, char *str) {
        }
 
        McdDisable[mcd - 1] = 0;
        }
 
        McdDisable[mcd - 1] = 0;
-       if (str == NULL || *str == 0) {
+       if (str == NULL || strcmp(str, "none") == 0) {
                McdDisable[mcd - 1] = 1;
                return;
        }
                McdDisable[mcd - 1] = 1;
                return;
        }
+       if (*str == 0)
+               return;
+
        f = fopen(str, "rb");
        if (f == NULL) {
                SysPrintf(_("The memory card %s doesn't exist - creating it\n"), str);
        f = fopen(str, "rb");
        if (f == NULL) {
                SysPrintf(_("The memory card %s doesn't exist - creating it\n"), str);
@@ -455,6 +458,9 @@ void LoadMcds(char *mcd1, char *mcd2) {
 void SaveMcd(char *mcd, char *data, uint32_t adr, int size) {
        FILE *f;
 
 void SaveMcd(char *mcd, char *data, uint32_t adr, int size) {
        FILE *f;
 
+       if (mcd == NULL || *mcd == 0 || strcmp(mcd, "none") == 0)
+               return;
+
        f = fopen(mcd, "r+b");
        if (f != NULL) {
                struct stat buf;
        f = fopen(mcd, "r+b");
        if (f != NULL) {
                struct stat buf;