Repository navigation
feat(libSceFont): implement text-code cursor iteration - #4050
p3n1cillin wants to merge 2 commits into
Conversation
|
The PS4 11.00
Both step functions also skip characters whose byte at +0x33 is set, and |
|
Closing: no title is shown to call |
* fix(libkernel): answer a second scePthreadJoin with ESRCH * fix(libkernel): answer pthread_getname_np for a joined thread with ESRCH * fix(libc): create noreplace streams exclusively * fix(pad): read controller commands from Unicode paths * feat(libSceVideoOut): register PS4 display buffers Add the PS4 functions sceVideoOutSetBufferAttribute and sceVideoOutRegisterBuffers on top of the existing registration. The PS4 call uses the first free attribute set and returns its index. It accepts linear A8R8G8B8_SRGB and A8B8G8R8_SRGB buffers, which map to the PS5 B8G8R8A8 and R8G8B8A8 formats. It throws for tiled buffers, whose PS4 layout differs from the PS5 one. Linear PS4 buffers may be 4 KiB aligned: the OpenOrbis graphics sample places its second 1920x1080 buffer 8,294,400 bytes after the first. PS5 buffers keep the 64 KiB rule. A handle with PS4 buffers writes the PS4 flip status (64 bytes) and vblank status (32 bytes). Writing the 128-byte PS5 flip status into the sample's stack structure overwrote its saved frame pointer. * fix(agc): release sampled views after storage eviction * fix(shader): translate f32 compares in f32 denormal modes 1 and 2 v_cmp_X_f32 and v_cmpx_X_f32 flush their denormal inputs by bit 0 of the FLOAT_MODE f32 denormal field, as measured on RDNA2 (gfx1030): mode 1 keeps them and mode 2 flushes them. Both modes threw before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(shader): translate v_ldexp_f32 in f32 denormal modes 1 and 2 Mode 1 keeps subnormal inputs and flushes a result below 2^-126 to a zero of its sign; mode 2 flushes subnormal inputs and rounds a subnormal result in the f32 round mode, as measured on RDNA2 (gfx1030) in every f32 round mode at IEEE=0 and IEEE=1. Both modes threw before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(libSceFont): implement sceFontCharactersRefersTextCodes and text code stepping sceFontCharactersRefersTextCodes fills a 64-byte FontTextCodes with the order and code of a text character and keeps the current, start and term characters at +0x28, +0x30 and +0x38. The traversal follows the PS4 11.00 libSceFont.sprx disassembly posted in the review of boykopovar#4050, which implemented the same rules: Refers never compares the character with the term and returns null for a clustered or synthetic character, sceFontTextCodesStepNext returns null at the term after visiting it, sceFontTextCodesStepBack returns null at the start character, and both steps skip synthetic characters. Null from StepNext at the end of the chain and from StepBack at the head of the chain is assumed and not covered by the report. The signatures follow Orbital's IDA type database and SharpProspero. A null cursor or output returns null as in KytyPS5; a null text character throws. guest_font_tests gets configure_windows_unwind so the expected exception reaches the test on Windows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(libSceFiber): run a fiber on its own context when the context is large Since 7947149 every fiber ran on an mmap'd host stack so that host calls cannot overrun the small contexts PPSA01341 packs next to each other. A title that derives state from the stack pointer then reads the wrong memory: PPSA05684's job fibers have 512 KiB contexts at 1 MiB-aligned addresses and find their job record by masking rsp with ~0xfffff, so the job system lost track of a GameInit job and the game waited forever right after loading big4r/actor76.txt. Its 64 KiB fibers fault later on a host stack too. A fiber now gets a host stack only when its context is smaller than 64 KiB; a larger context is the stack again, as on the console. The limit sits between the 16 KiB contexts that need protection and the 64 KiB ones that need the guest stack (technical debt entry). The fiber test runs a 512 KiB fiber and checks that its stack is in its context; it fails without this change. AI-assisted: yes * fix(agc): write nothing for an empty register list sceAgcCbSetShRegistersDirect and the other register list writers threw on a count of 0 although the matching size functions report 0 words for it. PPSA05684 calls the writer with an empty list at its main menu and terminated. An empty list now writes no packet and returns the cursor, as its size says; a null buffer still throws. AI-assisted: yes * feat(libc): export the fmin and fmax family Adds fmin, fminf, fminl, fmax, fmaxf and fmaxl, the remaining missing members of the C99 minimum/maximum family, with the NaN propagation and signed-zero handling guest_fminf pins down (host std::fmin does not guarantee the sign of a zero result). The previous libSceLibcInternal copy of fminf is removed so the export stays single-owner. PPSA28319 imports fmaxf from libc.prx; the other five names were exported by nothing. * feat(libSceVideoOut): capture the host cursor for guest mice and scale their deltas The console's mouse reports relative motion, so the host cursor can never line up with the cursor a title draws. While a title has a mouse open and the window is focused the host cursor is hidden and captured, released on focus loss or while the pad's mouse-to-stick toggle is on. Motion deltas are scaled from the presented image's size in window units to the title's display resolution with sub-pixel carry, so the title's cursor travels as far as the host pointer would, on scaled desktops and letterboxed windows alike. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(libSceVideoOut): preserve relative mouse mode for mouse-to-stick * test(agc): an empty register list into a null buffer still throws AI-assisted: yes * fix(agc): copy an indirect draw's vertex buffer only up to its last element For an indirect draw, whose counts only the GPU knows, the driver copies the whole range a vertex buffer descriptor covers, records * stride from the descriptor's address. The last record's element ends sooner when the attribute sits at an offset in its record, and the fetch can read at most (records - 1) * stride plus the element. Forspoken (PPSA03984) draws instances from a 48 MiB buffer of 96-byte records with six attributes at offsets 0 to 0x50 in each record. The copy for the attribute at 0x50 ran 0x50 bytes past the buffer into the unmapped page after it, and the draw stopped with "guest memory is not readable". VertexBufferExtent now ends at the last record's element, as VertexBufferReadSize does for the last record of a direct draw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(libScePlayGo): let users answer unlisted chunks * test(agc): align indirect argument storage at runtime * test(libc): cover the whole fmin and fmax family in guest_fminf * fix(agc): treat a view past a depth surface's first level as memory A depth surface is one level: the driver rejects draws that render a depth mip. A sampled or storage view at the surface's address and extent that starts at a later level, or a storage access to a later level, does not touch that level, so it is not the depth plane. DepthSurfaceTexture and DepthSurfaceStorage still sent such views to the surface, which rejected the level. Forspoken (PPSA03984) builds a depth pyramid from its 1984x1116 D32 depth surface with a compute shader that samples one level of a five-level R32F view and stores the next, and stopped there. Both now leave such views to the texture and storage caches, as they already do for a view of another extent or format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(libc): ignore noreplace for read-only streams * feat(libSceAudio3d): report supported port attributes * fix(libc): run guest finalizers before driver shutdown * test(libc): verify nested exit shutdown ordering * test(libc): keep firstArgument parsing for the exit-order and relaunch modes Co-Authored-By: Claude <noreply@anthropic.com> * fix(libSceNgs2): implement a minimal sceNgs2GeomApply pass-through Implement sceNgs2GeomApply, which was previously an unimplemented throwing stub and was blocking Dead Cells (PPSA15552). The implementation validates null handles/output addresses and writes a minimal Ngs2GeomAttribute: pitch_ratio 1.0, source position, source volume/level maxima, and diagonal channel levels for the source's channel count. It does not implement source attenuation, distance rolloff, panning or Doppler. The export lives in Geom.cpp's internal Ngs2GeomApply and is exposed through the existing default-visibility wrapper in Voice.cpp. Unimplemented.cpp no longer defines the stub. A passing test was added to Ngs2Geom.cpp. Unblocks: PPSA15552 #<Game bring-up discussion number> Depends on: none AI assistance: yes * fix(libSceSystemService): report the host time zone and summer time sceSystemServiceParamGetInt answered 0 for the time zone (parameter 4) and summer time (parameter 5), so the console looked set to UTC while libSceRtc and libc convert local time with the host's zone. Titles add the time zone in minutes and 60 more minutes when summer time is 1 to UTC to get the local time (Apollo, GoldHEN's frame logger). Both now follow the host's local time zone: summer time is whether it is in effect, and the time zone is the current offset east of UTC less the summer time shift while it is. On Windows that shift is the C runtime's own summer time bias (_get_dstbias), the one localtime_s applied, not a fixed 60 minutes. The UCRT reads the system zone when libc.prx loads and keeps that zone's bias after TZ is set later, so on a host whose system zone has no summer time (the CI runner's UTC) a TZ of CET-1CEST shifted by 0 and the time zone came out as 0. The cause and the change are screamm's, from the review. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * feat(libSceMouse): implement sceMouseResetAbsolutePosition * fix(libSceMouse): take the position arguments of sceMouseResetAbsolutePosition A call site passes the handle and then x and y as zero-extended 16-bit values (the centre of the display size), and ignores the result. * fix: correct audio-video playback timing and sync * fix(avplayer): preserve caller-paced delivery in no-sync mode * fix(libScePad): return measured status for unknown Pad export * docs(libScePad): record unknown NID probe limits * fix(libScePad): refuse unknown NID calls with open controller * test(libScePad): remove obsolete stub-only export check * fix(libSceRazorCpu): add sceRazorCpuNamedSync export Resolve the XCuZoBSVFG8 import required by Killzone Liberation by adding sceRazorCpuNamedSync as a no-op returning success when capture is inactive. Extend the RazorCpu behavior test and document the NID source and unverified console signature and capture behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(libSceRazorCpu): take the label argument of sceRazorCpuNamedSync * fix(tests): end Windows test processes through libc before DLL detach On Windows a test that returns from main ends through exit and ExitProcess, which kills every other thread before the prx static destructors run at DLL_PROCESS_DETACH. Detached host threads (the driver's async log thread, libkernel's file watch thread, ...) die holding winpthreads and queue locks, and a destructor that then locks a mutex, waits for the dead logger or destroys a condition variable never returns: the test prints its last line and hangs until the CTest timeout (boykopovar#6791). Every test executable now wraps main on MinGW. After main returns the wrapper runs the executable's own exit handlers and static destructors (_cexit), as exit does today, flushes the streams and ends the process with LibcTerminate_nid_no_patch, the path the guest exit already takes. That flushes the driver log while its thread is alive and calls TerminateProcess, so no DLL_PROCESS_DETACH work runs after the threads are gone. The libc shutdown callbacks are not run, as on a plain return from main on Linux. A test that does not load libc.prx returns as before. * docs(debt): record sceRazorCpuNamedSync silent stub * fix(agc): forward declare StorageTexture in DepthSurface.hpp * fix(libkernel): answer scePthreadCancel for joined thread with ESRCH * fix(metal): align sample position pass check and depth target test parameters * perf(metal): clamp resident texture view samples under forced 1x MSAA --------- Co-authored-by: Rujul Talekar <113801876+Roojool@users.noreply.github.com> Co-authored-by: Ondra97 <47064087+Ondra97@users.noreply.github.com> Co-authored-by: Get-fix <100056769+Get-fix@users.noreply.github.com> Co-authored-by: zmeizy <meiz.mzk@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: KernelPanicNT <76663133+KernelPanicNT@users.noreply.github.com> Co-authored-by: XairRrR <dev910382@gmail.com> Co-authored-by: akkadbakkad89 <best.dv1996@gmail.com> Co-authored-by: Mouad-Scriptz-0 <mouadscriptz@gmail.com> Co-authored-by: MarcZX100 <marczxrr@gmail.com> Co-authored-by: milescoviello <kitslayer29@gmail.com> Co-authored-by: fogydes <zeherop2@gmail.com> Co-authored-by: Romans Pokrovskis <motivated.it@gmail.com> Co-authored-by: Adrià Franch <adriadam10@gmail.com> Co-authored-by: alosta <mohammadalosta02@gmail.com> Co-authored-by: Rick <99503318+0xRickx@users.noreply.github.com> Co-authored-by: Masud <sheikhmasudhassann@gmail.com> Co-authored-by: Dean Galvin <dean.galvin@live.com> Co-authored-by: Leonardo Baldazzi <leonardo.baldazzi2003@gmail.com> Co-authored-by: MarcZX100 <MarcZX100@users.noreply.github.com> Co-authored-by: julienlgy <julien.legay2@gmail.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
What
Implement
sceFontCharactersRefersTextCodes,sceFontTextCodesStepNext, andsceFontTextCodesStepBackover the existing font-string character links. The cursor exposes the source ordering token and Unicode code, includes the supplied terminator, stops backward traversal at its starting character, and preserves the last valid step when an end is reached. This replaces three throwing exports, raising the source count from 2,946 to 2,949 of 3,437 on base2c8122c9f(85.71% to 85.80%).Signatures follow Orbital's type database and SharpProspero's bindings. The 64-byte cursor and public order/code fields follow SharpProspero's structure. Traversal rules and private current/start/terminator offsets follow the PS4 11.00 behavior reported in review. Initial clustered or synthetic characters are rejected; traversal skips synthetic characters but keeps cluster continuations. PS5 behavior, null-input results, lifetime requirements, and console error precedence remain unverified and are recorded in TechnicalDebt. No PS5 hardware or title validation of these exports is claimed.
Tested
guest_font,guest_system_font,guest_font_writing_line, and the newguest_font_text_codespassed.Socket.cppon Windows becauseHostPollis undeclared. Windows validation temporarily applied the existing fix from fix(libkernel): restore Windows select build for Demons Souls testing #4021; that patch is not included here.tools/check_conventions.py --base origin/main, andgit diff --check origin/main...HEADpassed.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repository