summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorChris Burgener <christhecoolist@gmail.com>2016-01-03 17:20:42 -0500
committerChris Burgener <christhecoolist@gmail.com>2016-01-03 18:39:52 -0500
commitfe4e99d6bf84da94d3fbd04ab8fb5cffeae0189f (patch)
tree338897c38e8dde57f5eb70f890d10f1096fc0605 /Source/Core
parent988f62dfb1d7ce3c86d79e8aa1dcb4fae55852fb (diff)
AVIDump Clean Up and Fixes
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/VideoCommon/AVIDump.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/Source/Core/VideoCommon/AVIDump.cpp b/Source/Core/VideoCommon/AVIDump.cpp
index 0424082709..1d00cf230a 100644
--- a/Source/Core/VideoCommon/AVIDump.cpp
+++ b/Source/Core/VideoCommon/AVIDump.cpp
@@ -13,6 +13,7 @@
#include "Common/StringUtil.h"
#include "Common/Logging/Log.h"
+#include "Core/ConfigManager.h"
#include "Core/CoreTiming.h"
#include "Core/HW/SystemTimers.h"
#include "Core/HW/VideoInterface.h" //for TargetRefreshRate
@@ -28,9 +29,6 @@
#include <vfw.h>
#include <winerror.h>
-#include "Core/ConfigManager.h" // for PAL60
-#include "Core/CoreTiming.h"
-
static HWND s_emu_wnd;
static LONG s_byte_buffer;
static LONG s_frame_count;
@@ -42,7 +40,6 @@ static int s_file_count;
static u64 s_last_frame;
static PAVISTREAM s_stream;
static PAVISTREAM s_stream_compressed;
-static int s_frame_rate;
static AVISTREAMINFO s_header;
static AVICOMPRESSOPTIONS s_options;
static AVICOMPRESSOPTIONS* s_array_options[1];
@@ -63,11 +60,6 @@ bool AVIDump::Start(HWND hWnd, int w, int h)
s_last_frame = CoreTiming::GetTicks();
- if (SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.E60"))
- s_frame_rate = 60; // always 60, for either pal60 or ntsc
- else
- s_frame_rate = VideoInterface::TargetRefreshRate; // 50 or 60, depending on region
-
// clear CFR frame cache on start, not on file create (which is also segment switch)
SetBitmapFormat();
StoreFrame(nullptr);
@@ -93,6 +85,11 @@ bool AVIDump::CreateFile()
{
File::Delete(movie_file_name);
}
+ else
+ {
+ // Stop and cancel dumping the video
+ return false;
+ }
}
AVIFileInit();
@@ -311,7 +308,7 @@ bool AVIDump::SetVideoFormat()
memset(&s_header, 0, sizeof(s_header));
s_header.fccType = streamtypeVIDEO;
s_header.dwScale = 1;
- s_header.dwRate = s_frame_rate;
+ s_header.dwRate = VideoInterface::TargetRefreshRate;
s_header.dwSuggestedBufferSize = s_bitmap.biSizeImage;
return SUCCEEDED(AVIFileCreateStream(s_file, &s_stream, &s_header));
@@ -383,6 +380,21 @@ bool AVIDump::CreateFile()
(File::GetUserPath(D_DUMPFRAMES_IDX) + "framedump0.avi").c_str());
File::CreateFullPath(s_format_context->filename);
+ // Ask to delete file
+ if (File::Exists(s_format_context->filename))
+ {
+ if (SConfig::GetInstance().m_DumpFramesSilent ||
+ AskYesNoT("Delete the existing file '%s'?", s_format_context->filename))
+ {
+ File::Delete(s_format_context->filename);
+ }
+ else
+ {
+ // Stop and cancel dumping the video
+ return false;
+ }
+ }
+
if (!(s_format_context->oformat = av_guess_format("avi", nullptr, nullptr)) ||
!(s_stream = avformat_new_stream(s_format_context, codec)))
{