mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
FifoDataFile: Add support for storing texture memory state
This bumps the file version to 4.
This commit is contained in:
parent
5b315b7bb4
commit
438989668e
@ -65,6 +65,9 @@ bool FifoDataFile::Save(const std::string& filename)
|
||||
u64 xfRegsOffset = file.Tell();
|
||||
file.WriteArray(m_XFRegs, XF_REGS_SIZE);
|
||||
|
||||
u64 texMemOffset = file.Tell();
|
||||
file.WriteArray(m_TexMem, TEX_MEM_SIZE);
|
||||
|
||||
// Write header
|
||||
FileHeader header;
|
||||
header.fileId = FILE_ID;
|
||||
@ -83,6 +86,9 @@ bool FifoDataFile::Save(const std::string& filename)
|
||||
header.xfRegsOffset = xfRegsOffset;
|
||||
header.xfRegsSize = XF_REGS_SIZE;
|
||||
|
||||
header.texMemOffset = texMemOffset;
|
||||
header.texMemSize = TEX_MEM_SIZE;
|
||||
|
||||
header.frameListOffset = frameListOffset;
|
||||
header.frameCount = (u32)m_Frames.size();
|
||||
|
||||
@ -150,22 +156,31 @@ std::unique_ptr<FifoDataFile> FifoDataFile::Load(const std::string& filename, bo
|
||||
return dataFile;
|
||||
}
|
||||
|
||||
u32 size = std::min((u32)BP_MEM_SIZE, header.bpMemSize);
|
||||
u32 size = std::min<u32>(BP_MEM_SIZE, header.bpMemSize);
|
||||
file.Seek(header.bpMemOffset, SEEK_SET);
|
||||
file.ReadArray(dataFile->m_BPMem, size);
|
||||
|
||||
size = std::min((u32)CP_MEM_SIZE, header.cpMemSize);
|
||||
size = std::min<u32>(CP_MEM_SIZE, header.cpMemSize);
|
||||
file.Seek(header.cpMemOffset, SEEK_SET);
|
||||
file.ReadArray(dataFile->m_CPMem, size);
|
||||
|
||||
size = std::min((u32)XF_MEM_SIZE, header.xfMemSize);
|
||||
size = std::min<u32>(XF_MEM_SIZE, header.xfMemSize);
|
||||
file.Seek(header.xfMemOffset, SEEK_SET);
|
||||
file.ReadArray(dataFile->m_XFMem, size);
|
||||
|
||||
size = std::min((u32)XF_REGS_SIZE, header.xfRegsSize);
|
||||
size = std::min<u32>(XF_REGS_SIZE, header.xfRegsSize);
|
||||
file.Seek(header.xfRegsOffset, SEEK_SET);
|
||||
file.ReadArray(dataFile->m_XFRegs, size);
|
||||
|
||||
// Texture memory saving was added in version 4.
|
||||
std::memset(dataFile->m_TexMem, 0, TEX_MEM_SIZE);
|
||||
if (dataFile->m_Version >= 4)
|
||||
{
|
||||
size = std::min<u32>(TEX_MEM_SIZE, header.texMemSize);
|
||||
file.Seek(header.texMemOffset, SEEK_SET);
|
||||
file.ReadArray(dataFile->m_TexMem, size);
|
||||
}
|
||||
|
||||
// Read frames
|
||||
for (u32 i = 0; i < header.frameCount; ++i)
|
||||
{
|
||||
|
@ -51,6 +51,7 @@ public:
|
||||
CP_MEM_SIZE = 256,
|
||||
XF_MEM_SIZE = 4096,
|
||||
XF_REGS_SIZE = 96,
|
||||
TEX_MEM_SIZE = 1024 * 1024,
|
||||
};
|
||||
|
||||
FifoDataFile();
|
||||
@ -64,6 +65,7 @@ public:
|
||||
u32* GetCPMem() { return m_CPMem; }
|
||||
u32* GetXFMem() { return m_XFMem; }
|
||||
u32* GetXFRegs() { return m_XFRegs; }
|
||||
u8* GetTexMem() { return m_TexMem; }
|
||||
void AddFrame(const FifoFrameInfo& frameInfo);
|
||||
const FifoFrameInfo& GetFrame(u32 frame) const { return m_Frames[frame]; }
|
||||
u32 GetFrameCount() const { return static_cast<u32>(m_Frames.size()); }
|
||||
@ -90,6 +92,7 @@ private:
|
||||
u32 m_CPMem[CP_MEM_SIZE];
|
||||
u32 m_XFMem[XF_MEM_SIZE];
|
||||
u32 m_XFRegs[XF_REGS_SIZE];
|
||||
u8 m_TexMem[TEX_MEM_SIZE];
|
||||
|
||||
u32 m_Flags;
|
||||
u32 m_Version;
|
||||
|
@ -11,7 +11,7 @@ namespace FifoFileStruct
|
||||
enum
|
||||
{
|
||||
FILE_ID = 0x0d01f1f0,
|
||||
VERSION_NUMBER = 3,
|
||||
VERSION_NUMBER = 4,
|
||||
MIN_LOADER_VERSION = 1,
|
||||
};
|
||||
|
||||
@ -34,6 +34,8 @@ union FileHeader {
|
||||
u64 frameListOffset;
|
||||
u32 frameCount;
|
||||
u32 flags;
|
||||
u64 texMemOffset;
|
||||
u32 texMemSize;
|
||||
};
|
||||
u32 rawData[32];
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user