mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 03:25:16 +00:00
AutoPauseManager, SaveDataUtility fix
Redundant stringstream removed
This commit is contained in:
parent
f245799479
commit
298eb46a31
6 changed files with 32 additions and 77 deletions
|
@ -1,9 +1,7 @@
|
|||
#include "stdafx.h"
|
||||
#include "state.h"
|
||||
#include <sstream>
|
||||
#include <type_traits>
|
||||
|
||||
namespace rpcs3
|
||||
{
|
||||
state_t state;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,9 @@
|
|||
#include "stdafx_gui.h"
|
||||
#include "Emu/System.h"
|
||||
#include "AutoPauseManager.h"
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include "Utilities/Log.h"
|
||||
#include "Utilities/File.h"
|
||||
|
||||
enum
|
||||
{
|
||||
id_add,
|
||||
id_remove,
|
||||
id_config
|
||||
};
|
||||
|
||||
//TODO::Get the enable configuration from ini.
|
||||
AutoPauseManagerDialog::AutoPauseManagerDialog(wxWindow* parent)
|
||||
: wxDialog(parent, wxID_ANY, "Auto Pause Manager")
|
||||
|
@ -21,11 +12,7 @@ AutoPauseManagerDialog::AutoPauseManagerDialog(wxWindow* parent)
|
|||
|
||||
wxBoxSizer* s_main = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_entry_convert.clear();
|
||||
m_entry_convert.str("");
|
||||
m_entry_convert << "To use auto pause: enter the ID(s) of a function or a system call. Restart of the game is required to apply. You can enable/disable this in the settings.";
|
||||
|
||||
wxStaticText* s_description = new wxStaticText(this, wxID_ANY, m_entry_convert.str(),wxDefaultPosition, wxDefaultSize, 0);
|
||||
wxStaticText* s_description = new wxStaticText(this, wxID_ANY, "To use auto pause: enter the ID(s) of a function or a system call. Restart of the game is required to apply. You can enable/disable this in the settings.", wxDefaultPosition, wxDefaultSize, 0);
|
||||
s_description->Wrap(400);
|
||||
s_main->Add(s_description, 0, wxALL, 5);
|
||||
|
||||
|
@ -119,10 +106,7 @@ void AutoPauseManagerDialog::UpdateList(void)
|
|||
m_list->InsertItem(i, i);
|
||||
if (m_entries[i] != 0xFFFFFFFF)
|
||||
{
|
||||
m_entry_convert.clear();
|
||||
m_entry_convert.str("");
|
||||
m_entry_convert << std::hex << std::setw(8) << std::setfill('0') << m_entries[i];
|
||||
m_list->SetItem(i, 0, m_entry_convert.str());
|
||||
m_list->SetItem(i, 0, fmt::format("%08x", m_entries[i]));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -219,11 +203,7 @@ AutoPauseSettingsDialog::AutoPauseSettingsDialog(wxWindow* parent, u32 *entry)
|
|||
|
||||
wxBoxSizer* s_main = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_entry_convert.clear();
|
||||
m_entry_convert.str("");
|
||||
m_entry_convert << "Specify ID of System Call or Function Call below. You need to use a Hexadecimal ID.";
|
||||
|
||||
wxStaticText* s_description = new wxStaticText(this, wxID_ANY, m_entry_convert.str(), wxDefaultPosition, wxDefaultSize, 0);
|
||||
wxStaticText* s_description = new wxStaticText(this, wxID_ANY, "Specify ID of System Call or Function Call below. You need to use a Hexadecimal ID.", wxDefaultPosition, wxDefaultSize, 0);
|
||||
s_description->Wrap(400);
|
||||
s_main->Add(s_description, 0, wxALL, 5);
|
||||
|
||||
|
@ -239,12 +219,9 @@ AutoPauseSettingsDialog::AutoPauseSettingsDialog(wxWindow* parent, u32 *entry)
|
|||
m_current_converted = new wxStaticText(this, wxID_ANY, wxT("Currently it gets an id of \"Unset\"."), wxDefaultPosition, wxDefaultSize, 0);
|
||||
s_main->Add(m_current_converted, 0, wxALL, 5);
|
||||
|
||||
m_entry_convert.clear();
|
||||
m_entry_convert.str("");
|
||||
m_entry_convert << std::hex << std::setw(8) << std::setfill('0') << m_entry;
|
||||
m_id->SetValue(m_entry_convert.str());
|
||||
m_id->SetValue(fmt::format("%08x", m_entry));
|
||||
|
||||
SetTitle("Auto Pause Setting: "+m_entry_convert.str());
|
||||
SetTitle("Auto Pause Setting: " + m_id->GetValue());
|
||||
|
||||
Bind(wxEVT_BUTTON, &AutoPauseSettingsDialog::OnOk, this, wxID_OK);
|
||||
Bind(wxEVT_TEXT, &AutoPauseSettingsDialog::OnUpdateValue, this, wxID_STATIC);
|
||||
|
@ -260,12 +237,10 @@ AutoPauseSettingsDialog::AutoPauseSettingsDialog(wxWindow* parent, u32 *entry)
|
|||
|
||||
void AutoPauseSettingsDialog::OnOk(wxCommandEvent& event)
|
||||
{
|
||||
//Luckily StringStream omit those not hex.
|
||||
m_entry_convert.clear();
|
||||
m_entry_convert.str("");
|
||||
m_entry_convert << std::hex << m_id->GetValue();
|
||||
m_entry_convert >> m_entry;
|
||||
ullong value = 0;
|
||||
m_id->GetValue().ToULongLong(&value, 16);
|
||||
|
||||
m_entry = value;
|
||||
*m_presult = m_entry;
|
||||
|
||||
EndModal(wxID_OK);
|
||||
|
@ -273,22 +248,9 @@ void AutoPauseSettingsDialog::OnOk(wxCommandEvent& event)
|
|||
|
||||
void AutoPauseSettingsDialog::OnUpdateValue(wxCommandEvent& event)
|
||||
{
|
||||
//Luckily StringStream omit those not hex.
|
||||
m_entry_convert.clear();
|
||||
m_entry_convert.str("");
|
||||
m_entry_convert << std::hex << m_id->GetValue();
|
||||
m_entry_convert >> m_entry;
|
||||
ullong value;
|
||||
const bool is_ok = m_id->GetValue().ToULongLong(&value, 16) && value <= UINT32_MAX;
|
||||
|
||||
m_entry_convert.clear();
|
||||
m_entry_convert.str("");
|
||||
m_entry_convert << std::hex << /*std::setw(8) << std::setfill('0') <<*/ m_entry;
|
||||
m_entry_convert.clear();
|
||||
if (m_entry_convert.str() == m_id->GetValue())
|
||||
{
|
||||
m_current_converted->SetLabelText("Currently it gets an id of \"" + m_entry_convert.str() + "\" - SAME.");
|
||||
}
|
||||
else {
|
||||
m_current_converted->SetLabelText("Currently it gets an id of \"" + m_entry_convert.str() + "\".");
|
||||
}
|
||||
m_current_converted->SetLabelText(fmt::format("Current value: %08x (%s)", u32(value), is_ok ? "OK" : "conversion failed"));
|
||||
event.Skip();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
#pragma once
|
||||
#include <sstream>
|
||||
|
||||
class AutoPauseManagerDialog : public wxDialog
|
||||
{
|
||||
wxListView *m_list;
|
||||
enum
|
||||
{
|
||||
id_add,
|
||||
id_remove,
|
||||
id_config,
|
||||
};
|
||||
|
||||
wxListView* m_list;
|
||||
std::vector<u32> m_entries;
|
||||
//Used when i want to convert u32 id to string
|
||||
std::stringstream m_entry_convert;
|
||||
|
||||
public:
|
||||
AutoPauseManagerDialog(wxWindow* parent);
|
||||
|
@ -29,13 +33,12 @@ public:
|
|||
class AutoPauseSettingsDialog : public wxDialog
|
||||
{
|
||||
u32 m_entry;
|
||||
u32 *m_presult;
|
||||
u32* m_presult;
|
||||
wxTextCtrl* m_id;
|
||||
wxStaticText* m_current_converted;
|
||||
std::stringstream m_entry_convert;
|
||||
|
||||
public:
|
||||
AutoPauseSettingsDialog(wxWindow* parent, u32 *entry);
|
||||
AutoPauseSettingsDialog(wxWindow* parent, u32* entry);
|
||||
void OnOk(wxCommandEvent& event);
|
||||
void OnUpdateValue(wxCommandEvent& event);
|
||||
};
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/clipbrd.h>
|
||||
#include <fstream>
|
||||
|
||||
#include "Emu/state.h"
|
||||
#include "Utilities/Log.h"
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#include "stdafx_gui.h"
|
||||
#include "SaveDataUtility.h"
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include "Utilities/Log.h"
|
||||
//#include "Utilities/File.h"
|
||||
|
||||
|
@ -175,10 +173,7 @@ SaveDataListDialog::SaveDataListDialog(wxWindow* parent, bool enable_manage)
|
|||
|
||||
wxBoxSizer* s_main = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_entry_convert.clear();
|
||||
m_entry_convert.str("");
|
||||
m_entry_convert << "This is only a stub for now. This doesn't work yet due to related functions not being implemented.";
|
||||
wxStaticText* s_description = new wxStaticText(this, wxID_ANY, m_entry_convert.str(), wxDefaultPosition, wxDefaultSize, 0);
|
||||
wxStaticText* s_description = new wxStaticText(this, wxID_ANY, "This is only a stub for now. This doesn't work yet due to related functions not being implemented.", wxDefaultPosition, wxDefaultSize, 0);
|
||||
s_description->Wrap(400);
|
||||
s_main->Add(s_description, 0, wxALL, 5);
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#pragma once
|
||||
#include <sstream>
|
||||
|
||||
//TODO: Implement function calls related to Save Data List.
|
||||
//Those function calls may be needed to use this GUI.
|
||||
|
@ -21,14 +20,6 @@ struct SaveDataEntry
|
|||
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
//Reserved some Ids for Sort-By Submenu.
|
||||
id_copy = 64,
|
||||
id_remove,
|
||||
id_info
|
||||
};
|
||||
|
||||
//Used to display the information of a savedata.
|
||||
//Not sure about what information should be displayed.
|
||||
class SaveDataInfoDialog :public wxDialog
|
||||
|
@ -59,10 +50,17 @@ public:
|
|||
//Can also be used as a Save Data Chooser.
|
||||
class SaveDataListDialog : public wxDialog
|
||||
{
|
||||
enum
|
||||
{
|
||||
//Reserved some Ids for Sort-By Submenu.
|
||||
id_copy = 64,
|
||||
id_remove,
|
||||
id_info,
|
||||
};
|
||||
|
||||
wxListView* m_list;
|
||||
wxMenu* m_sort_options;
|
||||
unsigned int m_sort_type;
|
||||
std::stringstream m_entry_convert;
|
||||
|
||||
void OnSelect(wxCommandEvent& event);
|
||||
void OnManage(wxCommandEvent& event);
|
||||
|
|
Loading…
Add table
Reference in a new issue