mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 12:39:56 +00:00
Saving a game from GMM is now working for the SAGA engine, though the description is not set correctly yet
svn-id: r34932
This commit is contained in:
parent
e6337d11aa
commit
57e57c49ce
@ -118,6 +118,7 @@ MainMenuDialog::MainMenuDialog(Engine *engine)
|
|||||||
_aboutDialog = new GUI::AboutDialog();
|
_aboutDialog = new GUI::AboutDialog();
|
||||||
_optionsDialog = new ConfigDialog();
|
_optionsDialog = new ConfigDialog();
|
||||||
_loadDialog = new GUI::SaveLoadChooser("Load game:", "Load");
|
_loadDialog = new GUI::SaveLoadChooser("Load game:", "Load");
|
||||||
|
_loadDialog->setSaveMode(false);
|
||||||
_saveDialog = new GUI::SaveLoadChooser("Save game:", "Save");
|
_saveDialog = new GUI::SaveLoadChooser("Save game:", "Save");
|
||||||
_saveDialog->setSaveMode(true);
|
_saveDialog->setSaveMode(true);
|
||||||
}
|
}
|
||||||
@ -155,7 +156,6 @@ void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kSaveCmd:
|
case kSaveCmd:
|
||||||
/*
|
|
||||||
{
|
{
|
||||||
Common::String gameId = ConfMan.get("gameid");
|
Common::String gameId = ConfMan.get("gameid");
|
||||||
|
|
||||||
@ -165,7 +165,9 @@ void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
|
|||||||
int slot = _saveDialog->runModal(plugin, ConfMan.getActiveDomainName());
|
int slot = _saveDialog->runModal(plugin, ConfMan.getActiveDomainName());
|
||||||
|
|
||||||
if (slot >= 0) {
|
if (slot >= 0) {
|
||||||
Common::String result(_saveDialog->getResultString());
|
// FIXME: at this point, the save list's selItem is -1!
|
||||||
|
//Common::String result(_saveDialog->getResultString());
|
||||||
|
Common::String result;
|
||||||
char *desc;
|
char *desc;
|
||||||
if (result.empty()) {
|
if (result.empty()) {
|
||||||
// If the user was lazy and entered no save name, come up with a default name.
|
// If the user was lazy and entered no save name, come up with a default name.
|
||||||
@ -180,7 +182,6 @@ void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
break;
|
break;
|
||||||
case kOptionsCmd:
|
case kOptionsCmd:
|
||||||
_optionsDialog->runModal();
|
_optionsDialog->runModal();
|
||||||
|
@ -187,9 +187,10 @@ SaveStateList SagaMetaEngine::listSaves(const char *target) const {
|
|||||||
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
|
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
|
||||||
|
|
||||||
SaveStateList saveList;
|
SaveStateList saveList;
|
||||||
|
int slotNum = 0;
|
||||||
for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
|
for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
|
||||||
// Obtain the last 2 digits of the filename, since they correspond to the save slot
|
// Obtain the last 2 digits of the filename, since they correspond to the save slot
|
||||||
int slotNum = atoi(file->c_str() + file->size() - 2);
|
slotNum = atoi(file->c_str() + file->size() - 2);
|
||||||
|
|
||||||
if (slotNum >= 0 && slotNum <= 99) {
|
if (slotNum >= 0 && slotNum <= 99) {
|
||||||
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
|
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
|
||||||
@ -199,10 +200,20 @@ SaveStateList SagaMetaEngine::listSaves(const char *target) const {
|
|||||||
in->read(saveDesc, SAVE_TITLE_SIZE);
|
in->read(saveDesc, SAVE_TITLE_SIZE);
|
||||||
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
|
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
|
||||||
delete in;
|
delete in;
|
||||||
|
} else {
|
||||||
|
// handle gaps
|
||||||
|
*saveDesc = 0;
|
||||||
|
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fill the rest of the list with empty slots
|
||||||
|
*saveDesc = 0;
|
||||||
|
for (int i = slotNum + 1; i <= 99; i++) {
|
||||||
|
saveList.push_back(SaveStateDescriptor(i, saveDesc));
|
||||||
|
}
|
||||||
|
|
||||||
return saveList;
|
return saveList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,4 +276,9 @@ Common::Error SagaEngine::loadGameState(int slot) {
|
|||||||
return Common::kNoError; // TODO: return success/failure
|
return Common::kNoError; // TODO: return success/failure
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Common::Error SagaEngine::saveGameState(int slot, const char *desc) {
|
||||||
|
save(calcSaveFileName((uint)slot), desc);
|
||||||
|
return Common::kNoError; // TODO: return success/failure
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace Saga
|
} // End of namespace Saga
|
||||||
|
@ -653,6 +653,7 @@ public:
|
|||||||
int getDisplayWidth() const;
|
int getDisplayWidth() const;
|
||||||
int getDisplayHeight() const;
|
int getDisplayHeight() const;
|
||||||
Common::Error loadGameState(int slot);
|
Common::Error loadGameState(int slot);
|
||||||
|
Common::Error saveGameState(int slot, const char *desc);
|
||||||
bool canLoadGameStateCurrently();
|
bool canLoadGameStateCurrently();
|
||||||
bool canSaveGameStateCurrently();
|
bool canSaveGameStateCurrently();
|
||||||
const GameDisplayInfo &getDisplayInfo();
|
const GameDisplayInfo &getDisplayInfo();
|
||||||
|
@ -565,7 +565,6 @@ void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 da
|
|||||||
case GUI::kListSelectionChangedCmd: {
|
case GUI::kListSelectionChangedCmd: {
|
||||||
updateSelection(true);
|
updateSelection(true);
|
||||||
|
|
||||||
/*
|
|
||||||
if (_list->isEditable()) {
|
if (_list->isEditable()) {
|
||||||
_list->startEditMode();
|
_list->startEditMode();
|
||||||
}
|
}
|
||||||
@ -574,7 +573,6 @@ void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 da
|
|||||||
// because we then just assign a default name.
|
// because we then just assign a default name.
|
||||||
_chooseButton->setEnabled(selItem >= 0 && (_list->isEditable() || !getResultString().empty()));
|
_chooseButton->setEnabled(selItem >= 0 && (_list->isEditable() || !getResultString().empty()));
|
||||||
_chooseButton->draw();
|
_chooseButton->draw();
|
||||||
*/
|
|
||||||
} break;
|
} break;
|
||||||
case kDelCmd:
|
case kDelCmd:
|
||||||
if (selItem >= 0 && _delSupport) {
|
if (selItem >= 0 && _delSupport) {
|
||||||
@ -742,11 +740,7 @@ void SaveLoadChooser::updateSaveList() {
|
|||||||
|
|
||||||
StringList saveNames;
|
StringList saveNames;
|
||||||
for (SaveStateList::const_iterator x = _saveList.begin(); x != _saveList.end(); ++x) {
|
for (SaveStateList::const_iterator x = _saveList.begin(); x != _saveList.end(); ++x) {
|
||||||
Common::String description = x->save_slot();
|
saveNames.push_back(x->description());
|
||||||
description += ". ";
|
|
||||||
description += x->description();
|
|
||||||
|
|
||||||
saveNames.push_back(description);
|
|
||||||
}
|
}
|
||||||
_list->setList(saveNames);
|
_list->setList(saveNames);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user