GPL-2.0 patches against RPCS3 v0.0.39 (c5511200d5a8997b5413b37cb3a4860ab3189a63).
Applied in name order by `python -m studio.rpcs3_renderer setup` (git apply).
Every hunk is guarded by #ifdef RR_RPCS3_GLUE (defined only by this glue's
CMakeLists.txt), so the patched tree still builds stock RPCS3 unchanged.
Both verified with `git apply --check` on a pristine checkout of the pinned commit
(2026-11-06).

0001-rr-external-fifo-owner.patch  -- ps3recomp owns the guest, lv2 and vblank
  rpcs3/Emu/Memory/vm.h       vm::g_base_addr/g_sudo_addr/... non-const so
                              rr_vm.cpp can attach ps3recomp's vm_base at runtime.
  rpcs3/Emu/RSX/rsx_utils.h   rsx::constants::local_mem_base becomes a runtime
                              variable (default 0xC0000000; set from the GCM
                              local address). get_location() range non-constexpr.
  rpcs3/Emu/RSX/RSXThread.cpp skip Emu.RunPPU() at RSX start (no lv2 boot) and do
                              not start RPCS3's VBlank thread (ps3recomp's 60 Hz
                              cellGcmTickVBlank stays the vblank authority).
  rpcs3/Emu/RSX/RSXFIFO.cpp   single-word flip marker 0xFEADxxxx (lv1 libgcm and
                              ps3recomp gcm_flip_into_fifo, 0xFEAD0100|buf) is
                              executed as GCM_FLIP_COMMAND(buf & 7).
  Utilities/Thread.cpp        do not install RPCS3's process-wide vectored
                              exception handler / unhandled filter / SIGSEGV
                              handler (the host program owns fault handling).
  (sys_rsx/lv2 event delivery needs no patch: rsx::thread::send_event lives in
   sys_rsx.cpp, which is not compiled; rr_stubs.cpp implements it.)

0002-rr-external-frame.patch  -- window/swapchain target
  rpcs3/Emu/RSX/GSRender.cpp  the GSFrameBase comes from the glue
                              (rr_frame_create() in src/rr_frame.cpp: external
                              HWND via rr_rpcs3_frame_set_hwnd()/RR_RPCS3_HWND,
                              else its own Win32 window) instead of the Qt UI
                              callbacks.

0003-rr-hle-events-invalidate.patch  -- G3 (2026-11-06), bridge v2
  rpcs3/Emu/RSX/RSXThread.h    declares rr_glue_on_flip_done/_flip_queued/
                               _user_command (global) and the public
                               rsx::thread::rr_queue_invalidate(addr, size).
  rpcs3/Emu/RSX/RSXThread.cpp  rr_queue_invalidate merges a range into
                               m_invalidated_memory_range (applied by the RSX
                               thread in do_local_task, cause unmap: guest pages
                               are never protected, so writes are reported);
                               handle_emu_flip calls rr_glue_on_flip_done.
  rpcs3/Emu/RSX/rsx_methods.cpp flip_command -> rr_glue_on_flip_queued;
                               user_command -> rr_glue_on_user_command (the
                               host's handler pump runs the guest callbacks).
  An existing checkout only needs `python -m studio.rpcs3_renderer setup`
  again (already-applied patches are skipped), then `build`.
  Verified with git apply --check after 0001+0002 on the pinned commit.

0010-rr-fifo-skip-ffffffff.patch  -- 2026-11-08 (RR_RPCS3_GLUE)
  rpcs3/Emu/RSX/RSXFIFO.cpp   FIFO_control::read: a lone 0xFFFFFFFF command
                              word is skipped as a NOP (get += 4), as the
                              ps3recomp walker does ("[FIFOUW] unknown word").
                              MotorStorm: Pacific Rift emits such words from its
                              first race frame on (bank+0x48D4 first); RPCS3
                              treated each as a malformed header and killed the
                              RSX thread ("Dead FIFO"). Logs the first 8 as
                              "rr: skipped 0xFFFFFFFF FIFO word at get=...".
                              RR_RPCS3_FIFO_FFFF=error restores RPCS3's
                              handling (then 0008's resync applies).

0012-rr-keep-gpu-sections.patch  -- 2026-11-09 (RR_RPCS3_GLUE)
  rpcs3/Emu/RSX/Common/texture_cache_types.h  rsx::g_rr_soft_invalidate.
  rpcs3/Emu/RSX/Common/texture_cache.h  invalidate_range_impl_base keeps
                              flushable (GPU-written) sections -- blit-engine
                              destinations and WCB framebuffer regions -- while
                              the flag is set, in both the unmap fast path and
                              the general path.
  rpcs3/Emu/RSX/RSXThread.cpp handle_invalidated_memory_range sets the flag
                              when the pending range came only from
                              rr_queue_invalidate (flip / host-write hints);
                              a real unmap or a stopped thread still drops
                              everything. Before, the per-flip invalidation of
                              all local + IO memory (cause unmap) discarded
                              every GPU-produced texture without write-back
                              (guest memory never received it, 0005), so a
                              texture rendered/blitted once and sampled in later
                              frames was re-read from guest memory: black (WCB
                              on) or garbage (WCB off). Also explains the
                              set_memory_flags "region_ptr == nullptr" spam.
                              RR_RPCS3_KEEP_GPU_SECTIONS=0 restores the old
                              behaviour. Paths carry a/ b/ prefixes (git apply).

0013-rr-write-watch.patch  -- 2026-11-10 (RR_RPCS3_GLUE)
  rpcs3/Emu/RSX/RSXThread.h   declares rr_glue_poll_writes(force) and
                              rsx::thread::rr_invalidate_now(address, size).
  rpcs3/Emu/RSX/RSXThread.cpp thread::begin() and do_local_task (outside
                              begin/end, not stopped) call rr_glue_poll_writes;
                              rr_invalidate_now applies one dirty range at once
                              (pending range first, so ranges are not merged
                              into one min/max span) through
                              handle_invalidated_memory_range (soft, 0012).
  Glue side (src/rr_glue.cpp): the guest space is reserved with MEM_WRITE_WATCH
  (ps3recomp runtime/memory/vm.h); GetWriteWatch(RESET) over the IO-mapped main
  memory runs and local memory yields exactly the pages the CPU/SPU wrote since
  the last poll (throttled RR_RPCS3_WW_US, default 250 us; runs closer than
  RR_RPCS3_WW_GAP, default 0x4000, are merged; every flip polls unthrottled).
  The blanket per-flip invalidation is then off unless RR_RPCS3_FLIP_INVALIDATE
  is set explicitly; RR_RPCS3_WRITEWATCH=0 (or a failing GetWriteWatch)
  restores it. Replaces design doc item G4 "write-watch".
  ms-pace-20261111 (glue only): the throttle is adaptive; an empty poll
  doubles the interval up to RR_RPCS3_WW_MAX_US (default 4000 us), a poll that
  finds written pages resets it to RR_RPCS3_WW_US. Draw-heavy frames had spent
  25-60% of the RSX thread in GetWriteWatch scans.

0015-rr-selective-wcb.patch  -- 2026-11-10 (RR_RPCS3_GLUE)
  Read direction without full write_color_buffers. With 0005 there are no CPU
  read faults, so RPCS3 never writes GPU surfaces back; whenever the texture
  cache cannot use a render target directly (format mismatch, clipped/atlas
  "Could not gather textures into an atlas; using CPU fallback", dimension
  mismatch "Cached object ... does not match") it uploads the texture from
  guest memory, which holds stale data: black or streaky 3D.
  rpcs3/Emu/RSX/Common/texture_cache_types.h  rr_wcb_mode() (RR_RPCS3_WCB:
                              unset/auto = selective, 1 = all, 0 = none) and a
                              64 KiB-page registry of surfaces to write back.
  rpcs3/Emu/RSX/Common/surface_store.h  rr_for_each_color_overlapping(range).
  rpcs3/Emu/RSX/Common/texture_cache.h  the CPU-upload fallback of
                              upload_texture and the blit-source CPU upload
                              mark every color surface overlapping the range
                              (log "rr 0015: color surface ... enabling
                              write-back"); discard_framebuffer_memory_region
                              also runs for marked ranges.
  rpcs3/Emu/RSX/VK/VKGSRender.cpp  prepare_rtts locks a color surface as a
                              flushable WCB region only if marked (or WCB=1),
                              so the existing read invalidation before the CPU
                              upload flushes it GPU->memory. Usually one frame
                              is wrong per new surface, then correct. Format
                              incompatibility (force data copy) is already a
                              GPU-side copy and needs nothing. GL backend unchanged.
  Glue: g_cfg write_color_buffers only for RR_RPCS3_WCB=1 (before, any value,
  even 0, enabled it); status line adds runs_local= ww_mb= ww_ms= wcb= wcb_pages=.
  (RSXThread.h/.cpp .orig-0015 copies are unchanged leftovers.)

0016-rr-oob-copy-guard.patch  -- 2026-11-11 (RR_RPCS3_GLUE)
  MotorStorm Apocalypse flip ~241: a B8G8R8A8_UNORM (VK 0x2C) color surface is
  sampled as CELL_GCM_TEXTURE_Y16_X16_FLOAT (0x9F: swizzled, normalized, 4 bpp
  2x fp16), render_target_format_is_compatible() has no case -> force-convert
  GPU copy; right after, 0011 clamps 640x47440 / 768x47616 images to 32768
  rows but callers keep the requested size, so transfer copies wrote past the
  image -> VK_ERROR_DEVICE_LOST (fault: access_write).
  rpcs3/Emu/RSX/VK/VKTexture.cpp  copy_image_typeless skips rects outside
                              src/dst; upload_image clips VkBufferImageCopy
                              regions to the dst mip extent.
  rpcs3/Emu/RSX/VK/VKTextureCache.cpp  copy_transfer_regions_impl skips
                              sections outside src/dst images.
  Logs "rr 0016: ..." (max 16 each). Result: stale texels instead of device loss.

0017-rr-fp-garbage-guard.patch  -- 2026-11-11 (RR_RPCS3_GLUE)
  Demon's Souls: first DRAW_ARRAYS (get 0x82e4) with SET_SHADER_PROGRAM 0x181
  (local 0x180) killed the RSX thread: FPOpcodes.cpp get_operand_count threw
  "Unimplemented BEM class instruction" -- the bytes at the FP address are not
  ucode (not uploaded yet / wrong offset), and one throw ends rendering for good.
  rpcs3/Emu/RSX/Program/Assembler/FPOpcodes.cpp  POW/BEM/TEXBEM/TXPBEM/BEMLUM/
                              TIMESWTEX return 0 operands and log "[rr 0017] FP
                              opcode ..." (max 8) instead of throwing.
  rpcs3/Emu/RSX/RSXThread.cpp  prefetch_fragment_program: RR_RPCS3_FPDUMP=1 logs,
                              for the first 16 distinct program addresses, the EA,
                              first 64 bytes and non-zero count of 512 bytes; on the
                              first one it walks the FIFO from io 0x1000 to GET and
                              lists subchannel!=0 commands (transfer engines),
                              SET_SHADER_PROGRAM and jumps ("[rr 0017] ...").
  (.orig-0017 copies are the pre-patch files.)

0018-rr-fp-placeholder.patch  -- 2026-11-11 (RR_RPCS3_GLUE)
  Demon's Souls: first draw (get 0x82e4) uses SET_SHADER_PROGRAM 0x181 (local
  0x180) before the title has written any ucode there (64 zero bytes, 16 non-zero
  bytes in 512; no transfer-engine command in the FIFO from io 0x1000 to GET).
  analyse_fragment_program scans unbounded for the first opcode / end bit, so the
  garbage was decompiled (illegal opcodes, src reg 2035) and the run died with
  0xC0000005 ~5 s in after 4 flips.
  rpcs3/Emu/RSX/RSXThread.cpp  prefetch_fragment_program probes the program
                              address with a bound (start within 8 KiB, end bit
                              within 64 KiB / end of local memory, no undefined
                              opcode); if it is not ucode the draw uses a NOP
                              program (end bit) and the address is re-probed on
                              every draw until valid ucode appears there.
  Logs "[rr 0018] FP ... is not fragment ucode (...): NOP placeholder" and
  "[rr 0018] FP ... now holds valid ucode after N placeholder draw(s)" (max 16).
  (.orig-0018 copy is the pre-patch file.)

0019-rr-pr-render-wcb-selfwrite.patch  -- 2026-11-11 (RR_RPCS3_GLUE, pr-render-20261111)
  Pacific Rift races: 0015 marked color surfaces 0xc77f0000/0xc79d0000
  (640x360 ARGB8) and 0xc2d95a00 (1280x720) as read through memory; the WCB
  flush writes them into guest memory from the RSX thread, which sets the host
  write-watch bits like a CPU/SPU write, so every poll re-invalidated those
  ranges (texture re-uploads, ww runs/ms climbing in races).
  rpcs3/Emu/RSX/Common/texture_cache_types.h  declares rr_glue_forget_writes().
  rpcs3/Emu/RSX/Common/texture_cache_utils.h  flush(): after imp_flush the
                              confirmed range is passed to rr_glue_forget_writes
                              (glue: ResetWriteWatch on whole pages inside it).
  rpcs3/Emu/RSX/Common/texture_cache.h  CPU-upload fallback: for the first 32
                              overlapping surfaces log "rr 0019: CPU read tex ..."
                              (address, size, WxHxD, pitch, gcm fmt, swizzle, mips,
                              dim) and "rr 0019:   surface ..." (WxH, pitch, bpp,
                              samples_x), i.e. why the RTT path was not taken.
  Glue (src/rr_glue.cpp): rr_glue_forget_writes; a poll hit halves the
  adaptive interval instead of resetting it to RR_RPCS3_WW_US
  (RR_RPCS3_WW_HIT_RESET=1 = old behaviour); status adds ww_self_mb=.
  Note: the 0x9F-from-B8G8R8A8 force-convert is already a bit-exact typeless
  copy (copy_image_typeless + cs_shuffle_32_16 = BE u16 pair), left unchanged.
  (.orig-0019 copies are the pre-patch files.)

0020-rr-cpu-read-writeback.patch  -- 2026-11-11 (RR_RPCS3_GLUE, ms-black3d)
  MotorStorm (BCUS98137): menus show only 2D text/logos, races only the HUD on
  black; status line wcb=2 wcb_pages=0 for the whole run. The 3D frames are
  read by the title's SPUs straight from local memory (0xC0000000+) with DMA
  GETs; 0015 only marks a colour surface for write-back when RSX itself
  reads it through memory (texture/blit CPU fallback), and with no page
  faults (0005) nothing ever flushed a surface for an SPU read.
  rpcs3/Emu/RSX/VK/VKGSRender.cpp  prepare_rtts notes the 64 KiB pages of every
                              bound colour surface (rsx::g_rr_rt_pages,
                              rsx::rr_rt_pages_any) and bumps rsx::g_rr_rt_gen
                              whenever a WCB colour region is locked again.
  Glue (src/rr_glue.cpp): rr_rpcs3_cpu_read(ea, size), called by the runtime
  for every SPU DMA GET while the RPCS3 engine runs (spu_dma.h hook, installed
  by cellGcmSys.c): outside surface pages -> nothing; surface not written back
  -> rr_wcb_mark (0015 locks it from its next bind) and log "rr 0020: SPU reads
  GPU colour surface memory ..." (max 16); written back -> on_access_violation
  (addr, read), the stock fault path: flushes it to guest memory, the SPU
  thread waits for the RSX thread; once per thread per (page, generation),
  log "rr 0020: wrote back ..." (first 8, then powers of two).
  PPU loads have no hook point and are not covered. RR_RPCS3_CPU_READ_WB=0 off;
  RR_RPCS3_WCB=0 also disables it. Old glue builds: cellGcmSys.c links a
  no-op (/alternatename), so the runtime builds with either library.

0021-rr-ww-idle-budget.patch  -- 2026-11-12 (RR_RPCS3_GLUE, infamous-speed-20261112)
  inFAMOUS streets (log 11-12 13:22, ~4-9 fps): ww polls ~2500/s at ~0.24 ms
  each (GetWriteWatch+reset over 133 MB IO + 249 MB local), ww_ms +1.1-1.3 s
  per 2 s status line, with GET == PUT in almost every status line: most polls
  ran from the idle FIFO loop; every hit halved the interval to the 250 us floor
  because the SPUs write job/vertex data all the time.
  rpcs3/Emu/RSX/RSXThread.h    declares rr_glue_poll_writes_idle(bool idle).
  rpcs3/Emu/RSX/RSXThread.cpp  do_local_task calls rr_glue_poll_writes_idle(
                              state == empty || state == spinning) instead of
                              rr_glue_poll_writes(false). begin() is unchanged.
  Glue (src/rr_glue.cpp): idle polls wait >= RR_RPCS3_WW_IDLE_US (default 2000);
  every non-forced poll waits >= cost*(100-B)/B, B = RR_RPCS3_WW_BUDGET percent
  (default 15). Both are capped at RR_RPCS3_WW_MAX_US (4000), the staleness 0013
  already allowed; flip polls stay forced. Status adds ww_idle_skip=.
  RR_RPCS3_WW_BUDGET=0 RR_RPCS3_WW_IDLE_US=0 = previous behaviour.
  (.bak-20261112-infspeed copies are the pre-patch files.)

0022-rr-local-report-area.patch  -- 2026-11-12 (RR_RPCS3_GLUE, gcm-report-layout-20261112)
  GCM conformance audit: RPCS3 writes LOCAL reports (CELL_GCM_CONTEXT_DMA_
  REPORT_LOCATION_LOCAL) at label_addr + 0x1400 + index * 16 -- lv2's
  RsxReports layout, where those 0x8000 bytes belong to the reports alone.
  ps3recomp's GCM window puts other things there: the control register at
  label base + 0x2000 (report 0xC0: timestamp over put/get, value over ref),
  the FIFO callback OPD at +0x2F00 (report 0x1B0) and the guest offset tables
  at +0x3000..0x7000 (reports 0x1C0..0x5BF). On the console the control
  register is its own DMA-control page and the offset tables are libgcm
  allocations, so the reports never meet them.
  rpcs3/Emu/RSX/RSXThread.h    declares u32 rr_glue_local_report_base().
  rpcs3/Emu/RSX/RSXThread.cpp  get_address(REPORT_LOCATION_LOCAL) returns
                              rr_glue_local_report_base() + offset when it is
                              non-zero, else the stock address.
  Glue (src/rr_glue.cpp): rr_rpcs3_start sets the base to label base + 0x20000
  (2048 x 16 = 0x8000 bytes, +0x20000..0x28000, unused in the window) before
  thread::init and logs "[rpcs3-rsx] local reports at 0x...". cellGcmSys.c's
  report getters (gcm_local_report_guest_ea, GCM_RPCS3_REPORT_AREA_OFF) read
  the same block. RR_RPCS3_REPORT_LEGACY=1 (read by glue and cellGcmSys.c):
  label base + 0x1400, the previous behaviour. Semaphores/labels, notifies and
  main-memory reports (0xFEED0001 / 0xBAD68000) are unchanged.
  (.bak-20261112-gcmreport copies are the pre-patch files.)

gow3-stall-20261112 (glue only, no RPCS3 tree change)
  God of War III / Ascension stalled with the RSX parked on a jump-to-self
  (SET_REFERENCE n + JUMP to its own offset) and the main thread in a
  sys_timer_usleep loop on a per-frame u16 flag. The titles' user handler
  calls a completion method on the object pointer passed with each
  cellGcmSetUserCommand; the glue kept only the last user arg between two
  polls (g_user_arg), so completions were lost. src/rr_glue.cpp now queues
  every user command (1024) and exports rr_rpcs3_pop_user_command(); the
  cellGcmSys.c pump delivers each in order. RR_GCM_USER_COALESCE=1 = old
  behaviour. (.bak-20261112-gow3stall copies are the pre-change files.)

0023-rr-tex-surface-resolve.patch  -- 2026-11-13 (RR_RPCS3_GLUE, tex-surface-20261113)
  Twisted Metal (log 11-12 22:49, black at ~8 fps): 32x "rr 0019: CPU read tex
  0xc1190000 (+0x6dd800) 1280x703 pitch=10240 fmt=0x85 ... overlaps surface
  0xc1191400 (+0x6dec00) 1280x704 pitch=10240 bpp=4". The final pass samples
  the scene target as a texture that starts 0x1400 bytes (half a pitch row)
  below the surface; RPCS3's overlap search places the surface at x=1280 of a
  1280-wide texture (fully clipped) and falls back to a CPU upload of memory
  the GPU never wrote back -> black.
  rpcs3/Emu/RSX/Common/texture_cache.h  upload_texture, just before the CPU
    upload: a 2D, linear, single-mip texture of a render-target colour format
    (A8R8G8B8, D8R8G8B8, R5G6B5, A1R5G5B5, B8, G8B8, X32_FLOAT, W16..X16_FLOAT,
    W32..X32_FLOAT) that overlaps a 1-sample colour surface with the same pitch
    and texel size whose start is less than one pitch away is resolved from
    that surface (process_framebuffer_resource_fast, size clamped to the
    surface; a copy when sizes differ or the surface is bound). Logs
    "rr 0023: tex ... resolved from GPU surface ..." (first 16). DXT,
    swizzled, mipmapped, 3D/cube and other formats keep the CPU path.
  RR_RPCS3_TEX_SURFACE_LEGACY=1 = previous behaviour.
  MotorStorm (21:24) and Killzone 2 (00:56) newest logs have no rr 0019 line:
  not affected. Pacific Rift's DXT case is excluded by format.
  (.bak-20261113-batch copies are the pre-patch files.)

0024-rr-fb-acquire-why.patch  -- 2026-11-13 (RR_RPCS3_GLUE, diagnostics only)
  rpcs3/Emu/RSX/RSXThread.cpp  get_framebuffer_layout: after "Framebuffer setup
    failed" logs "rr 0024: fb fail ..." (first 24): context, clip, target,
    colour format, colour write masks, raw colour/zeta addresses and pitches,
    depth test/write/func, stencil, which side was judged unused, scissor
    width, raster type. (inFAMOUS 2: 39 failures in triplets; the log had no
    reason line.)
  rpcs3/Emu/RSX/NV47/HW/nv406e.cpp  semaphore_acquire: once per address after
    1 s of waiting, "rr 0024: semaphore_acquire waiting >1s: addr ... (offset,
    ctx dma, label base) has X want Y". (Killzone 2 waits on label 0x490 for
    minutes and never logs RPCS3's own timeout.)
  No behaviour change; nothing to opt out of.
  (.bak-20261113-batch copies are the pre-patch files.)

batch-20261113 (glue + workspace cellGcmSys.c, no RPCS3 tree change)
  src/rr_glue.cpp: status line adds user_q=<retired by RSX>/<popped by pump>;
    first 16 retired user commands logged with their arg.
  ps3recomp libs/video/cellGcmSys.c (workspace copy): every host-view line
    adds "[cellGcmSys] user_q queued= delivered= dropped= pending= handler=";
    first 16 deliveries logged; when the RSX sits on a jump-to-self, the 64
    words before it are dumped once per park address (max 4; RR_GCM_PARKDUMP=0
    off); the VBlank handler's OPD code word is logged on first call and on
    any change vs SetVBlankHandler's ("MISMATCH"). Log only.
  (.bak-20261113-batch copies are the pre-change files.)

0025-rr-tex-unmapped-skip.patch  -- 2026-11-13 (RR_RPCS3_GLUE)
  rpcs3/Emu/RSX/Common/texture_cache.h  upload_texture: before get_address,
    a texture whose offset is not mapped (main: no IO page; local: past local
    memory) returns an empty descriptor (sampled as unbound, like a disabled
    texture) and logs "rr 0025: texture offset=... not mapped; skipped"
    (first 32). Used to throw "RSXIO memory not mapped!" and terminate the RSX
    thread (inFAMOUS 2: offset 0x7FFFFFFF, location 1, texture_cache.h:2309).
  RR_RPCS3_TEX_UNMAPPED_FATAL=1 = previous behaviour (fatal).
  (texture_cache.h.bak-20261113-r2tex is the pre-patch file.)

0026-rr-acquire-commit-flipget.patch  -- 2026-11-13 (RR_RPCS3_GLUE)
  rpcs3/Emu/RSX/NV47/HW/nv406e.cpp  semaphore_acquire: once satisfied
    (immediately or after waiting) publishes ctrl->get past the acquire's
    argument, at the next command header. Before, RPCS3 published get only
    inside the acquire's flush_fifo, at the ARGUMENT word, so host views and
    restore points taken there named a data word (Killzone 2: get=0x2C5F8,
    the arg of the acquire at 0x2C5F4). Logs "rr 0026: acquire ... satisfied"
    with arg io, ctrl.get, put, ref, restore_point (first RR_RPCS3_ACQGET_N,
    default 16).
  rpcs3/Emu/RSX/rsx_methods.cpp  flip_command: "rr 0026: flip #n before/
    after" with fifo pos, ctrl.get, put, ref, restore_point (first
    RR_RPCS3_FLIPGET_N, default 16).
  rpcs3/Emu/RSX/RSXFIFO.cpp  the 12 methods / JUMPs run after each of those
    flips: "rr 0026: after flip #n: method ... / JUMP at io ... -> ...".
  rpcs3/Emu/RSX/RSXThread.cpp  recover_fifo: "rr 0026: recover_fifo: pos
    ctrl.get -> restore_point (last cmd, caller)" (first 24). Recoveries
    from an args fetch failure rewound get without any log line.
  Investigation (Killzone 2): no code in the glue, cellGcmSys.c or patches
  0001-0025 saves and restores get around the acquire or the FEAD flip. The
  0x2C5F8 value is the stale publish described above; it does not prove the
  stream was rewound. The KZ2 log has no RPCS3 line at all (no shader
  compiled), so the RSX never draws. The new lines show where the stream
  goes after each flip.
  RR_RPCS3_ACQ_COMMIT=0 = previous get publishing; the logs are log-only
  (RR_RPCS3_ACQGET_N=0 / RR_RPCS3_FLIPGET_N=0 silence them).
  (*.bak-20261113-r3fix copies are the pre-patch files.)

0027-rr-acquire-selfblock.patch  -- 2026-11-13 (RR_RPCS3_GLUE, opt-in)
  rpcs3/Emu/RSX/NV47/HW/nv406e.cpp  semaphore_acquire: with
    RR_RPCS3_ACQ_SELFBLOCK=1, an acquire still waiting after 2 ms scans the
    command stream ahead of get (up to put, following JUMPs, stopping at
    CALL/RETURN or an unmapped page). If an NV406E SEMAPHORE_RELEASE, an
    NV4097 TEXTURE_READ_ or BACK_END_WRITE_SEMAPHORE_RELEASE of exactly the
    wanted value to the same address is queued there, it resolves the acquire:
    "rr 0027: self-blocking acquire ... queued ahead at io ... -> resolved"
    (first 16). Otherwise it logs "no matching release queued ahead" (first 8)
    and waits as before. Once per acquire.
  For God of War III: label 0x510 always wants have+1 and RPCS3 sits out its
  1 s timeout each frame. On by default only for 687f0dc67764
  (launch-env/687f0dc67764.json). Unset or 0 = off (the default for every
  other title).
  (nv406e.cpp.bak-20261113-r3fix is the pre-0026 file.)

0028-rr-tex-rt-refresh.patch  -- 2026-11-13 (RR_RPCS3_GLUE, pr-race-20261113, opt-in)
  Pacific Rift first race log (18:18): the only race-specific CPU-path texture
  is a linear B8 2048x2048 (12 mips, +0x7ff800) at 0xc6680000 whose memory
  holds the HDR luminance chain (320x180 x3, 16x16 FP16 bpp=8, 8x8). 0015
  marked those surfaces for write-back, but ww_self_mb stayed 0: no flush
  ever ran, because the exact-match shader_read lookup kept returning the
  first (stale) upload -- with no page faults (0005) nothing dirties a CPU
  section when the GPU later renders into its memory. Exposure from stale
  memory -> washed-out race picture (hypothesis, see report).
  rpcs3/Emu/RSX/Common/texture_cache.h  CPU upload: remember linear uploads
    that overlap a colour surface (base -> rsx::get_shared_tag()); exact-match
    lookup: if an overlapping colour surface has last_use_tag newer than that,
    set the section dirty and fall through, so the CPU path re-runs its read
    invalidation (flushes the WCB surfaces) and re-uploads. Logs "rr 0028:
    CPU texture ... re-uploading" (first 16).
  RR_RPCS3_TEX_RT_REFRESH=1 enables it; unset/0 = previous behaviour. On only
  for 489acc0ca2ba (launch-env). (texture_cache.h.orig-0028 /
  .bak-20261113-prrace are the pre-patch file.)

res-scale-rpcs3-20261113 (glue only, no new patch; 0029 still free)
  rr_glue.cpp apply_config() sets g_cfg.video.resolution_scale_percent from
  RR_RES_SCALE (percent, clamped 50..400) or RR_RES_TARGET=WxH (vs native
  1280x720; 1920x1080 = 150%). Logs "[rpcs3-rsx] render scale N% (from ...)".
  min_scalable_dimension is set to RPCS3's default 16 (RR_RES_MIN_DIM overrides)
  so tiny post-effect targets stay unscaled. RR_RES_SCALE=100/unset = stock 1:1.
  Reviewed vs scaling: 0015/0019/0020 write-back and CPU reads use RPCS3's own
  flush/download path (scaled -> native in guest memory); rr_rt_pages is keyed
  by guest memory ranges; 0023 passes guest-pixel dims into
  process_framebuffer_resource_fast, which applies the scale itself; 0028 only
  triggers re-uploads. No patch assumes 1:1, so nothing is disabled.
  On for 8f2702e56964 (Folklore, RR_RES_SCALE=150).

0029-rr-fead-single-word.patch  (kz2-stream-20261113)
  rpcs3/Emu/RSX/RSXFIFO.cpp  0001's 0xFEADxxxx flip marker did get += 4 and then
    run_FIFO's read_unsafe() stepped another word, so the word right after every
    marker was skipped. KZ2 (0aeec16ffca9) puts NV4097 0x220 at io 0x2c610 right
    after its marker; its arg 0x1 then executed as JUMP 0x0 -> stale io 0x1000 ->
    0x10000 -> ... -> back to the acquire at 0x2c5f8, every frame: SET_REFERENCE 2
    at io 0x11000 was never reached, ref stayed 1, PPU spun at 0x471C8, no draws,
    black screen. The marker now consumes one word (as ps3recomp's walker does).
  RR_RPCS3_FEAD_SKIP2=1 restores the old two-word skip. (RSXFIFO.cpp
  .bak-20261113-kz2stream is the pre-patch file.)

0030-rr-tex-rt-resample.patch  -- 2026-11-13 (RR_RPCS3_GLUE, pr-race-20261113b)
  Pacific Rift 20:45 run with 0028 on: no "rr 0028" line. The B8 alias
  texture is uploaded once and its sampler registers never change, so VKDraw
  (m_samplers_dirty / m_textures_dirty / check_surface_cache_sampler) never
  calls upload_texture again and 0028's lookup hook is never reached.
  rpcs3/Emu/RSX/Common/texture_cache.h  0028 uploads also widen a bounding
    range (rsx::g_rr_rt_alias_lo/hi).
  rpcs3/Emu/RSX/VK/VKGSRender.cpp  prepare_rtts: binding a colour surface
    inside that range sets m_samplers_dirty, so the next draw re-looks-up its
    textures and 0028 can re-upload. Logs "rr 0030: ..." (first 8).
  Active only with RR_RPCS3_TEX_RT_REFRESH=1; RR_RPCS3_TEX_RT_RESAMPLE=0 =
  0028 alone. (*.orig-0030 / *.bak-20261113-prrace2 are the pre-patch files.)
