From 78e8225cf007da5f293a929da6e8df94fa2e585c Mon Sep 17 00:00:00 2001 From: skidau Date: Sat, 4 Apr 2015 09:39:39 +0000 Subject: [PATCH] Enabled the e-Reader kill-switch under the Emulators menu. Fixes the freeze in "Crash Bandicoot - The Huge Adventure" by disabling the e-Reader reset patch. git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@1294 a31d4220-a93d-0410-bf67-fe4944624d44 --- src/gba/GBA.cpp | 24 +++++++++++++----------- src/gba/ereader.cpp | 2 +- src/gba/ereader.h | 2 +- src/win32/MainWndOptions.cpp | 4 ++-- src/win32/VBA.cpp | 8 ++++---- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/gba/GBA.cpp b/src/gba/GBA.cpp index 38c9a180..19b55ce1 100644 --- a/src/gba/GBA.cpp +++ b/src/gba/GBA.cpp @@ -3359,17 +3359,19 @@ void CPUReset() break; } } - switch (CheckEReaderRegion()) - { - case 1: //US - EReaderWriteMemory(0x8009134, 0x46C0DFE0); - break; - case 2: - EReaderWriteMemory(0x8008A8C, 0x46C0DFE0); - break; - case 3: - EReaderWriteMemory(0x80091A8, 0x46C0DFE0); - break; + if (eReaderEnabled) { + switch (CheckEReaderRegion()) + { + case 1: //US + EReaderWriteMemory(0x8009134, 0x46C0DFE0); + break; + case 2: + EReaderWriteMemory(0x8008A8C, 0x46C0DFE0); + break; + case 3: + EReaderWriteMemory(0x80091A8, 0x46C0DFE0); + break; + } } rtcReset(); // clean registers diff --git a/src/gba/ereader.cpp b/src/gba/ereader.cpp index 4440dc74..733770b8 100644 --- a/src/gba/ereader.cpp +++ b/src/gba/ereader.cpp @@ -17,7 +17,7 @@ //#include "win32/MainWnd.h" -int eReaderSaveRAW = 1; +int eReaderEnabled = 1; char US_Ereader[19] = "CARDE READERPSAE01"; char JAP_Ereader[19] = "CARDE READERPEAJ01"; diff --git a/src/gba/ereader.h b/src/gba/ereader.h index b0aa46d0..401807f7 100644 --- a/src/gba/ereader.h +++ b/src/gba/ereader.h @@ -1,6 +1,6 @@ extern unsigned char *DotCodeData; extern char filebuffer[]; -extern int eReaderSaveRAW; +extern int eReaderEnabled; int OpenDotCodeFile(void); int CheckEReaderRegion(void); diff --git a/src/win32/MainWndOptions.cpp b/src/win32/MainWndOptions.cpp index 66254e72..fd0b7ca3 100644 --- a/src/win32/MainWndOptions.cpp +++ b/src/win32/MainWndOptions.cpp @@ -636,12 +636,12 @@ void MainWnd::OnUpdateOptionsEmulatorAgbprint(CCmdUI* pCmdUI) void MainWnd::OnOptionsEmulatorEreader() { - eReaderSaveRAW = !eReaderSaveRAW; + eReaderEnabled = !eReaderEnabled; } void MainWnd::OnUpdateOptionsEmulatorEreader(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(eReaderSaveRAW == 1); + pCmdUI->SetCheck(eReaderEnabled == 1); } void MainWnd::OnOptionsEmulatorRealtimeclock() diff --git a/src/win32/VBA.cpp b/src/win32/VBA.cpp index 770e806b..214e0199 100644 --- a/src/win32/VBA.cpp +++ b/src/win32/VBA.cpp @@ -1415,9 +1415,9 @@ void VBA::loadSettings() { CString buffer; - eReaderSaveRAW = regQueryDwordValue("eReaderSaveRAW", 1); - if (eReaderSaveRAW < 0 || eReaderSaveRAW > 1) - eReaderSaveRAW = 1; + eReaderEnabled = regQueryDwordValue("eReaderEnabled", 1); + if (eReaderEnabled < 0 || eReaderEnabled > 1) + eReaderEnabled = 1; lastFullscreen = (VIDEO_SIZE)regQueryDwordValue("lastFullscreen", VIDEO_1024x768); @@ -2521,7 +2521,7 @@ void VBA::movieReadNext() void VBA::saveSettings() { - regSetDwordValue("eReaderSaveRAW", eReaderSaveRAW); + regSetDwordValue("eReaderEnabled", eReaderEnabled); regSetDwordValue("language", languageOption);