mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
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?).
This commit is contained in:
@ -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)
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user