FifoPlayer: Fixup style of types.

This commit is contained in:
Scott Mansell 2015-09-12 22:32:52 +12:00
parent a355d9868e
commit aa1fec6fc3
12 changed files with 68 additions and 68 deletions

View File

@ -19,34 +19,34 @@ void Init()
VertexLoader_Normal::Init();
}
u8 ReadFifo8(u8 *&data)
u8 ReadFifo8(u8*& data)
{
u8 value = data[0];
data += 1;
return value;
}
u16 ReadFifo16(u8 *&data)
u16 ReadFifo16(u8*& data)
{
u16 value = Common::swap16(data);
data += 2;
return value;
}
u32 ReadFifo32(u8 *&data)
u32 ReadFifo32(u8*& data)
{
u32 value = Common::swap32(data);
data += 4;
return value;
}
void InitBPMemory(BPMemory *bpMem)
void InitBPMemory(BPMemory* bpMem)
{
memset(bpMem, 0, sizeof(BPMemory));
bpMem->bpMask = 0x00FFFFFF;
}
BPCmd DecodeBPCmd(u32 value, const BPMemory &bpMem)
BPCmd DecodeBPCmd(u32 value, const BPMemory& bpMem)
{
//handle the mask register
int opcode = value >> 24;
@ -59,7 +59,7 @@ BPCmd DecodeBPCmd(u32 value, const BPMemory &bpMem)
return bp;
}
void LoadBPReg(const BPCmd &bp, BPMemory &bpMem)
void LoadBPReg(const BPCmd& bp, BPMemory& bpMem)
{
((u32*)&bpMem)[bp.address] = bp.newvalue;
@ -68,7 +68,7 @@ void LoadBPReg(const BPCmd &bp, BPMemory &bpMem)
bpMem.bpMask = 0xFFFFFF;
}
void LoadCPReg(u32 subCmd, u32 value, CPMemory &cpMem)
void LoadCPReg(u32 subCmd, u32 value, CPMemory& cpMem)
{
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;
@ -120,7 +120,7 @@ u32 CalculateVertexSize(int vatIndex, const CPMemory &cpMem)
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 VAT &vtxAttr = cpMem.vtxAttr[vatIndex];

View File

@ -13,15 +13,15 @@ namespace FifoAnalyzer
{
void Init();
u8 ReadFifo8(u8 *&data);
u16 ReadFifo16(u8 *&data);
u32 ReadFifo32(u8 *&data);
u8 ReadFifo8(u8*& data);
u16 ReadFifo16(u8*& data);
u32 ReadFifo32(u8*& data);
// TODO- move to video common
void InitBPMemory(BPMemory *bpMem);
void InitBPMemory(BPMemory* bpMem);
BPCmd DecodeBPCmd(u32 value, const BPMemory &bpMem);
void LoadBPReg(const BPCmd &bp, BPMemory &bpMem);
void GetTlutLoadData(u32 &tlutAddr, u32 &memAddr, u32 &tlutXferCount, BPMemory &bpMem);
void LoadBPReg(const BPCmd& bp, BPMemory &bpMem);
void GetTlutLoadData(u32& tlutAddr, u32 &memAddr, u32 &tlutXferCount, BPMemory &bpMem);
struct CPMemory
{
@ -31,8 +31,8 @@ namespace FifoAnalyzer
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);
void CalculateVertexElementSizes(int sizes[], int vatIndex, const CPMemory &cpMem);
u32 CalculateVertexSize(int vatIndex, const CPMemory& cpMem);
void CalculateVertexElementSizes(int sizes[], int vatIndex, const CPMemory& cpMem);
}

View File

@ -43,7 +43,7 @@ bool FifoDataFile::GetIsWii() const
return GetFlag(FLAG_IS_WII);
}
void FifoDataFile::AddFrame(const FifoFrameInfo &frameInfo)
void FifoDataFile::AddFrame(const FifoFrameInfo& frameInfo)
{
m_Frames.push_back(frameInfo);
}
@ -131,7 +131,7 @@ bool FifoDataFile::Save(const std::string& filename)
return true;
}
FifoDataFile *FifoDataFile::Load(const std::string &filename, bool flagsOnly)
FifoDataFile* FifoDataFile::Load(const std::string &filename, bool flagsOnly)
{
File::IOFile file;
file.Open(filename, "rb");
@ -219,7 +219,7 @@ bool FifoDataFile::GetFlag(u32 flag) const
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
u64 updateListOffset = file.Tell();
@ -249,7 +249,7 @@ u64 FifoDataFile::WriteMemoryUpdates(const std::vector<MemoryUpdate> &memUpdates
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);
@ -260,7 +260,7 @@ void FifoDataFile::ReadMemoryUpdates(u64 fileOffset, u32 numUpdates, std::vector
FileMemoryUpdate srcUpdate;
file.ReadBytes(&srcUpdate, sizeof(FileMemoryUpdate));
MemoryUpdate &dstUpdate = memUpdates[i];
MemoryUpdate& dstUpdate = memUpdates[i];
dstUpdate.address = srcUpdate.address;
dstUpdate.fifoPosition = srcUpdate.fifoPosition;
dstUpdate.size = srcUpdate.dataSize;

View File

@ -27,13 +27,13 @@ struct MemoryUpdate
u32 fifoPosition;
u32 address;
u32 size;
u8 *data;
u8* data;
Type type;
};
struct FifoFrameInfo
{
u8 *fifoData;
u8* fifoData;
u32 fifoDataSize;
u32 fifoStart;
@ -72,7 +72,7 @@ public:
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:
enum
@ -85,8 +85,8 @@ private:
void SetFlag(u32 flag, bool set);
bool GetFlag(u32 flag) const;
u64 WriteMemoryUpdates(const std::vector<MemoryUpdate> &memUpdates, File::IOFile &file);
static void ReadMemoryUpdates(u64 fileOffset, u32 numUpdates, 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);
u32 m_BPMem[BP_MEM_SIZE];
u32 m_CPMem[CP_MEM_SIZE];

View File

@ -20,7 +20,7 @@ struct CmdData
{
u32 size;
u32 offset;
u8 *ptr;
u8* ptr;
};
FifoPlaybackAnalyzer::FifoPlaybackAnalyzer()
@ -28,13 +28,13 @@ FifoPlaybackAnalyzer::FifoPlaybackAnalyzer()
FifoAnalyzer::Init();
}
void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector<AnalyzedFrameInfo> &frameInfo)
void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile* file, std::vector<AnalyzedFrameInfo>& frameInfo)
{
// Load BP memory
u32 *bpMem = file->GetBPMem();
u32* bpMem = file->GetBPMem();
memcpy(&m_BpMem, bpMem, sizeof(BPMemory));
u32 *cpMem = file->GetCPMem();
u32* cpMem = file->GetCPMem();
FifoAnalyzer::LoadCPReg(0x50, cpMem[0x50], 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 end = memUpdate.address + memUpdate.size;
@ -152,9 +152,9 @@ void FifoPlaybackAnalyzer::AddMemoryUpdate(MemoryUpdate memUpdate, AnalyzedFrame
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);

View File

@ -22,7 +22,7 @@ class FifoPlaybackAnalyzer
public:
FifoPlaybackAnalyzer();
void AnalyzeFrames(FifoDataFile *file, std::vector<AnalyzedFrameInfo> &frameInfo);
void AnalyzeFrames(FifoDataFile* file, std::vector<AnalyzedFrameInfo>& frameInfo);
private:
struct MemoryRange
@ -31,9 +31,9 @@ private:
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 StoreWrittenRegion(u32 address, u32 size);

View File

@ -153,7 +153,7 @@ void FifoPlayer::SetFrameRangeEnd(u32 end)
}
}
FifoPlayer &FifoPlayer::GetInstance()
FifoPlayer& FifoPlayer::GetInstance()
{
static FifoPlayer instance;
return instance;
@ -173,7 +173,7 @@ FifoPlayer::FifoPlayer() :
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
m_CyclesPerFrame = SystemTimers::GetTicksPerSecond() / VideoInterface::TargetRefreshRate;
@ -232,9 +232,9 @@ void FifoPlayer::WriteFrame(const FifoFrameInfo &frame, const AnalyzedFrameInfo
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)
{
@ -289,7 +289,7 @@ void FifoPlayer::WriteMemory(const MemoryUpdate& memUpdate)
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 lastBurstEnd = end - 1;
@ -452,7 +452,7 @@ void FifoPlayer::LoadXFReg(u16 reg, u32 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
GPFifo::Write8(0x10); // load XF reg

View File

@ -87,15 +87,15 @@ public:
private:
FifoPlayer();
void WriteFrame(const FifoFrameInfo &frame, const AnalyzedFrameInfo &info);
void WriteFramePart(u32 dataStart, u32 dataEnd, u32 &nextMemUpdate, 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 WriteAllMemoryUpdates();
void WriteMemory(const MemoryUpdate &memUpdate);
// 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
void WriteFifo(u8 *data, u32 start, u32 end);
void WriteFifo(u8* data, u32 start, u32 end);
void SetupFifo();
@ -131,7 +131,7 @@ private:
CallbackFunc m_FileLoadedCb;
CallbackFunc m_FrameWrittenCb;
FifoDataFile *m_File;
FifoDataFile* m_File;
std::vector<AnalyzedFrameInfo> m_FrameInfo;
};

View File

@ -22,7 +22,7 @@ FifoRecordAnalyzer::FifoRecordAnalyzer() :
{
}
void FifoRecordAnalyzer::Initialize(u32 *bpMem, u32 *cpMem)
void FifoRecordAnalyzer::Initialize(u32* bpMem, u32* cpMem)
{
m_DrawingObject = false;
@ -37,12 +37,12 @@ void FifoRecordAnalyzer::Initialize(u32 *bpMem, u32 *cpMem)
memcpy(m_CpMem.arrayStrides, cpMem + 0xB0, 16 * 4);
}
void FifoRecordAnalyzer::AnalyzeGPCommand(u8 *data)
void FifoRecordAnalyzer::AnalyzeGPCommand(u8* data)
{
DecodeOpcode(data);
}
void FifoRecordAnalyzer::DecodeOpcode(u8 *data)
void FifoRecordAnalyzer::DecodeOpcode(u8* 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);
}
void FifoRecordAnalyzer::ProcessVertexArrays(u8 *data, u8 vtxAttrGroup)
void FifoRecordAnalyzer::ProcessVertexArrays(u8* data, u8 vtxAttrGroup)
{
int sizes[21];
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
int arrayType = (m_CpMem.vtxDesc.Hex >> (9 + (arrayIndex * 2))) & 3;

View File

@ -16,22 +16,22 @@ public:
FifoRecordAnalyzer();
// 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
// Calls FifoRecorder::UseMemory
void AnalyzeGPCommand(u8 *data);
void AnalyzeGPCommand(u8* data);
private:
void DecodeOpcode(u8 *data);
void DecodeOpcode(u8* data);
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;
BPMemory *m_BpMem;
BPMemory* m_BpMem;
FifoAnalyzer::CPMemory m_CpMem;
};

View File

@ -64,7 +64,7 @@ void FifoRecorder::StopRecording()
m_RequestedRecordingEnd = true;
}
void FifoRecorder::WriteGPCommand(u8 *data, u32 size)
void FifoRecorder::WriteGPCommand(u8* data, u32 size)
{
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)
{
u8 *curData;
u8 *newData;
u8* curData;
u8* newData;
if (address & 0x10000000)
{
curData = &m_ExRam[address & Memory::EXRAM_MASK];
@ -205,7 +205,7 @@ void FifoRecorder::SetVideoMemory(u32 *bpMem, u32 *cpMem, u32 *xfMem, u32 *xfReg
sMutex.unlock();
}
FifoRecorder &FifoRecorder::GetInstance()
FifoRecorder& FifoRecorder::GetInstance()
{
return instance;
}

View File

@ -20,12 +20,12 @@ public:
void StartRecording(s32 numFrames, CallbackFunc finishedCb);
void StopRecording();
FifoDataFile *GetRecordedFile() { return m_File; }
FifoDataFile* GetRecordedFile() { return m_File; }
// Called from video thread
// 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.
// 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
// 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()
bool IsRecording() const { return m_IsRecording; }
static FifoRecorder &GetInstance();
static FifoRecorder& GetInstance();
private:
// Accessed from both GUI and video threads
@ -54,7 +54,7 @@ private:
volatile s32 m_RecordFramesRemaining;
volatile CallbackFunc m_FinishedCb;
FifoDataFile *volatile m_File;
FifoDataFile* volatile m_File;
// Accessed only from video thread