diff --git a/source/frontends/ncurses/main.cpp b/source/frontends/ncurses/main.cpp index fd0cae9d..de13bdf9 100644 --- a/source/frontends/ncurses/main.cpp +++ b/source/frontends/ncurses/main.cpp @@ -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) diff --git a/source/linux/state.cpp b/source/linux/state.cpp index 912c6108..64b3ca6e 100644 --- a/source/linux/state.cpp +++ b/source/linux/state.cpp @@ -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(); +}