Core: if Rom is larger than ISViewerHandler, then use rom handler
This commit is contained in:
parent
529812fdca
commit
48da86bea1
|
@ -3,9 +3,12 @@
|
|||
#include "ISViewerHandler.h"
|
||||
#include <Common/File.h>
|
||||
#include <Common/path.h>
|
||||
#include <Project64-core\N64System\N64Rom.h>
|
||||
#include <Project64-core\N64System\N64System.h>
|
||||
|
||||
ISViewerHandler::ISViewerHandler(CN64System & System) :
|
||||
ISViewerHandler::ISViewerHandler(CN64System & System, RomMemoryHandler & RomHandler, CN64Rom & Rom) :
|
||||
m_RomMemoryHandler(RomHandler),
|
||||
m_Rom(Rom),
|
||||
m_hLogFile(nullptr),
|
||||
m_BufferPos(0)
|
||||
{
|
||||
|
@ -15,6 +18,10 @@ ISViewerHandler::ISViewerHandler(CN64System & System) :
|
|||
|
||||
bool ISViewerHandler::Read32(uint32_t Address, uint32_t & Value)
|
||||
{
|
||||
if ((Address & 0xFFFFFFF) < m_Rom.GetRomSize())
|
||||
{
|
||||
return m_RomMemoryHandler.Read32(Address, Value);
|
||||
}
|
||||
if (!m_Data.empty())
|
||||
{
|
||||
Value = Swap32by8(*((uint32_t *)&m_Data[Address & 0xFFFC]));
|
||||
|
|
|
@ -6,12 +6,14 @@
|
|||
#include <vector>
|
||||
|
||||
class CN64System;
|
||||
class RomMemoryHandler;
|
||||
class CN64Rom;
|
||||
|
||||
class ISViewerHandler :
|
||||
public MemoryHandler
|
||||
{
|
||||
public:
|
||||
ISViewerHandler(CN64System & System);
|
||||
ISViewerHandler(CN64System & System, RomMemoryHandler & RomHandler, CN64Rom & Rom);
|
||||
|
||||
bool Read32(uint32_t Address, uint32_t & Value);
|
||||
bool Write32(uint32_t Address, uint32_t Value, uint32_t Mask);
|
||||
|
@ -29,6 +31,8 @@ private:
|
|||
|
||||
void SystemReset(void);
|
||||
|
||||
RomMemoryHandler & m_RomMemoryHandler;
|
||||
CN64Rom & m_Rom;
|
||||
std::unique_ptr<CFile> m_hLogFile;
|
||||
std::vector<uint8_t> m_Data;
|
||||
char m_Buffer[0x1000];
|
||||
|
|
|
@ -25,7 +25,7 @@ CMipsMemoryVM::CMipsMemoryVM(CN64System & System, bool SavesReadOnly) :
|
|||
m_CartridgeDomain2Address2Handler(System, System.m_Reg, *this, SavesReadOnly),
|
||||
m_RDRAMRegistersHandler(System.m_Reg),
|
||||
m_DPCommandRegistersHandler(System, System.GetPlugins(), System.m_Reg),
|
||||
m_ISViewerHandler(System),
|
||||
m_ISViewerHandler(System, m_RomMemoryHandler, *g_Rom),
|
||||
m_MIPSInterfaceHandler(System.m_Reg),
|
||||
m_PeripheralInterfaceHandler(System, *this, System.m_Reg, m_CartridgeDomain2Address2Handler),
|
||||
m_PifRamHandler(System, SavesReadOnly),
|
||||
|
|
Loading…
Reference in New Issue