mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 14:18:37 +00:00
PRINCE: Use ScummVM save/load dialogs
The original option dialogs do not seem to be implemented yet so we always show the ScummVM ones when using the save/load hotkeys for now. This partly fixes Trac#9866.
This commit is contained in:
parent
488c22631b
commit
589f0f8750
@ -544,6 +544,14 @@ void PrinceEngine::setMobTranslationTexts() {
|
||||
void PrinceEngine::keyHandler(Common::Event event) {
|
||||
uint16 nChar = event.kbd.keycode;
|
||||
switch (nChar) {
|
||||
case Common::KEYCODE_F1:
|
||||
if (canLoadGameStateCurrently())
|
||||
scummVMSaveLoadDialog(false);
|
||||
break;
|
||||
case Common::KEYCODE_F2:
|
||||
if (canSaveGameStateCurrently())
|
||||
scummVMSaveLoadDialog(true);
|
||||
break;
|
||||
case Common::KEYCODE_d:
|
||||
if (event.kbd.hasFlags(Common::KBD_CTRL)) {
|
||||
getDebugger()->attach();
|
||||
|
@ -279,6 +279,8 @@ public:
|
||||
PrinceEngine(OSystem *syst, const PrinceGameDescription *gameDesc);
|
||||
virtual ~PrinceEngine();
|
||||
|
||||
bool scummVMSaveLoadDialog(bool isSave);
|
||||
|
||||
virtual bool hasFeature(EngineFeature f) const;
|
||||
virtual void pauseEngineIntern(bool pause);
|
||||
virtual bool canSaveGameStateCurrently();
|
||||
|
@ -30,12 +30,15 @@
|
||||
#include "common/system.h"
|
||||
#include "common/config-manager.h"
|
||||
#include "common/memstream.h"
|
||||
#include "common/translation.h"
|
||||
|
||||
#include "graphics/thumbnail.h"
|
||||
#include "graphics/surface.h"
|
||||
#include "graphics/palette.h"
|
||||
#include "graphics/scaler.h"
|
||||
|
||||
#include "gui/saveload.h"
|
||||
|
||||
namespace Prince {
|
||||
|
||||
#define kSavegameVersion 1
|
||||
@ -43,6 +46,37 @@ namespace Prince {
|
||||
class InterpreterFlags;
|
||||
class Interpreter;
|
||||
|
||||
bool PrinceEngine::scummVMSaveLoadDialog(bool isSave) {
|
||||
GUI::SaveLoadChooser *dialog;
|
||||
Common::String desc;
|
||||
int slot;
|
||||
|
||||
if (isSave) {
|
||||
dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
|
||||
|
||||
slot = dialog->runModalWithCurrentTarget();
|
||||
desc = dialog->getResultString();
|
||||
|
||||
if (desc.empty()) {
|
||||
desc = dialog->createDefaultSaveDescription(slot);
|
||||
}
|
||||
} else {
|
||||
dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false);
|
||||
slot = dialog->runModalWithCurrentTarget();
|
||||
}
|
||||
|
||||
delete dialog;
|
||||
|
||||
if (slot < 0)
|
||||
return false;
|
||||
|
||||
if (isSave) {
|
||||
return saveGameState(slot, desc).getCode() == Common::kNoError;
|
||||
} else {
|
||||
return loadGameState(slot).getCode() == Common::kNoError;
|
||||
}
|
||||
}
|
||||
|
||||
WARN_UNUSED_RESULT bool PrinceEngine::readSavegameHeader(Common::InSaveFile *in, SavegameHeader &header, bool skipThumbnail) {
|
||||
header.version = 0;
|
||||
header.saveName.clear();
|
||||
|
Loading…
Reference in New Issue
Block a user