From 64104ca9fdeec1b5b19b26e75b5c564ed230613b Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Thu, 22 Nov 2018 22:33:15 -0500 Subject: [PATCH] gui:recording: Revert addition of Screenshot As, will contribute as separate PR Along with changing the .bmp file naming scheme. --- pcsx2/Recording/InputRecordingFile.cpp | 10 +++-- pcsx2/gui/App.h | 5 --- pcsx2/gui/MainFrame.cpp | 2 - pcsx2/gui/MainFrame.h | 1 - pcsx2/gui/MainMenuClicks.cpp | 17 -------- plugins/GSdx/GS.cpp | 12 +---- plugins/GSdx/Renderers/Common/GSRenderer.cpp | 46 ++++++++------------ 7 files changed, 28 insertions(+), 65 deletions(-) diff --git a/pcsx2/Recording/InputRecordingFile.cpp b/pcsx2/Recording/InputRecordingFile.cpp index 7ccb244c7c..31569b4458 100644 --- a/pcsx2/Recording/InputRecordingFile.cpp +++ b/pcsx2/Recording/InputRecordingFile.cpp @@ -214,7 +214,6 @@ bool InputRecordingFile::UpdatePadData(unsigned long frame, const PadData& key) return true; } -// TODO - see if we can get the actual game name, not just the ISO name // Verify header of recording file bool InputRecordingFile::readHeaderAndCheck() { @@ -225,7 +224,12 @@ bool InputRecordingFile::readHeaderAndCheck() if (fread(&UndoCount, 4, 1, recordingFile) != 1) return false; if (fread(&savestate.fromSavestate, sizeof(bool), 1, recordingFile) != 1) return false; if (savestate.fromSavestate) { - // TODO - check to see if the file is there, if it AINT, return false, throw an error, ETC (SAY WHAT FILE WE ARE LOOKING FOR) + FILE* ssFileCheck = wxFopen(filename + "_SaveState.p2s", "r"); + if (ssFileCheck = NULL) { + recordingConLog(wxString::Format("[REC]: Could not locate savestate file at location - %s\n", filename + "_SaveState.p2s")); + return false; + } + fclose(ssFileCheck); StateCopy_LoadFromFile(filename + "_SaveState.p2s"); } else { @@ -233,8 +237,8 @@ bool InputRecordingFile::readHeaderAndCheck() } // Check for current verison - // TODO - more specific log if fails for this reason if (header.version != 1) { + recordingConLog(wxString::Format("[REC]: Input recording file is not a supported version - %d\n", header.version)); return false; } return true; diff --git a/pcsx2/gui/App.h b/pcsx2/gui/App.h index f9ab706d40..982d2c8389 100644 --- a/pcsx2/gui/App.h +++ b/pcsx2/gui/App.h @@ -187,7 +187,6 @@ enum MenuIdentifiers MenuId_Capture_Video_Stop, MenuId_Capture_Screenshot, MenuId_Capture_Screenshot_Screenshot, - MenuId_Capture_Screenshot_Screenshot_As, #ifndef DISABLE_RECORDING // Recording Subsection @@ -198,10 +197,6 @@ enum MenuIdentifiers MenuId_Recording_VirtualPad_Port0, MenuId_Recording_VirtualPad_Port1, MenuId_Recording_Conversions, - MenuId_Recording_ConvertV2ToV3, - MenuId_Recording_ConvertV1_XToV2, - MenuId_Recording_ConvertV1ToV2, - MenuId_Recording_ConvertLegacy, #endif }; diff --git a/pcsx2/gui/MainFrame.cpp b/pcsx2/gui/MainFrame.cpp index 846bf10c2d..a346661460 100644 --- a/pcsx2/gui/MainFrame.cpp +++ b/pcsx2/gui/MainFrame.cpp @@ -248,7 +248,6 @@ void MainEmuFrame::ConnectMenus() Bind(wxEVT_MENU, &MainEmuFrame::Menu_Capture_Video_Record_Click, this, MenuId_Capture_Video_Record); Bind(wxEVT_MENU, &MainEmuFrame::Menu_Capture_Video_Stop_Click, this, MenuId_Capture_Video_Stop); Bind(wxEVT_MENU, &MainEmuFrame::Menu_Capture_Screenshot_Screenshot_Click, this, MenuId_Capture_Screenshot_Screenshot); - Bind(wxEVT_MENU, &MainEmuFrame::Menu_Capture_Screenshot_Screenshot_As_Click, this, MenuId_Capture_Screenshot_Screenshot_As); #ifndef DISABLE_RECORDING // Recording @@ -566,7 +565,6 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title) m_menuCapture.Append(MenuId_Capture_Screenshot, _("Screenshot"), &m_submenuScreenshot); m_submenuScreenshot.Append(MenuId_Capture_Screenshot_Screenshot, _("Screenshot")); - m_submenuScreenshot.Append(MenuId_Capture_Screenshot_Screenshot_As, _("Screenshot As...")); // ------------------------------------------------------------------------ diff --git a/pcsx2/gui/MainFrame.h b/pcsx2/gui/MainFrame.h index de4573ce42..c0c8b692d6 100644 --- a/pcsx2/gui/MainFrame.h +++ b/pcsx2/gui/MainFrame.h @@ -222,7 +222,6 @@ protected: void Menu_Capture_Video_Stop_Click(wxCommandEvent &event); void VideoCaptureUpdate(); void Menu_Capture_Screenshot_Screenshot_Click(wxCommandEvent &event); - void Menu_Capture_Screenshot_Screenshot_As_Click(wxCommandEvent &event); #ifndef DISABLE_RECORDING void Menu_Recording_New_Click(wxCommandEvent &event); diff --git a/pcsx2/gui/MainMenuClicks.cpp b/pcsx2/gui/MainMenuClicks.cpp index 45e1f59045..d5b8ab9139 100644 --- a/pcsx2/gui/MainMenuClicks.cpp +++ b/pcsx2/gui/MainMenuClicks.cpp @@ -759,23 +759,6 @@ void MainEmuFrame::Menu_Capture_Screenshot_Screenshot_Click(wxCommandEvent & eve GSmakeSnapshot(g_Conf->Folders.Snapshots.ToAscii()); } -void MainEmuFrame::Menu_Capture_Screenshot_Screenshot_As_Click(wxCommandEvent &event) -{ - if (!CoreThread.IsOpen()) - return; - - wxFileDialog fileDialog(this, "Select a file", g_Conf->Folders.Snapshots.ToAscii(), wxEmptyString, "PNG files (*.png)|*.png", wxFD_SAVE | wxFD_OVERWRITE_PROMPT); - - if (fileDialog.ShowModal() == wxID_OK) - { - wxString path = fileDialog.GetPath(); - // GS Code expects a .bmp path, despite PNG compression being hardcoded. - // Swap extensions so UX isn't confusing and avoid changing too much GS code that I'm not familiar with - path = wxString::Format("%s.bmp", path.substr(0, path.size() - 4)); - GSmakeSnapshot(path); - } -} - #ifndef DISABLE_RECORDING void MainEmuFrame::Menu_Recording_New_Click(wxCommandEvent &event) { diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index ea1b03800f..22ef7e6f40 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -740,17 +740,9 @@ EXPORT_C_(uint32) GSmakeSnapshot(char* path) { std::string s{path}; - if (!s.empty()) + if (!s.empty() && s[s.length() - 1] != DIRECTORY_SEPARATOR) { - // Facilitates Save As.. Feature - if (s.substr(s.size() - 4, 4) == ".bmp") - { - return s_gs->MakeSnapshot(s); - } - else if (s[s.length() - 1] != DIRECTORY_SEPARATOR) - { - s = s + DIRECTORY_SEPARATOR; - } + s = s + DIRECTORY_SEPARATOR; } return s_gs->MakeSnapshot(s + "gsdx"); diff --git a/plugins/GSdx/Renderers/Common/GSRenderer.cpp b/plugins/GSdx/Renderers/Common/GSRenderer.cpp index 07775d7ed7..8aac81f1a0 100644 --- a/plugins/GSdx/Renderers/Common/GSRenderer.cpp +++ b/plugins/GSdx/Renderers/Common/GSRenderer.cpp @@ -499,37 +499,29 @@ void GSRenderer::VSync(int field) bool GSRenderer::MakeSnapshot(const std::string& path) { - if(m_snapshot.empty()) + if (m_snapshot.empty()) { - // Facilitates Save As.. Feature - if (path.substr(path.size() - 4, 4) == ".bmp") - { - m_snapshot = path.substr(0, path.size() - 4); - } - else - { - time_t cur_time = time(nullptr); - static time_t prev_snap; - // The variable 'n' is used for labelling the screenshots when multiple screenshots are taken in - // a single second, we'll start using this variable for naming when a second screenshot request is detected - // at the same time as the first one. Hence, we're initially setting this counter to 2 to imply that - // the captured image is the 2nd image captured at this specific time. - static int n = 2; - char local_time[16]; + time_t cur_time = time(nullptr); + static time_t prev_snap; + // The variable 'n' is used for labelling the screenshots when multiple screenshots are taken in + // a single second, we'll start using this variable for naming when a second screenshot request is detected + // at the same time as the first one. Hence, we're initially setting this counter to 2 to imply that + // the captured image is the 2nd image captured at this specific time. + static int n = 2; + char local_time[16]; - if (strftime(local_time, sizeof(local_time), "%Y%m%d%H%M%S", localtime(&cur_time))) + if (strftime(local_time, sizeof(local_time), "%Y%m%d%H%M%S", localtime(&cur_time))) + { + if (cur_time == prev_snap) { - if (cur_time == prev_snap) - { - m_snapshot = format("%s_%s_(%d)", path.c_str(), local_time, n++); - } - else - { - n = 2; - m_snapshot = format("%s_%s", path.c_str(), local_time); - } - prev_snap = cur_time; + m_snapshot = format("%s_%s_(%d)", path.c_str(), local_time, n++); } + else + { + n = 2; + m_snapshot = format("%s_%s", path.c_str(), local_time); + } + prev_snap = cur_time; } }