Ticket #8921: saveStateRem_v1.patch
File saveStateRem_v1.patch, 11.7 KB (added by , 16 years ago) |
---|
-
gui/launcher.cpp
940 940 } 941 941 942 942 void LauncherDialog::loadGame(int item) { 943 Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();944 943 String gameId = ConfMan.get("gameid", _domains[item]); 945 944 if (gameId.empty()) 946 945 gameId = _domains[item]; … … 956 955 bool delSupport = (*plugin)->hasFeature(MetaEngine::kSupportsDeleteSave); 957 956 958 957 if ((*plugin)->hasFeature(MetaEngine::kSupportsListSaves) && 959 (*plugin)->hasFeature(MetaEngine::kSupportsDirectLoad)) 960 { 958 (*plugin)->hasFeature(MetaEngine::kSupportsDirectLoad)) { 961 959 do { 962 960 Common::StringList saveNames = generateSavegameList(item, plugin); 963 961 _loadDialog->setList(saveNames); … … 971 969 MessageDialog alert("Do you really want to delete this savegame?", 972 970 "Delete", "Cancel"); 973 971 if (alert.runModal() == GUI::kMessageOK) { 974 saveFileMan->removeSavefile(filename.c_str());975 if ((saveList.size() - 1) == 0) {976 //ConfMan.setInt("save_slot", -1);977 } 972 (*plugin)->removeSaveState(description.c_str(), atoi(saveList[idx].save_slot().c_str())); 973 /*if ((saveList.size() - 1) == 0) { 974 ConfMan.setInt("save_slot", -1); 975 }*/ 978 976 } 979 } 980 // Load the savegame 981 else { 977 } else { // Load the savegame 982 978 int slot = atoi(saveList[idx].save_slot().c_str()); 983 979 //const char *file = saveList[idx].filename().c_str(); 984 980 //printf("Loading slot: %d\n", slot); … … 988 984 close(); 989 985 } 990 986 } 991 } 992 while (_loadDialog->delSave()); 987 } while (_loadDialog->delSave()); 993 988 } else { 994 989 MessageDialog dialog 995 990 ("Sorry, this game does not yet support loading games from the launcher.", "OK"); -
engines/sword2/sword2.cpp
85 85 virtual GameDescriptor findGame(const char *gameid) const; 86 86 virtual GameList detectGames(const Common::FSList &fslist) const; 87 87 virtual SaveStateList listSaves(const char *target) const; 88 virtual void removeSaveState(const char *target, int slot) const; 88 89 89 90 virtual PluginError createInstance(OSystem *syst, Engine **engine) const; 90 91 }; … … 196 197 return saveList; 197 198 } 198 199 200 void Sword2MetaEngine::removeSaveState(const char *target, int slot) const { 201 char extension[6]; 202 snprintf(extension, sizeof(extension), ".%03d", slot); 203 204 Common::String filename = target; 205 filename += extension; 206 207 g_system->getSavefileManager()->removeSavefile(filename.c_str()); 208 } 209 199 210 PluginError Sword2MetaEngine::createInstance(OSystem *syst, Engine **engine) const { 200 211 assert(syst); 201 212 assert(engine); -
engines/scumm/detection.cpp
682 682 virtual PluginError createInstance(OSystem *syst, Engine **engine) const; 683 683 684 684 virtual SaveStateList listSaves(const char *target) const; 685 virtual void removeSaveState(const char *target, int slot) const; 685 686 }; 686 687 687 688 bool ScummMetaEngine::hasFeature(MetaEngineFeature f) const { … … 975 976 return saveList; 976 977 } 977 978 979 void ScummMetaEngine::removeSaveState(const char *target, int slot) const { 980 char extension[6]; 981 snprintf(extension, sizeof(extension), ".s%02d", slot); 982 983 Common::String filename = target; 984 filename += extension; 985 986 g_system->getSavefileManager()->removeSavefile(filename.c_str()); 987 } 988 978 989 #if PLUGIN_ENABLED_DYNAMIC(SCUMM) 979 990 REGISTER_PLUGIN_DYNAMIC(SCUMM, PLUGIN_TYPE_ENGINE, ScummMetaEngine); 980 991 #else -
engines/touche/detection.cpp
139 139 virtual bool hasFeature(MetaEngineFeature f) const; 140 140 virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const; 141 141 virtual SaveStateList listSaves(const char *target) const; 142 virtual void removeSaveState(const char *target, int slot) const; 142 143 }; 143 144 144 145 bool ToucheMetaEngine::hasFeature(MetaEngineFeature f) const { … … 208 209 return saveList; 209 210 } 210 211 212 void ToucheMetaEngine::removeSaveState(const char *target, int slot) const { 213 char extension[5]; 214 snprintf(extension, sizeof(extension), ".%d", slot); 215 216 Common::String filename = target; 217 filename += extension; 218 219 g_system->getSavefileManager()->removeSavefile(filename.c_str()); 220 } 221 211 222 #if PLUGIN_ENABLED_DYNAMIC(TOUCHE) 212 223 REGISTER_PLUGIN_DYNAMIC(TOUCHE, PLUGIN_TYPE_ENGINE, ToucheMetaEngine); 213 224 #else -
engines/agi/detection.cpp
2125 2125 virtual bool hasFeature(MetaEngineFeature f) const; 2126 2126 virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const; 2127 2127 virtual SaveStateList listSaves(const char *target) const; 2128 virtual void removeSaveState(const char *target, int slot) const; 2128 2129 2129 2130 const Common::ADGameDescription *fallbackDetect(const Common::FSList *fslist) const; 2130 2131 }; … … 2189 2190 return saveList; 2190 2191 } 2191 2192 2193 void AgiMetaEngine::removeSaveState(const char *target, int slot) const { 2194 char extension[6]; 2195 snprintf(extension, sizeof(extension), ".%03d", slot); 2196 2197 Common::String filename = target; 2198 filename += extension; 2199 2200 g_system->getSavefileManager()->removeSavefile(filename.c_str()); 2201 } 2202 2192 2203 const Common::ADGameDescription *AgiMetaEngine::fallbackDetect(const Common::FSList *fslist) const { 2193 2204 typedef Common::HashMap<Common::String, int32> IntMap; 2194 2205 IntMap allFiles; -
engines/metaengine.h
101 101 * For most engines this just amounts to calling _saveFileMan->removeSaveFile(). 102 102 * Engines which keep an index file will also update it accordingly. 103 103 * 104 * @param target name of a config manager target 104 105 * @param slot slot number of the save state to be removed 105 *106 * @todo This method is currently never called. Rather, LauncherDialog::loadGame107 * directly calls _saveFileMan->removeSaveFile() if kSupportsDeleteSave is set.108 106 */ 109 virtual void removeSaveState( int slot) const {};107 virtual void removeSaveState(const char *target, int slot) const {}; 110 108 111 109 112 110 /** @name MetaEngineFeature flags */ -
engines/kyra/detection.cpp
1067 1067 bool hasFeature(MetaEngineFeature f) const; 1068 1068 bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const; 1069 1069 SaveStateList listSaves(const char *target) const; 1070 void removeSaveState(const char *target, int slot) const; 1070 1071 }; 1071 1072 1072 1073 bool KyraMetaEngine::hasFeature(MetaEngineFeature f) const { … … 1147 1148 return saveList; 1148 1149 } 1149 1150 1151 void KyraMetaEngine::removeSaveState(const char *target, int slot) const { 1152 char extension[6]; 1153 snprintf(extension, sizeof(extension), ".%03d", slot); 1154 1155 Common::String filename = target; 1156 filename += extension; 1157 1158 g_system->getSavefileManager()->removeSavefile(filename.c_str()); 1159 } 1160 1150 1161 #if PLUGIN_ENABLED_DYNAMIC(KYRA) 1151 1162 REGISTER_PLUGIN_DYNAMIC(KYRA, PLUGIN_TYPE_ENGINE, KyraMetaEngine); 1152 1163 #else -
engines/lure/detection.cpp
188 188 virtual bool hasFeature(MetaEngineFeature f) const; 189 189 virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const; 190 190 virtual SaveStateList listSaves(const char *target) const; 191 virtual void removeSaveState(const char *target, int slot) const; 191 192 }; 192 193 193 194 bool LureMetaEngine::hasFeature(MetaEngineFeature f) const { … … 234 235 return saveList; 235 236 } 236 237 238 void LureMetaEngine::removeSaveState(const char *target, int slot) const { 239 char extension[6]; 240 snprintf(extension, sizeof(extension), ".%03d", slot); 241 242 Common::String filename = target; 243 filename += extension; 244 245 g_system->getSavefileManager()->removeSavefile(filename.c_str()); 246 } 247 237 248 #if PLUGIN_ENABLED_DYNAMIC(LURE) 238 249 REGISTER_PLUGIN_DYNAMIC(LURE, PLUGIN_TYPE_ENGINE, LureMetaEngine); 239 250 #else -
engines/parallaction/detection.cpp
246 246 virtual bool hasFeature(MetaEngineFeature f) const; 247 247 virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const; 248 248 virtual SaveStateList listSaves(const char *target) const; 249 virtual void removeSaveState(const char *target, int slot) const; 249 250 }; 250 251 251 252 bool ParallactionMetaEngine::hasFeature(MetaEngineFeature f) const { … … 302 303 return saveList; 303 304 } 304 305 306 void ParallactionMetaEngine::removeSaveState(const char *target, int slot) const { 307 char extension[6]; 308 snprintf(extension, sizeof(extension), ".0%02d", slot); 309 310 Common::String filename = target; 311 filename += extension; 312 313 g_system->getSavefileManager()->removeSavefile(filename.c_str()); 314 } 315 305 316 #if PLUGIN_ENABLED_DYNAMIC(PARALLACTION) 306 317 REGISTER_PLUGIN_DYNAMIC(PARALLACTION, PLUGIN_TYPE_ENGINE, ParallactionMetaEngine); 307 318 #else -
engines/saga/detection.cpp
150 150 virtual bool hasFeature(MetaEngineFeature f) const; 151 151 virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const; 152 152 virtual SaveStateList listSaves(const char *target) const; 153 virtual void removeSaveState(const char *target, int slot) const; 153 154 }; 154 155 155 156 bool SagaMetaEngine::hasFeature(MetaEngineFeature f) const { … … 198 199 return saveList; 199 200 } 200 201 202 void SagaMetaEngine::removeSaveState(const char *target, int slot) const { 203 char extension[6]; 204 snprintf(extension, sizeof(extension), ".s%02d", slot); 205 206 Common::String filename = target; 207 filename += extension; 208 209 g_system->getSavefileManager()->removeSavefile(filename.c_str()); 210 } 211 201 212 #if PLUGIN_ENABLED_DYNAMIC(SAGA) 202 213 REGISTER_PLUGIN_DYNAMIC(SAGA, PLUGIN_TYPE_ENGINE, SagaMetaEngine); 203 214 #else -
engines/queen/queen.cpp
65 65 virtual GameDescriptor findGame(const char *gameid) const; 66 66 virtual GameList detectGames(const Common::FSList &fslist) const; 67 67 virtual SaveStateList listSaves(const char *target) const; 68 virtual void removeSaveState(const char *target, int slot) const; 68 69 69 70 virtual PluginError createInstance(OSystem *syst, Engine **engine) const; 70 71 }; … … 161 162 return saveList; 162 163 } 163 164 165 void QueenMetaEngine::removeSaveState(const char *target, int slot) const { 166 char extension[6]; 167 snprintf(extension, sizeof(extension), ".s%02d", slot); 168 169 Common::String filename = target; 170 filename += extension; 171 172 g_system->getSavefileManager()->removeSavefile(filename.c_str()); 173 } 174 164 175 PluginError QueenMetaEngine::createInstance(OSystem *syst, Engine **engine) const { 165 176 assert(engine); 166 177 *engine = new Queen::QueenEngine(syst);