sceSdCleanEffectWorkArea reported its end after the transfer latency alone,
and a host that delivers audio completions at once (VP2S) ran it immediately.
VP2's reverb change (Csm export 8) clears core 0, then core 1, then releases
its lock; the EE asks (Csi RPC 0x1c) about two frames later whether the change
is still running and sends it again when it is not. With a clear that takes no
time it was never running: the castle-hall event of chapter 2 waited forever.
The clear's end now comes after the area's DMA time (16 IOP cycles per
halfword: mode 7 is 0x18040 bytes, about 21 ms per core) through a new
LibsdHost::interruptCallAfterWork, which ready-completion hosts honour (its
default forwards to interruptCall). Test: the end's delay and its route.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Shinobido's Hideout music recorded from PCSX2 (its own media capture of the
SPU2's samples) against the port's: the same to within 0.2 dB from 200 Hz to
4 kHz (coherence 1.000), but the port 1 dB brighter at 4-8 kHz, 2.6 dB at
8-12 kHz, 4 dB at 12-16 kHz and 6.4 dB above. The mixer resamples the voices
by 4-point Catmull-Rom (nearly flat to the top); the SPU2 by its 4-point
Gaussian table, as the PS1's SPU (psx-spx, "SPU ADPCM Pitch": 512 entries, the
index the pitch counter's bits 4-11, each of the four products shifted right
15), which rolls the highs off. With it the port's music is within 0.17 dB of
PCSX2's in every band from 200 Hz up.
Mixer::setGaussianInterpolation(bool), for every mixer, off by default (the
other ports' sound, and any recordings they compare against, unchanged);
Mixer::gaussian(y0, y1, y2, y3, t) the interpolation itself. The table's 512
values checked as the page says: each set of four weights sums to 0x7F7F-0x7F81.
Test (bozo-audio-tests): off by default; a constant 0x7000 at fraction 0 is
4206 + 20092 + 4262 - 1 = 28559; every index's weights sum within bounds; the
fraction's low 4 bits ignored (y1 alone at 0: 0x59B3); the switch.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Breath of Fire: Dragon Quarter's memory card picture is a sprite drawing the
frame so far into the GS memory, in the middle of a frame whose end is a
black fade tile: the presented picture (readPicture) is black. Natively the
port copies the frame so far into an auxiliary image there (fromFrame,
source 0) and reads that image back.
Renderer::readImage(image, width, height, rgba, timeoutMs) asks the first
present showing the frame published when it was called (or a later one) for
the auxiliary image as the frames drawn so far left it: all of it, one
ReadPixels, rows top-down as the screen's, RGBA (alpha 0x80), and its size.
Called on the game's thread after the frame drawing into the image was
published. False at once when nothing has presented in the last second
(headless), for an image no frame has drawn, and on a timeout.
GPU test (BOZO_APP, label gpu): a frame red over blue is copied into image 2
(8 x 6), then covered black; another thread reads the image back (red over
blue, top-down) while readPicture gives the black frame; an image never drawn
reads false.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The D-pad pushes the left stick too, but always with its button bit. Games
that read the D-pad apart (VP2's battle: left/right split the party) could
not be given a plain stick move from a script. The new names push one stick
to its end with no button bit or pressure, winning on their axis.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Material::destinationAlpha (Off / Clear: pass where the target's alpha is below
0x80 / Set: 0x80 and up): the target so far copied to unit 4 before the draw (3 being the shader blend's destination),
its alpha tested per fragment (0x80 is the 1.0 the target keeps).
- Material::frameAlpha: an opaque draw writes its own alpha (As) instead of 1, as
the GS does, so a later DATE or DST_ALPHA blend reads it.
Both default off: other ports draw as before.
Breath of Fire: Dragon Quarter's character outlines: an inflated dark mesh drawn
with DATE, DATM 1 where the frame's alpha is set, not over the characters (alpha 0).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The GPU blender has no factors for a colour times 1 + C (A = D, B = 0: ALPHA 0x49 Cd x (1 + As), 0x08
Cs x (1 + As)); applyGsBlend dropped the C term, so such draws did nothing (0x49) or lost their base (0x08).
They now blend in the shader against a copy of the target (the GS-arithmetic path), with the source alpha read
before the 1.0 clamp (the GS's As can exceed 0x80). Rare: a few draws a frame.
VP2S battle 0x8f (Dark Savior): the golden ground ring's 0x49 draws were invisible; they now brighten as on PCSX2.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
With setGsArithmetic on, a gsBlend draw that reads an image (fromFrame with a source) copies its target and
blends in the shader with the GS's byte rules: floor((A - B) x C / 128) + D, C the truncated source or target
alpha or FIX. The GPU blender cannot truncate; with small factors (VP2's title glow layers at alpha 3..4)
that is most of the result. A few full-screen layers a frame.
VP2S title glow vs a GS-rule render of PCSX2's dump: ours added 11.6/12.4/13.3 per channel, PCSX2 7.3/8.6/9.1;
now 7.0/8.4/9.0.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
With setGsArithmetic on, image passes (frame copies, filters, levels, chains) store their result as truncated
bytes, as each GS pass does, where the 8-bit target would round to nearest. Scene draws are unchanged.
VP2S's world-map glow measured against a GS-rule render of PCSX2's dump: the full frame was +3.3..+4.0 per
channel over PCSX2, now +0.9..+1.8 (with a VP2S-side split of the glow level pass).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Steambot Chronicles' menus are drawn over a half-size copy of the screen
(sceGsExecStoreImage of the frame buffer). Renderer::readPicture asks the
next present for a rectangle of the frame's screen, read back with one
ReadPixels after the picture is drawn and before the window draws over it,
box-averaged to the size asked for (RGBA, rows top-down, alpha 0x80). It
waits up to a timeout for that present and answers false at once when
nothing has presented in the last second (headless).
GPU test (BOZO_APP, label gpu): a hidden window presents red and blue
halves while another thread reads them back at 4 x 2.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Counted from the start (vblanks x the field), a field-rate change after
many fields of another length put the next vblank far off: Shinobido at
60 (NTSC's fields) switching to PAL's for a movie waited 16 s for its
next vblank, the movie's sound polling for it. Now each vblank is a field
after the one before, and a change re-spaces the pending one. A rate
that never changes gets the same vblanks as before.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Renderer::setGsArithmetic(true) makes textured scene draws compute as the GS does: the filtered texel and the
interpolated vertex colour as truncated bytes, modulate floor(T x C / 128), fog (F x C + (255 - F) x FOG) >> 8.
Off by default (exact float, rounded once on store). Image passes are unaffected.
VP2S measured a town frame against a GS-rule render of PCSX2's dump of the same frame: exact arithmetic is
+2.2 per channel over the GS (doubled by the game's 2x pass); with this, +0.4.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
CreateThread took each task's stack from a bump arena (0x1fe000 down to 0x190000) and DeleteThread never gave it
back, so a game that creates and deletes IOP threads at every map load ran the arena out: Steambot Chronicles stopped
with "native library task stacks exhausted" (thbase 4) after about 20 map loads.
- DeleteThread puts the task's stack on a free list; CreateThread takes the smallest free stack that fits (its whole
size becomes the task's) before the arena's next.
- The free list is saved in the IOP section's new "taskstacks" part; a state saved before it loads with none free.
- Test: 257 CreateThread / DeleteThread pairs with 4 KiB stacks, each thread on the first one's stack.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
When a player installs ReShade (its opengl32.dll beside the executable), the
program registers as one of its add-ons and has it render its effects inside
present(), after the 3D picture and before the HUD and menus, so a colour
grade, depth of field or ambient occlusion no longer goes over the 2D. The
F2 / F3 panels stay clear too. Without ReShade nothing changes;
BOZO_RESHADE_AT_PRESENT=1 keeps ReShade's own pass over everything.
- Renderer::setBeforeOverlay: a hook present() calls when it draws to the
window, between the 3D and the 2D, with the window's size; present()
binds its own state again afterwards.
- app/reshade_bridge: registration after the window is made (ReShade's DLL
loads with it) and before the GL context; the effects run on a texture
of the window's size, copied upside down from and back to the window, as
ReShade's own OpenGL pass does (its effects expect the top row first).
- ReShade 6.8.0's API headers (BSD-3-Clause) in app/reshade/.
- MinGW and ReShade's MSVC return structs from methods differently, so no
API method returning a struct is called; views are built as ReShade's
OpenGL backend makes them.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Capcom's SNDDRV.IRX 2.27W (Breath of Fire: Dragon Quarter) parses its arguments
with strstr and moves and clears its stream buffers with wmemcopy / wmemset
(bytes / 4 words). Test: tests/native/library_sysclib_words_tests.cpp.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
CompiledLibraries::useWorkFreeClock(): the IOP clock moves only with its own
events (deadlines, timers, the EE's time), not with the work compiled code
does, so a native rewrite of a compiled routine meets the same times and a
timer handler's work no longer delays its next period.
BOZO_IRX_CALLS=<file>: every import call (cycle, library, ordinal, a0-a3,
the caller, the result) written out, to compare two runs of the same
modules, compiled or rewritten. docs/native-irx.md also describes bindings
that sleep and resume at admitted return addresses.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The SDK sends a SIF command and the IOP's sifcmd sends the bytes back by SIF DMA; with no IOP the guest code's
request is never answered and the EE buffer stays as it was. Natively the bytes come from the IOP host's memory
(SifState::receive, a port's provider) at once; the receive record is filled; 0.
Steambot Chronicles' file loader reads each archive into an IOP buffer (sceCdReadIOPm) and takes every file back
with sceSifGetOtherData: without it the map's models and textures were zeros (ImdGetObjFirst: Not IMD).
Co-Authored-By: Claude Opus 5.5 <[email protected]>