diff options
| author | NeoBrainX <NeoBrainX@googlemail.com> | 2011-09-08 17:09:24 +0200 |
|---|---|---|
| committer | NeoBrainX <NeoBrainX@googlemail.com> | 2011-09-29 23:32:38 +0200 |
| commit | c710ea33f97b5b64eef1c56c2f67a666146d41f6 (patch) | |
| tree | fcb621e6680a7dc9b42f621d15b2f01c40821ef3 /Source/Core/VideoCommon | |
| parent | bd4a5b5ef692bce25dcfc60e13df3f08edc84bf8 (diff) | |
Merge some frame dumping code to VideoCommon, fixes a memory leak in D3D9 and OpenGL if emulation is stopped while dumping frames.
Breaks D3D11 frame dumping for some weird reason (memory corruption or whatever?).
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/Src/RenderBase.cpp | 17 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/RenderBase.h | 13 |
2 files changed, 25 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/Src/RenderBase.cpp b/Source/Core/VideoCommon/Src/RenderBase.cpp index 06f4c81ab6..fa6ba018c7 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.cpp +++ b/Source/Core/VideoCommon/Src/RenderBase.cpp @@ -42,6 +42,7 @@ #include "Host.h" #include "XFMemory.h" #include "FifoPlayer/FifoRecorder.h" +#include "AVIDump.h" #include <cmath> #include <string> @@ -52,7 +53,6 @@ int OSDChoice, OSDTime; Renderer *g_renderer = NULL; -bool bLastFrameDumped = false; std::mutex Renderer::s_criticalScreenshot; std::string Renderer::s_sScreenshotName; @@ -81,15 +81,28 @@ bool Renderer::s_EnableDLCachingAfterRecording; unsigned int Renderer::prev_efb_format = (unsigned int)-1; -Renderer::Renderer() +Renderer::Renderer() : frame_data(NULL), bLastFrameDumped(false) { UpdateActiveConfig(); + +#if defined _WIN32 || defined HAVE_LIBAV + bAVIDumping = false; +#endif } Renderer::~Renderer() { // invalidate previous efb format prev_efb_format = (unsigned int)-1; + +#if defined _WIN32 || defined HAVE_LIBAV + if (g_ActiveConfig.bDumpFrames && bLastFrameDumped && bAVIDumping) + AVIDump::Stop(); +#else + if (f_pFrameDump.IsOpen()) + f_pFrameDump.Close(); +#endif + delete[] frame_data; } void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc, float Gamma) diff --git a/Source/Core/VideoCommon/Src/RenderBase.h b/Source/Core/VideoCommon/Src/RenderBase.h index 48f096851f..e8d4c55a20 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.h +++ b/Source/Core/VideoCommon/Src/RenderBase.h @@ -132,9 +132,6 @@ public: protected: - static std::mutex s_criticalScreenshot; - static std::string s_sScreenshotName; - static void CalculateTargetScale(int x, int y, int &scaledX, int &scaledY); static bool CalculateTargetSize(int multiplier = 1); static void CalculateXYScale(const TargetRectangle& dst_rect); @@ -143,6 +140,16 @@ protected: static void RecordVideoMemory(); static volatile bool s_bScreenshot; + static std::mutex s_criticalScreenshot; + static std::string s_sScreenshotName; + +#if defined _WIN32 || defined HAVE_LIBAV + bool bAVIDumping; +#else + File::IOFile pFrameDump; +#endif + char* frame_data; + bool bLastFrameDumped; // The framebuffer size static int s_target_width; |
