Core: Add a setting for fpu reg caching

This commit is contained in:
zilmar 2023-04-17 18:47:33 +09:30
parent cba01b2063
commit ab8b004b71
13 changed files with 34 additions and 13 deletions

View File

@ -293,7 +293,8 @@
#5441# "Turbo" #5441# "Turbo"
#5442# "Slow" #5442# "Slow"
#5443# "Memory size (Known):" #5443# "Memory size (Known):"
#5443# "Memory size (Unknown):" #5444# "Memory size (Unknown):"
#5445# "FPU register caching:"
// Core styles // Core styles
#540# "Interpreter" #540# "Interpreter"

View File

@ -158,6 +158,7 @@ CJniBridegSettings::CJniBridegSettings()
ADD_SETTING(Game_FastSP); ADD_SETTING(Game_FastSP);
ADD_SETTING(Game_FuncLookupMode); ADD_SETTING(Game_FuncLookupMode);
ADD_SETTING(Game_RegCache); ADD_SETTING(Game_RegCache);
ADD_SETTING(Game_FPURegCache);
ADD_SETTING(Game_BlockLinking); ADD_SETTING(Game_BlockLinking);
ADD_SETTING(Game_ScreenHertz); ADD_SETTING(Game_ScreenHertz);
ADD_SETTING(Game_RspAudioSignal); ADD_SETTING(Game_RspAudioSignal);

View File

@ -330,6 +330,7 @@ enum LanguageStringID
ROM_DISK_SEEK_TIMING_SLOW = 5442, ROM_DISK_SEEK_TIMING_SLOW = 5442,
ROM_MEM_SIZE_KNOWN = 5443, ROM_MEM_SIZE_KNOWN = 5443,
ROM_MEM_SIZE_UNKNOWN = 5444, ROM_MEM_SIZE_UNKNOWN = 5444,
ROM_FPU_REG_CACHE = 5445,
// Core styles // Core styles
CORE_INTERPTER = 540, CORE_INTERPTER = 540,

View File

@ -278,6 +278,7 @@ void CLanguage::LoadDefaultStrings(void)
DEF_STR(ROM_DISK_SEEK_TIMING_SLOW, "Slow"); DEF_STR(ROM_DISK_SEEK_TIMING_SLOW, "Slow");
DEF_STR(ROM_MEM_SIZE_KNOWN, "Memory size (Known):"); DEF_STR(ROM_MEM_SIZE_KNOWN, "Memory size (Known):");
DEF_STR(ROM_MEM_SIZE_UNKNOWN, "Memory size (Unknown):"); DEF_STR(ROM_MEM_SIZE_UNKNOWN, "Memory size (Unknown):");
DEF_STR(ROM_FPU_REG_CACHE, "FPU register caching");
// Core styles // Core styles
DEF_STR(CORE_INTERPTER, "Interpreter"); DEF_STR(CORE_INTERPTER, "Interpreter");

View File

@ -327,8 +327,10 @@ void CX86RecompilerOps::PostCompileOpcode(void)
{ {
m_RegWorkingSet.WriteBackRegisters(); m_RegWorkingSet.WriteBackRegisters();
} }
if (!g_System->bFPURegCaching())
{
m_RegWorkingSet.UnMap_AllFPRs(); m_RegWorkingSet.UnMap_AllFPRs();
}
/*if (m_CompilePC >= 0x800933B4 && m_CompilePC <= 0x80093414 && (m_PipelineStage == PIPELINE_STAGE_NORMAL || m_PipelineStage == PIPELINE_STAGE_DO_DELAY_SLOT)) /*if (m_CompilePC >= 0x800933B4 && m_CompilePC <= 0x80093414 && (m_PipelineStage == PIPELINE_STAGE_NORMAL || m_PipelineStage == PIPELINE_STAGE_DO_DELAY_SLOT))
{ {
m_Assembler.MoveConstToVariable(&g_Reg->m_PROGRAM_COUNTER, "PROGRAM_COUNTER", m_CompilePC + 4); m_Assembler.MoveConstToVariable(&g_Reg->m_PROGRAM_COUNTER, "PROGRAM_COUNTER", m_CompilePC + 4);

View File

@ -162,6 +162,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Rdb_ScreenHertz, new CSettingTypeRomDatabase("ScreenHertz", (uint32_t)0)); AddHandler(Rdb_ScreenHertz, new CSettingTypeRomDatabase("ScreenHertz", (uint32_t)0));
AddHandler(Rdb_FuncLookupMode, new CSettingTypeRomDatabase("FuncFind", (uint32_t)FuncFind_PhysicalLookup)); AddHandler(Rdb_FuncLookupMode, new CSettingTypeRomDatabase("FuncFind", (uint32_t)FuncFind_PhysicalLookup));
AddHandler(Rdb_RegCache, new CSettingTypeRDB("Reg Cache", true)); AddHandler(Rdb_RegCache, new CSettingTypeRDB("Reg Cache", true));
AddHandler(Rdb_FpuRegCache, new CSettingTypeRDB("FPU Reg Cache", false));
#ifdef ANDROID #ifdef ANDROID
AddHandler(Rdb_BlockLinking, new CSettingTypeRDBOnOff("Linking", false)); AddHandler(Rdb_BlockLinking, new CSettingTypeRDBOnOff("Linking", false));
#else #else
@ -221,6 +222,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Game_ScreenHertz, new CSettingTypeGame("ScreenHertz", Rdb_ScreenHertz)); AddHandler(Game_ScreenHertz, new CSettingTypeGame("ScreenHertz", Rdb_ScreenHertz));
AddHandler(Game_FuncLookupMode, new CSettingTypeGame("FuncFind", Rdb_FuncLookupMode)); AddHandler(Game_FuncLookupMode, new CSettingTypeGame("FuncFind", Rdb_FuncLookupMode));
AddHandler(Game_RegCache, new CSettingTypeGame("Reg Cache", Rdb_RegCache)); AddHandler(Game_RegCache, new CSettingTypeGame("Reg Cache", Rdb_RegCache));
AddHandler(Game_FPURegCache, new CSettingTypeGame("FPU Reg Cache", Rdb_FpuRegCache));
AddHandler(Game_BlockLinking, new CSettingTypeGame("Linking", Rdb_BlockLinking)); AddHandler(Game_BlockLinking, new CSettingTypeGame("Linking", Rdb_BlockLinking));
AddHandler(Game_SMM_StoreInstruc, new CSettingTypeGame("SMM-StoreInst", Rdb_SMM_StoreInstruc)); AddHandler(Game_SMM_StoreInstruc, new CSettingTypeGame("SMM-StoreInst", Rdb_SMM_StoreInstruc));
AddHandler(Game_SMM_Cache, new CSettingTypeGame("SMM-Cache", Rdb_SMM_Cache)); AddHandler(Game_SMM_Cache, new CSettingTypeGame("SMM-Cache", Rdb_SMM_Cache));

View File

@ -24,6 +24,7 @@ bool CGameSettings::m_bFastSP = true;
bool CGameSettings::m_b32Bit = true; bool CGameSettings::m_b32Bit = true;
bool CGameSettings::m_RspAudioSignal; bool CGameSettings::m_RspAudioSignal;
bool CGameSettings::m_RegCaching; bool CGameSettings::m_RegCaching;
bool CGameSettings::m_FPURegCaching;
bool CGameSettings::m_bLinkBlocks; bool CGameSettings::m_bLinkBlocks;
uint32_t CGameSettings::m_LookUpMode; //FUNC_LOOKUP_METHOD uint32_t CGameSettings::m_LookUpMode; //FUNC_LOOKUP_METHOD
SYSTEM_TYPE CGameSettings::m_SystemType = SYSTEM_NTSC; SYSTEM_TYPE CGameSettings::m_SystemType = SYSTEM_NTSC;
@ -82,6 +83,7 @@ void CGameSettings::RefreshGameSettings()
#endif #endif
m_RspAudioSignal = g_Settings->LoadBool(Game_RspAudioSignal); m_RspAudioSignal = g_Settings->LoadBool(Game_RspAudioSignal);
m_RegCaching = g_Settings->LoadBool(Game_RegCache); m_RegCaching = g_Settings->LoadBool(Game_RegCache);
m_FPURegCaching = g_Settings->LoadBool(Game_FPURegCache);
m_bLinkBlocks = g_Settings->LoadBool(Game_BlockLinking); m_bLinkBlocks = g_Settings->LoadBool(Game_BlockLinking);
m_LookUpMode = g_Settings->LoadDword(Game_FuncLookupMode); m_LookUpMode = g_Settings->LoadDword(Game_FuncLookupMode);
m_SystemType = (SYSTEM_TYPE)g_Settings->LoadDword(Game_SystemType); m_SystemType = (SYSTEM_TYPE)g_Settings->LoadDword(Game_SystemType);

View File

@ -15,6 +15,10 @@ public:
{ {
return m_UseHleGfx; return m_UseHleGfx;
} }
inline static bool bFPURegCaching(void)
{
return m_FPURegCaching;
}
inline static bool bRegCaching(void) inline static bool bRegCaching(void)
{ {
return m_RegCaching; return m_RegCaching;
@ -140,6 +144,7 @@ private:
// Settings that can be changed on the fly // Settings that can be changed on the fly
static bool m_UseHleGfx; static bool m_UseHleGfx;
static bool m_RegCaching; static bool m_RegCaching;
static bool m_FPURegCaching;
static bool m_bLinkBlocks; static bool m_bLinkBlocks;
static uint32_t m_LookUpMode; //FUNC_LOOKUP_METHOD static uint32_t m_LookUpMode; //FUNC_LOOKUP_METHOD
static uint32_t m_CountPerOp; static uint32_t m_CountPerOp;

View File

@ -97,6 +97,7 @@ enum SettingID
Rdb_ScreenHertz, Rdb_ScreenHertz,
Rdb_FuncLookupMode, Rdb_FuncLookupMode,
Rdb_RegCache, Rdb_RegCache,
Rdb_FpuRegCache,
Rdb_BlockLinking, Rdb_BlockLinking,
Rdb_SMM_StoreInstruc, Rdb_SMM_StoreInstruc,
Rdb_SMM_Cache, Rdb_SMM_Cache,
@ -152,6 +153,7 @@ enum SettingID
Game_FastSP, Game_FastSP,
Game_FuncLookupMode, Game_FuncLookupMode,
Game_RegCache, Game_RegCache,
Game_FPURegCache,
Game_BlockLinking, Game_BlockLinking,
Game_ScreenHertz, Game_ScreenHertz,
Game_RspAudioSignal, Game_RspAudioSignal,

View File

@ -15,6 +15,7 @@ CGameRecompilePage::CGameRecompilePage(HWND hParent, const RECT & rcDispay)
SetDlgItemText(IDC_FUNCFIND_TEXT, wGS(ROM_FUNC_FIND).c_str()); SetDlgItemText(IDC_FUNCFIND_TEXT, wGS(ROM_FUNC_FIND).c_str());
SetDlgItemText(IDC_ROM_REGCACHE, wGS(ROM_REG_CACHE).c_str()); SetDlgItemText(IDC_ROM_REGCACHE, wGS(ROM_REG_CACHE).c_str());
SetDlgItemText(IDC_ROM_FPUREGCACHE, wGS(ROM_FPU_REG_CACHE).c_str());
SetDlgItemText(IDC_BLOCK_LINKING, wGS(ADVANCE_ABL).c_str()); SetDlgItemText(IDC_BLOCK_LINKING, wGS(ADVANCE_ABL).c_str());
SetDlgItemText(IDC_ROM_FASTSP, wGS(ROM_FAST_SP).c_str()); SetDlgItemText(IDC_ROM_FASTSP, wGS(ROM_FAST_SP).c_str());
SetDlgItemText(IDC_ROM_32BIT, wGS(ROM_32BIT).c_str()); SetDlgItemText(IDC_ROM_32BIT, wGS(ROM_32BIT).c_str());
@ -29,6 +30,7 @@ CGameRecompilePage::CGameRecompilePage(HWND hParent, const RECT & rcDispay)
m_SelfModGroup.Attach(GetDlgItem(IDC_SMM_FRAME)); m_SelfModGroup.Attach(GetDlgItem(IDC_SMM_FRAME));
AddModCheckBox(GetDlgItem(IDC_ROM_REGCACHE), Game_RegCache); AddModCheckBox(GetDlgItem(IDC_ROM_REGCACHE), Game_RegCache);
AddModCheckBox(GetDlgItem(IDC_ROM_FPUREGCACHE), Game_RegCache);
AddModCheckBox(GetDlgItem(IDC_BLOCK_LINKING), Game_BlockLinking); AddModCheckBox(GetDlgItem(IDC_BLOCK_LINKING), Game_BlockLinking);
AddModCheckBox(GetDlgItem(IDC_SMM_CACHE), Game_SMM_Cache); AddModCheckBox(GetDlgItem(IDC_SMM_CACHE), Game_SMM_Cache);
AddModCheckBox(GetDlgItem(IDC_SMM_DMA), Game_SMM_PIDMA); AddModCheckBox(GetDlgItem(IDC_SMM_DMA), Game_SMM_PIDMA);

View File

@ -567,15 +567,16 @@ BEGIN
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,6,42,208,1 CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,6,42,208,1
CONTROL "Register caching",IDC_ROM_REGCACHE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,49,95,10 CONTROL "Register caching",IDC_ROM_REGCACHE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,49,95,10
CONTROL "Advanced Block Linking",IDC_BLOCK_LINKING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,113,49,95,10 CONTROL "Advanced Block Linking",IDC_BLOCK_LINKING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,113,49,95,10
CONTROL "Fast SP",IDC_ROM_FASTSP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,62,91,10 CONTROL "Fast SP",IDC_ROM_FASTSP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,75,91,10
CONTROL "32 Bit Engine",IDC_ROM_32BIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,113,62,95,10 CONTROL "32 Bit Engine",IDC_ROM_32BIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,113,62,95,10
GROUPBOX "Self Mod Methods",IDC_SMM_FRAME,4,79,208,54 GROUPBOX "Self Mod Methods",IDC_SMM_FRAME,4,87,208,54
CONTROL "Cache",IDC_SMM_CACHE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,91,89,10 CONTROL "Cache",IDC_SMM_CACHE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,99,89,10
CONTROL "Store Instruction",IDC_SMM_STORE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,116,91,89,10 CONTROL "Store Instruction",IDC_SMM_STORE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,116,99,89,10
CONTROL "PI DMA",IDC_SMM_DMA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,103,89,10 CONTROL "PI DMA",IDC_SMM_DMA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,111,89,10
CONTROL "TLB Unmapping",IDC_SMM_TLB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,116,103,89,10 CONTROL "TLB Unmapping",IDC_SMM_TLB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,116,111,89,10
CONTROL "Start Changed",IDC_SMM_VALIDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,115,89,10 CONTROL "Start Changed",IDC_SMM_VALIDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,123,89,10
CONTROL "Protect Memory",IDC_SMM_PROTECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,116,115,89,10 CONTROL "Protect Memory",IDC_SMM_PROTECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,116,123,89,10
CONTROL "FPU Register caching",IDC_ROM_FPUREGCACHE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,62,95,10
END END
IDD_Settings_GamePlugin DIALOGEX 0, 0, 231, 206 IDD_Settings_GamePlugin DIALOGEX 0, 0, 231, 206

View File

@ -252,6 +252,7 @@
#define IDC_CONT_NAME 1100 #define IDC_CONT_NAME 1100
#define IDC_COUNTPERBYTE 1100 #define IDC_COUNTPERBYTE 1100
#define ID_SUPPORT_PJ64 1100 #define ID_SUPPORT_PJ64 1100
#define IDC_ROM_FPUREGCACHE 1100
#define IDC_DIR_FRAME1 1101 #define IDC_DIR_FRAME1 1101
#define IDC_ROM_FASTSP 1101 #define IDC_ROM_FASTSP 1101
#define IDC_INFO 1101 #define IDC_INFO 1101