Merge branch 'fifoplayer_updates'.

This adds an "Analyzer" tab to the fifoplayer dialog which allows to conveniently browse through all register pokes that are being sent by the game each frame.
There's also a search function, but it doesn't work all that well for anything but simple searches at the moment. However, I'm merging this anyway since I'm not sure if I'm going to finish this.

Note that due to recent fifo changes, it's not yet possible to run fifoplayer in dual-core mode.
This commit is contained in:
NeoBrainX
2012-03-29 22:50:45 +02:00
7 changed files with 628 additions and 23 deletions
@@ -71,10 +71,10 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector<Analyze
u32 cmdStart = 0;
u32 nextMemUpdate = 0;
// Debugging
vector<CmdData> prevCmds;
while (cmdStart < frame.fifoDataSize)
{
// Add memory updates that have occured before this point in the frame
@@ -83,9 +83,9 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector<Analyze
AddMemoryUpdate(frame.memoryUpdates[nextMemUpdate], analyzed);
++nextMemUpdate;
}
bool wasDrawing = m_DrawingObject;
u32 cmdSize = DecodeCommand(&frame.fifoData[cmdStart]);
#if (LOG_FIFO_CMDS)
@@ -95,7 +95,7 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector<Analyze
cmdData.size = cmdSize;
prevCmds.push_back(cmdData);
#endif
// Check for error
if (cmdSize == 0)
{
@@ -94,8 +94,9 @@ bool FifoPlayer::Play()
if (m_EarlyMemoryUpdates && m_CurrentFrame == m_FrameRangeStart)
WriteAllMemoryUpdates();
WriteFrame(m_File->GetFrame(m_CurrentFrame), m_FrameInfo[m_CurrentFrame]);
++m_CurrentFrame;
WriteFrame(m_File->GetFrame(m_CurrentFrame), m_FrameInfo[m_CurrentFrame]);
++m_CurrentFrame;
}
}
}
@@ -44,6 +44,8 @@ public:
u32 GetFrameObjectCount();
u32 GetCurrentFrameNum() { return m_CurrentFrame; }
const AnalyzedFrameInfo& GetAnalyzedFrameInfo(u32 frame) { return m_FrameInfo[frame]; }
// Frame range
u32 GetFrameRangeStart() { return m_FrameRangeStart; }
void SetFrameRangeStart(u32 start);
File diff suppressed because it is too large Load Diff
+34
View File
@@ -18,6 +18,7 @@
#ifndef __FIFO_PLAYER_DLG_h__
#define __FIFO_PLAYER_DLG_h__
#include <vector>
#include <wx/wx.h>
#include <wx/notebook.h>
@@ -44,11 +45,22 @@ private:
void OnNumFramesToRecord( wxSpinEvent& event );
void OnCloseClick( wxCommandEvent& event );
void OnBeginSearch(wxCommandEvent& event);
void OnFindNextClick(wxCommandEvent& event);
void OnFindPreviousClick(wxCommandEvent& event);
void OnSearchFieldTextChanged(wxCommandEvent& event);
void ChangeSearchResult(unsigned int result_idx);
void OnRecordingFinished(wxCommandEvent& event);
void OnFrameWritten(wxCommandEvent& event);
void OnFrameListSelectionChanged(wxCommandEvent& event);
void OnObjectListSelectionChanged(wxCommandEvent& event);
void OnObjectCmdListSelectionChanged(wxCommandEvent& event);
void UpdatePlayGui();
void UpdateRecorderGui();
void UpdateAnalyzerGui();
wxString CreateFileFrameCountLabel() const;
wxString CreateCurrentFrameLabel() const;
@@ -89,6 +101,28 @@ private:
wxButton* m_Save;
wxStaticText* m_FramesToRecordLabel;
wxSpinCtrl* m_FramesToRecordCtrl;
wxPanel* m_AnalyzePage;
wxListBox* m_framesList;
wxListBox* m_objectsList;
wxListBox* m_objectCmdList;
std::vector<u32> m_objectCmdOffsets;
wxStaticText* m_objectCmdInfo;
wxTextCtrl* m_searchField;
wxButton* m_beginSearch;
wxButton* m_findNext;
wxButton* m_findPrevious;
wxStaticText* m_numResultsText;
struct SearchResult {
int frame_idx;
int obj_idx;
int cmd_idx;
};
std::vector<SearchResult> search_results;
unsigned int m_search_result_idx;
wxButton* m_Close;
s32 m_FramesToRecord;
+110
View File
@@ -66,3 +66,113 @@ void BPReload()
}
}
}
void GetBPRegInfo(const u8* data, char* name, size_t name_size, char* desc, size_t desc_size)
{
const char* no_yes[2] = { "No", "Yes" };
u32 cmddata = Common::swap32(*(u32*)data) & 0xFFFFFF;
switch (data[0])
{
// Macro to set the register name and make sure it was written correctly via compile time assertion
#define SetRegName(reg) \
snprintf(name, name_size, #reg); \
(void)(reg);
case BPMEM_DISPLAYCOPYFILER: // 0x01
// TODO: This is actually the sample pattern used for copies from an antialiased EFB
SetRegName(BPMEM_DISPLAYCOPYFILER);
// TODO: Description
break;
case 0x02: // 0x02
case 0x03: // 0x03
case 0x04: // 0x04
// TODO: same as BPMEM_DISPLAYCOPYFILER
break;
case BPMEM_EFB_TL: // 0x49
{
SetRegName(BPMEM_EFB_TL);
X10Y10 left_top; left_top.hex = cmddata;
snprintf(desc, desc_size, "Left: %d\nTop: %d", left_top.x, left_top.y);
}
break;
case BPMEM_EFB_BR: // 0x4A
{
// TODO: Misleading name, should be BPMEM_EFB_WH instead
SetRegName(BPMEM_EFB_BR);
X10Y10 width_height; width_height.hex = cmddata;
snprintf(desc, desc_size, "Width: %d\nHeight: %d", width_height.x+1, width_height.y+1);
}
break;
case BPMEM_EFB_ADDR: // 0x4B
SetRegName(BPMEM_EFB_ADDR);
snprintf(desc, desc_size, "Target address (32 byte aligned): 0x%06X", cmddata << 5);
break;
case BPMEM_COPYYSCALE: // 0x4E
SetRegName(BPMEM_COPYYSCALE);
snprintf(desc, desc_size, "Scaling factor (XFB copy only): 0x%X (%f or inverted %f)", cmddata, (float)cmddata/256.f, 256.f/(float)cmddata);
break;
case BPMEM_CLEAR_AR: // 0x4F
SetRegName(BPMEM_CLEAR_AR);
snprintf(desc, desc_size, "Alpha: 0x%02X\nRed: 0x%02X", (cmddata&0xFF00)>>8, cmddata&0xFF);
break;
case BPMEM_CLEAR_GB: // 0x50
SetRegName(BPMEM_CLEAR_GB);
snprintf(desc, desc_size, "Green: 0x%02X\nBlue: 0x%02X", (cmddata&0xFF00)>>8, cmddata&0xFF);
break;
case BPMEM_CLEAR_Z: // 0x51
SetRegName(BPMEM_CLEAR_Z);
snprintf(desc, desc_size, "Z value: 0x%06X", cmddata);
break;
case BPMEM_TRIGGER_EFB_COPY: // 0x52
{
SetRegName(BPMEM_TRIGGER_EFB_COPY);
UPE_Copy copy; copy.Hex = cmddata;
snprintf(desc, desc_size, "Clamping: %s\n"
"Converting from RGB to YUV: %s\n"
"Target pixel format: 0x%X\n"
"Gamma correction: %s\n"
"Mipmap filter: %s\n"
"Vertical scaling: %s\n"
"Clear: %s\n"
"Frame to field: 0x%01X\n"
"Copy to XFB: %s\n"
"Intensity format: %s\n"
"Automatic color conversion: %s",
(copy.clamp0 && copy.clamp1) ? "Top and Bottom" : (copy.clamp0) ? "Top only" : (copy.clamp1) ? "Bottom only" : "None",
no_yes[copy.yuv],
copy.tp_realFormat(),
(copy.gamma==0)?"1.0":(copy.gamma==1)?"1.7":(copy.gamma==2)?"2.2":"Invalid value 0x3?",
no_yes[copy.half_scale],
no_yes[copy.scale_invert],
no_yes[copy.clear],
copy.frame_to_field,
no_yes[copy.copy_to_xfb],
no_yes[copy.intensity_fmt],
no_yes[copy.auto_conv]);
}
break;
case BPMEM_COPYFILTER0: // 0x53
SetRegName(BPMEM_COPYFILTER0);
// TODO: Description
break;
case BPMEM_COPYFILTER1: // 0x54
SetRegName(BPMEM_COPYFILTER1);
// TODO: Description
break;
#undef SET_REG_NAME
}
}
+2
View File
@@ -995,4 +995,6 @@ extern BPMemory bpmem;
void LoadBPReg(u32 value0);
void GetBPRegInfo(const u8* data, char* name, size_t name_size, char* desc, size_t desc_size);
#endif // _BPMEMORY_H