mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-20 11:35:45 +00:00
sceKernelClockGettime,sceUserServiceGetInitialUser functions
This commit is contained in:
parent
b6db2ec20c
commit
b7c7934e2a
4 changed files with 56 additions and 14 deletions
|
@ -1,31 +1,59 @@
|
|||
#include "common/timer.h"
|
||||
#include "core/hle/libraries/libkernel/time_management.h"
|
||||
|
||||
#include <core/hle/error_codes.h>
|
||||
#include <pthread_time.h>
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/log.h"
|
||||
#include "common/timer.h"
|
||||
#include "core/hle/libraries/libs.h"
|
||||
#include "emuTimer.h"
|
||||
|
||||
namespace Core::Libraries::LibKernel {
|
||||
|
||||
constexpr bool log_time_file = true; // disable it to disable logging
|
||||
|
||||
u64 PS4_SYSV_ABI sceKernelGetProcessTime() {
|
||||
return static_cast<u64>(Emulator::emuTimer::getTimeMsec() * 1000.0); // return time in microseconds
|
||||
}
|
||||
|
||||
u64 PS4_SYSV_ABI sceKernelGetProcessTimeCounter() {
|
||||
return Emulator::emuTimer::getTimeCounter();
|
||||
}
|
||||
u64 PS4_SYSV_ABI sceKernelGetProcessTimeCounter() { return Emulator::emuTimer::getTimeCounter(); }
|
||||
|
||||
u64 PS4_SYSV_ABI sceKernelGetProcessTimeCounterFrequency() {
|
||||
return Emulator::emuTimer::getTimeFrequency();
|
||||
}
|
||||
u64 PS4_SYSV_ABI sceKernelGetProcessTimeCounterFrequency() { return Emulator::emuTimer::getTimeFrequency(); }
|
||||
|
||||
u64 PS4_SYSV_ABI sceKernelReadTsc() {
|
||||
return Common::Timer::getQueryPerformanceCounter();
|
||||
u64 PS4_SYSV_ABI sceKernelReadTsc() { return Common::Timer::getQueryPerformanceCounter(); }
|
||||
|
||||
int PS4_SYSV_ABI sceKernelClockGettime(s32 clock_id, SceKernelTimespec* tp) {
|
||||
PRINT_FUNCTION_NAME();
|
||||
|
||||
if (tp == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EFAULT;
|
||||
}
|
||||
|
||||
clockid_t pclock_id = CLOCK_REALTIME;
|
||||
switch (clock_id) {
|
||||
case 0: pclock_id = CLOCK_REALTIME; break;
|
||||
case 13:
|
||||
case 4: pclock_id = CLOCK_MONOTONIC; break;
|
||||
default: LOG_TRACE_IF(log_time_file, "sceKernelClockGettime unknown clock_id: {}\n", clock_id); std::exit(0);
|
||||
}
|
||||
|
||||
timespec t{};
|
||||
|
||||
int result = clock_gettime(pclock_id, &t);
|
||||
|
||||
tp->tv_sec = t.tv_sec;
|
||||
tp->tv_nsec = t.tv_nsec;
|
||||
|
||||
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
void timeSymbolsRegister(Loader::SymbolsResolver* sym) {
|
||||
LIB_FUNCTION("4J2sUJmuHZQ", "libkernel", 1, "libkernel", 1, 1, sceKernelGetProcessTime);
|
||||
LIB_FUNCTION("4J2sUJmuHZQ", "libkernel", 1, "libkernel", 1, 1, sceKernelGetProcessTime);
|
||||
LIB_FUNCTION("fgxnMeTNUtY", "libkernel", 1, "libkernel", 1, 1, sceKernelGetProcessTimeCounter);
|
||||
LIB_FUNCTION("BNowx2l588E", "libkernel", 1, "libkernel", 1, 1, sceKernelGetProcessTimeCounterFrequency);
|
||||
LIB_FUNCTION("-2IRUCO--PM", "libkernel", 1, "libkernel", 1, 1, sceKernelReadTsc);
|
||||
LIB_FUNCTION("QBi7HCK03hw", "libkernel", 1, "libkernel", 1, 1, sceKernelClockGettime);
|
||||
}
|
||||
|
||||
} // namespace Core::Libraries::LibKernel
|
||||
|
|
|
@ -5,14 +5,19 @@
|
|||
namespace Core::Loader {
|
||||
class SymbolsResolver;
|
||||
}
|
||||
|
||||
namespace Core::Libraries::LibKernel {
|
||||
|
||||
struct SceKernelTimespec {
|
||||
s64 tv_sec;
|
||||
s64 tv_nsec;
|
||||
};
|
||||
|
||||
u64 PS4_SYSV_ABI sceKernelGetProcessTime();
|
||||
u64 PS4_SYSV_ABI sceKernelGetProcessTimeCounter();
|
||||
u64 PS4_SYSV_ABI sceKernelGetProcessTimeCounterFrequency();
|
||||
u64 PS4_SYSV_ABI sceKernelReadTsc();
|
||||
int PS4_SYSV_ABI sceKernelClockGettime(s32 clock_id, SceKernelTimespec* tp);
|
||||
|
||||
void timeSymbolsRegister(Loader::SymbolsResolver* sym);
|
||||
|
||||
} // namespace Core::Libraries::LibKernel
|
||||
} // namespace Core::Libraries::LibKernel
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "common/log.h"
|
||||
#include "core/hle/libraries/libuserservice/libuserservice.h"
|
||||
|
||||
#include "common/log.h"
|
||||
#include "core/hle/error_codes.h"
|
||||
#include "core/hle/libraries/libs.h"
|
||||
|
||||
|
@ -20,9 +21,16 @@ s32 PS4_SYSV_ABI sceUserServiceGetLoginUserIdList(SceUserServiceLoginUserIdList*
|
|||
return SCE_OK;
|
||||
}
|
||||
|
||||
s32 sceUserServiceGetInitialUser(SceUserServiceUserId* userId) {
|
||||
PRINT_DUMMY_FUNCTION_NAME();
|
||||
*userId = 1; // first player only
|
||||
return SCE_OK;
|
||||
}
|
||||
|
||||
void userServiceSymbolsRegister(Loader::SymbolsResolver* sym) {
|
||||
LIB_FUNCTION("j3YMu1MVNNo", "libSceUserService", 1, "libSceUserService", 1, 1, sceUserServiceInitialize);
|
||||
LIB_FUNCTION("fPhymKNvK-A", "libSceUserService", 1, "libSceUserService", 1, 1, sceUserServiceGetLoginUserIdList);
|
||||
LIB_FUNCTION("CdWp0oHWGr0", "libSceUserService", 1, "libSceUserService", 1, 1, sceUserServiceGetInitialUser);
|
||||
}
|
||||
|
||||
} // namespace Core::Libraries::LibUserService
|
||||
} // namespace Core::Libraries::LibUserService
|
||||
|
|
|
@ -20,6 +20,7 @@ struct SceUserServiceLoginUserIdList {
|
|||
|
||||
s32 PS4_SYSV_ABI sceUserServiceInitialize(const SceUserServiceInitializeParams* initParams);
|
||||
s32 PS4_SYSV_ABI sceUserServiceGetLoginUserIdList(SceUserServiceLoginUserIdList* userIdList);
|
||||
s32 sceUserServiceGetInitialUser(SceUserServiceUserId* userId);
|
||||
|
||||
void userServiceSymbolsRegister(Loader::SymbolsResolver* sym);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue