Core: Add RomMemoryHandler

This commit is contained in:
zilmar 2022-04-18 20:57:59 +09:30
parent d976aaf22b
commit 653e15a296
20 changed files with 194 additions and 168 deletions

View File

@ -2493,7 +2493,6 @@ Clear Frame=2
Culling=1
FuncFind=2
RDRAM Size=4
Rom In Memory=1
SMM-Cache=0
SMM-FUNC=0
SMM-PI DMA=0

View File

@ -103,7 +103,6 @@ CJniBridegSettings::CJniBridegSettings()
ADD_SETTING(Rdb_TLB_PAddrStart);
ADD_SETTING(Rdb_UseHleGfx);
ADD_SETTING(Rdb_UseHleAudio);
ADD_SETTING(Rdb_LoadRomToMemory);
ADD_SETTING(Rdb_ScreenHertz);
ADD_SETTING(Rdb_FuncLookupMode);
ADD_SETTING(Rdb_RegCache);
@ -166,7 +165,6 @@ CJniBridegSettings::CJniBridegSettings()
ADD_SETTING(Game_RspAudioSignal);
ADD_SETTING(Game_UseHleGfx);
ADD_SETTING(Game_UseHleAudio);
ADD_SETTING(Game_LoadRomToMemory);
ADD_SETTING(Game_ViRefreshRate);
ADD_SETTING(Game_AiCountPerBytes);
ADD_SETTING(Game_AudioResetOnLoad);

View File

@ -42,7 +42,8 @@ void CLogging::Log_LW(uint32_t PC, uint32_t VAddr)
(VAddr >= 0xA4400000 && VAddr <= 0xA4400034) ||
(VAddr >= 0xA4500000 && VAddr <= 0xA4500014) ||
(VAddr == 0xA4800000 && VAddr <= 0xA4800018) ||
(VAddr >= 0xBFC00000 && VAddr <= 0xBFC007C0))
(VAddr >= 0xBFC00000 && VAddr <= 0xBFC007C0) ||
(VAddr >= 0xB0000000 && ((VAddr - 0xB0000000) < g_Rom->GetRomSize())))
{
return;
}
@ -56,29 +57,6 @@ void CLogging::Log_LW(uint32_t PC, uint32_t VAddr)
LogMessage("%08X: read word from PIF RAM at 0x%X (%08X)", PC, VAddr - 0xBFC007C0, Value);
return;
}
if (VAddr >= 0xB0000040 && ((VAddr - 0xB0000000) < g_Rom->GetRomSize()))
{
return;
}
if (VAddr >= 0xB0000000 && VAddr < 0xB0000040)
{
if (!LogRomHeader())
{
return;
}
g_MMU->LW_VAddr(VAddr, Value);
switch (VAddr)
{
case 0xB0000004: LogMessage("%08X: read from ROM clock rate (%08X)", PC, Value); break;
case 0xB0000008: LogMessage("%08X: read from ROM boot address offset (%08X)", PC, Value); break;
case 0xB000000C: LogMessage("%08X: read from ROM release offset (%08X)", PC, Value); break;
case 0xB0000010: LogMessage("%08X: read from ROM CRC1 (%08X)", PC, Value); break;
case 0xB0000014: LogMessage("%08X: read from ROM CRC2 (%08X)", PC, Value); break;
default: LogMessage("%08X: read from ROM header 0x%X (%08X)", PC, VAddr & 0xFF, Value); break;
}
return;
}
if (!LogUnknown())
{
return;

View File

@ -0,0 +1,69 @@
#include "stdafx.h"
#include "RomMemoryHandler.h"
#include <Project64-core\N64System\N64System.h>
#include <Project64-core\N64System\Mips\Register.h>
#include <Project64-core\N64System\N64Rom.h>
RomMemoryHandler::RomMemoryHandler(CN64System & System, CRegisters & Reg, CN64Rom & Rom) :
m_PC(Reg.m_PROGRAM_COUNTER),
m_Rom(Rom),
m_RomWrittenTo(false),
m_RomWroteValue(0)
{
System.RegisterCallBack(CN64SystemCB_Reset, this, (CN64System::CallBackFunction)stSystemReset);
System.RegisterCallBack(CN64SystemCB_LoadedGameState, this, (CN64System::CallBackFunction)stLoadedGameState);
}
bool RomMemoryHandler::Read32(uint32_t Address, uint32_t & Value)
{
if (m_RomWrittenTo)
{
Value = m_RomWroteValue;
//LogMessage("%X: Read crap from ROM %08X from %08X",PROGRAM_COUNTER,*Value,PAddr);
m_RomWrittenTo = false;
}
else if ((Address & 0xFFFFFFF) < m_Rom.GetRomSize())
{
Value = *(uint32_t *)&m_Rom.GetRomAddress()[(Address & 0xFFFFFFF)];
}
else
{
Value = (Address << 16) | (Address & 0xFFFF);
}
if (LogRomHeader() && (Address & 0x1FFFFFFF) >= 0x10000000 && (Address & 0x1FFFFFFF) < 0x10000040)
{
switch (Address & 0x1FFFFFFF)
{
case 0x10000004: LogMessage("%08X: read from ROM clock rate (%08X)", m_PC, Value); break;
case 0x10000008: LogMessage("%08X: read from ROM boot address offset (%08X)", m_PC, Value); break;
case 0x1000000C: LogMessage("%08X: read from ROM release offset (%08X)", m_PC, Value); break;
case 0x10000010: LogMessage("%08X: read from ROM CRC1 (%08X)", m_PC, Value); break;
case 0x10000014: LogMessage("%08X: read from ROM CRC2 (%08X)", m_PC, Value); break;
default: LogMessage("%08X: read from ROM header 0x%X (%08X)", m_PC, Address & 0xFF, Value); break;
}
}
return true;
}
bool RomMemoryHandler::Write32(uint32_t Address, uint32_t Value, uint32_t Mask)
{
if (((Address & 0x1FFFFFFF) - 0x10000000) < m_Rom.GetRomSize())
{
m_RomWrittenTo = true;
m_RomWroteValue = (Value & Mask);
}
return true;
}
void RomMemoryHandler::SystemReset(void)
{
m_RomWrittenTo = false;
m_RomWroteValue = 0;
}
void RomMemoryHandler::LoadedGameState(void)
{
m_RomWrittenTo = false;
m_RomWroteValue = 0;
}

View File

@ -0,0 +1,37 @@
#pragma once
#include "MemoryHandler.h"
#include <Project64-core\Settings\DebugSettings.h>
#include <Project64-core\Logging.h>
#include <stdint.h>
class CRegisters;
class CN64Rom;
class CN64System;
class RomMemoryHandler :
public MemoryHandler,
private CDebugSettings,
private CLogging
{
public:
RomMemoryHandler(CN64System & System, CRegisters & Reg, CN64Rom & Rom);
bool Read32(uint32_t Address, uint32_t & Value);
bool Write32(uint32_t Address, uint32_t Value, uint32_t Mask);
private:
RomMemoryHandler();
RomMemoryHandler(const RomMemoryHandler&);
RomMemoryHandler& operator=(const RomMemoryHandler&);
void SystemReset(void);
void LoadedGameState(void);
static void stSystemReset(RomMemoryHandler * _this) { _this->SystemReset(); }
static void stLoadedGameState(RomMemoryHandler * _this) { _this->LoadedGameState(); }
uint32_t & m_PC;
CN64Rom & m_Rom;
bool m_RomWrittenTo;
uint32_t m_RomWroteValue;
};

View File

@ -30,20 +30,16 @@ CMipsMemoryVM::CMipsMemoryVM(CN64System & System, bool SavesReadOnly) :
m_AudioInterfaceHandler(System, System.m_Reg),
m_CartridgeDomain2Address1Handler(System.m_Reg),
m_RDRAMRegistersHandler(System.m_Reg),
m_RomMapped(false),
m_DPCommandRegistersHandler(System, System.GetPlugins(), System.m_Reg),
m_MIPSInterfaceHandler(System.m_Reg),
m_PeripheralInterfaceHandler(*this, System.m_Reg),
m_RDRAMInterfaceHandler(System.m_Reg),
m_RomMemoryHandler(System, System.m_Reg, *g_Rom),
m_SerialInterfaceHandler(*this, System.m_Reg),
m_SPRegistersHandler(System, *this, System.m_Reg),
m_VideoInterfaceHandler(System, *this, System.m_Reg),
m_Rom(nullptr),
m_RomSize(0),
m_MemoryReadMap(nullptr),
m_MemoryWriteMap(nullptr),
m_RomWrittenTo(false),
m_RomWroteValue(0),
m_TLB_ReadMap(nullptr),
m_TLB_WriteMap(nullptr),
m_RDRAM(nullptr),
@ -129,9 +125,9 @@ void CMipsMemoryVM::Reset(bool /*EraseMemory*/)
m_MemoryReadMap[Address >> 12] = ((size_t)m_RDRAM + TargetAddress) - Address;
m_MemoryWriteMap[Address >> 12] = ((size_t)m_RDRAM + TargetAddress) - Address;
}
if (TargetAddress >= 0x10000000 && TargetAddress < (0x10000000 + m_RomSize))
if (TargetAddress >= 0x10000000 && TargetAddress < (0x10000000 + g_Rom->GetRomSize()))
{
m_MemoryReadMap[Address >> 12] = ((size_t)m_Rom + (TargetAddress - 0x10000000)) - Address;
m_MemoryReadMap[Address >> 12] = ((size_t)g_Rom->GetRomAddress() + (TargetAddress - 0x10000000)) - Address;
}
m_TLB_ReadMap[Address >> 12] = ((size_t)m_RDRAM + TargetAddress) - Address;
m_TLB_WriteMap[Address >> 12] = ((size_t)m_RDRAM + TargetAddress) - Address;
@ -207,52 +203,12 @@ bool CMipsMemoryVM::Initialize(bool SyncSystem)
m_DMEM = (uint8_t *)(m_RDRAM + 0x04000000);
m_IMEM = (uint8_t *)(m_RDRAM + 0x04001000);
if (g_Settings->LoadBool(Game_LoadRomToMemory))
{
m_RomMapped = true;
m_Rom = m_RDRAM + 0x10000000;
m_RomSize = g_Rom->GetRomSize();
if (CommitMemory(m_Rom, g_Rom->GetRomSize(), MEM_READWRITE) == nullptr)
{
WriteTrace(TraceN64System, TraceError, "Failed to allocate ROM (Size: 0x%X)", g_Rom->GetRomSize());
FreeMemory();
return false;
}
memcpy(m_Rom, g_Rom->GetRomAddress(), g_Rom->GetRomSize());
::ProtectMemory(m_Rom, g_Rom->GetRomSize(), MEM_READONLY);
}
else
{
m_RomMapped = false;
m_Rom = g_Rom->GetRomAddress();
m_RomSize = g_Rom->GetRomSize();
}
// 64DD IPL
if (g_DDRom != nullptr)
{
if (g_Settings->LoadBool(Game_LoadRomToMemory))
{
m_DDRomMapped = true;
m_DDRom = m_RDRAM + 0x06000000;
m_DDRomSize = g_DDRom->GetRomSize();
if (CommitMemory(m_DDRom, g_DDRom->GetRomSize(), MEM_READWRITE) == nullptr)
{
WriteTrace(TraceN64System, TraceError, "Failed to allocate ROM (Size: 0x%X)", g_DDRom->GetRomSize());
FreeMemory();
return false;
}
memcpy(m_DDRom, g_DDRom->GetRomAddress(), g_DDRom->GetRomSize());
::ProtectMemory(m_DDRom, g_DDRom->GetRomSize(), MEM_READONLY);
}
else
{
m_DDRomMapped = false;
m_DDRom = g_DDRom->GetRomAddress();
m_DDRomSize = g_DDRom->GetRomSize();
}
m_DDRomMapped = false;
m_DDRom = g_DDRom->GetRomAddress();
m_DDRomSize = g_DDRom->GetRomSize();
}
CPifRam::Reset();
@ -557,9 +513,18 @@ bool CMipsMemoryVM::LB_NonMemory(uint32_t PAddr, uint32_t* Value, bool /*SignExt
if (PAddr >= 0x10000000 && PAddr < 0x16000000)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
uint32_t Value32;
if (!m_RomMemoryHandler.Read32(PAddr & ~0x3, Value32))
{
return false;
}
*Value = ((Value32 >> (((PAddr & 3) ^ 3) << 3)) & 0xff);
}
else
{
g_Notify->BreakPoint(__FILE__, __LINE__);
*Value = 0;
}
*Value = 0;
return true;
}
@ -582,31 +547,30 @@ bool CMipsMemoryVM::LH_NonMemory(uint32_t PAddr, uint32_t* Value, bool/* SignExt
bool CMipsMemoryVM::LW_NonMemory(uint32_t PAddr, uint32_t* Value)
{
m_MemLookupAddress = PAddr;
if (PAddr >= 0x10000000 && PAddr < 0x16000000)
switch (PAddr & 0xFFF00000)
{
Load32Rom();
}
else
{
switch (PAddr & 0xFFF00000)
case 0x03F00000: m_RDRAMRegistersHandler.Read32(PAddr, m_MemLookupValue.UW[0]); break;
case 0x04000000: m_SPRegistersHandler.Read32(PAddr, m_MemLookupValue.UW[0]); break;
case 0x04100000: m_DPCommandRegistersHandler.Read32(PAddr, m_MemLookupValue.UW[0]); break;
case 0x04300000: m_MIPSInterfaceHandler.Read32(PAddr, m_MemLookupValue.UW[0]); break;
case 0x04400000: m_VideoInterfaceHandler.Read32(PAddr, m_MemLookupValue.UW[0]); break;
case 0x04500000: m_AudioInterfaceHandler.Read32(PAddr, m_MemLookupValue.UW[0]); break;
case 0x04600000: m_PeripheralInterfaceHandler.Read32(PAddr, m_MemLookupValue.UW[0]); break;
case 0x04700000: m_RDRAMInterfaceHandler.Read32(PAddr, m_MemLookupValue.UW[0]); break;
case 0x04800000: m_SerialInterfaceHandler.Read32(PAddr, m_MemLookupValue.UW[0]); break;
case 0x05000000: m_CartridgeDomain2Address1Handler.Read32(PAddr, m_MemLookupValue.UW[0]); break;
case 0x06000000: Load32CartridgeDomain1Address1(); break;
case 0x08000000: Load32CartridgeDomain2Address2(); break;
case 0x1FC00000: Load32PifRam(); break;
case 0x1FF00000: Load32CartridgeDomain1Address3(); break;
default:
if (PAddr >= 0x10000000 && PAddr < 0x16000000)
{
case 0x03F00000: m_RDRAMRegistersHandler.Read32(PAddr, m_MemLookupValue.UW[0]); break;
case 0x04000000: m_SPRegistersHandler.Read32(PAddr, m_MemLookupValue.UW[0]); break;
case 0x04100000: m_DPCommandRegistersHandler.Read32(PAddr, m_MemLookupValue.UW[0]); break;
case 0x04300000: m_MIPSInterfaceHandler.Read32(PAddr, m_MemLookupValue.UW[0]); break;
case 0x04400000: m_VideoInterfaceHandler.Read32(PAddr, m_MemLookupValue.UW[0]); break;
case 0x04500000: m_AudioInterfaceHandler.Read32(PAddr, m_MemLookupValue.UW[0]); break;
case 0x04600000: m_PeripheralInterfaceHandler.Read32(PAddr, m_MemLookupValue.UW[0]); break;
case 0x04700000: m_RDRAMInterfaceHandler.Read32(PAddr, m_MemLookupValue.UW[0]); break;
case 0x04800000: m_SerialInterfaceHandler.Read32(PAddr, m_MemLookupValue.UW[0]); break;
case 0x05000000: m_CartridgeDomain2Address1Handler.Read32(PAddr, m_MemLookupValue.UW[0]); break;
case 0x06000000: Load32CartridgeDomain1Address1(); break;
case 0x08000000: Load32CartridgeDomain2Address2(); break;
case 0x1FC00000: Load32PifRam(); break;
case 0x1FF00000: Load32CartridgeDomain1Address3(); break;
default:
m_MemLookupValue.UW[0] = PAddr & 0xFFFF;
m_MemLookupValue.UW[0] = (m_MemLookupValue.UW[0] << 16) | m_MemLookupValue.UW[0];
m_RomMemoryHandler.Read32(PAddr, m_MemLookupValue.UW[0]);
}
else
{
m_MemLookupValue.UW[0] = ((PAddr & 0xFFFF) << 16) | PAddr & 0xFFFF;
}
}
*Value = m_MemLookupValue.UW[0];
@ -670,19 +634,6 @@ bool CMipsMemoryVM::SW_NonMemory(uint32_t PAddr, uint32_t Value)
m_MemLookupValue.UW[0] = Value;
m_MemLookupAddress = PAddr;
if (PAddr >= 0x10000000 && PAddr < 0x16000000)
{
if ((PAddr - 0x10000000) < g_Rom->GetRomSize())
{
m_RomWrittenTo = true;
m_RomWroteValue = Value;
}
else
{
return false;
}
}
switch (PAddr & 0xFFF00000)
{
case 0x00000000:
@ -723,6 +674,11 @@ bool CMipsMemoryVM::SW_NonMemory(uint32_t PAddr, uint32_t Value)
case 0x08000000: Write32CartridgeDomain2Address2(); break;
case 0x1FC00000: Write32PifRam(); break;
default:
if (PAddr >= 0x10000000 && PAddr < 0x16000000)
{
m_RomMemoryHandler.Write32(PAddr, Value, 0xFFFFFFFF);
return true;
}
return false;
break;
}
@ -1116,25 +1072,6 @@ void CMipsMemoryVM::Load32PifRam(void)
}
}
void CMipsMemoryVM::Load32Rom(void)
{
if (g_MMU->m_RomWrittenTo)
{
m_MemLookupValue.UW[0] = g_MMU->m_RomWroteValue;
//LogMessage("%X: Read crap from ROM %08X from %08X",PROGRAM_COUNTER,*Value,PAddr);
g_MMU->m_RomWrittenTo = false;
}
else if ((m_MemLookupAddress & 0xFFFFFFF) < g_MMU->m_RomSize)
{
m_MemLookupValue.UW[0] = *(uint32_t *)&g_MMU->m_Rom[(m_MemLookupAddress & 0xFFFFFFF)];
}
else
{
m_MemLookupValue.UW[0] = m_MemLookupAddress & 0xFFFF;
m_MemLookupValue.UW[0] = (m_MemLookupValue.UW[0] << 16) | m_MemLookupValue.UW[0];
}
}
void CMipsMemoryVM::Write32CartridgeDomain2Address2(void)
{
uint32_t offset = (m_MemLookupAddress & 0x1FFFFFFF) - 0x08000000;

View File

@ -7,12 +7,14 @@
#include <Project64-core\N64System\Mips\FlashRam.h>
#include <Project64-core\N64System\Mips\Sram.h>
#include <Project64-core\N64System\Mips\Dma.h>
#include <Project64-core\N64System\MemoryHandler\AudioInterfaceHandler.h>
#include <Project64-core\N64System\MemoryHandler\CartridgeDomain2Address1Handler.h>
#include <Project64-core\N64System\MemoryHandler\DisplayControlRegHandler.h>
#include <Project64-core\N64System\MemoryHandler\MIPSInterfaceHandler.h>
#include <Project64-core\N64System\MemoryHandler\PeripheralInterfaceHandler.h>
#include <Project64-core\N64System\MemoryHandler\RDRAMInterfaceHandler.h>
#include <Project64-core\N64System\MemoryHandler\RDRAMRegistersHandler.h>
#include <Project64-core\N64System\MemoryHandler\RomMemoryHandler.h>
#include <Project64-core\N64System\MemoryHandler\SPRegistersHandler.h>
#include <Project64-core\N64System\MemoryHandler\VideoInterfaceHandler.h>
#include <Project64-core\Settings\GameSettings.h>
@ -66,7 +68,6 @@ public:
uint32_t RdramSize() const { return m_AllocatedRdramSize; }
uint8_t * Dmem() const { return m_DMEM; }
uint8_t * Imem() const { return m_IMEM; }
uint8_t * Rom() const { return m_Rom; }
uint8_t * PifRam() { return &m_PifRam[0]; }
CSram * GetSram();
@ -136,7 +137,6 @@ private:
static void Load32CartridgeDomain1Address3(void);
static void Load32CartridgeDomain2Address2(void);
static void Load32PifRam(void);
static void Load32Rom(void);
static void Write32CartridgeDomain2Address2(void);
static void Write32PifRam(void);
@ -171,6 +171,7 @@ private:
DisplayControlRegHandler m_DPCommandRegistersHandler;
MIPSInterfaceHandler m_MIPSInterfaceHandler;
PeripheralInterfaceHandler m_PeripheralInterfaceHandler;
RomMemoryHandler m_RomMemoryHandler;
RDRAMInterfaceHandler m_RDRAMInterfaceHandler;
RDRAMRegistersHandler m_RDRAMRegistersHandler;
SerialInterfaceHandler m_SerialInterfaceHandler;
@ -178,11 +179,6 @@ private:
VideoInterfaceHandler m_VideoInterfaceHandler;
uint8_t * m_RDRAM, *m_DMEM, *m_IMEM;
uint32_t m_AllocatedRdramSize;
bool m_RomMapped;
uint8_t * m_Rom;
uint32_t m_RomSize;
bool m_RomWrittenTo;
uint32_t m_RomWroteValue;
bool m_DDRomMapped;
uint8_t * m_DDRom;
uint32_t m_DDRomSize;

View File

@ -18,7 +18,7 @@ public:
void SaveRomSettingID(bool temp);
void ClearRomSettingID();
CICChip CicChipID();
uint8_t * GetRomAddress() { return m_ROMImage; }
uint8_t * GetRomAddress() const { return m_ROMImage; }
uint32_t GetRomSize() const { return m_RomFileSize; }
const std::string & GetRomMD5() const { return m_MD5; }
const std::string & GetRomName() const { return m_RomName; }

View File

@ -1325,9 +1325,7 @@ void CN64System::UpdateSyncCPU(CN64System * const SecondCPU, uint32_t const Cycl
if (CyclesToExecute < 0) { return; }
SecondCPU->SetActiveSystem(true);
CInterpreterCPU::ExecuteOps(Cycles);
SetActiveSystem(true);
}

View File

@ -5899,7 +5899,7 @@ void CArmRecompilerOps::UpdateSyncCPU(CRegInfo & RegSet, uint32_t Cycles)
RegSet.AfterCallDirect();
}
void CArmRecompilerOps::UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool ClearValues)
void CArmRecompilerOps::UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool ClearValues, bool /*UpdateTimer*/)
{
if (RegSet.GetBlockCycleCount() != 0)
{

View File

@ -215,7 +215,7 @@ private:
void CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo &ExitRegSet, CExitInfo::EXIT_REASON reason);
void CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo &ExitRegSet, CExitInfo::EXIT_REASON reason, CArmOps::ArmCompareType CompareType);
static void UpdateSyncCPU(CRegInfo & RegSet, uint32_t Cycles);
void UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool ClearValues = false);
void UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool ClearValues = false, bool UpdateTimer = true);
void CompileSystemCheck(uint32_t TargetPC, const CRegInfo & RegSet);
void CompileReadTLBMiss(ArmReg AddressReg, ArmReg LookUpReg);
void CompileWriteTLBMiss(ArmReg AddressReg, ArmReg LookUpReg);

View File

@ -229,7 +229,7 @@ public:
virtual const OPCODE & GetOpcode(void) const = 0;
virtual void PreCompileOpcode(void) = 0;
virtual void PostCompileOpcode(void) = 0;
virtual void UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool ClearValues = false) = 0;
virtual void UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool ClearValues = false, bool UpdateTimer = true) = 0;
virtual void CompileExecuteBP(void) = 0;
virtual void CompileExecuteDelaySlotBP(void) = 0;
};

View File

@ -3421,7 +3421,7 @@ void CX86RecompilerOps::LW_KnownAddress(x86Reg Reg, uint32_t VAddr)
{
// Read from ROM
sprintf(VarName, "Rom + %X", (PAddr - 0x10000000));
MoveVariableToX86reg((PAddr - 0x10000000) + g_MMU->Rom(), VarName, Reg);
MoveVariableToX86reg((PAddr - 0x10000000) + g_Rom->GetRomAddress(), VarName, Reg);
}
else if (g_DDRom != nullptr && ((PAddr & 0xFF000000) == 0x06000000 && (PAddr - 0x06000000) < g_DDRom->GetRomSize()))
{
@ -9089,7 +9089,7 @@ void CX86RecompilerOps::CompileInPermLoop(CRegInfo & RegSet, uint32_t ProgramCou
{
MoveConstToVariable(ProgramCounter, _PROGRAM_COUNTER, "PROGRAM_COUNTER");
RegSet.WriteBackRegisters();
UpdateCounters(RegSet, false, true);
UpdateCounters(RegSet, false, true, false);
Call_Direct(AddressOf(CInterpreterCPU::InPermLoop), "CInterpreterCPU::InPermLoop");
#ifdef _MSC_VER
MoveConstToX86reg((uint32_t)g_SystemTimer, x86_ECX);
@ -9871,7 +9871,7 @@ void CX86RecompilerOps::UpdateSyncCPU(CRegInfo & RegSet, uint32_t Cycles)
RegSet.AfterCallDirect();
}
void CX86RecompilerOps::UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool ClearValues)
void CX86RecompilerOps::UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool ClearValues, bool UpdateTimer)
{
if (RegSet.GetBlockCycleCount() != 0)
{
@ -9907,6 +9907,20 @@ void CX86RecompilerOps::UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool
CPU_Message(" $Continue_From_Timer_Test:");
SetJump8(Jump, *g_RecompPos);
}
if (UpdateTimer && g_SyncSystem)
{
m_RegWorkingSet.BeforeCallDirect();
#ifdef _MSC_VER
MoveConstToX86reg((uint32_t)g_SystemTimer, x86_ECX);
Call_Direct(AddressOf(&CSystemTimer::UpdateTimers), "CSystemTimer::UpdateTimers");
#else
PushImm32((uint32_t)g_SystemTimer);
Call_Direct(AddressOf(&CSystemTimer::UpdateTimers), "CSystemTimer::UpdateTimers");
AddConstToX86Reg(x86_ESP, 4);
#endif
m_RegWorkingSet.AfterCallDirect();
}
}
void CX86RecompilerOps::CompileSystemCheck(uint32_t TargetPC, const CRegInfo & RegSet)

View File

@ -234,7 +234,7 @@ public:
void CompileReadTLBMiss(x86Reg AddressReg, x86Reg LookUpReg);
void CompileWriteTLBMiss(x86Reg AddressReg, x86Reg LookUpReg);
static void UpdateSyncCPU(CRegInfo & RegSet, uint32_t Cycles);
void UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool ClearValues = false);
void UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool ClearValues = false, bool UpdateTimer = true);
void CompileSystemCheck(uint32_t TargetPC, const CRegInfo & RegSet);
void CompileExecuteBP(void);
void CompileExecuteDelaySlotBP(void);

View File

@ -60,6 +60,7 @@
<ClCompile Include="N64System\MemoryHandler\PeripheralInterfaceHandler.cpp" />
<ClCompile Include="N64System\MemoryHandler\RDRAMInterfaceHandler.cpp" />
<ClCompile Include="N64System\MemoryHandler\RDRAMRegistersHandler.cpp" />
<ClCompile Include="N64System\MemoryHandler\RomMemoryHandler.cpp" />
<ClCompile Include="N64System\MemoryHandler\SerialInterfaceHandler.cpp" />
<ClCompile Include="N64System\MemoryHandler\SPRegistersHandler.cpp" />
<ClCompile Include="N64System\MemoryHandler\VideoInterfaceHandler.cpp" />
@ -165,6 +166,7 @@
<ClInclude Include="N64System\MemoryHandler\PeripheralInterfaceHandler.h" />
<ClInclude Include="N64System\MemoryHandler\RDRAMInterfaceHandler.h" />
<ClInclude Include="N64System\MemoryHandler\RDRAMRegistersHandler.h" />
<ClInclude Include="N64System\MemoryHandler\RomMemoryHandler.h" />
<ClInclude Include="N64System\MemoryHandler\SerialInterfaceHandler.h" />
<ClInclude Include="N64System\MemoryHandler\SPRegistersHandler.h" />
<ClInclude Include="N64System\MemoryHandler\VideoInterfaceHandler.h" />

View File

@ -40,9 +40,6 @@
<Filter Include="Header Files\Plugins">
<UniqueIdentifier>{e3f8ea19-e06b-47a7-8d69-14a0c1cfa8f1}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Plugins">
<UniqueIdentifier>{ac92e812-22e1-4a1a-8dd5-5055073c882c}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\N64 System\Mips">
<UniqueIdentifier>{febaabe1-9838-4211-970d-2af9a003ef8f}</UniqueIdentifier>
</Filter>
@ -100,6 +97,9 @@
<Filter Include="Source Files\N64 System\MemoryHandler">
<UniqueIdentifier>{f32cf723-4acb-4d3d-9bd9-05823579f8dd}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\N64 System\Plugins">
<UniqueIdentifier>{ac92e812-22e1-4a1a-8dd5-5055073c882c}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
@ -184,22 +184,22 @@
<Filter>Source Files\Settings</Filter>
</ClCompile>
<ClCompile Include="Plugins\AudioPlugin.cpp">
<Filter>Source Files\Plugins</Filter>
<Filter>Source Files\N64 System\Plugins</Filter>
</ClCompile>
<ClCompile Include="Plugins\ControllerPlugin.cpp">
<Filter>Source Files\Plugins</Filter>
<Filter>Source Files\N64 System\Plugins</Filter>
</ClCompile>
<ClCompile Include="Plugins\GFXPlugin.cpp">
<Filter>Source Files\Plugins</Filter>
<Filter>Source Files\N64 System\Plugins</Filter>
</ClCompile>
<ClCompile Include="Plugins\PluginBase.cpp">
<Filter>Source Files\Plugins</Filter>
<Filter>Source Files\N64 System\Plugins</Filter>
</ClCompile>
<ClCompile Include="Plugins\Plugin.cpp">
<Filter>Source Files\Plugins</Filter>
<Filter>Source Files\N64 System\Plugins</Filter>
</ClCompile>
<ClCompile Include="Plugins\RSPPlugin.cpp">
<Filter>Source Files\Plugins</Filter>
<Filter>Source Files\N64 System\Plugins</Filter>
</ClCompile>
<ClCompile Include="N64System\EmulationThread.cpp">
<Filter>Source Files\N64 System</Filter>
@ -384,6 +384,9 @@
<ClCompile Include="N64System\MemoryHandler\CartridgeDomain2Address1Handler.cpp">
<Filter>Source Files\N64 System\MemoryHandler</Filter>
</ClCompile>
<ClCompile Include="N64System\MemoryHandler\RomMemoryHandler.cpp">
<Filter>Source Files\N64 System\MemoryHandler</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
@ -734,6 +737,9 @@
<ClInclude Include="N64System\MemoryHandler\CartridgeDomain2Address1Handler.h">
<Filter>Header Files\N64 System\MemoryHandler</Filter>
</ClInclude>
<ClInclude Include="N64System\MemoryHandler\RomMemoryHandler.h">
<Filter>Header Files\N64 System\MemoryHandler</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="Version.h.in">

View File

@ -158,7 +158,6 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Rdb_TLB_PAddrStart, new CSettingTypeRomDatabase("TLB: PAddr Start", (uint32_t)0));
AddHandler(Rdb_UseHleGfx, new CSettingTypeRomDatabase("HLE GFX RDB", Plugin_UseHleGfx));
AddHandler(Rdb_UseHleAudio, new CSettingTypeRomDatabase("HLE Audio RDB", Plugin_UseHleAudio));
AddHandler(Rdb_LoadRomToMemory, new CSettingTypeRomDatabase("Rom In Memory", false));
AddHandler(Rdb_ScreenHertz, new CSettingTypeRomDatabase("ScreenHertz", (uint32_t)0));
AddHandler(Rdb_FuncLookupMode, new CSettingTypeRomDatabase("FuncFind", (uint32_t)FuncFind_PhysicalLookup));
AddHandler(Rdb_RegCache, new CSettingTypeRDBYesNo("Reg Cache", true));
@ -217,7 +216,6 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
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));

View File

@ -22,7 +22,6 @@ bool CGameSettings::m_FullSpeed = true;
bool CGameSettings::m_bFastSP = true;
bool CGameSettings::m_b32Bit = true;
bool CGameSettings::m_RspAudioSignal;
bool CGameSettings::m_bRomInMemory;
bool CGameSettings::m_RegCaching;
bool CGameSettings::m_bLinkBlocks;
uint32_t CGameSettings::m_LookUpMode; //FUNC_LOOKUP_METHOD
@ -80,7 +79,6 @@ void CGameSettings::RefreshGameSettings()
m_bFastSP = g_Settings->LoadBool(Game_FastSP);
#endif
m_RspAudioSignal = g_Settings->LoadBool(Game_RspAudioSignal);
m_bRomInMemory = g_Settings->LoadBool(Game_LoadRomToMemory);
m_RegCaching = g_Settings->LoadBool(Game_RegCache);
m_bLinkBlocks = g_Settings->LoadBool(Game_BlockLinking);
m_LookUpMode = g_Settings->LoadDword(Game_FuncLookupMode);

View File

@ -12,7 +12,6 @@ public:
void RefreshGameSettings(void);
inline static bool UseHleGfx(void) { return m_UseHleGfx; }
inline static bool bRomInMemory(void) { return m_bRomInMemory; }
inline static bool bRegCaching(void) { return m_RegCaching; }
inline static bool bLinkBlocks(void) { return m_bLinkBlocks && !CDebugSettings::HaveWriteBP() && !CDebugSettings::HaveReadBP(); }
inline static FUNC_LOOKUP_METHOD LookUpMode(void) { return (FUNC_LOOKUP_METHOD)m_LookUpMode; }
@ -55,7 +54,6 @@ private:
// Settings that can be changed on the fly
static bool m_UseHleGfx;
static bool m_bRomInMemory;
static bool m_RegCaching;
static bool m_bLinkBlocks;
static uint32_t m_LookUpMode; //FUNC_LOOKUP_METHOD

View File

@ -94,7 +94,6 @@ enum SettingID
Rdb_TLB_PAddrStart,
Rdb_UseHleGfx,
Rdb_UseHleAudio,
Rdb_LoadRomToMemory,
Rdb_ScreenHertz,
Rdb_FuncLookupMode,
Rdb_RegCache,
@ -157,7 +156,6 @@ enum SettingID
Game_RspAudioSignal,
Game_UseHleGfx,
Game_UseHleAudio,
Game_LoadRomToMemory,
Game_ViRefreshRate,
Game_AiCountPerBytes,
Game_AudioResetOnLoad,