Make MapDirErase public
This commit is contained in:
parent
4cd40b33af
commit
f6e9a9d975
|
@ -169,7 +169,6 @@ static int _GameMap2Slot(File* stream);
|
||||||
static int _SlotMap2Game(File* stream);
|
static int _SlotMap2Game(File* stream);
|
||||||
static int _mygets(char* dest, File* stream);
|
static int _mygets(char* dest, File* stream);
|
||||||
static int _copy_file(const char* existingFileName, const char* newFileName);
|
static int _copy_file(const char* existingFileName, const char* newFileName);
|
||||||
static int _MapDirErase(const char* path, const char* extension);
|
|
||||||
static int _SaveBackup();
|
static int _SaveBackup();
|
||||||
static int _RestoreSave();
|
static int _RestoreSave();
|
||||||
static int _LoadObjDudeCid(File* stream);
|
static int _LoadObjDudeCid(File* stream);
|
||||||
|
@ -340,9 +339,9 @@ void _InitLoadSave()
|
||||||
_slot_cursor = 0;
|
_slot_cursor = 0;
|
||||||
_patches = settings.system.master_patches_path.c_str();
|
_patches = settings.system.master_patches_path.c_str();
|
||||||
|
|
||||||
_MapDirErase("MAPS\\", "SAV");
|
MapDirErase("MAPS\\", "SAV");
|
||||||
_MapDirErase(PROTO_DIR_NAME "\\" CRITTERS_DIR_NAME "\\", PROTO_FILE_EXT);
|
MapDirErase(PROTO_DIR_NAME "\\" CRITTERS_DIR_NAME "\\", PROTO_FILE_EXT);
|
||||||
_MapDirErase(PROTO_DIR_NAME "\\" ITEMS_DIR_NAME "\\", PROTO_FILE_EXT);
|
MapDirErase(PROTO_DIR_NAME "\\" ITEMS_DIR_NAME "\\", PROTO_FILE_EXT);
|
||||||
|
|
||||||
configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_AUTO_QUICK_SAVE, &quickSaveSlots);
|
configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_AUTO_QUICK_SAVE, &quickSaveSlots);
|
||||||
if (quickSaveSlots > 0 && quickSaveSlots <= 10) {
|
if (quickSaveSlots > 0 && quickSaveSlots <= 10) {
|
||||||
|
@ -353,9 +352,9 @@ void _InitLoadSave()
|
||||||
// 0x47B85C
|
// 0x47B85C
|
||||||
void _ResetLoadSave()
|
void _ResetLoadSave()
|
||||||
{
|
{
|
||||||
_MapDirErase("MAPS\\", "SAV");
|
MapDirErase("MAPS\\", "SAV");
|
||||||
_MapDirErase(PROTO_DIR_NAME "\\" CRITTERS_DIR_NAME "\\", PROTO_FILE_EXT);
|
MapDirErase(PROTO_DIR_NAME "\\" CRITTERS_DIR_NAME "\\", PROTO_FILE_EXT);
|
||||||
_MapDirErase(PROTO_DIR_NAME "\\" ITEMS_DIR_NAME "\\", PROTO_FILE_EXT);
|
MapDirErase(PROTO_DIR_NAME "\\" ITEMS_DIR_NAME "\\", PROTO_FILE_EXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SaveGame
|
// SaveGame
|
||||||
|
@ -1570,7 +1569,7 @@ static int lsgPerformSaveGame()
|
||||||
debugPrint("\nLOADSAVE: ** Error opening save game for writing! **\n");
|
debugPrint("\nLOADSAVE: ** Error opening save game for writing! **\n");
|
||||||
_RestoreSave();
|
_RestoreSave();
|
||||||
snprintf(_gmpath, sizeof(_gmpath), "%s\\%s%.2d\\", "SAVEGAME", "SLOT", _slot_cursor + 1);
|
snprintf(_gmpath, sizeof(_gmpath), "%s\\%s%.2d\\", "SAVEGAME", "SLOT", _slot_cursor + 1);
|
||||||
_MapDirErase(_gmpath, "BAK");
|
MapDirErase(_gmpath, "BAK");
|
||||||
_partyMemberUnPrepSave();
|
_partyMemberUnPrepSave();
|
||||||
backgroundSoundResume();
|
backgroundSoundResume();
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1583,7 +1582,7 @@ static int lsgPerformSaveGame()
|
||||||
fileClose(_flptr);
|
fileClose(_flptr);
|
||||||
_RestoreSave();
|
_RestoreSave();
|
||||||
snprintf(_gmpath, sizeof(_gmpath), "%s\\%s%.2d\\", "SAVEGAME", "SLOT", _slot_cursor + 1);
|
snprintf(_gmpath, sizeof(_gmpath), "%s\\%s%.2d\\", "SAVEGAME", "SLOT", _slot_cursor + 1);
|
||||||
_MapDirErase(_gmpath, "BAK");
|
MapDirErase(_gmpath, "BAK");
|
||||||
_partyMemberUnPrepSave();
|
_partyMemberUnPrepSave();
|
||||||
backgroundSoundResume();
|
backgroundSoundResume();
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1597,7 +1596,7 @@ static int lsgPerformSaveGame()
|
||||||
fileClose(_flptr);
|
fileClose(_flptr);
|
||||||
_RestoreSave();
|
_RestoreSave();
|
||||||
snprintf(_gmpath, sizeof(_gmpath), "%s\\%s%.2d\\", "SAVEGAME", "SLOT", _slot_cursor + 1);
|
snprintf(_gmpath, sizeof(_gmpath), "%s\\%s%.2d\\", "SAVEGAME", "SLOT", _slot_cursor + 1);
|
||||||
_MapDirErase(_gmpath, "BAK");
|
MapDirErase(_gmpath, "BAK");
|
||||||
_partyMemberUnPrepSave();
|
_partyMemberUnPrepSave();
|
||||||
backgroundSoundResume();
|
backgroundSoundResume();
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1678,7 +1677,7 @@ static int lsgPerformSaveGame()
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(_gmpath, sizeof(_gmpath), "%s\\%s%.2d\\", "SAVEGAME", "SLOT", _slot_cursor + 1);
|
snprintf(_gmpath, sizeof(_gmpath), "%s\\%s%.2d\\", "SAVEGAME", "SLOT", _slot_cursor + 1);
|
||||||
_MapDirErase(_gmpath, "BAK");
|
MapDirErase(_gmpath, "BAK");
|
||||||
|
|
||||||
gLoadSaveMessageListItem.num = 140;
|
gLoadSaveMessageListItem.num = 140;
|
||||||
if (messageListGetItem(&gLoadSaveMessageList, &gLoadSaveMessageListItem)) {
|
if (messageListGetItem(&gLoadSaveMessageList, &gLoadSaveMessageListItem)) {
|
||||||
|
@ -1771,7 +1770,7 @@ static int lsgLoadGameInSlot(int slot)
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(_str, sizeof(_str), "%s\\", "MAPS");
|
snprintf(_str, sizeof(_str), "%s\\", "MAPS");
|
||||||
_MapDirErase(_str, "BAK");
|
MapDirErase(_str, "BAK");
|
||||||
_proto_dude_update_gender();
|
_proto_dude_update_gender();
|
||||||
|
|
||||||
// Game Loaded.
|
// Game Loaded.
|
||||||
|
@ -2487,7 +2486,7 @@ static int _GameMap2Slot(File* stream)
|
||||||
|
|
||||||
snprintf(_gmpath, sizeof(_gmpath), "%s\\%s%.2d\\", "SAVEGAME", "SLOT", _slot_cursor + 1);
|
snprintf(_gmpath, sizeof(_gmpath), "%s\\%s%.2d\\", "SAVEGAME", "SLOT", _slot_cursor + 1);
|
||||||
|
|
||||||
if (_MapDirErase(_gmpath, "SAV") == -1) {
|
if (MapDirErase(_gmpath, "SAV") == -1) {
|
||||||
fileNameListFree(&fileNameList, 0);
|
fileNameListFree(&fileNameList, 0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -2566,19 +2565,19 @@ static int _SlotMap2Game(File* stream)
|
||||||
|
|
||||||
snprintf(_str0, sizeof(_str0), "%s\\", PROTO_DIR_NAME "\\" CRITTERS_DIR_NAME);
|
snprintf(_str0, sizeof(_str0), "%s\\", PROTO_DIR_NAME "\\" CRITTERS_DIR_NAME);
|
||||||
|
|
||||||
if (_MapDirErase(_str0, PROTO_FILE_EXT) == -1) {
|
if (MapDirErase(_str0, PROTO_FILE_EXT) == -1) {
|
||||||
debugPrint("LOADSAVE: returning 3\n");
|
debugPrint("LOADSAVE: returning 3\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(_str0, sizeof(_str0), "%s\\", PROTO_DIR_NAME "\\" ITEMS_DIR_NAME);
|
snprintf(_str0, sizeof(_str0), "%s\\", PROTO_DIR_NAME "\\" ITEMS_DIR_NAME);
|
||||||
if (_MapDirErase(_str0, PROTO_FILE_EXT) == -1) {
|
if (MapDirErase(_str0, PROTO_FILE_EXT) == -1) {
|
||||||
debugPrint("LOADSAVE: returning 4\n");
|
debugPrint("LOADSAVE: returning 4\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(_str0, sizeof(_str0), "%s\\", "MAPS");
|
snprintf(_str0, sizeof(_str0), "%s\\", "MAPS");
|
||||||
if (_MapDirErase(_str0, "SAV") == -1) {
|
if (MapDirErase(_str0, "SAV") == -1) {
|
||||||
debugPrint("LOADSAVE: returning 5\n");
|
debugPrint("LOADSAVE: returning 5\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -2749,11 +2748,11 @@ void lsgInit()
|
||||||
{
|
{
|
||||||
char path[COMPAT_MAX_PATH];
|
char path[COMPAT_MAX_PATH];
|
||||||
snprintf(path, sizeof(path), "%s\\", "MAPS");
|
snprintf(path, sizeof(path), "%s\\", "MAPS");
|
||||||
_MapDirErase(path, "SAV");
|
MapDirErase(path, "SAV");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x480040
|
// 0x480040
|
||||||
static int _MapDirErase(const char* relativePath, const char* extension)
|
int MapDirErase(const char* relativePath, const char* extension)
|
||||||
{
|
{
|
||||||
char path[COMPAT_MAX_PATH];
|
char path[COMPAT_MAX_PATH];
|
||||||
snprintf(path, sizeof(path), "%s*.%s", relativePath, extension);
|
snprintf(path, sizeof(path), "%s*.%s", relativePath, extension);
|
||||||
|
|
|
@ -20,6 +20,7 @@ int lsgSaveGame(int mode);
|
||||||
int lsgLoadGame(int mode);
|
int lsgLoadGame(int mode);
|
||||||
bool _isLoadingGame();
|
bool _isLoadingGame();
|
||||||
void lsgInit();
|
void lsgInit();
|
||||||
|
int MapDirErase(const char* path, const char* extension);
|
||||||
int _MapDirEraseFile_(const char* a1, const char* a2);
|
int _MapDirEraseFile_(const char* a1, const char* a2);
|
||||||
|
|
||||||
} // namespace fallout
|
} // namespace fallout
|
||||||
|
|
Loading…
Reference in New Issue