gui:recording: Revert addition of Screenshot As, will contribute as separate PR

Along with changing the .bmp file naming scheme.
This commit is contained in:
Tyler Wilding 2018-11-22 22:33:15 -05:00 committed by lightningterror
parent c12c6ed149
commit 64104ca9fd
7 changed files with 28 additions and 65 deletions

View File

@ -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;

View File

@ -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
};

View File

@ -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..."));
// ------------------------------------------------------------------------

View File

@ -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);

View File

@ -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)
{

View File

@ -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");

View File

@ -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;
}
}