mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-02 14:51:40 +00:00
Fixes for Sword1 engine loading from launcher
svn-id: r33915
This commit is contained in:
parent
7e49b2e8a1
commit
603f0a2f8c
@ -703,7 +703,7 @@ void Control::handleSaveKey(Common::KeyState kbd) {
|
||||
bool Control::saveToFile(void) {
|
||||
if ((_selectedSavegame == 255) || !strlen((char*)_saveNames[_selectedSavegame]))
|
||||
return false; // no saveslot selected or no name entered
|
||||
saveGameToFile(_selectedSavegame);
|
||||
saveGameToFile(_numSaves);
|
||||
writeSavegameDescriptions();
|
||||
return true;
|
||||
}
|
||||
@ -741,6 +741,7 @@ void Control::readSavegameDescriptions(void) {
|
||||
curFileNum++;
|
||||
} while ((ch != 255) && (!inf->eos()));
|
||||
_saveFiles = curFileNum;
|
||||
_numSaves = _saveFiles;
|
||||
}
|
||||
delete inf;
|
||||
}
|
||||
|
@ -98,6 +98,7 @@ private:
|
||||
void deselectSaveslots(void);
|
||||
uint8 *_restoreBuf;
|
||||
uint8 _saveFiles;
|
||||
uint8 _numSaves;
|
||||
uint8 _saveScrollPos;
|
||||
uint8 _selectedSavegame;
|
||||
uint8 _saveNames[64][32];
|
||||
|
@ -199,12 +199,20 @@ PluginError SwordMetaEngine::createInstance(OSystem *syst, Engine **engine) cons
|
||||
SaveStateList SwordMetaEngine::listSaves(const char *target) const {
|
||||
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
|
||||
SaveStateList saveList;
|
||||
|
||||
Common::String pattern = "SAVEGAME.???";
|
||||
Common::StringList filenames = saveFileMan->listSavefiles(pattern.c_str());
|
||||
sort(filenames.begin(), filenames.end());
|
||||
Common::StringList::const_iterator file = filenames.begin();
|
||||
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading("SAVEGAME.INF");
|
||||
if (in) {
|
||||
uint8 stop;
|
||||
char saveDesc[32];
|
||||
int slotNum = 0;
|
||||
do {
|
||||
// Obtain the last digit of the filename, since they correspond to the save slot
|
||||
int slotNum = atoi(file->c_str() + file->size() - 1);
|
||||
|
||||
uint pos = 0;
|
||||
do {
|
||||
stop = in->readByte();
|
||||
@ -218,8 +226,8 @@ SaveStateList SwordMetaEngine::listSaves(const char *target) const {
|
||||
}
|
||||
} while ((stop != 10) && (stop != 255) && (!in->eos()));
|
||||
if (saveDesc[0] != 0) {
|
||||
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc, "SAVEGAME.INF"));
|
||||
slotNum++;
|
||||
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc, *file));
|
||||
file++;
|
||||
}
|
||||
} while ((stop != 255) && (!in->eos()));
|
||||
}
|
||||
@ -688,7 +696,7 @@ int SwordEngine::go() {
|
||||
int saveSlot = ConfMan.getInt("save_slot");
|
||||
// Savegames are numbered starting from 1 in the dialog window,
|
||||
// but their filenames are numbered starting from 0.
|
||||
if (saveSlot > 0 && _control->restoreGameFromFile(saveSlot - 1)) {
|
||||
if (saveSlot >= 0 && _control->savegamesExist() &&_control->restoreGameFromFile(saveSlot)) {
|
||||
_control->doRestore();
|
||||
} else if (_control->savegamesExist()) {
|
||||
_systemVars.controlPanelMode = CP_NEWGAME;
|
||||
|
Loading…
x
Reference in New Issue
Block a user