1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

Minor sys_prx update

This commit is contained in:
Alexandro Sánchez Bach 2014-08-19 12:14:26 +02:00
parent d3e9e1296c
commit c273c0e42b
5 changed files with 26 additions and 15 deletions

View File

@ -4,6 +4,7 @@
#include "Emu/System.h"
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/FS/vfsFile.h"
#include "Crypto/unself.h"
#include "sys_prx.h"
SysCallBase sys_prx("sys_prx");
@ -13,18 +14,30 @@ s32 sys_prx_load_module(u32 path_addr, u64 flags, mem_ptr_t<sys_prx_load_module_
std::string path = Memory.ReadString(path_addr);
sys_prx.Todo("sys_prx_load_module(path=\"%s\", flags=0x%llx, pOpt=0x%x)", path.c_str(), flags, pOpt.GetAddr());
// Check if the file is SPRX
std::string local_path;
Emu.GetVFS().GetDevice(path, local_path);
if (IsSelf(local_path)) {
if (!DecryptSelf(local_path+".prx", local_path)) {
return CELL_PRX_ERROR_ILLEGAL_LIBRARY;
}
path += ".prx";
}
vfsFile f(path);
if (!f.IsOpened()) {
return CELL_PRX_ERROR_UNKNOWN_MODULE;
}
// Load the PRX into memory
u64 prx_size = f.GetSize();
u32 prx_address = Memory.Alloc(prx_size, 4);
f.Read(Memory.VirtualToRealAddr(prx_address), prx_size);
// Create the PRX object and return its id
sys_prx_t* prx = new sys_prx_t(prx_size, prx_address);
sys_prx_t* prx = new sys_prx_t();
prx->size = f.GetSize();
prx->address = Memory.Alloc(prx->size, 4);
prx->path = path;
// Load the PRX into memory
f.Read(Memory.VirtualToRealAddr(prx->address), prx->size);
u32 id = sys_prx.GetNewId(prx, TYPE_PRX);
return id;
}

View File

@ -51,15 +51,15 @@ struct sys_prx_unload_module_option_t
};
// Auxiliary data types
struct sys_prx_t {
struct sys_prx_t
{
u32 size;
u32 address;
std::string path;
bool isStarted;
sys_prx_t(u32 prx_size, u32 prx_address)
: size(prx_size)
, address(prx_address)
, isStarted(false)
sys_prx_t()
: isStarted(false)
{
}
};

View File

@ -43,7 +43,7 @@ void KernelExplorer::Update()
char name[4096];
m_tree->DeleteAllItems();
auto& root = m_tree->AddRoot("Process, ID = 0x00000001, Total Memory Usage = 0x0C8A9000 (200.7 MB)");
auto& root = m_tree->AddRoot("Process, ID = 0x00000001, Total Memory Usage = 0x???????? (???.? MB)");
// TODO: PPU Threads
// TODO: SPU/RawSPU Threads

View File

@ -1,6 +1,5 @@
#pragma once
#include <wx/listctrl.h>
#include <wx/treectrl.h>
class KernelExplorer : public wxFrame

View File

@ -5,10 +5,9 @@
#include "Emu/Cell/PPUThread.h"
#include "Emu/SysCalls/SC_FUNC.h"
#include "Emu/SysCalls/Modules.h"
#include "ELF64.h"
#include "Emu/Cell/PPUInstrTable.h"
#include "Emu/System.h"
#include "Emu/SysCalls/ModuleManager.h"
#include "ELF64.h"
using namespace PPU_instr;