mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-23 03:45:00 +00:00
Added LibPngDec
(tested with Metal Slug 3, Risk of Rain, Deadbolt and Nidhogg)
This commit is contained in:
parent
31bd502764
commit
080ec3e23e
9 changed files with 336 additions and 12 deletions
|
@ -679,7 +679,7 @@ int PS4_SYSV_ABI scePthreadCondTimedwait(ScePthreadCond* cond, ScePthreadMutex*
|
|||
time.tv_nsec = ((usec % 1000000) * 1000);
|
||||
int result = pthread_cond_timedwait(&(*cond)->cond, &(*mutex)->pth_mutex, &time);
|
||||
|
||||
LOG_INFO(Kernel_Pthread, "scePthreadCondTimedwait, result={}", result);
|
||||
// LOG_INFO(Kernel_Pthread, "scePthreadCondTimedwait, result={}", result);
|
||||
|
||||
switch (result) {
|
||||
case 0:
|
||||
|
@ -1018,7 +1018,7 @@ int PS4_SYSV_ABI scePthreadCondSignal(ScePthreadCond* cond) {
|
|||
|
||||
int result = pthread_cond_signal(&(*cond)->cond);
|
||||
|
||||
LOG_INFO(Kernel_Pthread, "scePthreadCondSignal, result={}", result);
|
||||
// LOG_INFO(Kernel_Pthread, "scePthreadCondSignal, result={}", result);
|
||||
|
||||
switch (result) {
|
||||
case 0:
|
||||
|
@ -1170,7 +1170,19 @@ int PS4_SYSV_ABI posix_pthread_create_name_np(ScePthread* thread, const ScePthre
|
|||
int PS4_SYSV_ABI scePthreadOnce(int* once_control, void (*init_routine)(void)) {
|
||||
return pthread_once(reinterpret_cast<pthread_once_t*>(once_control), init_routine);
|
||||
}
|
||||
int PS4_SYSV_ABI posix_pthread_create(ScePthread* thread, const ScePthreadAttr* attr,
|
||||
pthreadEntryFunc start_routine, void* arg) {
|
||||
LOG_INFO(Kernel_Pthread, "posix pthread_create redirect to scePthreadCreate");
|
||||
|
||||
int result = scePthreadCreate(thread, attr, start_routine, arg, "");
|
||||
if (result != 0) {
|
||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
return rt;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
void pthreadSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
|
||||
LIB_FUNCTION("4+h9EzwKF4I", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrSetschedpolicy);
|
||||
LIB_FUNCTION("-Wreprtu0Qs", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrSetdetachstate);
|
||||
|
@ -1192,7 +1204,8 @@ void pthreadSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
|
|||
LIB_FUNCTION("x1X76arYMxU", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrGet);
|
||||
LIB_FUNCTION("UTXzJbWhhTE", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrSetstacksize);
|
||||
LIB_FUNCTION("vNe1w4diLCs", "libkernel", 1, "libkernel", 1, 1, __tls_get_addr);
|
||||
|
||||
LIB_FUNCTION("OxhIB8LB-PQ", "libkernel", 1, "libkernel", 1, 1, posix_pthread_create);
|
||||
LIB_FUNCTION("OxhIB8LB-PQ", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_create);
|
||||
LIB_FUNCTION("bt3CTBKmGyI", "libkernel", 1, "libkernel", 1, 1, scePthreadSetaffinity);
|
||||
LIB_FUNCTION("6UgtwV+0zb4", "libkernel", 1, "libkernel", 1, 1, scePthreadCreate);
|
||||
LIB_FUNCTION("T72hz6ffq08", "libkernel", 1, "libkernel", 1, 1, scePthreadYield);
|
||||
|
|
|
@ -63,9 +63,7 @@ int PS4_SYSV_ABI sceKernelUsleep(u32 microseconds) {
|
|||
}
|
||||
|
||||
int PS4_SYSV_ABI posix_usleep(u32 microseconds) {
|
||||
ASSERT(microseconds >= 1000);
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(microseconds));
|
||||
return 0;
|
||||
return sceKernelUsleep(microseconds);
|
||||
}
|
||||
|
||||
u32 PS4_SYSV_ABI sceKernelSleep(u32 seconds) {
|
||||
|
@ -79,11 +77,15 @@ int PS4_SYSV_ABI sceKernelClockGettime(s32 clock_id, OrbisKernelTimespec* tp) {
|
|||
}
|
||||
clockid_t pclock_id = CLOCK_REALTIME;
|
||||
switch (clock_id) {
|
||||
case 0:
|
||||
case ORBIS_CLOCK_REALTIME:
|
||||
case ORBIS_CLOCK_REALTIME_PRECISE:
|
||||
case ORBIS_CLOCK_REALTIME_FAST:
|
||||
pclock_id = CLOCK_REALTIME;
|
||||
break;
|
||||
case 13:
|
||||
case 4:
|
||||
case ORBIS_CLOCK_SECOND:
|
||||
case ORBIS_CLOCK_MONOTONIC:
|
||||
case ORBIS_CLOCK_MONOTONIC_PRECISE:
|
||||
case ORBIS_CLOCK_MONOTONIC_FAST:
|
||||
pclock_id = CLOCK_MONOTONIC;
|
||||
break;
|
||||
default:
|
||||
|
@ -100,7 +102,7 @@ int PS4_SYSV_ABI sceKernelClockGettime(s32 clock_id, OrbisKernelTimespec* tp) {
|
|||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI clock_gettime(s32 clock_id, OrbisKernelTimespec* time) {
|
||||
int PS4_SYSV_ABI posix_clock_gettime(s32 clock_id, OrbisKernelTimespec* time) {
|
||||
int result = sceKernelClockGettime(clock_id, time);
|
||||
if (result < 0) {
|
||||
UNREACHABLE(); // TODO return posix error code
|
||||
|
@ -151,6 +153,37 @@ int PS4_SYSV_ABI gettimeofday(OrbisKernelTimeval* tp, OrbisKernelTimezone* tz) {
|
|||
return sceKernelGettimeofday(tp);
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI posix_clock_getres(u32 clock_id, OrbisKernelTimespec* res) {
|
||||
if (res == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EFAULT;
|
||||
}
|
||||
clockid_t pclock_id = CLOCK_REALTIME;
|
||||
switch (clock_id) {
|
||||
case ORBIS_CLOCK_REALTIME:
|
||||
case ORBIS_CLOCK_REALTIME_PRECISE:
|
||||
case ORBIS_CLOCK_REALTIME_FAST:
|
||||
pclock_id = CLOCK_REALTIME;
|
||||
break;
|
||||
case ORBIS_CLOCK_SECOND:
|
||||
case ORBIS_CLOCK_MONOTONIC:
|
||||
case ORBIS_CLOCK_MONOTONIC_PRECISE:
|
||||
case ORBIS_CLOCK_MONOTONIC_FAST:
|
||||
pclock_id = CLOCK_MONOTONIC;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
timespec t{};
|
||||
int result = clock_getres(pclock_id, &t);
|
||||
res->tv_sec = t.tv_sec;
|
||||
res->tv_nsec = t.tv_nsec;
|
||||
if (result == 0) {
|
||||
return SCE_OK;
|
||||
}
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
void timeSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
|
||||
clock = std::make_unique<Common::NativeClock>();
|
||||
initial_ptc = clock->GetUptime();
|
||||
|
@ -163,6 +196,7 @@ void timeSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
|
|||
LIB_FUNCTION("ejekcaNQNq0", "libkernel", 1, "libkernel", 1, 1, sceKernelGettimeofday);
|
||||
LIB_FUNCTION("n88vx3C5nW8", "libkernel", 1, "libkernel", 1, 1, gettimeofday);
|
||||
LIB_FUNCTION("n88vx3C5nW8", "libScePosix", 1, "libkernel", 1, 1, gettimeofday);
|
||||
LIB_FUNCTION("QvsZxomvUHs", "libkernel", 1, "libkernel", 1, 1, sceKernelNanosleep);
|
||||
LIB_FUNCTION("1jfXLRVzisc", "libkernel", 1, "libkernel", 1, 1, sceKernelUsleep);
|
||||
LIB_FUNCTION("QcteRwbsnV0", "libScePosix", 1, "libkernel", 1, 1, posix_usleep);
|
||||
LIB_FUNCTION("-ZR+hG7aDHw", "libkernel", 1, "libkernel", 1, 1, sceKernelSleep);
|
||||
|
@ -170,8 +204,9 @@ void timeSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
|
|||
LIB_FUNCTION("yS8U2TGCe1A", "libkernel", 1, "libkernel", 1, 1, posix_nanosleep);
|
||||
LIB_FUNCTION("yS8U2TGCe1A", "libScePosix", 1, "libkernel", 1, 1, posix_nanosleep);
|
||||
LIB_FUNCTION("QBi7HCK03hw", "libkernel", 1, "libkernel", 1, 1, sceKernelClockGettime);
|
||||
LIB_FUNCTION("lLMT9vJAck0", "libkernel", 1, "libkernel", 1, 1, clock_gettime);
|
||||
LIB_FUNCTION("lLMT9vJAck0", "libScePosix", 1, "libkernel", 1, 1, clock_gettime);
|
||||
LIB_FUNCTION("lLMT9vJAck0", "libkernel", 1, "libkernel", 1, 1, posix_clock_gettime);
|
||||
LIB_FUNCTION("lLMT9vJAck0", "libScePosix", 1, "libkernel", 1, 1, posix_clock_gettime);
|
||||
LIB_FUNCTION("smIj7eqzZE8", "libScePosix", 1, "libkernel", 1, 1, posix_clock_getres);
|
||||
}
|
||||
|
||||
} // namespace Libraries::Kernel
|
||||
|
|
|
@ -26,6 +26,25 @@ struct OrbisKernelTimespec {
|
|||
s64 tv_nsec;
|
||||
};
|
||||
|
||||
constexpr int ORBIS_CLOCK_REALTIME = 0;
|
||||
constexpr int ORBIS_CLOCK_VIRTUAL = 1;
|
||||
constexpr int ORBIS_CLOCK_PROF = 2;
|
||||
constexpr int ORBIS_CLOCK_MONOTONIC = 4;
|
||||
constexpr int ORBIS_CLOCK_UPTIME = 5;
|
||||
constexpr int ORBIS_CLOCK_UPTIME_PRECISE = 7;
|
||||
constexpr int ORBIS_CLOCK_UPTIME_FAST = 8;
|
||||
constexpr int ORBIS_CLOCK_REALTIME_PRECISE = 9;
|
||||
constexpr int ORBIS_CLOCK_REALTIME_FAST = 10;
|
||||
constexpr int ORBIS_CLOCK_MONOTONIC_PRECISE = 11;
|
||||
constexpr int ORBIS_CLOCK_MONOTONIC_FAST = 12;
|
||||
constexpr int ORBIS_CLOCK_SECOND = 13;
|
||||
constexpr int ORBIS_CLOCK_THREAD_CPUTIME_ID = 14;
|
||||
constexpr int ORBIS_CLOCK_PROCTIME = 15;
|
||||
constexpr int ORBIS_CLOCK_EXT_NETWORK = 16;
|
||||
constexpr int ORBIS_CLOCK_EXT_DEBUG_NETWORK = 17;
|
||||
constexpr int ORBIS_CLOCK_EXT_AD_NETWORK = 18;
|
||||
constexpr int ORBIS_CLOCK_EXT_RAW_NETWORK = 19;
|
||||
|
||||
u64 PS4_SYSV_ABI sceKernelGetTscFrequency();
|
||||
u64 PS4_SYSV_ABI sceKernelGetProcessTime();
|
||||
u64 PS4_SYSV_ABI sceKernelGetProcessTimeCounter();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue