mirror of https://github.com/sm64pc/sm64pc.git
Added backup for slot 0 to slot 1
This commit is contained in:
parent
82163b706a
commit
b7b255317f
|
@ -205,8 +205,7 @@ static s32 read_text_save(s32 fileIndex) {
|
||||||
ini_t *savedata;
|
ini_t *savedata;
|
||||||
|
|
||||||
u32 i, flag, coins, stars, starFlags;
|
u32 i, flag, coins, stars, starFlags;
|
||||||
u32 capLevel, capArea;
|
u32 capArea;
|
||||||
Vec3s capPos;
|
|
||||||
|
|
||||||
/* Define savefile's name */
|
/* Define savefile's name */
|
||||||
if (sprintf(filename, FILENAME_FORMAT, fileIndex) < 0)
|
if (sprintf(filename, FILENAME_FORMAT, fileIndex) < 0)
|
||||||
|
@ -218,8 +217,6 @@ static s32 read_text_save(s32 fileIndex) {
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
printf("Loading savefile from '%s'\n", filename);
|
printf("Loading savefile from '%s'\n", filename);
|
||||||
/* Good, file exists for gSaveBuffer */
|
|
||||||
gSaveBuffer.files[fileIndex][0].flags |= SAVE_FLAG_FILE_EXISTS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read coin score age for selected file and sound mode */
|
/* Read coin score age for selected file and sound mode */
|
||||||
|
@ -303,34 +300,46 @@ static s32 read_text_save(s32 fileIndex) {
|
||||||
|
|
||||||
/* ... it's level ... */
|
/* ... it's level ... */
|
||||||
value = ini_get(savedata, "cap", "level");
|
value = ini_get(savedata, "cap", "level");
|
||||||
if (strcmp(value, "ssl") == 0) {
|
if (value) {
|
||||||
gSaveBuffer.files[fileIndex][0].capLevel = 8; // ssl
|
if (strcmp(value, "ssl") == 0) {
|
||||||
}
|
gSaveBuffer.files[fileIndex][0].capLevel = 8; // ssl
|
||||||
else if (strcmp(value, "sl") == 0) {
|
}
|
||||||
gSaveBuffer.files[fileIndex][0].capLevel = 10; // sl
|
else if (strcmp(value, "sl") == 0) {
|
||||||
}
|
gSaveBuffer.files[fileIndex][0].capLevel = 10; // sl
|
||||||
else if (strcmp(value, "ttm") == 0) {
|
}
|
||||||
gSaveBuffer.files[fileIndex][0].capLevel = 12; // ttm
|
else if (strcmp(value, "ttm") == 0) {
|
||||||
}
|
gSaveBuffer.files[fileIndex][0].capLevel = 12; // ttm
|
||||||
else if (strcmp(value, "none") == 0) {
|
}
|
||||||
gSaveBuffer.files[fileIndex][0].capLevel = 0;
|
else if (strcmp(value, "none") == 0) {
|
||||||
}
|
gSaveBuffer.files[fileIndex][0].capLevel = 0;
|
||||||
else {
|
}
|
||||||
printf("Invalid 'cap:level' flag!\n");
|
else {
|
||||||
return -1;
|
printf("Invalid 'cap:level' flag!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ... and it's area */
|
/* ... and it's area */
|
||||||
sscanf(ini_get(savedata, "cap", "area"), "%d", &capArea);
|
value = ini_get(savedata, "cap", "area");
|
||||||
if (capArea > 1 && capArea < 2) {
|
if (value) {
|
||||||
printf("Invalid 'cap:area' flag: %d!\n", capArea);
|
sscanf(value, "%d", &capArea);
|
||||||
return -1;
|
if (capArea > 1 && capArea < 2) {
|
||||||
}
|
printf("Invalid 'cap:area' flag: %d!\n", capArea);
|
||||||
else {
|
return -1;
|
||||||
gSaveBuffer.files[fileIndex][0].capArea = capArea;
|
}
|
||||||
|
else {
|
||||||
|
gSaveBuffer.files[fileIndex][0].capArea = capArea;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Good, file exists for gSaveBuffer */
|
||||||
|
gSaveBuffer.files[fileIndex][0].flags |= SAVE_FLAG_FILE_EXISTS;
|
||||||
|
|
||||||
|
/* Make a backup */
|
||||||
|
bcopy(&gSaveBuffer.files[fileIndex][0], &gSaveBuffer.files[fileIndex][1],
|
||||||
|
sizeof(gSaveBuffer.files[fileIndex][1]));
|
||||||
|
|
||||||
/* Cleaning up after ourselves */
|
/* Cleaning up after ourselves */
|
||||||
ini_free(savedata);
|
ini_free(savedata);
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue