200 Commits
Author SHA1 Message Date
Brian Degenhardt 7668167aa1 Counters: mark the savestate poison-repair blocks DELETEME after 2026-12-01
The load-time repairs in rcntFreeze/psxRcntFreeze exist only to heal .p2s
files saved by builds that predate the trigger fix (9f6288531d, 2026-08-09).
No new state can carry the scar, so once old states have aged out the loops
can simply be deleted; the sync-time guards stay.
2026-08-09 10:03:57 -07:00
Brian Degenhardt abe076fb2c Counters: warn loudly when a counter baseline sits ahead of the clock
The baseline-ahead guards added in 4e34e65b84 silently skipped the sync.
Post-fix, that condition is unreachable for ungated counters unless the
CPU clock itself moved backwards — which is exactly the signature of the
cross-thread nextEventCycle race that poisoned God of War II savestates
(fixed in the previous commit), and of any future clock-regression bug.
A silent skip would hide the next one; a console warning is what let the
exit-storm repro pinpoint this one.
2026-08-09 10:01:37 -07:00
Brian Degenhardt 4e34e65b84 Counters: fix u32 blowup when a counter baseline sits ahead of cycle
rcntSyncCounter computed (cpuRegs.cycle - startCycle) / rate into a u32.
With 64-bit cycle counts, a baseline even one cycle AHEAD of now (a
transient state around savestate thaw and vsync-retime seams) underflows
the subtraction, and the truncated quotient becomes change=0xFFFFFFFF:
count += 0xFFFFFFFF and startCycle += 2^32 - rate, zero-extended into the
u64. The counter is then dead until cycle crosses the bogus baseline
(14.6s at EE clock), and the blown-out count drains at one overflow lap
per pass for minutes afterwards - and the scar rides along in every
savestate taken meanwhile. psxRcntSync had the identical pattern, where
one epoch is 116.5s at IOP clock.

This is the God of War II poisoned-savestate bug: the area-title banner
stays stuck and gorgon-eye chest pickups freeze for ~6 minutes after
loading an affected state, on every host that loads it. A poisoned state
carries EXACTLY startCycle = (cycle & ~(rate-1)) + 2^32 on EE timer 0,
byte-for-byte the arithmetic above. A/B from that state: 1200 frames on
the old code still shows the stuck banner; with this change it clears.

Guard the negative case (skip the sync; the counter resumes within one
tick), widen change to u64, and repair poisoned baselines/counts when
thawing a savestate so existing affected saves heal on load.
2026-08-09 08:26:17 -07:00
jpolo1224 de7ec8509c GS: 20:9/19.5:9/custom aspect, interlace+presentation policies, VK feedback flags
Aspect ratios: added 20:9, 19.5:9 and a user-entered Custom ratio
(GSOptions::CustomAspectRatio, clamped 0.5..5.0). All APPENDED, never inserted —
these values are persisted as raw ints in the ini and in the Android prefs, so
slotting one in mid-enum would silently repoint every saved config at a different
ratio. Also filled in the two ultrawide cases RequestDisplaySize was missing.

Interlace/presentation: ported sashkinbro's EmuCoreX 30799e4. SelectGSInterlaceMode
centralises the mode choice and keeps shader_mode -1 for automatic full-frame output
(a deinterlace pass must not run over progressive output during a video-mode
transition); our formula already agreed, so this is centralisation plus
static_asserts rather than a behaviour change. ShouldSkipAndroidBlankFrame is new
behaviour: Vulkan now suppresses only the startup blank, so a mid-game fade reaches
the normal present path and its recorded command buffer is submitted.

Vulkan: declare the attachment feedback loops on the PIPELINE, not just on the image
layout and render pass. We put attachments into FEEDBACK_LOOP_OPTIMAL without ever
setting VK_PIPELINE_CREATE_{COLOR,DEPTH_STENCIL}_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT,
which the spec requires — undefined behaviour rather than a missed optimisation, and
strict mobile drivers are where undefined shows up as stale attachment reads.
2026-07-30 01:09:12 -04:00
jpolo1224 c553aa8acb GS: add a 21:9 aspect ratio
Requested by David (SSR), who noted no PS2 emulator offers one: without it the
only way to use an ultrawide patch was Stretch, which distorts. Useful on folds,
tablets, DeX and anything driving a 21:9 panel.

Added to the generic aspect AND the FMV override, since a game that wants
ultrawide gameplay usually wants it during cutscenes too. Adding it to the FMV
enum also shifted MaxCount, which the name array is sized from -- that array had
to grow with it or the last entry would have been a hole.

The Kotlin side needed SIX edits for one new enum value, and getting five of them
right still left the feature completely dead:

  RendererTab       options list + clamp
  RendererTab       FMV options list + clamp
  EmulationMenu     setAspectRatio clamp
  EmulationMenuScreen  the pause menu's own options list
  Settings          NativeApp.setAspectRatio(coerceIn(0, 4))   <-- the killer
  Settings          INI name<->index, both directions

That fifth one clamped on the way to the core, so the picker highlighted 21:9
while the emulator was told 10:7 -- UI correct, nothing happens, no error. The
sixth meant the choice would not have survived a reload even once it applied.

The NATIVE clamp needed no change at all, because it derives its bound from
AspectRatioType::MaxCount instead of hard-coding it. That is the pattern the
Kotlin side should follow; four literal 4s in four files is why this was a
six-site change instead of a one-site one.
2026-07-28 12:49:30 -04:00
jpolo1224 8e23439b26 Android 2.6.5: Adreno Vulkan default, low-latency default, UI sounds, RA client hardening, GameDB
Rendering
- Auto renderer now resolves to Vulkan HW on Adreno (OpenGL elsewhere).
- Mobile hardware ROV (Phase 0): tile-native depth feedback behind the ROV toggle.

Performance & input
- Low Latency frame pacing is the default on capable devices, with a one-time
  migration for existing installs; low-end devices keep the queued pacing.
- Reduce Android input latency and improve input handling (PR #403, Splaser).
- Experimental CPU clock hint (ADPF) toggle in Performance settings (default off).

Audio & UI
- Pop-up open/close sound cues (info, hardcore confirm, patches & cheats).
- Alternating controller navigation / slider tick sounds.

RetroAchievements
- Inject the RA client version from a build-time secret kept out of public source,
  with a stock-PCSX2 fallback (no hardcore) for secret-less builds. Applies to the
  iOS client token too. Prevents third parties from copying our User-Agent.

Game compatibility
- Delta Force: Black Hawk Down (SLUS-21124 / SLES-53299) GameDB fixes
  (PR #401, XDarkFallenX).
2026-07-24 02:40:17 -04:00
Brian Degenhardt 4ca00c6088 EE counters: clamp T_COUNT reads until the boundary interrupt is delivered
NFL 2K5 (SLUS-20919) hangs at the boot logo in a 64-bit divide-by-repeated-
subtraction with a huge unsigned dividend. Its 64-bit clock is an overflow-
ISR-maintained wrap accumulator plus a live T0_COUNT read (bus/16, OVFE),
reconciled lock-free with double reads — airtight on hardware, where the
count wrap and the overflow interrupt are the same edge and the ISR preempts
before any later read.

Under the JIT the guest can observe the wrap while the ISR's effects are
still pending, in two phases: (1) the count (derived from the live
cpuRegs.cycle) crosses the boundary before the scheduled rcntUpdate event
runs; (2) rcntUpdate has wrapped the count and raised the INTC, but the
exception waits for the next event test — which our static-linked /
short-block tails defer past the reader's entire load sequence (traced live:
the wrap event fires at the reader's own block-entry event test, and
delivery lands at its jr-ra exit, 30 cycles too late). Either way the game
reads stale-accumulator + wrapped-count, time goes backwards one wrap
period, and the divide runs ~2^48 iterations.

Clamp the read to just-before-the-boundary until the interrupt has actually
been delivered. The deliverability guard (INTC pending & unmasked & Status
EIE/IE, no EXL/ERL) makes this exact: inside the handler or with the source
masked (e.g. the game's DisableIntc reader, which reconciles the raw wrap
itself) the wrapped count stays observable, as on hardware.

Pinned by EeTimerCountReadRace.* in recompiler_tests. Verified live: cold
fastboot reaches attract; previously parked at the divide loop within ~20s.
2026-07-19 00:20:01 -07:00
refractionpcsx2 539357436c Build: Clean up a few warnings 2026-05-08 18:17:31 +02:00
Ziemas f576962dd8 EE: Switch to 64 bit cycle counter
[SAVEVERSION+]
2026-03-07 09:28:55 -05:00
SternXD d983b2b066 Copyright: Change year from 2002-2025 to 2002-2026 2026-01-15 00:22:32 +01:00
Ty d5ddf07958 Counters: u32 implicit cast warning fix 2025-11-24 18:07:25 -05:00
TellowKrinkle 8fd91cb7df Formatting: Apply AlignWithSpaces 2025-07-31 15:20:27 +02:00
TheTechnician27 23fd57f641 Copyright: Change year from 2002-2024 to 2002-2025 2025-01-20 05:07:26 +01:00
KamFretoZ 424951e1bb Logging: Adjust the formatting to be more consistent 2024-12-28 11:25:26 -05:00
Ty Lamontagne ab21d22514 Misc: wire up and refactor trace logging 2024-10-19 20:04:02 -04:00
crashGG 6c3cf12df6 GS: Add a 10:7 pixel ration option 2024-09-25 11:46:09 -04:00
GovanifY 132431b7c8 headers: relicense to GPL-3.0+
also update to 2024 while i'm at it
2024-07-30 17:17:13 -04:00
refractionpcsx2 566ea8ea9b Core: Refactor a lot of timer work and fix a couple of bugs
EE/IOP Timers: improve clock sync, disable v/h sync when SINT enabled.

Some changes based on tests from PS2

[SAVEVERSION+]
2024-05-15 10:54:26 +01:00
refractionpcsx2 3b63445f07 Timers: Fix up some timer behaviour 2024-05-02 09:07:09 +01:00
refractionpcsx2 5f7c2b7cd8 EE/IOP Timers: Rewrote most of the gate handling to be better.
[SAVEVERSION+]
2024-04-29 17:25:51 +01:00
refractionpcsx2 4363255234 EE/Timer: Don't reset count on setting gate 2024-04-29 17:25:51 +01:00
Stenzek 77a6525556 Counters: Move input poll to after throttle 2024-01-27 13:29:55 +10:00
Stenzek fa00069068 Console: Remove WX rubbish and replace 2024-01-12 12:40:46 +10:00
Stenzek f388de26ab GS: Refactor renderer switching
- Fix automatic renderer causing delay when changing settings.
 - Make the Debug -> Switch Renderer menu actually save.
2023-12-31 19:17:43 +10:00
Stenzek d9abe10308 Misc: Remove explicit PCH include, switch to SPDX 2023-12-24 14:03:14 +10:00