Project64-core: Make Setting_EnableDisk be a setting in GameSettings
This commit is contained in:
parent
219b9149d6
commit
09f90d9b53
|
@ -1453,7 +1453,7 @@ void CMipsMemoryVM::Load32CartridgeDomain1Address3(void)
|
|||
void CMipsMemoryVM::Load32CartridgeDomain2Address1(void)
|
||||
{
|
||||
// 64DD registers
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk))
|
||||
if (EnableDisk())
|
||||
{
|
||||
switch (m_MemLookupAddress & 0x1FFFFFFF)
|
||||
{
|
||||
|
@ -2050,7 +2050,7 @@ void CMipsMemoryVM::Write32PeripheralInterface(void)
|
|||
case 0x04600000: g_Reg->PI_DRAM_ADDR_REG = m_MemLookupValue.UW[0]; break;
|
||||
case 0x04600004:
|
||||
g_Reg->PI_CART_ADDR_REG = m_MemLookupValue.UW[0];
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk))
|
||||
if (EnableDisk())
|
||||
{
|
||||
DiskDMACheck();
|
||||
}
|
||||
|
@ -2139,7 +2139,7 @@ void CMipsMemoryVM::Write32SerialInterface(void)
|
|||
void CMipsMemoryVM::Write32CartridgeDomain2Address1(void)
|
||||
{
|
||||
// 64DD registers
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk))
|
||||
if (EnableDisk())
|
||||
{
|
||||
switch (m_MemLookupAddress & 0xFFFFFFF)
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <Project64-core/N64System/Mips/FlashRam.h>
|
||||
#include <Project64-core/N64System/Mips/Sram.h>
|
||||
#include <Project64-core/N64System/Mips/Dma.h>
|
||||
#include <Project64-core\Settings\GameSettings.h>
|
||||
|
||||
#ifdef __arm__
|
||||
#include <sys/ucontext.h>
|
||||
|
@ -40,7 +41,8 @@ class CMipsMemoryVM :
|
|||
private CPifRam,
|
||||
private CFlashram,
|
||||
private CSram,
|
||||
private CDMA
|
||||
private CDMA,
|
||||
private CGameSettings
|
||||
{
|
||||
public:
|
||||
CMipsMemoryVM(bool SavesReadOnly);
|
||||
|
|
|
@ -499,12 +499,18 @@ bool CN64System::RunFileImage(const char * FileLoc)
|
|||
if (g_Rom->IsLoadedRomDDIPL())
|
||||
{
|
||||
if (g_Rom->CicChipID() == CIC_NUS_8303)
|
||||
{
|
||||
g_Settings->SaveString(File_DiskIPLPath, FileLoc);
|
||||
}
|
||||
else if (g_Rom->CicChipID() == CIC_NUS_DDUS)
|
||||
{
|
||||
g_Settings->SaveString(File_DiskIPLUSAPath, FileLoc);
|
||||
}
|
||||
else if (g_Rom->CicChipID() == CIC_NUS_8401)
|
||||
{
|
||||
g_Settings->SaveString(File_DiskIPLTOOLPath, FileLoc);
|
||||
}
|
||||
}
|
||||
RunLoadedImage();
|
||||
return true;
|
||||
}
|
||||
|
@ -1762,7 +1768,7 @@ bool CN64System::SaveState()
|
|||
zipOpenNewFileInZip(file, SaveFile.GetNameExtension().c_str(), nullptr, nullptr, 0, nullptr, 0, nullptr, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
|
||||
zipWriteInFileInZip(file, &SaveID_0, sizeof(SaveID_0));
|
||||
zipWriteInFileInZip(file, &RdramSize, sizeof(uint32_t));
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk) && g_Disk)
|
||||
if (EnableDisk() && g_Disk)
|
||||
{
|
||||
// Keep base ROM information (64DD IPL / compatible game ROM)
|
||||
zipWriteInFileInZip(file, &g_Rom->GetRomAddress()[0x10], 0x20);
|
||||
|
@ -1832,7 +1838,7 @@ bool CN64System::SaveState()
|
|||
hSaveFile.SeekToBegin();
|
||||
hSaveFile.Write(&SaveID_0, sizeof(uint32_t));
|
||||
hSaveFile.Write(&RdramSize, sizeof(uint32_t));
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk) && g_Disk)
|
||||
if (EnableDisk() && g_Disk)
|
||||
{
|
||||
// Keep base ROM information (64DD IPL / compatible game ROM)
|
||||
hSaveFile.Write(&g_Rom->GetRomAddress()[0x10], 0x20);
|
||||
|
@ -2013,7 +2019,7 @@ bool CN64System::LoadState(const char * FileName)
|
|||
|
||||
uint8_t LoadHeader[64];
|
||||
unzReadCurrentFile(file, LoadHeader, 0x40);
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk) && g_Disk)
|
||||
if (EnableDisk() && g_Disk)
|
||||
{
|
||||
// Base ROM information (64DD IPL / compatible game ROM) and disk info check
|
||||
if ((memcmp(LoadHeader, &g_Rom->GetRomAddress()[0x10], 0x20) != 0 ||
|
||||
|
@ -2108,7 +2114,7 @@ bool CN64System::LoadState(const char * FileName)
|
|||
// Check header
|
||||
uint8_t LoadHeader[64];
|
||||
hSaveFile.Read(LoadHeader, 0x40);
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk) && g_Disk)
|
||||
if (EnableDisk() && g_Disk)
|
||||
{
|
||||
// Base ROM information (64DD IPL / compatible game ROM) and disk info check
|
||||
if ((memcmp(LoadHeader, &g_Rom->GetRomAddress()[0x10], 0x20) != 0 ||
|
||||
|
|
|
@ -6547,7 +6547,7 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
|||
break;
|
||||
case 0x05000000:
|
||||
// 64DD registers
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk))
|
||||
if (EnableDisk())
|
||||
{
|
||||
switch (PAddr)
|
||||
{
|
||||
|
@ -6874,7 +6874,7 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
|
|||
case 0x04600000: MoveArmRegToVariable(Reg, &g_Reg->PI_DRAM_ADDR_REG, "PI_DRAM_ADDR_REG"); break;
|
||||
case 0x04600004:
|
||||
MoveArmRegToVariable(Reg, &g_Reg->PI_CART_ADDR_REG, "PI_CART_ADDR_REG");
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk))
|
||||
if (EnableDisk())
|
||||
{
|
||||
m_RegWorkingSet.BeforeCallDirect();
|
||||
CallFunction(AddressOf(&DiskDMACheck), "DiskDMACheck");
|
||||
|
@ -7003,7 +7003,7 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
|
|||
break;
|
||||
case 0x05000000:
|
||||
// 64DD registers
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk))
|
||||
if (EnableDisk())
|
||||
{
|
||||
switch (PAddr)
|
||||
{
|
||||
|
@ -7324,7 +7324,7 @@ void CArmRecompilerOps::LW_KnownAddress(ArmReg Reg, uint32_t VAddr)
|
|||
break;
|
||||
case 0x05000000:
|
||||
// 64DD registers
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk))
|
||||
if (EnableDisk())
|
||||
{
|
||||
switch (PAddr)
|
||||
{
|
||||
|
|
|
@ -3,11 +3,13 @@
|
|||
#include <Project64-core/N64System/Mips/Register.h>
|
||||
#include <Project64-core/N64System/Recompiler/RecompilerOps.h>
|
||||
#include <Project64-core/N64System/Recompiler/Arm/ArmOps.h>
|
||||
#include <Project64-core\Settings\GameSettings.h>
|
||||
|
||||
class CArmRecompilerOps :
|
||||
public CRecompilerOps,
|
||||
private CArmOps,
|
||||
protected CSystemRegisters
|
||||
protected CSystemRegisters,
|
||||
private CGameSettings
|
||||
{
|
||||
public:
|
||||
CArmRecompilerOps();
|
||||
|
|
|
@ -3443,7 +3443,7 @@ void CX86RecompilerOps::LW_KnownAddress(x86Reg Reg, uint32_t VAddr)
|
|||
break;
|
||||
case 0x05000000:
|
||||
// 64DD registers
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk))
|
||||
if (EnableDisk())
|
||||
{
|
||||
switch (PAddr)
|
||||
{
|
||||
|
@ -11261,7 +11261,7 @@ void CX86RecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
|||
break;
|
||||
case 0x05000000:
|
||||
// 64DD registers
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk))
|
||||
if (EnableDisk())
|
||||
{
|
||||
switch (PAddr)
|
||||
{
|
||||
|
@ -11603,7 +11603,7 @@ void CX86RecompilerOps::SW_Register(x86Reg Reg, uint32_t VAddr)
|
|||
case 0x04600000: MoveX86regToVariable(Reg, &g_Reg->PI_DRAM_ADDR_REG, "PI_DRAM_ADDR_REG"); break;
|
||||
case 0x04600004:
|
||||
MoveX86regToVariable(Reg, &g_Reg->PI_CART_ADDR_REG, "PI_CART_ADDR_REG");
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk))
|
||||
if (EnableDisk())
|
||||
{
|
||||
m_RegWorkingSet.BeforeCallDirect();
|
||||
Call_Direct(AddressOf(&DiskDMACheck), "DiskDMACheck");
|
||||
|
@ -11763,7 +11763,7 @@ void CX86RecompilerOps::SW_Register(x86Reg Reg, uint32_t VAddr)
|
|||
break;
|
||||
case 0x05000000:
|
||||
// 64DD registers
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk))
|
||||
if (EnableDisk())
|
||||
{
|
||||
switch (PAddr)
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <Project64-core/N64System/Interpreter/InterpreterOps.h>
|
||||
#include <Project64-core/Settings/N64SystemSettings.h>
|
||||
#include <Project64-core/Settings/RecompilerSettings.h>
|
||||
#include <Project64-core\Settings\GameSettings.h>
|
||||
|
||||
class CCodeBlock;
|
||||
class CCodeSection;
|
||||
|
@ -20,7 +21,8 @@ class CX86RecompilerOps :
|
|||
protected R4300iOp,
|
||||
protected CX86Ops,
|
||||
protected CN64SystemSettings,
|
||||
protected CRecompilerSettings
|
||||
protected CRecompilerSettings,
|
||||
private CGameSettings
|
||||
{
|
||||
public:
|
||||
// Trap functions
|
||||
|
|
|
@ -33,6 +33,28 @@ uint32_t CGameSettings::m_OverClockModifier = 1;
|
|||
DISK_SEEK_TYPE CGameSettings::m_DiskSeekTimingType = DiskSeek_Turbo;
|
||||
bool CGameSettings::m_EnhancmentOverClock = false;
|
||||
uint32_t CGameSettings::m_EnhancmentOverClockModifier = 1;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void CGameSettings::RefreshGameSettings()
|
||||
{
|
||||
|
@ -105,3 +127,8 @@ void CGameSettings::SetOverClockModifier(bool EnhancmentOverClock, uint32_t Enha
|
|||
if (m_OverClockModifier < 1) { m_OverClockModifier = 1; }
|
||||
if (m_OverClockModifier > 20) { m_OverClockModifier = 20; }
|
||||
}
|
||||
|
||||
void CGameSettings::EnableDiskChanged(void *)
|
||||
{
|
||||
m_EnableDisk = g_Settings->LoadBool(Setting_EnableDisk);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
class CGameSettings
|
||||
{
|
||||
public:
|
||||
CGameSettings();
|
||||
virtual ~CGameSettings();
|
||||
|
||||
void RefreshGameSettings(void);
|
||||
|
||||
inline static bool UseHleGfx(void) { return m_UseHleGfx; }
|
||||
|
@ -36,14 +39,21 @@ public:
|
|||
inline static CPU_TYPE CpuType(void) { return m_CpuType; }
|
||||
inline static uint32_t OverClockModifier(void) { return m_OverClockModifier; }
|
||||
inline static DISK_SEEK_TYPE DiskSeekTimingType(void) { return m_DiskSeekTimingType; };
|
||||
inline static bool EnableDisk(void) { return m_EnableDisk; }
|
||||
|
||||
void RefreshSyncToAudio(void);
|
||||
static void SetOverClockModifier(bool EnhancmentOverClock, uint32_t EnhancmentOverClockModifier);
|
||||
|
||||
protected:
|
||||
static void SpeedChanged(int32_t SpeedLimit);
|
||||
static void EnableDiskChanged(void);
|
||||
|
||||
private:
|
||||
CGameSettings(const CGameSettings&);
|
||||
CGameSettings& operator=(const CGameSettings&);
|
||||
|
||||
static void EnableDiskChanged(void *);
|
||||
|
||||
// Settings that can be changed on the fly
|
||||
static bool m_UseHleGfx;
|
||||
static bool m_bRomInMemory;
|
||||
|
@ -75,4 +85,6 @@ private:
|
|||
static DISK_SEEK_TYPE m_DiskSeekTimingType;
|
||||
static bool m_EnhancmentOverClock;
|
||||
static uint32_t m_EnhancmentOverClockModifier;
|
||||
static bool m_EnableDisk;
|
||||
static int32_t m_RefCount;
|
||||
};
|
||||
|
|
|
@ -814,10 +814,14 @@ void CRomBrowser::RomList_OpenRom(uint32_t /*pnmh*/)
|
|||
}
|
||||
|
||||
if ((CPath(pRomInfo->szFullFileName).GetExtension() != "ndd") && (CPath(pRomInfo->szFullFileName).GetExtension() != "d64"))
|
||||
{
|
||||
CN64System::RunFileImage(pRomInfo->szFullFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
CN64System::RunDiskImage(pRomInfo->szFullFileName);
|
||||
}
|
||||
}
|
||||
|
||||
void CRomBrowser::RomList_PopupMenu(uint32_t /*pnmh*/)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue