diff --git a/Source/Core/VideoCommon/FrameDumpFFMpeg.cpp b/Source/Core/VideoCommon/FrameDumpFFMpeg.cpp index d698af8cd5..ea8bda7893 100644 --- a/Source/Core/VideoCommon/FrameDumpFFMpeg.cpp +++ b/Source/Core/VideoCommon/FrameDumpFFMpeg.cpp @@ -8,7 +8,6 @@ #endif #include -#include #include #include @@ -32,15 +31,14 @@ extern "C" { #include "Common/MsgHandler.h" #include "Common/StringUtil.h" +#include "Core/Config/GraphicsSettings.h" #include "Core/Config/MainSettings.h" #include "Core/ConfigManager.h" #include "Core/HW/SystemTimers.h" #include "Core/HW/VideoInterface.h" #include "Core/System.h" -#include "VideoCommon/FrameDumper.h" #include "VideoCommon/OnScreenDisplay.h" -#include "VideoCommon/VideoConfig.h" struct FrameDumpContext { @@ -122,8 +120,9 @@ void InitAVCodec() std::string GetDumpPath(const std::string& extension, std::time_t time, u32 index) { - if (!g_Config.sDumpPath.empty()) - return g_Config.sDumpPath; + const std::string dump_path = Config::Get(Config::GFX_DUMP_PATH); + if (!dump_path.empty()) + return dump_path; const std::string path_prefix = File::GetUserPath(D_DUMPFRAMES_IDX) + SConfig::GetInstance().GetGameID(); @@ -194,7 +193,7 @@ bool FFMpegFrameDump::PrepareEncoding(int w, int h, u64 start_ticks, u32 savesta bool FFMpegFrameDump::CreateVideoFile() { - const std::string& format = g_Config.sDumpFormat; + const std::string format = Config::Get(Config::GFX_DUMP_FORMAT); const std::string dump_path = GetDumpPath(format, m_start_time, m_file_index); @@ -217,7 +216,8 @@ bool FFMpegFrameDump::CreateVideoFile() return false; } - const std::string& codec_name = g_Config.bUseLossless ? "utvideo" : g_Config.sDumpCodec; + const std::string codec_name = + Config::Get(Config::GFX_USE_LOSSLESS) ? "utvideo" : Config::Get(Config::GFX_DUMP_CODEC); AVCodecID codec_id = output_format->video_codec; @@ -231,12 +231,12 @@ bool FFMpegFrameDump::CreateVideoFile() } const AVCodec* codec = nullptr; - - if (!g_Config.sDumpEncoder.empty()) + const std::string dump_encoder = Config::Get(Config::GFX_DUMP_ENCODER); + if (!dump_encoder.empty()) { - codec = avcodec_find_encoder_by_name(g_Config.sDumpEncoder.c_str()); + codec = avcodec_find_encoder_by_name(dump_encoder.c_str()); if (!codec) - WARN_LOG_FMT(FRAMEDUMP, "Invalid encoder {}", g_Config.sDumpEncoder); + WARN_LOG_FMT(FRAMEDUMP, "Invalid encoder {}", dump_encoder); } if (!codec) codec = avcodec_find_encoder(codec_id); @@ -258,7 +258,7 @@ bool FFMpegFrameDump::CreateVideoFile() m_context->height, time_base.den, time_base.num); m_context->codec->codec_type = AVMEDIA_TYPE_VIDEO; - m_context->codec->bit_rate = static_cast(g_Config.iBitrateKbps) * 1000; + m_context->codec->bit_rate = static_cast(Config::Get(Config::GFX_BITRATE_KBPS)) * 1000; m_context->codec->width = m_context->width; m_context->codec->height = m_context->height; m_context->codec->time_base = time_base; @@ -267,7 +267,7 @@ bool FFMpegFrameDump::CreateVideoFile() AVPixelFormat pix_fmt = AV_PIX_FMT_NONE; - const std::string& pixel_format_string = g_Config.sDumpPixelFormat; + const std::string pixel_format_string = Config::Get(Config::GFX_DUMP_PIXEL_FORMAT); if (!pixel_format_string.empty()) { pix_fmt = av_get_pix_fmt(pixel_format_string.c_str()); diff --git a/Source/Core/VideoCommon/FrameDumper.cpp b/Source/Core/VideoCommon/FrameDumper.cpp index 30f6a40e10..c98141e8eb 100644 --- a/Source/Core/VideoCommon/FrameDumper.cpp +++ b/Source/Core/VideoCommon/FrameDumper.cpp @@ -16,7 +16,6 @@ #include "VideoCommon/AbstractTexture.h" #include "VideoCommon/OnScreenDisplay.h" #include "VideoCommon/Present.h" -#include "VideoCommon/VideoConfig.h" // The video encoder needs the image to be a multiple of x samples. static constexpr int VIDEO_ENCODER_LCM = 4; @@ -201,7 +200,7 @@ void FrameDumper::FrameDumpThreadFunc() { Common::SetCurrentThreadName("FrameDumping"); - bool dump_to_ffmpeg = !g_ActiveConfig.bDumpFramesAsImages; + bool dump_to_ffmpeg = !Config::Get(Config::GFX_DUMP_FRAMES_AS_IMAGES); bool frame_dump_started = false; // If Dolphin was compiled without ffmpeg, we only support dumping to images. diff --git a/Source/Core/VideoCommon/Present.cpp b/Source/Core/VideoCommon/Present.cpp index 1d1a77b4ca..43f1c8140f 100644 --- a/Source/Core/VideoCommon/Present.cpp +++ b/Source/Core/VideoCommon/Present.cpp @@ -229,7 +229,7 @@ void Presenter::ProcessFrameDumping(u64 ticks) const if (g_frame_dumper->IsFrameDumping() && m_xfb_entry) { MathUtil::Rectangle target_rect; - switch (g_ActiveConfig.frame_dumps_resolution_type) + switch (Config::Get(Config::GFX_FRAME_DUMPS_RESOLUTION_TYPE)) { default: case FrameDumpResolutionType::WindowResolution: diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 722bf7cedb..678541931e 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -112,15 +112,6 @@ void VideoConfig::Refresh() bCacheHiresTextures = Config::Get(Config::GFX_CACHE_HIRES_TEXTURES); bDumpEFBTarget = Config::Get(Config::GFX_DUMP_EFB_TARGET); bDumpXFBTarget = Config::Get(Config::GFX_DUMP_XFB_TARGET); - bDumpFramesAsImages = Config::Get(Config::GFX_DUMP_FRAMES_AS_IMAGES); - bUseLossless = Config::Get(Config::GFX_USE_LOSSLESS); - sDumpFormat = Config::Get(Config::GFX_DUMP_FORMAT); - sDumpCodec = Config::Get(Config::GFX_DUMP_CODEC); - sDumpPixelFormat = Config::Get(Config::GFX_DUMP_PIXEL_FORMAT); - sDumpEncoder = Config::Get(Config::GFX_DUMP_ENCODER); - sDumpPath = Config::Get(Config::GFX_DUMP_PATH); - iBitrateKbps = Config::Get(Config::GFX_BITRATE_KBPS); - frame_dumps_resolution_type = Config::Get(Config::GFX_FRAME_DUMPS_RESOLUTION_TYPE); bEnableGPUTextureDecoding = Config::Get(Config::GFX_ENABLE_GPU_TEXTURE_DECODING); bPreferVSForLinePointExpansion = Config::Get(Config::GFX_PREFER_VS_FOR_LINE_POINT_EXPANSION); bEnablePixelLighting = Config::Get(Config::GFX_ENABLE_PIXEL_LIGHTING); diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h index c51cefa784..53b51a81e4 100644 --- a/Source/Core/VideoCommon/VideoConfig.h +++ b/Source/Core/VideoCommon/VideoConfig.h @@ -258,19 +258,9 @@ struct VideoConfig final bool bCacheHiresTextures = false; bool bDumpEFBTarget = false; bool bDumpXFBTarget = false; - bool bDumpFramesAsImages = false; - bool bUseLossless = false; - std::string sDumpCodec; - std::string sDumpPixelFormat; - std::string sDumpEncoder; - std::string sDumpFormat; - std::string sDumpPath; - FrameDumpResolutionType frame_dumps_resolution_type = - FrameDumpResolutionType::XFBAspectRatioCorrectedResolution; bool bBorderlessFullscreen = false; bool bEnableGPUTextureDecoding = false; bool bPreferVSForLinePointExpansion = false; - int iBitrateKbps = 0; bool bGraphicMods = false; std::optional graphics_mod_config;