From 0002cc0af3daaf36316dbaba1ea50cb730b5d4d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandro=20S=C3=A1nchez=20Bach?= Date: Sun, 6 Jul 2014 01:30:28 +0200 Subject: [PATCH] Removed old / unnecessary code * Removed Plugins.h file as I assume setting up a plugin hell is a bad idea (does anyone disagree?). * Removed FnIdGenerator, and moved FnIdGenerator::GenerateFnId to getFunctionId in Modules.cpp * Disabled RSX Debugger and Memory Viewer when the emulator is stopped. * ELF64Loader::LoadPhdrData refactored. --- rpcs3/Emu/SysCalls/Modules.cpp | 11 +- rpcs3/Emu/SysCalls/Modules.h | 13 +- rpcs3/Emu/SysCalls/SysCalls.h | 2 - rpcs3/Emu/SysCalls/lv2/sys_lwcond.cpp | 1 - rpcs3/Emu/SysCalls/lv2/sys_lwmutex.cpp | 1 - rpcs3/Emu/SysCalls/lv2/sys_memory.cpp | 1 - rpcs3/Emu/SysCalls/lv2/sys_mmapper.cpp | 1 + rpcs3/Emu/SysCalls/lv2/sys_mutex.cpp | 1 - rpcs3/Emu/SysCalls/lv2/sys_rwlock.cpp | 2 +- rpcs3/Emu/SysCalls/lv2/sys_semaphore.cpp | 1 + rpcs3/Emu/SysCalls/lv2/sys_timer.cpp | 2 +- rpcs3/Emu/SysCalls/lv2/sys_trace.cpp | 1 + rpcs3/Emu/SysCalls/lv2/sys_tty.cpp | 1 + rpcs3/Emu/System.cpp | 1 - rpcs3/Gui/FnIdGenerator.cpp | 102 ------- rpcs3/Gui/FnIdGenerator.h | 23 -- rpcs3/Gui/MainFrame.cpp | 32 +- rpcs3/Gui/Plugins.h | 362 ----------------------- rpcs3/Loader/ELF64.cpp | 237 +++++++-------- rpcs3/Loader/Loader.h | 64 ++-- rpcs3/emucore.vcxproj | 4 +- rpcs3/rpcs3.vcxproj | 2 - rpcs3/rpcs3.vcxproj.filters | 6 - 23 files changed, 175 insertions(+), 696 deletions(-) delete mode 100644 rpcs3/Gui/FnIdGenerator.cpp delete mode 100644 rpcs3/Gui/FnIdGenerator.h delete mode 100644 rpcs3/Gui/Plugins.h diff --git a/rpcs3/Emu/SysCalls/Modules.cpp b/rpcs3/Emu/SysCalls/Modules.cpp index 20a5669c5d..ecbdb085de 100644 --- a/rpcs3/Emu/SysCalls/Modules.cpp +++ b/rpcs3/Emu/SysCalls/Modules.cpp @@ -5,12 +5,20 @@ #include "Emu/Cell/PPUThread.h" #include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" +#include "Crypto/sha1.h" #include #include "Emu/System.h" #include "ModuleManager.h" +u32 getFunctionId(const std::string& name) +{ + 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 = name + suffix; + unsigned char output[20]; - + sha1((unsigned char*)input.c_str(), input.length(), output); // Compute SHA-1 hash + return (u32&)output[0]; +} Module::Module(u16 id, const char* name) : m_is_loaded(false) @@ -217,4 +225,3 @@ bool Module::CheckID(u32 id, ID*& _id) const { return Emu.GetIdManager().CheckID(id) && (_id = &Emu.GetIdManager().GetID(id))->m_name == GetName(); } - diff --git a/rpcs3/Emu/SysCalls/Modules.h b/rpcs3/Emu/SysCalls/Modules.h index a558246faf..ee55d8de93 100644 --- a/rpcs3/Emu/SysCalls/Modules.h +++ b/rpcs3/Emu/SysCalls/Modules.h @@ -2,7 +2,6 @@ #define declCPU PPUThread& CPU = GetCurrentPPUThread - //TODO struct ModuleFunc { @@ -120,16 +119,24 @@ public: } template __forceinline void AddFunc(u32 id, T func); - + template __forceinline void AddFunc(const std::string& name, T func); template __forceinline void AddFuncSub(const char group[8], const u64 ops[], const char* name, T func); }; +u32 getFunctionId(const std::string& name); + template __forceinline void Module::AddFunc(u32 id, T func) { m_funcs_list.emplace_back(new ModuleFunc(id, bind_func(func))); } +template +__forceinline void Module::AddFunc(const std::string& name, T func) +{ + AddFunc(getFunctionId(name), func); +} + template __forceinline void Module::AddFuncSub(const char group[8], const u64 ops[], const char* name, T func) { @@ -144,7 +151,6 @@ __forceinline void Module::AddFuncSub(const char group[8], const u64 ops[], cons sf->found = 0; // TODO: check for self-inclusions, use CRC - for (u32 i = 0; ops[i]; i++) { SFuncOp op; @@ -157,4 +163,3 @@ __forceinline void Module::AddFuncSub(const char group[8], const u64 ops[], cons } Emu.GetSFuncManager().push_back(sf); } - diff --git a/rpcs3/Emu/SysCalls/SysCalls.h b/rpcs3/Emu/SysCalls/SysCalls.h index 2454724db8..759078de8d 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.h +++ b/rpcs3/Emu/SysCalls/SysCalls.h @@ -179,8 +179,6 @@ public: static std::string GetHLEFuncName(const u32 fid); }; -//extern SysCalls SysCallsManager; - #define REG_SUB(module, group, name, ...) \ static const u64 name ## _table[] = {__VA_ARGS__ , 0}; \ module->AddFuncSub(group, name ## _table, #name, name) diff --git a/rpcs3/Emu/SysCalls/lv2/sys_lwcond.cpp b/rpcs3/Emu/SysCalls/lv2/sys_lwcond.cpp index b4778707da..7bc6377c62 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_lwcond.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_lwcond.cpp @@ -22,7 +22,6 @@ s32 sys_lwcond_create(mem_ptr_t lwcond, mem_ptr_t l u32 id = sys_lwcond.GetNewId(new Lwcond(attr->name_u64)); lwcond->lwmutex = lwmutex.GetAddr(); lwcond->lwcond_queue = id; - procObjects.lwcond_objects.insert(id); if (lwmutex.IsGood()) { diff --git a/rpcs3/Emu/SysCalls/lv2/sys_lwmutex.cpp b/rpcs3/Emu/SysCalls/lv2/sys_lwmutex.cpp index e33893ce81..1708e2770a 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_lwmutex.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_lwmutex.cpp @@ -40,7 +40,6 @@ s32 sys_lwmutex_create(mem_ptr_t lwmutex, mem_ptr_tname_u64)); lwmutex->sleep_queue = sq_id; - procObjects.lwmutex_objects.insert(sq_id); sc_lwmutex.Warning("*** lwmutex created [%s] (attribute=0x%x): sq_id = %d", std::string(attr->name, 8).c_str(), (u32) lwmutex->attribute, sq_id); diff --git a/rpcs3/Emu/SysCalls/lv2/sys_memory.cpp b/rpcs3/Emu/SysCalls/lv2/sys_memory.cpp index 480f0c5d7d..9815223f86 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_memory.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_memory.cpp @@ -129,7 +129,6 @@ s32 sys_memory_container_create(mem32_t cid, u32 yield_size) // Wrap the allocated memory in a memory container. MemoryContainerInfo *ct = new MemoryContainerInfo(addr, yield_size); cid = sc_mem.GetNewId(ct); - procObjects.mem_objects.insert(cid); sc_mem.Warning("*** memory_container created(addr=0x%llx): id = %d", addr, cid.GetValue()); diff --git a/rpcs3/Emu/SysCalls/lv2/sys_mmapper.cpp b/rpcs3/Emu/SysCalls/lv2/sys_mmapper.cpp index edd1226fc7..1660ce5b3d 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_mmapper.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_mmapper.cpp @@ -3,6 +3,7 @@ #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/SysCalls.h" +#include "sys_memory.h" #include "sys_mmapper.h" #include diff --git a/rpcs3/Emu/SysCalls/lv2/sys_mutex.cpp b/rpcs3/Emu/SysCalls/lv2/sys_mutex.cpp index 524dea7ef6..ab5b870efc 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_mutex.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_mutex.cpp @@ -44,7 +44,6 @@ s32 sys_mutex_create(mem32_t mutex_id, mem_ptr_t attr) u32 tid = GetCurrentPPUThread().GetId(); Mutex* mutex = new Mutex((u32)attr->protocol, is_recursive, attr->name_u64); u32 id = sys_mtx.GetNewId(mutex); - procObjects.mutex_objects.insert(id); mutex->m_mutex.lock(tid); mutex->id = id; mutex_id = id; diff --git a/rpcs3/Emu/SysCalls/lv2/sys_rwlock.cpp b/rpcs3/Emu/SysCalls/lv2/sys_rwlock.cpp index 3db2e9c6e7..2ad0524cee 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_rwlock.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_rwlock.cpp @@ -3,8 +3,8 @@ #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" -#include "sys_rwlock.h" #include "Emu/SysCalls/SysCalls.h" +#include "sys_rwlock.h" SysCallBase sys_rwlock("sys_rwlock"); diff --git a/rpcs3/Emu/SysCalls/lv2/sys_semaphore.cpp b/rpcs3/Emu/SysCalls/lv2/sys_semaphore.cpp index 66be62ee2c..08f3c73915 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_semaphore.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_semaphore.cpp @@ -4,6 +4,7 @@ #include "Emu/System.h" #include "Emu/SysCalls/SysCalls.h" #include "sys_semaphore.h" +#include "sys_time.h" SysCallBase sys_sem("sys_semaphore"); diff --git a/rpcs3/Emu/SysCalls/lv2/sys_timer.cpp b/rpcs3/Emu/SysCalls/lv2/sys_timer.cpp index e7fbc7f63b..cb94b404e6 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_timer.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_timer.cpp @@ -2,9 +2,9 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "sys_timer.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/event.h" +#include "sys_timer.h" SysCallBase sys_timer("sys_timer"); diff --git a/rpcs3/Emu/SysCalls/lv2/sys_trace.cpp b/rpcs3/Emu/SysCalls/lv2/sys_trace.cpp index 776d34f779..6df868f1aa 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_trace.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_trace.cpp @@ -3,6 +3,7 @@ #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/SysCalls.h" +#include "sys_trace.h" SysCallBase sys_trace("sys_trace"); diff --git a/rpcs3/Emu/SysCalls/lv2/sys_tty.cpp b/rpcs3/Emu/SysCalls/lv2/sys_tty.cpp index 0ecf0f3b5a..de64701a6d 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_tty.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_tty.cpp @@ -3,6 +3,7 @@ #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/SysCalls.h" +#include "sys_tty.h" s32 sys_tty_read(u32 ch, u64 buf_addr, u32 len, u64 preadlen_addr) { diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 857b172e86..54254c4f62 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -407,7 +407,6 @@ void Emulator::Stop() GetAudioManager().Close(); GetEventManager().Clear(); GetCPU().Close(); - //SysCallsManager.Close(); GetIdManager().Clear(); GetPadManager().Close(); GetKeyboardManager().Close(); diff --git a/rpcs3/Gui/FnIdGenerator.cpp b/rpcs3/Gui/FnIdGenerator.cpp deleted file mode 100644 index 100e0b8e50..0000000000 --- a/rpcs3/Gui/FnIdGenerator.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include "stdafx.h" -#include "Utilities/Log.h" -#include "Emu/Memory/Memory.h" -#include "FnIdGenerator.h" - -FnIdGenerator::FnIdGenerator(wxWindow* parent) - : wxDialog(parent, wxID_ANY, "FunctionID Generator") - , 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)); - b_input_name->Bind(wxEVT_BUTTON, &FnIdGenerator::OnInput, this); - - wxButton *b_clear = new wxButton(this, wxID_ANY, "Clear List", wxDefaultPosition, wxSize(140, -1)); - b_clear->Bind(wxEVT_BUTTON, &FnIdGenerator::OnClear, this); - - 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); - - SetSizerAndFit(s_panel); -} - -FnIdGenerator::~FnIdGenerator() -{ - delete m_list; - m_list = nullptr; -} - -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&) output[0]; -} - -void FnIdGenerator::PrintId() -{ - TextInputDialog dial(0, "", "Please input function name"); - if (dial.ShowModal() == wxID_OK) - { - const std::string& func_name = dial.GetResult(); - - if (func_name.length() == 0) - return; - - const be_t result = GenerateFnId(func_name); - m_func_name.push_back(func_name); - m_func_id.push_back(result); - - LOG_NOTICE(HLE, "Function: %s, Id: 0x%08x ", func_name.c_str(), result); - UpdateInformation(); - } - - return; -} - -void FnIdGenerator::UpdateInformation() -{ - m_list->DeleteAllItems(); - - for(u32 i = 0; i < m_func_name.size(); i++) - { - m_list->InsertItem(m_func_name.size(), wxEmptyString); - m_list->SetItem(i, 0, m_func_name[i]); - m_list->SetItem(i, 1, wxString::Format("0x%08x", re(m_func_id[i]))); - } -} diff --git a/rpcs3/Gui/FnIdGenerator.h b/rpcs3/Gui/FnIdGenerator.h deleted file mode 100644 index c2fd448510..0000000000 --- a/rpcs3/Gui/FnIdGenerator.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include "TextInputDialog.h" -#include "../Crypto/aes.h" -#include "../Crypto/sha1.h" - -class FnIdGenerator : public wxDialog -{ -private: - std::vector m_func_name; - std::vector 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(); -}; \ No newline at end of file diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index 648c61838e..20c6a55274 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -9,7 +9,6 @@ #include "MemoryViewer.h" #include "RSXDebugger.h" #include "PADManager.h" -#include "FnIdGenerator.h" #include "git-version.h" #include "Ini.h" @@ -96,9 +95,8 @@ MainFrame::MainFrame() wxMenu* menu_tools = new wxMenu(); menubar->Append(menu_tools, "Tools"); 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"); + menu_tools->Append(id_tools_memory_viewer, "Memory Viewer")->Enable(false); + menu_tools->Append(id_tools_rsx_debugger, "RSX Debugger")->Enable(false); wxMenu* menu_help = new wxMenu(); menubar->Append(menu_help, "Help"); @@ -134,7 +132,6 @@ MainFrame::MainFrame() Bind(wxEVT_MENU, &MainFrame::OpenELFCompiler, this, id_tools_compiler); Bind(wxEVT_MENU, &MainFrame::OpenMemoryViewer, this, id_tools_memory_viewer); Bind(wxEVT_MENU, &MainFrame::OpenRSXDebugger, this, id_tools_rsx_debugger); - Bind(wxEVT_MENU, &MainFrame::OpenFnIdGenerator, this, id_tools_fnid_generator); Bind(wxEVT_MENU, &MainFrame::AboutDialogHandler, this, id_help_about); @@ -656,11 +653,6 @@ 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)) { @@ -729,21 +721,31 @@ void MainFrame::UpdateUI(wxCommandEvent& event) is_ready = Emu.IsReady(); } + // Update menu items based on the state of the emulator wxMenuBar& menubar( *GetMenuBar() ); + + // Emulation wxMenuItem& pause = *menubar.FindItem( id_sys_pause ); wxMenuItem& stop = *menubar.FindItem( id_sys_stop ); - wxMenuItem& send_exit = *menubar.FindItem( id_sys_send_exit ); - wxMenuItem& send_open_menu = *menubar.FindItem( id_sys_send_open_menu ); - pause.SetItemLabel(is_running ? "Pause\tCtrl + P" : is_ready ? "Start\tCtrl + C" : "Resume\tCtrl + C"); + pause.SetItemLabel(is_running ? "Pause\tCtrl + P" : is_ready ? "Start\tCtrl + E" : "Resume\tCtrl + E"); pause.Enable(!is_stopped); stop.Enable(!is_stopped); - //send_exit.Enable(false); - bool enable_commands = !is_stopped && Emu.GetCallbackManager().m_exit_callback.m_callbacks.size(); + // PS3 Commands + wxMenuItem& send_exit = *menubar.FindItem( id_sys_send_exit ); + wxMenuItem& send_open_menu = *menubar.FindItem( id_sys_send_open_menu ); + bool enable_commands = !is_stopped && Emu.GetCallbackManager().m_exit_callback.m_callbacks.size(); send_open_menu.SetItemLabel(wxString::Format("Send %s system menu cmd", (m_sys_menu_opened ? "close" : "open"))); send_open_menu.Enable(enable_commands); send_exit.Enable(enable_commands); + // Tools + wxMenuItem& memory_viewer = *menubar.FindItem( id_tools_memory_viewer ); + wxMenuItem& rsx_debugger = *menubar.FindItem( id_tools_rsx_debugger); + memory_viewer.Enable(!is_stopped); + rsx_debugger.Enable(!is_stopped); + + //m_aui_mgr.Update(); //wxCommandEvent refit( wxEVT_COMMAND_MENU_SELECTED, id_update_dbg ); diff --git a/rpcs3/Gui/Plugins.h b/rpcs3/Gui/Plugins.h deleted file mode 100644 index d3e10c8728..0000000000 --- a/rpcs3/Gui/Plugins.h +++ /dev/null @@ -1,362 +0,0 @@ -#pragma once - -#define LOAD_SYMBOL(x) if(m_dll.HasSymbol(#x)) x = (_##x)m_dll.GetSymbol(#x) -struct Ps3EmuPlugin -{ - enum PS3EMULIB_TYPE - { - LIB_PAD = (1 << 0), - LIB_KB = (1 << 1), - LIB_MOUSE = (1 << 2), - LIB_FS = (1 << 3), - }; - - typedef u32 (*_Ps3EmuLibGetType)(); - typedef u32 (*_Ps3EmuLibGetVersion)(); - typedef const char* (*_Ps3EmuLibGetName)(); - typedef const char* (*_Ps3EmuLibGetFullName)(); - typedef void (*_Ps3EmuLibSetSettingsPath)(const char* path); - typedef void (*_Ps3EmuLibSetLogPath)(const char* path); - typedef const char* (*_Ps3EmuLibGetSettingsName)(); - typedef const char* (*_Ps3EmuLibGetLogName)(); - typedef void (*_Ps3EmuLibConfigure)(PS3EMULIB_TYPE type); - typedef void (*_Ps3EmuLibAbout)(); - typedef u32 (*_Ps3EmuLibTest)(PS3EMULIB_TYPE type); - - _Ps3EmuLibGetType Ps3EmuLibGetType; - _Ps3EmuLibGetVersion Ps3EmuLibGetVersion; - _Ps3EmuLibGetName Ps3EmuLibGetName; - _Ps3EmuLibGetFullName Ps3EmuLibGetFullName; - _Ps3EmuLibSetSettingsPath Ps3EmuLibSetSettingsPath; - _Ps3EmuLibSetLogPath Ps3EmuLibSetLogPath; - _Ps3EmuLibGetSettingsName Ps3EmuLibGetSettingsName; - _Ps3EmuLibGetLogName Ps3EmuLibGetLogName; - _Ps3EmuLibConfigure Ps3EmuLibConfigure; - _Ps3EmuLibAbout Ps3EmuLibAbout; - _Ps3EmuLibTest Ps3EmuLibTest; - - wxDynamicLibrary m_dll; - - Ps3EmuPlugin() - { - Reset(); - } - - Ps3EmuPlugin(const wxString& path) - { - Load(path); - } - - virtual ~Ps3EmuPlugin() throw() - { - Unload(); - } - - wxString FormatVersion() - { - if(!Ps3EmuLibGetVersion) return wxEmptyString; - - const u32 v = Ps3EmuLibGetVersion(); - - const u8 v0 = v >> 24; - const u8 v1 = v >> 16; - const u8 v2 = v >> 8; - const u8 v3 = v; - - if(!v2 && !v3) return wxString::Format("%d.%d", v0, v1); - if(!v3) return wxString::Format("%d.%d.%d", v0, v1, v2); - - return wxString::Format("%d.%d.%d.%d", v0, v1, v2, v3); - } - - void Load(const wxString& path) - { - if(m_dll.Load(path)) - { - Init(); - } - else - { - Reset(); - } - } - - void Unload() - { - Reset(); - - if(m_dll.IsLoaded()) m_dll.Unload(); - } - - virtual bool Test() - { - return - m_dll.IsLoaded() && - Ps3EmuLibGetType && - Ps3EmuLibGetVersion && - Ps3EmuLibGetName && - Ps3EmuLibGetFullName && - Ps3EmuLibSetSettingsPath && - Ps3EmuLibSetLogPath && - Ps3EmuLibGetSettingsName && - Ps3EmuLibGetLogName && - Ps3EmuLibConfigure && - Ps3EmuLibAbout && - Ps3EmuLibTest; - } - -protected: - virtual void Init() - { - LOAD_SYMBOL(Ps3EmuLibGetType); - LOAD_SYMBOL(Ps3EmuLibGetVersion); - LOAD_SYMBOL(Ps3EmuLibGetName); - LOAD_SYMBOL(Ps3EmuLibGetFullName); - LOAD_SYMBOL(Ps3EmuLibSetSettingsPath); - LOAD_SYMBOL(Ps3EmuLibSetLogPath); - LOAD_SYMBOL(Ps3EmuLibGetSettingsName); - LOAD_SYMBOL(Ps3EmuLibGetLogName); - LOAD_SYMBOL(Ps3EmuLibConfigure); - LOAD_SYMBOL(Ps3EmuLibAbout); - LOAD_SYMBOL(Ps3EmuLibTest); - } - - virtual void Reset() - { - Ps3EmuLibGetType = nullptr; - Ps3EmuLibGetVersion = nullptr; - Ps3EmuLibGetName = nullptr; - Ps3EmuLibGetFullName = nullptr; - Ps3EmuLibSetSettingsPath = nullptr; - Ps3EmuLibSetLogPath = nullptr; - Ps3EmuLibGetSettingsName = nullptr; - Ps3EmuLibGetLogName = nullptr; - Ps3EmuLibConfigure = nullptr; - Ps3EmuLibAbout = nullptr; - Ps3EmuLibTest = nullptr; - } -}; - -struct Ps3EmuPluginPAD : public Ps3EmuPlugin -{ - typedef int (*_PadInit)(u32 max_connect); - typedef int (*_PadEnd)(); - typedef int (*_PadClearBuf)(u32 port_no); - typedef int (*_PadGetData)(u32 port_no, void* data); - typedef int (*_PadGetDataExtra)(u32 port_no, u32* device_type, void* data); - typedef int (*_PadSetActDirect)(u32 port_no, void* param); - typedef int (*_PadGetInfo)(void* info); - typedef int (*_PadGetInfo2)(void* info); - typedef int (*_PadSetPortSetting)(u32 port_no, u32 port_setting); - typedef int (*_PadLddRegisterController)(); - typedef int (*_PadLddUnregisterController)(int handle); - typedef int (*_PadLddDataInsert)(int handle, void* data); - typedef int (*_PadLddGetPortNo)(int handle); - typedef int (*_PadPeriphGetInfo)(void* info); - typedef int (*_PadPeriphGetData)(u32 port_no, void* data); - typedef int (*_PadInfoPressMode)(u32 port_no); - typedef int (*_PadSetPressMode)(u32 port_no, u8 mode); - typedef int (*_PadInfoSensorMode)(u32 port_no); - typedef int (*_PadSetSensorMode)(u32 port_no, u8 mode); - typedef int (*_PadGetRawData)(u32 port_no, void* data); - typedef int (*_PadDbgLddRegisterController)(u32 device_capability); - typedef int (*_PadDbgLddSetDataInsertMode)(int handle, u8 mode); - typedef int (*_PadDbgPeriphRegisterDevice)(u16 vid, u16 pid, u32 pclass_type, u32 pclass_profile, void* mapping); - typedef int (*_PadDbgGetData)(u32 port_no, void* data); - - _PadInit PadInit; - _PadEnd PadEnd; - _PadClearBuf PadClearBuf; - _PadGetData PadGetData; - _PadGetDataExtra PadGetDataExtra; - _PadSetActDirect PadSetActDirect; - _PadGetInfo PadGetInfo; - _PadGetInfo2 PadGetInfo2; - _PadSetPortSetting PadSetPortSetting; - _PadLddRegisterController PadLddRegisterController; - _PadLddUnregisterController PadLddUnregisterController; - _PadLddDataInsert PadLddDataInsert; - _PadLddGetPortNo PadLddGetPortNo; - _PadPeriphGetInfo PadPeriphGetInfo; - _PadPeriphGetData PadPeriphGetData; - _PadInfoPressMode PadInfoPressMode; - _PadSetPressMode PadSetPressMode; - _PadInfoSensorMode PadInfoSensorMode; - _PadSetSensorMode PadSetSensorMode; - _PadGetRawData PadGetRawData; - _PadDbgLddRegisterController PadDbgLddRegisterController; - _PadDbgLddSetDataInsertMode PadDbgLddSetDataInsertMode; - _PadDbgPeriphRegisterDevice PadDbgPeriphRegisterDevice; - _PadDbgGetData PadDbgGetData; - - Ps3EmuPluginPAD() - { - Reset(); - } - - Ps3EmuPluginPAD(const wxString& path) - { - Load(path); - } - - virtual bool Test() - { - return Ps3EmuPlugin::Test() && - PadInit && - PadEnd && - PadClearBuf && - PadGetData && - PadGetDataExtra && - PadSetActDirect && - PadGetInfo && - PadGetInfo2 && - PadSetPortSetting && - PadLddRegisterController && - PadLddUnregisterController && - PadLddDataInsert && - PadLddGetPortNo && - PadPeriphGetInfo && - PadPeriphGetData && - PadInfoPressMode && - PadSetPressMode && - PadInfoSensorMode && - PadSetSensorMode && - PadGetRawData && - PadDbgLddRegisterController && - PadDbgLddSetDataInsertMode && - PadDbgPeriphRegisterDevice && - PadDbgGetData; - } - -protected: - virtual void Init() - { - LOAD_SYMBOL(PadInit); - LOAD_SYMBOL(PadEnd); - LOAD_SYMBOL(PadClearBuf); - LOAD_SYMBOL(PadGetData); - LOAD_SYMBOL(PadGetDataExtra); - LOAD_SYMBOL(PadSetActDirect); - LOAD_SYMBOL(PadGetInfo); - LOAD_SYMBOL(PadGetInfo2); - LOAD_SYMBOL(PadSetPortSetting); - LOAD_SYMBOL(PadLddRegisterController); - LOAD_SYMBOL(PadLddUnregisterController); - LOAD_SYMBOL(PadLddDataInsert); - LOAD_SYMBOL(PadLddGetPortNo); - LOAD_SYMBOL(PadPeriphGetInfo); - LOAD_SYMBOL(PadPeriphGetData); - LOAD_SYMBOL(PadInfoPressMode); - LOAD_SYMBOL(PadSetPressMode); - LOAD_SYMBOL(PadInfoSensorMode); - LOAD_SYMBOL(PadSetSensorMode); - LOAD_SYMBOL(PadGetRawData); - LOAD_SYMBOL(PadDbgLddRegisterController); - LOAD_SYMBOL(PadDbgLddSetDataInsertMode); - LOAD_SYMBOL(PadDbgPeriphRegisterDevice); - LOAD_SYMBOL(PadDbgGetData); - - Ps3EmuPlugin::Init(); - } - - virtual void Reset() - { - PadInit = nullptr; - PadEnd = nullptr; - PadClearBuf = nullptr; - PadGetData = nullptr; - PadGetDataExtra = nullptr; - PadSetActDirect = nullptr; - PadGetInfo = nullptr; - PadGetInfo2 = nullptr; - PadSetPortSetting = nullptr; - PadLddRegisterController = nullptr; - PadLddUnregisterController = nullptr; - PadLddDataInsert = nullptr; - PadLddGetPortNo = nullptr; - PadPeriphGetInfo = nullptr; - PadPeriphGetData = nullptr; - PadInfoPressMode = nullptr; - PadSetPressMode = nullptr; - PadInfoSensorMode = nullptr; - PadSetSensorMode = nullptr; - PadGetRawData = nullptr; - PadDbgLddRegisterController = nullptr; - PadDbgLddSetDataInsertMode = nullptr; - PadDbgPeriphRegisterDevice = nullptr; - PadDbgGetData = nullptr; - - Ps3EmuPlugin::Reset(); - } -}; - -struct PluginsManager -{ - struct PluginInfo - { - wxString path; - wxString name; - u32 type; - }; - - std::vector m_plugins; - std::vector m_pad_plugins; - - void Load(const wxString& path) - { - if(!wxDirExists(path)) return; - - m_plugins.clear(); - wxDir dir(path); - - wxArrayString res; - wxDir::GetAllFiles(path, &res, "*.dll", wxDIR_FILES); - - for(u32 i=0; iAdd(new wxStaticText(parent, wxID_ANY, name), wxSizerFlags().Border(wxRIGHT, 5).Center().Left()); - s_panel->Add(cb = new wxComboBox(parent, wxID_ANY), wxSizerFlags().Center().Right()); - - return s_panel; - } - - void Dialog() - { - wxDialog dial(nullptr, wxID_ANY, "Select plugins...", wxDefaultPosition); - - wxBoxSizer& s_panel(*new wxBoxSizer(wxVERTICAL)); - - wxComboBox* cbox_pad_plugins; - s_panel.Add(GetNewComboBox(&dial, "Pad", cbox_pad_plugins), wxSizerFlags().Border(wxALL, 5).Expand()); - - for(u32 i=0; iAppend(m_plugins[i].name + " (" + wxFileName(m_plugins[i].path).GetName() + ")"); - } - } - - if(cbox_pad_plugins->GetCount()) cbox_pad_plugins->Select(0); - - dial.SetSizerAndFit(&s_panel); - dial.ShowModal(); - } -}; diff --git a/rpcs3/Loader/ELF64.cpp b/rpcs3/Loader/ELF64.cpp index 857b24759a..1736ecf163 100644 --- a/rpcs3/Loader/ELF64.cpp +++ b/rpcs3/Loader/ELF64.cpp @@ -210,31 +210,27 @@ bool ELF64Loader::LoadEhdrData(u64 offset) bool ELF64Loader::LoadPhdrData(u64 offset) { - for(u32 i=0; i max_addr) + if (phdr.p_vaddr + phdr.p_memsz > max_addr) { - max_addr = phdr_arr[i].p_vaddr + phdr_arr[i].p_memsz; + max_addr = phdr.p_vaddr + phdr.p_memsz; } - if(phdr_arr[i].p_vaddr != phdr_arr[i].p_paddr) + if (phdr.p_vaddr != phdr.p_paddr) { - LOG_WARNING - ( - LOADER, - "ElfProgram different load addrs: paddr=0x%8.8x, vaddr=0x%8.8x", - phdr_arr[i].p_paddr, phdr_arr[i].p_vaddr - ); + LOG_WARNING(LOADER, "ElfProgram different load addrs: paddr=0x%8.8x, vaddr=0x%8.8x", + phdr.p_paddr, phdr.p_vaddr); } - if(!Memory.MainMem.IsInMyRange(offset + phdr_arr[i].p_vaddr, phdr_arr[i].p_memsz)) + if(!Memory.MainMem.IsInMyRange(offset + phdr.p_vaddr, phdr.p_memsz)) { #ifdef LOADER_DEBUG LOG_WARNING(LOADER, "Skipping..."); @@ -243,57 +239,48 @@ bool ELF64Loader::LoadPhdrData(u64 offset) continue; } - switch(phdr_arr[i].p_type) + switch(phdr.p_type) { case 0x00000001: //LOAD - if(phdr_arr[i].p_memsz) + if(phdr.p_memsz) { - Memory.MainMem.AllocFixed(offset + phdr_arr[i].p_vaddr, phdr_arr[i].p_memsz); + Memory.MainMem.AllocFixed(offset + phdr.p_vaddr, phdr.p_memsz); - if(phdr_arr[i].p_filesz) + if(phdr.p_filesz) { - elf64_f.Seek(phdr_arr[i].p_offset); - elf64_f.Read(&Memory[offset + phdr_arr[i].p_vaddr], phdr_arr[i].p_filesz); - Emu.GetSFuncManager().StaticAnalyse(&Memory[offset + phdr_arr[i].p_vaddr], phdr_arr[i].p_filesz, phdr_arr[i].p_vaddr); + elf64_f.Seek(phdr.p_offset); + elf64_f.Read(&Memory[offset + phdr.p_vaddr], phdr.p_filesz); + Emu.GetSFuncManager().StaticAnalyse(&Memory[offset + phdr.p_vaddr], phdr.p_filesz, phdr.p_vaddr); } } break; case 0x00000007: //TLS - Emu.SetTLSData(offset + phdr_arr[i].p_vaddr, phdr_arr[i].p_filesz, phdr_arr[i].p_memsz); + Emu.SetTLSData(offset + phdr.p_vaddr, phdr.p_filesz, phdr.p_memsz); break; case 0x60000001: //LOOS+1 { - if(!phdr_arr[i].p_filesz) break; + if(!phdr.p_filesz) + break; - const sys_process_param& proc_param = *(sys_process_param*)&Memory[offset + phdr_arr[i].p_vaddr]; + const sys_process_param& proc_param = *(sys_process_param*)&Memory[offset + phdr.p_vaddr]; - if(re(proc_param.size) < sizeof(sys_process_param)) - { - LOG_WARNING(LOADER, "Bad proc param size! [0x%x : 0x%x]", re(proc_param.size), sizeof(sys_process_param)); + if (proc_param.size < sizeof(sys_process_param)) { + LOG_WARNING(LOADER, "Bad proc param size! [0x%x : 0x%x]", proc_param.size, sizeof(sys_process_param)); } - - if(re(proc_param.magic) != 0x13bcc5f6) - { - LOG_ERROR(LOADER, "Bad magic! [0x%x]", Memory.Reverse32(proc_param.magic)); + if (proc_param.magic != 0x13bcc5f6) { + LOG_ERROR(LOADER, "Bad magic! [0x%x]", proc_param.magic); } - else - { - sys_process_param_info& info = Emu.GetInfo().GetProcParam(); - info.sdk_version = re(proc_param.info.sdk_version); - info.primary_prio = re(proc_param.info.primary_prio); - info.primary_stacksize = re(proc_param.info.primary_stacksize); - info.malloc_pagesize = re(proc_param.info.malloc_pagesize); - info.ppc_seg = re(proc_param.info.ppc_seg); - //info.crash_dump_param_addr = re(proc_param.info.crash_dump_param_addr); + else { #ifdef LOADER_DEBUG - LOG_NOTICE(LOADER, "*** sdk version: 0x%x", info.sdk_version); - LOG_NOTICE(LOADER, "*** primary prio: %d", info.primary_prio); - LOG_NOTICE(LOADER, "*** primary stacksize: 0x%x", info.primary_stacksize); - LOG_NOTICE(LOADER, "*** malloc pagesize: 0x%x", info.malloc_pagesize); - LOG_NOTICE(LOADER, "*** ppc seg: 0x%x", info.ppc_seg); - //LOG_NOTICE(LOADER, "*** crash dump param addr: 0x%x", info.crash_dump_param_addr); + sys_process_param_info& info = Emu.GetInfo().GetProcParam(); + LOG_NOTICE(LOADER, "*** sdk version: 0x%x", info.sdk_version.ToLE()); + LOG_NOTICE(LOADER, "*** primary prio: %d", info.primary_prio.ToLE()); + LOG_NOTICE(LOADER, "*** primary stacksize: 0x%x", info.primary_stacksize.ToLE()); + LOG_NOTICE(LOADER, "*** malloc pagesize: 0x%x", info.malloc_pagesize.ToLE()); + LOG_NOTICE(LOADER, "*** ppc seg: 0x%x", info.ppc_seg.ToLE()); + //LOG_NOTICE(LOADER, "*** crash dump param addr: 0x%x", info.crash_dump_param_addr.ToLE()); #endif } } @@ -301,113 +288,89 @@ bool ELF64Loader::LoadPhdrData(u64 offset) case 0x60000002: //LOOS+2 { - if(!phdr_arr[i].p_filesz) break; + if(!phdr.p_filesz) + break; - sys_proc_prx_param proc_prx_param = *(sys_proc_prx_param*)&Memory[offset + phdr_arr[i].p_vaddr]; + sys_proc_prx_param proc_prx_param = *(sys_proc_prx_param*)&Memory[offset + phdr.p_vaddr]; - proc_prx_param.size = re(proc_prx_param.size); - proc_prx_param.magic = re(proc_prx_param.magic); - proc_prx_param.version = re(proc_prx_param.version); - proc_prx_param.libentstart = re(proc_prx_param.libentstart); - proc_prx_param.libentend = re(proc_prx_param.libentend); - proc_prx_param.libstubstart = re(proc_prx_param.libstubstart); - proc_prx_param.libstubend = re(proc_prx_param.libstubend); - proc_prx_param.ver = re(proc_prx_param.ver); #ifdef LOADER_DEBUG - LOG_NOTICE(LOADER, "*** size: 0x%x", proc_prx_param.size); - LOG_NOTICE(LOADER, "*** magic: 0x%x", proc_prx_param.magic); - LOG_NOTICE(LOADER, "*** version: 0x%x", proc_prx_param.version); - LOG_NOTICE(LOADER, "*** libentstart: 0x%x", proc_prx_param.libentstart); - LOG_NOTICE(LOADER, "*** libentend: 0x%x", proc_prx_param.libentend); - LOG_NOTICE(LOADER, "*** libstubstart: 0x%x", proc_prx_param.libstubstart); - LOG_NOTICE(LOADER, "*** libstubend: 0x%x", proc_prx_param.libstubend); - LOG_NOTICE(LOADER, "*** ver: 0x%x", proc_prx_param.ver); + LOG_NOTICE(LOADER, "*** size: 0x%x", proc_prx_param.size.ToLE()); + LOG_NOTICE(LOADER, "*** magic: 0x%x", proc_prx_param.magic.ToLE()); + LOG_NOTICE(LOADER, "*** version: 0x%x", proc_prx_param.version.ToLE()); + LOG_NOTICE(LOADER, "*** libentstart: 0x%x", proc_prx_param.libentstart.ToLE()); + LOG_NOTICE(LOADER, "*** libentend: 0x%x", proc_prx_param.libentend.ToLE()); + LOG_NOTICE(LOADER, "*** libstubstart: 0x%x", proc_prx_param.libstubstart.ToLE()); + LOG_NOTICE(LOADER, "*** libstubend: 0x%x", proc_prx_param.libstubend.ToLE()); + LOG_NOTICE(LOADER, "*** ver: 0x%x", proc_prx_param.ver.ToLE()); #endif - if(proc_prx_param.magic != 0x1b434cec) - { - LOG_ERROR(LOADER, "Bad magic! (0x%x)", proc_prx_param.magic); + if (proc_prx_param.magic != 0x1b434cec) { + LOG_ERROR(LOADER, "Bad magic! (0x%x)", proc_prx_param.magic.ToLE()); + break; } - else + + for(u32 s=proc_prx_param.libstubstart; sSetLoaded(); - } - else - { - LOG_WARNING(LOADER, "Unknown module '%s'", module_name.c_str()); - } - -#ifdef LOADER_DEBUG - LOG_NOTICE(LOADER, ""); - LOG_NOTICE(LOADER, "*** size: 0x%x", stub.s_size); - LOG_NOTICE(LOADER, "*** version: 0x%x", stub.s_version); - LOG_NOTICE(LOADER, "*** unk0: 0x%x", stub.s_unk0); - LOG_NOTICE(LOADER, "*** unk1: 0x%x", stub.s_unk1); - LOG_NOTICE(LOADER, "*** imports: %d", stub.s_imports); - LOG_NOTICE(LOADER, "*** module name: %s [0x%x]", module_name.c_str(), stub.s_modulename); - LOG_NOTICE(LOADER, "*** nid: 0x%x", stub.s_nid); - LOG_NOTICE(LOADER, "*** text: 0x%x", stub.s_text); -#endif - static const u32 section = 4 * 3; - u64 tbl = Memory.MainMem.AllocAlign(stub.s_imports * 4 * 2); - u64 dst = Memory.MainMem.AllocAlign(stub.s_imports * section); - - for(u32 i=0; iLoad(nid)) - { - LOG_WARNING(LOADER, "Unimplemented function '%s' in '%s' module", SysCalls::GetHLEFuncName(nid).c_str(), module_name.c_str()); - } - } -#ifdef LOADER_DEBUG - LOG_NOTICE(LOADER, "import %d:", i+1); - LOG_NOTICE(LOADER, "*** nid: 0x%x (0x%x)", nid, stub.s_nid + i*4); - LOG_NOTICE(LOADER, "*** text: 0x%x (0x%x)", text, stub.s_text + i*4); -#endif - Memory.Write32(stub.s_text + i*4, tbl + i*8); - - mem32_ptr_t out_tbl(tbl + i*8); - out_tbl += dst + i*section; - out_tbl += Emu.GetModuleManager().GetFuncNumById(nid); - - mem32_ptr_t out_dst(dst + i*section); - out_dst += OR(11, 2, 2, 0); - out_dst += SC(2); - out_dst += BCLR(0x10 | 0x04, 0, 0, 0); - } + const std::string& module_name = Memory.ReadString(stub.s_modulename); + Module* module = Emu.GetModuleManager().GetModuleByName(module_name); + if (module) { + //module->SetLoaded(); } + else { + LOG_WARNING(LOADER, "Unknown module '%s'", module_name.c_str()); + } + #ifdef LOADER_DEBUG - LOG_NOTICE(LOADER, " "); + LOG_NOTICE(LOADER, ""); + LOG_NOTICE(LOADER, "*** size: 0x%x", stub.s_size); + LOG_NOTICE(LOADER, "*** version: 0x%x", stub.s_version.ToLE()); + LOG_NOTICE(LOADER, "*** unk0: 0x%x", stub.s_unk0); + LOG_NOTICE(LOADER, "*** unk1: 0x%x", stub.s_unk1.ToLE()); + LOG_NOTICE(LOADER, "*** imports: %d", stub.s_imports.ToLE()); + LOG_NOTICE(LOADER, "*** module name: %s [0x%x]", module_name.c_str(), stub.s_modulename.ToLE()); + LOG_NOTICE(LOADER, "*** nid: 0x%016llx [0x%x]", Memory.Read64(stub.s_nid), stub.s_nid.ToLE()); + LOG_NOTICE(LOADER, "*** text: 0x%x", stub.s_text.ToLE()); #endif + static const u32 section = 4 * 3; + u64 tbl = Memory.MainMem.AllocAlign(stub.s_imports * 4 * 2); + u64 dst = Memory.MainMem.AllocAlign(stub.s_imports * section); + + for(u32 i=0; iLoad(nid)) { + LOG_WARNING(LOADER, "Unimplemented function '%s' in '%s' module", SysCalls::GetHLEFuncName(nid).c_str(), module_name.c_str()); + } +#ifdef LOADER_DEBUG + LOG_NOTICE(LOADER, "import %d:", i+1); + LOG_NOTICE(LOADER, "*** nid: 0x%x (0x%x)", nid, stub.s_nid + i*4); + LOG_NOTICE(LOADER, "*** text: 0x%x (0x%x)", text, stub.s_text + i*4); +#endif + Memory.Write32(stub.s_text + i*4, tbl + i*8); + + mem32_ptr_t out_tbl(tbl + i*8); + out_tbl += dst + i*section; + out_tbl += Emu.GetModuleManager().GetFuncNumById(nid); + + mem32_ptr_t out_dst(dst + i*section); + out_dst += OR(11, 2, 2, 0); + out_dst += SC(2); + out_dst += BCLR(0x10 | 0x04, 0, 0, 0); + } } +#ifdef LOADER_DEBUG + LOG_NOTICE(LOADER, ""); +#endif } break; } #ifdef LOADER_DEBUG - LOG_NOTICE(LOADER, " "); + LOG_NOTICE(LOADER, ""); #endif } @@ -461,7 +424,7 @@ bool ELF64Loader::LoadShdrData(u64 offset) switch(shdr.sh_type) { case SHT_NOBITS: - //ConLog.Warning("SHT_NOBITS: addr=0x%llx, size=0x%llx", offset + addr, size); + //LOG_WARNING(LOADER, "SHT_NOBITS: addr=0x%llx, size=0x%llx", offset + addr, size); //memset(&Memory[offset + addr], 0, size); break; diff --git a/rpcs3/Loader/Loader.h b/rpcs3/Loader/Loader.h index 9112eddc41..96134a3e34 100644 --- a/rpcs3/Loader/Loader.h +++ b/rpcs3/Loader/Loader.h @@ -125,53 +125,53 @@ const std::string Phdr_TypeToString(const u32 type); struct sys_process_param_info { - u32 sdk_version; - s32 primary_prio; - u32 primary_stacksize; - u32 malloc_pagesize; - u32 ppc_seg; - //u32 crash_dump_param_addr; + be_t sdk_version; + be_t primary_prio; + be_t primary_stacksize; + be_t malloc_pagesize; + be_t ppc_seg; + //be_t crash_dump_param_addr; }; struct sys_process_param { - u32 size; - u32 magic; - u32 version; + be_t size; + be_t magic; + be_t version; sys_process_param_info info; }; struct sys_proc_prx_param { - u32 size; - u32 magic; - u32 version; - u32 pad0; - u32 libentstart; - u32 libentend; - u32 libstubstart; - u32 libstubend; - u16 ver; - u16 pad1; - u32 pad2; + be_t size; + be_t magic; + be_t version; + be_t pad0; + be_t libentstart; + be_t libentend; + be_t libstubstart; + be_t libstubend; + be_t ver; + be_t pad1; + be_t pad2; }; struct Elf64_StubHeader { u8 s_size; // = 0x2c u8 s_unk0; - u16 s_version; // = 0x1 - u16 s_unk1; // = 0x9 // flags? - u16 s_imports; - u32 s_unk2; // = 0x0 - u32 s_unk3; // = 0x0 - u32 s_modulename; - u32 s_nid; - u32 s_text; - u32 s_unk4; // = 0x0 - u32 s_unk5; // = 0x0 - u32 s_unk6; // = 0x0 - u32 s_unk7; // = 0x0 + be_t s_version; // = 0x1 + be_t s_unk1; // = 0x9 // flags? + be_t s_imports; + be_t s_unk2; // = 0x0 + be_t s_unk3; // = 0x0 + be_t s_modulename; + be_t s_nid; + be_t s_text; + be_t s_unk4; // = 0x0 + be_t s_unk5; // = 0x0 + be_t s_unk6; // = 0x0 + be_t s_unk7; // = 0x0 }; class LoaderBase diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index 15ffbd0baa..20178ef443 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -92,9 +92,9 @@ + - @@ -316,9 +316,9 @@ + - diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index a791fc8435..a7d200071c 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -175,7 +175,6 @@ - @@ -224,7 +223,6 @@ - diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index 15476df48d..950a606fba 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -60,9 +60,6 @@ Gui - - Gui - Gui @@ -158,9 +155,6 @@ Gui - - Gui - Gui