Fix noWX build, and lower thread priority for screenshots
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3913 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
96b03effcc
commit
7eed236df9
|
@ -95,6 +95,11 @@ void Thread::SetAffinity(int mask)
|
|||
SetThreadAffinityMask(m_hThread, mask);
|
||||
}
|
||||
|
||||
void Thread::SetPriority(int priority)
|
||||
{
|
||||
SetThreadPriority(m_hThread, priority);
|
||||
}
|
||||
|
||||
void Thread::SetCurrentThreadAffinity(int mask)
|
||||
{
|
||||
SetThreadAffinityMask(GetCurrentThread(), mask);
|
||||
|
@ -308,7 +313,6 @@ void Thread::SetAffinity(int mask)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
void Thread::SetCurrentThreadAffinity(int mask)
|
||||
{
|
||||
#ifdef __linux__
|
||||
|
|
|
@ -106,6 +106,7 @@ public:
|
|||
void SetAffinity(int mask);
|
||||
static void SetCurrentThreadAffinity(int mask);
|
||||
#ifdef _WIN32
|
||||
void SetPriority(int priority);
|
||||
void WaitForDeath(const int _Wait = INFINITE);
|
||||
#else
|
||||
void WaitForDeath();
|
||||
|
|
|
@ -140,7 +140,6 @@ EXPORT void CALL Video_EndField();
|
|||
// output: response to the access request (ex: peek z data at specified coord)
|
||||
//
|
||||
EXPORT u32 CALL Video_AccessEFB(EFBAccessType type, u32 x, u32 y);
|
||||
void Video_OnThreadAccessEFB(); // TODO: Find a more sympathetic place to place this
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
// Function: Video_Screenshot
|
||||
|
|
|
@ -80,8 +80,6 @@ CGcontext g_cgcontext;
|
|||
CGprofile g_cgvProf;
|
||||
CGprofile g_cgfProf;
|
||||
|
||||
Common::Thread *scrshotThread = NULL;
|
||||
|
||||
RasterFont* s_pfont = NULL;
|
||||
|
||||
static bool s_bFullscreen = false;
|
||||
|
@ -103,6 +101,7 @@ static u32 s_blendMode;
|
|||
static bool s_bNativeResolution = false;
|
||||
|
||||
static volatile bool s_bScreenshot = false;
|
||||
static Common::Thread *scrshotThread = 0;
|
||||
static Common::CriticalSection s_criticalScreenshot;
|
||||
static std::string s_sScreenshotName;
|
||||
|
||||
|
@ -123,6 +122,7 @@ int OSDChoice = 0 , OSDTime = 0, OSDInternalW = 0, OSDInternalH = 0;
|
|||
|
||||
namespace {
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
// Screenshot thread struct
|
||||
typedef struct
|
||||
{
|
||||
|
@ -130,6 +130,7 @@ typedef struct
|
|||
std::string filename;
|
||||
wxImage *img;
|
||||
} ScrStrct;
|
||||
#endif
|
||||
|
||||
static const GLenum glSrcFactors[8] =
|
||||
{
|
||||
|
@ -210,6 +211,7 @@ bool Renderer::Init()
|
|||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
INFO_LOG(VIDEO, "Supported OpenGL Extensions:");
|
||||
INFO_LOG(VIDEO, ptoken); // write to the log file
|
||||
INFO_LOG(VIDEO, "");
|
||||
|
@ -1289,6 +1291,7 @@ void Renderer::SetScreenshot(const char *filename)
|
|||
s_criticalScreenshot.Leave();
|
||||
}
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
THREAD_RETURN TakeScreenshot(void *pArgs)
|
||||
{
|
||||
ScrStrct *threadStruct = (ScrStrct *)pArgs;
|
||||
|
@ -1309,18 +1312,22 @@ THREAD_RETURN TakeScreenshot(void *pArgs)
|
|||
else
|
||||
FloatH *= Ratio;
|
||||
|
||||
// This is a bit expensive on high resolutions
|
||||
threadStruct->img->Rescale((int)FloatW, (int)FloatH, wxIMAGE_QUALITY_HIGH);
|
||||
}
|
||||
|
||||
// Save the screenshot and finally kill the wxImage object
|
||||
// This is really expensive when saving to PNG, but not at all when using BMP
|
||||
threadStruct->img->SaveFile(wxString::FromAscii(threadStruct->filename.c_str()), wxBITMAP_TYPE_PNG);
|
||||
threadStruct->img->Destroy();
|
||||
|
||||
// Show success messages
|
||||
OSD::AddMessage(StringFromFormat("Saved %i x %i %s", (int)FloatW, (int)FloatH, threadStruct->filename.c_str()).c_str(), 2000);
|
||||
delete threadStruct;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Renderer::SaveRenderTarget(const char *filename, int W, int H, int YOffset)
|
||||
{
|
||||
|
@ -1340,9 +1347,6 @@ bool Renderer::SaveRenderTarget(const char *filename, int W, int H, int YOffset)
|
|||
FlipImageData(data, W, H);
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
//Enable support for PNG file type.
|
||||
wxImage::AddHandler( new wxPNGHandler );
|
||||
|
||||
// Create wxImage
|
||||
wxImage *a = new wxImage(W, H, data);
|
||||
|
||||
|
@ -1358,6 +1362,9 @@ bool Renderer::SaveRenderTarget(const char *filename, int W, int H, int YOffset)
|
|||
threadStruct->H = H; threadStruct->W = W;
|
||||
|
||||
scrshotThread = new Common::Thread(TakeScreenshot, threadStruct);
|
||||
#ifdef _WIN32
|
||||
scrshotThread->SetPriority(THREAD_PRIORITY_BELOW_NORMAL);
|
||||
#endif
|
||||
bool result = true;
|
||||
|
||||
OSD::AddMessage("Saving Screenshot... ", 2000);
|
||||
|
|
|
@ -320,6 +320,11 @@ void Initialize(void *init)
|
|||
g_Config.GameIniLoad();
|
||||
g_Config.UpdateProjectionHack();
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
//Enable support for PNG screenshots.
|
||||
wxImage::AddHandler( new wxPNGHandler );
|
||||
#endif
|
||||
|
||||
if (!OpenGL_Create(g_VideoInitialize, 640, 480)) // 640x480 will be the default if all else fails
|
||||
{
|
||||
g_VideoInitialize.pLog("Renderer::Create failed\n", TRUE);
|
||||
|
|
Loading…
Reference in New Issue