diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 0ed693da50..b6962af435 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -924,8 +924,11 @@ void CFrame::StartGame(const std::string& filename) wxBeginBusyCursor(); + DoFullscreen(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen); + if (!BootManager::BootCore(filename)) { + DoFullscreen(false); // Destroy the renderer frame when not rendering to main if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain) m_RenderFrame->Destroy(); @@ -940,8 +943,6 @@ void CFrame::StartGame(const std::string& filename) X11Utils::XWindowFromHandle(GetHandle()), true); #endif - DoFullscreen(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen); - #ifdef _WIN32 ::SetFocus((HWND)m_RenderParent->GetHandle()); #else diff --git a/Source/Core/DolphinWX/Src/ISOFile.cpp b/Source/Core/DolphinWX/Src/ISOFile.cpp index b21f2a2612..8505203322 100644 --- a/Source/Core/DolphinWX/Src/ISOFile.cpp +++ b/Source/Core/DolphinWX/Src/ISOFile.cpp @@ -45,10 +45,10 @@ static u32 g_ImageTemp[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT]; GameListItem::GameListItem(const std::string& _rFileName) : m_FileName(_rFileName) + , m_emu_state(0) , m_FileSize(0) , m_Valid(false) , m_BlobCompressed(false) - , m_emu_state(0) { if (LoadFromCache()) { diff --git a/Source/Core/VideoCommon/Src/AVIDump.cpp b/Source/Core/VideoCommon/Src/AVIDump.cpp index ac075ecce5..cfd34e5cdb 100644 --- a/Source/Core/VideoCommon/Src/AVIDump.cpp +++ b/Source/Core/VideoCommon/Src/AVIDump.cpp @@ -214,7 +214,6 @@ AVStream *s_Stream = NULL; AVFrame *s_BGRFrame = NULL, *s_YUVFrame = NULL; uint8_t *s_YUVBuffer = NULL; uint8_t *s_OutBuffer = NULL; -struct SwsContext *s_SwsContext = NULL; int s_width; int s_height; int s_size; @@ -254,19 +253,15 @@ bool AVIDump::CreateFile() return false; } - if (g_Config.bUseFFV1) - { - s_FormatContext->oformat->video_codec = CODEC_ID_FFV1; - } - - s_Stream->codec->codec_id = s_FormatContext->oformat->video_codec; + s_Stream->codec->codec_id = + g_Config.bUseFFV1 ? CODEC_ID_FFV1 : s_FormatContext->oformat->video_codec; s_Stream->codec->codec_type = AVMEDIA_TYPE_VIDEO; s_Stream->codec->bit_rate = 400000; s_Stream->codec->width = s_width; s_Stream->codec->height = s_height; s_Stream->codec->time_base = (AVRational){1, VideoInterface::TargetRefreshRate}; s_Stream->codec->gop_size = 12; - s_Stream->codec->pix_fmt = (g_Config.bUseFFV1) ? PIX_FMT_BGRA : PIX_FMT_YUV420P; + s_Stream->codec->pix_fmt = g_Config.bUseFFV1 ? PIX_FMT_BGRA : PIX_FMT_YUV420P; av_set_parameters(s_FormatContext, NULL); @@ -277,13 +272,6 @@ bool AVIDump::CreateFile() return false; } - if(!(s_SwsContext = sws_getContext(s_width, s_height, PIX_FMT_BGR24, s_width, s_height, - s_Stream->codec->pix_fmt, SWS_BICUBIC, NULL, NULL, NULL))) - { - CloseFile(); - return false; - } - s_BGRFrame = avcodec_alloc_frame(); s_YUVFrame = avcodec_alloc_frame(); @@ -307,13 +295,20 @@ bool AVIDump::CreateFile() return true; } -void AVIDump::AddFrame(uint8_t *data) +void AVIDump::AddFrame(uint8_t *data, int width, int height) { - avpicture_fill((AVPicture *)s_BGRFrame, data, PIX_FMT_BGR24, s_width, s_height); + avpicture_fill((AVPicture *)s_BGRFrame, data, PIX_FMT_BGR24, width, height); - // Convert image from BGR24 to YUV420P - sws_scale(s_SwsContext, s_BGRFrame->data, s_BGRFrame->linesize, 0, - s_height, s_YUVFrame->data, s_YUVFrame->linesize); + // Convert image from BGR24 to desired pixel format, and scale to initial + // width and height + struct SwsContext *s_SwsContext; + if ((s_SwsContext = sws_getContext(width, height, PIX_FMT_BGR24, s_width, s_height, + s_Stream->codec->pix_fmt, SWS_BICUBIC, NULL, NULL, NULL))) + { + sws_scale(s_SwsContext, s_BGRFrame->data, s_BGRFrame->linesize, 0, + height, s_YUVFrame->data, s_YUVFrame->linesize); + sws_freeContext(s_SwsContext); + } // Encode and write the image int outsize = avcodec_encode_video(s_Stream->codec, s_OutBuffer, s_size, s_YUVFrame); @@ -372,15 +367,12 @@ void AVIDump::CloseFile() av_free(s_YUVFrame); s_YUVFrame = NULL; - if (s_SwsContext) - sws_freeContext(s_SwsContext); - s_SwsContext = NULL; - if (s_FormatContext) { if (s_FormatContext->pb) url_fclose(s_FormatContext->pb); av_free(s_FormatContext); + s_FormatContext = NULL; } } diff --git a/Source/Core/VideoCommon/Src/AVIDump.h b/Source/Core/VideoCommon/Src/AVIDump.h index ae5f37579a..e74df05db4 100644 --- a/Source/Core/VideoCommon/Src/AVIDump.h +++ b/Source/Core/VideoCommon/Src/AVIDump.h @@ -39,7 +39,7 @@ class AVIDump static void AddFrame(char *data); #else static bool Start(int w, int h); - static void AddFrame(uint8_t *data); + static void AddFrame(uint8_t *data, int width, int height); #endif static void Stop(); }; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index ab692615d6..d568a6d2a7 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -984,7 +984,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons #ifdef _WIN32 AVIDump::AddFrame((char *) data); #elif defined HAVE_LIBAV - AVIDump::AddFrame(data); + AVIDump::AddFrame(data, w, h); #endif Core::Callback_VideoCopiedToXFB(false); return; @@ -1002,7 +1002,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons #ifdef _WIN32 AVIDump::AddFrame((char *) data); #elif defined HAVE_LIBAV - AVIDump::AddFrame(data); + AVIDump::AddFrame(data, w, h); #endif Core::Callback_VideoCopiedToXFB(false); return; @@ -1196,7 +1196,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons AVIDump::AddFrame((char *) data); #else FlipImageData(data, w, h); - AVIDump::AddFrame(data); + AVIDump::AddFrame(data, w, h); #endif }