mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-22 16:43:05 -05:00
- libc: reserve guest memory in one arena below the PS5 map limit with MEM_WRITE_WATCH (GuestArena) and a caching guest heap; the allocation registry gains a generation counter, an invalidator callback for the driver's page cache and a pin waiter for leased ranges. This replaces the fault-based GuestMemoryTracking/GuestMemoryBacking layer, whose files are removed. - libkernel: mmap/mprotect/munmap on the arena, flexible memory budget, real sceKernelVirtualQuery; POSIX pthread layer, rwlocks, timed locks, TSD, event flags; 0.5 ms scheduler tick and high-resolution sleeps; TSC/clock/time functions; file APIs return SCE errno codes; the APR file-streaming API. - libc: vectored crash reporter with backtraces for fatal exceptions, SIGABRT, UCRT invalid parameters and process exit; SSE4a EXTRQ/INSERTQ emulation for Intel hosts; %ls/%lc/%S/%C with the guest's 16-bit wchar_t; hand-written setjmp/longjmp for the guest jmp_buf; a path alias table for short save-data mount points; more string, stdio and math exports. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0177gthrWEBBfBu5xJDXgBfo
89 lines
4.3 KiB
C++
89 lines
4.3 KiB
C++
#include <mutex>
|
|
#include <cstdint>
|
|
#include <cmath>
|
|
|
|
#include "prx/libc/include/General.hpp"
|
|
|
|
extern "C" {
|
|
|
|
double APS5_VABI cbrt_nid_postfix(double x) { return std::cbrt(x); }
|
|
double APS5_VABI asin_nid_postfix(double x) { return std::asin(x); }
|
|
double APS5_VABI acos_nid_postfix(double x) { return std::acos(x); }
|
|
double APS5_VABI exp_nid_postfix(double x) { return std::exp(x); }
|
|
double APS5_VABI atan_nid_postfix(double x) { return std::atan(x); }
|
|
double APS5_VABI tan_nid_postfix(double x) { return std::tan(x); }
|
|
double APS5_VABI log2_nid_postfix(double x) { return std::log2(x); }
|
|
double APS5_VABI log_nid_postfix(double x) { return std::log(x); }
|
|
|
|
float APS5_VABI sinf_nid_postfix(float x) { return std::sin(x); }
|
|
float APS5_VABI cosf_nid_postfix(float x) { return std::cos(x); }
|
|
|
|
void APS5_VABI sincosf_nid_postfix(float x, float* sinp, float* cosp) {
|
|
*sinp = std::sin(x);
|
|
*cosp = std::cos(x);
|
|
}
|
|
|
|
double APS5_VABI sin_nid_postfix(double x) { return std::sin(x); }
|
|
double APS5_VABI cos_nid_postfix(double x) { return std::cos(x); }
|
|
|
|
void APS5_VABI sincos_nid_postfix(double x, double* sinp, double* cosp) {
|
|
*sinp = std::sin(x);
|
|
*cosp = std::cos(x);
|
|
}
|
|
|
|
float APS5_VABI atanf_nid_postfix(float x) { return std::atan(x); }
|
|
double APS5_VABI atan2_nid_postfix(double y, double x) { return std::atan2(y, x); }
|
|
float APS5_VABI powf_nid_postfix(float base, float exp) { return std::pow(base, exp); }
|
|
double APS5_VABI pow_nid_postfix(double base, double exp) { return std::pow(base, exp); }
|
|
float APS5_VABI expf_nid_postfix(float x) { return std::exp(x); }
|
|
float APS5_VABI exp2f_nid_postfix(float x) { return std::exp2(x); }
|
|
float APS5_VABI logf_nid_postfix(float x) { return std::log(x); }
|
|
float APS5_VABI log2f_nid_postfix(float x) { return std::log2(x); }
|
|
double APS5_VABI log10_nid_postfix(double x) { return std::log10(x); }
|
|
float APS5_VABI ldexpf_nid_postfix(float x, int exp) { return std::ldexp(x, exp); }
|
|
double APS5_VABI fmod_nid_postfix(double x, double y) { return std::fmod(x, y); }
|
|
float APS5_VABI roundf_nid_postfix(float x) { return std::round(x); }
|
|
double APS5_VABI round_nid_postfix(double x) { return std::round(x); }
|
|
|
|
int APS5_VABI __isfinite_nid_postfix(double x) { return std::isfinite(x) ? 1 : 0; }
|
|
int APS5_VABI __isnan_nid_postfix(double x) { return std::isnan(x) ? 1 : 0; }
|
|
int APS5_VABI __signbit_nid_postfix(double x) { return std::signbit(x) ? 1 : 0; }
|
|
|
|
double APS5_VABI modf_nid_postfix(double x, double* integral) { return std::modf(x, integral); }
|
|
float APS5_VABI modff_nid_postfix(float x, float* integral) { return std::modf(x, integral); }
|
|
double APS5_VABI frexp_nid_postfix(double x, int* exponent) { return std::frexp(x, exponent); }
|
|
float APS5_VABI frexpf_nid_postfix(float x, int* exponent) { return std::frexp(x, exponent); }
|
|
double APS5_VABI ldexp_nid_postfix(double x, int exponent) { return std::ldexp(x, exponent); }
|
|
float APS5_VABI fmodf_nid_postfix(float x, float y) { return std::fmod(x, y); }
|
|
float APS5_VABI atan2f_nid_postfix(float y, float x) { return std::atan2(y, x); }
|
|
float APS5_VABI asinf_nid_postfix(float x) { return std::asin(x); }
|
|
float APS5_VABI acosf_nid_postfix(float x) { return std::acos(x); }
|
|
float APS5_VABI tanf_nid_postfix(float x) { return std::tan(x); }
|
|
double APS5_VABI tanh_nid_postfix(double x) { return std::tanh(x); }
|
|
float APS5_VABI tanhf_nid_postfix(float x) { return std::tanh(x); }
|
|
float APS5_VABI log10f_nid_postfix(float x) { return std::log10(x); }
|
|
float APS5_VABI _FSinh_nid_postfix(float x, float y) { return y * std::sinh(x); }
|
|
float APS5_VABI _FCosh_nid_postfix(float x, float y) { return y * std::cosh(x); }
|
|
int APS5_VABI __isnanf_nid_postfix(float x) { return std::isnan(x) ? 1 : 0; }
|
|
int APS5_VABI __isinff_nid_postfix(float x) { return std::isinf(x) ? 1 : 0; }
|
|
int APS5_VABI __signbitf_nid_postfix(float x) { return std::signbit(x) ? 1 : 0; }
|
|
|
|
static std::mutex g_randLock;
|
|
static std::uint32_t g_randState = 1;
|
|
|
|
int APS5_VABI rand_nid_postfix() {
|
|
std::lock_guard lock(g_randLock);
|
|
const std::int64_t x = static_cast<std::int64_t>(g_randState % 0x7ffffffeu) + 1;
|
|
std::int64_t next = 16807 * (x % 127773) - 2836 * (x / 127773);
|
|
if (next < 0) next += 0x7fffffff;
|
|
g_randState = static_cast<std::uint32_t>(next - 1);
|
|
return static_cast<int>(next - 1);
|
|
}
|
|
|
|
void APS5_VABI srand_nid_postfix(unsigned int seed) {
|
|
std::lock_guard lock(g_randLock);
|
|
g_randState = seed;
|
|
}
|
|
|
|
}
|