From f2b22ad4840106e7b3bdfa41d236aad0ea7347a1 Mon Sep 17 00:00:00 2001 From: skidau Date: Sat, 18 Apr 2015 14:28:38 +0000 Subject: [PATCH] Fixed the global saveType from getting clobbered. --- src/common/ConfigManager.cpp | 1 - src/win32/MainWnd.cpp | 1 - src/win32/MainWndOptions.cpp | 24 ++++++++++++------------ src/win32/VBA.cpp | 10 +++++----- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/common/ConfigManager.cpp b/src/common/ConfigManager.cpp index 2c7a874e..f3c4719a 100644 --- a/src/common/ConfigManager.cpp +++ b/src/common/ConfigManager.cpp @@ -472,7 +472,6 @@ void LoadConfig() recentFreeze = ReadPref("recentFreeze", false) ? true : false; autoPatch = ReadPref("autoPatch", 1) == 1 ? true : false; cpuDisableSfx = ReadPref("disableSfx", 0) ? true : false; - saveType = ReadPref("saveType", 0); ifbType = ReadPref("ifbType", 0); winFlashSize = ReadPref("flashSize", 0x10000); agbPrintEnable(ReadPref("agbPrint", 0) ? true : false); diff --git a/src/win32/MainWnd.cpp b/src/win32/MainWnd.cpp index 6498061d..d3bb7d14 100644 --- a/src/win32/MainWnd.cpp +++ b/src/win32/MainWnd.cpp @@ -522,7 +522,6 @@ bool MainWnd::FileRun() flashSetSize(winFlashSize); rtcEnable(rtcEnabled); - cpuSaveType = saveType; if (cpuSaveType == 0) utilGBAFindSave(theApp.romSize); diff --git a/src/win32/MainWndOptions.cpp b/src/win32/MainWndOptions.cpp index 57cb8ddb..4af14df6 100644 --- a/src/win32/MainWndOptions.cpp +++ b/src/win32/MainWndOptions.cpp @@ -710,62 +710,62 @@ void MainWnd::OnUpdateOptionsEmulatorShowSpeed(CCmdUI *pCmdUI) void MainWnd::OnOptionsEmulatorSavetypeAutomatic() { - saveType = 0; + cpuSaveType = 0; } void MainWnd::OnUpdateOptionsEmulatorSavetypeAutomatic(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(saveType == 0); + pCmdUI->SetCheck(cpuSaveType == 0); } void MainWnd::OnOptionsEmulatorSavetypeEeprom() { - saveType = 1; + cpuSaveType = 1; } void MainWnd::OnUpdateOptionsEmulatorSavetypeEeprom(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(saveType == 1); + pCmdUI->SetCheck(cpuSaveType == 1); } void MainWnd::OnOptionsEmulatorSavetypeSram() { - saveType = 2; + cpuSaveType = 2; } void MainWnd::OnUpdateOptionsEmulatorSavetypeSram(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(saveType == 2); + pCmdUI->SetCheck(cpuSaveType == 2); } void MainWnd::OnOptionsEmulatorSavetypeFlash() { - saveType = 3; + cpuSaveType = 3; } void MainWnd::OnUpdateOptionsEmulatorSavetypeFlash(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(saveType == 3); + pCmdUI->SetCheck(cpuSaveType == 3); } void MainWnd::OnOptionsEmulatorSavetypeEepromsensor() { - saveType = 4; + cpuSaveType = 4; } void MainWnd::OnUpdateOptionsEmulatorSavetypeEepromsensor(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(saveType == 4); + pCmdUI->SetCheck(cpuSaveType == 4); } void MainWnd::OnOptionsEmulatorSavetypeNone() { - saveType = 5; + cpuSaveType = 5; } void MainWnd::OnUpdateOptionsEmulatorSavetypeNone(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(saveType == 5); + pCmdUI->SetCheck(cpuSaveType == 5); } void MainWnd::OnOptionsEmulatorSavetypeFlash512k() diff --git a/src/win32/VBA.cpp b/src/win32/VBA.cpp index 8eb99568..5bfde6eb 100644 --- a/src/win32/VBA.cpp +++ b/src/win32/VBA.cpp @@ -250,7 +250,7 @@ VBA::VBA() winGbBorderOn = 0; winFlashSize = 0x20000; rtcEnabled = false; - saveType = 0; + cpuSaveType = 0; rewindMemory = NULL; rewindPos = 0; rewindTopPos = 0; @@ -1574,9 +1574,9 @@ void VBA::loadSettings() cpuDisableSfx = regQueryDwordValue("disableSfx", 0) ? true : false; - saveType = regQueryDwordValue("saveType", 0); - if(saveType < 0 || saveType > 5) - saveType = 0; + cpuSaveType = regQueryDwordValue("saveType", 0); + if(cpuSaveType < 0 || cpuSaveType > 5) + cpuSaveType = 0; ifbType = (IFBFilter)regQueryDwordValue("ifbType", 0); if(ifbType < 0 || ifbType > 2) @@ -2578,7 +2578,7 @@ void VBA::saveSettings() regSetDwordValue("disableSfx", cpuDisableSfx); - regSetDwordValue("saveType", saveType); + regSetDwordValue("saveType", cpuSaveType); regSetDwordValue("ifbType", ifbType);