Added delay DP interrupt + refractoring of some of the settings

This commit is contained in:
zilmar 2012-10-06 09:53:11 +10:00
parent 207ae1c7ea
commit ba27b5e423
15 changed files with 47 additions and 30 deletions

View File

@ -1033,6 +1033,9 @@ void CMipsMemoryVM::Compile_SW_Register (x86Reg Reg, DWORD VAddr )
AfterCallDirect(m_RegWorkingSet);
break;
case 0x04040010:
m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - CountPerOp()) ;
UpdateCounters(m_RegWorkingSet,false, true);
m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + CountPerOp()) ;
MoveX86regToVariable(Reg,&RegModValue,"RegModValue");
BeforeCallDirect(m_RegWorkingSet);
Call_Direct(ChangeSpStatus,"ChangeSpStatus");

View File

@ -2,8 +2,6 @@
int CPifRamSettings::m_RefCount = 0;
bool CPifRamSettings::m_bShowPifRamErrors = false;
bool CPifRamSettings::m_DelaySI = false;
DWORD CPifRamSettings::m_RdramSize = 0;
CPifRamSettings::CPifRamSettings()
{
@ -11,8 +9,6 @@ CPifRamSettings::CPifRamSettings()
if (m_RefCount == 1)
{
_Settings->RegisterChangeCB(Debugger_ShowPifErrors,NULL,RefreshSettings);
_Settings->RegisterChangeCB(Game_RDRamSize,NULL,RefreshSettings);
_Settings->RegisterChangeCB(Game_DelaySI,NULL,RefreshSettings);
RefreshSettings(NULL);
}
}
@ -23,16 +19,12 @@ CPifRamSettings::~CPifRamSettings()
if (m_RefCount == 0)
{
_Settings->UnregisterChangeCB(Debugger_ShowPifErrors,NULL,RefreshSettings);
_Settings->UnregisterChangeCB(Game_RDRamSize,NULL,RefreshSettings);
_Settings->UnregisterChangeCB(Game_DelaySI,NULL,RefreshSettings);
}
}
void CPifRamSettings::RefreshSettings(void *)
{
m_bShowPifRamErrors = _Settings->LoadBool(Debugger_ShowPifErrors);
m_RdramSize = _Settings->LoadDword(Game_RDRamSize);
m_DelaySI = _Settings->LoadBool(Game_DelaySI);
}
CPifRam::CPifRam( bool SavesReadOnly ) :

View File

@ -5,15 +5,11 @@ protected:
virtual ~CPifRamSettings();
inline bool bShowPifRamErrors ( void ) const { return m_bShowPifRamErrors; }
inline bool bDelaySI ( void ) const { return m_DelaySI; }
inline DWORD RdramSize ( void ) const { return m_RdramSize; }
private:
static void RefreshSettings ( void * );
static bool m_bShowPifRamErrors;
static bool m_DelaySI;
static DWORD m_RdramSize;
static int m_RefCount;
@ -21,6 +17,7 @@ private:
class CPifRam :
private CPifRamSettings,
private CGameSettings,
private CEeprom
{
public:

View File

@ -209,6 +209,11 @@ void CSystemTimer::TimerDone (void)
_Notify->BreakPoint(__FILE__,__LINE__);
}
break;
case CSystemTimer::RSPTimerDlist:
_SystemTimer->StopTimer(CSystemTimer::RSPTimerDlist);
_Reg->m_GfxIntrReg |= MI_INTR_DP;
_Reg->CheckInterrupts();
break;
case CSystemTimer::AiTimer:
_SystemTimer->StopTimer(CSystemTimer::AiTimer);
_Audio->TimerDone();

View File

@ -1549,11 +1549,11 @@ void CN64System::RunRSP ( void ) {
WriteTrace(TraceError, "RunRSP: exception generated");
_Notify->FatalError("Unknown memory action\n\nEmulation stop");
}
/*if (Task == 1 && _Settings->LoadDword(DelayDlists)) {
m_Reg.ChangeTimerFixed(RSPTimerDlist,400);
MI_INTR_REG &= ~(MI_INTR_MASK_SP | MI_INTR_MASK_DP);
SP_STATUS_REG &= ~SP_STATUS_SIG2;
}*/
if (Task == 1 && bDelayDP() && ((m_Reg.m_GfxIntrReg & MI_INTR_DP) != 0))
{
_SystemTimer->SetTimer(CSystemTimer::RSPTimerDlist,0x1000,false);
m_Reg.m_GfxIntrReg &= ~MI_INTR_DP;
}
if (bShowCPUPer()) { m_CPU_Usage.StartTimer(CPU_UsageAddr); }
//if (bProfiling) { m_Profile.StartTimer(ProfileAddr); }

View File

@ -53,6 +53,7 @@ enum SettingID {
Rdb_RDRamSize,
Rdb_CounterFactor,
Rdb_UseTlb,
Rdb_DelayDP,
Rdb_DelaySi,
Rdb_32Bit,
Rdb_FastSP,
@ -109,6 +110,7 @@ enum SettingID {
Game_RDRamSize,
Game_CounterFactor,
Game_UseTlb,
Game_DelayDP,
Game_DelaySI,
Game_FastSP,
Game_FuncLookupMode,

View File

@ -1,10 +1,13 @@
#include "stdafx.h"
int CGameSettings::m_RefCount = 0;
int CGameSettings::m_RefCount = 0;
bool CGameSettings::m_bUseTlb;
DWORD CGameSettings::m_CountPerOp = 2;
DWORD CGameSettings::m_ViRefreshRate = 1500;
bool CGameSettings::m_DelayDP = false;
bool CGameSettings::m_DelaySI = false;
DWORD CGameSettings::m_RdramSize = 0;
CGameSettings::CGameSettings()
{
@ -14,6 +17,9 @@ CGameSettings::CGameSettings()
_Settings->RegisterChangeCB(Game_UseTlb,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Game_ViRefreshRate,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Game_CounterFactor,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Game_RDRamSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Game_DelaySI,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Game_DelayDP,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
RefreshSettings();
}
@ -27,6 +33,9 @@ CGameSettings::~CGameSettings()
_Settings->UnregisterChangeCB(Game_UseTlb,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Game_ViRefreshRate,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Game_CounterFactor,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Game_RDRamSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Game_DelaySI,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Game_DelayDP,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
}
}
@ -35,4 +44,7 @@ void CGameSettings::RefreshSettings()
m_bUseTlb = _Settings->LoadBool(Game_UseTlb);
m_ViRefreshRate = _Settings->LoadDword(Game_ViRefreshRate);
m_CountPerOp = _Settings->LoadDword(Game_CounterFactor);
m_RdramSize = _Settings->LoadDword(Game_RDRamSize);
m_DelaySI = _Settings->LoadBool(Game_DelaySI);
m_DelayDP = _Settings->LoadBool(Game_DelayDP);
}

View File

@ -9,6 +9,10 @@ public:
static inline bool bUseTlb ( void ) { return m_bUseTlb; }
inline static DWORD CountPerOp ( void ) { return m_CountPerOp; }
inline static DWORD ViRefreshRate ( void ) { return m_ViRefreshRate; }
inline static bool bDelayDP ( void ) { return m_DelayDP; }
inline static bool bDelaySI ( void ) { return m_DelaySI; }
inline static DWORD RdramSize ( void ) { return m_RdramSize; }
private:
static void StaticRefreshSettings (CGameSettings * _this)
{
@ -21,5 +25,8 @@ private:
static bool m_bUseTlb;
static DWORD m_CountPerOp;
static DWORD m_ViRefreshRate;
static bool m_DelayDP;
static bool m_DelaySI;
static DWORD m_RdramSize;
static int m_RefCount;
};

View File

@ -14,7 +14,6 @@ bool CRecompilerSettings::m_bFastSP;
bool CRecompilerSettings::m_b32Bit;
bool CRecompilerSettings::m_RegCaching;
bool CRecompilerSettings::m_bLinkBlocks;
DWORD CRecompilerSettings::m_RdramSize;
DWORD CRecompilerSettings::m_LookUpMode; //FUNC_LOOKUP_METHOD
CRecompilerSettings::CRecompilerSettings()
@ -29,7 +28,6 @@ CRecompilerSettings::CRecompilerSettings()
_Settings->RegisterChangeCB(Game_SMM_TLB,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Game_RegCache,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Game_BlockLinking,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Game_RDRamSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Game_FuncLookupMode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Debugger_ShowRecompMemSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Debugger_ProfileCode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
@ -53,7 +51,6 @@ CRecompilerSettings::~CRecompilerSettings()
_Settings->UnregisterChangeCB(Game_SMM_TLB,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Game_RegCache,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Game_BlockLinking,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Game_RDRamSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Game_FuncLookupMode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Debugger_ShowRecompMemSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Debugger_ProfileCode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
@ -78,6 +75,5 @@ void CRecompilerSettings::RefreshSettings()
m_RegCaching = _Settings->LoadBool(Game_RegCache);
m_bLinkBlocks = _Settings->LoadBool(Game_BlockLinking);
m_RdramSize = _Settings->LoadDword(Game_RDRamSize);
m_LookUpMode = _Settings->LoadDword(Game_FuncLookupMode);
}

View File

@ -17,9 +17,6 @@ public:
static bool bRomInMemory ( void ) { return m_bRomInMemory; }
static bool bRegCaching ( void ) { return m_RegCaching; }
static bool bLinkBlocks ( void ) { return m_bLinkBlocks; }
// static bool bFastSP ( void ) { return m_bFastSP; }
// static bool b32BitCore ( void ) { return m_b32Bit; }
static DWORD RdramSize ( void ) { return m_RdramSize; }
static FUNC_LOOKUP_METHOD LookUpMode ( void ) { return (FUNC_LOOKUP_METHOD)m_LookUpMode; }
private:
@ -45,7 +42,6 @@ private:
static bool m_RegCaching;
static bool m_bLinkBlocks;
static DWORD m_RdramSize;
static DWORD m_LookUpMode; //FUNC_LOOKUP_METHOD
static int m_RefCount;

View File

@ -109,6 +109,7 @@ void CSettings::AddHowToHandleSetting ()
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_DelayDP, new CSettingTypeRDBYesNo("Delay DP",true));
AddHandler(Rdb_DelaySi, new CSettingTypeRDBYesNo("Delay SI",false));
AddHandler(Rdb_32Bit, new CSettingTypeRDBYesNo("32bit",true));
AddHandler(Rdb_FastSP, new CSettingTypeRDBYesNo("Fast SP",true));
@ -155,6 +156,7 @@ void CSettings::AddHowToHandleSetting ()
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_DelayDP, new CSettingTypeGame("Delay DP",Rdb_DelayDP));
AddHandler(Game_DelaySI, new CSettingTypeGame("Delay SI",Rdb_DelaySi));
AddHandler(Game_RspAudioSignal, new CSettingTypeGame("Audio Signal",Rdb_RspAudioSignal));
AddHandler(Game_32Bit, new CSettingTypeGame("32bit",Rdb_32Bit));

View File

@ -13,6 +13,7 @@ CGameGeneralPage::CGameGeneralPage (HWND hParent, const RECT & rcDispay )
AddModCheckBox(GetDlgItem(IDC_SYNC_AUDIO),Game_SyncViaAudio);
AddModCheckBox(GetDlgItem(IDC_ROM_FIXEDAUDIO),Game_FixedAudio);
AddModCheckBox(GetDlgItem(IDC_USE_TLB),Game_UseTlb);
AddModCheckBox(GetDlgItem(IDC_DELAY_DP),Game_DelayDP);
AddModCheckBox(GetDlgItem(IDC_DELAY_SI),Game_DelaySI);
AddModCheckBox(GetDlgItem(IDC_AUDIO_SIGNAL),Game_RspAudioSignal);

View File

@ -16,6 +16,7 @@ class CGameGeneralPage :
COMMAND_ID_HANDLER_EX(IDC_SYNC_AUDIO,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_ROM_FIXEDAUDIO,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_USE_TLB,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_DELAY_DP,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)

View File

@ -203,12 +203,13 @@ BEGIN
CONTROL "Sync using Audio",IDC_SYNC_AUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,112,91,11
CONTROL "Use TLB",IDC_USE_TLB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,98,91,11
CONTROL "Delay SI Interrupt",IDC_DELAY_SI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,126,91,11
CONTROL "RSP Audio Signal",IDC_AUDIO_SIGNAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,126,91,11
CONTROL "RSP Audio Signal",IDC_AUDIO_SIGNAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,140,91,11
CONTROL "Fixed Audio Timing",IDC_ROM_FIXEDAUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,112,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
CONTROL "32 Bit Engine",IDC_ROM_32BIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,98,91,11
CONTROL "Delay DP Interrupt",IDC_DELAY_DP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,126,91,11
END
IDD_Settings_Accelerator DIALOGEX 0, 0, 218, 183
@ -571,7 +572,7 @@ BEGIN
END
IDD_Settings_GameRecompiler DIALOGEX 0, 0, 230, 156
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
STYLE DS_SETFONT | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
@ -584,12 +585,12 @@ BEGIN
CONTROL "Cache",IDC_SMM_CACHE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,91,89,9
CONTROL "PI DMA",IDC_SMM_DMA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,103,89,9
CONTROL "Start Changed",IDC_SMM_VALIDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,115,89,8
CONTROL "Protect Memory",IDC_SMM_PROTECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,116,91,89,8
CONTROL "Protect Memory",IDC_SMM_PROTECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,116,115,89,8
CONTROL "TLB Unmapping",IDC_SMM_TLB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,116,103,89,8
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,6,42,208,1
CONTROL "Advanced Block Linking",IDC_BLOCK_LINKING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,113,49,95,11
CONTROL "Fast SP",IDC_ROM_FASTSP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,62,91,11
CONTROL "Store Instruction",IDC_SMM_STORE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,116,115,89,8
CONTROL "Store Instruction",IDC_SMM_STORE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,116,91,89,8
END
IDD_Settings_GamePlugin DIALOGEX 0, 0, 231, 206

View File

@ -97,6 +97,8 @@
#define IDC_TLB_ENTRIES 1013
#define IDC_SMM_DMA 1013
#define IDC_UNKNOWN_ALIGN 1013
#define IDC_ROM_FIXEDAUDIO3 1013
#define IDC_DELAY_DP 1013
#define IDC_INFO_CRC1 1014
#define IDC_ASSIGNED_MENU_ITEM 1014
#define IDC_TLB_RULES 1014