mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 10:56:58 +02:00
libs: simplify ABI registration facades
This commit is contained in:
@@ -2644,7 +2644,7 @@ static int KYTY_SYSV_ABI AmmWaitCommandBufferCompletion(uint32_t submission_id)
|
||||
|
||||
} // namespace Ampr
|
||||
|
||||
LIB_DEFINE(InitAmpr_1_Ampr) {
|
||||
LIB_DEFINE(InitAmpr_1) {
|
||||
LIB_FUNC("8aI7R7WaOlc", Ampr::CommandBufferConstructor);
|
||||
LIB_FUNC("a8uLzYY--tM", Ampr::AprCommandBufferConstructor);
|
||||
LIB_FUNC("Qs1xtplKo0U", Ampr::AprCommandBufferDestructor);
|
||||
@@ -2742,8 +2742,4 @@ LIB_DEFINE(InitAmpr_1_Ampr) {
|
||||
|
||||
} // namespace LibAmpr
|
||||
|
||||
LIB_DEFINE(InitAmpr_1) {
|
||||
LibAmpr::InitAmpr_1_Ampr(s);
|
||||
}
|
||||
|
||||
} // namespace Libs
|
||||
|
||||
+3
-1
@@ -808,7 +808,7 @@ LIB_DEFINE(InitLibcInternal_1) {
|
||||
|
||||
} // namespace LibcInternal
|
||||
|
||||
LIB_USING(LibC);
|
||||
namespace LibC {
|
||||
|
||||
LIB_DEFINE(InitLibC_1) {
|
||||
LibcInternal::InitLibcInternal_1(s);
|
||||
@@ -835,4 +835,6 @@ LIB_DEFINE(InitLibC_1) {
|
||||
LIB_FUNC("DiGVep5yB5w", LibC::std_execute_once);
|
||||
}
|
||||
|
||||
} // namespace LibC
|
||||
|
||||
} // namespace Libs
|
||||
|
||||
@@ -16,14 +16,10 @@ static KYTY_SYSV_ABI uint32_t RazorCpuIsCapturing() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
LIB_DEFINE(InitLibRazorCpu_1) {
|
||||
LIB_DEFINE(InitRazorCpu_1) {
|
||||
LIB_FUNC("EboejOQvLL4", LibRazorCpu::RazorCpuIsCapturing);
|
||||
}
|
||||
|
||||
} // namespace LibRazorCpu
|
||||
|
||||
LIB_DEFINE(InitDebug_1) {
|
||||
LibRazorCpu::InitLibRazorCpu_1(s);
|
||||
}
|
||||
|
||||
} // namespace Libs
|
||||
|
||||
+15
-19
@@ -512,10 +512,6 @@ bool KernelIsDispatchingSignalOnCurrentThread() {
|
||||
return g_dispatching_signal_handler;
|
||||
}
|
||||
|
||||
static void QueuePendingSignal(Pthread thread, int signum) {
|
||||
PthreadQueuePendingSignal(thread, signum);
|
||||
}
|
||||
|
||||
#if KYTY_PLATFORM != KYTY_PLATFORM_WINDOWS
|
||||
static void WaitForSignalDispatch(Pthread thread, int signum) {
|
||||
constexpr auto DISPATCH_WAIT_STEP = std::chrono::microseconds(1000);
|
||||
@@ -529,10 +525,6 @@ static void WaitForSignalDispatch(Pthread thread, int signum) {
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool TakePendingSignal(Pthread thread, int signum) {
|
||||
return PthreadTakePendingSignal(thread, signum);
|
||||
}
|
||||
|
||||
struct SignalMcontext {
|
||||
uint64_t mc_onstack;
|
||||
uint64_t mc_rdi;
|
||||
@@ -985,7 +977,7 @@ static void HostSignalDispatchHandler(int /*host_signal*/, siginfo_t* /*info*/,
|
||||
auto* host_ctx = static_cast<ucontext_t*>(native_context);
|
||||
|
||||
for (int signum = 0; signum < static_cast<int>(std::size(g_exception_handlers)); signum++) {
|
||||
if (!TakePendingSignal(current, signum)) {
|
||||
if (!PthreadTakePendingSignal(current, signum)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1046,7 +1038,7 @@ static NtQueueApcThreadExFunc GetNtQueueApcThreadEx() {
|
||||
static void SignalApcHandler(void* arg1, void* arg2, void* /*arg3*/, PCONTEXT context) {
|
||||
auto* thread = static_cast<Pthread>(arg1);
|
||||
const auto signum = static_cast<int>(reinterpret_cast<intptr_t>(arg2));
|
||||
if (!TakePendingSignal(thread, signum)) {
|
||||
if (!PthreadTakePendingSignal(thread, signum)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1081,7 +1073,7 @@ void KernelDispatchPendingSignalForCurrentThread() {
|
||||
}
|
||||
|
||||
for (int signum = 0; signum < static_cast<int>(std::size(g_exception_handlers)); signum++) {
|
||||
if (!TakePendingSignal(current, signum)) {
|
||||
if (!PthreadTakePendingSignal(current, signum)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1159,7 +1151,7 @@ static int KYTY_SYSV_ABI KernelRaiseException(Pthread thread, int signum) {
|
||||
return KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
QueuePendingSignal(thread, signum);
|
||||
PthreadQueuePendingSignal(thread, signum);
|
||||
KytyUserApcOption option {};
|
||||
option.UserApcFlags = KytyQueueUserApcFlagsSpecialUserApc;
|
||||
|
||||
@@ -1168,7 +1160,7 @@ static int KYTY_SYSV_ABI KernelRaiseException(Pthread thread, int signum) {
|
||||
reinterpret_cast<void*>(static_cast<intptr_t>(signum)), nullptr);
|
||||
|
||||
if (status != 0) {
|
||||
TakePendingSignal(thread, signum);
|
||||
PthreadTakePendingSignal(thread, signum);
|
||||
CloseHandle(target_thread);
|
||||
LOGF("\t NtQueueApcThreadEx failed: target_os_thread=%" PRIu64 ", status=0x%016" PRIx64
|
||||
"\n",
|
||||
@@ -1194,9 +1186,9 @@ static int KYTY_SYSV_ABI KernelRaiseException(Pthread thread, int signum) {
|
||||
return KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
QueuePendingSignal(thread, signum);
|
||||
PthreadQueuePendingSignal(thread, signum);
|
||||
if (!PthreadKillHost(thread, SignalDispatchHostSignal())) {
|
||||
TakePendingSignal(thread, signum);
|
||||
PthreadTakePendingSignal(thread, signum);
|
||||
LOGF("\t pthread_kill failed for target thread\n");
|
||||
return KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
@@ -3028,9 +3020,9 @@ namespace EventQueue = LibKernel::EventQueue;
|
||||
namespace EventFlag = LibKernel::EventFlag;
|
||||
namespace Semaphore = LibKernel::Semaphore;
|
||||
|
||||
LIB_DEFINE(InitFiber_1) {
|
||||
LIB_USING(Fiber);
|
||||
namespace Fiber {
|
||||
|
||||
LIB_DEFINE(InitFiber_1) {
|
||||
LIB_FUNC("hVYD7Ou2pCQ", Fiber::FiberInitialize);
|
||||
LIB_FUNC("7+OJIpko9RY", Fiber::FiberInitializeInternal);
|
||||
LIB_FUNC("asjUJJ+aa8s", Fiber::FiberOptParamInitialize);
|
||||
@@ -3048,13 +3040,17 @@ LIB_DEFINE(InitFiber_1) {
|
||||
LIB_FUNC("0dy4JtMUcMQ", Fiber::FiberGetThreadFramePointerAddress);
|
||||
}
|
||||
|
||||
LIB_DEFINE(InitCoredump_1) {
|
||||
LIB_USING(Coredump);
|
||||
} // namespace Fiber
|
||||
|
||||
namespace Coredump {
|
||||
|
||||
LIB_DEFINE(InitCoredump_1) {
|
||||
LIB_FUNC("8zLSfEfW5AU", Coredump::sceCoredumpRegisterCoredumpHandler);
|
||||
LIB_FUNC("fFkhOgztiCA", Coredump::sceCoredumpUnregisterCoredumpHandler);
|
||||
}
|
||||
|
||||
} // namespace Coredump
|
||||
|
||||
LIB_DEFINE(InitLibKernel_1_FS) {
|
||||
LIB_FUNC("1G3lF1Gg1k8", FileSystem::KernelOpen);
|
||||
LIB_FUNC("UK2Tl2DWUns", FileSystem::KernelClose);
|
||||
|
||||
+6
-10
@@ -78,7 +78,7 @@ static int KYTY_SYSV_ABI RtcCheckValid(const RtcDateTime* time) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int RtcGetDaysInMonth(int year, int month) {
|
||||
static int GetDaysInMonth(int year, int month) {
|
||||
if (year <= 0 || year > 9999) {
|
||||
return RTC_ERROR_INVALID_YEAR;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ static int KYTY_SYSV_ABI RtcIsLeapYear(int year) {
|
||||
static int KYTY_SYSV_ABI RtcGetDayOfWeek(int year, int month, int day) {
|
||||
PRINT_NAME();
|
||||
|
||||
const auto days = RtcGetDaysInMonth(year, month);
|
||||
const auto days = GetDaysInMonth(year, month);
|
||||
if (days < 0) {
|
||||
return days;
|
||||
}
|
||||
@@ -118,10 +118,10 @@ static int KYTY_SYSV_ABI RtcGetDayOfWeek(int year, int month, int day) {
|
||||
return (dow == 7 ? 0 : dow);
|
||||
}
|
||||
|
||||
static int KYTY_SYSV_ABI RtcGetDaysInMonthExport(int year, int month) {
|
||||
static int KYTY_SYSV_ABI RtcGetDaysInMonth(int year, int month) {
|
||||
PRINT_NAME();
|
||||
|
||||
return RtcGetDaysInMonth(year, month);
|
||||
return GetDaysInMonth(year, month);
|
||||
}
|
||||
|
||||
static int KYTY_SYSV_ABI RtcGetTickResolution() {
|
||||
@@ -549,7 +549,7 @@ static int KYTY_SYSV_ABI RtcTickAddWeeks(RtcTick* dst, const RtcTick* src, int32
|
||||
|
||||
} // namespace Rtc
|
||||
|
||||
LIB_DEFINE(InitRtc_1_Rtc) {
|
||||
LIB_DEFINE(InitRtc_1) {
|
||||
LIB_FUNC("lPEBYdVX0XQ", Rtc::RtcCheckValid);
|
||||
LIB_FUNC("8Yr143yEnRo", Rtc::RtcConvertLocalTimeToUtc);
|
||||
LIB_FUNC("M1TvFst-jrM", Rtc::RtcConvertUtcToLocalTime);
|
||||
@@ -560,7 +560,7 @@ LIB_DEFINE(InitRtc_1_Rtc) {
|
||||
LIB_FUNC("zO9UL3qIINQ", Rtc::RtcGetCurrentNetworkTick);
|
||||
LIB_FUNC("CyIK-i4XdgQ", Rtc::RtcGetDayOfWeek);
|
||||
LIB_FUNC("Ug8pCwQvh0c", Rtc::RtcIsLeapYear);
|
||||
LIB_FUNC("3O7Ln8AqJ1o", Rtc::RtcGetDaysInMonthExport);
|
||||
LIB_FUNC("3O7Ln8AqJ1o", Rtc::RtcGetDaysInMonth);
|
||||
LIB_FUNC("8w-H19ip48I", Rtc::RtcGetTick);
|
||||
LIB_FUNC("jMNwqYr4R-k", Rtc::RtcGetTickResolution);
|
||||
LIB_FUNC("BtqmpTRXHgk", Rtc::RtcGetTime_t);
|
||||
@@ -580,8 +580,4 @@ LIB_DEFINE(InitRtc_1_Rtc) {
|
||||
|
||||
} // namespace LibRtc
|
||||
|
||||
LIB_DEFINE(InitRtc_1) {
|
||||
LibRtc::InitRtc_1_Rtc(s);
|
||||
}
|
||||
|
||||
} // namespace Libs
|
||||
|
||||
@@ -47,8 +47,4 @@ LIB_DEFINE(InitVideoOut_1) {
|
||||
|
||||
} // namespace LibGen5
|
||||
|
||||
LIB_DEFINE(InitVideoOut_1) {
|
||||
LibGen5::InitVideoOut_1(s);
|
||||
}
|
||||
|
||||
} // namespace Libs
|
||||
|
||||
+64
-47
@@ -6,10 +6,6 @@
|
||||
|
||||
namespace Libs {
|
||||
|
||||
namespace LibcInternal {
|
||||
LIB_DEFINE(InitLibcInternal_1);
|
||||
} // namespace LibcInternal
|
||||
|
||||
namespace LibContentDelete {
|
||||
LIB_DEFINE(InitContentDelete_1);
|
||||
} // namespace LibContentDelete
|
||||
@@ -46,15 +42,38 @@ namespace LibPsml {
|
||||
LIB_DEFINE(InitPsml_1);
|
||||
} // namespace LibPsml
|
||||
|
||||
namespace LibC {
|
||||
LIB_DEFINE(InitLibC_1);
|
||||
LIB_DEFINE(InitAppContent_1);
|
||||
} // namespace LibC
|
||||
|
||||
namespace LibAmpr {
|
||||
LIB_DEFINE(InitAmpr_1);
|
||||
LIB_DEFINE(InitAudio_1);
|
||||
} // namespace LibAmpr
|
||||
|
||||
namespace Coredump {
|
||||
LIB_DEFINE(InitCoredump_1);
|
||||
LIB_DEFINE(InitDbgAddressSanitizer_1);
|
||||
LIB_DEFINE(InitDebug_1);
|
||||
LIB_DEFINE(InitDialog_1);
|
||||
} // namespace Coredump
|
||||
|
||||
namespace LibRazorCpu {
|
||||
LIB_DEFINE(InitRazorCpu_1);
|
||||
} // namespace LibRazorCpu
|
||||
|
||||
namespace Fiber {
|
||||
LIB_DEFINE(InitFiber_1);
|
||||
} // namespace Fiber
|
||||
|
||||
namespace LibRtc {
|
||||
LIB_DEFINE(InitRtc_1);
|
||||
} // namespace LibRtc
|
||||
|
||||
namespace LibGen5 {
|
||||
LIB_DEFINE(InitVideoOut_1);
|
||||
} // namespace LibGen5
|
||||
|
||||
LIB_DEFINE(InitAppContent_1);
|
||||
LIB_DEFINE(InitAudio_1);
|
||||
LIB_DEFINE(InitDbgAddressSanitizer_1);
|
||||
LIB_DEFINE(InitDialog_1);
|
||||
LIB_DEFINE(InitFont_1);
|
||||
LIB_DEFINE(InitFontFt_1);
|
||||
LIB_DEFINE(InitAgcDriver_1);
|
||||
@@ -65,52 +84,50 @@ LIB_DEFINE(InitPlayGo_1);
|
||||
LIB_DEFINE(InitPngDec_1);
|
||||
LIB_DEFINE(InitPlatform_1);
|
||||
LIB_DEFINE(InitRudp_1);
|
||||
LIB_DEFINE(InitRtc_1);
|
||||
LIB_DEFINE(InitSaveData_1);
|
||||
LIB_DEFINE(InitShare_1);
|
||||
LIB_DEFINE(InitSysmodule_1);
|
||||
LIB_DEFINE(InitSystemService_1);
|
||||
LIB_DEFINE(InitTextToSpeech2_1);
|
||||
LIB_DEFINE(InitUserService_1);
|
||||
LIB_DEFINE(InitVideoOut_1);
|
||||
|
||||
void InitAll(Loader::SymbolDatabase* s) {
|
||||
LIB_LOAD(InitAudio_1);
|
||||
LIB_LOAD(InitAmpr_1);
|
||||
LIB_LOAD(InitAppContent_1);
|
||||
LIB_LOAD(InitCoredump_1);
|
||||
LIB_LOAD(LibContentDelete::InitContentDelete_1);
|
||||
LIB_LOAD(LibContentExport::InitContentExport_1);
|
||||
LIB_LOAD(LibContentSearch::InitContentSearch_1);
|
||||
LIB_LOAD(InitLibC_1);
|
||||
LIB_LOAD(InitDbgAddressSanitizer_1);
|
||||
LIB_LOAD(InitDebug_1);
|
||||
LIB_LOAD(InitDialog_1);
|
||||
LIB_LOAD(InitFiber_1);
|
||||
LIB_LOAD(InitFont_1);
|
||||
LIB_LOAD(InitFontFt_1);
|
||||
LIB_LOAD(InitAgcDriver_1);
|
||||
LIB_LOAD(InitLibKernel_1);
|
||||
LIB_LOAD(LibMouse::InitMouse_1);
|
||||
LIB_LOAD(LibKeyboard::InitKeyboard_1);
|
||||
LIB_LOAD(Ime::InitPlatform_1_Ime);
|
||||
LIB_LOAD(InitNet_1);
|
||||
LIB_LOAD(InitPad_1);
|
||||
LIB_LOAD(InitPlayGo_1);
|
||||
LIB_LOAD(LibPsml::InitPsml_1);
|
||||
LIB_LOAD(InitPngDec_1);
|
||||
LIB_LOAD(InitPlatform_1);
|
||||
LIB_LOAD(InitRudp_1);
|
||||
LIB_LOAD(InitRtc_1);
|
||||
LIB_LOAD(InitSaveData_1);
|
||||
LIB_LOAD(InitShare_1);
|
||||
LIB_LOAD(InitSysmodule_1);
|
||||
LIB_LOAD(InitSystemService_1);
|
||||
LIB_LOAD(InitTextToSpeech2_1);
|
||||
LIB_LOAD(LibUlt::InitUlt_1);
|
||||
LIB_LOAD(InitUserService_1);
|
||||
LIB_LOAD(VideoDec2::InitVideoDec2_1);
|
||||
LIB_LOAD(InitVideoOut_1);
|
||||
InitAudio_1(s);
|
||||
LibAmpr::InitAmpr_1(s);
|
||||
InitAppContent_1(s);
|
||||
Coredump::InitCoredump_1(s);
|
||||
LibContentDelete::InitContentDelete_1(s);
|
||||
LibContentExport::InitContentExport_1(s);
|
||||
LibContentSearch::InitContentSearch_1(s);
|
||||
LibC::InitLibC_1(s);
|
||||
InitDbgAddressSanitizer_1(s);
|
||||
LibRazorCpu::InitRazorCpu_1(s);
|
||||
InitDialog_1(s);
|
||||
Fiber::InitFiber_1(s);
|
||||
InitFont_1(s);
|
||||
InitFontFt_1(s);
|
||||
InitAgcDriver_1(s);
|
||||
InitLibKernel_1(s);
|
||||
LibMouse::InitMouse_1(s);
|
||||
LibKeyboard::InitKeyboard_1(s);
|
||||
Ime::InitPlatform_1_Ime(s);
|
||||
InitNet_1(s);
|
||||
InitPad_1(s);
|
||||
InitPlayGo_1(s);
|
||||
LibPsml::InitPsml_1(s);
|
||||
InitPngDec_1(s);
|
||||
InitPlatform_1(s);
|
||||
InitRudp_1(s);
|
||||
LibRtc::InitRtc_1(s);
|
||||
InitSaveData_1(s);
|
||||
InitShare_1(s);
|
||||
InitSysmodule_1(s);
|
||||
InitSystemService_1(s);
|
||||
InitTextToSpeech2_1(s);
|
||||
LibUlt::InitUlt_1(s);
|
||||
InitUserService_1(s);
|
||||
VideoDec2::InitVideoDec2_1(s);
|
||||
LibGen5::InitVideoOut_1(s);
|
||||
}
|
||||
|
||||
namespace LibContentExport {
|
||||
|
||||
@@ -27,15 +27,6 @@
|
||||
static constexpr int g_module_version_major = mv1; \
|
||||
static constexpr int g_module_version_minor = mv2;
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
#define LIB_USING(n) \
|
||||
using n::g_library; \
|
||||
using n::g_library_version; \
|
||||
using n::g_module; \
|
||||
using n::g_module_version_major; \
|
||||
using n::g_module_version_minor;
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
#define LIB_LOAD(name) name(s)
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
#define LIB_ADD(n, f, t) \
|
||||
{ \
|
||||
Loader::SymbolResolve sr {}; \
|
||||
|
||||
Reference in New Issue
Block a user