Skip to content

Commit 105b013

Browse files
authored
3DO: use a common save file for multi-disc games (MiSTer-devel#1227)
1 parent f013047 commit 105b013

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

support/3do/3do.cpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,28 @@ void p3do_poll()
5252
}
5353
}
5454

55-
static char buf[1024];
55+
static char buf[2048];
56+
57+
static void p3do_get_save_without_disk(char *path)
58+
{
59+
char *p1, *p2;
60+
61+
if ((p1 = strstr(path, "disc")) != 0 || (p1 = strstr(path, "Disc")) != 0 || (p1 = strstr(path, "DISC")) != 0 ||
62+
(p1 = strstr(path, "disk")) != 0 || (p1 = strstr(path, "Disk")) != 0 || (p1 = strstr(path, "DISK")) != 0)
63+
{
64+
p2 = p1 + 4;
65+
66+
if (p1 > path && *(--p1) == '(') p1--;
67+
if (p1 > path && *(--p1) == ' ') p1--;
68+
if (*p2 == ' ') p2++;
69+
if ((*p2 >= '0' && *p2 <= '9') || (*p2 >= 'a' && *p2 <= 'f') || (*p2 >= 'A' && *p2 <= 'F')) {
70+
p2++;
71+
if (*p2 == ')') p2++;
72+
p1++;
73+
strcpy(p1, p2);
74+
}
75+
}
76+
}
5677

5778
static void p3do_mount_save(const char *filename)
5879
{
@@ -61,6 +82,7 @@ static void p3do_mount_save(const char *filename)
6182
if (strlen(filename))
6283
{
6384
FileGenerateSavePath(filename, buf);
85+
p3do_get_save_without_disk(buf);
6486
#ifdef P3DO_DEBUG
6587
printf("Saturn save filename = %s\n", buf);
6688
#endif // P3DO_DEBUG
@@ -96,7 +118,7 @@ void p3do_set_image(int num, const char *filename)
96118
p3docdd.Unload();
97119
p3docdd.Reset();
98120

99-
int same_game = *filename && *last_dir && !strncmp(last_dir, filename, strlen(last_dir));
121+
int same_game = 0;//*filename && *last_dir && !strncmp(last_dir, filename, strlen(last_dir));
100122
strcpy(last_dir, filename);
101123
char *p = strrchr(last_dir, '/');
102124
if (p) *p = 0;

0 commit comments

Comments
 (0)