From aa76a1d6410f805c326fe8a087d50184fdff7902 Mon Sep 17 00:00:00 2001 From: zilmar Date: Wed, 3 Oct 2012 05:42:06 +1000 Subject: [PATCH] Cleaned up some of the initialization code from the C Core refactoring --- Source/Project64/N64 System/N64 Class.cpp | 49 ++++++++++------------- Source/Project64/N64 System/N64 Class.h | 5 +-- 2 files changed, 23 insertions(+), 31 deletions(-) diff --git a/Source/Project64/N64 System/N64 Class.cpp b/Source/Project64/N64 System/N64 Class.cpp index b583994c4..b66930dc9 100644 --- a/Source/Project64/N64 System/N64 Class.cpp +++ b/Source/Project64/N64 System/N64 Class.cpp @@ -4,26 +4,6 @@ #include -void CN64System::InitializeCPUCore ( void ) -{ - switch (_Rom->GetCountry()) - { - case Germany: case french: case Italian: - case Europe: case Spanish: case Australia: - case X_PAL: case Y_PAL: - m_SystemType = SYSTEM_PAL; - break; - default: - m_SystemType = SYSTEM_NTSC; - break; - } -#ifndef EXTERNAL_RELEASE - LogOptions.GenerateLog = _Settings->LoadDword(Debugger_GenerateDebugLog); - LoadLogOptions(&LogOptions, FALSE); - StartLog(); -#endif -} - CN64System::CN64System ( CPlugins * Plugins, bool SavesReadOnly ) : m_MMU_VM(this,SavesReadOnly), m_TLB(this), @@ -47,11 +27,25 @@ CN64System::CN64System ( CPlugins * Plugins, bool SavesReadOnly ) : m_NextInstruction(0), m_JumpToLocation(0), m_TLBLoadAddress(0), - m_TLBStoreAddress(0) + m_TLBStoreAddress(0), + m_SaveUsing((SAVE_CHIP_TYPE)_Settings->LoadDword(Game_SaveChip)), + m_SystemType(SYSTEM_NTSC) { m_hPauseEvent = CreateEvent(NULL,true,false,NULL); m_Limitor.SetHertz(_Settings->LoadDword(Game_ScreenHertz)); m_Cheats.LoadCheats(!_Settings->LoadDword(Setting_RememberCheats)); + + switch (_Rom->GetCountry()) + { + case Germany: case french: case Italian: + case Europe: case Spanish: case Australia: + case X_PAL: case Y_PAL: + m_SystemType = SYSTEM_PAL; + break; + default: + m_SystemType = SYSTEM_NTSC; + break; + } } CN64System::~CN64System ( void ) { @@ -778,10 +772,11 @@ void CN64System::ExecuteCPU ( void ) m_EndEmulation = false; _Notify->RefreshMenu(); - //Check me - // _Rom->m_RomFileSize = _Rom->GetRomSize(); - - m_SaveUsing = (SAVE_CHIP_TYPE)_Settings->LoadDword(Game_SaveChip); +#ifndef EXTERNAL_RELEASE + LogOptions.GenerateLog = _Settings->LoadDword(Debugger_GenerateDebugLog); + LoadLogOptions(&LogOptions, FALSE); + StartLog(); +#endif CInterpreterCPU::BuildCPU(); @@ -795,7 +790,6 @@ void CN64System::ExecuteCPU ( void ) } void CN64System::ExecuteInterpret () { - InitializeCPUCore(); SetActiveSystem(); CInterpreterCPU::ExecuteCPU(); } @@ -803,7 +797,6 @@ void CN64System::ExecuteInterpret () { void CN64System::ExecuteRecompiler () { //execute opcodes while no errors - InitializeCPUCore(); m_Recomp = new CRecompiler(m_Profile,m_EndEmulation); SetActiveSystem(); m_Recomp->Run(); @@ -824,7 +817,6 @@ void CN64System::ExecuteSyncCPU () m_SyncCPU->SetActiveSystem(); SetActiveSystem(); - InitializeCPUCore(); m_Recomp->Run(); } @@ -938,6 +930,7 @@ void CN64System::SyncCPU (CN64System * const SecondCPU) { if (m_MMU_VM.Rdram()[0x00206970 + z] != SecondCPU->m_MMU_VM.Rdram()[0x00206970 + z]) { ErrorFound = true; + break; } }*/ diff --git a/Source/Project64/N64 System/N64 Class.h b/Source/Project64/N64 System/N64 Class.h index adda8d7b6..a99eac697 100644 --- a/Source/Project64/N64 System/N64 Class.h +++ b/Source/Project64/N64 System/N64 Class.h @@ -33,8 +33,8 @@ public: CProfiling m_Profile; CCheats m_Cheats; bool m_EndEmulation; - enum SAVE_CHIP_TYPE m_SaveUsing; - enum SystemType m_SystemType;; + SAVE_CHIP_TYPE m_SaveUsing; + SystemType m_SystemType; //Methods static bool CN64System::RunFileImage ( const char * FileLoc ); @@ -85,7 +85,6 @@ private: static void StartEmulationThread ( FileImageInfo * Info ); static bool EmulationStarting ( HANDLE hThread, DWORD ThreadId ); - void InitializeCPUCore( void ); void ExecuteCPU ( void ); void RefreshScreen ( void ); bool InternalEvent ( void );