summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2014-08-30 18:53:18 -0400
committerLioncash <mathew1800@gmail.com>2014-08-31 00:52:36 -0400
commitf22597a4eed44af4ea2fb5df21473e7dfe314eb6 (patch)
tree594c310289b6ac532cceca0be26b6f03eaaf34b7 /Source/Core
parentfe518af22df5c293e026b23ff3a68629a563c2bf (diff)
Core: Break movie header validity checking into a function
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Movie.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp
index b2d2a4fc52..3834f417b8 100644
--- a/Source/Core/Core/Movie.cpp
+++ b/Source/Core/Core/Movie.cpp
@@ -103,6 +103,14 @@ static void EnsureTmpInputSize(size_t bound)
tmpInput = newTmpInput;
}
+static bool IsMovieHeader(u8 magic[4])
+{
+ return magic[0] == 'D' &&
+ magic[1] == 'T' &&
+ magic[2] == 'M' &&
+ magic[3] == 0x1A;
+}
+
std::string GetInputDisplay()
{
if (!IsPlayingInput() && !IsRecordingInput())
@@ -730,10 +738,7 @@ bool PlayInput(const std::string& filename)
g_recordfd.ReadArray(&tmpHeader, 1);
- if (tmpHeader.filetype[0] != 'D' ||
- tmpHeader.filetype[1] != 'T' ||
- tmpHeader.filetype[2] != 'M' ||
- tmpHeader.filetype[3] != 0x1A)
+ if (!IsMovieHeader(tmpHeader.filetype))
{
PanicAlertT("Invalid recording file");
goto cleanup;
@@ -801,7 +806,7 @@ void LoadInput(const std::string& filename)
t_record.ReadArray(&tmpHeader, 1);
- if (tmpHeader.filetype[0] != 'D' || tmpHeader.filetype[1] != 'T' || tmpHeader.filetype[2] != 'M' || tmpHeader.filetype[3] != 0x1A)
+ if (!IsMovieHeader(tmpHeader.filetype))
{
PanicAlertT("Savestate movie %s is corrupted, movie recording stopping...", filename.c_str());
EndPlayInput(false);