2016-01-27 09:11:59 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
#include <Project64-core/N64System/SystemGlobals.h>
|
2021-04-14 05:34:15 +00:00
|
|
|
#include <Project64-core/N64System/N64System.h>
|
2016-01-27 09:11:59 +00:00
|
|
|
#include <Project64-core/Settings/GameSettings.h>
|
|
|
|
|
2017-08-30 22:58:26 +00:00
|
|
|
bool CGameSettings::m_UseHleGfx = true;
|
2017-06-15 11:09:49 +00:00
|
|
|
bool CGameSettings::m_bSMM_StoreInstruc;
|
|
|
|
bool CGameSettings::m_bSMM_Protect;
|
|
|
|
bool CGameSettings::m_bSMM_ValidFunc;
|
|
|
|
bool CGameSettings::m_bSMM_PIDMA;
|
|
|
|
bool CGameSettings::m_bSMM_TLB;
|
2016-01-27 09:11:59 +00:00
|
|
|
uint32_t CGameSettings::m_CountPerOp = 2;
|
|
|
|
uint32_t CGameSettings::m_ViRefreshRate = 1500;
|
|
|
|
uint32_t CGameSettings::m_AiCountPerBytes = 500;
|
2017-06-15 11:09:49 +00:00
|
|
|
bool CGameSettings::m_DelayDP = false;
|
|
|
|
bool CGameSettings::m_DelaySI = false;
|
2019-10-02 22:18:19 +00:00
|
|
|
bool CGameSettings::m_bRandomizeSIPIInterrupts = true;
|
2016-01-27 09:11:59 +00:00
|
|
|
uint32_t CGameSettings::m_RdramSize = 0;
|
2017-06-15 11:09:49 +00:00
|
|
|
bool CGameSettings::m_bFixedAudio = true;
|
|
|
|
bool CGameSettings::m_bSyncToAudio = true;
|
2017-09-28 11:43:58 +00:00
|
|
|
bool CGameSettings::m_FullSpeed = true;
|
2017-06-15 11:09:49 +00:00
|
|
|
bool CGameSettings::m_bFastSP = true;
|
|
|
|
bool CGameSettings::m_b32Bit = true;
|
|
|
|
bool CGameSettings::m_RspAudioSignal;
|
|
|
|
bool CGameSettings::m_RegCaching;
|
|
|
|
bool CGameSettings::m_bLinkBlocks;
|
2016-01-27 09:11:59 +00:00
|
|
|
uint32_t CGameSettings::m_LookUpMode; //FUNC_LOOKUP_METHOD
|
|
|
|
SYSTEM_TYPE CGameSettings::m_SystemType = SYSTEM_NTSC;
|
|
|
|
CPU_TYPE CGameSettings::m_CpuType = CPU_Recompiler;
|
2017-06-15 11:09:49 +00:00
|
|
|
uint32_t CGameSettings::m_OverClockModifier = 1;
|
2021-01-29 23:29:09 +00:00
|
|
|
DISK_SEEK_TYPE CGameSettings::m_DiskSeekTimingType = DiskSeek_Turbo;
|
2021-03-10 07:39:01 +00:00
|
|
|
bool CGameSettings::m_EnhancmentOverClock = false;
|
|
|
|
uint32_t CGameSettings::m_EnhancmentOverClockModifier = 1;
|
2022-01-03 23:37:52 +00:00
|
|
|
bool CGameSettings::m_EnableDisk = false;
|
|
|
|
|
|
|
|
int32_t CGameSettings::m_RefCount = 0;
|
|
|
|
|
|
|
|
CGameSettings::CGameSettings()
|
|
|
|
{
|
|
|
|
m_RefCount += 1;
|
|
|
|
if (m_RefCount == 1)
|
|
|
|
{
|
|
|
|
g_Settings->RegisterChangeCB(Setting_EnableDisk, nullptr, EnableDiskChanged);
|
|
|
|
EnableDiskChanged(nullptr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CGameSettings::~CGameSettings()
|
|
|
|
{
|
|
|
|
m_RefCount -= 1;
|
|
|
|
if (m_RefCount == 0)
|
|
|
|
{
|
|
|
|
g_Settings->RegisterChangeCB(Setting_EnableDisk, nullptr, EnableDiskChanged);
|
|
|
|
}
|
|
|
|
}
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
void CGameSettings::RefreshGameSettings()
|
|
|
|
{
|
2016-09-26 11:10:11 +00:00
|
|
|
WriteTrace(TraceN64System, TraceDebug, "start");
|
2017-08-30 22:58:26 +00:00
|
|
|
m_UseHleGfx = g_Settings->LoadBool(Game_UseHleGfx);
|
2022-06-06 02:11:09 +00:00
|
|
|
m_bSMM_StoreInstruc = g_Settings->LoadBool(Game_SMM_StoreInstruc);
|
2016-01-27 09:11:59 +00:00
|
|
|
m_bSMM_Protect = g_Settings->LoadBool(Game_SMM_Protect);
|
|
|
|
m_bSMM_ValidFunc = g_Settings->LoadBool(Game_SMM_ValidFunc);
|
|
|
|
m_bSMM_PIDMA = g_Settings->LoadBool(Game_SMM_PIDMA);
|
|
|
|
m_bSMM_TLB = g_Settings->LoadBool(Game_SMM_TLB);
|
|
|
|
m_ViRefreshRate = g_Settings->LoadDword(Game_ViRefreshRate);
|
|
|
|
m_AiCountPerBytes = g_Settings->LoadDword(Game_AiCountPerBytes);
|
|
|
|
m_CountPerOp = g_Settings->LoadDword(Game_CounterFactor);
|
|
|
|
m_RdramSize = g_Settings->LoadDword(Game_RDRamSize);
|
|
|
|
m_DelaySI = g_Settings->LoadBool(Game_DelaySI);
|
2019-10-02 22:18:19 +00:00
|
|
|
m_bRandomizeSIPIInterrupts = g_Settings->LoadBool(Game_RandomizeSIPIInterrupts);
|
2016-01-27 09:11:59 +00:00
|
|
|
m_DelayDP = g_Settings->LoadBool(Game_DelayDP);
|
|
|
|
m_bFixedAudio = g_Settings->LoadBool(Game_FixedAudio);
|
2017-09-28 11:43:58 +00:00
|
|
|
m_FullSpeed = g_Settings->LoadBool(Game_FullSpeed);
|
2016-01-27 09:11:59 +00:00
|
|
|
m_b32Bit = g_Settings->LoadBool(Game_32Bit);
|
2016-08-07 06:59:33 +00:00
|
|
|
#ifdef ANDROID
|
|
|
|
m_bFastSP = false;
|
|
|
|
#else
|
2016-01-27 09:11:59 +00:00
|
|
|
m_bFastSP = g_Settings->LoadBool(Game_FastSP);
|
2016-08-07 06:59:33 +00:00
|
|
|
#endif
|
2016-01-27 09:11:59 +00:00
|
|
|
m_RspAudioSignal = g_Settings->LoadBool(Game_RspAudioSignal);
|
|
|
|
m_RegCaching = g_Settings->LoadBool(Game_RegCache);
|
|
|
|
m_bLinkBlocks = g_Settings->LoadBool(Game_BlockLinking);
|
|
|
|
m_LookUpMode = g_Settings->LoadDword(Game_FuncLookupMode);
|
|
|
|
m_SystemType = (SYSTEM_TYPE)g_Settings->LoadDword(Game_SystemType);
|
|
|
|
m_CpuType = (CPU_TYPE)g_Settings->LoadDword(Game_CpuType);
|
2019-04-20 03:43:30 +00:00
|
|
|
m_OverClockModifier = g_Settings->LoadDword(Game_OverClockModifier);
|
2016-01-27 09:11:59 +00:00
|
|
|
if (m_CountPerOp == 0)
|
|
|
|
{
|
|
|
|
m_CountPerOp = 2;
|
|
|
|
}
|
2019-01-11 22:50:25 +00:00
|
|
|
if (m_OverClockModifier < 1) { m_OverClockModifier = 1; }
|
2017-06-15 11:09:49 +00:00
|
|
|
if (m_OverClockModifier > 20) { m_OverClockModifier = 20; }
|
2021-01-29 23:29:09 +00:00
|
|
|
m_DiskSeekTimingType = (DISK_SEEK_TYPE)g_Settings->LoadDword(Game_DiskSeekTiming);
|
2018-12-20 10:19:14 +00:00
|
|
|
RefreshSyncToAudio();
|
2016-09-26 11:10:11 +00:00
|
|
|
WriteTrace(TraceN64System, TraceDebug, "Done");
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CGameSettings::SpeedChanged(int SpeedLimit)
|
|
|
|
{
|
2017-09-28 11:43:58 +00:00
|
|
|
m_FullSpeed = (g_System->m_SystemType == SYSTEM_PAL ? 50 : 60) == SpeedLimit;
|
|
|
|
g_Settings->SaveBool(Game_FullSpeed, m_FullSpeed);
|
2018-12-20 10:19:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CGameSettings::RefreshSyncToAudio(void)
|
|
|
|
{
|
2021-02-02 01:31:45 +00:00
|
|
|
m_bSyncToAudio = g_Settings->LoadBool(Game_SyncViaAudio) && g_Settings->LoadBool(Setting_SyncViaAudioEnabled) && g_Settings->LoadBool(Plugin_EnableAudio);
|
2018-12-20 10:19:14 +00:00
|
|
|
}
|
2021-03-10 07:39:01 +00:00
|
|
|
|
|
|
|
void CGameSettings::SetOverClockModifier(bool EnhancmentOverClock, uint32_t EnhancmentOverClockModifier)
|
|
|
|
{
|
|
|
|
m_EnhancmentOverClock = EnhancmentOverClock;
|
|
|
|
m_EnhancmentOverClockModifier = EnhancmentOverClockModifier;
|
|
|
|
|
|
|
|
if (m_EnhancmentOverClock)
|
|
|
|
{
|
|
|
|
m_OverClockModifier = m_EnhancmentOverClockModifier;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_OverClockModifier = g_Settings->LoadDword(Game_OverClockModifier);
|
|
|
|
}
|
|
|
|
if (m_OverClockModifier < 1) { m_OverClockModifier = 1; }
|
|
|
|
if (m_OverClockModifier > 20) { m_OverClockModifier = 20; }
|
2022-01-03 23:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CGameSettings::EnableDiskChanged(void *)
|
|
|
|
{
|
|
|
|
m_EnableDisk = g_Settings->LoadBool(Setting_EnableDisk);
|
|
|
|
}
|