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

This commit is contained in:
zilmar 2008-12-04 10:41:51 +00:00
parent 361bdcaa84
commit 5ff8e00c28
40 changed files with 646 additions and 232 deletions

View File

@ -45,7 +45,7 @@ BOOL g_ShowUnhandledMemory = false, g_ShowCPUPer = false, g_ShowTLBMisses = fals
g_ShowPifRamErrors = false, g_GenerateLog = false, g_DelaySI = false, g_SPHack = false,
g_DisableRegCaching = false, g_ShowCompMem = false, g_UseLinking = false,
g_FixedAudio = false, g_LogX86Code = false;
DWORD g_RomFileSize = 0, g_CountPerOp = 2;
DWORD g_RomFileSize = 0, g_CountPerOp = 2, g_ViRefreshRate = 1500;
enum CPU_TYPE g_CPU_Type;
enum SAVE_CHIP_TYPE g_SaveUsing;
enum CICChip g_CicChip;
@ -204,6 +204,7 @@ void CC_Core::SetSettings ( )
g_DisableRegCaching = !g_Settings->LoadBool(Game_RegCache);
g_UseLinking = g_Settings->LoadBool(Game_BlockLinking);
g_ShowCompMem = false;
g_ViRefreshRate = g_Settings->LoadDword(Game_ViRefreshRate);
strcpy(g_RomName, g_Settings->LoadString(Game_GameName).c_str());
}
}
@ -616,10 +617,10 @@ void UpdateCurrentHalfLine (void)
}
//DisplayError("Timer: %X",Timers.Timer);
//HalfLine = (Timer / 1500) + VI_INTR_REG;
*g_HalfLine = (DWORD)(*g_Timer / 1500);
*g_HalfLine = (DWORD)(*g_Timer / g_ViRefreshRate);
*g_HalfLine &= ~1;
// *g_HalfLine += ViFieldNumber;
//Timers.Timer -= 1500;
//Timers.Timer -= g_ViRefreshRate;
}
void CC_Core::ApplyGSButtonCheats (CN64System * System)

View File

@ -1461,7 +1461,7 @@ void CN64System::RefreshScreen ( void ) {
if (_Reg->VI_V_SYNC_REG == 0) {
VI_INTR_TIME = 500000;
} else {
VI_INTR_TIME = (_Reg->VI_V_SYNC_REG + 1) * 1500;
VI_INTR_TIME = (_Reg->VI_V_SYNC_REG + 1) * ViRefreshRate();
if ((_Reg->VI_V_SYNC_REG % 1) != 0) {
VI_INTR_TIME -= 38;
}

View File

@ -55,6 +55,14 @@ CAudioPlugin::CAudioPlugin ( const char * FileName) {
if (RomClosed == NULL) { UnloadPlugin(); return; }
if (ProcessAList == NULL) { UnloadPlugin(); return; }
SetSettingInfo2 = (void (__cdecl *)(PLUGIN_SETTINGS2 *))GetProcAddress( (HMODULE)hDll, "SetSettingInfo2" );
if (SetSettingInfo2)
{
PLUGIN_SETTINGS2 info;
info.FindSystemSettingId = (unsigned int (*)( void * handle, const char * ))CSettings::FindGameSetting;
SetSettingInfo2(&info);
}
SetSettingInfo = (void (__cdecl *)(PLUGIN_SETTINGS *))GetProcAddress( (HMODULE)hDll, "SetSettingInfo" );
if (SetSettingInfo)
{
@ -263,7 +271,7 @@ void CAudioPlugin::UnloadPlugin(void) {
void CAudioPlugin::DacrateChanged (SystemType Type) {
if (!Initilized()) { return; }
DWORD Frequency = _Reg->AI_DACRATE_REG * 66;
DWORD CountsPerSecond = (_Reg->VI_V_SYNC_REG != 0 ? (_Reg->VI_V_SYNC_REG + 1) * 1500 : 500000) * 60;
DWORD CountsPerSecond = (_Reg->VI_V_SYNC_REG != 0 ? (_Reg->VI_V_SYNC_REG + 1) * _Settings->LoadDword(Game_ViRefreshRate) : 500000) * 60;
m_CountsPerByte = (double)CountsPerSecond / (double)Frequency;
m_DacrateChanged(Type);
}

View File

@ -56,6 +56,14 @@ CControl_Plugin::CControl_Plugin ( const char * FileName) {
if (InitFunc == NULL) { UnloadPlugin(); return; }
if (CloseDLL == NULL) { UnloadPlugin(); return; }
SetSettingInfo2 = (void (__cdecl *)(PLUGIN_SETTINGS2 *))GetProcAddress( (HMODULE)hDll, "SetSettingInfo2" );
if (SetSettingInfo2)
{
PLUGIN_SETTINGS2 info;
info.FindSystemSettingId = (unsigned int (*)( void * handle, const char * ))CSettings::FindGameSetting;
SetSettingInfo2(&info);
}
SetSettingInfo = (void (__cdecl *)(PLUGIN_SETTINGS *))GetProcAddress( (HMODULE)hDll, "SetSettingInfo" );
if (SetSettingInfo)
{

View File

@ -82,6 +82,14 @@ CGfxPlugin::CGfxPlugin ( const char * FileName) {
}
SetSettingInfo2 = (void (__cdecl *)(PLUGIN_SETTINGS2 *))GetProcAddress( (HMODULE)hDll, "SetSettingInfo2" );
if (SetSettingInfo2)
{
PLUGIN_SETTINGS2 info;
info.FindSystemSettingId = (unsigned int (*)( void * handle, const char * ))CSettings::FindGameSetting;
SetSettingInfo2(&info);
}
SetSettingInfo = (void (__cdecl *)(PLUGIN_SETTINGS *))GetProcAddress( (HMODULE)hDll, "SetSettingInfo" );
if (SetSettingInfo)
{

View File

@ -54,6 +54,10 @@ typedef struct {
void (*UseUnregisteredSetting) (int ID);
} PLUGIN_SETTINGS;
typedef struct {
unsigned int (*FindSystemSettingId) ( void * handle, const char * Name );
} PLUGIN_SETTINGS2;
enum PLUGIN_TYPE {
PLUGIN_TYPE_NONE = 0,
PLUGIN_TYPE_RSP = 1,

View File

@ -52,6 +52,14 @@ CRSP_Plugin::CRSP_Plugin ( const char * FileName) {
if (RomClosed == NULL) { UnloadPlugin(); return; }
if (CloseDLL == NULL) { UnloadPlugin(); return; }
SetSettingInfo2 = (void (__cdecl *)(PLUGIN_SETTINGS2 *))GetProcAddress( (HMODULE)hDll, "SetSettingInfo2" );
if (SetSettingInfo2)
{
PLUGIN_SETTINGS2 info;
info.FindSystemSettingId = (unsigned int (*)( void * handle, const char * ))CSettings::FindGameSetting;
SetSettingInfo2(&info);
}
SetSettingInfo = (void (__cdecl *)(PLUGIN_SETTINGS *))GetProcAddress( (HMODULE)hDll, "SetSettingInfo" );
if (SetSettingInfo)
{

View File

@ -48,6 +48,7 @@ typedef struct {
void (__cdecl *InitiateDebugger) ( DEBUG_INFO DebugInfo);
void (__cdecl *PluginOpened) ( void );
void (__cdecl *SetSettingInfo) ( PLUGIN_SETTINGS * info );
void (__cdecl *SetSettingInfo2) ( PLUGIN_SETTINGS2 * info );
public:
CRSP_Plugin ( const char * FileName);

View File

@ -36,6 +36,7 @@ enum SettingID {
Setting_CurrentLanguage,
//RDB TLB Settings
Rdb_GoodName,
Rdb_SaveChip,
Rdb_CpuType,
Rdb_RDRamSize,
@ -44,6 +45,8 @@ enum SettingID {
Rdb_DelaySi,
Rdb_SPHack,
Rdb_Status,
Rdb_NotesCore,
Rdb_NotesPlugin,
Rdb_FixedAudio,
Rdb_SyncViaAudio,
Rdb_RspAudioSignal,
@ -63,6 +66,7 @@ enum SettingID {
Rdb_SMM_Protect,
Rdb_SMM_ValidFunc,
Rdb_GameCheatFix,
Rdb_ViRefreshRate,
//Individual Game Settings
Game_IniKey,
@ -96,6 +100,7 @@ enum SettingID {
Game_UseHleGfx,
Game_UseHleAudio,
Game_LoadRomToMemory,
Game_ViRefreshRate,
// General Game running info
GameRunning_LoadingInProgress,

View File

@ -10,6 +10,7 @@ bool CN64SystemSettings::m_bFixedAudio;
bool CN64SystemSettings::m_bSyncToAudio;
bool CN64SystemSettings::m_bDisplayFrameRate;
bool CN64SystemSettings::m_SPHack;
DWORD CN64SystemSettings::m_ViRefreshRate;
CN64SystemSettings::CN64SystemSettings()
@ -26,6 +27,7 @@ CN64SystemSettings::CN64SystemSettings()
_Settings->RegisterChangeCB(Game_FixedAudio,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Game_SyncViaAudio,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Game_SPHack,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Game_ViRefreshRate,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
RefreshSettings();
}
@ -43,6 +45,7 @@ CN64SystemSettings::~CN64SystemSettings()
_Settings->UnregisterChangeCB(Game_FixedAudio,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Game_SyncViaAudio,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Game_SPHack,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Game_ViRefreshRate,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
}
void CN64SystemSettings::RefreshSettings()
@ -58,4 +61,5 @@ void CN64SystemSettings::RefreshSettings()
m_bFixedAudio = _Settings->LoadBool(Game_FixedAudio);
m_bSyncToAudio = m_bFixedAudio ? _Settings->LoadBool(Game_SyncViaAudio) : false;
m_SPHack = _Settings->LoadBool(Game_SPHack);
m_ViRefreshRate = _Settings->LoadDword(Game_ViRefreshRate);
}

View File

@ -9,27 +9,29 @@ class CN64SystemSettings
void RefreshSettings ( void );
static bool m_bShowCPUPer;
static bool m_bProfiling;
static bool m_bBasicMode;
static bool m_bLimitFPS;
static bool m_bShowDListAListCount;
static bool m_bFixedAudio;
static bool m_bSyncToAudio;
static bool m_bDisplayFrameRate;
static bool m_SPHack;
static bool m_bShowCPUPer;
static bool m_bProfiling;
static bool m_bBasicMode;
static bool m_bLimitFPS;
static bool m_bShowDListAListCount;
static bool m_bFixedAudio;
static bool m_bSyncToAudio;
static bool m_bDisplayFrameRate;
static bool m_SPHack;
static DWORD m_ViRefreshRate;
protected:
CN64SystemSettings();
virtual ~CN64SystemSettings();
inline bool bBasicMode ( void ) const { return m_bBasicMode; }
inline bool bDisplayFrameRate ( void ) const { return m_bDisplayFrameRate; }
inline bool bShowCPUPer ( void ) const { return m_bShowCPUPer; }
inline bool bProfiling ( void ) const { return m_bProfiling; }
inline bool bShowDListAListCount ( void ) const { return m_bShowDListAListCount; }
inline bool bLimitFPS ( void ) const { return m_bLimitFPS; }
inline bool bFixedAudio ( void ) const { return m_bFixedAudio; }
inline bool bSyncToAudio ( void ) const { return m_bSyncToAudio; }
inline bool bSPHack ( void ) const { return m_SPHack; }
inline bool bBasicMode ( void ) const { return m_bBasicMode; }
inline bool bDisplayFrameRate ( void ) const { return m_bDisplayFrameRate; }
inline bool bShowCPUPer ( void ) const { return m_bShowCPUPer; }
inline bool bProfiling ( void ) const { return m_bProfiling; }
inline bool bShowDListAListCount ( void ) const { return m_bShowDListAListCount; }
inline bool bLimitFPS ( void ) const { return m_bLimitFPS; }
inline bool bFixedAudio ( void ) const { return m_bFixedAudio; }
inline bool bSyncToAudio ( void ) const { return m_bSyncToAudio; }
inline bool bSPHack ( void ) const { return m_SPHack; }
inline DWORD ViRefreshRate ( void ) const { return m_ViRefreshRate; }
};

View File

@ -51,5 +51,7 @@ public:
// Initilize this class to use ini or registry
static void Initilize ( const char * AppName );
static void CleanUp ( void );
LPCSTR GetKeyName ( void) const { return m_KeyName.c_str(); }
};

View File

@ -6,18 +6,18 @@
bool CSettingTypeGame::m_RdbEditor = false;
stdstr CSettingTypeGame::m_SectionIdent;
CSettingTypeGame::CSettingTypeGame(LPCSTR Section, LPCSTR Name, LPCSTR DefaultValue ) :
CSettingTypeApplication("",FixName(Section,Name).c_str(),DefaultValue)
CSettingTypeGame::CSettingTypeGame(LPCSTR Name, LPCSTR DefaultValue ) :
CSettingTypeApplication("",Name,DefaultValue)
{
}
CSettingTypeGame::CSettingTypeGame(LPCSTR Section, LPCSTR Name, DWORD DefaultValue ) :
CSettingTypeApplication("",FixName(Section,Name).c_str(),DefaultValue)
CSettingTypeGame::CSettingTypeGame(LPCSTR Name, DWORD DefaultValue ) :
CSettingTypeApplication("",Name,DefaultValue)
{
}
CSettingTypeGame::CSettingTypeGame(LPCSTR Section, LPCSTR Name, SettingID DefaultSetting ) :
CSettingTypeApplication("",FixName(Section,Name).c_str(),DefaultSetting)
CSettingTypeGame::CSettingTypeGame(LPCSTR Name, SettingID DefaultSetting ) :
CSettingTypeApplication("",Name,DefaultSetting)
{
}
@ -36,18 +36,6 @@ void CSettingTypeGame::CleanUp ( void )
_Settings->UnregisterChangeCB(Game_IniKey,NULL,UpdateSettings);
}
stdstr CSettingTypeGame::FixName ( LPCSTR Section, LPCSTR Name )
{
stdstr FixedName;
if (Section !=- NULL && strlen(Section) > 0)
{
FixedName.Format("%s-%s",Section,Name);
} else {
FixedName.Format("%s",Name);
}
return FixedName;
}
LPCSTR CSettingTypeGame::SectionName ( void ) const
{
return m_SectionIdent.c_str();

View File

@ -8,14 +8,13 @@ protected:
static stdstr m_SectionIdent;
static void UpdateSettings ( void * /*Data */ );
static stdstr FixName ( LPCSTR Section, LPCSTR Name );
virtual LPCSTR SectionName ( void ) const;
public:
CSettingTypeGame(LPCSTR Section, LPCSTR Name, LPCSTR DefaultValue );
CSettingTypeGame(LPCSTR Section, LPCSTR Name, DWORD DefaultValue );
CSettingTypeGame(LPCSTR Section, LPCSTR Name, SettingID DefaultSetting );
CSettingTypeGame(LPCSTR Name, LPCSTR DefaultValue );
CSettingTypeGame(LPCSTR Name, DWORD DefaultValue );
CSettingTypeGame(LPCSTR Name, SettingID DefaultSetting );
virtual ~CSettingTypeGame();
virtual bool IndexBasedSetting ( void ) const { return false; }

View File

@ -6,21 +6,21 @@
CSettingTypeGameIndex::CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, SettingID DefaultSetting ) :
CSettingTypeGame("","", DefaultSetting),
CSettingTypeGame("", DefaultSetting),
m_PreIndex(PreIndex),
m_PostIndex(PostIndex)
{
}
CSettingTypeGameIndex::CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, DWORD DefaultValue ) :
CSettingTypeGame("","", DefaultValue),
CSettingTypeGame("", DefaultValue),
m_PreIndex(PreIndex),
m_PostIndex(PostIndex)
{
}
CSettingTypeGameIndex::CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, LPCSTR DefaultValue ) :
CSettingTypeGame("","", DefaultValue),
CSettingTypeGame("", DefaultValue),
m_PreIndex(PreIndex),
m_PostIndex(PostIndex)
{

View File

@ -75,7 +75,7 @@ void CSettingTypeRDBYesNo::LoadDefault ( int Index, stdstr & Value ) const
//Update the settings
void CSettingTypeRDBYesNo::Save ( int Index, bool Value )
{
Notify().BreakPoint(__FILE__,__LINE__);
m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),Value? "Yes" : "No");
}
void CSettingTypeRDBYesNo::Save ( int Index, ULONG Value )

View File

@ -171,12 +171,12 @@ void CSettingTypeRomDatabase::Save ( int Index, ULONG Value )
void CSettingTypeRomDatabase::Save ( int Index, const stdstr & Value )
{
Notify().BreakPoint(__FILE__,__LINE__);
m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),Value.c_str());
}
void CSettingTypeRomDatabase::Save ( int Index, const char * Value )
{
Notify().BreakPoint(__FILE__,__LINE__);
m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),Value);
}
void CSettingTypeRomDatabase::Delete ( int Index )

View File

@ -93,6 +93,7 @@ void CSettings::AddHowToHandleSetting ()
AddHandler(Setting_RememberCheats, new CSettingTypeApplication("","Remember Cheats", (DWORD)false));
AddHandler(Setting_CurrentLanguage, new CSettingTypeApplication("","Current Language",""));
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));
@ -101,6 +102,8 @@ void CSettings::AddHowToHandleSetting ()
AddHandler(Rdb_DelaySi, new CSettingTypeRDBYesNo("Delay SI",false));
AddHandler(Rdb_SPHack, new CSettingTypeRDBYesNo("SP Hack",false));
AddHandler(Rdb_Status, new CSettingTypeRomDatabase("Status","Unknown"));
AddHandler(Rdb_NotesCore, new CSettingTypeRomDatabase("Core Note",""));
AddHandler(Rdb_NotesPlugin, new CSettingTypeRomDatabase("Plugin Note",""));
AddHandler(Rdb_FixedAudio, new CSettingTypeRomDatabase("Fixed Audio",true));
AddHandler(Rdb_SyncViaAudio, new CSettingTypeRomDatabase("Sync Audio",false));
AddHandler(Rdb_RspAudioSignal, new CSettingTypeRDBYesNo("Audio Signal",false));
@ -120,39 +123,40 @@ void CSettings::AddHowToHandleSetting ()
AddHandler(Rdb_SMM_Protect, new CSettingTypeRomDatabase("SMM-Protect",false));
AddHandler(Rdb_SMM_ValidFunc, new CSettingTypeRomDatabase("SMM-FUNC",true));
AddHandler(Rdb_GameCheatFix, new CSettingTypeRomDatabaseIndex("Cheat","",""));
AddHandler(Rdb_ViRefreshRate, new CSettingTypeRomDatabase("ViRefresh",1500));
AddHandler(Game_IniKey, new CSettingTypeTempString(""));
AddHandler(Game_GameName, new CSettingTypeTempString(""));
AddHandler(Game_GoodName, new CSettingTypeRomDatabase("Good Name",Game_GameName));
AddHandler(Game_Plugin_Gfx, new CSettingTypeGame("Plugin","Gfx",Plugin_GFX_Current));
AddHandler(Game_Plugin_Audio, new CSettingTypeGame("Plugin","Audio",Plugin_AUDIO_Current));
AddHandler(Game_Plugin_Controller, new CSettingTypeGame("Plugin","Controller",Plugin_CONT_Current));
AddHandler(Game_Plugin_RSP, new CSettingTypeGame("Plugin","RSP",Plugin_RSP_Current));
AddHandler(Game_SaveChip, new CSettingTypeGame("","SaveChip",Rdb_SaveChip));
AddHandler(Game_CpuType, new CSettingTypeGame("","CpuType",Rdb_CpuType));
AddHandler(Game_LastSaveSlot, new CSettingTypeGame("","Last Used Save Slot",(DWORD)0));
AddHandler(Game_FixedAudio, new CSettingTypeGame("","Fixed Audio",Rdb_FixedAudio));
AddHandler(Game_RDRamSize, new CSettingTypeGame("","RDRamSize",Rdb_RDRamSize));
AddHandler(Game_CounterFactor, new CSettingTypeGame("","Counter Factor",Rdb_CounterFactor));
AddHandler(Game_UseTlb, new CSettingTypeGame("","Use TLB",Rdb_UseTlb));
AddHandler(Game_DelaySI, new CSettingTypeGame("","Delay SI",Rdb_DelaySi));
AddHandler(Game_RspAudioSignal, new CSettingTypeGame("","Audio Signal",Rdb_RspAudioSignal));
AddHandler(Game_SPHack, new CSettingTypeGame("","SP Hack",Rdb_SPHack));
AddHandler(Game_GoodName, new CSettingTypeGame("Good Name",Rdb_GoodName));
AddHandler(Game_Plugin_Gfx, new CSettingTypeGame("Plugin-Gfx",Plugin_GFX_Current));
AddHandler(Game_Plugin_Audio, new CSettingTypeGame("Plugin-Audio",Plugin_AUDIO_Current));
AddHandler(Game_Plugin_Controller, new CSettingTypeGame("Plugin-Controller",Plugin_CONT_Current));
AddHandler(Game_Plugin_RSP, new CSettingTypeGame("Plugin-RSP",Plugin_RSP_Current));
AddHandler(Game_SaveChip, new CSettingTypeGame("SaveChip",Rdb_SaveChip));
AddHandler(Game_CpuType, new CSettingTypeGame("CpuType",Rdb_CpuType));
AddHandler(Game_LastSaveSlot, new CSettingTypeGame("Last Used Save Slot",(DWORD)0));
AddHandler(Game_FixedAudio, new CSettingTypeGame("Fixed Audio",Rdb_FixedAudio));
AddHandler(Game_RDRamSize, new CSettingTypeGame("RDRamSize",Rdb_RDRamSize));
AddHandler(Game_CounterFactor, new CSettingTypeGame("Counter Factor",Rdb_CounterFactor));
AddHandler(Game_UseTlb, new CSettingTypeGame("Use TLB",Rdb_UseTlb));
AddHandler(Game_DelaySI, new CSettingTypeGame("Delay SI",Rdb_DelaySi));
AddHandler(Game_RspAudioSignal, new CSettingTypeGame("Audio Signal",Rdb_RspAudioSignal));
AddHandler(Game_SPHack, new CSettingTypeGame("SP Hack",Rdb_SPHack));
AddHandler(Game_CurrentSaveState, new CSettingTypeTempNumber(0));
AddHandler(Game_SyncViaAudio, new CSettingTypeGame("","Sync Audio",Rdb_SyncViaAudio));
AddHandler(Game_UseHleGfx, new CSettingTypeGame("RSP","HLE GFX",Rdb_UseHleGfx));
AddHandler(Game_UseHleAudio, new CSettingTypeGame("RSP","HLE Audio",Rdb_UseHleAudio));
AddHandler(Game_LoadRomToMemory, new CSettingTypeGame("","Rom In Memory",Rdb_LoadRomToMemory));
AddHandler(Game_ScreenHertz, new CSettingTypeGame("","ScreenHertz",Rdb_ScreenHertz));
AddHandler(Game_FuncLookupMode, new CSettingTypeGame("","FuncFind",Rdb_FuncLookupMode));
AddHandler(Game_RegCache, new CSettingTypeGame("","Reg Cache",Rdb_RegCache));
AddHandler(Game_BlockLinking, new CSettingTypeGame("","Linking",Rdb_BlockLinking));
AddHandler(Game_SMM_Cache, new CSettingTypeGame("SMM","Cache",Rdb_SMM_Cache));
AddHandler(Game_SMM_PIDMA, new CSettingTypeGame("SMM","PI DMA",Rdb_SMM_PIDMA));
AddHandler(Game_SMM_TLB, new CSettingTypeGame("SMM","TLB",Rdb_SMM_TLB));
AddHandler(Game_SMM_Protect, new CSettingTypeGame("SMM","Protect",Rdb_SMM_Protect));
AddHandler(Game_SMM_ValidFunc, new CSettingTypeGame("SMM","FUNC",Rdb_SMM_ValidFunc));
AddHandler(Game_SyncViaAudio, new CSettingTypeGame("Sync Audio",Rdb_SyncViaAudio));
AddHandler(Game_UseHleGfx, new CSettingTypeGame("HLE GFX",Rdb_UseHleGfx));
AddHandler(Game_UseHleAudio, new CSettingTypeGame("HLE Audio",Rdb_UseHleAudio));
AddHandler(Game_LoadRomToMemory, new CSettingTypeGame("Rom In Memory",Rdb_LoadRomToMemory));
AddHandler(Game_ScreenHertz, new CSettingTypeGame("ScreenHertz",Rdb_ScreenHertz));
AddHandler(Game_FuncLookupMode, new CSettingTypeGame("FuncFind",Rdb_FuncLookupMode));
AddHandler(Game_RegCache, new CSettingTypeGame("Reg Cache",Rdb_RegCache));
AddHandler(Game_BlockLinking, new CSettingTypeGame("Linking",Rdb_BlockLinking));
AddHandler(Game_SMM_Cache, new CSettingTypeGame("SMM-Cache",Rdb_SMM_Cache));
AddHandler(Game_SMM_PIDMA, new CSettingTypeGame("SMM-PI DMA",Rdb_SMM_PIDMA));
AddHandler(Game_SMM_TLB, new CSettingTypeGame("SMM-TLB",Rdb_SMM_TLB));
AddHandler(Game_SMM_Protect, new CSettingTypeGame("SMM-Protect",Rdb_SMM_Protect));
AddHandler(Game_SMM_ValidFunc, new CSettingTypeGame("SMM-FUNC",Rdb_SMM_ValidFunc));
AddHandler(Game_ViRefreshRate, new CSettingTypeGame("ViRefresh",Rdb_ViRefreshRate));
//User Interface
AddHandler(UserInterface_BasicMode, new CSettingTypeApplication("","Basic Mode", (DWORD)true));
@ -592,6 +596,25 @@ void CSettings::AddHowToHandleSetting ()
*/
}
DWORD CSettings::FindGameSetting ( CSettings * _this, char * Name )
{
for (SETTING_MAP::iterator iter = _this->m_SettingInfo.begin(); iter != _this->m_SettingInfo.end(); iter++)
{
CSettingType * Setting = iter->second;
if (Setting->GetSettingType() != SettingType_GameSetting)
{
continue;
}
CSettingTypeGame * GameSetting = (CSettingTypeGame *)Setting;
if (stricmp(GameSetting->GetKeyName(),Name) != 0)
{
continue;
}
return iter->first;
}
return 0;
}
DWORD CSettings::GetSetting ( CSettings * _this, SettingID Type )
{
@ -665,26 +688,29 @@ void CSettings::RegisterSetting ( CSettings * _this, SettingID ID, SettingID Def
}
break;
case SettingType_GameSetting:
switch (DataType)
{
case Data_DWORD:
if (DefaultID == Default_None)
stdstr_f Name("%s-%s",Category,DefaultStr);
switch (DataType)
{
_this->AddHandler(ID,new CSettingTypeGame(Category,DefaultStr,Value));
} else {
_this->AddHandler(ID,new CSettingTypeGame(Category,DefaultStr,DefaultID));
case Data_DWORD:
if (DefaultID == Default_None)
{
_this->AddHandler(ID,new CSettingTypeGame(Name.c_str(),Value));
} else {
_this->AddHandler(ID,new CSettingTypeGame(Name.c_str(),DefaultID));
}
break;
case Data_String:
if (DefaultID == Default_None)
{
_this->AddHandler(ID,new CSettingTypeGame(Name.c_str(),""));
} else {
_this->AddHandler(ID,new CSettingTypeGame(Name.c_str(),DefaultID));
}
break;
default:
Notify().BreakPoint(__FILE__,__LINE__);
}
break;
case Data_String:
if (DefaultID == Default_None)
{
_this->AddHandler(ID,new CSettingTypeGame(Category,DefaultStr,""));
} else {
_this->AddHandler(ID,new CSettingTypeGame(Category,DefaultStr,DefaultID));
}
break;
default:
Notify().BreakPoint(__FILE__,__LINE__);
}
break;
case SettingType_RomDatabase:

View File

@ -280,6 +280,8 @@ public:
static void RegisterSetting ( CSettings * _this, SettingID ID, SettingID DefaultID, SettingDataType DataType,
SettingType Type, const char * Category, const char * DefaultStr,
DWORD Value );
static DWORD FindGameSetting ( CSettings * _this, char * Name );
private:
void NotifyCallBacks ( SettingID Type );

View File

@ -40,9 +40,19 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*
if (m_GameConfig)
{
SetWindowText(ConfigRomTitle.c_str());
if (_Settings->LoadBool(Setting_RdbEditor))
{
SetWindowText(stdstr_f("%s ** RDB Edit Mode **",ConfigRomTitle.c_str()).c_str());
} else {
SetWindowText(ConfigRomTitle.c_str());
}
} else {
SetWindowText(GS(OPTIONS_TITLE));
if (_Settings->LoadBool(Setting_RdbEditor))
{
SetWindowText(stdstr_f("%s ** RDB Edit Mode **",GS(OPTIONS_TITLE)).c_str());
} else {
SetWindowText(GS(OPTIONS_TITLE));
}
if (_Settings->LoadBool(Setting_PluginPageFirst))
{
@ -136,7 +146,7 @@ LRESULT CSettingConfig::OnClicked (WORD wNotifyCode, WORD wID, HWND , BOOL& bHan
case IDCANCEL:
EndDialog(0);
break;
case IDC_RESET:
case IDC_RESET_PAGE:
if (m_CurrentPage)
{
m_CurrentPage->ResetPage();
@ -164,6 +174,17 @@ LRESULT CSettingConfig::OnClicked (WORD wNotifyCode, WORD wID, HWND , BOOL& bHan
void CSettingConfig::ApplySettings( bool UpdateScreen )
{
stdstr GameIni(_Settings->LoadString(Game_IniKey));
if (!GameIni.empty())
{
stdstr GoodName;
if (!_Settings->LoadString(Game_GoodName,GoodName))
{
_Settings->SaveString(Game_GoodName,GoodName);
}
}
for (SETTING_SECTIONS::const_iterator iter = m_Sections.begin(); iter != m_Sections.end(); iter++)
{
CConfigSettingSection * Section = *iter;
@ -178,7 +199,7 @@ void CSettingConfig::ApplySettings( bool UpdateScreen )
if (UpdateScreen)
{
::EnableWindow(GetDlgItem(IDAPPLY),false);
::EnableWindow(GetDlgItem(IDC_RESET), m_CurrentPage->EnableReset());
::EnableWindow(GetDlgItem(IDC_RESET_PAGE), m_CurrentPage->EnableReset());
}
}
@ -196,7 +217,7 @@ LRESULT CSettingConfig::OnPageListItemChanged(NMHDR* phdr)
}
m_CurrentPage = Page;
m_CurrentPage->ShowPage();
::EnableWindow(GetDlgItem(IDC_RESET), m_CurrentPage->EnableReset());
::EnableWindow(GetDlgItem(IDC_RESET_PAGE), m_CurrentPage->EnableReset());
}
return 0; // retval ignored
}
@ -204,7 +225,7 @@ LRESULT CSettingConfig::OnPageListItemChanged(NMHDR* phdr)
LRESULT CSettingConfig::OnSettingPageChanged ( UINT /*uMsg*/, WPARAM wPage, LPARAM /*lParam*/)
{
::EnableWindow(GetDlgItem(IDAPPLY),true);
::EnableWindow(GetDlgItem(IDC_RESET), m_CurrentPage->EnableReset());
::EnableWindow(GetDlgItem(IDC_RESET_PAGE), m_CurrentPage->EnableReset());
BoldChangedPages(m_PagesTreeList.GetRootItem());
return 0;
}

View File

@ -21,14 +21,8 @@ CGameGeneralPage::CGameGeneralPage (HWND hParent, const RECT & rcDispay )
if (ComboBox)
{
ComboBox->SetTextField(GetDlgItem(IDC_MEMORY_SIZE_TEXT));
/*if (_Settings->LoadBool(Setting_RdbEditor))
{
ComboBox->AddItem(GS(RDRAM_4MB), 4 );
ComboBox->AddItem(GS(RDRAM_8MB), 8 );
} else {*/
ComboBox->AddItem(GS(RDRAM_4MB), 0x400000 );
ComboBox->AddItem(GS(RDRAM_8MB), 0x800000 );
//}
ComboBox->AddItem(GS(RDRAM_4MB), 0x400000 );
ComboBox->AddItem(GS(RDRAM_8MB), 0x800000 );
}
ComboBox = AddModComboBox(GetDlgItem(IDC_SAVE_TYPE),Game_SaveChip);
@ -56,6 +50,9 @@ CGameGeneralPage::CGameGeneralPage (HWND hParent, const RECT & rcDispay )
SetDlgItemText(IDC_GOOD_NAME,_Settings->LoadString(Game_GoodName).c_str());
CModifiedEditBox * TxtBox = AddModTextBox(GetDlgItem(IDC_VIREFRESH),Game_ViRefreshRate, false);
TxtBox->SetTextField(GetDlgItem(IDC_VIREFESH_TEXT));
UpdatePageSettings();
}

View File

@ -18,6 +18,7 @@ class CGameGeneralPage :
COMMAND_ID_HANDLER_EX(IDC_USE_TLB,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_DELAY_SI,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_AUDIO_SIGNAL,CheckBoxChanged)
COMMAND_HANDLER_EX(IDC_VIREFRESH,EN_UPDATE,EditBoxChanged)
END_MSG_MAP()
enum { IDD = IDD_Settings_GameGeneral };

View File

@ -23,7 +23,7 @@ CGamePluginPage::CGamePluginPage (HWND hParent, const RECT & rcDispay )
SetDlgItemText(IDC_HLE_GFX,GS(PLUG_HLE_GFX));
SetDlgItemText(IDC_HLE_AUDIO,GS(PLUG_HLE_AUDIO));
m_GfxGroup.Attach(GetDlgItem(IDC_GRAPHICS_NAME));
m_GfxGroup.Attach(GetDlgItem(IDC_GFX_NAME));
m_AudioGroup.Attach(GetDlgItem(IDC_AUDIO_NAME));
m_ControlGroup.Attach(GetDlgItem(IDC_CONT_NAME));
m_RspGroup.Attach(GetDlgItem(IDC_RSP_NAME));

View File

@ -4,12 +4,35 @@
CGameStatusPage::CGameStatusPage (HWND hParent, const RECT & rcDispay )
{
Create(hParent);
if (m_hWnd == NULL)
if (!Create(hParent,rcDispay))
{
return;
}
SetWindowPos(HWND_TOP,&rcDispay,SWP_HIDEWINDOW);
CIniFile RomIniFile (_Settings->LoadString(SupportFile_RomDatabase).c_str());
strlist Keys;
RomIniFile.GetKeyList("Rom Status",Keys);
stdstr Status = _Settings->LoadString(Rdb_Status);
CModifiedComboBoxTxt * ComboBox;
ComboBox = AddModComboBoxTxt(GetDlgItem(IDC_STATUS_TYPE),Rdb_Status);
if (ComboBox)
{
for (strlist::iterator item = Keys.begin(); item != Keys.end(); item++ )
{
if (strstr(item->c_str(),".Sel") != NULL) { continue; }
if (strstr(item->c_str(),".Auto") != NULL) { continue; }
ComboBox->AddItem(item->c_str(), item->c_str());
}
ComboBox->SetTextField(GetDlgItem(IDC_STATUS_TEXT));
}
CModifiedEditBox * TxtBox;
TxtBox = AddModTextBox(GetDlgItem(IDC_NOTES_CORE),Rdb_NotesCore,true);
TxtBox->SetTextField(GetDlgItem(IDC_NOTES_CORE_TEXT));
TxtBox = AddModTextBox(GetDlgItem(IDC_NOTES_PLUGIN),Rdb_NotesPlugin,true);
TxtBox->SetTextField(GetDlgItem(IDC_NOTES_PLUGIN_TEXT));
UpdatePageSettings();
}
void CGameStatusPage::ShowPage()
@ -24,14 +47,16 @@ void CGameStatusPage::HidePage()
void CGameStatusPage::ApplySettings( bool UpdateScreen )
{
CSettingsPageImpl<CGameStatusPage>::ApplySettings(UpdateScreen);
}
bool CGameStatusPage::EnableReset ( void )
{
if (CSettingsPageImpl<CGameStatusPage>::EnableReset()) { return true; }
return false;
}
void CGameStatusPage::ResetPage()
{
Notify().BreakPoint(__FILE__,__LINE__);
}
CSettingsPageImpl<CGameStatusPage>::ResetPage();
}

View File

@ -1,11 +1,14 @@
#pragma once
class CGameStatusPage :
private CDialogImpl<CGameStatusPage>,
public CSettingsPageImpl<CGameStatusPage>,
public CSettingsPage
{
BEGIN_MSG_MAP_EX(CGameStatusPage)
COMMAND_HANDLER_EX(IDC_STATUS_TYPE,LBN_SELCHANGE,ComboBoxChanged)
COMMAND_HANDLER_EX(IDC_NOTES_CORE,EN_UPDATE,EditBoxChanged)
COMMAND_HANDLER_EX(IDC_NOTES_PLUGIN,EN_UPDATE,EditBoxChanged)
END_MSG_MAP()
enum { IDD = IDD_Settings_GameStatus };

View File

@ -13,6 +13,12 @@ CGeneralOptionsPage::CGeneralOptionsPage (HWND hParent, const RECT & rcDispay )
AddModCheckBox(GetDlgItem(IDC_SCREEN_SAVER),Setting_DisableScrSaver);
AddModCheckBox(GetDlgItem(IDC_BASIC_MODE),UserInterface_BasicMode);
CModifiedEditBox * TxtBox = AddModTextBox(GetDlgItem(IDC_REMEMBER),File_RecentGameFileCount, false);
TxtBox->SetTextField(GetDlgItem(IDC_MAXROMS_TXT));
TxtBox = AddModTextBox(GetDlgItem(IDC_REMEMBERDIR),Directory_RecentGameDirCount, false);
TxtBox->SetTextField(GetDlgItem(IDC_MAXROMDIR_TXT));
UpdatePageSettings();
}

View File

@ -10,6 +10,8 @@ class CGeneralOptionsPage :
COMMAND_ID_HANDLER_EX(IDC_LOAD_FULLSCREEN,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_SCREEN_SAVER,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_BASIC_MODE,CheckBoxChanged)
COMMAND_HANDLER_EX(IDC_REMEMBER,EN_UPDATE,EditBoxChanged)
COMMAND_HANDLER_EX(IDC_REMEMBERDIR,EN_UPDATE,EditBoxChanged)
END_MSG_MAP()
enum { IDD = IDD_Settings_General };

View File

@ -22,7 +22,7 @@ COptionPluginPage::COptionPluginPage (HWND hParent, const RECT & rcDispay )
SetDlgItemText(IDC_HLE_GFX,GS(PLUG_HLE_GFX));
SetDlgItemText(IDC_HLE_AUDIO,GS(PLUG_HLE_AUDIO));
m_GfxGroup.Attach(GetDlgItem(IDC_GRAPHICS_NAME));
m_GfxGroup.Attach(GetDlgItem(IDC_GFX_NAME));
m_AudioGroup.Attach(GetDlgItem(IDC_AUDIO_NAME));
m_ControlGroup.Attach(GetDlgItem(IDC_CONT_NAME));
m_RspGroup.Attach(GetDlgItem(IDC_RSP_NAME));

View File

@ -18,15 +18,25 @@ class CSettingsPageImpl :
public CDialogImpl<T>
{
protected:
typedef std::map<SettingID,CModifiedButton *> ButtonList;
typedef std::map<SettingID,CModifiedComboBox *> ComboBoxList;
typedef std::map<SettingID,CModifiedEditBox *> TextBoxList;
typedef std::map<SettingID,CModifiedButton *> ButtonList;
typedef std::map<SettingID,CModifiedComboBox *> ComboBoxList;
typedef std::map<SettingID,CModifiedComboBoxTxt *> ComboBoxTxtList;
virtual ~CSettingsPageImpl()
{
for (TextBoxList::iterator eb_iter = m_TxtBoxList.begin(); eb_iter != m_TxtBoxList.end(); eb_iter ++)
{
delete eb_iter->second;
}
for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++)
{
delete iter->second;
}
for (ComboBoxTxtList::iterator cbtxt_iter = m_ComboBoxTxtList.begin(); cbtxt_iter != m_ComboBoxTxtList.end(); cbtxt_iter ++)
{
delete cbtxt_iter->second;
}
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++)
{
delete cb_iter->second;
@ -41,6 +51,7 @@ protected:
return false;
}
SetWindowPos(HWND_TOP,&rcDispay,SWP_HIDEWINDOW);
m_UpdatingTxt = false;
return true;
}
@ -59,6 +70,27 @@ protected:
}
}
void UpdateModEditBox ( CModifiedEditBox & EditBox, SettingID Type )
{
if (EditBox.IsChanged())
{
stdstr Value = EditBox.GetWindowText();
if (EditBox.IsbString())
{
_Settings->SaveString(Type,Value);
} else {
DWORD dwValue = atoi(Value.c_str());
_Settings->SaveDword(Type,dwValue);
}
}
if (EditBox.IsReset())
{
_Settings->DeleteSetting(Type);
EditBox.SetReset(false);
}
}
void UpdateModCheckBox ( CModifiedButton & CheckBox, SettingID Type )
{
if (CheckBox.IsChanged())
@ -89,6 +121,44 @@ protected:
return true;
}
bool ResetEditBox ( CModifiedEditBox & EditBox, SettingID Type )
{
if (!EditBox.IsChanged())
{
return false;
}
if (EditBox.IsbString())
{
stdstr Value = _Settings->LoadDefaultString(Type);
EditBox.SetReset(true);
EditBox.SetWindowText(Value.c_str());
} else {
DWORD Value = _Settings->LoadDefaultDword(Type);
EditBox.SetReset(true);
EditBox.SetWindowText(stdstr_f("%d",Value).c_str());
}
return true;
}
CModifiedEditBox * AddModTextBox ( HWND hWnd, SettingID Type, bool bString )
{
TextBoxList::iterator item = m_TxtBoxList.find(Type);
if (item == m_TxtBoxList.end())
{
CModifiedEditBox * EditBox = new CModifiedEditBox(bString);
if (EditBox == NULL)
{
return NULL;
}
EditBox->Attach(hWnd);
m_TxtBoxList.insert(TextBoxList::value_type(Type,EditBox));
return EditBox;
}
return NULL;
}
void AddModCheckBox ( HWND hWnd, SettingID Type )
{
ButtonList::iterator item = m_ButtonList.find(Type);
@ -123,6 +193,24 @@ protected:
return ComboBox;
}
CModifiedComboBoxTxt * AddModComboBoxTxt ( HWND hWnd, SettingID Type )
{
ComboBoxTxtList::iterator item = m_ComboBoxTxtList.find(Type);
if (item != m_ComboBoxTxtList.end())
{
return item->second;
}
CModifiedComboBoxTxt * ComboBox = new CModifiedComboBoxTxt;
if (ComboBox == NULL)
{
return NULL;
}
ComboBox->Attach(hWnd);
m_ComboBoxTxtList.insert(ComboBoxTxtList::value_type(Type,ComboBox));
return ComboBox;
}
void UpdateCheckBoxes ( void )
{
for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++)
@ -138,6 +226,15 @@ protected:
void UpdateComboBoxes ( void)
{
for (ComboBoxTxtList::iterator cbtxt_iter = m_ComboBoxTxtList.begin(); cbtxt_iter != m_ComboBoxTxtList.end(); cbtxt_iter ++)
{
CModifiedComboBoxTxt * ComboBox = cbtxt_iter->second;
stdstr SelectedValue;
ComboBox->SetChanged(_Settings->LoadString(cbtxt_iter->first,SelectedValue));
ComboBox->SetDefault(SelectedValue);
}
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++)
{
CModifiedComboBox * ComboBox = cb_iter->second;
@ -148,27 +245,80 @@ protected:
}
}
void UpdateTextBoxes ( void)
{
for (TextBoxList::iterator iter = m_TxtBoxList.begin(); iter != m_TxtBoxList.end(); iter ++)
{
CModifiedEditBox * TextBox = iter->second;
m_UpdatingTxt = true;
if (TextBox->IsbString())
{
stdstr SelectedValue;
TextBox->SetChanged(_Settings->LoadString(iter->first,SelectedValue));
TextBox->SetWindowText(SelectedValue.c_str());
} else {
DWORD SelectedValue;
TextBox->SetChanged(_Settings->LoadDword(iter->first,SelectedValue));
TextBox->SetWindowText(stdstr_f("%d",SelectedValue).c_str());
}
m_UpdatingTxt = false;
}
}
virtual void UpdatePageSettings ( void )
{
UpdateCheckBoxes();
UpdateComboBoxes();
UpdateTextBoxes();
}
void ComboBoxChanged ( UINT Code, int id, HWND ctl )
{
for (ComboBoxTxtList::iterator cbtxt_iter = m_ComboBoxTxtList.begin(); cbtxt_iter != m_ComboBoxTxtList.end(); cbtxt_iter ++)
{
CModifiedComboBoxTxt * ComboBox = cbtxt_iter->second;
if ((int)ComboBox->GetMenu() != id)
{
continue;
}
ComboBox->SetChanged(true);
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0);
break;
}
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++)
{
CModifiedComboBox * ComboBox = cb_iter->second;
if ((int)ComboBox->GetMenu() != id)
{
continue;
}
}
ComboBox->SetChanged(true);
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0);
break;
}
}
void EditBoxChanged ( UINT Code, int id, HWND ctl )
{
if (m_UpdatingTxt)
{
return;
}
for (TextBoxList::iterator eb_iter = m_TxtBoxList.begin(); eb_iter != m_TxtBoxList.end(); eb_iter ++)
{
CModifiedEditBox * EditBox = eb_iter->second;
if ((int)EditBox->GetMenu() != id)
{
continue;
}
EditBox->SetChanged(true);
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0);
break;
}
}
virtual bool ResetComboBox ( CModifiedComboBox & ComboBox, SettingID Type )
{
if (!ComboBox.IsChanged())
@ -180,7 +330,28 @@ protected:
DWORD Value = _Settings->LoadDefaultDword(Type);
for (int i = 0, n = ComboBox.GetCount(); i < n; i++)
{
if (ComboBox.GetItemData(i) != Value)
if (*((WPARAM *)ComboBox.GetItemData(i)) != Value)
{
continue;
}
ComboBox.SetCurSel(i);
return true;
}
return false;
}
virtual bool ResetComboBoxTxt ( CModifiedComboBoxTxt & ComboBox, SettingID Type )
{
if (!ComboBox.IsChanged())
{
return false;
}
ComboBox.SetReset(true);
stdstr Value = _Settings->LoadDefaultString(Type);
for (int i = 0, n = ComboBox.GetCount(); i < n; i++)
{
if (*((stdstr *)ComboBox.GetItemData(i)) != Value)
{
continue;
}
@ -199,7 +370,7 @@ protected:
{
return;
}
_Settings->SaveDword(Type,(DWORD)ComboBox.GetItemData(index));
_Settings->SaveDword(Type,*(DWORD *)ComboBox.GetItemData(index));
}
if (ComboBox.IsReset())
{
@ -208,7 +379,32 @@ protected:
}
}
virtual void UpdateModComboBoxTxt ( CModifiedComboBoxTxt & ComboBox, SettingID Type )
{
if (ComboBox.IsChanged())
{
int index = ComboBox.GetCurSel();
if (index == CB_ERR)
{
return;
}
_Settings->SaveString(Type,((stdstr *)ComboBox.GetItemData(index))->c_str());
}
if (ComboBox.IsReset())
{
_Settings->DeleteSetting(Type);
ComboBox.SetReset(false);
}
}
public:
virtual void ApplyEditBoxes ( void )
{
for (TextBoxList::iterator eb_iter = m_TxtBoxList.begin(); eb_iter != m_TxtBoxList.end(); eb_iter ++)
{
CModifiedEditBox * EditBox = eb_iter->second;
UpdateModEditBox(*EditBox,eb_iter->first);
}
}
virtual void ApplyCheckBoxes ( void )
{
for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++)
@ -219,6 +415,11 @@ public:
}
virtual void ApplyComboBoxes ( void )
{
for (ComboBoxTxtList::iterator cbtxt_iter = m_ComboBoxTxtList.begin(); cbtxt_iter != m_ComboBoxTxtList.end(); cbtxt_iter ++)
{
CModifiedComboBoxTxt * ComboBox = cbtxt_iter->second;
UpdateModComboBoxTxt(*ComboBox,cbtxt_iter->first);
}
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++)
{
CModifiedComboBox * ComboBox = cb_iter->second;
@ -227,6 +428,7 @@ public:
}
void ApplySettings( bool UpdateScreen )
{
ApplyEditBoxes();
ApplyCheckBoxes();
ApplyComboBoxes();
@ -238,6 +440,14 @@ public:
bool EnableReset ( void )
{
for (TextBoxList::iterator eb_iter = m_TxtBoxList.begin(); eb_iter != m_TxtBoxList.end(); eb_iter ++)
{
CModifiedEditBox * EditBox = eb_iter->second;
if (EditBox->IsChanged())
{
return true;
}
}
for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++)
{
CModifiedButton * Button = iter->second;
@ -246,6 +456,14 @@ public:
return true;
}
}
for (ComboBoxTxtList::iterator cbtxt_iter = m_ComboBoxTxtList.begin(); cbtxt_iter != m_ComboBoxTxtList.end(); cbtxt_iter ++)
{
CModifiedComboBoxTxt * ComboBox = cbtxt_iter->second;
if (ComboBox->IsChanged())
{
return true;
}
}
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++)
{
CModifiedComboBox * ComboBox = cb_iter->second;
@ -260,6 +478,14 @@ public:
void ResetPage ( void )
{
bool Changed = false;
for (TextBoxList::iterator eb_iter = m_TxtBoxList.begin(); eb_iter != m_TxtBoxList.end(); eb_iter ++)
{
CModifiedEditBox * EditBox = eb_iter->second;
if (ResetEditBox(*EditBox,eb_iter->first))
{
Changed = true;
}
}
for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++)
{
CModifiedButton * Button = iter->second;
@ -268,6 +494,14 @@ public:
Changed = true;
}
}
for (ComboBoxTxtList::iterator cbtxt_iter = m_ComboBoxTxtList.begin(); cbtxt_iter != m_ComboBoxTxtList.end(); cbtxt_iter ++)
{
CModifiedComboBoxTxt * ComboBox = cbtxt_iter->second;
if (ResetComboBoxTxt(*ComboBox,cbtxt_iter->first))
{
Changed = true;
}
}
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++)
{
CModifiedComboBox * ComboBox = cb_iter->second;
@ -282,8 +516,11 @@ public:
}
}
protected:
ButtonList m_ButtonList;
ComboBoxList m_ComboBoxList;
TextBoxList m_TxtBoxList;
ButtonList m_ButtonList;
ComboBoxList m_ComboBoxList;
ComboBoxTxtList m_ComboBoxTxtList;
bool m_UpdatingTxt;
};

View File

@ -84,7 +84,7 @@ BEGIN
BS_AUTOCHECKBOX | WS_TABSTOP,9,127,193,8
CONTROL "Use High Level Audio",IDC_HLE_AUDIO,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,9,140,188,8
GROUPBOX "Graphics:",IDC_GRAPHICS_NAME,6,6,208,29
GROUPBOX "Graphics:",IDC_GFX_NAME,6,6,208,29
GROUPBOX "Audio:",IDC_AUDIO_NAME,6,38,208,29
GROUPBOX "Controller:",IDC_CONT_NAME,6,66,208,29
GROUPBOX "Reality Signal Processor: ",IDC_RSP_NAME,6,96,208,29
@ -169,12 +169,12 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,41,198,8
CONTROL "Hide Advanced Settings",IDC_BASIC_MODE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,8,57,198,8
LTEXT "Max # of Roms Remembered (Max 10):",IDC_ROMSEL_TEXT1,6,
LTEXT "Max # of Roms Remembered (Max 10):",IDC_MAXROMS_TXT,6,
81,145,8
EDITTEXT IDC_REMEMBER,154,79,26,12,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "roms",IDC_ROMSEL_TEXT2,184,81,31,8
LTEXT "Max # of Rom Dirs Remembered (Max 10):",
IDC_ROMSEL_TEXT3,6,96,145,8
IDC_MAXROMDIR_TXT,6,96,145,8
EDITTEXT IDC_REMEMBERDIR,154,94,26,12,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "dirs",IDC_ROMSEL_TEXT4,184,99,31,8
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,4,73,
@ -226,35 +226,37 @@ END
IDD_Settings_GameGeneral DIALOGEX 0, 0, 218, 158
STYLE WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Good Name:",IDC_GOOD_NAME_TEXT,6,8,91,10
EDITTEXT IDC_GOOD_NAME,102,7,109,12,ES_AUTOHSCROLL | ES_READONLY
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,4,25,
208,1
LTEXT "Memory Size:",IDC_MEMORY_SIZE_TEXT,6,33,91,10
LTEXT "Memory Size:",IDC_MEMORY_SIZE_TEXT,6,34,91,10
COMBOBOX IDC_RDRAM_SIZE,102,32,109,49,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Default Save type:",IDC_SAVE_TYPE_TEXT,6,48,91,10
LTEXT "Default Save type:",IDC_SAVE_TYPE_TEXT,6,49,91,10
COMBOBOX IDC_SAVE_TYPE,102,47,109,49,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Counter Factor:",IDC_COUNTFACT_TEXT,6,64,91,10
COMBOBOX IDC_COUNTFACT,102,61,109,49,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
CONTROL "Sync using Audio",IDC_SYNC_AUDIO,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,6,86,91,11
BS_AUTOCHECKBOX | WS_TABSTOP,6,98,91,11
CONTROL "Use TLB",IDC_USE_TLB,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,6,114,91,11
WS_TABSTOP,6,126,91,11
CONTROL "Delay SI Interrupt",IDC_DELAY_SI,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,102,100,91,11
BS_AUTOCHECKBOX | WS_TABSTOP,102,112,91,11
CONTROL "SP Hack",IDC_ROM_SPHACK,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,6,100,91,11
WS_TABSTOP,6,112,91,11
CONTROL "RSP Audio Signal",IDC_AUDIO_SIGNAL,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,102,114,91,11
BS_AUTOCHECKBOX | WS_TABSTOP,102,126,91,11
CONTROL "Fixed Audio Timing",IDC_ROM_FIXEDAUDIO,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,102,86,91,11
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,3,80,
BS_AUTOCHECKBOX | WS_TABSTOP,102,98,91,11
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,3,92,
208,1
LTEXT "Vi Refresh Rate:",IDC_VIREFESH_TEXT,6,77,91,10
EDITTEXT IDC_VIREFRESH,102,75,109,12,ES_AUTOHSCROLL | ES_NUMBER
END
IDD_Settings_Accelerator DIALOGEX 0, 0, 218, 183
@ -299,21 +301,6 @@ BEGIN
3,96,19
END
IDD_Settings_GameStatus DIALOGEX 0, 0, 233, 206
STYLE WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "",IDC_STATIC,4,20,224,138
LTEXT "Status:",IDC_STATUS_TEXT,11,33,74,10
COMBOBOX IDC_STATUS_TYPE,89,31,132,49,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Notes (Core)",IDC_NOTES_CORE_TEXT,10,47,74,9
EDITTEXT IDC_NOTES_CORE,89,47,132,30,ES_AUTOHSCROLL
LTEXT "Notes (Plugin)",IDC_NOTES_PLUGIN_TEXT,9,84,74,9
EDITTEXT IDC_NOTES_PLUGIN,89,83,132,30,ES_AUTOHSCROLL
END
IDD_Cheats_Select DIALOGEX 0, 0, 412, 226
STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_CAPTION |
WS_SYSMENU
@ -778,12 +765,26 @@ BEGIN
BS_AUTOCHECKBOX | WS_TABSTOP,9,127,193,8
CONTROL "Use High Level Audio",IDC_HLE_AUDIO,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,9,140,188,8
GROUPBOX "Graphics:",IDC_GRAPHICS_NAME,6,6,208,29
GROUPBOX "Graphics:",IDC_GFX_NAME,6,6,208,29
GROUPBOX "Audio:",IDC_AUDIO_NAME,6,38,208,29
GROUPBOX "Controller:",IDC_CONT_NAME,6,66,208,29
GROUPBOX "Reality Signal Processor: ",IDC_RSP_NAME,6,96,208,29
END
IDD_Settings_GameStatus DIALOGEX 0, 0, 218, 158
STYLE WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Status:",IDC_STATUS_TEXT,6,12,74,10
COMBOBOX IDC_STATUS_TYPE,80,10,131,49,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Notes (Core)",IDC_NOTES_CORE_TEXT,6,26,74,10
EDITTEXT IDC_NOTES_CORE,80,26,132,30,ES_AUTOHSCROLL
LTEXT "Notes (Plugin)",IDC_NOTES_PLUGIN_TEXT,6,63,74,10
EDITTEXT IDC_NOTES_PLUGIN,80,62,132,30,ES_AUTOHSCROLL
END
/////////////////////////////////////////////////////////////////////////////
//
@ -855,14 +856,6 @@ BEGIN
BOTTOMMARGIN, 38
END
IDD_Settings_GameStatus, DIALOG
BEGIN
LEFTMARGIN, 4
RIGHTMARGIN, 231
TOPMARGIN, 4
BOTTOMMARGIN, 200
END
IDD_Cheats_Select, DIALOG
BEGIN
LEFTMARGIN, 7
@ -1017,6 +1010,14 @@ BEGIN
TOPMARGIN, 7
BOTTOMMARGIN, 172
END
IDD_Settings_GameStatus, DIALOG
BEGIN
LEFTMARGIN, 4
RIGHTMARGIN, 216
TOPMARGIN, 4
BOTTOMMARGIN, 152
END
END
#endif // APSTUDIO_INVOKED

View File

@ -4,12 +4,15 @@ template <class TParam>
class CModifiedComboBoxT :
public CComboBox
{
typedef std::list<TParam *> TParamList;
bool m_Changed;
bool m_Reset;
TParam m_defaultValue;
HFONT m_BoldFont;
HFONT m_OriginalFont;
HWND m_TextField;
TParamList m_ParamList;
public:
// Constructors
@ -23,29 +26,28 @@ public:
{
}
CModifiedComboBoxT(TParam defaultValue, HWND hWnd = NULL ) :
CComboBox(hWnd),
m_Changed(false),
m_Reset(false),
m_BoldFont(NULL),
m_OriginalFont(NULL),
m_defaultValue(),
m_TextField(NULL)
{
}
~CModifiedComboBoxT()
{
if (m_BoldFont)
{
DeleteObject(m_BoldFont);
}
for (TParamList::iterator iter = m_ParamList.begin(); iter != m_ParamList.end(); iter ++)
{
TParam * Item = (TParam *)*iter;
if (Item)
{
delete Item;
}
}
}
int AddItem (LPCSTR strItem, TParam lParam)
int AddItem (LPCSTR strItem, const TParam & lParam)
{
int indx = AddString(strItem);
SetItemData(indx,(DWORD_PTR)lParam);
TParam * Value = new TParam(lParam);
SetItemData(indx,(DWORD_PTR)(Value));
m_ParamList.push_back(Value);
if (GetCount() == 1 || m_defaultValue == lParam)
{
SetCurSel(indx);
@ -113,12 +115,12 @@ public:
}
}
inline void SetDefault (TParam defaultValue)
inline void SetDefault (const TParam & defaultValue)
{
m_defaultValue = defaultValue;
for (int i = 0, n = GetCount(); i < n; i++)
{
if (GetItemData(i) == m_defaultValue)
if (*((TParam *)GetItemData(i)) == m_defaultValue)
{
SetCurSel(i);
break;
@ -138,3 +140,4 @@ public:
};
typedef CModifiedComboBoxT<WPARAM> CModifiedComboBox;
typedef CModifiedComboBoxT<stdstr> CModifiedComboBoxTxt;

View File

@ -1,11 +1,13 @@
#include <User Interface.h>
CModifiedEditBox::CModifiedEditBox(HWND hWnd) :
CModifiedEditBox::CModifiedEditBox(bool bString /* = true */, HWND hWnd /* = NULL */) :
CEdit(hWnd),
m_Changed(false),
m_Reset(false),
m_BoldFont(NULL),
m_OriginalFont(NULL)
m_OriginalFont(NULL),
m_TextField(NULL),
m_bString(bString)
{
}
@ -44,11 +46,22 @@ void CModifiedEditBox::SetChanged (bool Changed)
}
SendMessage(WM_SETFONT,(WPARAM)m_BoldFont);
InvalidateRect(NULL);
if (m_TextField)
{
::SendMessage(m_TextField,WM_SETFONT,(WPARAM)m_BoldFont,0);
::InvalidateRect(m_TextField, NULL, true);
}
} else {
if (m_OriginalFont)
{
SendMessage(WM_SETFONT,(WPARAM)m_OriginalFont);
InvalidateRect(NULL);
if (m_TextField)
{
::SendMessage(m_TextField,WM_SETFONT,(WPARAM)m_OriginalFont,0);
::InvalidateRect(m_TextField, NULL, true);
}
}
}
}
@ -67,3 +80,16 @@ stdstr CModifiedEditBox::GetWindowText( void )
::GetWindowText(m_hWnd,(char *)Result.c_str(),nLen+1);
return Result;
}
void CModifiedEditBox::SetTextField (HWND hWnd)
{
if (m_TextField && m_OriginalFont)
{
::SendMessage(m_TextField,WM_SETFONT,(WPARAM)m_OriginalFont,0);
}
m_TextField = hWnd;
if (m_Changed && m_BoldFont)
{
::SendMessage(m_TextField,WM_SETFONT,(WPARAM)m_BoldFont,0);
}
}

View File

@ -7,15 +7,18 @@ class CModifiedEditBox :
bool m_Reset;
HFONT m_BoldFont;
HFONT m_OriginalFont;
HWND m_TextField;
bool m_bString;
public:
// Constructors
CModifiedEditBox(HWND hWnd = NULL);
CModifiedEditBox(bool bString = true, HWND hWnd = NULL);
~CModifiedEditBox();
void SetReset ( bool Reset );
void SetChanged (bool Changed);
stdstr GetWindowText();
void SetTextField (HWND hWnd);
inline bool IsChanged ( void ) const
{
@ -25,6 +28,9 @@ public:
{
return m_Reset;
}
inline bool IsbString ( void ) const
{
return m_bString;
}
};

View File

@ -24,7 +24,6 @@
#define IDD_About 128
#define IDD_Settings_Directory 131
#define IDD_Settings_Advanced 132
#define IDD_Settings_Rom 133
#define IDD_Settings_GameGeneral 133
#define IDD_Cheats_Select 134
#define IDD_Cheats_List 135
@ -40,9 +39,7 @@
#define IDB_ABOUT_TOP 144
#define IDD_Settings_Accelerator 145
#define IDB_ABOUT_BOTTOM 145
#define IDD_Settings_RomStatus 146
#define IDB_ABOUT_MIDDLE 146
#define IDD_Settings_GameStatus 146
#define IDB_LANG_OK 147
#define IDB_LANG_OK_DOWN 148
#define IDD_Settings_Config 149
@ -52,6 +49,7 @@
#define IDR_HTML_ABOUT 162
#define IDD_Settings_GameRecompiler 162
#define IDD_Settings_GamePlugin 163
#define IDD_Settings_GameStatus 164
#define IDC_MENU_ITEM_TEXT 1000
#define IDC_CLOSE_BUTTON 1001
#define IDC_LIST2 1003
@ -66,7 +64,6 @@
#define IDC_REFRSH_MEM 1007
#define IDC_INFO_ROMNAME 1008
#define IDC_BUTTON3 1008
#define IDC_RESET 1008
#define IDC_RESET_PAGE 1008
#define IDC_INFO_CARTID 1009
#define IDC_VIRTUALKEY 1009
@ -92,7 +89,6 @@
#define IDC_HLE_AUDIO 1012
#define IDC_SMM_CACHE 1012
#define IDC_CASE_SENSITIVE 1012
#define IDC_DISPLAY_FRAMERATE2 1013
#define IDC_INFO_COUNTRY 1013
#define IDC_SHIFT 1013
#define IDC_TLB 1013
@ -145,7 +141,6 @@
#define IDC_RI_REG 1044
#define IDC_SMM_TLB 1044
#define IDC_SI_REG 1045
#define IDC_CUSTOM_SMM 1045
#define IDC_RDRAM 1046
#define IDC_SMM_FRAME 1046
#define IDC_SP_REG 1047
@ -226,22 +221,20 @@
#define IDC_SELECT_LANG 1088
#define IDC_SAVE_TYPE 1089
#define IDC_MENU_ITEMS 1089
#define IDC_ABL 1090
#define IDC_PAGELIST 1090
#define IDC_USEINI 1091
#define IDC_CPU_TYPE_TEXT 1092
#define IDC_ZIP 1092
#define IDC_SETTING_INFO 1092
#define IDC_GOOD_NAME_TEXT 1093
#define IDC_GRAPHICS_NAME 1093
#define IDC_FUNCFIND_TEXT 1094
#define IDC_REMEMBER 1095
#define IDC_GFX_NAME 1095
#define IDC_AUTOSLEEP 1096
#define IDC_COUNTFACT_TEXT2 1096
#define IDC_COUNTFACT_TEXT 1096
#define IDC_RSP_NAME 1097
#define IDC_REMEMBERDIR 1097
#define IDC_GFX_NAME 1098
#define IDC_VIREFESH_TEXT 1097
#define IDC_VIREFRESH 1098
#define IDC_AUDIO_NAME 1099
#define IDC_ROM_REGCACHE 1099
#define IDC_CONT_NAME 1100
@ -252,14 +245,11 @@
#define IDC_DIR_FRAME3 1103
#define IDC_DIR_FRAME4 1104
#define IDC_DIR_FRAME5 1105
#define IDC_INFO 1106
#define IDC_TEXT2 1107
#define IDC_TEXT3 1108
#define IDC_TEXT4 1109
#define IDC_TEXT5 1110
#define IDC_ROMSEL_TEXT1 1111
#define IDC_MAXROMS_TXT 1111
#define IDC_ROMSEL_TEXT2 1112
#define IDC_ROMSEL_TEXT3 1113
#define IDC_MAXROMDIR_TXT 1113
#define IDC_ROMSEL_TEXT4 1114
#define IDC_UNMARK 1119
#define IDC_NOTES 1120
@ -289,7 +279,6 @@
#define IDC_PAL 1146
#define IDC_USA 1147
#define IDC_SHELL_INT_TEXT 1149
#define IDC_BLOCK_LINKING_TEXT 1150
#define IDC_RDB_HOME 1150
#define IDC_COUNTFACT 1151
#define IDC_CHT_HOME 1151
@ -320,7 +309,6 @@
#define IDC_STATE 1179
#define IDC_CHEATSFRAME 1188
#define IDC_ADDCHEATSFRAME 1189
#define IDC_CORE_DEFAULTS 1190
#define IDC_CHEAT_OPTIONS 1190
#define IDC_ROM_NAME 1191
#define IDC_LABEL_OPTIONS 1191
@ -358,7 +346,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 150
#define _APS_NEXT_COMMAND_VALUE 40008
#define _APS_NEXT_CONTROL_VALUE 1095
#define _APS_NEXT_CONTROL_VALUE 1099
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -376,6 +376,8 @@ void RSP_Cop0_MF (void) {
RDP_LogMF0(*PrgCount,RSPOpC.rd);
}
switch (RSPOpC.rd) {
case 0: RSP_GPR[RSPOpC.rt].UW = *RSPInfo.SP_MEM_ADDR_REG; break;
case 1: RSP_GPR[RSPOpC.rt].UW = *RSPInfo.SP_DRAM_ADDR_REG; break;
case 4: RSP_GPR[RSPOpC.rt].UW = *RSPInfo.SP_STATUS_REG; break;
case 5: RSP_GPR[RSPOpC.rt].UW = *RSPInfo.SP_DMA_FULL_REG; break;
case 6: RSP_GPR[RSPOpC.rt].UW = *RSPInfo.SP_DMA_BUSY_REG; break;
@ -475,10 +477,10 @@ void RSP_Cop2_MF (void) {
void RSP_Cop2_CF (void) {
switch ((RSPOpC.rd & 0x03)) {
case 0: RSP_GPR[RSPOpC.rt].W = RSP_Flags[0].HW[0]; break;
case 1: RSP_GPR[RSPOpC.rt].W = RSP_Flags[1].HW[0]; break;
case 2: RSP_GPR[RSPOpC.rt].W = RSP_Flags[2].HW[0]; break;
case 3: RSP_GPR[RSPOpC.rt].W = RSP_Flags[2].HW[0]; break;
case 0: RSP_GPR[RSPOpC.rt].W = RSP_Flags[0].UHW[0]; break;
case 1: RSP_GPR[RSPOpC.rt].W = RSP_Flags[1].UHW[0]; break;
case 2: RSP_GPR[RSPOpC.rt].W = RSP_Flags[2].UHW[0]; break;
case 3: RSP_GPR[RSPOpC.rt].W = RSP_Flags[2].UHW[0]; break;
}
}

View File

@ -71,13 +71,15 @@ extern BYTE * pLastSecondary;
enum {
Set_BreakOnStart, Set_CPUCore, Set_LogRDP, Set_LogX86Code, Set_Profiling, Set_IndvidualBlock,
Set_AudioHle, Set_GraphicsHle, Set_ShowErrors,
Set_ShowErrors,
//Compiler settings
Set_CheckDest, Set_Accum, Set_Mmx, Set_Mmx2, Set_Sse, Set_Sections,
Set_ReOrdering, Set_GPRConstants, Set_Flags, Set_AlignVector,
};
ULONG Set_AudioHle = 0, Set_GraphicsHle = 0;
/************ DLL info **************/
const char * AppName ( void )
{
@ -181,7 +183,7 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD fdwReason, LPVOID lpvReserved ){
__declspec(dllexport) void GetDllInfo ( PLUGIN_INFO * PluginInfo ) {
PluginInfo->Version = 0x0102;
PluginInfo->Type = PLUGIN_TYPE_RSP;
sprintf(PluginInfo->Name,"RSP Plugin %s",VersionInfo(VERSION_PRODUCT_VERSION,hinstDLL));
sprintf(PluginInfo->Name,"RSP Plugin %s",VersionInfo(VERSION_PRODUCT_VERSION,hinstDLL).c_str());
PluginInfo->NormalMemory = FALSE;
PluginInfo->MemoryBswaped = TRUE;
}
@ -297,8 +299,8 @@ void DetectCpuSpecs(void) {
__declspec(dllexport) void InitiateRSP ( RSP_INFO Rsp_Info, DWORD * CycleCount) {
RSPInfo = Rsp_Info;
AudioHle = GetSetting(Set_AudioHle);
GraphicsHle = GetSetting(Set_GraphicsHle);
AudioHle = GetSystemSetting(Set_AudioHle);
GraphicsHle = GetSystemSetting(Set_GraphicsHle);
*CycleCount = 0;
AllocateMemory();
@ -681,15 +683,17 @@ __declspec(dllexport) void PluginLoaded (void)
Compiler.bGPRConstants = TRUE;
DetectCpuSpecs();
SetModuleName("RSP");
Set_GraphicsHle = FindSystemSettingId("HLE GFX");
Set_AudioHle = FindSystemSettingId("HLE Audio");
RegisterSetting(Set_BreakOnStart, Data_DWORD_General,"Break on Start", NULL,BreakOnStart,NULL);
RegisterSetting(Set_CPUCore, Data_DWORD_General,"CPU Method", NULL,CPUCore,NULL);
RegisterSetting(Set_LogRDP, Data_DWORD_General,"Log RDP", NULL,LogRDP,NULL);
RegisterSetting(Set_LogX86Code, Data_DWORD_General,"Log X86 Code", NULL,LogX86Code,NULL);
RegisterSetting(Set_Profiling, Data_DWORD_General,"Profiling", NULL,Profiling,NULL);
RegisterSetting(Set_IndvidualBlock, Data_DWORD_General,"Indvidual Block",NULL,IndvidualBlock,NULL);
RegisterSetting(Set_AudioHle, Data_DWORD_General,"HLE Audio", NULL,FALSE,NULL);
RegisterSetting(Set_GraphicsHle, Data_DWORD_General,"HLE GFX", NULL,TRUE,NULL);
RegisterSetting(Set_ShowErrors, Data_DWORD_General,"Show Errors", NULL,ShowErrors,NULL);
//Compiler settings
@ -704,8 +708,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 = GetSetting(Set_AudioHle);
GraphicsHle = GetSetting(Set_GraphicsHle);
AudioHle = GetSystemSetting(Set_AudioHle);
GraphicsHle = GetSystemSetting(Set_GraphicsHle);
hMutex = CreateMutex(NULL, FALSE, NULL);

View File

@ -42,7 +42,7 @@ END
RSPCOMPILER DIALOGEX 0, 0, 226, 135
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "RSP Compiler"
FONT 8, "MS Sans Serif"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
PUSHBUTTON "OK",IDOK,109,113,50,14
PUSHBUTTON "Cancel",IDCANCEL,161,113,50,14
@ -214,8 +214,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,7,0,2
PRODUCTVERSION 1,7,0,2
FILEVERSION 1,7,0,3
PRODUCTVERSION 1,7,0,3
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -233,14 +233,14 @@ BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Project64\0"
VALUE "FileDescription", "RSP emulation Plugin\0"
VALUE "FileVersion", "1, 7, 0, 2\0"
VALUE "FileVersion", "1, 7, 0, 3\0"
VALUE "InternalName", "RSP Plugin\0"
VALUE "LegalCopyright", "Copyright © 2006\0"
VALUE "LegalCopyright", "Copyright © 2008\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "RSP.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", " RSP\0"
VALUE "ProductVersion", "1, 7, 0, 2\0"
VALUE "ProductVersion", "1, 7, 0, 3\0"
VALUE "SpecialBuild", "\0"
END
END

View File

@ -33,12 +33,12 @@
// #define RSP_SAFE_DMA /* unoptimized dma transfers */
void SP_DMA_READ (void) {
DWORD i, j, Length, Skip, Count, End;
DWORD i, j, Length, Skip, Count, End, addr;
BYTE *Dest, *Source;
*RSPInfo.SP_DRAM_ADDR_REG &= 0x00FFFFFF;
addr = (*RSPInfo.SP_DRAM_ADDR_REG) & 0x00FFFFFF;
if (*RSPInfo.SP_DRAM_ADDR_REG > 0x800000) {
if (addr > 0x800000) {
MessageBox(NULL,"SP DMA READ\nSP_DRAM_ADDR_REG not in RDRam space","Error",MB_OK);
return;
}
@ -58,7 +58,7 @@ void SP_DMA_READ (void) {
} else {
Dest = RSPInfo.DMEM + ((*RSPInfo.SP_MEM_ADDR_REG & 0x0FFF) & ~7);
}
Source = RSPInfo.RDRAM + (*RSPInfo.SP_DRAM_ADDR_REG & ~7);
Source = RSPInfo.RDRAM + (addr & ~7);
#if defined(RSP_SAFE_DMA)
for (j = 0 ; j < Count; j++) {
@ -94,10 +94,10 @@ void SP_DMA_READ (void) {
}
void SP_DMA_WRITE (void) {
DWORD i, j, Length, Skip, Count;
DWORD i, j, Length, Skip, Count, addr;
BYTE *Dest, *Source;
*RSPInfo.SP_DRAM_ADDR_REG &= 0x00FFFFFF;
addr = (*RSPInfo.SP_DRAM_ADDR_REG) & 0x00FFFFFF;
if (*RSPInfo.SP_DRAM_ADDR_REG > 0x800000) {
MessageBox(NULL,"SP DMA WRITE\nSP_DRAM_ADDR_REG not in RDRam space","Error",MB_OK);
@ -112,7 +112,7 @@ void SP_DMA_WRITE (void) {
Length = ((*RSPInfo.SP_WR_LEN_REG & 0xFFF) | 7) + 1;
Skip = (*RSPInfo.SP_WR_LEN_REG >> 20) + Length;
Count = ((*RSPInfo.SP_WR_LEN_REG >> 12) & 0xFF) + 1;
Dest = RSPInfo.RDRAM + (*RSPInfo.SP_DRAM_ADDR_REG & ~7);
Dest = RSPInfo.RDRAM + (addr & ~7);
Source = RSPInfo.DMEM + ((*RSPInfo.SP_MEM_ADDR_REG & 0x1FFF) & ~7);
#if defined(RSP_SAFE_DMA)

View File

@ -28,12 +28,18 @@ typedef struct {
void (*UseUnregisteredSetting) (int ID);
} PLUGIN_SETTINGS;
static PLUGIN_SETTINGS g_PluginSettings;
static bool g_PluginInitilized = false;
static char g_PluginSettingName[300];
typedef struct {
unsigned int (*FindSystemSettingId) ( void * handle, const char * Name );
} PLUGIN_SETTINGS2;
static PLUGIN_SETTINGS g_PluginSettings;
static PLUGIN_SETTINGS2 g_PluginSettings2;
static bool g_PluginInitilized = false;
static char g_PluginSettingName[300];
extern "C" {
__declspec(dllexport) void SetSettingInfo (PLUGIN_SETTINGS * info);
__declspec(dllexport) void SetSettingInfo2 (PLUGIN_SETTINGS2 * info);
}
@ -44,6 +50,11 @@ __declspec(dllexport) void SetSettingInfo (PLUGIN_SETTINGS * info)
info->UseUnregisteredSetting = UseUnregisteredSetting;
}
__declspec(dllexport) void SetSettingInfo2 (PLUGIN_SETTINGS2 * info)
{
g_PluginSettings2 = *info;
}
BOOL SettingsInitilized ( void )
{
return g_PluginInitilized;
@ -112,12 +123,26 @@ void RegisterSetting ( short SettingID, SETTING_DATA_TYPE Type, const char *
}
}
ULONG FindSystemSettingId ( const char * Name )
{
if (g_PluginSettings2.FindSystemSettingId && g_PluginSettings.handle)
{
return g_PluginSettings2.FindSystemSettingId(g_PluginSettings.handle,Name);
}
return 0;
}
unsigned int GetSetting ( short SettingID )
{
return g_PluginSettings.GetSetting(g_PluginSettings.handle,SettingID + g_PluginSettings.SettingStartRange);
}
unsigned int GetSystemSetting ( short SettingID )
{
return g_PluginSettings.GetSetting(g_PluginSettings.handle,SettingID);
}
const char * GetSettingSz ( short SettingID, char * Buffer, int BufferLen )
{
return g_PluginSettings.GetSettingSz(g_PluginSettings.handle,SettingID + g_PluginSettings.SettingStartRange,Buffer,BufferLen);

View File

@ -3,8 +3,9 @@ extern "C" {
#endif
// Get Settings, take a setting id
unsigned int GetSetting ( short SettingID );
const char * GetSettingSz ( short SettingID, char * Buffer, int BufferLen );
unsigned int GetSetting ( short SettingID );
unsigned int GetSystemSetting ( short SettingID );
const char * GetSettingSz ( short SettingID, char * Buffer, int BufferLen );
// Set a settings value
void SetSetting ( short SettingID, unsigned int Value );
@ -26,7 +27,7 @@ BOOL SettingsInitilized ( void );
void SetModuleName ( const char * Name );
void RegisterSetting ( short SettingID, SETTING_DATA_TYPE Type, const char * Name, const char * Category,
unsigned int DefaultDW, const char * DefaultStr );
ULONG FindSystemSettingId ( const char * Name );
// this must be implemented to be notified when a setting is used but has not been set up
void UseUnregisteredSetting (int SettingID);