Merge pull request #10323 from AdmiralCurtiss/config-port-movie

Config: Port Movie settings to new config system.
This commit is contained in:
JMC47 2021-12-30 15:47:40 -05:00 committed by GitHub
commit 533116093e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 49 additions and 62 deletions

View File

@ -260,4 +260,14 @@ const Info<std::string> MAIN_AUTOUPDATE_UPDATE_TRACK{{System::Main, "AutoUpdate"
const Info<std::string> MAIN_AUTOUPDATE_HASH_OVERRIDE{{System::Main, "AutoUpdate", "HashOverride"}, const Info<std::string> MAIN_AUTOUPDATE_HASH_OVERRIDE{{System::Main, "AutoUpdate", "HashOverride"},
""}; ""};
// Main.Movie
const Info<bool> MAIN_MOVIE_PAUSE_MOVIE{{System::Main, "Movie", "PauseMovie"}, false};
const Info<std::string> MAIN_MOVIE_MOVIE_AUTHOR{{System::Main, "Movie", "Author"}, ""};
const Info<bool> MAIN_MOVIE_DUMP_FRAMES{{System::Main, "Movie", "DumpFrames"}, false};
const Info<bool> MAIN_MOVIE_DUMP_FRAMES_SILENT{{System::Main, "Movie", "DumpFramesSilent"}, false};
const Info<bool> MAIN_MOVIE_SHOW_INPUT_DISPLAY{{System::Main, "Movie", "ShowInputDisplay"}, false};
const Info<bool> MAIN_MOVIE_SHOW_RTC{{System::Main, "Movie", "ShowRTC"}, false};
const Info<bool> MAIN_MOVIE_SHOW_RERECORD{{System::Main, "Movie", "ShowRerecord"}, false};
} // namespace Config } // namespace Config

View File

@ -220,4 +220,14 @@ extern const Info<bool> MAIN_FIFOPLAYER_LOOP_REPLAY;
extern const Info<std::string> MAIN_AUTOUPDATE_UPDATE_TRACK; extern const Info<std::string> MAIN_AUTOUPDATE_UPDATE_TRACK;
extern const Info<std::string> MAIN_AUTOUPDATE_HASH_OVERRIDE; extern const Info<std::string> MAIN_AUTOUPDATE_HASH_OVERRIDE;
// Main.Movie
extern const Info<bool> MAIN_MOVIE_PAUSE_MOVIE;
extern const Info<std::string> MAIN_MOVIE_MOVIE_AUTHOR;
extern const Info<bool> MAIN_MOVIE_DUMP_FRAMES;
extern const Info<bool> MAIN_MOVIE_DUMP_FRAMES_SILENT;
extern const Info<bool> MAIN_MOVIE_SHOW_INPUT_DISPLAY;
extern const Info<bool> MAIN_MOVIE_SHOW_RTC;
extern const Info<bool> MAIN_MOVIE_SHOW_RERECORD;
} // namespace Config } // namespace Config

View File

@ -27,7 +27,7 @@ bool IsSettingSaveable(const Config::Location& config_location)
{ {
for (const std::string_view section : for (const std::string_view section :
{"NetPlay", "General", "GBA", "Display", "Network", "Analytics", "AndroidOverlayButtons", {"NetPlay", "General", "GBA", "Display", "Network", "Analytics", "AndroidOverlayButtons",
"DSP", "GameList", "FifoPlayer", "AutoUpdate"}) "DSP", "GameList", "FifoPlayer", "AutoUpdate", "Movie"})
{ {
if (config_location.section == section) if (config_location.section == section)
return true; return true;

View File

@ -91,7 +91,6 @@ void SConfig::SaveSettings()
SaveGeneralSettings(ini); SaveGeneralSettings(ini);
SaveInterfaceSettings(ini); SaveInterfaceSettings(ini);
SaveCoreSettings(ini); SaveCoreSettings(ini);
SaveMovieSettings(ini);
SaveInputSettings(ini); SaveInputSettings(ini);
SaveBluetoothPassthroughSettings(ini); SaveBluetoothPassthroughSettings(ini);
SaveUSBPassthroughSettings(ini); SaveUSBPassthroughSettings(ini);
@ -199,19 +198,6 @@ void SConfig::SaveCoreSettings(IniFile& ini)
core->Set("CustomRTCValue", m_customRTCValue); core->Set("CustomRTCValue", m_customRTCValue);
} }
void SConfig::SaveMovieSettings(IniFile& ini)
{
IniFile::Section* movie = ini.GetOrCreateSection("Movie");
movie->Set("PauseMovie", m_PauseMovie);
movie->Set("Author", m_strMovieAuthor);
movie->Set("DumpFrames", m_DumpFrames);
movie->Set("DumpFramesSilent", m_DumpFramesSilent);
movie->Set("ShowInputDisplay", m_ShowInputDisplay);
movie->Set("ShowRTC", m_ShowRTC);
movie->Set("ShowRerecord", m_ShowRerecord);
}
void SConfig::SaveInputSettings(IniFile& ini) void SConfig::SaveInputSettings(IniFile& ini)
{ {
IniFile::Section* input = ini.GetOrCreateSection("Input"); IniFile::Section* input = ini.GetOrCreateSection("Input");
@ -270,7 +256,6 @@ void SConfig::LoadSettings()
LoadGeneralSettings(ini); LoadGeneralSettings(ini);
LoadInterfaceSettings(ini); LoadInterfaceSettings(ini);
LoadCoreSettings(ini); LoadCoreSettings(ini);
LoadMovieSettings(ini);
LoadInputSettings(ini); LoadInputSettings(ini);
LoadBluetoothPassthroughSettings(ini); LoadBluetoothPassthroughSettings(ini);
LoadUSBPassthroughSettings(ini); LoadUSBPassthroughSettings(ini);
@ -383,19 +368,6 @@ void SConfig::LoadCoreSettings(IniFile& ini)
core->Get("CustomRTCValue", &m_customRTCValue, 946684800); core->Get("CustomRTCValue", &m_customRTCValue, 946684800);
} }
void SConfig::LoadMovieSettings(IniFile& ini)
{
IniFile::Section* movie = ini.GetOrCreateSection("Movie");
movie->Get("PauseMovie", &m_PauseMovie, false);
movie->Get("Author", &m_strMovieAuthor, "");
movie->Get("DumpFrames", &m_DumpFrames, false);
movie->Get("DumpFramesSilent", &m_DumpFramesSilent, false);
movie->Get("ShowInputDisplay", &m_ShowInputDisplay, false);
movie->Get("ShowRTC", &m_ShowRTC, false);
movie->Get("ShowRerecord", &m_ShowRerecord, false);
}
void SConfig::LoadInputSettings(IniFile& ini) void SConfig::LoadInputSettings(IniFile& ini)
{ {
IniFile::Section* input = ini.GetOrCreateSection("Input"); IniFile::Section* input = ini.GetOrCreateSection("Input");

View File

@ -224,15 +224,8 @@ struct SConfig
bool m_use_builtin_title_database = true; bool m_use_builtin_title_database = true;
std::string m_WirelessMac; std::string m_WirelessMac;
bool m_PauseMovie;
bool m_ShowRerecord;
bool m_ShowLag; bool m_ShowLag;
bool m_ShowFrameCount; bool m_ShowFrameCount;
bool m_ShowRTC;
std::string m_strMovieAuthor;
bool m_DumpFrames;
bool m_DumpFramesSilent;
bool m_ShowInputDisplay;
bool m_PauseOnFocusLost; bool m_PauseOnFocusLost;
@ -265,7 +258,6 @@ private:
void SaveInterfaceSettings(IniFile& ini); void SaveInterfaceSettings(IniFile& ini);
void SaveCoreSettings(IniFile& ini); void SaveCoreSettings(IniFile& ini);
void SaveInputSettings(IniFile& ini); void SaveInputSettings(IniFile& ini);
void SaveMovieSettings(IniFile& ini);
void SaveBluetoothPassthroughSettings(IniFile& ini); void SaveBluetoothPassthroughSettings(IniFile& ini);
void SaveUSBPassthroughSettings(IniFile& ini); void SaveUSBPassthroughSettings(IniFile& ini);
void SaveJitDebugSettings(IniFile& ini); void SaveJitDebugSettings(IniFile& ini);
@ -274,7 +266,6 @@ private:
void LoadInterfaceSettings(IniFile& ini); void LoadInterfaceSettings(IniFile& ini);
void LoadCoreSettings(IniFile& ini); void LoadCoreSettings(IniFile& ini);
void LoadInputSettings(IniFile& ini); void LoadInputSettings(IniFile& ini);
void LoadMovieSettings(IniFile& ini);
void LoadBluetoothPassthroughSettings(IniFile& ini); void LoadBluetoothPassthroughSettings(IniFile& ini);
void LoadUSBPassthroughSettings(IniFile& ini); void LoadUSBPassthroughSettings(IniFile& ini);
void LoadJitDebugSettings(IniFile& ini); void LoadJitDebugSettings(IniFile& ini);

View File

@ -574,7 +574,7 @@ bool BeginRecordingInput(const ControllerTypeArray& controllers,
} }
s_playMode = MODE_RECORDING; s_playMode = MODE_RECORDING;
s_author = SConfig::GetInstance().m_strMovieAuthor; s_author = Config::Get(Config::MAIN_MOVIE_MOVIE_AUTHOR);
s_temp_input.clear(); s_temp_input.clear();
s_currentByte = 0; s_currentByte = 0;
@ -1328,7 +1328,7 @@ void EndPlayInput(bool cont)
Core::QueueHostJob([=] { Core::QueueHostJob([=] {
Core::UpdateWantDeterminism(); Core::UpdateWantDeterminism();
if (was_running && !SConfig::GetInstance().m_PauseMovie) if (was_running && !Config::Get(Config::MAIN_MOVIE_PAUSE_MOVIE))
CPU::EnableStepping(false); CPU::EnableStepping(false);
}); });
} }

View File

@ -746,15 +746,15 @@ void MenuBar::AddMovieMenu()
auto* pause_at_end = movie_menu->addAction(tr("Pause at End of Movie")); auto* pause_at_end = movie_menu->addAction(tr("Pause at End of Movie"));
pause_at_end->setCheckable(true); pause_at_end->setCheckable(true);
pause_at_end->setChecked(SConfig::GetInstance().m_PauseMovie); pause_at_end->setChecked(Config::Get(Config::MAIN_MOVIE_PAUSE_MOVIE));
connect(pause_at_end, &QAction::toggled, connect(pause_at_end, &QAction::toggled,
[](bool value) { SConfig::GetInstance().m_PauseMovie = value; }); [](bool value) { Config::SetBaseOrCurrent(Config::MAIN_MOVIE_PAUSE_MOVIE, value); });
auto* rerecord_counter = movie_menu->addAction(tr("Show Rerecord Counter")); auto* rerecord_counter = movie_menu->addAction(tr("Show Rerecord Counter"));
rerecord_counter->setCheckable(true); rerecord_counter->setCheckable(true);
rerecord_counter->setChecked(SConfig::GetInstance().m_ShowRerecord); rerecord_counter->setChecked(Config::Get(Config::MAIN_MOVIE_SHOW_RERECORD));
connect(rerecord_counter, &QAction::toggled, connect(rerecord_counter, &QAction::toggled,
[](bool value) { SConfig::GetInstance().m_ShowRerecord = value; }); [](bool value) { Config::SetBaseOrCurrent(Config::MAIN_MOVIE_SHOW_RERECORD, value); });
auto* lag_counter = movie_menu->addAction(tr("Show Lag Counter")); auto* lag_counter = movie_menu->addAction(tr("Show Lag Counter"));
lag_counter->setCheckable(true); lag_counter->setCheckable(true);
@ -770,23 +770,24 @@ void MenuBar::AddMovieMenu()
auto* input_display = movie_menu->addAction(tr("Show Input Display")); auto* input_display = movie_menu->addAction(tr("Show Input Display"));
input_display->setCheckable(true); input_display->setCheckable(true);
input_display->setChecked(SConfig::GetInstance().m_ShowInputDisplay); input_display->setChecked(Config::Get(Config::MAIN_MOVIE_SHOW_INPUT_DISPLAY));
connect(input_display, &QAction::toggled, connect(input_display, &QAction::toggled, [](bool value) {
[](bool value) { SConfig::GetInstance().m_ShowInputDisplay = value; }); Config::SetBaseOrCurrent(Config::MAIN_MOVIE_SHOW_INPUT_DISPLAY, value);
});
auto* system_clock = movie_menu->addAction(tr("Show System Clock")); auto* system_clock = movie_menu->addAction(tr("Show System Clock"));
system_clock->setCheckable(true); system_clock->setCheckable(true);
system_clock->setChecked(SConfig::GetInstance().m_ShowRTC); system_clock->setChecked(Config::Get(Config::MAIN_MOVIE_SHOW_RTC));
connect(system_clock, &QAction::toggled, connect(system_clock, &QAction::toggled,
[](bool value) { SConfig::GetInstance().m_ShowRTC = value; }); [](bool value) { Config::SetBaseOrCurrent(Config::MAIN_MOVIE_SHOW_RTC, value); });
movie_menu->addSeparator(); movie_menu->addSeparator();
auto* dump_frames = movie_menu->addAction(tr("Dump Frames")); auto* dump_frames = movie_menu->addAction(tr("Dump Frames"));
dump_frames->setCheckable(true); dump_frames->setCheckable(true);
dump_frames->setChecked(SConfig::GetInstance().m_DumpFrames); dump_frames->setChecked(Config::Get(Config::MAIN_MOVIE_DUMP_FRAMES));
connect(dump_frames, &QAction::toggled, connect(dump_frames, &QAction::toggled,
[](bool value) { SConfig::GetInstance().m_DumpFrames = value; }); [](bool value) { Config::SetBaseOrCurrent(Config::MAIN_MOVIE_DUMP_FRAMES, value); });
auto* dump_audio = movie_menu->addAction(tr("Dump Audio")); auto* dump_audio = movie_menu->addAction(tr("Dump Audio"));
dump_audio->setCheckable(true); dump_audio->setCheckable(true);

View File

@ -25,6 +25,7 @@ extern "C" {
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/HW/SystemTimers.h" #include "Core/HW/SystemTimers.h"
#include "Core/HW/VideoInterface.h" #include "Core/HW/VideoInterface.h"
@ -93,7 +94,7 @@ std::string GetDumpPath(const std::string& extension, std::time_t time, u32 inde
// Ask to delete file. // Ask to delete file.
if (File::Exists(path)) if (File::Exists(path))
{ {
if (SConfig::GetInstance().m_DumpFramesSilent || if (Config::Get(Config::MAIN_MOVIE_DUMP_FRAMES_SILENT) ||
AskYesNoFmtT("Delete the existing file '{0}'?", path)) AskYesNoFmtT("Delete the existing file '{0}'?", path))
{ {
File::Delete(path); File::Delete(path);

View File

@ -39,6 +39,7 @@
#include "Common/Timer.h" #include "Common/Timer.h"
#include "Core/Config/GraphicsSettings.h" #include "Core/Config/GraphicsSettings.h"
#include "Core/Config/MainSettings.h"
#include "Core/Config/NetplaySettings.h" #include "Core/Config/NetplaySettings.h"
#include "Core/Config/SYSCONFSettings.h" #include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
@ -575,9 +576,10 @@ void Renderer::DrawDebugText()
ImGui::End(); ImGui::End();
} }
const bool show_movie_window = config.m_ShowFrameCount | config.m_ShowLag | const bool show_movie_window = config.m_ShowFrameCount || config.m_ShowLag ||
config.m_ShowInputDisplay | config.m_ShowRTC | Config::Get(Config::MAIN_MOVIE_SHOW_INPUT_DISPLAY) ||
config.m_ShowRerecord; Config::Get(Config::MAIN_MOVIE_SHOW_RTC) ||
Config::Get(Config::MAIN_MOVIE_SHOW_RERECORD);
if (show_movie_window) if (show_movie_window)
{ {
// Position under the FPS display. // Position under the FPS display.
@ -603,11 +605,11 @@ void Renderer::DrawDebugText()
} }
if (SConfig::GetInstance().m_ShowLag) if (SConfig::GetInstance().m_ShowLag)
ImGui::Text("Lag: %" PRIu64 "\n", Movie::GetCurrentLagCount()); ImGui::Text("Lag: %" PRIu64 "\n", Movie::GetCurrentLagCount());
if (SConfig::GetInstance().m_ShowInputDisplay) if (Config::Get(Config::MAIN_MOVIE_SHOW_INPUT_DISPLAY))
ImGui::TextUnformatted(Movie::GetInputDisplay().c_str()); ImGui::TextUnformatted(Movie::GetInputDisplay().c_str());
if (SConfig::GetInstance().m_ShowRTC) if (Config::Get(Config::MAIN_MOVIE_SHOW_RTC))
ImGui::TextUnformatted(Movie::GetRTCDisplay().c_str()); ImGui::TextUnformatted(Movie::GetRTCDisplay().c_str());
if (SConfig::GetInstance().m_ShowRerecord) if (Config::Get(Config::MAIN_MOVIE_SHOW_RERECORD))
ImGui::TextUnformatted(Movie::GetRerecords().c_str()); ImGui::TextUnformatted(Movie::GetRerecords().c_str());
} }
ImGui::End(); ImGui::End();
@ -1452,7 +1454,7 @@ bool Renderer::IsFrameDumping() const
if (m_screenshot_request.IsSet()) if (m_screenshot_request.IsSet())
return true; return true;
if (SConfig::GetInstance().m_DumpFrames) if (Config::Get(Config::MAIN_MOVIE_DUMP_FRAMES))
return true; return true;
return false; return false;
@ -1659,7 +1661,7 @@ void Renderer::FrameDumpThreadFunc()
m_screenshot_completed.Set(); m_screenshot_completed.Set();
} }
if (SConfig::GetInstance().m_DumpFrames) if (Config::Get(Config::MAIN_MOVIE_DUMP_FRAMES))
{ {
if (!frame_dump_started) if (!frame_dump_started)
{ {
@ -1670,7 +1672,7 @@ void Renderer::FrameDumpThreadFunc()
// Stop frame dumping if we fail to start. // Stop frame dumping if we fail to start.
if (!frame_dump_started) if (!frame_dump_started)
SConfig::GetInstance().m_DumpFrames = false; Config::SetCurrent(Config::MAIN_MOVIE_DUMP_FRAMES, false);
} }
// If we failed to start frame dumping, don't write a frame. // If we failed to start frame dumping, don't write a frame.
@ -1741,7 +1743,7 @@ std::string Renderer::GetFrameDumpNextImageFileName() const
bool Renderer::StartFrameDumpToImage(const FrameDump::FrameData&) bool Renderer::StartFrameDumpToImage(const FrameDump::FrameData&)
{ {
m_frame_dump_image_counter = 1; m_frame_dump_image_counter = 1;
if (!SConfig::GetInstance().m_DumpFramesSilent) if (!Config::Get(Config::MAIN_MOVIE_DUMP_FRAMES_SILENT))
{ {
// Only check for the presence of the first image to confirm overwriting. // Only check for the presence of the first image to confirm overwriting.
// A previous run will always have at least one image, and it's safe to assume that if the user // A previous run will always have at least one image, and it's safe to assume that if the user