added rtc lib and rwlocks

This commit is contained in:
georgemoralis 2024-06-03 20:26:29 +03:00
parent ea2e4f7b5c
commit b6e65c29fc
8 changed files with 590 additions and 7 deletions

View File

@ -154,6 +154,8 @@ set(SYSTEM_LIBS src/core/libraries/system/commondialog.cpp
src/core/libraries/system/userservice.h src/core/libraries/system/userservice.h
src/core/libraries/app_content/app_content.cpp src/core/libraries/app_content/app_content.cpp
src/core/libraries/app_content/app_content.h src/core/libraries/app_content/app_content.h
src/core/libraries/rtc/rtc.cpp
src/core/libraries/rtc/rtc.h
) )
set(VIDEOOUT_LIB src/core/libraries/videoout/buffer.h set(VIDEOOUT_LIB src/core/libraries/videoout/buffer.h

View File

@ -102,6 +102,7 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
SUB(Lib, Screenshot) \ SUB(Lib, Screenshot) \
SUB(Lib, LibCInternal) \ SUB(Lib, LibCInternal) \
SUB(Lib, AppContent) \ SUB(Lib, AppContent) \
SUB(Lib, Rtc) \
CLS(Frontend) \ CLS(Frontend) \
CLS(Render) \ CLS(Render) \
SUB(Render, Vulkan) \ SUB(Render, Vulkan) \

View File

@ -69,6 +69,7 @@ enum class Class : u8 {
Lib_Screenshot, ///< The LibSceScreenshot implementation Lib_Screenshot, ///< The LibSceScreenshot implementation
Lib_LibCInternal, ///< The LibCInternal implementation. Lib_LibCInternal, ///< The LibCInternal implementation.
Lib_AppContent, ///< The LibSceAppContent implementation. Lib_AppContent, ///< The LibSceAppContent implementation.
Lib_Rtc, ///< The LibSceRtc implementation.
Frontend, ///< Emulator UI Frontend, ///< Emulator UI
Render, ///< Video Core Render, ///< Video Core
Render_Vulkan, ///< Vulkan backend Render_Vulkan, ///< Vulkan backend

View File

@ -5,8 +5,8 @@
#include <thread> #include <thread>
#include "common/assert.h" #include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/thread.h"
#include "common/singleton.h" #include "common/singleton.h"
#include "common/thread.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/libraries/kernel/thread_management.h" #include "core/libraries/kernel/thread_management.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"
@ -34,6 +34,10 @@ void init_pthreads() {
ScePthreadAttr default_attr = nullptr; ScePthreadAttr default_attr = nullptr;
scePthreadAttrInit(&default_attr); scePthreadAttrInit(&default_attr);
g_pthread_cxt->SetDefaultAttr(default_attr); g_pthread_cxt->SetDefaultAttr(default_attr);
// default rwlock init
ScePthreadRwAttr default_rwattr = nullptr;
scePthreadRwlockattrInit(&default_rwattr);
g_pthread_cxt->setDefaultRwattr(default_rwattr);
g_pthread_cxt->SetPthreadPool(new PThreadPool); g_pthread_cxt->SetPthreadPool(new PThreadPool);
} }
@ -1149,6 +1153,133 @@ int PS4_SYSV_ABI posix_pthread_join(ScePthread thread, void** value_ptr) {
return pthread_join(thread->pth, value_ptr); return pthread_join(thread->pth, value_ptr);
} }
/****
* rwlock
*/
int PS4_SYSV_ABI scePthreadRwlockInit(ScePthreadRw* thread, ScePthreadRwAttr* attr,
const char* name) {
*thread = new PthreadRwInternal{};
if (thread == nullptr || *thread == nullptr) {
return SCE_KERNEL_ERROR_EINVAL;
}
if (attr == nullptr || *attr == nullptr) {
attr = g_pthread_cxt->getDefaultRwattr();
}
int result = pthread_rwlock_init(&(*thread)->pth_rwlock, &(*attr)->attr_rwlock);
LOG_INFO(Kernel_Pthread, "scePthreadRwlockInit: result = {}", result);
switch (result) {
case 0:
return SCE_OK;
case ENOMEM:
return SCE_KERNEL_ERROR_ENOMEM;
default:
return SCE_KERNEL_ERROR_EINVAL;
}
}
int PS4_SYSV_ABI scePthreadRwlockRdlock(ScePthreadRw* thread) {
if (thread == nullptr || *thread == nullptr) {
return SCE_KERNEL_ERROR_EINVAL;
}
int result = pthread_rwlock_rdlock(&(*thread)->pth_rwlock);
LOG_INFO(Kernel_Pthread, "scePthreadRwlockRdlock: result = {}", result);
switch (result) {
case 0:
return SCE_OK;
case EBUSY:
return SCE_KERNEL_ERROR_EBUSY;
default:
return SCE_KERNEL_ERROR_EINVAL;
}
}
int PS4_SYSV_ABI scePthreadRwlockWrlock(ScePthreadRw* thread) {
if (thread == nullptr || *thread == nullptr) {
return SCE_KERNEL_ERROR_EINVAL;
}
int result = pthread_rwlock_wrlock(&(*thread)->pth_rwlock);
LOG_INFO(Kernel_Pthread, "scePthreadRwlockWrlock: result = {}", result);
switch (result) {
case 0:
return SCE_OK;
case EBUSY:
return SCE_KERNEL_ERROR_EBUSY;
default:
return SCE_KERNEL_ERROR_EINVAL;
}
}
int PS4_SYSV_ABI scePthreadRwlockUnlock(ScePthreadRw* thread) {
if (thread == nullptr || *thread == nullptr) {
return SCE_KERNEL_ERROR_EINVAL;
}
int result = pthread_rwlock_unlock(&(*thread)->pth_rwlock);
LOG_INFO(Kernel_Pthread, "scePthreadRwlockUnlock: result = {}", result);
switch (result) {
case 0:
return SCE_OK;
case EBUSY:
return SCE_KERNEL_ERROR_EBUSY;
default:
return SCE_KERNEL_ERROR_EINVAL;
}
return 0;
}
int PS4_SYSV_ABI scePthreadRwlockDestroy(ScePthreadRw* thread) {
if (thread == nullptr || *thread == nullptr) {
return SCE_KERNEL_ERROR_EINVAL;
}
int result = pthread_rwlock_destroy(&(*thread)->pth_rwlock);
LOG_INFO(Kernel_Pthread, "scePthreadRwlockDestroy: result = {}", result);
switch (result) {
case 0:
return SCE_OK;
case EBUSY:
return SCE_KERNEL_ERROR_EBUSY;
default:
return SCE_KERNEL_ERROR_EINVAL;
}
}
int PS4_SYSV_ABI scePthreadRwlockattrInit(ScePthreadRwAttr* attr) {
*attr = new PthreadRwLockAttrInernal{};
int result = pthread_rwlockattr_init(&(*attr)->attr_rwlock);
LOG_INFO(Kernel_Pthread, "scePthreadRwlockattrInit: result = {}", result);
switch (result) {
case 0:
return SCE_OK;
case ENOMEM:
return SCE_KERNEL_ERROR_ENOMEM;
default:
return SCE_KERNEL_ERROR_EINVAL;
}
return 0;
}
int PS4_SYSV_ABI posix_pthread_rwlock_rdlock(ScePthreadRw* thread) {
int result = scePthreadRwlockRdlock(thread);
if (result < 0) {
UNREACHABLE();
}
return result;
}
int PS4_SYSV_ABI posix_pthread_rwlock_unlock(ScePthreadRw* thread) {
int result = scePthreadRwlockUnlock(thread);
if (result < 0) {
UNREACHABLE();
}
return result;
}
void pthreadSymbolsRegister(Core::Loader::SymbolsResolver* sym) { void pthreadSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("4+h9EzwKF4I", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrSetschedpolicy); LIB_FUNCTION("4+h9EzwKF4I", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrSetschedpolicy);
LIB_FUNCTION("-Wreprtu0Qs", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrSetdetachstate); LIB_FUNCTION("-Wreprtu0Qs", "libkernel", 1, "libkernel", 1, 1, scePthreadAttrSetdetachstate);
@ -1214,6 +1345,16 @@ void pthreadSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("lLMT9vJAck0", "libScePosix", 1, "libkernel", 1, 1, clock_gettime); LIB_FUNCTION("lLMT9vJAck0", "libScePosix", 1, "libkernel", 1, 1, clock_gettime);
LIB_FUNCTION("yS8U2TGCe1A", "libScePosix", 1, "libkernel", 1, 1, nanosleep); LIB_FUNCTION("yS8U2TGCe1A", "libScePosix", 1, "libkernel", 1, 1, nanosleep);
// Rwlock funstions
LIB_FUNCTION("6ULAa0fq4jA", "libkernel", 1, "libkernel", 1, 1, scePthreadRwlockInit);
LIB_FUNCTION("yOfGg-I1ZII", "libkernel", 1, "libkernel", 1, 1, scePthreadRwlockattrInit);
LIB_FUNCTION("Ox9i0c7L5w0", "libkernel", 1, "libkernel", 1, 1, scePthreadRwlockRdlock);
LIB_FUNCTION("mqdNorrB+gI", "libkernel", 1, "libkernel", 1, 1, scePthreadRwlockWrlock);
LIB_FUNCTION("+L98PIbGttk", "libkernel", 1, "libkernel", 1, 1, scePthreadRwlockUnlock);
LIB_FUNCTION("BB+kb08Tl9A", "libkernel", 1, "libkernel", 1, 1, scePthreadRwlockDestroy);
LIB_FUNCTION("iGjsr1WAtI0", "libkernel", 1, "libkernel", 1, 1, posix_pthread_rwlock_rdlock);
LIB_FUNCTION("EgmLo6EWgso", "libkernel", 1, "libkernel", 1, 1, posix_pthread_rwlock_unlock);
// openorbis weird functions // openorbis weird functions
LIB_FUNCTION("7H0iTOciTLo", "libkernel", 1, "libkernel", 1, 1, posix_pthread_mutex_lock); LIB_FUNCTION("7H0iTOciTLo", "libkernel", 1, "libkernel", 1, 1, posix_pthread_mutex_lock);
LIB_FUNCTION("2Z+PpY6CaJg", "libkernel", 1, "libkernel", 1, 1, posix_pthread_mutex_unlock); LIB_FUNCTION("2Z+PpY6CaJg", "libkernel", 1, "libkernel", 1, 1, posix_pthread_mutex_unlock);

View File

@ -8,8 +8,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <pthread.h> #include <pthread.h>
#include <semaphore.h>
#include <sched.h> #include <sched.h>
#include <semaphore.h>
#include "common/types.h" #include "common/types.h"
namespace Core::Loader { namespace Core::Loader {
@ -24,6 +24,8 @@ struct PthreadMutexInternal;
struct PthreadMutexattrInternal; struct PthreadMutexattrInternal;
struct PthreadCondInternal; struct PthreadCondInternal;
struct PthreadCondAttrInternal; struct PthreadCondAttrInternal;
struct PthreadRwInternal;
struct PthreadRwLockAttrInernal;
using SceKernelSchedParam = ::sched_param; using SceKernelSchedParam = ::sched_param;
using ScePthread = PthreadInternal*; using ScePthread = PthreadInternal*;
@ -32,6 +34,8 @@ using ScePthreadMutex = PthreadMutexInternal*;
using ScePthreadMutexattr = PthreadMutexattrInternal*; using ScePthreadMutexattr = PthreadMutexattrInternal*;
using ScePthreadCond = PthreadCondInternal*; using ScePthreadCond = PthreadCondInternal*;
using ScePthreadCondattr = PthreadCondAttrInternal*; using ScePthreadCondattr = PthreadCondAttrInternal*;
using ScePthreadRw = PthreadRwInternal*;
using ScePthreadRwAttr = PthreadRwLockAttrInernal*;
using pthreadEntryFunc = PS4_SYSV_ABI void* (*)(void*); using pthreadEntryFunc = PS4_SYSV_ABI void* (*)(void*);
@ -85,6 +89,19 @@ struct PthreadCondAttrInternal {
pthread_condattr_t cond_attr; pthread_condattr_t cond_attr;
}; };
struct PthreadRwLockAttrInernal {
u64 initialized = 1;
u8 reserved[64];
pthread_rwlockattr_t attr_rwlock;
int type;
};
struct PthreadRwInternal {
u64 initialized = 1;
pthread_rwlock_t pth_rwlock;
std::string name;
};
class PThreadPool { class PThreadPool {
public: public:
ScePthread Create(); ScePthread Create();
@ -120,12 +137,19 @@ public:
void SetPthreadPool(PThreadPool* pool) { void SetPthreadPool(PThreadPool* pool) {
m_pthread_pool = pool; m_pthread_pool = pool;
} }
ScePthreadRwAttr* getDefaultRwattr() {
return &m_default_Rwattr;
}
void setDefaultRwattr(ScePthreadRwAttr attr) {
m_default_Rwattr = attr;
}
private: private:
ScePthreadMutexattr m_default_mutexattr = nullptr; ScePthreadMutexattr m_default_mutexattr = nullptr;
ScePthreadCondattr m_default_condattr = nullptr; ScePthreadCondattr m_default_condattr = nullptr;
ScePthreadAttr m_default_attr = nullptr; ScePthreadAttr m_default_attr = nullptr;
PThreadPool* m_pthread_pool = nullptr; PThreadPool* m_pthread_pool = nullptr;
ScePthreadRwAttr m_default_Rwattr = nullptr;
}; };
void init_pthreads(); void init_pthreads();
@ -169,5 +193,18 @@ int PS4_SYSV_ABI posix_pthread_mutex_lock(ScePthreadMutex* mutex);
int PS4_SYSV_ABI posix_pthread_mutex_unlock(ScePthreadMutex* mutex); int PS4_SYSV_ABI posix_pthread_mutex_unlock(ScePthreadMutex* mutex);
int PS4_SYSV_ABI posix_pthread_cond_broadcast(ScePthreadCond* cond); int PS4_SYSV_ABI posix_pthread_cond_broadcast(ScePthreadCond* cond);
/****
* rwlock calls
*/
int PS4_SYSV_ABI scePthreadRwlockInit(ScePthreadRw* thread, ScePthreadRwAttr* attr,
const char* name);
int PS4_SYSV_ABI scePthreadRwlockRdlock(ScePthreadRw* thread);
int PS4_SYSV_ABI scePthreadRwlockWrlock(ScePthreadRw* thread);
int PS4_SYSV_ABI scePthreadRwlockUnlock(ScePthreadRw* thread);
int PS4_SYSV_ABI scePthreadRwlockDestroy(ScePthreadRw* thread);
int PS4_SYSV_ABI scePthreadRwlockattrInit(ScePthreadRwAttr* attr);
int PS4_SYSV_ABI posix_pthread_rwlock_rdlock(ScePthreadRw* thread);
int PS4_SYSV_ABI posix_pthread_rwlock_unlock(ScePthreadRw* thread);
void pthreadSymbolsRegister(Core::Loader::SymbolsResolver* sym); void pthreadSymbolsRegister(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::Kernel } // namespace Libraries::Kernel

View File

@ -28,6 +28,7 @@
#include "core/libraries/system/systemservice.h" #include "core/libraries/system/systemservice.h"
#include "core/libraries/system/userservice.h" #include "core/libraries/system/userservice.h"
#include "core/libraries/videoout/video_out.h" #include "core/libraries/videoout/video_out.h"
#include "rtc/rtc.h"
namespace Libraries { namespace Libraries {
@ -61,6 +62,7 @@ void InitHLELibs(Core::Loader::SymbolsResolver* sym) {
Libraries::ScreenShot::RegisterlibSceScreenShot(sym); Libraries::ScreenShot::RegisterlibSceScreenShot(sym);
Libraries::LibcInternal::RegisterlibSceLibcInternal(sym); Libraries::LibcInternal::RegisterlibSceLibcInternal(sym);
Libraries::AppContent::RegisterlibSceAppContent(sym); Libraries::AppContent::RegisterlibSceAppContent(sym);
Libraries::Rtc::RegisterlibSceRtc(sym);
} }
} // namespace Libraries } // namespace Libraries

View File

@ -0,0 +1,322 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
// Generated By moduleGenerator
#include <chrono>
#include "common/logging/log.h"
#include "core/libraries/error_codes.h"
#include "core/libraries/libs.h"
#include "rtc.h"
namespace Libraries::Rtc {
int PS4_SYSV_ABI sceRtcCheckValid() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcCompareTick() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcConvertLocalTimeToUtc() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcConvertUtcToLocalTime() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcEnd() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcFormatRFC2822() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcFormatRFC2822LocalTime() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcFormatRFC3339() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcFormatRFC3339LocalTime() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcFormatRFC3339Precise() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcFormatRFC3339PreciseLocalTime() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcGetCurrentAdNetworkTick() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcGetCurrentClock() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcGetCurrentClockLocalTime(OrbisRtcDateTime* pTime) {
auto now = std::chrono::system_clock::now();
auto now_ns = std::chrono::time_point_cast<std::chrono::nanoseconds>(now);
auto epoch = now_ns.time_since_epoch();
auto micros = std::chrono::duration_cast<std::chrono::microseconds>(epoch);
std::time_t now_time_t = std::chrono::system_clock::to_time_t(now);
std::tm local_tm = *std::localtime(&now_time_t);
pTime->year = local_tm.tm_year + 1900;
pTime->month = local_tm.tm_mon + 1;
pTime->day = local_tm.tm_mday;
pTime->hour = local_tm.tm_hour;
pTime->minute = local_tm.tm_min;
pTime->second = local_tm.tm_sec;
pTime->microsecond = micros.count() % 1000000;
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcGetCurrentDebugNetworkTick() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcGetCurrentNetworkTick() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcGetCurrentRawNetworkTick() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcGetCurrentTick(OrbisRtcTick* pTick) {
pTick->tick = std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::high_resolution_clock::now().time_since_epoch())
.count();
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcGetDayOfWeek(int year, int month, int day) {
std::tm timeinfo = {0};
timeinfo.tm_year = year - 1900;
timeinfo.tm_mon = month - 1;
timeinfo.tm_mday = day;
std::mktime(&timeinfo);
return timeinfo.tm_wday;
}
int PS4_SYSV_ABI sceRtcGetDaysInMonth() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcGetDosTime() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcGetTick() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcGetTickResolution() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcGetTime_t() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcGetWin32FileTime() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcInit() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcIsLeapYear() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcParseDateTime() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcParseRFC3339() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcSetConf() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcSetCurrentAdNetworkTick() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcSetCurrentDebugNetworkTick() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcSetCurrentNetworkTick() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcSetCurrentTick() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcSetDosTime() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcSetTick() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcSetTime_t() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcSetWin32FileTime() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcTickAddDays() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcTickAddHours() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcTickAddMicroseconds() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcTickAddMinutes() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcTickAddMonths() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcTickAddSeconds() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcTickAddTicks() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcTickAddWeeks() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceRtcTickAddYears() {
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
return ORBIS_OK;
}
void RegisterlibSceRtc(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("lPEBYdVX0XQ", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcCheckValid);
LIB_FUNCTION("fNaZ4DbzHAE", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcCompareTick);
LIB_FUNCTION("8Yr143yEnRo", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcConvertLocalTimeToUtc);
LIB_FUNCTION("M1TvFst-jrM", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcConvertUtcToLocalTime);
LIB_FUNCTION("8SljQx6pDP8", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcEnd);
LIB_FUNCTION("eiuobaF-hK4", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcFormatRFC2822);
LIB_FUNCTION("AxHBk3eat04", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcFormatRFC2822LocalTime);
LIB_FUNCTION("WJ3rqFwymew", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcFormatRFC3339);
LIB_FUNCTION("DwuHIlLGW8I", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcFormatRFC3339LocalTime);
LIB_FUNCTION("lja0nNPWojg", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcFormatRFC3339Precise);
LIB_FUNCTION("tOZ6fwwHZOA", "libSceRtc", 1, "libSceRtc", 1, 1,
sceRtcFormatRFC3339PreciseLocalTime);
LIB_FUNCTION("LN3Zcb72Q0c", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcGetCurrentAdNetworkTick);
LIB_FUNCTION("8lfvnRMqwEM", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcGetCurrentClock);
LIB_FUNCTION("ZPD1YOKI+Kw", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcGetCurrentClockLocalTime);
LIB_FUNCTION("Ot1DE3gif84", "libSceRtc", 1, "libSceRtc", 1, 1,
sceRtcGetCurrentDebugNetworkTick);
LIB_FUNCTION("zO9UL3qIINQ", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcGetCurrentNetworkTick);
LIB_FUNCTION("HWxHOdbM-Pg", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcGetCurrentRawNetworkTick);
LIB_FUNCTION("18B2NS1y9UU", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcGetCurrentTick);
LIB_FUNCTION("CyIK-i4XdgQ", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcGetDayOfWeek);
LIB_FUNCTION("3O7Ln8AqJ1o", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcGetDaysInMonth);
LIB_FUNCTION("E7AR4o7Ny7E", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcGetDosTime);
LIB_FUNCTION("8w-H19ip48I", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcGetTick);
LIB_FUNCTION("jMNwqYr4R-k", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcGetTickResolution);
LIB_FUNCTION("BtqmpTRXHgk", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcGetTime_t);
LIB_FUNCTION("jfRO0uTjtzA", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcGetWin32FileTime);
LIB_FUNCTION("LlodCMDbk3o", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcInit);
LIB_FUNCTION("Ug8pCwQvh0c", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcIsLeapYear);
LIB_FUNCTION("NxEI1KByvCI", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcParseDateTime);
LIB_FUNCTION("99bMGglFW3I", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcParseRFC3339);
LIB_FUNCTION("fFLgmNUpChg", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcSetConf);
LIB_FUNCTION("sV2tK+yOhBU", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcSetCurrentAdNetworkTick);
LIB_FUNCTION("VLDUPKmw5L8", "libSceRtc", 1, "libSceRtc", 1, 1,
sceRtcSetCurrentDebugNetworkTick);
LIB_FUNCTION("qhDBtIo+auw", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcSetCurrentNetworkTick);
LIB_FUNCTION("d4fHLCGmY80", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcSetCurrentTick);
LIB_FUNCTION("aYPCd1cChyg", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcSetDosTime);
LIB_FUNCTION("ueega6v3GUw", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcSetTick);
LIB_FUNCTION("bDEVVP4bTjQ", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcSetTime_t);
LIB_FUNCTION("n5JiAJXsbcs", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcSetWin32FileTime);
LIB_FUNCTION("NR1J0N7L2xY", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcTickAddDays);
LIB_FUNCTION("MDc5cd8HfCA", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcTickAddHours);
LIB_FUNCTION("XPIiw58C+GM", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcTickAddMicroseconds);
LIB_FUNCTION("mn-tf4QiFzk", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcTickAddMinutes);
LIB_FUNCTION("CL6y9q-XbuQ", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcTickAddMonths);
LIB_FUNCTION("07O525HgICs", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcTickAddSeconds);
LIB_FUNCTION("AqVMssr52Rc", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcTickAddTicks);
LIB_FUNCTION("gI4t194c2W8", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcTickAddWeeks);
LIB_FUNCTION("-5y2uJ62qS8", "libSceRtc", 1, "libSceRtc", 1, 1, sceRtcTickAddYears);
};
} // namespace Libraries::Rtc

View File

@ -0,0 +1,77 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/types.h"
namespace Core::Loader {
class SymbolsResolver;
}
namespace Libraries::Rtc {
struct OrbisRtcTick {
u64 tick;
};
struct OrbisRtcDateTime {
u16 year;
u16 month;
u16 day;
u16 hour;
u16 minute;
u16 second;
u16 microsecond;
};
int PS4_SYSV_ABI sceRtcCheckValid();
int PS4_SYSV_ABI sceRtcCompareTick();
int PS4_SYSV_ABI sceRtcConvertLocalTimeToUtc();
int PS4_SYSV_ABI sceRtcConvertUtcToLocalTime();
int PS4_SYSV_ABI sceRtcEnd();
int PS4_SYSV_ABI sceRtcFormatRFC2822();
int PS4_SYSV_ABI sceRtcFormatRFC2822LocalTime();
int PS4_SYSV_ABI sceRtcFormatRFC3339();
int PS4_SYSV_ABI sceRtcFormatRFC3339LocalTime();
int PS4_SYSV_ABI sceRtcFormatRFC3339Precise();
int PS4_SYSV_ABI sceRtcFormatRFC3339PreciseLocalTime();
int PS4_SYSV_ABI sceRtcGetCurrentAdNetworkTick();
int PS4_SYSV_ABI sceRtcGetCurrentClock();
int PS4_SYSV_ABI sceRtcGetCurrentClockLocalTime(OrbisRtcDateTime* pTime);
int PS4_SYSV_ABI sceRtcGetCurrentDebugNetworkTick();
int PS4_SYSV_ABI sceRtcGetCurrentNetworkTick();
int PS4_SYSV_ABI sceRtcGetCurrentRawNetworkTick();
int PS4_SYSV_ABI sceRtcGetCurrentTick(OrbisRtcTick* pTick);
int PS4_SYSV_ABI sceRtcGetDayOfWeek(int year, int month, int day);
int PS4_SYSV_ABI sceRtcGetDaysInMonth();
int PS4_SYSV_ABI sceRtcGetDosTime();
int PS4_SYSV_ABI sceRtcGetTick();
int PS4_SYSV_ABI sceRtcGetTickResolution();
int PS4_SYSV_ABI sceRtcGetTime_t();
int PS4_SYSV_ABI sceRtcGetWin32FileTime();
int PS4_SYSV_ABI sceRtcInit();
int PS4_SYSV_ABI sceRtcIsLeapYear();
int PS4_SYSV_ABI sceRtcParseDateTime();
int PS4_SYSV_ABI sceRtcParseRFC3339();
int PS4_SYSV_ABI sceRtcSetConf();
int PS4_SYSV_ABI sceRtcSetCurrentAdNetworkTick();
int PS4_SYSV_ABI sceRtcSetCurrentDebugNetworkTick();
int PS4_SYSV_ABI sceRtcSetCurrentNetworkTick();
int PS4_SYSV_ABI sceRtcSetCurrentTick();
int PS4_SYSV_ABI sceRtcSetDosTime();
int PS4_SYSV_ABI sceRtcSetTick();
int PS4_SYSV_ABI sceRtcSetTime_t();
int PS4_SYSV_ABI sceRtcSetWin32FileTime();
int PS4_SYSV_ABI sceRtcTickAddDays();
int PS4_SYSV_ABI sceRtcTickAddHours();
int PS4_SYSV_ABI sceRtcTickAddMicroseconds();
int PS4_SYSV_ABI sceRtcTickAddMinutes();
int PS4_SYSV_ABI sceRtcTickAddMonths();
int PS4_SYSV_ABI sceRtcTickAddSeconds();
int PS4_SYSV_ABI sceRtcTickAddTicks();
int PS4_SYSV_ABI sceRtcTickAddWeeks();
int PS4_SYSV_ABI sceRtcTickAddYears();
void RegisterlibSceRtc(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::Rtc