1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-23 11:13:19 +01:00

sys_process_get_sdk_version rough implementation

This commit is contained in:
Nekotekina 2014-08-09 20:04:53 +04:00
parent 6f8fb71d15
commit b7ea1f4d44
4 changed files with 53 additions and 3 deletions

View File

@ -10,10 +10,16 @@ SysCallBase sc_p("Process");
sysProcessObjects_t procObjects;
s32 process_getpid()
{
// TODO: get current process id
return 1;
}
s32 sys_process_getpid()
{
sc_p.Log("sys_process_getpid() -> 1");
return 1;
return process_getpid();
}
s32 sys_process_getppid()
@ -228,12 +234,29 @@ s32 sys_process_get_paramsfo(mem8_ptr_t buffer)
return CELL_OK;*/
}
s32 process_get_sdk_version(u32 pid, s32& ver)
{
// TODO: get correct SDK version for selected pid
ver = Emu.m_sdk_version;
return CELL_OK;
}
s32 sys_process_get_sdk_version(u32 pid, mem32_t version)
{
sc_p.Warning("sys_process_get_sdk_version(pid=%d, version_addr=0x%x)", pid, version.GetAddr());
version = 0x360001; // TODO
return CELL_OK;
s32 sdk_ver;
s32 ret = process_get_sdk_version(pid, sdk_ver);
if (ret != CELL_OK)
{
return ret; // error code
}
else
{
version = sdk_ver;
return CELL_OK;
}
}
s32 sys_process_kill(u32 pid)

View File

@ -51,6 +51,10 @@ struct sysProcessObjects_t
// Extern
extern sysProcessObjects_t procObjects;
// Auxiliary functions
s32 process_getpid();
s32 process_get_sdk_version(u32 pid, s32& ver);
// SysCalls
s32 sys_process_getpid();
s32 sys_process_getppid();

View File

@ -16,6 +16,8 @@
#include "Emu/CPU/CPUThreadManager.h" //gui dependency
#include "Loader/PSF.h"
#include "../Crypto/unself.h"
#include <cstdlib>
#include <fstream>
@ -258,6 +260,26 @@ void Emulator::Load()
return;
}
// setting default values
Emu.m_sdk_version = -1; // possibly "unknown" value
// trying to load some info from PARAM.SFO
vfsFile f2("/app_home/PARAM.SFO");
if (f2.IsOpened())
{
PSFLoader psf(f2);
if (psf.Load(false))
{
std::string version = psf.GetString("PS3_SYSTEM_VER");
const size_t dot = version.find('.');
if (dot != std::string::npos)
{
Emu.m_sdk_version = (std::stoi(version, nullptr, 16) << 20) | ((std::stoi(version.substr(dot + 1), nullptr, 16) & 0xffff) << 4) | 1;
}
}
}
LoadPoints(BreakPointsDBName);
CPUThread& thread = GetCPU().AddThread(thread_type);

View File

@ -106,6 +106,7 @@ public:
std::string m_path;
std::string m_elf_path;
std::string m_title_id;
s32 m_sdk_version;
Emulator();