From 7265dee506e54b0f5ea2ceb1481eb785cccfd8aa Mon Sep 17 00:00:00 2001 From: tomcw Date: Sun, 6 Oct 2019 16:39:43 +0100 Subject: [PATCH] Fixes: . loading disk state (v5) . string append bug introduced in 'char* to std::string' PR #687 --- source/Applewin.cpp | 5 +---- source/Disk.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/Applewin.cpp b/source/Applewin.cpp index c04ee8f1..5d028141 100644 --- a/source/Applewin.cpp +++ b/source/Applewin.cpp @@ -762,10 +762,7 @@ bool SetCurrentImageDir(const std::string & pszImageDir) int nLen = g_sCurrentDir.size(); if ((nLen > 0) && (g_sCurrentDir[ nLen - 1 ] != '\\')) - { - g_sCurrentDir[ nLen + 0 ] = '\\'; - g_sCurrentDir.resize(nLen + 1); - } + g_sCurrentDir += '\\'; if( SetCurrentDirectory(g_sCurrentDir.c_str()) ) return true; diff --git a/source/Disk.cpp b/source/Disk.cpp index 6fbeefd0..847543e5 100644 --- a/source/Disk.cpp +++ b/source/Disk.cpp @@ -2005,8 +2005,6 @@ bool Disk2InterfaceCard::LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT m_enhanceDisk = yamlLoadHelper.LoadBool(SS_YAML_KEY_ENHANCE_DISK); m_floppyLatch = yamlLoadHelper.LoadUint(SS_YAML_KEY_FLOPPY_LATCH); m_floppyMotorOn = yamlLoadHelper.LoadBool(SS_YAML_KEY_FLOPPY_MOTOR_ON); - m_seqFunc.writeMode = yamlLoadHelper.LoadBool(SS_YAML_KEY_FLOPPY_WRITE_MODE) ? 1 : 0; - m_seqFunc.loadMode = 0; // Wasn't saved until v5 - overwritten later if v5 if (version >= 2) { @@ -2030,6 +2028,11 @@ bool Disk2InterfaceCard::LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT { m_seqFunc.function = (SEQFUNC) yamlLoadHelper.LoadInt(SS_YAML_KEY_LSS_SEQUENCER_FUNCTION); } + else + { + m_seqFunc.writeMode = yamlLoadHelper.LoadBool(SS_YAML_KEY_FLOPPY_WRITE_MODE) ? 1 : 0; + m_seqFunc.loadMode = 0; // Wasn't saved until v5 + } // Eject all disks first in case Drive-2 contains disk to be inserted into Drive-1 for (UINT i=0; i