Skip to content

feat(random): implement sceRandomGetRandomNumber - #8

Merged
boykopovar merged 1 commit into
boykopovar:mainfrom
Pacuka:feat/scerandom
Sep 26, 2026
Merged

boykopovar merged 1 commit into
boykopovar:mainfrom
Pacuka:feat/scerandom

Conversation

@Pacuka

@Pacuka Pacuka commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

sceRandomGetRandomNumber was a NotImplemented stub. The Smurfs – Dreams (Unreal Engine) calls it during startup. This PR is the first of the smaller library implementations mentioned in #7.

Changes

  • Fill the buffer from std::random_device.
  • Return SCE_RANDOM_ERROR_INVALID (0x817C0016) for a null buffer or a size above SCE_RANDOM_MAX_SIZE (64), matching the system library, and leave the buffer untouched in that case.
  • Add a guest_random test that covers the invalid arguments, a zero size, partial-word sizes (no write past size), and two 64-byte draws that differ.

Testing (Linux, GCC)

🤖 Generated with Claude Code

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>
@boykopovar
boykopovar merged commit ae82942 into boykopovar:main Sep 26, 2026
GautamMIH added a commit to GautamMIH/AnyPS5 that referenced this pull request Sep 26, 2026
Brings in upstream's merged PRs boykopovar#3 (homebrew compatibility: guest stdio
streams, formatting, directories, environment, signals, UDP sockets,
dynamic module loading, working directory, mspace, errno messages), boykopovar#7
(Linux runtime fixes), boykopovar#8 (sceRandom) and boykopovar#9 (sceRtc).

Conflict resolution:
- Rendering waits: adopt upstream's RenderingWait/BufferReuseTracker design;
  drop this branch's WAIT_FLIP_DONE packet. sceAgcDcb/AcbWaitUntilSafeFor-
  Rendering now emit upstream's 4-dword rendering-wait packet.
- ResolvePath: upstream's working-directory resolver, plus host /dev devices
  and the AMPR asset-container fallback for missing /app0 files.
- Relinker: keep the DT_HASH symbol-count fallback, adopt optional PLT
  relocations, and bound the symbol count by relocation indices when neither
  DT_SCE_SYMTABSZ nor DT_HASH exists (upstream's optional_plt/empty_tls
  images). --to-intel output now actually reaches the relink pipeline.
- libc: upstream's Rtc, Random, errno messages (guest FreeBSD numbering),
  pthread_once, stream/string/formatting functions replace this branch's
  duplicates; Mspace keeps upstream's in-memory arena layout and adds
  library-owned arenas, stats, memalign/reallocalign and IsHeapEmpty.
- DirectMemory: register the main image, keep the host mprotect fallback for
  other modules, and make executable pages readable.
- close() routes socket descriptors to the guest socket runtime.

All 31 CTest suites pass, as do this branch's test executables (apart from
the three pre-existing graphics-test failures).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ycarogabriel-lgtm pushed a commit to ycarogabriel-lgtm/AnyPS5 that referenced this pull request Oct 18, 2026
…module-info-macos

feat(libkernel): sceKernelGetModuleInfoFromAddr on macOS hosts, without reading st_size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants