Add a few correct card names, so the snapshot loading does not fail.

But, these cards are still ignored.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2019-11-13 21:01:28 +00:00
parent 1da46e89e1
commit 54d418725e
5 changed files with 57 additions and 6 deletions

View file

@ -397,6 +397,7 @@ void QApple::on_actionLoad_state_triggered()
{
emit endEmulator();
Snapshot_LoadState();
SetWindowTitle();
myEmulatorWindow->setWindowTitle(QString::fromStdString(g_pAppTitle));
myEmulator->updateVideo();
}
@ -457,3 +458,29 @@ void QApple::on_actionSwap_disks_triggered()
// this might open a file dialog
sg_Disk2Card.DriveSwap();
}
void QApple::on_actionLoad_state_from_triggered()
{
PauseEmulator pause(this);
QFileDialog stateFileDialog(this);
stateFileDialog.setFileMode(QFileDialog::AnyFile);
if (stateFileDialog.exec())
{
QStringList files = stateFileDialog.selectedFiles();
if (files.size() == 1)
{
const QString & filename = files[0];
const QFileInfo file(filename);
const QString path = file.absoluteDir().canonicalPath();
// this is useful as snapshots from the test
// have relative disk location
SetCurrentImageDir(path.toStdString().c_str());
Snapshot_SetFilename(filename.toStdString().c_str());
actionLoad_state->trigger();
}
}
}

View file

@ -62,6 +62,8 @@ private slots:
void on_stateChanged(QAudio::State state);
void on_actionLoad_state_from_triggered();
private:
// helper class to pause the emulator and restart at the end of the block

View file

@ -42,7 +42,7 @@
<x>0</x>
<y>0</y>
<width>1032</width>
<height>25</height>
<height>24</height>
</rect>
</property>
<widget class="QMenu" name="menuSystem">
@ -79,6 +79,7 @@
<string>File</string>
</property>
<addaction name="actionLoad_state"/>
<addaction name="actionLoad_state_from"/>
<addaction name="actionSave_state"/>
<addaction name="actionSwap_disks"/>
</widget>
@ -213,6 +214,11 @@
<string>F5</string>
</property>
</action>
<action name="actionLoad_state_from">
<property name="text">
<string>Load state...</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>

View file

@ -11,6 +11,7 @@
#include "Memory.h"
#include "Keyboard.h"
#include "NTSC.h"
#include <unistd.h>
static bool bVideoScannerNTSC = true; // NTSC video scanning (or PAL)
static VideoStyle_e g_eVideoStyle = VS_HALF_SCANLINES;
@ -62,6 +63,11 @@ void LeaveCriticalSection(CRITICAL_SECTION * criticalSection)
{
}
bool SetCurrentImageDir(const std::string & dir ) {
chdir(dir.c_str());
return true;
}
void OutputDebugString(const char * str)
{
std::cerr << str << std::endl;

View file

@ -8,7 +8,6 @@
void VideoLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT version) { }
void KeybLoadSnapshot(YamlLoadHelper&, unsigned int) { }
std::string GetSnapshotCardName() { return ""; }
void SpkrLoadSnapshot(YamlLoadHelper&) { }
void KeybReset() { }
void MB_SaveSnapshot(YamlSaveHelper&, unsigned int) { }
@ -20,18 +19,29 @@ void SetLoadedSaveStateFlag(bool) { }
void KeybSaveSnapshot(YamlSaveHelper&) { }
void SpkrSaveSnapshot(YamlSaveHelper&) { }
bool CSuperSerialCard::LoadSnapshot(YamlLoadHelper&, unsigned int, unsigned int) { return true; }
std::string CSuperSerialCard::GetSnapshotCardName() { return ""; }
std::string MB_GetSnapshotCardName() { return ""; }
void MB_Reset() { }
void MB_InitializeForLoadingSnapshot() { }
void Phasor_LoadSnapshot(YamlLoadHelper&, unsigned int, unsigned int) { }
void Phasor_SaveSnapshot(YamlSaveHelper&, unsigned int) { }
std::string Phasor_GetSnapshotCardName() { return ""; }
void IPropertySheet::ApplyNewConfig(CConfigNeedingRestart const&, CConfigNeedingRestart const&) { }
void FrameUpdateApple2Type() { }
bool SetCurrentImageDir(const std::string & ) { return true; }
void CSuperSerialCard::SaveSnapshot(YamlSaveHelper&) { }
std::string MB_GetSnapshotCardName()
{
return "Mockingboard C";
}
std::string CSuperSerialCard::GetSnapshotCardName()
{
return "Super Serial Card";
}
std::string Phasor_GetSnapshotCardName()
{
return "Phasor";
}
// Copied from Video.cpp as it is too complicated to compile and use Video.cpp
#define SS_YAML_KEY_ALTCHARSET "Alt Char Set"