Add ability to save state (use F12).

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2017-06-04 21:19:24 +01:00
parent 2aae3592c4
commit 05a55c0735
2 changed files with 49 additions and 4 deletions

View file

@ -14,6 +14,7 @@
#include "Frame.h"
#include "Memory.h"
#include "Video.h"
#include "SaveState.h"
#include "frontends/ncurses/world.h"
#include "ncurses.h"
@ -103,7 +104,18 @@ namespace
switch (key)
{
case KEY_F(2):
return false;
{
return false;
}
case KEY_F(12):
{
// F12: as F11 is already Fullscreen in the terminal
// To load an image, use command line options
Snapshot_SetFilename("");
Snapshot_SaveState();
break;
}
}
if (g_dwCyclesThisFrame >= dwClksPerFrame)

View file

@ -1,8 +1,11 @@
#include "StdAfx.h"
#include "Applewin.h"
#include "SerialComms.h"
#include "MouseInterface.h"
#include "Configuration/IPropertySheet.h"
#include "YamlHelper.h"
#include "Video.h"
void VideoReinitialize() { }
void KeybLoadSnapshot(YamlLoadHelper&) { }
@ -30,8 +33,38 @@ std::string Phasor_GetSnapshotCardName() { return ""; }
void CMouseInterface::SaveSnapshot(YamlSaveHelper&) { }
void IPropertySheet::ApplyNewConfig(CConfigNeedingRestart const&, CConfigNeedingRestart const&) { }
void FrameUpdateApple2Type() { }
void VideoLoadSnapshot(YamlLoadHelper&) { }
void SetCurrentImageDir(char const*) { }
bool SetCurrentImageDir(char const*) { }
void CMouseInterface::Uninitialize() { }
void CSuperSerialCard::SaveSnapshot(YamlSaveHelper&) { }
void VideoSaveSnapshot(YamlSaveHelper&) { }
// Copied from Video.cpp as it is too complicated to compile and use Video.cpp
#define SS_YAML_KEY_ALTCHARSET "Alt Char Set"
#define SS_YAML_KEY_VIDEOMODE "Video Mode"
#define SS_YAML_KEY_CYCLESTHISFRAME "Cycles This Frame"
static std::string VideoGetSnapshotStructName(void)
{
static const std::string name("Video");
return name;
}
void VideoSaveSnapshot(YamlSaveHelper& yamlSaveHelper)
{
YamlSaveHelper::Label state(yamlSaveHelper, "%s:\n", VideoGetSnapshotStructName().c_str());
yamlSaveHelper.SaveBool(SS_YAML_KEY_ALTCHARSET, g_nAltCharSetOffset ? true : false);
yamlSaveHelper.SaveHexUint32(SS_YAML_KEY_VIDEOMODE, g_uVideoMode);
yamlSaveHelper.SaveUint(SS_YAML_KEY_CYCLESTHISFRAME, g_dwCyclesThisFrame);
}
void VideoLoadSnapshot(YamlLoadHelper& yamlLoadHelper)
{
if (!yamlLoadHelper.GetSubMap(VideoGetSnapshotStructName()))
return;
g_nAltCharSetOffset = yamlLoadHelper.LoadBool(SS_YAML_KEY_ALTCHARSET) ? 256 : 0;
g_uVideoMode = yamlLoadHelper.LoadUint(SS_YAML_KEY_VIDEOMODE);
g_dwCyclesThisFrame = yamlLoadHelper.LoadUint(SS_YAML_KEY_CYCLESTHISFRAME);
yamlLoadHelper.PopMap();
}