From 86397d912c52bbcb2cb01bc71928db7270e566d6 Mon Sep 17 00:00:00 2001 From: zilmar Date: Sat, 22 Sep 2012 15:53:39 +1000 Subject: [PATCH] commit the local changes I had on my hard disk --- Bin/Release/Config/Project64.rdb | 35 ++++++++--------- Source/Common/MemTest.h | 15 ++++++-- .../N64 System/Mips/System Events.cpp | 3 ++ Source/Project64/N64 System/N64 Class.cpp | 38 ++++--------------- .../Recompiler/Recompiler Class.cpp | 11 ++++++ .../N64 System/Recompiler/Recompiler Class.h | 1 + .../SettingsType-ApplicationIndex.cpp | 3 ++ .../Settings/SettingType/SettingsType-Base.h | 2 + .../SettingType/SettingsType-Cheats.cpp | 23 +++++++---- .../SettingType/SettingsType-Cheats.h | 4 +- .../SettingType/SettingsType-GameSetting.cpp | 21 +++++++--- .../SettingType/SettingsType-GameSetting.h | 6 +-- .../SettingType/SettingsType-RDBCpuType.cpp | 6 +-- .../SettingType/SettingsType-RDBOnOff.cpp | 6 +-- .../SettingType/SettingsType-RDBRamSize.cpp | 6 +-- .../SettingType/SettingsType-RDBSaveChip.cpp | 14 +++---- .../SettingType/SettingsType-RDBYesNo.cpp | 12 +++--- .../SettingType/SettingsType-RelativePath.cpp | 4 ++ .../SettingType/SettingsType-RomDatabase.cpp | 28 +++++++++----- .../SettingType/SettingsType-RomDatabase.h | 2 +- .../SettingsType-RomDatabaseIndex.cpp | 2 +- .../SettingType/SettingsType-TempBool.cpp | 4 ++ .../SettingType/SettingsType-TempNumber.cpp | 4 ++ .../SettingType/SettingsType-TempString.cpp | 5 +++ Source/Project64/Settings/Settings Class.cpp | 8 ++-- Source/Project64/User Interface/Gui Class.cpp | 2 +- .../Project64/User Interface/UI Resources.rc | 8 ++-- Source/Project64/main.cpp | 1 + Source/RSP/Main.cpp | 4 +- 29 files changed, 161 insertions(+), 117 deletions(-) diff --git a/Bin/Release/Config/Project64.rdb b/Bin/Release/Config/Project64.rdb index 49aa22eb8..41e5b7038 100644 --- a/Bin/Release/Config/Project64.rdb +++ b/Bin/Release/Config/Project64.rdb @@ -7091,31 +7091,28 @@ SMM-PI DMA=0 SMM-TLB=0 [EC7011B7-7616D72B-C:45] -Good Name=Legend of Zelda, The - Ocarina of Time (U) (V1.0) -Internal Name=THE LEGEND OF ZELDA -RDRAM Size=4 -Counter Factor=2 +Aspect Correction=1 CPU Type=Recompiler -Self-modifying code Method=Check Memory Advance -Use TLB=No -Status=Compatible -Core Note=(see GameFAQ) -Plugin Note= +Cheat0=801DA5CB 0002 Clear Frame=0 -Self Texture=1 -Primary Frame Buffer=0 -//Resolution Width=-1 -//Resolution Height=-1 +Core Note=(see GameFAQ) +Counter Factor=2 Culling=1 -Emulate Clear=1 -Cheat0=801DA5CB 0002 //Subscreen Delay Fix -MD5=AA3911F5D5598E19E0183E15B6719C36 CustomSMM=1 +Emulate Clear=1 +FuncFind=1 +Good Name=Legend of Zelda, The - Ocarina of Time (U) (V1.0) +Internal Name=THE LEGEND OF ZELDA +MD5=AA3911F5D5598E19E0183E15B6719C36 +Plugin Note= +Primary Frame Buffer=0 +RDRAM Size=4 SMM-PI DMA=0 SMM-TLB=0 -FuncFind=1 -ClearvFrame=0 -Aspect Correction=1 +Self Texture=1 +Self-modifying code Method=Check Memory Advance +Status=Compatible +Use TLB=No [D43DA81F-021E1E19-C:45] Good Name=Legend of Zelda, The - Ocarina of Time (U) (V1.1) diff --git a/Source/Common/MemTest.h b/Source/Common/MemTest.h index c3c9d056a..33aa5fc50 100644 --- a/Source/Common/MemTest.h +++ b/Source/Common/MemTest.h @@ -14,18 +14,25 @@ #define _WIN32_WINNT 0x0500 #endif -#include +#include +#include +#include +#include + +#define new new(__FILE__, __LINE__) #include +#include +#undef new + +/* #include #include #include -#include -#include #include #include #include #include - +*/ typedef struct { diff --git a/Source/Project64/N64 System/Mips/System Events.cpp b/Source/Project64/N64 System/Mips/System Events.cpp index 1b3f4a591..bd6d0067d 100644 --- a/Source/Project64/N64 System/Mips/System Events.cpp +++ b/Source/Project64/N64 System/Mips/System Events.cpp @@ -55,6 +55,9 @@ void CSystemEvents::ExecuteEvents ( void ) case SysEvent_ResetCPU_SoftDone: _System->Reset(true,false); break; + case SysEvent_ResetCPU_Hard: + _System->Reset(true,true); + break; case SysEvent_Profile_GenerateLogs: GenerateProfileLog(); break; diff --git a/Source/Project64/N64 System/N64 Class.cpp b/Source/Project64/N64 System/N64 Class.cpp index 684e0c1ef..0e9aaddef 100644 --- a/Source/Project64/N64 System/N64 Class.cpp +++ b/Source/Project64/N64 System/N64 Class.cpp @@ -75,6 +75,7 @@ void CN64System::ExternalEvent ( SystemEvent action ) case SysEvent_Interrupt_DP: QueueEvent(action); break; + case SysEvent_ResetCPU_Hard: case SysEvent_ResetCPU_Soft: case SysEvent_CloseCPU: QueueEvent(action); @@ -135,31 +136,6 @@ void CN64System::ExternalEvent ( SystemEvent action ) SetEvent(m_hPauseEvent); } break; - case SysEvent_ResetCPU_Hard: - { - _Notify->BreakPoint(__FILE__,__LINE__); -#ifdef tofix - m_InReset = true; - - CN64Rom * TempRom = _Rom; - _Rom = 0; - Reset(); - _Rom = TempRom; - - m_Limitor.SetHertz(_Settings->LoadDword(Game_ScreenHertz)); //Is set in LoadRomSettings - - //Recreate Memory - m_Reg = new CRegisters(this, _Notify); - _MMU = new CMipsMemoryVM(this); - _MMU->FixRDramSize(); - - m_Audio.Reset(); - - m_InReset = false; - StartEmulation(true); -#endif - } - break; case SysEvent_CPUUsageTimerChanged: g_ShowCPUPer = _Settings->LoadDword(UserInterface_ShowCPUPer); break; @@ -498,10 +474,6 @@ bool CN64System::IsDialogMsg( MSG * msg ) void CN64System::Reset (bool bInitReg, bool ClearMenory) { - if (m_Recomp) - { - m_Recomp->ResetRecompCode(); - } if (_Plugins) { _Plugins->GameReset(); } m_Audio.Reset(); m_MMU_VM.Reset(ClearMenory); @@ -514,7 +486,6 @@ void CN64System::Reset (bool bInitReg, bool ClearMenory) m_UnknownCount = 0; m_DMAUsed = false; - m_Reg.Reset(); m_SystemTimer.Reset(); m_SystemTimer.SetTimer(CSystemTimer::CompareTimer,m_Reg.COMPARE_REGISTER - m_Reg.COUNT_REGISTER,false); @@ -532,7 +503,14 @@ void CN64System::Reset (bool bInitReg, bool ClearMenory) { memcpy((m_MMU_VM.Dmem()+0x40), (_Rom->GetRomAddress() + 0x040), 0xFBC); } + } else { + m_Reg.Reset(); } + if (m_Recomp) + { + m_Recomp->Reset(); + } + if (_Plugins) { _Plugins->GameReset(); } } bool CN64System::SetActiveSystem( bool bActive ) diff --git a/Source/Project64/N64 System/Recompiler/Recompiler Class.cpp b/Source/Project64/N64 System/Recompiler/Recompiler Class.cpp index db61c2697..e028a5ffb 100644 --- a/Source/Project64/N64 System/Recompiler/Recompiler Class.cpp +++ b/Source/Project64/N64 System/Recompiler/Recompiler Class.cpp @@ -534,6 +534,12 @@ void CRecompiler::RecompilerMain_Lookup( void ) }*/ } +void CRecompiler::Reset() +{ + ResetRecompCode(); + ResetMemoryStackPos(); +} + void CRecompiler::ResetRecompCode() { CRecompMemory::Reset(); @@ -896,6 +902,11 @@ void CRecompiler::ClearRecompCode_Virt(DWORD Address, int length,REMOVE_REASON R void CRecompiler::ResetMemoryStackPos( void ) { + if (_Reg->m_GPR[29].UW[0] == 0) + { + m_MemoryStack = NULL; + return; + } if (_MMU == NULL || _Reg == NULL) { _Notify->BreakPoint(__FILE__,__LINE__); diff --git a/Source/Project64/N64 System/Recompiler/Recompiler Class.h b/Source/Project64/N64 System/Recompiler/Recompiler Class.h index 6a4beb0f4..254516a0c 100644 --- a/Source/Project64/N64 System/Recompiler/Recompiler Class.h +++ b/Source/Project64/N64 System/Recompiler/Recompiler Class.h @@ -23,6 +23,7 @@ public: ~CRecompiler (void); void Run ( void ); + void Reset ( void ); void ResetRecompCode ( void ); bool GenerateX86Code (CCodeBlock & BlockInfo, CCodeSection * Section, DWORD Test ); diff --git a/Source/Project64/Settings/SettingType/SettingsType-ApplicationIndex.cpp b/Source/Project64/Settings/SettingType/SettingsType-ApplicationIndex.cpp index ecc6a9367..28df566b4 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-ApplicationIndex.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-ApplicationIndex.cpp @@ -23,6 +23,9 @@ CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(LPCSTR Section, LPCST { } +CSettingTypeApplicationIndex::~CSettingTypeApplicationIndex ( void ) +{ +} bool CSettingTypeApplicationIndex::Load ( int Index, bool & Value ) const { diff --git a/Source/Project64/Settings/SettingType/SettingsType-Base.h b/Source/Project64/Settings/SettingType/SettingsType-Base.h index fab2bba3f..dbd9b4971 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-Base.h +++ b/Source/Project64/Settings/SettingType/SettingsType-Base.h @@ -20,6 +20,8 @@ enum SettingType { class CSettingType { public: + virtual ~CSettingType() {}; + virtual SettingType GetSettingType ( void ) const = 0; virtual bool IndexBasedSetting ( void ) const = 0; diff --git a/Source/Project64/Settings/SettingType/SettingsType-Cheats.cpp b/Source/Project64/Settings/SettingType/SettingsType-Cheats.cpp index 0104848d9..97477dd66 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-Cheats.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-Cheats.cpp @@ -2,19 +2,23 @@ #include "SettingsType-Cheats.h" CIniFile * CSettingTypeCheats::m_CheatIniFile = NULL; -stdstr CSettingTypeCheats::m_SectionIdent; +stdstr * CSettingTypeCheats::m_SectionIdent = NULL; CSettingTypeCheats::CSettingTypeCheats(LPCSTR PostFix ) : m_PostFix(PostFix) { } +CSettingTypeCheats::~CSettingTypeCheats ( void ) +{ +} + void CSettingTypeCheats::Initilize ( void ) { m_CheatIniFile = new CIniFile(_Settings->LoadString(SupportFile_Cheats).c_str()); m_CheatIniFile->SetAutoFlush(false); _Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged); - m_SectionIdent = _Settings->LoadString(Game_IniKey); + m_SectionIdent = new stdstr(_Settings->LoadString(Game_IniKey)); GameChanged(NULL); } @@ -26,6 +30,11 @@ void CSettingTypeCheats::CleanUp ( void ) delete m_CheatIniFile; m_CheatIniFile = NULL; } + if (m_SectionIdent) + { + delete m_SectionIdent; + m_SectionIdent = NULL; + } } void CSettingTypeCheats::FlushChanges( void ) @@ -38,7 +47,7 @@ void CSettingTypeCheats::FlushChanges( void ) void CSettingTypeCheats::GameChanged ( void * /*Data */ ) { - m_SectionIdent = _Settings->LoadString(Game_IniKey); + *m_SectionIdent = _Settings->LoadString(Game_IniKey); } @@ -75,7 +84,7 @@ bool CSettingTypeCheats::Load ( int Index, stdstr & Value ) const return false; } stdstr_f Key("Cheat%d%s",Index,m_PostFix); - return m_CheatIniFile->GetString(m_SectionIdent.c_str(),Key.c_str(),"",Value); + return m_CheatIniFile->GetString(m_SectionIdent->c_str(),Key.c_str(),"",Value); } //return the default values @@ -110,7 +119,7 @@ void CSettingTypeCheats::Save ( int Index, const stdstr & Value ) if (m_CheatIniFile == NULL) { return; } stdstr_f Key("Cheat%d%s",Index,m_PostFix); - m_CheatIniFile->SaveString(m_SectionIdent.c_str(),Key.c_str(),Value.c_str()); + m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),Value.c_str()); } void CSettingTypeCheats::Save ( int Index, const char * Value ) @@ -118,11 +127,11 @@ void CSettingTypeCheats::Save ( int Index, const char * Value ) if (m_CheatIniFile == NULL) { return; } stdstr_f Key("Cheat%d%s",Index,m_PostFix); - m_CheatIniFile->SaveString(m_SectionIdent.c_str(),Key.c_str(),Value); + m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),Value); } void CSettingTypeCheats::Delete ( int Index ) { stdstr_f Key("Cheat%d%s",Index,m_PostFix); - m_CheatIniFile->SaveString(m_SectionIdent.c_str(),Key.c_str(),NULL); + m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),NULL); } diff --git a/Source/Project64/Settings/SettingType/SettingsType-Cheats.h b/Source/Project64/Settings/SettingType/SettingsType-Cheats.h index 081d1d32b..a4fb89fc6 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-Cheats.h +++ b/Source/Project64/Settings/SettingType/SettingsType-Cheats.h @@ -6,8 +6,8 @@ class CSettingTypeCheats : protected: static CIniFile * m_CheatIniFile; - static stdstr m_SectionIdent; - const LPCSTR m_PostFix; + static stdstr * m_SectionIdent; + const LPCSTR m_PostFix; static void GameChanged ( void * /*Data */ ); public: diff --git a/Source/Project64/Settings/SettingType/SettingsType-GameSetting.cpp b/Source/Project64/Settings/SettingType/SettingsType-GameSetting.cpp index 5515faa8c..4a29328ab 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-GameSetting.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-GameSetting.cpp @@ -2,9 +2,9 @@ #include "SettingsType-Application.h" #include "SettingsType-GameSetting.h" -bool CSettingTypeGame::m_RdbEditor = false; -bool CSettingTypeGame::m_EraseDefaults = true; -stdstr CSettingTypeGame::m_SectionIdent; +bool CSettingTypeGame::m_RdbEditor = false; +bool CSettingTypeGame::m_EraseDefaults = true; +stdstr * CSettingTypeGame::m_SectionIdent = NULL; CSettingTypeGame::CSettingTypeGame(LPCSTR Name, LPCSTR DefaultValue ) : CSettingTypeApplication("",Name,DefaultValue) @@ -34,11 +34,16 @@ void CSettingTypeGame::Initilize ( void ) void CSettingTypeGame::CleanUp ( void ) { _Settings->UnregisterChangeCB(Game_IniKey,NULL,UpdateSettings); + if (m_SectionIdent) + { + delete m_SectionIdent; + m_SectionIdent = NULL; + } } LPCSTR CSettingTypeGame::SectionName ( void ) const { - return m_SectionIdent.c_str(); + return m_SectionIdent ? m_SectionIdent->c_str() : ""; } void CSettingTypeGame::UpdateSettings ( void * /*Data */ ) @@ -47,9 +52,13 @@ void CSettingTypeGame::UpdateSettings ( void * /*Data */ ) m_EraseDefaults = _Settings->LoadBool(Setting_EraseGameDefaults); stdstr SectionIdent = _Settings->LoadString(Game_IniKey); - if (SectionIdent != m_SectionIdent) + if (m_SectionIdent == NULL) { - m_SectionIdent = SectionIdent; + m_SectionIdent = new stdstr; + } + if (SectionIdent != *m_SectionIdent) + { + *m_SectionIdent = SectionIdent; _Settings->SettingTypeChanged(SettingType_GameSetting); _Settings->SettingTypeChanged(SettingType_RomDatabase); } diff --git a/Source/Project64/Settings/SettingType/SettingsType-GameSetting.h b/Source/Project64/Settings/SettingType/SettingsType-GameSetting.h index 2945ce7be..0bd4558a7 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-GameSetting.h +++ b/Source/Project64/Settings/SettingType/SettingsType-GameSetting.h @@ -4,9 +4,9 @@ class CSettingTypeGame : public CSettingTypeApplication { protected: - static bool m_RdbEditor; - static bool m_EraseDefaults; - static stdstr m_SectionIdent; + static bool m_RdbEditor; + static bool m_EraseDefaults; + static stdstr * m_SectionIdent; static void UpdateSettings ( void * /*Data */ ); diff --git a/Source/Project64/Settings/SettingType/SettingsType-RDBCpuType.cpp b/Source/Project64/Settings/SettingType/SettingsType-RDBCpuType.cpp index 4b2ac52cf..9772bc63c 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-RDBCpuType.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-RDBCpuType.cpp @@ -25,7 +25,7 @@ bool CSettingTypeRDBCpuType::Load ( int Index, bool & Value ) const bool CSettingTypeRDBCpuType::Load ( int Index, ULONG & Value ) const { stdstr strValue; - bool bRes = m_SettingsIniFile->GetString(m_SectionIdent.c_str(),m_KeyName.c_str(),m_DefaultStr,strValue); + bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue); if (!bRes) { LoadDefault(Index,Value); @@ -94,7 +94,7 @@ void CSettingTypeRDBCpuType::Save ( int Index, ULONG Value ) default: Notify().BreakPoint(__FILE__,__LINE__); } - m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),strValue.c_str()); + m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),strValue.c_str()); } void CSettingTypeRDBCpuType::Save ( int Index, const stdstr & Value ) @@ -109,5 +109,5 @@ void CSettingTypeRDBCpuType::Save ( int Index, const char * Value ) void CSettingTypeRDBCpuType::Delete( int Index ) { - m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),NULL); + m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL); } diff --git a/Source/Project64/Settings/SettingType/SettingsType-RDBOnOff.cpp b/Source/Project64/Settings/SettingType/SettingsType-RDBOnOff.cpp index 4e61de03b..848e8e15c 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-RDBOnOff.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-RDBOnOff.cpp @@ -19,7 +19,7 @@ CSettingTypeRDBOnOff::CSettingTypeRDBOnOff(LPCSTR Name, int DefaultValue ) : bool CSettingTypeRDBOnOff::Load ( int Index, bool & Value ) const { stdstr strValue; - bool bRes = m_SettingsIniFile->GetString(m_SectionIdent.c_str(),m_KeyName.c_str(),m_DefaultStr,strValue); + bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue); if (!bRes) { LoadDefault(Index,Value); @@ -79,7 +79,7 @@ void CSettingTypeRDBOnOff::LoadDefault ( int Index, stdstr & Value ) const //Update the settings void CSettingTypeRDBOnOff::Save ( int Index, bool Value ) { - m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),Value? "On" : "Off"); + m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),Value? "On" : "Off"); } void CSettingTypeRDBOnOff::Save ( int Index, ULONG Value ) @@ -99,5 +99,5 @@ void CSettingTypeRDBOnOff::Save ( int Index, const char * Value ) void CSettingTypeRDBOnOff::Delete( int Index ) { - m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),NULL); + m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL); } diff --git a/Source/Project64/Settings/SettingType/SettingsType-RDBRamSize.cpp b/Source/Project64/Settings/SettingType/SettingsType-RDBRamSize.cpp index c71e5b6e4..8558791d0 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-RDBRamSize.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-RDBRamSize.cpp @@ -27,7 +27,7 @@ bool CSettingTypeRDBRDRamSize::Load ( int Index, bool & Value ) const bool CSettingTypeRDBRDRamSize::Load ( int Index, ULONG & Value ) const { ULONG ulValue; - bool bRes = m_SettingsIniFile->GetNumber(m_SectionIdent.c_str(),m_KeyName.c_str(),m_DefaultValue,ulValue); + bool bRes = m_SettingsIniFile->GetNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultValue,ulValue); if (!bRes) { LoadDefault(Index,ulValue); @@ -70,7 +70,7 @@ void CSettingTypeRDBRDRamSize::Save ( int Index, bool Value ) void CSettingTypeRDBRDRamSize::Save ( int Index, ULONG Value ) { - m_SettingsIniFile->SaveNumber(m_SectionIdent.c_str(),m_KeyName.c_str(),Value == 0x800000 ? 8 : 4); + m_SettingsIniFile->SaveNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),Value == 0x800000 ? 8 : 4); } void CSettingTypeRDBRDRamSize::Save ( int Index, const stdstr & Value ) @@ -85,5 +85,5 @@ void CSettingTypeRDBRDRamSize::Save ( int Index, const char * Value ) void CSettingTypeRDBRDRamSize::Delete( int Index ) { - m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),NULL); + m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL); } diff --git a/Source/Project64/Settings/SettingType/SettingsType-RDBSaveChip.cpp b/Source/Project64/Settings/SettingType/SettingsType-RDBSaveChip.cpp index 3d80d50db..8d52e9fa0 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-RDBSaveChip.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-RDBSaveChip.cpp @@ -25,7 +25,7 @@ bool CSettingTypeRDBSaveChip::Load ( int Index, bool & Value ) const bool CSettingTypeRDBSaveChip::Load ( int Index, ULONG & Value ) const { stdstr strValue; - bool bRes = m_SettingsIniFile->GetString(m_SectionIdent.c_str(),m_KeyName.c_str(),m_DefaultStr,strValue); + bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue); if (!bRes) { LoadDefault(Index,Value); @@ -89,11 +89,11 @@ void CSettingTypeRDBSaveChip::Save ( int Index, ULONG Value ) { switch (Value) { - case SaveChip_Auto: m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),"First Save Type"); break; - case SaveChip_Eeprom_4K: m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),"4kbit Eeprom"); break; - case SaveChip_Eeprom_16K: m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),"16kbit Eeprom"); break; - case SaveChip_Sram: m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),"Sram"); break; - case SaveChip_FlashRam: m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),"FlashRam"); break; + case SaveChip_Auto: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"First Save Type"); break; + case SaveChip_Eeprom_4K: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"4kbit Eeprom"); break; + case SaveChip_Eeprom_16K: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"16kbit Eeprom"); break; + case SaveChip_Sram: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"Sram"); break; + case SaveChip_FlashRam: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"FlashRam"); break; default: Notify().BreakPoint(__FILE__,__LINE__); } @@ -111,5 +111,5 @@ void CSettingTypeRDBSaveChip::Save ( int Index, const char * Value ) void CSettingTypeRDBSaveChip::Delete( int Index ) { - m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),NULL); + m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL); } diff --git a/Source/Project64/Settings/SettingType/SettingsType-RDBYesNo.cpp b/Source/Project64/Settings/SettingType/SettingsType-RDBYesNo.cpp index 021357a69..3a738f770 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-RDBYesNo.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-RDBYesNo.cpp @@ -12,14 +12,14 @@ CSettingTypeRDBYesNo::CSettingTypeRDBYesNo(LPCSTR Name, int DefaultValue ) : { } - CSettingTypeRDBYesNo::~CSettingTypeRDBYesNo() +CSettingTypeRDBYesNo::~CSettingTypeRDBYesNo() { } bool CSettingTypeRDBYesNo::Load ( int Index, bool & Value ) const { stdstr strValue; - bool bRes = m_SettingsIniFile->GetString(m_SectionIdent.c_str(),m_KeyName.c_str(),m_DefaultStr,strValue); + bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue); if (!bRes) { LoadDefault(Index,Value); @@ -34,7 +34,7 @@ bool CSettingTypeRDBYesNo::Load ( int Index, bool & Value ) const LoadDefault(Index,Value); return false; } else { - WriteTraceF(TraceError,"Invalid Yes/No setting value (Section: %s Key: %s Value: %s)",m_SectionIdent.c_str(),String,m_KeyName.c_str(),strValue.c_str()); + WriteTraceF(TraceError,"Invalid Yes/No setting value (Section: %s Key: %s Value: %s)",m_SectionIdent->c_str(),String,m_KeyName.c_str(),strValue.c_str()); LoadDefault(Index,Value); return false; } @@ -82,12 +82,12 @@ void CSettingTypeRDBYesNo::LoadDefault ( int Index, stdstr & Value ) const //Update the settings void CSettingTypeRDBYesNo::Save ( int Index, bool Value ) { - m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),Value? "Yes" : "No"); + m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),Value? "Yes" : "No"); } void CSettingTypeRDBYesNo::Save ( int Index, ULONG Value ) { - m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),Value? "Yes" : "No"); + m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),Value? "Yes" : "No"); } void CSettingTypeRDBYesNo::Save ( int Index, const stdstr & Value ) @@ -102,5 +102,5 @@ void CSettingTypeRDBYesNo::Save ( int Index, const char * Value ) void CSettingTypeRDBYesNo::Delete( int Index ) { - m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),NULL); + m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL); } diff --git a/Source/Project64/Settings/SettingType/SettingsType-RelativePath.cpp b/Source/Project64/Settings/SettingType/SettingsType-RelativePath.cpp index cf8feff72..03e9a1ddb 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-RelativePath.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-RelativePath.cpp @@ -7,6 +7,10 @@ CSettingTypeRelativePath::CSettingTypeRelativePath(LPCSTR Path, LPCSTR FileName) m_FileName.AppendDirectory(Path); } +CSettingTypeRelativePath::~CSettingTypeRelativePath ( void ) +{ +} + bool CSettingTypeRelativePath::Load ( int Index, stdstr & value ) const { value = (LPCSTR)m_FileName; diff --git a/Source/Project64/Settings/SettingType/SettingsType-RomDatabase.cpp b/Source/Project64/Settings/SettingType/SettingsType-RomDatabase.cpp index 3916aa373..259e51d3e 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-RomDatabase.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-RomDatabase.cpp @@ -2,7 +2,7 @@ #include "SettingsType-RomDatabase.h" CIniFile * CSettingTypeRomDatabase::m_SettingsIniFile = NULL; -stdstr CSettingTypeRomDatabase::m_SectionIdent; +stdstr * CSettingTypeRomDatabase::m_SectionIdent = NULL; CSettingTypeRomDatabase::CSettingTypeRomDatabase(LPCSTR Name, int DefaultValue, bool DeleteOnDefault ) : m_KeyName(Name), @@ -50,7 +50,7 @@ void CSettingTypeRomDatabase::Initilize( void ) _Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged); - m_SectionIdent = _Settings->LoadString(Game_IniKey); + m_SectionIdent = new stdstr(_Settings->LoadString(Game_IniKey)); } void CSettingTypeRomDatabase::CleanUp( void ) @@ -61,11 +61,19 @@ void CSettingTypeRomDatabase::CleanUp( void ) delete m_SettingsIniFile; m_SettingsIniFile = NULL; } + if (m_SectionIdent) + { + delete m_SectionIdent; + m_SectionIdent = NULL; + } } void CSettingTypeRomDatabase::GameChanged ( void * /*Data */ ) { - m_SectionIdent = _Settings->LoadString(Game_IniKey); + if (m_SectionIdent) + { + *m_SectionIdent = _Settings->LoadString(Game_IniKey); + } } bool CSettingTypeRomDatabase::Load ( int Index, bool & Value ) const @@ -78,7 +86,7 @@ bool CSettingTypeRomDatabase::Load ( int Index, bool & Value ) const bool CSettingTypeRomDatabase::Load ( int Index, ULONG & Value ) const { - bool bRes = m_SettingsIniFile->GetNumber(m_SectionIdent.c_str(),m_KeyName.c_str(),Value,Value); + bool bRes = m_SettingsIniFile->GetNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),Value,Value); if (!bRes) { LoadDefault(Index,Value); @@ -89,7 +97,7 @@ bool CSettingTypeRomDatabase::Load ( int Index, ULONG & Value ) const bool CSettingTypeRomDatabase::Load ( int Index, stdstr & Value ) const { stdstr temp_value; - bool bRes = m_SettingsIniFile->GetString(m_SectionIdent.c_str(),m_KeyName.c_str(),m_DefaultStr,temp_value); + bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,temp_value); if (bRes) { Value = temp_value; @@ -150,7 +158,7 @@ void CSettingTypeRomDatabase::Save ( int Index, bool Value ) { Notify().BreakPoint(__FILE__,__LINE__); } - m_SettingsIniFile->SaveNumber(m_SectionIdent.c_str(),m_KeyName.c_str(),Value); + m_SettingsIniFile->SaveNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),Value); } void CSettingTypeRomDatabase::Save ( int Index, ULONG Value ) @@ -165,20 +173,20 @@ void CSettingTypeRomDatabase::Save ( int Index, ULONG Value ) return; } } - m_SettingsIniFile->SaveNumber(m_SectionIdent.c_str(),m_KeyName.c_str(),Value); + m_SettingsIniFile->SaveNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),Value); } void CSettingTypeRomDatabase::Save ( int Index, const stdstr & Value ) { - m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),Value.c_str()); + m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),Value.c_str()); } void CSettingTypeRomDatabase::Save ( int Index, const char * Value ) { - m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),Value); + m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),Value); } void CSettingTypeRomDatabase::Delete ( int Index ) { - m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),NULL); + m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL); } diff --git a/Source/Project64/Settings/SettingType/SettingsType-RomDatabase.h b/Source/Project64/Settings/SettingType/SettingsType-RomDatabase.h index 81e4dddca..69206566c 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-RomDatabase.h +++ b/Source/Project64/Settings/SettingType/SettingsType-RomDatabase.h @@ -10,7 +10,7 @@ protected: const SettingID m_DefaultSetting; const bool m_DeleteOnDefault; - static stdstr m_SectionIdent; + static stdstr * m_SectionIdent; static CIniFile * m_SettingsIniFile; static void GameChanged ( void * /*Data */ ); diff --git a/Source/Project64/Settings/SettingType/SettingsType-RomDatabaseIndex.cpp b/Source/Project64/Settings/SettingType/SettingsType-RomDatabaseIndex.cpp index fb69a4446..2f8cc0cd8 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-RomDatabaseIndex.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-RomDatabaseIndex.cpp @@ -92,5 +92,5 @@ void CSettingTypeRomDatabaseIndex::Save ( int Index, const char * Value ) void CSettingTypeRomDatabaseIndex::Delete ( int Index ) { - m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),NULL); + m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL); } diff --git a/Source/Project64/Settings/SettingType/SettingsType-TempBool.cpp b/Source/Project64/Settings/SettingType/SettingsType-TempBool.cpp index 331415402..c3fb4d729 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-TempBool.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-TempBool.cpp @@ -6,6 +6,10 @@ CSettingTypeTempBool::CSettingTypeTempBool(bool initialValue) : { } +CSettingTypeTempBool::~CSettingTypeTempBool ( void ) +{ +} + bool CSettingTypeTempBool::Load ( int Index, bool & Value ) const { Value = m_value; diff --git a/Source/Project64/Settings/SettingType/SettingsType-TempNumber.cpp b/Source/Project64/Settings/SettingType/SettingsType-TempNumber.cpp index fcc113001..2841ec46c 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-TempNumber.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-TempNumber.cpp @@ -6,6 +6,10 @@ CSettingTypeTempNumber::CSettingTypeTempNumber(ULONG initialValue) : { } +CSettingTypeTempNumber::~CSettingTypeTempNumber ( void ) +{ +} + bool CSettingTypeTempNumber::Load ( int Index, bool & Value ) const { Notify().BreakPoint(__FILE__,__LINE__); diff --git a/Source/Project64/Settings/SettingType/SettingsType-TempString.cpp b/Source/Project64/Settings/SettingType/SettingsType-TempString.cpp index 182566a2a..11f45a6b0 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-TempString.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-TempString.cpp @@ -6,6 +6,11 @@ CSettingTypeTempString::CSettingTypeTempString(LPCSTR initialValue) : { } +CSettingTypeTempString::~CSettingTypeTempString ( void ) +{ +} + + bool CSettingTypeTempString::Load ( int Index, bool & Value ) const { Notify().BreakPoint(__FILE__,__LINE__); diff --git a/Source/Project64/Settings/Settings Class.cpp b/Source/Project64/Settings/Settings Class.cpp index b4a75c455..6cd8dccff 100644 --- a/Source/Project64/Settings/Settings Class.cpp +++ b/Source/Project64/Settings/Settings Class.cpp @@ -51,11 +51,9 @@ CSettings::~CSettings() void CSettings::AddHandler ( SettingID TypeID, CSettingType * Handler ) { - SETTING_HANDLER FindInfo = m_SettingInfo.find(TypeID); - if (FindInfo == m_SettingInfo.end()) - { - m_SettingInfo.insert(SETTING_MAP::value_type(TypeID,Handler)); - } else { + SETTING_MAP::_Pairib res = m_SettingInfo.insert(SETTING_MAP::value_type(TypeID,Handler)); + if (!res.second) + { delete Handler; } } diff --git a/Source/Project64/User Interface/Gui Class.cpp b/Source/Project64/User Interface/Gui Class.cpp index bafaa41ab..b2e88728c 100644 --- a/Source/Project64/User Interface/Gui Class.cpp +++ b/Source/Project64/User Interface/Gui Class.cpp @@ -694,7 +694,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam } break; } - if (bAutoSleep()) + if (bAutoSleep() || fActive) { if (_BaseSystem) { diff --git a/Source/Project64/User Interface/UI Resources.rc b/Source/Project64/User Interface/UI Resources.rc index 0aea8c0b8..a35b2232d 100644 --- a/Source/Project64/User Interface/UI Resources.rc +++ b/Source/Project64/User Interface/UI Resources.rc @@ -925,8 +925,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,7,51,51 - PRODUCTVERSION 1,7,51,51 + FILEVERSION 1,7,51,52 + PRODUCTVERSION 1,7,51,52 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -943,12 +943,12 @@ BEGIN BEGIN VALUE "CompanyName", " " VALUE "FileDescription", "Project64" - VALUE "FileVersion", "1, 7, 51, 51" + VALUE "FileVersion", "1, 7, 51, 52" VALUE "InternalName", "Project64" VALUE "LegalCopyright", "Copyright © 2010" VALUE "OriginalFilename", "Project64.exe" VALUE "ProductName", " Project64" - VALUE "ProductVersion", "1, 7, 51, 51" + VALUE "ProductVersion", "1, 7, 51, 52" END END BLOCK "VarFileInfo" diff --git a/Source/Project64/main.cpp b/Source/Project64/main.cpp index 41a0faab1..49191bbd8 100644 --- a/Source/Project64/main.cpp +++ b/Source/Project64/main.cpp @@ -251,6 +251,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszArgs, CoInitialize(NULL); try { + SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL ); LPCSTR AppName = "Project64 1.7"; _Lang = new CLanguage(); diff --git a/Source/RSP/Main.cpp b/Source/RSP/Main.cpp index af69056df..c16191f06 100644 --- a/Source/RSP/Main.cpp +++ b/Source/RSP/Main.cpp @@ -712,8 +712,8 @@ __declspec(dllexport) void PluginLoaded (void) RegisterSetting(Set_Flags, Data_DWORD_General,"Check Flag Usage", NULL,Compiler.bFlags,NULL); RegisterSetting(Set_AlignVector, Data_DWORD_General,"Assume Vector loads align", NULL,Compiler.bAlignVector,NULL); - AudioHle = GetSystemSetting(Set_AudioHle); - GraphicsHle = GetSystemSetting(Set_GraphicsHle); + AudioHle = Set_AudioHle != 0 ? GetSystemSetting(Set_AudioHle) : false; + GraphicsHle = Set_GraphicsHle != 0 ? GetSystemSetting(Set_GraphicsHle) : true; hMutex = CreateMutex(NULL, FALSE, NULL);