Commit Graph

8582 Commits

Author SHA1 Message Date
MechaCat02
33dee75c03 [Audit] --audit-r3-dump-bytes: dump N bytes at r3 when probe fires
Some checks failed
Orchestrator / Commit Message Validation (push) Has been skipped
Orchestrator / Lint (push) Failing after 1m20s
Orchestrator / Windows (x86-64) (push) Has been skipped
Orchestrator / Linux (x86-64) (push) Has been skipped
Orchestrator / Create Release (push) Has been skipped
AUDIT-059 round 15 — diagnostic. New cvar `audit_jit_prolog_r3_bytes`
(default 64 = existing behaviour, capped at 256, rounded up to 16B
multiple) controls how many bytes are dumped at host(r3) when the
audit_jit_prolog_pc probe fires. Set to 80 to capture audit-051's
stack-local struct at sub_82452DC0's r31+96.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 19:39:26 +02:00
MechaCat02
5427f14f1b [Audit] JIT-prolog: optional audit_jit_prolog_mem_dump chain (3 levels)
Some checks failed
Orchestrator / Commit Message Validation (push) Has been skipped
Orchestrator / Lint (push) Failing after 1m19s
Orchestrator / Windows (x86-64) (push) Has been skipped
Orchestrator / Linux (x86-64) (push) Has been skipped
Orchestrator / Create Release (push) Has been skipped
Round-14 of AUDIT-2BF (singleton-dump). Pairs with xenia-rs'
--audit-mem-read-hex to emit one comparable XELOGKERNEL line resolving
the bctrl target at sub_822F1AA8+0x90 (PC 0x822F1B4C):

  [0x828E1F08]        -> singleton instance ptr
  [singleton+0]       -> vtable
  [vtable+0]          -> vtable[0]  (= first virtual method, bctrl tgt)
  [vtable+24]         -> vtable[24] (= slot 6, silph chain target)

Two complementary hooks:

1. src/xenia/cpu/backend/x64/x64_emitter.cc: extend
   AuditLogJitPrologArgs. New cvar `audit_jit_prolog_mem_dump` (uint32).
   When non-zero and an `audit_jit_prolog_pc` fire happens, the host
   side dereferences the VA 3 levels deep and emits one
   AUDIT-MEM-READ line in the same format ours emits. Defensive
   per-level null + VA-range checks.

2. src/xenia/kernel/kernel_state.cc: one-shot dump in
   EmulateCPInterruptDPC of the same chain (hard-coded to
   0x828E1F08). Useful when audit_jit_prolog_pc isn't set; fires the
   first time the CP interrupt path runs (after the singleton ctor
   has had time to populate).

Read-only. Both gates default-off; no impact when cvars unset.
~65 LOC total across the two files.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 12:15:33 +02:00
MechaCat02
a594f95f77 [Audit] round 12: ExCreateThread + XThread::Execute probes
Two cvar-gated AUDIT-HLC probes for thread-spawn lineage attribution:

1. ExCreateThread_entry shim logs (start_address, start_context, xapi,
   flags, kernel lr, guest_lr). guest_lr is recovered via the same
   one-frame-up PPC back-chain walk used by the NtWaitForSingleObjectEx
   probe (lr saved at [back2 - 8]).

2. XThread::Execute emits (tid, start_address, start_context, xapi) at
   the very top so each running thread can be matched back to its
   creating ExCreateThread entry by (start_address, start_context).

Gated on the existing cvars::audit_handle_lifecycle; no new cvar.
Pulled in xenia/kernel/kernel_flags.h from xthread.cc to expose the
cvar declaration there.

Used by audit-059 round 12 to enumerate the 23 thread spawns in
canary's 35 s boot, attribute each to its guest_lr caller, and cross-
reference against ours' 10 spawns to identify the 7 missing
spawner functions (including sub_824F7800 which spawns the 4 silph
PKEVENT workers at entry=0x82506528/58/88/B8 via guest_lr=0x824F7B24).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 11:12:18 +02:00
MechaCat02
dde48f287b [Audit] round 9: generalize JIT-entry probe to PC-configurable cvar
Some checks failed
Orchestrator / Commit Message Validation (push) Has been skipped
Orchestrator / Lint (push) Failing after 1m18s
Orchestrator / Windows (x86-64) (push) Has been skipped
Orchestrator / Linux (x86-64) (push) Has been skipped
Orchestrator / Create Release (push) Has been skipped
Replace the round-7 hardcoded `current_guest_function_ == 0x824F7800`
gate with a runtime cvar `audit_jit_prolog_pc` (uint32, 0 = disabled).
The cvar names the guest entry PC at which the x64 emitter inserts a
CallNative to the prolog probe; the probe now dumps the active PC in
each log line so multiple instrumentation campaigns can share output.

Renames `audit_log_sub824F7800_args` (cvar) and `AuditLogSub824F7800Args`
(host function) — the round-7 sub_824F7800-specific cvar and function
are deleted, not left dormant. The `audit_handle_lifecycle` cvar and
its existing AUDIT-HLC probe sites in xboxkrnl_threading.cc /
kernel_state.cc are untouched.

Validated by audit-059 round 9: with `--audit_jit_prolog_pc=0x821B55D8`
the silph WorkerCtx-init chain entry fires 1× in canary at tid=6
lr=0x82172D8C (call site at sub_82172BA0+0x1E8 `bctrl`, the virtual
dispatch through vtable slot 6 that statically-blind xref-walkers
cannot enumerate).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 10:40:35 +02:00
MechaCat02
fc89e68155 [Audit] round 7: JIT-entry probe for sub_824F7800 args
Adds cvar audit_log_sub824F7800_args (off by default). When set, the x64
JIT emits one CallNative to AuditLogSub824F7800Args at the start of the
JIT-compiled body of guest function 0x824F7800 (silph::WorkerCtx ctor's
immediate caller per audit-058). The hook reads r3..r10, LR, and 64
bytes at host(r3) from PPCContext and writes them to XELOGKERNEL.

The hook is placed *after* the JIT prolog (stack push, GUEST_RET_ADDR /
GUEST_CALL_RET_ADDR setup, optional trace-functions block) and *before*
the first HIR body instruction, so r3..r10 and lr in PPCContext still
reflect the caller's args (no LOAD/STORE_CONTEXT has executed yet inside
the callee). The compile-time gate `current_guest_function_ == 0x824F7800`
makes this a zero-cost no-op for all other functions and a single extra
CallNative for the one target.

Audit-059 round 7 probe captures r3..r10 + LR for a-prime synthetic
replay of sub_824F7800 from a host hook in xenia-rs. Run with:
--audit_handle_lifecycle=true --audit_log_sub824F7800_args=true

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-06 19:48:47 +02:00
MechaCat02
289c2f3a3e [Audit] handle-lifecycle: one-shot silph::WorkerCtx hexdump on first KeSetEvent
Adds a 41-LOC cvar-gated probe (audit_handle_lifecycle) that emits a one-shot
0x300-byte hexdump of the silph::WorkerCtx context the first time KeSetEvent
fires into the silph UI PKEVENT cluster (0xBCE25200..0xBCE25300 in current
builds). Recovers ctx_base by anchoring on the canonical layout (events at
ctx+0x54/+0x64/+0x74/+0x84 with 16-byte stride; ctx_base = ev_addr - (ev_addr
- 0xBCE251C0)). Also emits an explicit per-slot summary of the 8 candidate
KEVENT headers at +0x54..+0xC4 for sanity.

Produces 48 DUMP rows + 8 slot rows in canary.log on the first triggering
KeSetEvent. Guarded by std::atomic_bool so subsequent fires are silent. Used
by iterate 2.BF context-replication in ours: we need the live [ctx+0] vtable
pointer and the 4 quiet/4 active KEVENT slot config to synthesize a matching
WorkerCtx and spawn the four sub_82506xxx entries.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-06 18:42:15 +02:00
MechaCat02
1e5648c9a5 [Audit] handle-lifecycle: include guest LR + one-frame stack-walk on waits
Extend the AUDIT-HLC probes with guest LR capture:
  - NtCreateEvent, NtSetEvent, KeSetEvent: log immediate guest LR
    (cpu::ThreadState::Get()->context()->lr) so callers can be
    attributed to specific guest functions.
  - NtWaitForSingleObjectEx entry + _done: also walk one PPC stack
    frame up to recover the guest_lr of the wait wrapper's caller
    (Xbox 360 EABI: saved LR at [prev_sp - 8], see xenia-rs's
    walk_guest_back_chain). lr_enter alone gives only the kernel
    wait wrapper return address (e.g. 0x824AC578); guest_lr surfaces
    the actual call site.

Still cvar-gated on audit_handle_lifecycle. Used in audit-059 round 4
to map canary handles F8000xxx to ours' 0x12xx wedges via guest LR
matching against silph::UImpl/GamePart cluster.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-06 18:17:15 +02:00
MechaCat02
d031d7c513 [Audit] handle-lifecycle XELOGKERNEL probes (cvar-gated)
New cvar `audit_handle_lifecycle` (Auditing group, default false).
When enabled, emits one-line XELOGKERNEL traces tagged AUDIT-HLC at:
  NtCreateEvent return, NtSetEvent entry, KeSetEvent entry,
  NtWaitForSingleObjectEx entry + completion,
  EmulateCPInterruptDPC entry.

Observation-only: zero-overhead when cvar off (single branch + flag
read). Intended for handle disambiguation between xenia-rs and
canary under the Wine cross-build oracle.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-06 11:57:34 +02:00
MechaCat02
03362b59fe [Build] Linux→Windows cross-compile toolchain (clang-cl + xwin)
Some checks failed
Orchestrator / Commit Message Validation (push) Has been skipped
Orchestrator / Lint (push) Successful in 1m19s
Orchestrator / Windows (x86-64) (push) Failing after 5m16s
Orchestrator / Linux (x86-64) (push) Failing after 13m23s
Orchestrator / Create Release (push) Has been skipped
New CMake preset `cross-win-clangcl` for Ninja Multi-Config on
non-Windows hosts. Toolchain: clang-cl (MSVC-ABI), lld-link, xwin SDK/CRT
splat. Shader compilation routes through wine fxc.exe with FXC_PATH
env forwarding and unix→Windows path translation via `winepath -w`.
Plus per-file build fixes (constexpr→const, llvm-rc forward-slash,
zlib-ng AVX guard, /RTCsu MSVC-only). third_party/snappy bumped to
fabi/sylpheed-crossbuild for the target-aware POSIX-gate header.

Produces `xenia_canary.exe` (Debug MSVC) suitable for use as the
audit oracle under Wine for xenia-rs work. See
docs/CROSS_BUILD_SETUP.md for the full reproduction recipe.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-05 23:52:27 +02:00
Gliniak
99fd19d025 [XAM] Limit XContentQueryVolumeDeviceType to XContent packages
Some checks failed
Orchestrator / Commit Message Validation (push) Has been skipped
Orchestrator / Lint (push) Successful in 1m23s
Orchestrator / Windows (x86-64) (push) Failing after 5m18s
Orchestrator / Linux (x86-64) (push) Failing after 22m34s
Orchestrator / Create Release (push) Has been skipped
- Changed mount path for XContent packages from Cdrom to Package_0
Normally it should generate specific value instead of 0, but for now 0 is enough
2026-06-05 16:13:31 +02:00
Gliniak
9478cda5d6 [Kernel] Fixed issue with titles not booting due to lack of title id 2026-06-03 22:45:54 +02:00
Adrian
be6e53e383 [XAM] Fixed missing CreateFolder in XamWriteGamerTile
Fixed Rez HD failing to get past main menus in unlocked state.
2026-06-02 20:36:25 +02:00
bomabomabomaboma
73945c06d7 [GPU] Simplify ZPD cvars 2026-06-02 20:09:50 +02:00
bomabomabomaboma
fbd620c22b [GPU] Implement ZPD occlusion queries
Implements EVENT_WRITE_ZPD handling across shared CommandProcessor, D3D12, and Vulkan backends.

This adds a shared report lifecycle. Reports can span submissions/render passes, split into multiple segments, and asynchronously retire. Reports can also survive same-slot reuse, which is critical for titles that aggressively recycle against a small pool.

RTV/FBO use their respective host occlusion queries, whereas ROV/FSI use counter buffers instead, with shader helpers that are called from the translated PS, accumulating surviving MSAA sample coverage into active slots. Regardless of approach, results are copied to small, dedicated readbacks and fed through shared retirement.

Fast mode writes speculative values and patches in resolved results later. Strict mode waits for real results with a small retire backstop so it doesn't spin forever when a report gets weird. Fake mode's fundamentals are unchanged, it just now uses XenosZPDReport memory helpers like all the modes do.

Also adds optional sample count saturation for instances when attenuation isn't a one-for-one with real hardware, an optional alternate fast behavior that preserves cached zeroes (that can improve flare-heavy titles but might regress occlusion culling), and normalization for upscaling.

QueryBatch is still unsupported other than a fake path that's enabled when a range is set via cvar.
2026-05-30 19:26:25 +02:00
Gliniak
29311ddcdd [APU] Replaced min-max with clamp for queued frames 2026-05-26 22:58:46 +02:00
Gliniak
c5113acb9c [CPU] XexModule: Removed unused class member 2026-05-26 22:56:37 +02:00
The-Little-Wolf
7a5cb96c2e [XAM/INFO] - IPTV Initialization Setting
- Allow for initializing IPTV
- Stub XamGetDvrStorage
- Stub XamSetDvrStorage
2026-05-26 19:36:34 +02:00
Gliniak
7e98ae6de3 [XMA] Invalidate output buffer if there is nothing to process
- Fixes 565507E4 hardlock on boot
2026-05-26 09:27:02 +02:00
oreyg
505697f980 [APU] XmaContextNew: refine output buffer invalidation 2026-05-25 11:54:18 +02:00
Gliniak
02a0d697cb [Base] Added option to recursively search for file 2026-05-24 22:35:40 +02:00
Adrian
c48e0f29e5 [XAM] Implemented XUserAwardGamerPicture 2026-05-24 20:18:46 +02:00
The-Little-Wolf
a7e13e195b [Xam/Content] - Implement XamContentResolveInternal
- Implement XamContentResolveInternal
2026-05-23 20:21:55 +02:00
oreyg
09dbe2cd36 [APU] XmaContextNew: do not invalidate output_buffer_valid prematurely 2026-05-21 20:54:10 +02:00
Adrian
b2aa8b200a [BASE] Use FlushAllSinks instead of inline loop 2026-05-21 07:43:48 +02:00
Gliniak
a11908fa76 [XAM] Enable storing IPTV name.
Still needs to be exposed in UI (optional)
2026-05-19 23:31:53 +02:00
Gliniak
072ef7eff7 [XAM] Implemented XamGetOnlineLanguageAndCountry 2026-05-19 22:37:14 +02:00
Gliniak
9ce91e55fe [UI] Listed extended languages 2026-05-19 22:03:54 +02:00
Gliniak
99ea6da18a [XConfig] Implementation of XConfig 2026-05-19 07:50:16 +02:00
The-Little-Wolf
f88bfbe41e [Xam/Content] - Implement XamContentCreateEnumeratorInternal
- Implement XamContentCreateEnumeratorInternal
2026-05-18 20:30:38 +02:00
Gliniak
ef67d1ca3f [SMC] Removed std::bind usage in favor of lambda 2026-05-18 19:52:12 +02:00
Gliniak
482629a3b1 [XAM] Fixed issue with different param count in XamFormatDateString and XamFormatTimeString
In older dashes filetime is in r4 then output buffer in r5
but on newer it's in r3 and r4
2026-05-17 17:34:39 +02:00
Adrian
a261b83def [APP] Flush log & save config on quick exit 2026-05-17 12:05:20 +02:00
Gliniak
4c396fe611 [XAM] Implemented XamGetLanguageLocaleFallbackString and XamGetLanguageTypeface
- Added stub XamGetLanguageTypefacePatch
- Moved locale related calls to xam_locale from xam_info
2026-05-17 10:49:08 +02:00
The-Little-Wolf
dc4db67f9c [Kernel] - Change OddObj to X_DISPATCH_HEADER
- Change OddObj to X_DISPATCH_HEADER
- Add unknown X_KWAIT_REASON flag
- Fixed InitializeGuestObject mistake
- Replaces unknowns in kthread using nukernel as reference
2026-05-16 23:57:19 +02:00
oreyg
c2674b19d2 [Vulkan] Drop vertex buffer residency cache, hoist global lock like D3D12 2026-05-15 14:58:51 +02:00
oreyg
b15fcc73e6 [Vulkan] Route guest oDepth through gl_FragDepth in FBO and into FSI depth test 2026-05-15 10:25:54 +02:00
Adrian
6181160ed4 [XAM] Fixed XEX swap failing to remove prefix
Fixed Splinter Cell: Double Agent xex swapping from singleplayer to multiplayer.
2026-05-15 09:42:14 +02:00
oreyg
562aa0dd91 [Vulkan] Only declare the clip-distance or cull-distance array that is written 2026-05-15 09:00:26 +02:00
oreyg
02a2591295 [Vulkan] Port ac6_ground_fix vertex-fetch nudge to SPIR-V 2026-05-15 08:31:10 +02:00
Adrian
cebbdb6cac [Kernel] Implemented XeCryptHmacShaInit, XeCryptHmacShaUpdate and XeCryptHmacShaFinal 2026-05-14 23:04:47 +02:00
Gliniak
fdbaaaba21 [Kernel] Replace SHIM version of kernel strings with exports
- Split into header file for usage in other places
- Removed most of define SHIM Utils
2026-05-14 22:11:40 +02:00
oreyg
b575c68418 [XMA] Enhances the existing XmaContextNew implementation with one derived from the AC6_recomp RexGlue SDK.
Key fixes versus the previous implementation:

    Packet walk across input-buffer boundaries: GetNextPacket and
    GetNextPacketReadOffset now resolve the actual target packet inside
    the next input buffer, instead of clamping to its first packet.

Resolves silent 'patches' in cinematics observed previously in AC6.

Co-authored-by: sal063 <ssalh0456@gmail.com>
2026-05-14 21:04:18 +02:00
Adrian
d1e587617a [UI] Fallback to default button for XamShowMessageBoxUI 2026-05-14 07:20:14 +02:00
Gliniak
331ddf79bf [Kernel] KeGetImagePageTableEntry: Added bit 0 set
According to dashboards 14xxx and higher it is required that
return of this call will have that bit set.
2026-05-13 20:07:46 +02:00
Gliniak
cdb88d0b36 [Kernel] Remove IsQueued check for DPC 2026-05-13 20:02:36 +02:00
Guilhem Massol
f3086cfced [Compilation] Fix Clang 23 2026-05-12 22:45:56 +02:00
Adrian
f4f821215e [XGI] Stubbed XUserAwardAvatarAssets 2026-05-12 13:07:15 +02:00
Adrian
bfdaa41827 [XGI] Cleanup XUserWriteAchievements 2026-05-11 21:03:40 +02:00
Adrian
ad57bfa7dd [APP] Fixed zar creation file naming bug 2026-05-11 20:05:47 +02:00
Gliniak
3e1bff213d [Cmake] Fixed whoopsie. Disabled profiler from default 2026-05-09 11:31:12 +02:00