git-svn-id: https://localhost/svn/Project64/trunk@19 111125ac-702d-7242-af9c-5ba8ae61c1ef

This commit is contained in:
zilmar 2008-12-11 10:31:10 +00:00
parent 043a755f80
commit e1f5d9a555
15 changed files with 111 additions and 30 deletions

View File

@ -30,6 +30,7 @@ enum SettingID {
Setting_AutoSleep,
Setting_AutoStart,
Setting_AutoFullscreen,
Setting_EraseGameDefaults,
Setting_AutoZipInstantSave,
Setting_RememberCheats,

View File

@ -100,12 +100,18 @@ void CSettingTypeCheats::Save ( int Index, ULONG Value )
void CSettingTypeCheats::Save ( int Index, const stdstr & Value )
{
Notify().BreakPoint(__FILE__,__LINE__);
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());
}
void CSettingTypeCheats::Save ( int Index, const char * Value )
{
Notify().BreakPoint(__FILE__,__LINE__);
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);
}
void CSettingTypeCheats::Delete ( int Index )

View File

@ -4,6 +4,7 @@
#include "SettingsType-GameSetting.h"
bool CSettingTypeGame::m_RdbEditor = false;
bool CSettingTypeGame::m_EraseDefaults = true;
stdstr CSettingTypeGame::m_SectionIdent;
CSettingTypeGame::CSettingTypeGame(LPCSTR Name, LPCSTR DefaultValue ) :
@ -43,7 +44,8 @@ LPCSTR CSettingTypeGame::SectionName ( void ) const
void CSettingTypeGame::UpdateSettings ( void * /*Data */ )
{
m_RdbEditor = _Settings->LoadBool(Setting_RdbEditor);
m_RdbEditor = _Settings->LoadBool(Setting_RdbEditor);
m_EraseDefaults = _Settings->LoadBool(Setting_EraseGameDefaults);
stdstr SectionIdent = _Settings->LoadString(Game_IniKey);
if (SectionIdent != m_SectionIdent)
@ -146,6 +148,16 @@ void CSettingTypeGame::LoadDefault ( int Index, stdstr & Value ) const
//Update the settings
void CSettingTypeGame::Save ( int Index, bool Value )
{
if (m_EraseDefaults)
{
bool bDefault;
LoadDefault(Index,bDefault);
if (bDefault == Value)
{
Delete(Index);
return;
}
}
if (m_RdbEditor && _Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (_Settings->IndexBasedSetting(m_DefaultSetting))
@ -161,6 +173,16 @@ void CSettingTypeGame::Save ( int Index, bool Value )
void CSettingTypeGame::Save ( int Index, ULONG Value )
{
if (m_EraseDefaults)
{
ULONG ulDefault;
LoadDefault(Index,ulDefault);
if (ulDefault == Value)
{
Delete(Index);
return;
}
}
if (m_RdbEditor && _Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (_Settings->IndexBasedSetting(m_DefaultSetting))
@ -181,6 +203,16 @@ void CSettingTypeGame::Save ( int Index, const stdstr & Value )
void CSettingTypeGame::Save ( int Index, const char * Value )
{
if (m_EraseDefaults)
{
stdstr szDefault;
LoadDefault(Index,szDefault);
if (_stricmp(szDefault.c_str(),Value) == 0)
{
Delete(Index);
return;
}
}
if (m_RdbEditor && _Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (_Settings->IndexBasedSetting(m_DefaultSetting))

View File

@ -5,6 +5,7 @@ class CSettingTypeGame :
{
protected:
static bool m_RdbEditor;
static bool m_EraseDefaults;
static stdstr m_SectionIdent;
static void UpdateSettings ( void * /*Data */ );

View File

@ -34,9 +34,14 @@ bool CSettingTypeRDBCpuType::Load ( int Index, ULONG & Value ) const
}
LPCSTR String = strValue.c_str();
if (strcmp(String,"Interpreter") == 0) { Value = CPU_Interpreter; }
else if (strcmp(String,"Recompiler") == 0) { Value = CPU_Recompiler; }
else if (strcmp(String,"SyncCores") == 0) { Value = CPU_SyncCores; }
if (_stricmp(String,"Interpreter") == 0) { Value = CPU_Interpreter; }
else if (_stricmp(String,"Recompiler") == 0) { Value = CPU_Recompiler; }
else if (_stricmp(String,"SyncCores") == 0) { Value = CPU_SyncCores; }
else if (_stricmp(String,"default") == 0)
{
LoadDefault(Index,Value);
return false;
}
else { Notify().BreakPoint(__FILE__,__LINE__); }
return true;

View File

@ -28,9 +28,9 @@ bool CSettingTypeRDBOnOff::Load ( int Index, bool & Value ) const
}
LPCSTR String = strValue.c_str();
if (strcmp(String,"On") == 0) { Value = true; }
else if (strcmp(String,"Off") == 0) { Value = false; }
else if (strcmp(String,"Global") == 0)
if (_stricmp(String,"On") == 0) { Value = true; }
else if (_stricmp(String,"Off") == 0) { Value = false; }
else if (_stricmp(String,"Global") == 0 || _stricmp(String,"default"))
{
LoadDefault(Index,Value);
return false;
@ -97,3 +97,8 @@ void CSettingTypeRDBOnOff::Save ( int Index, const char * Value )
{
Notify().BreakPoint(__FILE__,__LINE__);
}
void CSettingTypeRDBOnOff::Delete( int Index )
{
m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),NULL);
}

View File

@ -24,5 +24,8 @@ public:
virtual void Save ( int Index, ULONG Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
};

View File

@ -86,5 +86,5 @@ void CSettingTypeRDBRDRamSize::Save ( int Index, const char * Value )
void CSettingTypeRDBRDRamSize::Delete( int Index )
{
Notify().BreakPoint(__FILE__,__LINE__);
m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),NULL);
}

View File

@ -34,12 +34,18 @@ bool CSettingTypeRDBSaveChip::Load ( int Index, ULONG & Value ) const
}
LPCSTR String = strValue.c_str();
if (strcmp(String,"First Save Type") == 0) { Value = SaveChip_Auto; }
else if (strcmp(String,"4kbit Eeprom") == 0) { Value = SaveChip_Eeprom_4K; }
else if (strcmp(String,"16kbit Eeprom") == 0) { Value = SaveChip_Eeprom_16K; }
else if (strcmp(String,"Sram") == 0) { Value = SaveChip_Sram; }
else if (strcmp(String,"FlashRam") == 0) { Value = SaveChip_FlashRam; }
else { Notify().BreakPoint(__FILE__,__LINE__); }
if (_stricmp(String,"First Save Type") == 0) { Value = SaveChip_Auto; }
else if (_stricmp(String,"4kbit Eeprom") == 0) { Value = SaveChip_Eeprom_4K; }
else if (_stricmp(String,"16kbit Eeprom") == 0) { Value = SaveChip_Eeprom_16K; }
else if (_stricmp(String,"Sram") == 0) { Value = SaveChip_Sram; }
else if (_stricmp(String,"FlashRam") == 0) { Value = SaveChip_FlashRam; }
else if (_stricmp(String,"default") == 0)
{
LoadDefault(Index,Value);
return false;
} else {
Notify().BreakPoint(__FILE__,__LINE__);
}
return true;
}

View File

@ -28,8 +28,13 @@ bool CSettingTypeRDBYesNo::Load ( int Index, bool & Value ) const
}
LPCSTR String = strValue.c_str();
if (strcmp(String,"Yes") == 0) { Value = true; }
else if (strcmp(String,"No") == 0) { Value = false; }
if (_stricmp(String,"Yes") == 0) { Value = true; }
else if (_stricmp(String,"No") == 0) { Value = false; }
else if (_stricmp(String,"default") == 0)
{
LoadDefault(Index,Value);
return false;
}
else { Notify().BreakPoint(__FILE__,__LINE__); }
return true;
@ -92,3 +97,8 @@ void CSettingTypeRDBYesNo::Save ( int Index, const char * Value )
{
Notify().BreakPoint(__FILE__,__LINE__);
}
void CSettingTypeRDBYesNo::Delete( int Index )
{
m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),NULL);
}

View File

@ -24,5 +24,8 @@ public:
virtual void Save ( int Index, ULONG Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
};

View File

@ -82,13 +82,14 @@ void CSettings::AddHowToHandleSetting ()
//Settings location
AddHandler(Setting_ApplicationName, new CSettingTypeTempString(""));
AddHandler(Setting_UseFromRegistry, new CSettingTypeApplication("Settings","Use Registry",(DWORD)false));
AddHandler(Setting_RdbEditor, new CSettingTypeApplication("","Rdb Editor", true));
AddHandler(Setting_RdbEditor, new CSettingTypeApplication("","Rdb Editor", false));
AddHandler(Setting_PluginPageFirst, new CSettingTypeApplication("","Plugin Page First", false));
AddHandler(Setting_DisableScrSaver, new CSettingTypeApplication("","Disable Screen Saver",(DWORD)true));
AddHandler(Setting_AutoSleep, new CSettingTypeApplication("","Auto Sleep", (DWORD)true));
AddHandler(Setting_AutoStart, new CSettingTypeApplication("","Auto Start", (DWORD)true));
AddHandler(Setting_AutoFullscreen, new CSettingTypeApplication("","Auto Full Screen", (DWORD)true));
AddHandler(Setting_AutoZipInstantSave,new CSettingTypeApplication("","Auto Zip Saves", (DWORD)true));
AddHandler(Setting_AutoZipInstantSave,new CSettingTypeApplication("","Auto Zip Saves", (DWORD)true));
AddHandler(Setting_EraseGameDefaults, new CSettingTypeApplication("","Erase on default", (DWORD)true));
AddHandler(Setting_RememberCheats, new CSettingTypeApplication("","Remember Cheats", (DWORD)false));
AddHandler(Setting_CurrentLanguage, new CSettingTypeApplication("","Current Language",""));
@ -96,7 +97,7 @@ void CSettings::AddHowToHandleSetting ()
AddHandler(Rdb_GoodName, new CSettingTypeRomDatabase("Good Name",Game_GameName));
AddHandler(Rdb_SaveChip, new CSettingTypeRDBSaveChip("Save Type",SaveChip_Auto));
AddHandler(Rdb_CpuType, new CSettingTypeRDBCpuType("CPU Type",CPU_Recompiler));
AddHandler(Rdb_RDRamSize, new CSettingTypeRDBRDRamSize("RDRAM Size",4));
AddHandler(Rdb_RDRamSize, new CSettingTypeRDBRDRamSize("RDRAM Size",0x400000));
AddHandler(Rdb_CounterFactor, new CSettingTypeRomDatabase("Counter Factor",2));
AddHandler(Rdb_UseTlb, new CSettingTypeRDBYesNo("Use TLB",true));
AddHandler(Rdb_DelaySi, new CSettingTypeRDBYesNo("Delay SI",false));

View File

@ -79,7 +79,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../../Bin/Debug/RSP 1.7.dll" /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../../Bin/Debug/Plugin/RSP/RSP 1.7.dll" /pdbtype:sept
!ENDIF
@ -155,10 +155,6 @@ SOURCE=".\RSP Register.c"
# End Source File
# Begin Source File
SOURCE=.\RSP.rc
# End Source File
# Begin Source File
SOURCE=.\Sse.c
# End Source File
# Begin Source File
@ -286,6 +282,10 @@ SOURCE=.\Support\XString.h
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\RSP.rc
# End Source File
# End Group
# End Target
# End Project

View File

@ -148,6 +148,11 @@ const char * GetSettingSz ( short SettingID, char * Buffer, int BufferLen )
return g_PluginSettings.GetSettingSz(g_PluginSettings.handle,SettingID + g_PluginSettings.SettingStartRange,Buffer,BufferLen);
}
const char * GetSystemSettingSz ( short SettingID, char * Buffer, int BufferLen )
{
return g_PluginSettings.GetSettingSz(g_PluginSettings.handle,SettingID,Buffer,BufferLen);
}
void SetSetting ( short SettingID, unsigned int Value )
{
g_PluginSettings.SetSetting(g_PluginSettings.handle,SettingID + g_PluginSettings.SettingStartRange, Value);

View File

@ -2,10 +2,13 @@
extern "C" {
#endif
// Get Settings, take a setting id
unsigned int GetSetting ( short SettingID );
unsigned int GetSystemSetting ( short SettingID );
const char * GetSettingSz ( short SettingID, char * Buffer, int BufferLen );
// Get Plugin Settings, take a setting id
unsigned int GetSetting ( short SettingID );
const char * GetSettingSz ( short SettingID, char * Buffer, int BufferLen );
// Get System Settings, take a setting returned by FindSystemSettingId
unsigned int GetSystemSetting ( short SettingID );
const char * GetSystemSettingSz( short SettingID, char * Buffer, int BufferLen );
// Set a settings value
void SetSetting ( short SettingID, unsigned int Value );