FifoPlayer: Fixup style of types.
This commit is contained in:
parent
a355d9868e
commit
aa1fec6fc3
|
@ -19,34 +19,34 @@ void Init()
|
||||||
VertexLoader_Normal::Init();
|
VertexLoader_Normal::Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 ReadFifo8(u8 *&data)
|
u8 ReadFifo8(u8*& data)
|
||||||
{
|
{
|
||||||
u8 value = data[0];
|
u8 value = data[0];
|
||||||
data += 1;
|
data += 1;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 ReadFifo16(u8 *&data)
|
u16 ReadFifo16(u8*& data)
|
||||||
{
|
{
|
||||||
u16 value = Common::swap16(data);
|
u16 value = Common::swap16(data);
|
||||||
data += 2;
|
data += 2;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 ReadFifo32(u8 *&data)
|
u32 ReadFifo32(u8*& data)
|
||||||
{
|
{
|
||||||
u32 value = Common::swap32(data);
|
u32 value = Common::swap32(data);
|
||||||
data += 4;
|
data += 4;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitBPMemory(BPMemory *bpMem)
|
void InitBPMemory(BPMemory* bpMem)
|
||||||
{
|
{
|
||||||
memset(bpMem, 0, sizeof(BPMemory));
|
memset(bpMem, 0, sizeof(BPMemory));
|
||||||
bpMem->bpMask = 0x00FFFFFF;
|
bpMem->bpMask = 0x00FFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
BPCmd DecodeBPCmd(u32 value, const BPMemory &bpMem)
|
BPCmd DecodeBPCmd(u32 value, const BPMemory& bpMem)
|
||||||
{
|
{
|
||||||
//handle the mask register
|
//handle the mask register
|
||||||
int opcode = value >> 24;
|
int opcode = value >> 24;
|
||||||
|
@ -59,7 +59,7 @@ BPCmd DecodeBPCmd(u32 value, const BPMemory &bpMem)
|
||||||
return bp;
|
return bp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadBPReg(const BPCmd &bp, BPMemory &bpMem)
|
void LoadBPReg(const BPCmd& bp, BPMemory& bpMem)
|
||||||
{
|
{
|
||||||
((u32*)&bpMem)[bp.address] = bp.newvalue;
|
((u32*)&bpMem)[bp.address] = bp.newvalue;
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ void LoadBPReg(const BPCmd &bp, BPMemory &bpMem)
|
||||||
bpMem.bpMask = 0xFFFFFF;
|
bpMem.bpMask = 0xFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadCPReg(u32 subCmd, u32 value, CPMemory &cpMem)
|
void LoadCPReg(u32 subCmd, u32 value, CPMemory& cpMem)
|
||||||
{
|
{
|
||||||
switch (subCmd & 0xF0)
|
switch (subCmd & 0xF0)
|
||||||
{
|
{
|
||||||
|
@ -107,7 +107,7 @@ void LoadCPReg(u32 subCmd, u32 value, CPMemory &cpMem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 CalculateVertexSize(int vatIndex, const CPMemory &cpMem)
|
u32 CalculateVertexSize(int vatIndex, const CPMemory& cpMem)
|
||||||
{
|
{
|
||||||
u32 vertexSize = 0;
|
u32 vertexSize = 0;
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ u32 CalculateVertexSize(int vatIndex, const CPMemory &cpMem)
|
||||||
return vertexSize;
|
return vertexSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculateVertexElementSizes(int sizes[], int vatIndex, const CPMemory &cpMem)
|
void CalculateVertexElementSizes(int sizes[], int vatIndex, const CPMemory& cpMem)
|
||||||
{
|
{
|
||||||
const TVtxDesc &vtxDesc = cpMem.vtxDesc;
|
const TVtxDesc &vtxDesc = cpMem.vtxDesc;
|
||||||
const VAT &vtxAttr = cpMem.vtxAttr[vatIndex];
|
const VAT &vtxAttr = cpMem.vtxAttr[vatIndex];
|
||||||
|
|
|
@ -13,15 +13,15 @@ namespace FifoAnalyzer
|
||||||
{
|
{
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
u8 ReadFifo8(u8 *&data);
|
u8 ReadFifo8(u8*& data);
|
||||||
u16 ReadFifo16(u8 *&data);
|
u16 ReadFifo16(u8*& data);
|
||||||
u32 ReadFifo32(u8 *&data);
|
u32 ReadFifo32(u8*& data);
|
||||||
|
|
||||||
// TODO- move to video common
|
// TODO- move to video common
|
||||||
void InitBPMemory(BPMemory *bpMem);
|
void InitBPMemory(BPMemory* bpMem);
|
||||||
BPCmd DecodeBPCmd(u32 value, const BPMemory &bpMem);
|
BPCmd DecodeBPCmd(u32 value, const BPMemory &bpMem);
|
||||||
void LoadBPReg(const BPCmd &bp, BPMemory &bpMem);
|
void LoadBPReg(const BPCmd& bp, BPMemory &bpMem);
|
||||||
void GetTlutLoadData(u32 &tlutAddr, u32 &memAddr, u32 &tlutXferCount, BPMemory &bpMem);
|
void GetTlutLoadData(u32& tlutAddr, u32 &memAddr, u32 &tlutXferCount, BPMemory &bpMem);
|
||||||
|
|
||||||
struct CPMemory
|
struct CPMemory
|
||||||
{
|
{
|
||||||
|
@ -31,8 +31,8 @@ namespace FifoAnalyzer
|
||||||
u32 arrayStrides[16];
|
u32 arrayStrides[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
void LoadCPReg(u32 subCmd, u32 value, CPMemory &cpMem);
|
void LoadCPReg(u32 subCmd, u32 value, CPMemory& cpMem);
|
||||||
|
|
||||||
u32 CalculateVertexSize(int vatIndex, const CPMemory &cpMem);
|
u32 CalculateVertexSize(int vatIndex, const CPMemory& cpMem);
|
||||||
void CalculateVertexElementSizes(int sizes[], int vatIndex, const CPMemory &cpMem);
|
void CalculateVertexElementSizes(int sizes[], int vatIndex, const CPMemory& cpMem);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ bool FifoDataFile::GetIsWii() const
|
||||||
return GetFlag(FLAG_IS_WII);
|
return GetFlag(FLAG_IS_WII);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FifoDataFile::AddFrame(const FifoFrameInfo &frameInfo)
|
void FifoDataFile::AddFrame(const FifoFrameInfo& frameInfo)
|
||||||
{
|
{
|
||||||
m_Frames.push_back(frameInfo);
|
m_Frames.push_back(frameInfo);
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ bool FifoDataFile::Save(const std::string& filename)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FifoDataFile *FifoDataFile::Load(const std::string &filename, bool flagsOnly)
|
FifoDataFile* FifoDataFile::Load(const std::string &filename, bool flagsOnly)
|
||||||
{
|
{
|
||||||
File::IOFile file;
|
File::IOFile file;
|
||||||
file.Open(filename, "rb");
|
file.Open(filename, "rb");
|
||||||
|
@ -219,7 +219,7 @@ bool FifoDataFile::GetFlag(u32 flag) const
|
||||||
return !!(m_Flags & flag);
|
return !!(m_Flags & flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 FifoDataFile::WriteMemoryUpdates(const std::vector<MemoryUpdate> &memUpdates, File::IOFile &file)
|
u64 FifoDataFile::WriteMemoryUpdates(const std::vector<MemoryUpdate>& memUpdates, File::IOFile& file)
|
||||||
{
|
{
|
||||||
// Add space for memory update list
|
// Add space for memory update list
|
||||||
u64 updateListOffset = file.Tell();
|
u64 updateListOffset = file.Tell();
|
||||||
|
@ -249,7 +249,7 @@ u64 FifoDataFile::WriteMemoryUpdates(const std::vector<MemoryUpdate> &memUpdates
|
||||||
return updateListOffset;
|
return updateListOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FifoDataFile::ReadMemoryUpdates(u64 fileOffset, u32 numUpdates, std::vector<MemoryUpdate> &memUpdates, File::IOFile &file)
|
void FifoDataFile::ReadMemoryUpdates(u64 fileOffset, u32 numUpdates, std::vector<MemoryUpdate>& memUpdates, File::IOFile& file)
|
||||||
{
|
{
|
||||||
memUpdates.resize(numUpdates);
|
memUpdates.resize(numUpdates);
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ void FifoDataFile::ReadMemoryUpdates(u64 fileOffset, u32 numUpdates, std::vector
|
||||||
FileMemoryUpdate srcUpdate;
|
FileMemoryUpdate srcUpdate;
|
||||||
file.ReadBytes(&srcUpdate, sizeof(FileMemoryUpdate));
|
file.ReadBytes(&srcUpdate, sizeof(FileMemoryUpdate));
|
||||||
|
|
||||||
MemoryUpdate &dstUpdate = memUpdates[i];
|
MemoryUpdate& dstUpdate = memUpdates[i];
|
||||||
dstUpdate.address = srcUpdate.address;
|
dstUpdate.address = srcUpdate.address;
|
||||||
dstUpdate.fifoPosition = srcUpdate.fifoPosition;
|
dstUpdate.fifoPosition = srcUpdate.fifoPosition;
|
||||||
dstUpdate.size = srcUpdate.dataSize;
|
dstUpdate.size = srcUpdate.dataSize;
|
||||||
|
|
|
@ -27,13 +27,13 @@ struct MemoryUpdate
|
||||||
u32 fifoPosition;
|
u32 fifoPosition;
|
||||||
u32 address;
|
u32 address;
|
||||||
u32 size;
|
u32 size;
|
||||||
u8 *data;
|
u8* data;
|
||||||
Type type;
|
Type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FifoFrameInfo
|
struct FifoFrameInfo
|
||||||
{
|
{
|
||||||
u8 *fifoData;
|
u8* fifoData;
|
||||||
u32 fifoDataSize;
|
u32 fifoDataSize;
|
||||||
|
|
||||||
u32 fifoStart;
|
u32 fifoStart;
|
||||||
|
@ -72,7 +72,7 @@ public:
|
||||||
|
|
||||||
bool Save(const std::string& filename);
|
bool Save(const std::string& filename);
|
||||||
|
|
||||||
static FifoDataFile *Load(const std::string &filename, bool flagsOnly);
|
static FifoDataFile* Load(const std::string &filename, bool flagsOnly);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum
|
enum
|
||||||
|
@ -85,8 +85,8 @@ private:
|
||||||
void SetFlag(u32 flag, bool set);
|
void SetFlag(u32 flag, bool set);
|
||||||
bool GetFlag(u32 flag) const;
|
bool GetFlag(u32 flag) const;
|
||||||
|
|
||||||
u64 WriteMemoryUpdates(const std::vector<MemoryUpdate> &memUpdates, File::IOFile &file);
|
u64 WriteMemoryUpdates(const std::vector<MemoryUpdate>& memUpdates, File::IOFile &file);
|
||||||
static void ReadMemoryUpdates(u64 fileOffset, u32 numUpdates, std::vector<MemoryUpdate> &memUpdates, File::IOFile &file);
|
static void ReadMemoryUpdates(u64 fileOffset, u32 numUpdates, std::vector<MemoryUpdate>& memUpdates, File::IOFile& file);
|
||||||
|
|
||||||
u32 m_BPMem[BP_MEM_SIZE];
|
u32 m_BPMem[BP_MEM_SIZE];
|
||||||
u32 m_CPMem[CP_MEM_SIZE];
|
u32 m_CPMem[CP_MEM_SIZE];
|
||||||
|
|
|
@ -20,7 +20,7 @@ struct CmdData
|
||||||
{
|
{
|
||||||
u32 size;
|
u32 size;
|
||||||
u32 offset;
|
u32 offset;
|
||||||
u8 *ptr;
|
u8* ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
FifoPlaybackAnalyzer::FifoPlaybackAnalyzer()
|
FifoPlaybackAnalyzer::FifoPlaybackAnalyzer()
|
||||||
|
@ -28,13 +28,13 @@ FifoPlaybackAnalyzer::FifoPlaybackAnalyzer()
|
||||||
FifoAnalyzer::Init();
|
FifoAnalyzer::Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector<AnalyzedFrameInfo> &frameInfo)
|
void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile* file, std::vector<AnalyzedFrameInfo>& frameInfo)
|
||||||
{
|
{
|
||||||
// Load BP memory
|
// Load BP memory
|
||||||
u32 *bpMem = file->GetBPMem();
|
u32* bpMem = file->GetBPMem();
|
||||||
memcpy(&m_BpMem, bpMem, sizeof(BPMemory));
|
memcpy(&m_BpMem, bpMem, sizeof(BPMemory));
|
||||||
|
|
||||||
u32 *cpMem = file->GetCPMem();
|
u32* cpMem = file->GetCPMem();
|
||||||
FifoAnalyzer::LoadCPReg(0x50, cpMem[0x50], m_CpMem);
|
FifoAnalyzer::LoadCPReg(0x50, cpMem[0x50], m_CpMem);
|
||||||
FifoAnalyzer::LoadCPReg(0x60, cpMem[0x60], m_CpMem);
|
FifoAnalyzer::LoadCPReg(0x60, cpMem[0x60], m_CpMem);
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector<Analyze
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FifoPlaybackAnalyzer::AddMemoryUpdate(MemoryUpdate memUpdate, AnalyzedFrameInfo &frameInfo)
|
void FifoPlaybackAnalyzer::AddMemoryUpdate(MemoryUpdate memUpdate, AnalyzedFrameInfo& frameInfo)
|
||||||
{
|
{
|
||||||
u32 begin = memUpdate.address;
|
u32 begin = memUpdate.address;
|
||||||
u32 end = memUpdate.address + memUpdate.size;
|
u32 end = memUpdate.address + memUpdate.size;
|
||||||
|
@ -152,9 +152,9 @@ void FifoPlaybackAnalyzer::AddMemoryUpdate(MemoryUpdate memUpdate, AnalyzedFrame
|
||||||
frameInfo.memoryUpdates.push_back(memUpdate);
|
frameInfo.memoryUpdates.push_back(memUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 FifoPlaybackAnalyzer::DecodeCommand(u8 *data)
|
u32 FifoPlaybackAnalyzer::DecodeCommand(u8* data)
|
||||||
{
|
{
|
||||||
u8 *dataStart = data;
|
u8* dataStart = data;
|
||||||
|
|
||||||
int cmd = ReadFifo8(data);
|
int cmd = ReadFifo8(data);
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class FifoPlaybackAnalyzer
|
||||||
public:
|
public:
|
||||||
FifoPlaybackAnalyzer();
|
FifoPlaybackAnalyzer();
|
||||||
|
|
||||||
void AnalyzeFrames(FifoDataFile *file, std::vector<AnalyzedFrameInfo> &frameInfo);
|
void AnalyzeFrames(FifoDataFile* file, std::vector<AnalyzedFrameInfo>& frameInfo);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct MemoryRange
|
struct MemoryRange
|
||||||
|
@ -31,9 +31,9 @@ private:
|
||||||
u32 end;
|
u32 end;
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddMemoryUpdate(MemoryUpdate memUpdate, AnalyzedFrameInfo &frameInfo);
|
void AddMemoryUpdate(MemoryUpdate memUpdate, AnalyzedFrameInfo& frameInfo);
|
||||||
|
|
||||||
u32 DecodeCommand(u8 *data);
|
u32 DecodeCommand(u8* data);
|
||||||
|
|
||||||
void StoreEfbCopyRegion();
|
void StoreEfbCopyRegion();
|
||||||
void StoreWrittenRegion(u32 address, u32 size);
|
void StoreWrittenRegion(u32 address, u32 size);
|
||||||
|
|
|
@ -153,7 +153,7 @@ void FifoPlayer::SetFrameRangeEnd(u32 end)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FifoPlayer &FifoPlayer::GetInstance()
|
FifoPlayer& FifoPlayer::GetInstance()
|
||||||
{
|
{
|
||||||
static FifoPlayer instance;
|
static FifoPlayer instance;
|
||||||
return instance;
|
return instance;
|
||||||
|
@ -173,7 +173,7 @@ FifoPlayer::FifoPlayer() :
|
||||||
m_Loop = SConfig::GetInstance().bLoopFifoReplay;
|
m_Loop = SConfig::GetInstance().bLoopFifoReplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FifoPlayer::WriteFrame(const FifoFrameInfo &frame, const AnalyzedFrameInfo &info)
|
void FifoPlayer::WriteFrame(const FifoFrameInfo& frame, const AnalyzedFrameInfo& info)
|
||||||
{
|
{
|
||||||
// Core timing information
|
// Core timing information
|
||||||
m_CyclesPerFrame = SystemTimers::GetTicksPerSecond() / VideoInterface::TargetRefreshRate;
|
m_CyclesPerFrame = SystemTimers::GetTicksPerSecond() / VideoInterface::TargetRefreshRate;
|
||||||
|
@ -232,9 +232,9 @@ void FifoPlayer::WriteFrame(const FifoFrameInfo &frame, const AnalyzedFrameInfo
|
||||||
FlushWGP();
|
FlushWGP();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FifoPlayer::WriteFramePart(u32 dataStart, u32 dataEnd, u32 &nextMemUpdate, const FifoFrameInfo &frame, const AnalyzedFrameInfo &info)
|
void FifoPlayer::WriteFramePart(u32 dataStart, u32 dataEnd, u32& nextMemUpdate, const FifoFrameInfo& frame, const AnalyzedFrameInfo& info)
|
||||||
{
|
{
|
||||||
u8 *data = frame.fifoData;
|
u8* data = frame.fifoData;
|
||||||
|
|
||||||
while (nextMemUpdate < frame.memoryUpdates.size() && dataStart < dataEnd)
|
while (nextMemUpdate < frame.memoryUpdates.size() && dataStart < dataEnd)
|
||||||
{
|
{
|
||||||
|
@ -289,7 +289,7 @@ void FifoPlayer::WriteMemory(const MemoryUpdate& memUpdate)
|
||||||
memcpy(mem, memUpdate.data, memUpdate.size);
|
memcpy(mem, memUpdate.data, memUpdate.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FifoPlayer::WriteFifo(u8 *data, u32 start, u32 end)
|
void FifoPlayer::WriteFifo(u8* data, u32 start, u32 end)
|
||||||
{
|
{
|
||||||
u32 written = start;
|
u32 written = start;
|
||||||
u32 lastBurstEnd = end - 1;
|
u32 lastBurstEnd = end - 1;
|
||||||
|
@ -452,7 +452,7 @@ void FifoPlayer::LoadXFReg(u16 reg, u32 value)
|
||||||
GPFifo::Write32(value);
|
GPFifo::Write32(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FifoPlayer::LoadXFMem16(u16 address, u32 *data)
|
void FifoPlayer::LoadXFMem16(u16 address, u32* data)
|
||||||
{
|
{
|
||||||
// Loads 16 * 4 bytes in xf memory starting at address
|
// Loads 16 * 4 bytes in xf memory starting at address
|
||||||
GPFifo::Write8(0x10); // load XF reg
|
GPFifo::Write8(0x10); // load XF reg
|
||||||
|
|
|
@ -87,15 +87,15 @@ public:
|
||||||
private:
|
private:
|
||||||
FifoPlayer();
|
FifoPlayer();
|
||||||
|
|
||||||
void WriteFrame(const FifoFrameInfo &frame, const AnalyzedFrameInfo &info);
|
void WriteFrame(const FifoFrameInfo& frame, const AnalyzedFrameInfo &info);
|
||||||
void WriteFramePart(u32 dataStart, u32 dataEnd, u32 &nextMemUpdate, const FifoFrameInfo &frame, const AnalyzedFrameInfo &info);
|
void WriteFramePart(u32 dataStart, u32 dataEnd, u32 &nextMemUpdate, const FifoFrameInfo& frame, const AnalyzedFrameInfo& info);
|
||||||
|
|
||||||
void WriteAllMemoryUpdates();
|
void WriteAllMemoryUpdates();
|
||||||
void WriteMemory(const MemoryUpdate &memUpdate);
|
void WriteMemory(const MemoryUpdate &memUpdate);
|
||||||
|
|
||||||
// writes a range of data to the fifo
|
// writes a range of data to the fifo
|
||||||
// start and end must be relative to frame's fifo data so elapsed cycles are figured correctly
|
// start and end must be relative to frame's fifo data so elapsed cycles are figured correctly
|
||||||
void WriteFifo(u8 *data, u32 start, u32 end);
|
void WriteFifo(u8* data, u32 start, u32 end);
|
||||||
|
|
||||||
void SetupFifo();
|
void SetupFifo();
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ private:
|
||||||
CallbackFunc m_FileLoadedCb;
|
CallbackFunc m_FileLoadedCb;
|
||||||
CallbackFunc m_FrameWrittenCb;
|
CallbackFunc m_FrameWrittenCb;
|
||||||
|
|
||||||
FifoDataFile *m_File;
|
FifoDataFile* m_File;
|
||||||
|
|
||||||
std::vector<AnalyzedFrameInfo> m_FrameInfo;
|
std::vector<AnalyzedFrameInfo> m_FrameInfo;
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,7 +22,7 @@ FifoRecordAnalyzer::FifoRecordAnalyzer() :
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void FifoRecordAnalyzer::Initialize(u32 *bpMem, u32 *cpMem)
|
void FifoRecordAnalyzer::Initialize(u32* bpMem, u32* cpMem)
|
||||||
{
|
{
|
||||||
m_DrawingObject = false;
|
m_DrawingObject = false;
|
||||||
|
|
||||||
|
@ -37,12 +37,12 @@ void FifoRecordAnalyzer::Initialize(u32 *bpMem, u32 *cpMem)
|
||||||
memcpy(m_CpMem.arrayStrides, cpMem + 0xB0, 16 * 4);
|
memcpy(m_CpMem.arrayStrides, cpMem + 0xB0, 16 * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FifoRecordAnalyzer::AnalyzeGPCommand(u8 *data)
|
void FifoRecordAnalyzer::AnalyzeGPCommand(u8* data)
|
||||||
{
|
{
|
||||||
DecodeOpcode(data);
|
DecodeOpcode(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FifoRecordAnalyzer::DecodeOpcode(u8 *data)
|
void FifoRecordAnalyzer::DecodeOpcode(u8* data)
|
||||||
{
|
{
|
||||||
int cmd = ReadFifo8(data);
|
int cmd = ReadFifo8(data);
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ void FifoRecordAnalyzer::ProcessLoadIndexedXf(u32 val, int array)
|
||||||
FifoRecorder::GetInstance().UseMemory(address, size * 4, MemoryUpdate::XF_DATA);
|
FifoRecorder::GetInstance().UseMemory(address, size * 4, MemoryUpdate::XF_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FifoRecordAnalyzer::ProcessVertexArrays(u8 *data, u8 vtxAttrGroup)
|
void FifoRecordAnalyzer::ProcessVertexArrays(u8* data, u8 vtxAttrGroup)
|
||||||
{
|
{
|
||||||
int sizes[21];
|
int sizes[21];
|
||||||
FifoAnalyzer::CalculateVertexElementSizes(sizes, vtxAttrGroup, m_CpMem);
|
FifoAnalyzer::CalculateVertexElementSizes(sizes, vtxAttrGroup, m_CpMem);
|
||||||
|
@ -155,7 +155,7 @@ void FifoRecordAnalyzer::ProcessVertexArrays(u8 *data, u8 vtxAttrGroup)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FifoRecordAnalyzer::WriteVertexArray(int arrayIndex, u8 *vertexData, int vertexSize, int numVertices)
|
void FifoRecordAnalyzer::WriteVertexArray(int arrayIndex, u8* vertexData, int vertexSize, int numVertices)
|
||||||
{
|
{
|
||||||
// Skip if not indexed array
|
// Skip if not indexed array
|
||||||
int arrayType = (m_CpMem.vtxDesc.Hex >> (9 + (arrayIndex * 2))) & 3;
|
int arrayType = (m_CpMem.vtxDesc.Hex >> (9 + (arrayIndex * 2))) & 3;
|
||||||
|
|
|
@ -16,22 +16,22 @@ public:
|
||||||
FifoRecordAnalyzer();
|
FifoRecordAnalyzer();
|
||||||
|
|
||||||
// Must call this before analyzing GP commands
|
// Must call this before analyzing GP commands
|
||||||
void Initialize(u32 *bpMem, u32 *cpMem);
|
void Initialize(u32* bpMem, u32* cpMem);
|
||||||
|
|
||||||
// Assumes data contains all information for the command
|
// Assumes data contains all information for the command
|
||||||
// Calls FifoRecorder::UseMemory
|
// Calls FifoRecorder::UseMemory
|
||||||
void AnalyzeGPCommand(u8 *data);
|
void AnalyzeGPCommand(u8* data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DecodeOpcode(u8 *data);
|
void DecodeOpcode(u8* data);
|
||||||
|
|
||||||
void ProcessLoadIndexedXf(u32 val, int array);
|
void ProcessLoadIndexedXf(u32 val, int array);
|
||||||
void ProcessVertexArrays(u8 *data, u8 vtxAttrGroup);
|
void ProcessVertexArrays(u8* data, u8 vtxAttrGroup);
|
||||||
|
|
||||||
void WriteVertexArray(int arrayIndex, u8 *vertexData, int vertexSize, int numVertices);
|
void WriteVertexArray(int arrayIndex, u8* vertexData, int vertexSize, int numVertices);
|
||||||
|
|
||||||
bool m_DrawingObject;
|
bool m_DrawingObject;
|
||||||
|
|
||||||
BPMemory *m_BpMem;
|
BPMemory* m_BpMem;
|
||||||
FifoAnalyzer::CPMemory m_CpMem;
|
FifoAnalyzer::CPMemory m_CpMem;
|
||||||
};
|
};
|
||||||
|
|
|
@ -64,7 +64,7 @@ void FifoRecorder::StopRecording()
|
||||||
m_RequestedRecordingEnd = true;
|
m_RequestedRecordingEnd = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FifoRecorder::WriteGPCommand(u8 *data, u32 size)
|
void FifoRecorder::WriteGPCommand(u8* data, u32 size)
|
||||||
{
|
{
|
||||||
if (!m_SkipNextData)
|
if (!m_SkipNextData)
|
||||||
{
|
{
|
||||||
|
@ -104,8 +104,8 @@ void FifoRecorder::WriteGPCommand(u8 *data, u32 size)
|
||||||
|
|
||||||
void FifoRecorder::UseMemory(u32 address, u32 size, MemoryUpdate::Type type, bool dynamicUpdate)
|
void FifoRecorder::UseMemory(u32 address, u32 size, MemoryUpdate::Type type, bool dynamicUpdate)
|
||||||
{
|
{
|
||||||
u8 *curData;
|
u8* curData;
|
||||||
u8 *newData;
|
u8* newData;
|
||||||
if (address & 0x10000000)
|
if (address & 0x10000000)
|
||||||
{
|
{
|
||||||
curData = &m_ExRam[address & Memory::EXRAM_MASK];
|
curData = &m_ExRam[address & Memory::EXRAM_MASK];
|
||||||
|
@ -205,7 +205,7 @@ void FifoRecorder::SetVideoMemory(u32 *bpMem, u32 *cpMem, u32 *xfMem, u32 *xfReg
|
||||||
sMutex.unlock();
|
sMutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
FifoRecorder &FifoRecorder::GetInstance()
|
FifoRecorder& FifoRecorder::GetInstance()
|
||||||
{
|
{
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,12 @@ public:
|
||||||
void StartRecording(s32 numFrames, CallbackFunc finishedCb);
|
void StartRecording(s32 numFrames, CallbackFunc finishedCb);
|
||||||
void StopRecording();
|
void StopRecording();
|
||||||
|
|
||||||
FifoDataFile *GetRecordedFile() { return m_File; }
|
FifoDataFile* GetRecordedFile() { return m_File; }
|
||||||
|
|
||||||
// Called from video thread
|
// Called from video thread
|
||||||
|
|
||||||
// Must write one full GP command at a time
|
// Must write one full GP command at a time
|
||||||
void WriteGPCommand(u8 *data, u32 size);
|
void WriteGPCommand(u8* data, u32 size);
|
||||||
|
|
||||||
// Track memory that has been used and write it to the fifolog if it has changed.
|
// Track memory that has been used and write it to the fifolog if it has changed.
|
||||||
// If memory is updated by the video backend (dynamicUpdate == true) take special care to make sure the data
|
// If memory is updated by the video backend (dynamicUpdate == true) take special care to make sure the data
|
||||||
|
@ -36,12 +36,12 @@ public:
|
||||||
|
|
||||||
// This function must be called before writing GP commands
|
// This function must be called before writing GP commands
|
||||||
// bpMem must point to the actual bp mem array used by the plugin because it will be read as fifo data is recorded
|
// bpMem must point to the actual bp mem array used by the plugin because it will be read as fifo data is recorded
|
||||||
void SetVideoMemory(u32 *bpMem, u32 *cpMem, u32 *xfMem, u32 *xfRegs, u32 xfRegsSize);
|
void SetVideoMemory(u32* bpMem, u32* cpMem, u32* xfMem, u32* xfRegs, u32 xfRegsSize);
|
||||||
|
|
||||||
// Checked once per frame prior to callng EndFrame()
|
// Checked once per frame prior to callng EndFrame()
|
||||||
bool IsRecording() const { return m_IsRecording; }
|
bool IsRecording() const { return m_IsRecording; }
|
||||||
|
|
||||||
static FifoRecorder &GetInstance();
|
static FifoRecorder& GetInstance();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Accessed from both GUI and video threads
|
// Accessed from both GUI and video threads
|
||||||
|
@ -54,7 +54,7 @@ private:
|
||||||
volatile s32 m_RecordFramesRemaining;
|
volatile s32 m_RecordFramesRemaining;
|
||||||
volatile CallbackFunc m_FinishedCb;
|
volatile CallbackFunc m_FinishedCb;
|
||||||
|
|
||||||
FifoDataFile *volatile m_File;
|
FifoDataFile* volatile m_File;
|
||||||
|
|
||||||
// Accessed only from video thread
|
// Accessed only from video thread
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue