diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index 0583455f08..e2e66dfda4 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -285,6 +285,7 @@ void SConfig::SaveCoreSettings(IniFile &ini) core->Set("SlippiEnableSpectator", m_enableSpectator); core->Set("SlippiSpectatorLocalPort", m_spectator_local_port); core->Set("SlippiSaveReplays", m_slippiSaveReplays); + core->Set("SlippiRegenerateReplays", m_slippiRegenerateReplays); core->Set("SlippiEnableQuickChat", m_slippiEnableQuickChat); core->Set("SlippiForceNetplayPort", m_slippiForceNetplayPort); core->Set("SlippiNetplayPort", m_slippiNetplayPort); @@ -292,6 +293,7 @@ void SConfig::SaveCoreSettings(IniFile &ini) core->Set("SlippiLanIp", m_slippiLanIp); core->Set("SlippiReplayMonthFolders", m_slippiReplayMonthFolders); core->Set("SlippiReplayDir", m_strSlippiReplayDir); + core->Set("SlippiReplayRegenerateDir", m_strSlippiRegenerateReplayDir); core->Set("SlippiPlaybackDisplayFrameIndex", m_slippiEnableFrameIndex); core->Set("BlockingPipes", m_blockingPipes); core->Set("MemcardAPath", m_strMemoryCardA); @@ -627,11 +629,8 @@ void SConfig::LoadCoreSettings(IniFile &ini) core->Get("SlippiEnableSpectator", &m_enableSpectator, true); core->Get("SlippiSpectatorLocalPort", &m_spectator_local_port, 51441); core->Get("SlippiOnlineDelay", &m_slippiOnlineDelay, 2); -#ifdef IS_PLAYBACK - core->Get("SlippiSaveReplays", &m_slippiSaveReplays, false); -#else core->Get("SlippiSaveReplays", &m_slippiSaveReplays, true); -#endif + core->Get("SlippiRegenerateReplays", &m_slippiRegenerateReplays, false); core->Get("SlippiEnableQuickChat", &m_slippiEnableQuickChat, SLIPPI_CHAT_ON); core->Get("SlippiForceNetplayPort", &m_slippiForceNetplayPort, false); core->Get("SlippiNetplayPort", &m_slippiNetplayPort, 2626); @@ -642,6 +641,9 @@ void SConfig::LoadCoreSettings(IniFile &ini) core->Get("SlippiReplayDir", &m_strSlippiReplayDir, default_replay_dir); if (m_strSlippiReplayDir.empty()) m_strSlippiReplayDir = default_replay_dir; + core->Get("SlippiReplayRegenerateDir", &m_strSlippiRegenerateReplayDir, default_replay_dir); + if (m_strSlippiRegenerateReplayDir.empty()) + m_strSlippiRegenerateReplayDir = default_replay_dir; core->Get("SlippiPlaybackDisplayFrameIndex", &m_slippiEnableFrameIndex, false); core->Get("BlockingPipes", &m_blockingPipes, false); core->Get("MemcardAPath", &m_strMemoryCardA); diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h index 9f316fdb03..ec39dd970e 100644 --- a/Source/Core/Core/ConfigManager.h +++ b/Source/Core/Core/ConfigManager.h @@ -158,14 +158,12 @@ struct SConfig : NonCopyable bool bMeleeForceWidescreen = false; // Slippi -#ifdef IS_PLAYBACK - bool m_slippiSaveReplays = false; -#else bool m_slippiSaveReplays = true; -#endif + bool m_slippiRegenerateReplays = false; int m_slippiEnableQuickChat = SLIPPI_CHAT_ON; bool m_slippiReplayMonthFolders = false; std::string m_strSlippiReplayDir; + std::string m_strSlippiRegenerateReplayDir; bool m_slippiForceNetplayPort = false; int m_slippiNetplayPort; bool m_slippiForceLanIp = false; diff --git a/Source/Core/Core/HW/EXI_DeviceSlippi.cpp b/Source/Core/Core/HW/EXI_DeviceSlippi.cpp index 99585a0b3e..6a3164eaf7 100644 --- a/Source/Core/Core/HW/EXI_DeviceSlippi.cpp +++ b/Source/Core/Core/HW/EXI_DeviceSlippi.cpp @@ -484,7 +484,13 @@ std::vector CEXISlippi::generateMetadata() void CEXISlippi::writeToFileAsync(u8 *payload, u32 length, std::string fileOption) { - if (!SConfig::GetInstance().m_slippiSaveReplays) +#ifndef IS_PLAYBACK + bool shouldSaveReplays = SConfig::GetInstance().m_slippiSaveReplays; +#else + bool shouldSaveReplays = SConfig::GetInstance().m_slippiRegenerateReplays; +#endif + + if (!shouldSaveReplays) { return; } @@ -628,6 +634,7 @@ void CEXISlippi::createNewFile() closeFile(); } +#ifndef IS_PLAYBACK std::string dirpath = SConfig::GetInstance().m_strSlippiReplayDir; // in case the config value just gets lost somehow if (dirpath.empty()) @@ -635,6 +642,15 @@ void CEXISlippi::createNewFile() SConfig::GetInstance().m_strSlippiReplayDir = File::GetHomeDirectory() + DIR_SEP + "Slippi"; dirpath = SConfig::GetInstance().m_strSlippiReplayDir; } +#else + std::string dirpath = SConfig::GetInstance().m_strSlippiRegenerateReplayDir; + // in case the config value just gets lost somehow + if (dirpath.empty()) + { + SConfig::GetInstance().m_strSlippiRegenerateReplayDir = File::GetHomeDirectory() + DIR_SEP + "Slippi"; + dirpath = SConfig::GetInstance().m_strSlippiRegenerateReplayDir; + } +#endif // Remove a trailing / or \\ if the user managed to have that in their config char dirpathEnd = dirpath.back(); @@ -646,6 +662,7 @@ void CEXISlippi::createNewFile() // First, ensure that the root Slippi replay directory is created File::CreateFullPath(dirpath + "/"); +#ifndef IS_PLAYBACK // Now we have a dir such as /home/Replays but we need to make one such // as /home/Replays/2020-06 if month categorization is enabled if (SConfig::GetInstance().m_slippiReplayMonthFolders) @@ -663,6 +680,7 @@ void CEXISlippi::createNewFile() // Ensure that the subfolder directory is created File::CreateDir(dirpath); } +#endif std::string filepath = dirpath + DIR_SEP + generateFileName(); INFO_LOG(SLIPPI, "EXI_DeviceSlippi.cpp: Creating new replay file %s", filepath.c_str()); diff --git a/Source/Core/DolphinWX/Config/SlippiConfigPane.cpp b/Source/Core/DolphinWX/Config/SlippiConfigPane.cpp index 0881069b00..20785d376a 100644 --- a/Source/Core/DolphinWX/Config/SlippiConfigPane.cpp +++ b/Source/Core/DolphinWX/Config/SlippiConfigPane.cpp @@ -427,13 +427,9 @@ SlippiPlaybackConfigPane::SlippiPlaybackConfigPane(wxWindow *parent, wxWindowID void SlippiPlaybackConfigPane::InitializeGUI() { // Slippi settings - m_replay_enable_checkbox = new wxCheckBox(this, wxID_ANY, _("Regenerate Slippi Replays")); - m_replay_enable_checkbox->SetToolTip( - _("Enable this to regenerate .slp recordings of your games. Does not need to be enabled to use spectator service for powering custom HUDs.")); - - m_replay_month_folders_checkbox = new wxCheckBox(this, wxID_ANY, _("Save Replays to Monthly Subfolders")); - m_replay_month_folders_checkbox->SetToolTip( - _("Enable this to save your replays into subfolders by month (YYYY-MM).")); + m_replay_regenerate_checkbox = new wxCheckBox(this, wxID_ANY, _("Regenerate Slippi Replays (off if unsure)")); + m_replay_regenerate_checkbox->SetToolTip( + _("Enable this to regenerate .slp recordings of your games. Does NOT need to be enabled to use slp event monitoring service for powering custom HUDs.")); m_replay_directory_picker = new wxDirPickerCtrl(this, wxID_ANY, wxEmptyString, _("Slippi Replay Folder:"), wxDefaultPosition, wxDefaultSize, @@ -458,12 +454,10 @@ void SlippiPlaybackConfigPane::InitializeGUI() sbSlippiPlaybackSettings->AddSpacer(space5); wxGridBagSizer *const sSlippiReplaySettings = new wxGridBagSizer(space5, space5); - sSlippiReplaySettings->Add(m_replay_enable_checkbox, wxGBPosition(0, 0), wxGBSpan(1, 2)); - sSlippiReplaySettings->Add(m_replay_month_folders_checkbox, wxGBPosition(1, 0), wxGBSpan(1, 2), - wxRESERVE_SPACE_EVEN_IF_HIDDEN); - sSlippiReplaySettings->Add(new wxStaticText(this, wxID_ANY, _("Replay folder:")), wxGBPosition(2, 0), wxDefaultSpan, + sSlippiReplaySettings->Add(m_replay_regenerate_checkbox, wxGBPosition(0, 0), wxGBSpan(1, 2)); + sSlippiReplaySettings->Add(new wxStaticText(this, wxID_ANY, _("Replay folder:")), wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); - sSlippiReplaySettings->Add(m_replay_directory_picker, wxGBPosition(2, 1), wxDefaultSpan, wxEXPAND); + sSlippiReplaySettings->Add(m_replay_directory_picker, wxGBPosition(1, 1), wxDefaultSpan, wxEXPAND); sSlippiReplaySettings->AddGrowableCol(1); wxStaticBoxSizer *const sbSlippiReplaySettings = @@ -487,9 +481,8 @@ void SlippiPlaybackConfigPane::LoadGUIValues() { const SConfig &startup_params = SConfig::GetInstance(); - m_replay_enable_checkbox->SetValue(startup_params.m_slippiSaveReplays); - m_replay_month_folders_checkbox->SetValue(startup_params.m_slippiReplayMonthFolders); - m_replay_directory_picker->SetPath(StrToWxStr(startup_params.m_strSlippiReplayDir)); + m_replay_regenerate_checkbox->SetValue(startup_params.m_slippiRegenerateReplays); + m_replay_directory_picker->SetPath(StrToWxStr(startup_params.m_strSlippiRegenerateReplayDir)); m_display_frame_index->SetValue(startup_params.m_slippiEnableFrameIndex); } @@ -497,8 +490,7 @@ void SlippiPlaybackConfigPane::BindEvents() { m_display_frame_index->Bind(wxEVT_CHECKBOX, &SlippiPlaybackConfigPane::OnDisplayFrameIndexToggle, this); - m_replay_enable_checkbox->Bind(wxEVT_CHECKBOX, &SlippiPlaybackConfigPane::OnReplaySavingToggle, this); - m_replay_month_folders_checkbox->Bind(wxEVT_CHECKBOX, &SlippiPlaybackConfigPane::OnReplayMonthFoldersToggle, this); + m_replay_regenerate_checkbox->Bind(wxEVT_CHECKBOX, &SlippiPlaybackConfigPane::OnReplayRegenerateToggle, this); m_replay_directory_picker->Bind(wxEVT_DIRPICKER_CHANGED, &SlippiPlaybackConfigPane::OnReplayDirChanged, this); } @@ -508,20 +500,14 @@ void SlippiPlaybackConfigPane::OnDisplayFrameIndexToggle(wxCommandEvent &event) SConfig::GetInstance().m_slippiEnableFrameIndex = enableFrameIndex; } -void SlippiPlaybackConfigPane::OnReplaySavingToggle(wxCommandEvent &event) +void SlippiPlaybackConfigPane::OnReplayRegenerateToggle(wxCommandEvent &event) { - bool enableReplays = m_replay_enable_checkbox->IsChecked(); - - SConfig::GetInstance().m_slippiSaveReplays = enableReplays; -} + bool enableReplays = m_replay_regenerate_checkbox->IsChecked(); -void SlippiPlaybackConfigPane::OnReplayMonthFoldersToggle(wxCommandEvent &event) -{ - SConfig::GetInstance().m_slippiReplayMonthFolders = - m_replay_enable_checkbox->IsChecked() && m_replay_month_folders_checkbox->IsChecked(); + SConfig::GetInstance().m_slippiRegenerateReplays = enableReplays; } void SlippiPlaybackConfigPane::OnReplayDirChanged(wxCommandEvent &event) { - SConfig::GetInstance().m_strSlippiReplayDir = WxStrToStr(m_replay_directory_picker->GetPath()); + SConfig::GetInstance().m_strSlippiRegenerateReplayDir = WxStrToStr(m_replay_directory_picker->GetPath()); } diff --git a/Source/Core/DolphinWX/Config/SlippiConfigPane.h b/Source/Core/DolphinWX/Config/SlippiConfigPane.h index 9154e50973..47599a9a4a 100644 --- a/Source/Core/DolphinWX/Config/SlippiConfigPane.h +++ b/Source/Core/DolphinWX/Config/SlippiConfigPane.h @@ -78,13 +78,11 @@ class SlippiPlaybackConfigPane final : public wxPanel wxStaticText *m_slippi_delay_frames_txt; wxTextCtrl *m_slippi_netplay_lan_ip_ctrl; - wxCheckBox *m_replay_enable_checkbox; - wxCheckBox *m_replay_month_folders_checkbox; + wxCheckBox *m_replay_regenerate_checkbox; wxDirPickerCtrl *m_replay_directory_picker; wxCheckBox *m_display_frame_index; void OnDisplayFrameIndexToggle(wxCommandEvent &event); - void OnReplaySavingToggle(wxCommandEvent &event); - void OnReplayMonthFoldersToggle(wxCommandEvent &event); + void OnReplayRegenerateToggle(wxCommandEvent &event); void OnReplayDirChanged(wxCommandEvent &event); };