示例#1
0
void LoadXFReg(u32 transferSize, u32 baseAddress)
{
	// do not allow writes past registers
	if (baseAddress + transferSize > 0x1058)
	{
		INFO_LOG(VIDEO, "XF load exceeds address space: %x %d bytes", baseAddress, transferSize);

		if (baseAddress >= 0x1058)
			transferSize = 0;
		else
			transferSize = 0x1058 - baseAddress;
	}

	// write to XF mem
	if (baseAddress < 0x1000 && transferSize > 0)
	{
		u32 end = baseAddress + transferSize;

		u32 xfMemBase = baseAddress;
		u32 xfMemTransferSize = transferSize;

		if (end >= 0x1000)
		{
			xfMemTransferSize = 0x1000 - baseAddress;

			baseAddress = 0x1000;
			transferSize = end - 0x1000;
		}
		else
		{
			transferSize = 0;
		}

		XFMemWritten(xfMemTransferSize, xfMemBase);
		for (u32 i = 0; i < xfMemTransferSize; i++)
		{
			((u32*)&xfmem)[xfMemBase + i] = DataRead<u32>();
		}
	}

	// write to XF regs
	if (transferSize > 0)
	{
		XFRegWritten(transferSize, baseAddress);
		for (u32 i = 0; i < transferSize; i++)
		{
			((u32*)&xfmem)[baseAddress + i] = DataRead<u32>();
		}
	}
}
示例#2
0
void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
{
	// do not allow writes past registers
	if (baseAddress + transferSize > 0x1058)
	{
		INFO_LOG(VIDEO, "XF load exceeds address space: %x %d bytes", baseAddress, transferSize);

		if (baseAddress >= 0x1058)
			transferSize = 0;
		else
			transferSize = 0x1058 - baseAddress;
	}

	// write to XF mem
	if (baseAddress < 0x1000 && transferSize > 0)
	{
		u32 end = baseAddress + transferSize;

		u32 xfMemBase = baseAddress;
		u32 xfMemTransferSize = transferSize;

		if (end >= 0x1000)
		{
			xfMemTransferSize = 0x1000 - baseAddress;

			baseAddress = 0x1000;
			transferSize = end - 0x1000;
		}
		else
		{
			transferSize = 0;
		}
		
		XFMemWritten(xfMemTransferSize, xfMemBase);
		memcpy_gc(&xfmem[xfMemBase], pData, xfMemTransferSize * 4);

		pData += xfMemTransferSize;
	}

	// write to XF regs
	if (transferSize > 0)
	{	
		XFRegWritten(transferSize, baseAddress, pData);
		memcpy_gc((u32*)(&xfregs) + (baseAddress - 0x1000), pData, transferSize * 4);        
	}
}