mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-15 22:21:25 +00:00
Merge pull request #179 from O1L/master
Minor fix in GUI an other changes.
This commit is contained in:
commit
c8d8428275
102
rpcs3/Gui/FnIdGenerator.cpp
Normal file
102
rpcs3/Gui/FnIdGenerator.cpp
Normal file
@ -0,0 +1,102 @@
|
||||
#include "stdafx.h"
|
||||
#include "FnIdGenerator.h"
|
||||
|
||||
FnIdGenerator::FnIdGenerator(wxWindow* parent)
|
||||
: wxDialog(parent, wxID_ANY, "FunctionID Generator", wxDefaultPosition)
|
||||
, m_list(nullptr)
|
||||
{
|
||||
wxBoxSizer* s_panel(new wxBoxSizer(wxHORIZONTAL));
|
||||
wxBoxSizer* s_subpanel(new wxBoxSizer(wxVERTICAL));
|
||||
wxBoxSizer* s_subpanel2(new wxBoxSizer(wxHORIZONTAL));
|
||||
|
||||
m_list = new wxListView(this, wxID_ANY, wxDefaultPosition, wxSize(300, 450));
|
||||
m_list->InsertColumn(0, "Function Name", 0, 200);
|
||||
m_list->InsertColumn(1, "Function ID", 0, 100);
|
||||
|
||||
wxButton *b_input_name = new wxButton(this, wxID_ANY, "Input Function Name", wxDefaultPosition, wxSize(140, -1));
|
||||
wxButton *b_clear = new wxButton(this, wxID_ANY, "Clear List", wxDefaultPosition, wxSize(140, -1));
|
||||
|
||||
s_subpanel2->Add(b_input_name);
|
||||
s_subpanel2->AddSpacer(10);
|
||||
s_subpanel2->Add(b_clear);
|
||||
|
||||
s_subpanel->AddSpacer(5);
|
||||
s_subpanel->Add(m_list);
|
||||
s_subpanel->AddSpacer(5);
|
||||
s_subpanel->Add(s_subpanel2);
|
||||
|
||||
s_panel->AddSpacer(5);
|
||||
s_panel->Add(s_subpanel);
|
||||
s_panel->AddSpacer(5);
|
||||
|
||||
this->SetSizerAndFit(s_panel);
|
||||
|
||||
Connect(b_input_name->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FnIdGenerator::OnInput));
|
||||
Connect(b_clear->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FnIdGenerator::OnClear));
|
||||
}
|
||||
|
||||
FnIdGenerator::~FnIdGenerator()
|
||||
{
|
||||
m_func_name.Clear();
|
||||
m_func_id.Clear();
|
||||
delete m_list;
|
||||
}
|
||||
|
||||
void FnIdGenerator::OnInput(wxCommandEvent &event)
|
||||
{
|
||||
PrintId();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void FnIdGenerator::OnClear(wxCommandEvent &event)
|
||||
{
|
||||
m_list->DeleteAllItems();
|
||||
m_func_name.Clear();
|
||||
m_func_id.Clear();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
u32 FnIdGenerator::GenerateFnId(const std::string& func_name)
|
||||
{
|
||||
static const char* suffix = "\x67\x59\x65\x99\x04\x25\x04\x90\x56\x64\x27\x49\x94\x89\x74\x1A"; //symbol name suffix
|
||||
std::string input = func_name + suffix;
|
||||
unsigned char output[20];
|
||||
|
||||
sha1((unsigned char*)input.c_str(), input.length(), output); //compute SHA-1 hash
|
||||
|
||||
return (be_t<u32>&) output[0];
|
||||
}
|
||||
|
||||
void FnIdGenerator::PrintId()
|
||||
{
|
||||
const std::string temp;
|
||||
TextInputDialog dial(0, temp, "Please input function name");
|
||||
if (dial.ShowModal() == wxID_OK)
|
||||
{
|
||||
dial.GetResult();
|
||||
}
|
||||
|
||||
const std::string& func_name = dial.GetResult();
|
||||
|
||||
if (func_name.length() == 0)
|
||||
return;
|
||||
|
||||
const be_t<u32> result = GenerateFnId(func_name);
|
||||
m_func_name.AddCpy(func_name);
|
||||
m_func_id.AddCpy(result);
|
||||
|
||||
ConLog.Write("Function: %s, Id: 0x%08x ", func_name.c_str(), result);
|
||||
UpdateInformation();
|
||||
}
|
||||
|
||||
void FnIdGenerator::UpdateInformation()
|
||||
{
|
||||
m_list->DeleteAllItems();
|
||||
|
||||
for(u32 i = 0; i < m_func_name.GetCount(); i++)
|
||||
{
|
||||
m_list->InsertItem(m_func_name.GetCount(), wxEmptyString);
|
||||
m_list->SetItem(i, 0, m_func_name[i]);
|
||||
m_list->SetItem(i, 1, wxString::Format("0x%08x", re(m_func_id[i])));
|
||||
}
|
||||
}
|
21
rpcs3/Gui/FnIdGenerator.h
Normal file
21
rpcs3/Gui/FnIdGenerator.h
Normal file
@ -0,0 +1,21 @@
|
||||
#include "TextInputDialog.h"
|
||||
#include "../Crypto/aes.h"
|
||||
#include "../Crypto/sha1.h"
|
||||
|
||||
class FnIdGenerator : public wxDialog
|
||||
{
|
||||
private:
|
||||
Array<std::string> m_func_name;
|
||||
Array<u32> m_func_id;
|
||||
wxListView* m_list;
|
||||
|
||||
public:
|
||||
FnIdGenerator(wxWindow* parent);
|
||||
~FnIdGenerator();
|
||||
|
||||
void OnInput(wxCommandEvent &event);
|
||||
void OnClear(wxCommandEvent &event);
|
||||
u32 GenerateFnId(const std::string& func_name);
|
||||
void UpdateInformation();
|
||||
void PrintId();
|
||||
};
|
@ -4,6 +4,7 @@
|
||||
#include "MemoryViewer.h"
|
||||
#include "RSXDebugger.h"
|
||||
#include "PADManager.h"
|
||||
#include "FnIdGenerator.h"
|
||||
|
||||
#include "git-version.h"
|
||||
#include "Ini.h"
|
||||
@ -35,6 +36,7 @@ enum IDs
|
||||
id_tools_compiler,
|
||||
id_tools_memory_viewer,
|
||||
id_tools_rsx_debugger,
|
||||
id_tools_fnid_generator,
|
||||
id_help_about,
|
||||
id_update_dbg,
|
||||
};
|
||||
@ -88,6 +90,7 @@ MainFrame::MainFrame()
|
||||
menu_tools.Append(id_tools_compiler, "ELF Compiler");
|
||||
menu_tools.Append(id_tools_memory_viewer, "Memory Viewer");
|
||||
menu_tools.Append(id_tools_rsx_debugger, "RSX Debugger");
|
||||
menu_tools.Append(id_tools_fnid_generator, "FunctionID Generator");
|
||||
|
||||
wxMenu& menu_help(*new wxMenu());
|
||||
menubar.Append(&menu_help, "Help");
|
||||
@ -122,6 +125,7 @@ MainFrame::MainFrame()
|
||||
Connect( id_tools_compiler, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OpenELFCompiler));
|
||||
Connect( id_tools_memory_viewer, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OpenMemoryViewer));
|
||||
Connect( id_tools_rsx_debugger, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OpenRSXDebugger));
|
||||
Connect(id_tools_fnid_generator, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OpenFnIdGenerator));
|
||||
|
||||
Connect( id_help_about, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::AboutDialogHandler) );
|
||||
|
||||
@ -583,6 +587,12 @@ void MainFrame::OpenRSXDebugger(wxCommandEvent& WXUNUSED(event))
|
||||
(new RSXDebugger(this)) -> Show();
|
||||
}
|
||||
|
||||
void MainFrame::OpenFnIdGenerator(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
FnIdGenerator(this).ShowModal();
|
||||
}
|
||||
|
||||
|
||||
void MainFrame::AboutDialogHandler(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
AboutDialog(this).ShowModal();
|
||||
|
@ -37,6 +37,7 @@ private:
|
||||
void OpenELFCompiler(wxCommandEvent& evt);
|
||||
void OpenMemoryViewer(wxCommandEvent& evt);
|
||||
void OpenRSXDebugger(wxCommandEvent& evt);
|
||||
void OpenFnIdGenerator(wxCommandEvent& evt);
|
||||
void AboutDialogHandler(wxCommandEvent& event);
|
||||
void UpdateUI(wxCommandEvent& event);
|
||||
void OnKeyDown(wxKeyEvent& event);
|
||||
|
@ -5,13 +5,12 @@ PADManager::PADManager(wxWindow* parent)
|
||||
: wxDialog(parent, wxID_ANY, "PAD Settings", wxDefaultPosition)
|
||||
, m_button_id(0)
|
||||
, m_key_pressed(false)
|
||||
, m_emu_paused(false)
|
||||
{
|
||||
bool paused = false;
|
||||
|
||||
if(Emu.IsRunning())
|
||||
{
|
||||
Emu.Pause();
|
||||
paused = true;
|
||||
m_emu_paused = true;
|
||||
}
|
||||
|
||||
wxBoxSizer* s_panel(new wxBoxSizer(wxHORIZONTAL));
|
||||
@ -246,8 +245,6 @@ PADManager::PADManager(wxWindow* parent)
|
||||
Connect(b_ok->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(PADManager::OnButtonClicked));
|
||||
Connect(b_reset->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(PADManager::OnButtonClicked));
|
||||
Connect(b_cancel->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(PADManager::OnButtonClicked));
|
||||
|
||||
if(paused) Emu.Resume();
|
||||
}
|
||||
|
||||
void PADManager::OnKeyDown(wxKeyEvent &keyEvent)
|
||||
|
@ -82,13 +82,11 @@ private:
|
||||
AppConnector m_app_connector;
|
||||
u32 m_seconds;
|
||||
u32 m_button_id;
|
||||
bool m_key_pressed;
|
||||
bool m_key_pressed, m_emu_paused;
|
||||
|
||||
public:
|
||||
PADManager(wxWindow* parent);
|
||||
~PADManager()
|
||||
{
|
||||
}
|
||||
~PADManager() { if(m_emu_paused) Emu.Resume(); }
|
||||
|
||||
void OnKeyDown(wxKeyEvent &keyEvent);
|
||||
void OnKeyUp(wxKeyEvent &keyEvent);
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "stdafx.h"
|
||||
#include "TextInputDialog.h"
|
||||
|
||||
TextInputDialog::TextInputDialog(wxWindow* parent, const std::string& defvalue)
|
||||
: wxDialog(parent, wxID_ANY, "Input text", wxDefaultPosition)
|
||||
TextInputDialog::TextInputDialog(wxWindow* parent, const std::string& defvalue, const std::string& label)
|
||||
: wxDialog(parent, wxID_ANY, label, wxDefaultPosition)
|
||||
{
|
||||
m_tctrl_text = new wxTextCtrl(this, wxID_ANY, fmt::ToUTF8(defvalue));
|
||||
|
||||
|
@ -6,7 +6,7 @@ class TextInputDialog : public wxDialog
|
||||
std::string m_result;
|
||||
|
||||
public:
|
||||
TextInputDialog(wxWindow* parent, const std::string& defvalue = "");
|
||||
TextInputDialog(wxWindow* parent, const std::string& defvalue = "", const std::string& label = "Input text");
|
||||
void OnOk(wxCommandEvent& event);
|
||||
|
||||
std::string GetResult();
|
||||
|
@ -333,6 +333,7 @@
|
||||
<ClCompile Include="Gui\MemoryViewer.cpp" />
|
||||
<ClCompile Include="Gui\PADManager.cpp" />
|
||||
<ClCompile Include="Gui\RSXDebugger.cpp" />
|
||||
<ClCompile Include="Gui\FnIdGenerator.cpp" />
|
||||
<ClCompile Include="Gui\TextInputDialog.cpp" />
|
||||
<ClCompile Include="Gui\VFSManager.cpp" />
|
||||
<ClCompile Include="Gui\VHDDManager.cpp" />
|
||||
@ -502,6 +503,7 @@
|
||||
<ClInclude Include="Gui\TextInputDialog.h" />
|
||||
<ClInclude Include="Gui\VFSManager.h" />
|
||||
<ClInclude Include="Gui\VHDDManager.h" />
|
||||
<ClInclude Include="Gui\FnIdGenerator.h" />
|
||||
<ClInclude Include="Ini.h" />
|
||||
<ClInclude Include="Loader\ELF.h" />
|
||||
<ClInclude Include="Loader\ELF32.h" />
|
||||
|
@ -370,6 +370,9 @@
|
||||
<ClCompile Include="Gui\RSXDebugger.cpp">
|
||||
<Filter>Gui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Gui\FnIdGenerator.cpp">
|
||||
<Filter>Gui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Gui\PADManager.cpp">
|
||||
<Filter>Gui</Filter>
|
||||
</ClCompile>
|
||||
@ -579,6 +582,9 @@
|
||||
<ClInclude Include="Gui\RSXDebugger.h">
|
||||
<Filter>Gui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Gui\FnIdGenerator.h">
|
||||
<Filter>Gui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Gui\TextInputDialog.h">
|
||||
<Filter>Gui</Filter>
|
||||
</ClInclude>
|
||||
|
Loading…
x
Reference in New Issue
Block a user