Ejemplo n.º 1
0
void CSIF::SaveState(Framework::CZipArchiveWriter& archive)
{
	{
		CRegisterStateFile* registerFile = new CRegisterStateFile(STATE_REGS_XML);
		registerFile->SetRegister32("MAINADDR",		m_nMAINADDR);
		registerFile->SetRegister32("SUBADDR",		m_nSUBADDR);
		registerFile->SetRegister32("MSFLAG",		m_nMSFLAG);
		registerFile->SetRegister32("SMFLAG",		m_nSMFLAG);
		registerFile->SetRegister32("EERecvAddr",	m_nEERecvAddr);
		registerFile->SetRegister32("DataAddr",		m_nDataAddr);
		archive.InsertFile(registerFile);
	}

	{
		CStructCollectionStateFile* callRepliesFile = new CStructCollectionStateFile(STATE_CALL_REPLIES_XML);
		for(CallReplyMap::const_iterator callReplyIterator(m_callReplies.begin());
			callReplyIterator != m_callReplies.end(); callReplyIterator++)
		{
			const CALLREQUESTINFO& callReply(callReplyIterator->second);
			std::string replyId = lexical_cast_hex<std::string>(callReplyIterator->first, 8);
			CStructFile replyStruct;
			{
				SaveState_RpcCall(replyStruct, callReply.call);
				SaveState_RequestEnd(replyStruct, callReply.reply);
			}
			callRepliesFile->InsertStruct(replyId.c_str(), replyStruct);
		}
		archive.InsertFile(callRepliesFile);
	}
}
Ejemplo n.º 2
0
void CSubSystem::SaveState(Framework::CZipArchiveWriter& archive)
{
    archive.InsertFile(new CMemoryStateFile(STATE_CPU,		&m_cpu.m_State, sizeof(MIPSSTATE)));
    archive.InsertFile(new CMemoryStateFile(STATE_RAM,		m_ram,			IOP_RAM_SIZE));
    archive.InsertFile(new CMemoryStateFile(STATE_SCRATCH,	m_scratchPad,	IOP_SCRATCH_SIZE));
    archive.InsertFile(new CMemoryStateFile(STATE_SPURAM,	m_spuRam,		SPU_RAM_SIZE));
    m_intc.SaveState(archive);
    m_counters.SaveState(archive);
    m_spuCore0.SaveState(archive);
    m_spuCore1.SaveState(archive);
    m_bios->SaveState(archive);
}
Ejemplo n.º 3
0
void CCdvdman::SaveState(Framework::CZipArchiveWriter& archive)
{
	auto registerFile = new CRegisterStateFile(STATE_FILENAME);
	registerFile->SetRegister32(STATE_CALLBACK_ADDRESS, m_callbackPtr);
	registerFile->SetRegister32(STATE_STATUS, m_status);
	archive.InsertFile(registerFile);
}
Ejemplo n.º 4
0
Archivo: VPU.cpp Proyecto: cmexp/Play-
void CVPU::SaveState(Framework::CZipArchiveWriter& archive)
{
	std::string path = STATE_PREFIX + boost::lexical_cast<std::string>(m_vpuNumber) + STATE_SUFFIX;
	CRegisterStateFile* registerFile = new CRegisterStateFile(path.c_str());
	registerFile->SetRegister32(STATE_REGS_STAT,		m_STAT);
	registerFile->SetRegister32(STATE_REGS_CODE,		m_CODE);
	registerFile->SetRegister32(STATE_REGS_CYCLE,		m_CYCLE);
	registerFile->SetRegister32(STATE_REGS_NUM,			m_NUM);
	registerFile->SetRegister32(STATE_REGS_MODE,		m_MODE);
	registerFile->SetRegister32(STATE_REGS_MASK,		m_MASK);
	registerFile->SetRegister32(STATE_REGS_MARK,		m_MARK);
	registerFile->SetRegister32(STATE_REGS_ROW0,		m_R[0]);
	registerFile->SetRegister32(STATE_REGS_ROW1,		m_R[1]);
	registerFile->SetRegister32(STATE_REGS_ROW2,		m_R[2]);
	registerFile->SetRegister32(STATE_REGS_ROW3,		m_R[3]);
	registerFile->SetRegister32(STATE_REGS_COL0,		m_C[0]);
	registerFile->SetRegister32(STATE_REGS_COL1,		m_C[1]);
	registerFile->SetRegister32(STATE_REGS_COL2,		m_C[2]);
	registerFile->SetRegister32(STATE_REGS_COL3,		m_C[3]);
	registerFile->SetRegister32(STATE_REGS_ITOP,		m_ITOP);
	registerFile->SetRegister32(STATE_REGS_ITOPS,		m_ITOPS);
	registerFile->SetRegister32(STATE_REGS_READTICK,	m_readTick);
	registerFile->SetRegister32(STATE_REGS_WRITETICK,	m_writeTick);
	archive.InsertFile(registerFile);
}
Ejemplo n.º 5
0
void CFileIoHandler2300::SaveState(Framework::CZipArchiveWriter& archive) const
{
	auto registerFile = new CRegisterStateFile(STATE_XML);
	registerFile->SetRegister32(STATE_RESULTPTR0,     m_resultPtr[0]);
	registerFile->SetRegister32(STATE_RESULTPTR1,     m_resultPtr[1]);
	registerFile->SetRegister32(STATE_PENDINGREADCMD, m_pendingReadCommand ? 1 : 0);
	archive.InsertFile(registerFile);
}
Ejemplo n.º 6
0
void CFrameDump::Write(Framework::CStream& output) const
{
	Framework::CZipArchiveWriter archive;

	archive.InsertFile(new CMemoryStateFile(STATE_INITIAL_GSRAM,	m_initialGsRam,			CGSHandler::RAMSIZE));
	archive.InsertFile(new CMemoryStateFile(STATE_INITIAL_GSREGS,	m_initialGsRegisters,	sizeof(uint64) * CGSHandler::REGISTER_MAX));

	unsigned int currentPacket = 0;
	for(const auto& packet : m_packets)
	{
		std::string packetName = STATE_PACKET_PREFIX + std::to_string(currentPacket);
		std::string packetMetadataName = STATE_PACKET_METADATA_PREFIX + std::to_string(currentPacket);
		archive.InsertFile(new CMemoryStateFile(packetName.c_str(), packet.writes.data(), packet.writes.size() * sizeof(CGSHandler::RegisterWrite)));
		archive.InsertFile(new CMemoryStateFile(packetMetadataName.c_str(), &packet.metadata, sizeof(CGsPacketMetadata)));
		currentPacket++;
	}

	archive.Write(output);
}
Ejemplo n.º 7
0
void CVif1::SaveState(Framework::CZipArchiveWriter& archive)
{
    CVif::SaveState(archive);

    auto path = string_format(STATE_PATH_FORMAT, m_number);
    CRegisterStateFile* registerFile = new CRegisterStateFile(path.c_str());
    registerFile->SetRegister32(STATE_REGS_BASE,	m_BASE);
    registerFile->SetRegister32(STATE_REGS_TOP,		m_TOP);
    registerFile->SetRegister32(STATE_REGS_TOPS,	m_TOPS);
    registerFile->SetRegister32(STATE_REGS_OFST,	m_OFST);
    archive.InsertFile(registerFile);
}
Ejemplo n.º 8
0
void CVPU1::SaveState(Framework::CZipArchiveWriter& archive)
{
	CVPU::SaveState(archive);

	std::string path = STATE_PREFIX + boost::lexical_cast<std::string>(m_vpuNumber) + STATE_SUFFIX;
	CRegisterStateFile* registerFile = new CRegisterStateFile(path.c_str());
	registerFile->SetRegister32(STATE_REGS_BASE,	m_BASE);
	registerFile->SetRegister32(STATE_REGS_TOP,		m_TOP);
	registerFile->SetRegister32(STATE_REGS_TOPS,	m_TOPS);
	registerFile->SetRegister32(STATE_REGS_OFST,	m_OFST);
	archive.InsertFile(registerFile);
}
Ejemplo n.º 9
0
void CFrameDump::Write(Framework::CStream& output) const
{
	Framework::CZipArchiveWriter archive;

	archive.InsertFile(new CMemoryStateFile(STATE_INITIAL_GSRAM, m_initialGsRam, CGSHandler::RAMSIZE));
	archive.InsertFile(new CMemoryStateFile(STATE_INITIAL_GSREGS, m_initialGsRegisters, sizeof(uint64) * CGSHandler::REGISTER_MAX));

	{
		auto privRegsStateFile = new CRegisterStateFile(STATE_INITIAL_GSPRIVREGS);
		privRegsStateFile->SetRegister64(STATE_PRIVREG_SMODE2, m_initialSMODE2);
		archive.InsertFile(privRegsStateFile);
	}

	unsigned int currentPacket = 0;
	for(const auto& packet : m_packets)
	{
		auto packetMetadataFileName = STATE_PACKET_METADATA_PREFIX + std::to_string(currentPacket);
		archive.InsertFile(new CMemoryStateFile(packetMetadataFileName.c_str(), &packet.metadata, sizeof(CGsPacketMetadata)));
		if(!packet.registerWrites.empty())
		{
			auto packetRegisterWritesFileName = STATE_PACKET_REGISTERWRITES_PREFIX + std::to_string(currentPacket);
			archive.InsertFile(new CMemoryStateFile(packetRegisterWritesFileName.c_str(), packet.registerWrites.data(), packet.registerWrites.size() * sizeof(CGSHandler::RegisterWrite)));
		}
		if(!packet.imageData.empty())
		{
			auto packetImageDataName = STATE_PACKET_IMAGEDATA_PREFIX + std::to_string(currentPacket);
			archive.InsertFile(new CMemoryStateFile(packetImageDataName.c_str(), packet.imageData.data(), packet.imageData.size()));
		}
		currentPacket++;
	}

	archive.Write(output);
}
Ejemplo n.º 10
0
void CGSHandler::SaveState(Framework::CZipArchiveWriter& archive)
{
	archive.InsertFile(new CMemoryStateFile(STATE_RAM,		m_pRAM,		RAMSIZE));
	archive.InsertFile(new CMemoryStateFile(STATE_REGS,		m_nReg,		sizeof(uint64) * CGSHandler::REGISTER_MAX));
	archive.InsertFile(new CMemoryStateFile(STATE_TRXCTX,	&m_trxCtx,	sizeof(TRXCONTEXT)));

	{
		CRegisterStateFile* registerFile = new CRegisterStateFile(STATE_PRIVREGS);

		registerFile->SetRegister64(STATE_PRIVREGS_PMODE,			m_nPMODE);
		registerFile->SetRegister64(STATE_PRIVREGS_SMODE2,			m_nSMODE2);
		registerFile->SetRegister64(STATE_PRIVREGS_DISPFB1,			m_nDISPFB1.value.q);
		registerFile->SetRegister64(STATE_PRIVREGS_DISPLAY1,		m_nDISPLAY1.value.q);
		registerFile->SetRegister64(STATE_PRIVREGS_DISPFB2,			m_nDISPFB2.value.q);
		registerFile->SetRegister64(STATE_PRIVREGS_DISPLAY2,		m_nDISPLAY2.value.q);
		registerFile->SetRegister64(STATE_PRIVREGS_CSR,				m_nCSR);
		registerFile->SetRegister64(STATE_PRIVREGS_IMR,				m_nIMR);
		registerFile->SetRegister32(STATE_PRIVREGS_CRTMODE,			m_nCrtMode);

		archive.InsertFile(registerFile);
	}
}
Ejemplo n.º 11
0
void CVIF::SaveState(Framework::CZipArchiveWriter& archive)
{
	//TODO: Save FifoStream states

	{
		CRegisterStateFile* registerFile = new CRegisterStateFile(STATE_REGS_XML);
		registerFile->SetRegister32(STATE_REGS_VPU_STAT, m_VPU_STAT);
		archive.InsertFile(registerFile);
	}

	m_pVPU[0]->SaveState(archive);
	m_pVPU[1]->SaveState(archive);
}
Ejemplo n.º 12
0
void CCdvdfsv::SaveState(Framework::CZipArchiveWriter& archive)
{
	auto registerFile = new CRegisterStateFile(STATE_FILENAME);

	registerFile->SetRegister32(STATE_PENDINGCOMMAND, m_pendingCommand);
	registerFile->SetRegister32(STATE_PENDINGREADSECTOR, m_pendingReadSector);
	registerFile->SetRegister32(STATE_PENDINGREADCOUNT, m_pendingReadCount);
	registerFile->SetRegister32(STATE_PENDINGREADADDR, m_pendingReadAddr);

	registerFile->SetRegister32(STATE_STREAMING, m_streaming);
	registerFile->SetRegister32(STATE_STREAMPOS, m_streamPos);
	registerFile->SetRegister32(STATE_STREAMBUFFERSIZE, m_streamBufferSize);

	archive.InsertFile(registerFile);
}
Ejemplo n.º 13
0
void CSifCmd::SaveState(Framework::CZipArchiveWriter& archive)
{
	auto modulesFile = new CStructCollectionStateFile(STATE_MODULES);
	{
		int moduleIndex = 0;
		for(const auto& module : m_servers)
		{
			auto moduleName = std::string(STATE_MODULE) + std::to_string(moduleIndex++);
			CStructFile moduleStruct;
			{
				uint32 serverDataAddress = module->GetServerDataAddress();
				moduleStruct.SetRegister32(STATE_MODULE_SERVER_DATA_ADDRESS, serverDataAddress);
			}
			modulesFile->InsertStruct(moduleName.c_str(), moduleStruct);
		}
	}
	archive.InsertFile(modulesFile);
}
Ejemplo n.º 14
0
void CSubSystem::SaveState(Framework::CZipArchiveWriter& archive)
{
    archive.InsertFile(new CMemoryStateFile(STATE_EE,			&m_EE.m_State,	sizeof(MIPSSTATE)));
    archive.InsertFile(new CMemoryStateFile(STATE_VU0,			&m_VU0.m_State,	sizeof(MIPSSTATE)));
    archive.InsertFile(new CMemoryStateFile(STATE_VU1,			&m_VU1.m_State,	sizeof(MIPSSTATE)));
    archive.InsertFile(new CMemoryStateFile(STATE_RAM,			m_ram,			PS2::EE_RAM_SIZE));
    archive.InsertFile(new CMemoryStateFile(STATE_SPR,			m_spr,			PS2::EE_SPR_SIZE));
    archive.InsertFile(new CMemoryStateFile(STATE_VUMEM0,		m_vuMem0,		PS2::VUMEM0SIZE));
    archive.InsertFile(new CMemoryStateFile(STATE_MICROMEM0,	m_microMem0,	PS2::MICROMEM0SIZE));
    archive.InsertFile(new CMemoryStateFile(STATE_VUMEM1,		m_vuMem1,		PS2::VUMEM1SIZE));
    archive.InsertFile(new CMemoryStateFile(STATE_MICROMEM1,	m_microMem1,	PS2::MICROMEM1SIZE));

    m_dmac.SaveState(archive);
    m_intc.SaveState(archive);
    m_sif.SaveState(archive);
    m_vpu0->SaveState(archive);
    m_vpu1->SaveState(archive);
    m_timer.SaveState(archive);
}
Ejemplo n.º 15
0
Archivo: GIF.cpp Proyecto: unpeng/Play-
void CGIF::SaveState(Framework::CZipArchiveWriter& archive)
{
	CRegisterStateFile* registerFile = new CRegisterStateFile(STATE_REGS_XML);
	registerFile->SetRegister32(STATE_REGS_M3P, m_path3Masked ? 1 : 0);
	archive.InsertFile(registerFile);
}