Commit Graph

70 Commits

Author SHA1 Message Date
Dipshet a353f9d7aa Write a crash report naming the guest instruction when the game dies
Any fatal event now writes one self-contained crash-<timestamp>.txt -
guest call stack, registers, a guest-versus-host verdict on the faulting
address, modules and the log tail naming rex_sub_* frames with no symbols.
2026-08-09 01:02:33 +02:00
Dipshet 98020a02b2 Fix lines on open waters seen at an acute angle (undefined shader derivatives)
The water shader's wave-normal lookup sits inside control flow this translator
generates from the guest's predication and jumps, where DXBC derivatives are
undefined: the gradient collapses to zero along the ocean mesh's seams, the LOD
clamps to the finest mip, and grazing Fresnel amplifies that into a bright line.
Computing the gradients in the prologue, where the quad is uniform, restores them.
2026-08-08 20:12:28 +02:00
Dipshet 07d09128e6 Silence the Alt+key system beep (unhandled WM_SYSCHAR)
While Alt is held every keypress arrives as WM_SYSKEYDOWN->WM_SYSCHAR,
and an unhandled WM_SYSCHAR reaching DefWindowProc on a menu-less
window triggers MessageBeep which causes camera panning on KB+M dinged constantly.
Consume it (and answer WM_MENUCHAR with MNC_CLOSE) when the window has
no menu.
2026-08-07 23:29:53 +02:00
Dipshet 42b6ab3b85 Hide the free cursor after idle (default 3 s)
Hide the free cursor after idle (ac6_cursor_hide_seconds, 3 s)
The free cursor now disappears after N seconds without motion and
returns instantly on motion or a button. Never hides while an overlay
is on screen (new DialogsVisible presence flag). Default 3 s, 0 = never, live.
2026-08-07 23:28:19 +02:00
Dipshet 4ca74fd107 Add keybind F11 to toggle fullscreen
Records the choice through the same user_value
path as a settings-menu edit.
2026-08-07 23:24:01 +02:00
Dipshet 90c1ef45ff HD terrain: draw the full shipped terrain resolution (ac6_terrain_hd, on)
The game ships 2x the terrain height samples it ever draws; its terrain
vertex shader is fully data-driven, so a synthetic full-density ring table
(vertex fetch constant 95 redirect) plus a matching fan emission make the
unmodified shader express every sample - no more terrain cracks ("rifts"),
true river beds.
2026-08-07 16:42:20 +02:00
Dipshet 93c6dba3ff Stop a controller disconnect/reconnect from closing the game
A failed SDL_OpenGamepad on hot-plug hit assert_always(), which is fatal in release: one transient open failure on reconnect closed the game.
The axis/button handlers also dereferenced the controller-index optional unchecked, so orphan pad events were UB -> std::terminate.
Now a failed open logs a WARN and returns; the pad retries on its next ADDED event. Orphan events are dropped with a rate-limited WARN.
2026-08-06 21:14:10 +02:00
Dipshet cf6000c0f6 Tag the WASAPI render stream GameEffects so media apps stop muting the game
Windows auto-mutes AudioCategory_GameMedia render streams whenever a Store media app (Screenbox, Windows' modern Media Player) plays music. Our single WASAPI stream carries the entire premixed game output, so the whole game fell silent. GameEffects is the category Windows games run as by default..
2026-08-06 18:29:44 +02:00
Dipshet 201a4038ea Revert "Guard XMA loop handling against degenerate loop metadata"
This reverts commit 466cac7c00.
The guard's reject test (loop_start >= loop_end) also matches a legitimate
"loop from start" encoding, so it suppressed real BGM metadata loops and
playback ran past the loop point.
2026-08-06 17:03:49 +02:00
Dipshet deb406bdb0 Fix cvar preset timing and settings-save leaks; tidy the cvar surface
Config presets now run after the toml loads: the ac6_fix_* switches and
their scale gates finally honor user settings. The settings save persists
only user-set values, with toml escaping - no leaked presets, and a saved
Windows path can no longer void the whole config. Runtime-forced values
(performance mode) can no longer overwrite the user's saved choices.
Menu: wrapped tooltips, "(set by <cvar>)" on driven entries, a developer
toggle; AC6-added cvars grouped under the AC6 node as AC6/Fixes and
AC6/Enhancements, with true restart/live lifecycles.
2026-08-06 15:46:15 +02:00
Dipshet 9b81d7b7e6 Mount the game from a .iso and DLC from raw containers directly
The game now mounts straight from a .iso beside the exe (selected by
title id; the assets folder still wins, and loose files layer over the
image so mods need no extraction), and DLC mounts straight from raw
STFS containers in a dlc folder, any layout, title updates ignored.
Disc image device ported from Xenia (BSD); one log line per source.
2026-08-06 02:37:42 +02:00
Dipshet 33c2cf60cc Fix overlay input leaking into the game: explicit input ownership
Interacting with the overlays also drove the game (clicks fired
weapons, scroll cycled them, keys leaked), and hovering one silenced a real
pad. Input now follows window-manager rules, mouse to the window under the
cursor, keyboard to the focused window, real pads never suppressed, via
ImGui capture flags conjoined with overlay visibility, published as atomics.
2026-08-06 00:43:34 +02:00
Dipshet de2527ade5 Revert "Fix doubled cutscene dialogue: fold only the fronts while a cutscene plays"
This reverts commit edcb6314f2b1b06e70dbb214674eb7c2325f8ab1. The fold was a mitigation: the doubling was never in the assets but came from the decoder dropping straddled-header frames, letting the premix streams drift and comb. With the decode fixed at the root, the full summing fold is clean and cutscenes regain centre and rear content.
2026-08-05 20:31:37 +02:00
Dipshet 5ca3b24c62 apu: guard the XMA loop-end frame test against degenerate loop metadata
The loop-end test runs before UpdateLoopStatus, so the degenerate-loop guard there never reaches it. With loop_count > 0 and loop_start >= loop_end, the clamped loop end equals the start offset of the stream at packet 0, arming the frame output limit and silently truncating 384 samples from its first frame. Cvar audio_xma_loop_end_guard, default on.
2026-08-05 20:29:34 +02:00
Dipshet ad7be62321 apu: decode XMA frames whose 15-bit header straddles a packet boundary
The frame walk treated fewer than 15 remaining bits as end-of-chain, but a frame starting there is real: its header continues in the next packet, as the encoder's own seek ledger confirms. Each one was silently dropped, so a premix's parallel streams drifted apart in 512-sample steps and doubled on the fold. Cvar audio_xma_header_straddle_fix, on.
2026-08-05 20:26:02 +02:00
Dipshet edcb631442 Fix doubled cutscene dialogue: fold only the fronts while a cutscene plays
AC6's cutscene mixer submits its 5.1 premix to all six speaker slots as decorrelated near-copies of one mix; six real speakers separate them acoustically, but the port's 6→2 fold sums them, combing speech into the long-reported doubled dialogue. While the demo sequencer ticks, fold only the fronts (verified lossless). audio_cutscene_downmix (default on).
2026-07-31 04:25:30 +02:00
Dipshet 466cac7c00 Guard XMA loop handling against degenerate loop metadata
Streamed voices carrying degenerate loop metadata (loop_count 0xFF with loop_start == loop_end == 0) re-fired the loop machinery on every input buffer swap, truncating or skipping subframes of the stream. Require a real loop window (loop_start < loop_end, read_offset ≥ loop_end) before engaging, as in Xenia PR #1808. 47 confirmed fires in AC6; default on.
2026-07-31 04:24:07 +02:00
Dipshet 8c922abd77 Preserve the XMA stream timeline across undecodable frames
A frame the decoder backend rejects advances the read offset but emitted nothing, silently shortening that stream by 512 samples, permanent desync for multi-stream sources (5.1 premixes as parallel stereo XMA). Emit the frame as silence instead so the timeline holds. Robustness: no in-game trigger known in AC6. audio_xma_preserve_timeline (default on).
2026-07-31 04:23:20 +02:00
Dipshet 23e463737c Fix cutscene depth-of-field striping and ghosting at render scale > 1
The cutscene DoF chain is authored for the 640×360 guest grid; at render scale > 1 its guest-granular blur kernels alias against host-granular content, visible as streaks and ghost outlines. Fix: snap the two CoC pre-blur passes to guest texel centers and densify the two 13-tap gather passes per axis. Hash-allowlisted, behind ac6_fix_dof (on), inert at 1x.
2026-07-31 03:58:29 +02:00
Dipshet cc9d8aa54e Add ultrawide support: hor+ in missions
ac6_widescreen = true (default false), renders missions at the window's aspect ratio (hor+) by patching the game's per-camera aspect data, so FOV, culling and every camera follow. Menus, hangar, briefing and FMV revert to 16:9 and letterbox. The HUD is pre-squeezed at  draw time to stay crisp, and marker art is squared without moving the aim points. ac6_widescreen_cinematics enables it in in-game cutscenes(default true, gated).
2026-07-29 04:35:39 +02:00
Dipshet e44fc2266c Fix Japanese language: honor console language/region config
XGetLanguage and the XConfig language/country reads now follow the
user_language / user_country cvars instead of hardcoding English.
XGetGameRegion follows a new game_region cvar, defaulting to auto:
it reports 0x1FF when Japanese is selected, else region-free 0xFFFF.
Set user_language = 2 for full Japanese text and voice; defaults are unchanged for English.
2026-07-16 14:48:25 +02:00
Dipshet dfd8b92a5b D3D12: Fix CONSTANT_ALPHA blend factors collapsing onto constant RGB
The D3D12 PipelineBlendFactor enum had no constant-alpha entry, so the Xenos
CONSTANT_ALPHA and ONE_MINUS_CONSTANT_ALPHA blend factors (14, 15) were mapped
onto the constant-COLOR kBlendFactor / kInvBlendFactor - i.e. D3D12 BLEND_FACTOR
/ INV_BLEND_FACTOR, which use the blend constant's RGB rather than its alpha.

Aircraft ground shadow blends with dst = ONE_MINUS_CONSTANT_ALPHA and aSTANT_ALPHA blend factors collapsing onto
blend constant of (0.03, 0.04, 0.04, 0.30): it wants 1 - 0.30 = 0.70 (scale the
background down -> darken), but got 1 - (0.03,0.04,0.04) ~= 0.97 (barely scaled)
with the white source added on top, so the shadow BRIGHTENED instead of
darkening - the "white shadow" bug. Vulkan has the distinct
ONE_MINUS_CONSTANT_ALPHA factor and renders it correctly.

Add kBlendFactorAlpha / kInvBlendFactorAlpha to the enum, route factors 14/15 to
them in both the colour and alpha maps, and map them to D3D12 ALPHA_FACTOR /
INV_ALPHA_FACTOR. Verified fixed on both the RTV and ROV render-target paths.
2026-07-15 02:03:35 +02:00
Dipshet 5425126dd2 Fix IDOLM@STER DLC not activated
AC6's colour/skin DLC packs ship a PARTIAL per-colour license bitmask in their STFS header (e.g. PACK09 = 0x5f, PACK02 = 0x0f). The game hides every colour whose bit is clear, which left most of the IDOLM@STER skins missing from the selection screen.
2026-07-14 23:47:10 +02:00
Dipshet dd106a2f20 Added build-stamp watermark
Extract the build watermark into its own BuildStampOverlay (rex/ui/overlay/build_stamp_overlay.*), a non-interactive drawer in the lower-left corner - independent of the F3 debug overlay. It stamps the short git commit hash (REXGLUE_GIT_HASH, captured by CMake via git rev-parse --short HEAD -> version.h; re-run cmake to refresh) via REXGLUE_BUILD_HASH_STAMP, instead of the build date. Drawing is gated by the show_build_stamp cvar (category UI, default true) so players can hide it; registered next to the other built-in overlays in rex_app.
2026-07-14 20:37:15 +02:00
Dipshet 97906a6d4e Shader disk cache: fix mission-start pipeline-compile
Xenia's pipeline disk cache (record + pre-create at launch) was built but never triggered, so pipelines compiled on-demand mid-gameplay every run. Wire InitializeShaderStorage after module launch: pre-create recorded pipelines during load, record new ones. New cvar use_shader_disk_cache (default on); cache at ./cache/shaders/.
2026-07-14 20:23:27 +02:00
Dipshet 6dc4120790 Added modern present pacing + dt-snap: smooth fps unlock
Guest swap thread blocks on real GPU delivery (NotifyGuestPresent feeds the delivery counter) + an absolute-deadline limiter at ac6_fps_target, not the vblank grid (no sub-harmonic staircase). dt-snap locks the sim delta to the exact target at steady rate (kills the shake). Guest vblank forced to free-run during gameplay so pacing needs zero config. ac6_unlock_fps is the single master switch, ON by default (folded in timing-hooks/vblank-auto/delta-precision/dt-snap-tolerance AND the flight-model framerate-independence fix).
2026-07-14 20:20:23 +02:00
Dipshet 9603fb84d0 Added F3 debug overlay: FPS counters, frametime graphs
FPS/frametime counters (avg 0.5s), two fixed-time-interval frametime graphs (fps-independent, spikes preserved), present-wait metric (rex/ui/present_stats.h). Guest stats provider wired in OnCreateDialogs. Removed the old inline F3-only build watermark (moves to a standalone always-on drawer in a later commit).
2026-07-14 20:12:39 +02:00
Dipshet b85be1d7ac Improve logging behavior by reducing noise and enabling fresh logs
Downgrade per-frame debug traces logged at error/warn (leaked even at log_level=error) to debug: RefreshGuestOutput checkpoints + IssueSwap traces (command_processor.cpp) and the empty-resolve-region warning (draw.cpp).

log_new_file_per_launch deletes the previous log on start so a fixed log_file is replaced, not appended-to.
2026-07-14 20:07:47 +02:00
Dipshet 2b52e5e2c8 Add dynamic vblank pacing for the FPS unlock (ac6_dynamic_vblank)
With the unlock forcing single-vblank presents, frame-locked content (menus,
hangar, in-engine cutscenes) free-runs far too fast while only gameplay should.
Pace the guest vblank dynamically: free-run only while the 3D world is being
rendered, otherwise force the native 60Hz.

"World is rendering" is detected from the GPU side - the command processor
stamps a heartbeat (NotifyWorldCompositorDraw) whenever a draw uses the
world/effects compositor pixel shader (ucode 17e5e4ac3e713245), which runs
every frame of 3D but never in the 2D front-end. The present timing hook then
sets a guest-vblank Hz override via the new GraphicsSystem hook. Only engages
under the unlock; ac6_dynamic_vblank=false restores the plain always-on unlock.
2026-07-09 22:38:29 +03:00
Dipshet 2c7ee7ea68 Fix cull the sun-flare's spurious second billboard (flare "square")
The sun lens-flare draw (VS ADF9AFC4C10921B9 emits two billboards:
V0-V3 = the visible glow quad, V4-V7 = a malformed quad that mis-renders
in the emulator as a faint  bright rectangle in the sky (the "square").

Cull it in the vertex shader using the translator's existing kill-vertex
mechanism: in CompleteVertexOrDomainShader, for this ucode hash
(plain host VS only), vertices with SV_VertexID >= ac6_flare_drop_index_min
(default 4) get a NaN output position, so the rasterizer discards the primitive.
The real glow (V0-V3) is untouched.

cvars: ac6_flare_drop_quad2 (bool, default true), ac6_flare_drop_index_min
(int32, default 4). Baked at shader translation.
2026-07-08 20:54:59 +03:00
sal063 b30cdf003d Merge pull request #18 from Dipshet/fix-deswizzle
Fix AC6 resolution scalar >1x mosaic and cloud/effects de-swizzle streaks
2026-07-08 08:56:09 +03:00
Dipshet bb4f4855ac Fix invisible missile/jet trails (stale vertex-buffer residency)
Missile/jet trail position history is a fixed guest-address ring, so its
vertex fetch constants never change and the command processor's
vertex_buffer_states_ address cache skipped RequestRange forever, the GPU
copy of the trail history froze at zero (trails invisible) while CPU memory was
correct.

Register a physical-memory invalidation callback that flags when the CPU writes
watched GPU-visible memory, and drop the cached vertex-buffer states at the next
draw so the ring's pages get re-uploaded. Also notify those callbacks from the
access-violation page-recovery path (xmemory), since a recovered page becomes
read-write and would otherwise never fault again to report the write. Gated by
ac6_fix_trails (default ON).
2026-07-08 02:14:02 +03:00
Dipshet 313fd236ee Fix AC6 >1x mosaic and cloud/effects de-swizzle streaks
Upscale mosaic. At draw-resolution scale > 1, AC6's deferred
EDRAM restore passes do integer pixel-address math on the PsParamGen
position. Its leftover sub-guest-pixel fraction scrambles into an 8x8
mosaic. Floor the param-gen position (param_gen_integer_guest_position)
and re-add the host sub-pixel at the fetch (param_gen_host_subpixel_restore).
Inert at 1x.

De-swizzle scramble. Some AC6 restore/resample passes
manually de-swizzle the Xenos EDRAM sub-tile layout of their source, which
is only correct on tiled data. The emulator detiles everything to linear,
so the de-swizzle always scrambles, streaking the cloud/effects pipeline.
For allowlisted shader hashes (ac6_neutralize_deswizzle_hashes) the sample
coordinate is replaced with the identity host-texel UV (a 1:1 copy).
2026-07-08 01:28:57 +03:00
Schryzon bdc9658b8b Fix MSVC compilation flags, improve build script, and update README 2026-07-04 23:57:35 +08:00
salh c2e2fbfbbc Add 60fps cutscene clamp for in-engine cinematics
Suspend the FPS unlock while a demo-manager Exec (DD sub_82184460 / EM sub_821856F8) ticks, so the frame-locked IngameCinematics Sequencer plays at native ~30fps instead of double speed. Adds ac6_cutscene_clamp CVar (default on).
2026-06-15 16:03:43 +03:00
salh 0d7a528395 Fix codegen teardown and skip dispatch thread in tool mode 2026-05-30 11:56:35 +03:00
salh ead11217b7 Upgraded to RexGlue v0.8 and edited a bit of the Audio code 2026-05-29 22:17:02 +03:00
salh 64f8efbb2b Restore AC6 mode-1 decoder dump hook via midasm at 0x821CCC5C
Recovers the Apr 23 hand-edit (lost in subsequent refactors) and re-wires
it as a TOML midasm hook so codegen regeneration can no longer drop it.
Hook fires immediately after the guest decompressor (bl 0x822CF510)
returns, reads the entry record via r11 (codec at +1, csize at +8,
usize at +12), source offset from *(r31+22888), entry tag from r10, and
calls Ac6DumpPacDecodedEntry with the decoded buffer at r4. With
AC6_DUMP_PAC_DECODED=1, all 800 compressed entries now drop as
FHM-magic'd entry_*_mode1_*.bin in out/ac6_pac_runtime_dump/.

Also adds streamer-worker dispatch probes (AC6_TRACE_PAC_WORK_ITEMS),
PPC stack walking on PAC reads (AC6_TRACE_PAC_STACKS), the AC6 PAC
index parser, the chunk-coalescing dump fallback, and a user-facing
walkthrough at docs/ac6_asset_extraction_walkthrough.txt.
2026-05-01 21:22:14 +03:00
salh 96e10d2b6e Removed a whole lot of Dead legacy code. Add a performence that is enabled by Default. 2026-04-30 10:57:35 +03:00
salh 121c910b57 Add AC6 PAC extraction and texture export tooling 2026-04-24 17:01:15 +03:00
salh a0884cbf3a Hardened Failure handling. Added Clearer instructions for building 2026-04-22 16:55:39 +03:00
salh 34d8c0185e Improve texture swap modding workflow 2026-04-22 16:22:41 +03:00
salh d3bb76be61 Integrate rexglue 0.7.5 and 0.7.6 improvements 2026-04-22 14:30:40 +03:00
salh 3d3579d290 Implement texture swap dump and replace pipeline 2026-04-22 01:06:53 +03:00
salh 701eb202eb Fix graphics diagnostics and restore default runtime settings 2026-04-20 23:13:53 +03:00
salh 9af6f59938 Fix texture format bounds checking to prevent rendering corruption (black triangles) 2026-04-20 18:56:20 +03:00
salh d9f1c20d60 Fix vendored FFmpeg avconfig.h include path visibility 2026-04-20 18:48:47 +03:00
salh c57016c272 Track vendored simde x86 headers 2026-04-20 17:23:49 +03:00
salh 41f58b5a1f Fix vendored FFmpeg headers on clean clones 2026-04-20 15:49:18 +03:00
salh 26c84988e7 Add setup_and_build.bat script 2026-04-20 06:43:35 +03:00