Commit Graph

2005 Commits

Author SHA1 Message Date
boykopovar e526f1f528 feat(libc): replace guest locale implementation with std::locale 2026-09-27 11:43:42 +03:00
QDarkRex 97cae1458e fix(kernel): use SCE kernel error codes in equeue, direct memory and mutex
SCE kernel errors are 0x80020000 plus the FreeBSD errno. The equeue and
direct memory constants used an unrelated 0x8001xxxx range with mismatched
errno values (e.g. ETIMEDOUT was 0x80010023), so a guest checking
sceKernelWaitEqueue for SCE_KERNEL_ERROR_ETIMEDOUT saw an unexpected error.
SCE_KERNEL_ERROR_EDEADLK in Mutex.cpp held the EAGAIN value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 13:22:01 +07:00
QDarkRex 76b7f998f5 fix(kernel): give every thread a pthread handle and keep mutex ownership consistent
- scePthreadSelf returned null on Linux and for threads not created by
  scePthreadCreate (including the main thread); such threads now get a
  lazily adopted, non-joinable handle
- scePthreadExit on Linux skipped FinishThread, losing the join value
- detached threads on Linux were never freed; use the reference count
  already used on Windows
- unlocking a recursive mutex from a non-owner was undefined behaviour;
  return SCE_KERNEL_ERROR_EPERM
- scePthreadCondTimedwait did not restore the mutex owner after waking,
  so another thread locking during the wait made the waiter's unlock
  fail with EPERM and left the mutex locked forever
- SCE_KERNEL_ERROR_ETIMEDOUT in Cond.cpp was 0x80020062 instead of 0x8002003C

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 12:38:59 +07:00
devilismyfriend af3c2024ed feat(runtime): timed waits, sync primitive fixes, heap and RTC fixes, unattended-run switches
libkernel: a TimedWait service for condition variables, semaphores, event flags, rwlocks and
equeues with the scheduler tick; mutex/cond/sem corner cases the title hits; job worker
affinity is opt-in (APS5_JOB_AFFINITY). libc: calloc/realloc heap slot swap, a default
terminate handler with a backtrace, CPU topology helper. libSceRtc export fixes with tests.
libSceVideoOut: APS5_NO_PAD_INPUT ignores host input for unattended measurements,
APS5_FLIP_QUEUE_WAIT keeps a stalled process alive for a debugger. ApplicationHeap and
GuestRtc tests wired into the test build.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0177gthrWEBBfBu5xJDXgBfo
2026-09-26 19:00:39 -07:00
boykopovar 1a0ebbc849
Merge pull request #9 from Pacuka/feat/scertc
feat(rtc): implement libSceRtc date and tick functions
- Ticks count microseconds since 0001-01-01 00:00:00 in the proleptic Gregorian calendar, up to 9999-12-31 23:59:59.999999. `sceRtcGetTickResolution` returns 1000000.
- Validation (`sceRtcCheckValid`, `sceRtcIsLeapYear`, `sceRtcGetDayOfWeek`) returns the matching `SCE_RTC_ERROR_INVALID_*` code (`0x80B50002`–`0x80B5000E`).
- Conversions: `sceRtcGetTick`/`SetTick`, `GetTime_t`/`SetTime_t`, `GetWin32FileTime`/`SetWin32FileTime`.
- Current time: `sceRtcGetCurrentTick`, `GetCurrentClock`, `GetCurrentClockLocalTime`. `sceRtcGetCurrentNetworkTick` uses the host clock.
- UTC and local time conversion through the host time zone.
- `sceRtcFormatRFC3339` (`YYYY-MM-DDThh:mm:ss.cc` plus `Z` or `±hh:mm`) and `sceRtcParseRFC3339`.
- Tick arithmetic (`sceRtcTickAdd*`) rejects results outside the valid range with `SCE_RTC_ERROR_INVALID_VALUE`.
- New exports: `sceRtcGetDaysInMonth`, `sceRtcTickAddMonths` and `sceRtcTickAddYears`. The last two clamp the day to the end of the target month (2024-01-31 + 1 month = 2024-02-29).
2026-09-26 13:41:16 +03:00
Pacuka c0508a7f5f feat(rtc): implement libSceRtc date and tick functions
Ticks count microseconds since 0001-01-01 in the proleptic Gregorian
calendar, up to 9999-12-31 23:59:59.999999. Implement validation, tick
and date conversion, time_t and Win32 FILETIME conversion, UTC and
local time conversion through the host time zone, RFC 3339 formatting
and parsing, and tick arithmetic. Add sceRtcGetDaysInMonth,
sceRtcTickAddMonths and sceRtcTickAddYears, which clamp the day to the
end of the target month.

The network clock uses the host clock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 12:21:23 +02:00
Pacuka d1c25097e3 feat(random): implement sceRandomGetRandomNumber
Fill the buffer from std::random_device and reject a null buffer or a
size above SCE_RANDOM_MAX_SIZE (64) with SCE_RANDOM_ERROR_INVALID, as
the system library does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 12:14:46 +02:00
Pacuka 998605fe4e fix(libc): swap calloc and realloc slots of the malloc replacement table
SceLibcMallocReplace lists calloc before realloc (malloc, free, calloc,
realloc, memalign, reallocalign, posix_memalign, ...), as the table in
retail titles shows. realloc therefore called the application's calloc
with the old pointer as the element count, and calloc called realloc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 11:15:16 +02:00
SamG-Coder f37fffdacd feat(libc): expose guest vsprintf formatting 2026-09-25 07:26:06 +10:00
SamG-Coder 6cdf4a5be1 feat(libc): implement binary search with guest comparator ABI 2026-09-25 07:24:17 +10:00
SamG-Coder 473a4f8d1c fix(agc): preserve strict shader linkage failures 2026-09-25 07:22:06 +10:00
SamG-Coder 322dc24c9e feat(kernel): implement guest once initialization 2026-09-25 07:22:05 +10:00
SamG-Coder 95dc22c173 feat(agc): execute rendering waits against buffer reuse fences 2026-09-25 07:16:55 +10:00
SamG-Coder cca00c13ab feat(video): track ordered buffer reuse reservations 2026-09-25 07:13:15 +10:00
SamG-Coder 2187436d0d feat(agc): expose legacy register defaults entry point 2026-09-25 07:10:15 +10:00
SamG-Coder d6f23df679 feat(agc): compose basic shader linkage register blocks 2026-09-25 07:08:10 +10:00
SamG-Coder 18ce03cba2 feat(libc): implement immediate guest process exit 2026-09-25 07:05:07 +10:00
SamG-Coder dd0debe967 feat(libc): reopen guest streams while preserving identity 2026-09-25 07:05:07 +10:00
SamG-Coder 2920c7f04c feat(system): handle console exit through runtime shutdown 2026-09-25 07:02:37 +10:00
SamG-Coder 79edb20f17 fix(libc): preserve 64-bit guest stream offsets 2026-09-25 07:00:45 +10:00
SamG-Coder 39b81364b7 feat(libc): add C-locale character APIs and guest basename 2026-09-25 06:58:41 +10:00
SamG-Coder 7d07187ac8 feat(libc): add floating-point string conversions 2026-09-25 06:55:31 +10:00
SamG-Coder c7d26dda5e feat(libc): add missing guest math exports and 64-bit rounding 2026-09-25 06:54:49 +10:00
SamG-Coder 730afc79f8 feat(libc): add independent guest strtok state 2026-09-25 06:52:05 +10:00
SamG-Coder 1b45b0fe68 feat(libc): track guest working directory and resolve relative paths 2026-09-25 06:51:37 +10:00
SamG-Coder 453fec28c5 feat(kernel): add tracked dynamic module loading and NID lookup 2026-09-25 06:48:50 +10:00
SamG-Coder 91bf8e3a7a feat(libc): implement guest file removal and renaming 2026-09-25 06:45:30 +10:00
SamG-Coder 5301f89092 feat(libc): translate guest directory enumeration 2026-09-25 06:41:55 +10:00
SamG-Coder 18790691bd feat(libc): implement guest environment variable storage 2026-09-25 06:39:14 +10:00
SamG-Coder f49cace1ca feat(libc): implement guest formatted stream output 2026-09-25 06:35:32 +10:00
SamG-Coder b8c1097db4 feat(kernel): support socket nonblocking flags through fcntl 2026-09-25 06:34:30 +10:00
SamG-Coder e8ecb29170 feat(libc): expose guest standard streams and character IO 2026-09-25 06:30:30 +10:00
SamG-Coder 56c7a589db feat(kernel): bridge guest signal registration and delivery 2026-09-25 06:27:11 +10:00
SamG-Coder cbd22dd854 feat(kernel): implement guest system configuration queries 2026-09-25 06:25:16 +10:00
SamG-Coder 9cbefb7e04 feat(kernel): implement tracked UDP sockets and ioctl 2026-09-25 06:23:44 +10:00
SamG-Coder ff725218cb feat(kernel): translate guest IP address conversion APIs 2026-09-25 06:18:32 +10:00
SamG-Coder 97e6ce992b feat(libc): implement guest errno message APIs 2026-09-25 06:17:18 +10:00
SamG-Coder cbf8362251 feat(posix): translate guest address resolution APIs 2026-09-25 06:15:32 +10:00
SamG-Coder dec5841b2d feat(libc): implement caller-backed mspace heaps 2026-09-25 06:10:50 +10:00
SamG-Coder 8a4cc838e0 Merge remote-tracking branch 'upstream/main' into feat/homebrew-game 2026-09-25 06:06:31 +10:00
SamG-Coder 1bbdf7daa6 feat(kernel): support private anonymous guest memory mappings 2026-09-25 06:06:31 +10:00
SamG-Coder 6ba24a895c feat(libs): implement homebrew string compatibility functions 2026-09-25 05:59:07 +10:00
boykopovar 9a4c8eab8b fix(libc): update locale signatures + add sysv abi to math funcs 2026-09-24 22:57:49 +03:00
boykopovar c9a82af00c fix(libc): add guest-compatible c++ locale abi 2026-09-24 10:51:11 +03:00
boykopovar 594656581e feat(libs): add new std symbols + unused filter off by default 2026-09-24 10:28:33 +03:00
boykopovar 9f2b41b9a1 fix(libc): route guest allocations through application heap 2026-09-24 06:53:12 +03:00
boykopovar ed171b23da feat(agc): add driver submission queue and vulkan compute path 2026-09-14 06:37:19 +03:00
boykopovar bd0969c3a4 fix(libs): ex from libc prx: unwind for catch fix (mingw) 2026-09-13 19:21:31 +03:00
boykopovar a1116fe948 feat(libc): windows way for ex handling (wip) 2026-09-11 08:17:12 +03:00
boykopovar ea3f7b5ae0 fix(windows): va_list sysv abi parse for fomatting functions 2026-09-11 07:49:14 +03:00
boykopovar 999a723a5f fix(windows): precommit guest thread stacks to prevent guard page skips 2026-09-10 20:25:25 +03:00
boykopovar b765cefa42 fix(libs): fix args sysv abi for types (windows) 2026-09-10 19:54:03 +03:00
boykopovar fdd7049250 fix(libc): fix ftools exports 2026-09-07 19:54:01 +03:00
boykopovar ba6d7afc22 refactor(libc): __attribute__ replacing and removing 2026-09-06 13:02:22 +03:00
boykopovar baa8a8d9d3 feat(libc): add ex tests + remove bad_alloc dup 2026-09-06 07:30:59 +03:00