Core/FifoAnalyzer: Convert DecodeMode enum into an enum class

Makes the enumeration elements strongly typed.
This commit is contained in:
Lioncash
2019-07-14 20:43:20 -04:00
parent 53779aa732
commit 73db402010
4 changed files with 11 additions and 9 deletions

View File

@ -188,7 +188,7 @@ u32 AnalyzeCommand(const u8* data, DecodeMode mode)
int array = 0xc + (cmd - OpcodeDecoder::GX_LOAD_INDX_A) / 8; int array = 0xc + (cmd - OpcodeDecoder::GX_LOAD_INDX_A) / 8;
u32 value = ReadFifo32(data); u32 value = ReadFifo32(data);
if (mode == DECODE_RECORD) if (mode == DecodeMode::Record)
FifoRecordAnalyzer::ProcessLoadIndexedXf(value, array); FifoRecordAnalyzer::ProcessLoadIndexedXf(value, array);
break; break;
} }
@ -229,7 +229,7 @@ u32 AnalyzeCommand(const u8* data, DecodeMode mode)
int vertexSize = offset; int vertexSize = offset;
int numVertices = ReadFifo16(data); int numVertices = ReadFifo16(data);
if (mode == DECODE_RECORD && numVertices > 0) if (mode == DecodeMode::Record && numVertices > 0)
{ {
for (int i = 0; i < 12; ++i) for (int i = 0; i < 12; ++i)
{ {

View File

@ -10,10 +10,10 @@
namespace FifoAnalyzer namespace FifoAnalyzer
{ {
enum DecodeMode enum class DecodeMode
{ {
DECODE_RECORD, Record,
DECODE_PLAYBACK, Playback,
}; };
u32 AnalyzeCommand(const u8* data, DecodeMode mode); u32 AnalyzeCommand(const u8* data, DecodeMode mode);

View File

@ -63,9 +63,9 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile* file,
++nextMemUpdate; ++nextMemUpdate;
} }
bool wasDrawing = s_DrawingObject; const bool wasDrawing = s_DrawingObject;
const u32 cmdSize =
u32 cmdSize = FifoAnalyzer::AnalyzeCommand(&frame.fifoData[cmdStart], DECODE_PLAYBACK); FifoAnalyzer::AnalyzeCommand(&frame.fifoData[cmdStart], DecodeMode::Playback);
#if LOG_FIFO_CMDS #if LOG_FIFO_CMDS
CmdData cmdData; CmdData cmdData;

View File

@ -77,12 +77,14 @@ void FifoRecorder::WriteGPCommand(const u8* data, u32 size)
{ {
// Assumes data contains all information for the command // Assumes data contains all information for the command
// Calls FifoRecorder::UseMemory // Calls FifoRecorder::UseMemory
u32 analyzed_size = FifoAnalyzer::AnalyzeCommand(data, FifoAnalyzer::DECODE_RECORD); const u32 analyzed_size = FifoAnalyzer::AnalyzeCommand(data, FifoAnalyzer::DecodeMode::Record);
// Make sure FifoPlayer's command analyzer agrees about the size of the command. // Make sure FifoPlayer's command analyzer agrees about the size of the command.
if (analyzed_size != size) if (analyzed_size != size)
{
PanicAlert("FifoRecorder: Expected command to be %i bytes long, we were given %i bytes", PanicAlert("FifoRecorder: Expected command to be %i bytes long, we were given %i bytes",
analyzed_size, size); analyzed_size, size);
}
// Copy data to buffer // Copy data to buffer
size_t currentSize = m_FifoData.size(); size_t currentSize = m_FifoData.size();