mirror of https://github.com/PCSX2/pcsx2.git
recording: Improve NewRecordingFrame window
* File browsing will be required when creating a new input recording if at any point the filename box is empty. * Removes the "Current Frame" selection if GS is closed. Corethread check in InputRecordingFile::openNew() no longer necesaary.
This commit is contained in:
parent
a6b2d30bd0
commit
c278e6414c
|
@ -130,27 +130,11 @@ bool InputRecordingFile::open(const wxString path, bool newRecording)
|
|||
|
||||
bool InputRecordingFile::OpenNew(const wxString& path, bool fromSavestate)
|
||||
{
|
||||
if (fromSavestate)
|
||||
{
|
||||
if (CoreThread.IsOpen())
|
||||
{
|
||||
if (open(path, true))
|
||||
{
|
||||
savestate.fromSavestate = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
inputRec::consoleLog("Game is not open, aborting playing input recording which starts on a save-state.");
|
||||
if (!open(path, true))
|
||||
return false;
|
||||
}
|
||||
else if (open(path, true))
|
||||
{
|
||||
savestate.fromSavestate = false;
|
||||
savestate.fromSavestate = fromSavestate;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool InputRecordingFile::OpenExisting(const wxString& path)
|
||||
{
|
||||
|
|
|
@ -33,13 +33,10 @@ NewRecordingFrame::NewRecordingFrame(wxWindow* parent)
|
|||
|
||||
m_filePicker = new wxFilePickerCtrl(panel, MenuIds_New_Recording_Frame_File, wxEmptyString, "File", L"p2m2 file(*.p2m2)|*.p2m2", wxDefaultPosition, wxDefaultSize, wxFLP_SAVE | wxFLP_OVERWRITE_PROMPT | wxFLP_USE_TEXTCTRL);
|
||||
m_authorInput = new wxTextCtrl(panel, MenuIds_New_Recording_Frame_Author, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
|
||||
wxArrayString choices;
|
||||
choices.Add("Current Frame");
|
||||
choices.Add("Power-On");
|
||||
m_fromChoice = new wxChoice(panel, MenuIds_New_Recording_Frame_From, wxDefaultPosition, wxDefaultSize, choices);
|
||||
m_fromChoice->SetSelection(0);
|
||||
m_fromChoice = new wxChoice(panel, MenuIds_New_Recording_Frame_From, wxDefaultPosition, wxDefaultSize, NULL);
|
||||
|
||||
m_startRecording = new wxButton(panel, wxID_OK, _("Ok"), wxDefaultPosition, wxDefaultSize);
|
||||
m_startRecording = new wxButton(panel, wxID_OK, _("Browse Required"), wxDefaultPosition, wxDefaultSize);
|
||||
m_startRecording->Enable(false);
|
||||
m_cancelRecording = new wxButton(panel, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
fgs->Add(m_fileLabel, 1);
|
||||
|
@ -58,6 +55,45 @@ NewRecordingFrame::NewRecordingFrame(wxWindow* parent)
|
|||
panel->SetSizer(container);
|
||||
panel->GetSizer()->Fit(this);
|
||||
Centre();
|
||||
|
||||
m_fileBrowsed = false;
|
||||
m_filePicker->GetPickerCtrl()->Bind(wxEVT_FILEPICKER_CHANGED, &NewRecordingFrame::OnFileDirChange, this);
|
||||
m_filePicker->Bind(wxEVT_FILEPICKER_CHANGED, &NewRecordingFrame::OnFileChanged, this);
|
||||
}
|
||||
|
||||
int NewRecordingFrame::ShowModal(const bool isCoreThreadOpen)
|
||||
{
|
||||
static const char* choices[2] = {"Boot", "Current Frame"};
|
||||
m_fromChoice->Set(wxArrayString(1 + isCoreThreadOpen, &choices[0]));
|
||||
m_fromChoice->SetSelection(isCoreThreadOpen);
|
||||
return wxDialog::ShowModal();
|
||||
}
|
||||
|
||||
void NewRecordingFrame::OnFileDirChange(wxFileDirPickerEvent& event)
|
||||
{
|
||||
m_filePicker->wxFileDirPickerCtrlBase::OnFileDirChange(event);
|
||||
m_fileBrowsed = true;
|
||||
EnableOkBox();
|
||||
}
|
||||
|
||||
void NewRecordingFrame::OnFileChanged(wxFileDirPickerEvent& event)
|
||||
{
|
||||
EnableOkBox();
|
||||
}
|
||||
|
||||
void NewRecordingFrame::EnableOkBox()
|
||||
{
|
||||
if (m_filePicker->GetPath().length() == 0)
|
||||
{
|
||||
m_fileBrowsed = false;
|
||||
m_startRecording->SetLabel(_("Browse Required"));
|
||||
m_startRecording->Enable(false);
|
||||
}
|
||||
else if (m_fileBrowsed)
|
||||
{
|
||||
m_startRecording->SetLabel(_("Start"));
|
||||
m_startRecording->Enable(true);
|
||||
}
|
||||
}
|
||||
|
||||
wxString NewRecordingFrame::GetFile() const
|
||||
|
|
|
@ -32,14 +32,21 @@ class NewRecordingFrame : public wxDialog
|
|||
{
|
||||
public:
|
||||
NewRecordingFrame(wxWindow* parent);
|
||||
int ShowModal(const bool isCoreThreadOpen);
|
||||
|
||||
wxString GetFile() const;
|
||||
wxString GetAuthor() const;
|
||||
int GetFrom() const;
|
||||
|
||||
protected:
|
||||
void OnFileDirChange(wxFileDirPickerEvent& event);
|
||||
void OnFileChanged(wxFileDirPickerEvent& event);
|
||||
void EnableOkBox();
|
||||
|
||||
private:
|
||||
wxStaticText* m_fileLabel;
|
||||
wxFilePickerCtrl* m_filePicker;
|
||||
bool m_fileBrowsed;
|
||||
wxStaticText* m_authorLabel;
|
||||
wxTextCtrl* m_authorInput;
|
||||
wxStaticText* m_fromLabel;
|
||||
|
|
|
@ -956,9 +956,9 @@ void MainEmuFrame::Menu_Recording_New_Click(wxCommandEvent& event)
|
|||
NewRecordingFrame* newRecordingFrame = wxGetApp().GetNewRecordingFramePtr();
|
||||
if (newRecordingFrame)
|
||||
{
|
||||
if (newRecordingFrame->ShowModal() != wxID_CANCEL)
|
||||
if (newRecordingFrame->ShowModal(CoreThread.IsOpen()) != wxID_CANCEL)
|
||||
{
|
||||
if (g_InputRecording.Create(newRecordingFrame->GetFile(), !newRecordingFrame->GetFrom(), newRecordingFrame->GetAuthor()))
|
||||
if (g_InputRecording.Create(newRecordingFrame->GetFile(), newRecordingFrame->GetFrom(), newRecordingFrame->GetAuthor()))
|
||||
{
|
||||
if (!g_InputRecording.GetInputRecordingData().FromSaveState())
|
||||
StartInputRecording();
|
||||
|
|
Loading…
Reference in New Issue