Skip to content
Permalink
Browse files

Core/FifoAnalyzer: Convert DecodeMode enum into an enum class

Makes the enumeration elements strongly typed.
  • Loading branch information...
lioncash committed Jul 15, 2019
1 parent 53779aa commit 73db402010fc74c6db94cd0c8ebc2a59e41eb5f7
@@ -188,7 +188,7 @@ u32 AnalyzeCommand(const u8* data, DecodeMode mode)
int array = 0xc + (cmd - OpcodeDecoder::GX_LOAD_INDX_A) / 8;
u32 value = ReadFifo32(data);

if (mode == DECODE_RECORD)
if (mode == DecodeMode::Record)
FifoRecordAnalyzer::ProcessLoadIndexedXf(value, array);
break;
}
@@ -229,7 +229,7 @@ u32 AnalyzeCommand(const u8* data, DecodeMode mode)
int vertexSize = offset;
int numVertices = ReadFifo16(data);

if (mode == DECODE_RECORD && numVertices > 0)
if (mode == DecodeMode::Record && numVertices > 0)
{
for (int i = 0; i < 12; ++i)
{
@@ -10,10 +10,10 @@

namespace FifoAnalyzer
{
enum DecodeMode
enum class DecodeMode
{
DECODE_RECORD,
DECODE_PLAYBACK,
Record,
Playback,
};

u32 AnalyzeCommand(const u8* data, DecodeMode mode);
@@ -63,9 +63,9 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile* file,
++nextMemUpdate;
}

bool wasDrawing = s_DrawingObject;

u32 cmdSize = FifoAnalyzer::AnalyzeCommand(&frame.fifoData[cmdStart], DECODE_PLAYBACK);
const bool wasDrawing = s_DrawingObject;
const u32 cmdSize =
FifoAnalyzer::AnalyzeCommand(&frame.fifoData[cmdStart], DecodeMode::Playback);

#if LOG_FIFO_CMDS
CmdData cmdData;
@@ -77,12 +77,14 @@ void FifoRecorder::WriteGPCommand(const u8* data, u32 size)
{
// Assumes data contains all information for the command
// 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.
if (analyzed_size != size)
{
PanicAlert("FifoRecorder: Expected command to be %i bytes long, we were given %i bytes",
analyzed_size, size);
}

// Copy data to buffer
size_t currentSize = m_FifoData.size();

0 comments on commit 73db402

Please sign in to comment.
You can’t perform that action at this time.