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]>
- video::Settings::widescreen (video.ini `widescreen`, PS2X_WIDESCREEN):
the port shows a 16:9 picture where its game can show more at the sides.
Off by default. The Video tab offers it once the port calls
video::offerWidescreen(true); a port without it ignores it.
- setPictureAspect(aspect) (window.h, any thread, live): the picture's
shape the window letterboxes, over WindowOptions::aspect (0 back to it).
A port drawing its wider picture sets 16:9 while it does.
TMB widens its match views with them (TheBozos/TMB_Recomp PR to follow).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A port whose in-game menu saves a state calls its own save rather than
Game::saveState through F5, so the slot kept its old picture in the
Save states tab. captureStatePicture(slot) takes the window's next frame
as the slot's picture, the same path F5 uses.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
For a game whose views are fixed pictures (pre-rendered rooms) and cannot
show more at the sides: setPictureCrop(16/9) shows a 16:9 shape fitted in
the window, the 4:3 picture filling its width and cut at the top and
bottom (or its height for a narrower shape); outside the shape the window
stays black (scissored clears after the present). Live, any thread; 0
(the default) is the letterboxed 4:3 as before. The port keeps its HUD
inside the shape.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
bozo/app/profiler.h (bozo_profiler, no SDL3): while it runs, a thread of its
own reads each registered thread's instruction pointer about every
millisecond (Windows: suspended for the read, nothing allocated meanwhile;
Linux: SIGPROF answered from the thread's handler) and a profile counts the
samples by function, named from the executable's own symbols (PE/COFF or
ELF .symtab, demangled; recompiled functions keep their PS2 address) and a
library's export ("ntdll.dll!ZwWaitForSingleObject": a thread waiting).
The window registers its game thread ("game") and its own ("window"); a
port registers its workers. F2 has a Profiler tab (start, stop, each
thread's functions, a report saved to the user folder's profiles/), and
PS2X_PROFILE=<from>:<to>[:<file>] profiles game frames in scripted runs.
Tested by tests/app/profiler_tests.cpp (a spinning thread's function first).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A game paced at 60 on its own clock, presented with vsync on a 60 Hz
monitor: the two clocks drift, and every so often a picture stayed two
refreshes and the next was never shown. 60 frames a second that did not
feel smooth (TTA's players). The driver also queued up to three frames
ahead of the display, each a refresh of input delay.
On vsync at the game's rate (no frames between, not lockstep, a shown
window) the window now waits each present out (glFinish after the swap)
and counts it; once their period is steady and within 1 % of the cap's,
FramePacer ends each frame on the display's next refresh instead of its
own clock (bounded to 0.9..2 periods). Fast forward, a hidden window or
an unsteady display keep the clock. PS2X_NO_VSYNC_PACE=1 and
PS2X_NO_SWAP_FINISH=1 for the old ways; the window's stats line shows
the locked period.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
FramePacer::frameEnd and the window's own present schedule slept with
std::this_thread::sleep_until, which MinGW turns into nanosleep. Under
Proton Experimental with fsync that oversleeps by up to 13 ms, so a game
with 1 ms of work a frame ran its menus at 55 frames a second while the
presents held 60. bozo::app::sleepUntil waits on a high-resolution
waitable timer instead (a plain one where that kind is missing, then
sleep_until); other systems keep sleep_until.
PAL sc3.exe under Proton Experimental with fsync, menus: 58.6 -> 59.95
game frames a second (a standalone pacer loop: 55 -> 60.00).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The frame's 3D is drawn into a multisampled colour and depth-stencil of the
target's size and resolved into the single-sampled target wherever the frame
is read: the copies a material samples, the depth an image pass reads, an
auxiliary target sharing the frame's depth, the depth tiles and the present.
Off by default; video.ini anti_aliasing, PS2X_ANTI_ALIASING (also read by
scripted runs). A size or sample count the GPU refuses falls back to none.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Window actions bound like the pad's buttons (input.ini, the Controls tab): fast forward,
the settings window (the gamepad's middle button by default), save and load a state
(unbound). input::windowActions evaluates them; DevicePad::windowActions gathers the
players'; the window acts on their presses. ImGui's gamepad navigation steers the settings
window (every gamepad), which takes the focus when opened and holds the gamepads from the
game while it is open. PS2X_VIRTUAL_PAD=<s>:<button>,... presses an SDL virtual gamepad's
buttons for scripted checks.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
input::FastForward joins the actions (input.ini fast_forward): player 1's ` key and every
player's touchpad click by default (DualShock 4 / DualSense; no PS2 button has it), rebound
in the Controls tab like a PS2 button. padState reports it; DevicePad::fastForwardHeld
gathers the players' and the window sets the speed from it (focus and the panel's keyboard
hold as for the game's input).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
FramePacer::speedPercent: a paced game's frames held to the cap times the speed, each
counted as one period of the cap; the sound stays on the host's clock. The window sets it
while ` is held with the focus (not while the panel takes the keyboard); the Video tab's
"Fast forward" picks the speed (video.ini fast_forward, PS2X_FAST_FORWARD, 3x by default);
">> 3x" shows at the top left meanwhile. PS2X_FAST_FORWARD_AT=<from>-<to> holds it from a
script.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A save (F5 or the tab's Save) takes the game's picture at the next present as slotN.png beside the state (320 wide,
SDL_SavePNG on the capture thread). The tab shows it beside the slot (96 x 72, full size under the pointer), loaded
into a texture again when the file changes; empty slots stay one line. PS2X_STATE_SAVE_AT=<s>[,<s>...] presses F5
from a script.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The game's picture without the panel, at the next present, written by the capture thread through SDL_SavePNG (alpha
made opaque) as screenshots/screenshot_<date>_<time>.png in the user folder (PS2X_SCREENSHOT_DIR another folder; a
number added within the same second), with a notice naming it. PS2X_SCREENSHOT_AT=<s>[,<s>...] presses it from a
script.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Shown again by any motion, button or wheel, while the settings window is
open, and when the pointer leaves the window. Hidden (scripted) windows
are left alone; PS2X_KEEP_CURSOR=1 keeps it shown.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
FramePacer::backgroundHold(), set by the window's loop when the player's
video settings ask for it (video.ini pause_in_background, PS2X_PAUSE_IN_BACKGROUND,
the Video tab's checkbox) and the window is unfocused or minimised. A paced
game holds at its frame end; the frame after counts one period. Cleared
before the game is stopped. Off by default.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
WindowOptions::lockstep presents each published frame exactly once, in order, after the frame has ended, and
reports it through onPresented. A host that holds its game after each publish until then gets pictures that do not
depend on the window's timing, including what they keep from present to present (kPreviousFrame, the render
targets). TTA's Nazgul Scream ghosting varied by up to 0.9 levels between runs without it; with it, every capture
of TTA's regression check is pixel-identical run to run.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- WindowOptions::hidden (never shown) and captureScene (also PS2X_CAPTURE_SCENE=1): the window presents
into an offscreen picture, captures read it, then it is copied to the window. A hidden or covered
window's back buffer read back black, so captures depended on what was on top of the desktop.
- Renderer::present returns to the framebuffer it was called with instead of 0.
- gl: BlitFramebuffer.
- Material::stencilDepthFail: stencilOp counts where the depth test fails (z-fail), for closed volumes
the near plane cuts or the camera is in.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A state is taken at the top of Dispatcher::run's loop, where no guest code is on
the host stack: memory, the dispatcher, the kernel (threads, frames, queues,
deadlines), every library's state, the native IOP host (memory, tasks, kernel
objects, RPC servers, mixer, libsd) and sections ports add (state::Sections).
Parked library lambdas become data: Resume records and native deadline kinds,
rebuilt from tables on load; ports can add their own kinds. FreeHost serves
requestSave / requestLoad from any thread, rolls back a failed load, and takes
FreeOptions (gameTag, loadState[Frame], saveState[Frame]). Windows get ten slots:
F5 save, F7 load, F6 / Shift+F6 select, and a Save states tab in F2.
989SND's engine and a playing movie are not covered: a save waits, saying why.
docs/save-states.md tells a port how to use and check it; tests/runtime/state_tests.cpp
covers the archive, files and a dispatcher round trip.
Co-Authored-By: Claude Opus 5.5 <[email protected]>