summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-07-14 20:43:20 -0400
committerLioncash <mathew1800@gmail.com>2019-07-15 07:37:30 -0400
commit73db402010fc74c6db94cd0c8ebc2a59e41eb5f7 (patch)
treebfa9873078aa6fea75f70a5402ad1d84f0810933 /Source
parent53779aa73209e521e431e0c8b2b105f97a7c1c5a (diff)
Core/FifoAnalyzer: Convert DecodeMode enum into an enum class
Makes the enumeration elements strongly typed.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/FifoPlayer/FifoAnalyzer.cpp4
-rw-r--r--Source/Core/Core/FifoPlayer/FifoAnalyzer.h6
-rw-r--r--Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.cpp6
-rw-r--r--Source/Core/Core/FifoPlayer/FifoRecorder.cpp4
4 files changed, 11 insertions, 9 deletions
diff --git a/Source/Core/Core/FifoPlayer/FifoAnalyzer.cpp b/Source/Core/Core/FifoPlayer/FifoAnalyzer.cpp
index c0b1bd2e9c..f2a369a84f 100644
--- a/Source/Core/Core/FifoPlayer/FifoAnalyzer.cpp
+++ b/Source/Core/Core/FifoPlayer/FifoAnalyzer.cpp
@@ -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)
{
diff --git a/Source/Core/Core/FifoPlayer/FifoAnalyzer.h b/Source/Core/Core/FifoPlayer/FifoAnalyzer.h
index 550fe15489..52fbeb7179 100644
--- a/Source/Core/Core/FifoPlayer/FifoAnalyzer.h
+++ b/Source/Core/Core/FifoPlayer/FifoAnalyzer.h
@@ -10,10 +10,10 @@
namespace FifoAnalyzer
{
-enum DecodeMode
+enum class DecodeMode
{
- DECODE_RECORD,
- DECODE_PLAYBACK,
+ Record,
+ Playback,
};
u32 AnalyzeCommand(const u8* data, DecodeMode mode);
diff --git a/Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.cpp b/Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.cpp
index 0458fe2fde..4b8da762bc 100644
--- a/Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.cpp
+++ b/Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.cpp
@@ -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;
diff --git a/Source/Core/Core/FifoPlayer/FifoRecorder.cpp b/Source/Core/Core/FifoPlayer/FifoRecorder.cpp
index f85eeb9aef..96329d695b 100644
--- a/Source/Core/Core/FifoPlayer/FifoRecorder.cpp
+++ b/Source/Core/Core/FifoPlayer/FifoRecorder.cpp
@@ -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();