mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-26 15:55:31 +01:00
Actually, filename really does need to be a parameter because of some random debug thing.
This commit is contained in:
parent
cd46138d29
commit
74b5fb3ab4
@ -680,7 +680,7 @@ void Renderer::SetBlendMode(bool forceUpdate)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::TakeScreenshot(const TargetRectangle &rc)
|
void Renderer::TakeScreenshot(const TargetRectangle &rc, std::string filename)
|
||||||
{
|
{
|
||||||
if (!s_screenshot_texture)
|
if (!s_screenshot_texture)
|
||||||
CreateScreenshotTexture(rc);
|
CreateScreenshotTexture(rc);
|
||||||
@ -708,7 +708,7 @@ void Renderer::TakeScreenshot(const TargetRectangle &rc)
|
|||||||
}
|
}
|
||||||
D3D::context->Unmap(s_screenshot_texture, 0);
|
D3D::context->Unmap(s_screenshot_texture, 0);
|
||||||
|
|
||||||
SaveScreenshot(dest, rc.GetWidth(), rc.GetHeight());
|
SaveScreenshot(dest, rc.GetWidth(), rc.GetHeight(), filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void formatBufferDump(const u8* in, u8* out, int w, int h, int p)
|
void formatBufferDump(const u8* in, u8* out, int w, int h, int p)
|
||||||
@ -846,7 +846,8 @@ void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangle& r
|
|||||||
// done with drawing the game stuff, good moment to save a screenshot
|
// done with drawing the game stuff, good moment to save a screenshot
|
||||||
if (s_bScreenshot)
|
if (s_bScreenshot)
|
||||||
{
|
{
|
||||||
TakeScreenshot(GetTargetRectangle());
|
TakeScreenshot(GetTargetRectangle(), s_sScreenshotName);
|
||||||
|
s_bScreenshot = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dump frames
|
// Dump frames
|
||||||
|
@ -48,7 +48,7 @@ public:
|
|||||||
|
|
||||||
void UpdateViewport();
|
void UpdateViewport();
|
||||||
|
|
||||||
static void TakeScreenshot(const TargetRectangle &rc);
|
static void TakeScreenshot(const TargetRectangle &rc, std::string filename);
|
||||||
|
|
||||||
static bool CheckForResize();
|
static bool CheckForResize();
|
||||||
|
|
||||||
|
@ -1378,7 +1378,8 @@ void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangle& r
|
|||||||
// Save screenshot
|
// Save screenshot
|
||||||
if (s_bScreenshot)
|
if (s_bScreenshot)
|
||||||
{
|
{
|
||||||
TakeScreenshot(flipped_trc);
|
TakeScreenshot(flipped_trc, s_sScreenshotName);
|
||||||
|
s_bScreenshot = false;
|
||||||
// Reset settings
|
// Reset settings
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1772,7 +1773,7 @@ void Renderer::FlipImageData(u8 *data, int w, int h)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::TakeScreenshot(const TargetRectangle &back_rc)
|
void Renderer::TakeScreenshot(const TargetRectangle &back_rc, std::string filename)
|
||||||
{
|
{
|
||||||
u32 W = back_rc.GetWidth();
|
u32 W = back_rc.GetWidth();
|
||||||
u32 H = back_rc.GetHeight();
|
u32 H = back_rc.GetHeight();
|
||||||
@ -1792,7 +1793,7 @@ void Renderer::TakeScreenshot(const TargetRectangle &back_rc)
|
|||||||
// Turn image upside down
|
// Turn image upside down
|
||||||
FlipImageData(data, W, H);
|
FlipImageData(data, W, H);
|
||||||
|
|
||||||
SaveScreenshot(data, W, H);
|
SaveScreenshot(data, W, H, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ public:
|
|||||||
|
|
||||||
void UpdateViewport();
|
void UpdateViewport();
|
||||||
|
|
||||||
static void TakeScreenshot(const TargetRectangle &rc);
|
static void TakeScreenshot(const TargetRectangle &rc, std::string filename);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void UpdateEFBCache(EFBAccessType type, u32 cacheRectIdx, const EFBRectangle& efbPixelRc, const TargetRectangle& targetPixelRc, const u32* data);
|
void UpdateEFBCache(EFBAccessType type, u32 cacheRectIdx, const EFBRectangle& efbPixelRc, const TargetRectangle& targetPixelRc, const u32* data);
|
||||||
|
@ -341,7 +341,7 @@ void VertexManager::vFlush()
|
|||||||
tr.right = Renderer::GetTargetWidth();
|
tr.right = Renderer::GetTargetWidth();
|
||||||
tr.top = 0;
|
tr.top = 0;
|
||||||
tr.bottom = Renderer::GetTargetHeight();
|
tr.bottom = Renderer::GetTargetHeight();
|
||||||
g_renderer->SaveScreenshot(str, tr);
|
static_cast<OGL::Renderer *>(g_renderer)->TakeScreenshot(tr, str);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
g_Config.iSaveTargetId++;
|
g_Config.iSaveTargetId++;
|
||||||
|
@ -294,13 +294,13 @@ void Renderer::SaveScreenshotOnThread(u8* data, size_t width, size_t height, std
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Renderer::SaveScreenshot(u8* ptr, size_t width, size_t height)
|
void Renderer::SaveScreenshot(u8* ptr, size_t width, size_t height, std::string filename)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lk(s_criticalScreenshot);
|
std::lock_guard<std::mutex> lk(s_criticalScreenshot);
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
#if defined(HAVE_WX) && HAVE_WX
|
||||||
// Create wxImage
|
// Create wxImage
|
||||||
|
|
||||||
std::thread thread(SaveScreenshotOnThread, ptr, width, height, s_sScreenshotName);
|
std::thread thread(SaveScreenshotOnThread, ptr, width, height, filename);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
SetThreadPriority(thread.native_handle(), THREAD_PRIORITY_BELOW_NORMAL);
|
SetThreadPriority(thread.native_handle(), THREAD_PRIORITY_BELOW_NORMAL);
|
||||||
#endif
|
#endif
|
||||||
@ -309,11 +309,10 @@ void Renderer::SaveScreenshot(u8* ptr, size_t width, size_t height)
|
|||||||
OSD::AddMessage("Saving Screenshot... ", 2000);
|
OSD::AddMessage("Saving Screenshot... ", 2000);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
SaveTGA(s_sScreenshotName.c_str(), width, height, ptr);
|
SaveTGA(filename.c_str(), width, height, ptr);
|
||||||
free(ptr);
|
free(ptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
s_sScreenshotName.clear();
|
|
||||||
s_bScreenshot = false;
|
s_bScreenshot = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ protected:
|
|||||||
#if defined(HAVE_WX) && HAVE_WX
|
#if defined(HAVE_WX) && HAVE_WX
|
||||||
static void SaveScreenshotOnThread(u8* data, size_t width, size_t height, std::string filename);
|
static void SaveScreenshotOnThread(u8* data, size_t width, size_t height, std::string filename);
|
||||||
#endif
|
#endif
|
||||||
static void SaveScreenshot(u8* ptr, size_t width, size_t height);
|
static void SaveScreenshot(u8* ptr, size_t width, size_t height, std::string filename);
|
||||||
|
|
||||||
static volatile bool s_bScreenshot;
|
static volatile bool s_bScreenshot;
|
||||||
static std::mutex s_criticalScreenshot;
|
static std::mutex s_criticalScreenshot;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user