From 10d67bdf9e434fa70255c7f95b912a007070c0d7 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Thu, 8 Mar 2018 03:55:41 +0000 Subject: [PATCH] Menus: "Clean Up Obsolete Saves" git-svn-id: https://svn.eduke32.com/eduke32@6749 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/menus.cpp | 7 +++++++ source/duke3d/src/osdcmds.cpp | 10 ++++++++++ source/duke3d/src/savegame.cpp | 12 ++++++++++++ source/duke3d/src/savegame.h | 1 + 4 files changed, 30 insertions(+) diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index 2bd1c482c..646036c0c 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -1223,10 +1223,13 @@ static MenuEntry_t ME_SAVESETUP_AUTOSAVEDELETION = MAKE_MENUENTRY( "Auto-Delete: static MenuRangeInt32_t MEO_SAVESETUP_MAXAUTOSAVES = MAKE_MENURANGE( &ud.maxautosaves, &MF_Redfont, 1, 10, 0, 10, 1 ); static MenuEntry_t ME_SAVESETUP_MAXAUTOSAVES = MAKE_MENUENTRY( "Limit:", &MF_Redfont, &MEF_BigOptions_Apply, &MEO_SAVESETUP_MAXAUTOSAVES, RangeInt32 ); +static MenuEntry_t ME_SAVESETUP_CLEANUP = MAKE_MENUENTRY( "Clean Up Saves", &MF_Redfont, &MEF_BigOptionsRt, &MEO_NULL, Link ); + static MenuEntry_t *MEL_SAVESETUP[] = { &ME_SAVESETUP_AUTOSAVE, &ME_SAVESETUP_AUTOSAVEDELETION, &ME_SAVESETUP_MAXAUTOSAVES, + &ME_SAVESETUP_CLEANUP, }; @@ -3024,6 +3027,10 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry) if (ud.config.MusicToggle) S_RestartMusic(); } + else if (entry == &ME_SAVESETUP_CLEANUP) + { + G_DeleteOldSaves(); + } else if (entry == &ME_COLCORR_RESET) { vid_gamma = DEFAULT_GAMMA; diff --git a/source/duke3d/src/osdcmds.cpp b/source/duke3d/src/osdcmds.cpp index f3f2db7e6..d7caaeb2e 100644 --- a/source/duke3d/src/osdcmds.cpp +++ b/source/duke3d/src/osdcmds.cpp @@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "demo.h" // g_firstDemoFile[] #include "cheats.h" #include "sbar.h" +#include "savegame.h" #ifdef LUNATIC # include "lunatic_game.h" @@ -1410,6 +1411,13 @@ static int32_t osdcmd_kickban(osdfuncparm_t const * const parm) } #endif +static int32_t osdcmd_sv_cleanup(osdfuncparm_t const * const UNUSED(parm)) +{ + UNREFERENCED_CONST_PARAMETER(parm); + G_DeleteOldSaves(); + return OSDCMD_OK; +} + static int32_t osdcmd_printtimes(osdfuncparm_t const * const UNUSED(parm)) { UNREFERENCED_CONST_PARAMETER(parm); @@ -1776,6 +1784,8 @@ int32_t registerosdcommands(void) OSD_RegisterFunction("disconnect","disconnect: disconnects from the local multiplayer game", osdcmd_disconnect); #endif + OSD_RegisterFunction("sv_cleanup", "sv_cleanup: deletes obsolete and unreadable save files", osdcmd_sv_cleanup); + for (i=0; i