Commit Graph

2102 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
Gliniak
74f34818e7 [Lint] Added InsertBraces to linter to unify codebase to one standard 2026-05-08 18:54:50 +02:00
Adrian
2c68a2fc4b [XAM] Fixed XamUserReadProfileSettingsEx setting buffer_size_ptr
Fixes Kinect Dashboard from crashing when selecting Switch Profiles.
2026-05-08 15:02:53 +02:00
Gliniak
80f2b535e9 [Kernel] Added KeSaveFloatingPointState and KeRestoreFloatingPointState from nukernel 2026-05-05 10:45:31 +02:00
Adrian
6e1bd0a9a6 [XBDM] Fixed DmGetConsoleType using value from cvar 2026-05-02 17:33:53 +02:00
Michael Oliver
6de80dffe2 [Emulator] Load title plugins before main thread execution begins
This keeps the title thread suspended until plugins are loaded, allowing early init and hook setup before guest code starts running.
2026-04-29 20:20:08 +02:00
Adrian
dc561e4df5 [XMP] Fixed XMP Overriding
Fixed cutscene audio in 58411446

Co-Authored-By: The-Little-Wolf <116989599+the-little-wolf@users.noreply.github.com>
2026-04-25 18:27:28 +02:00
Adrian
68d409ebba [Kernel] Fixed releasing XObject handles on title termination 2026-04-21 22:42:12 +02:00
Gliniak
e3e57bdb47 [XAM/XMP] Fixed incorrect size of XMP_SONGINFO structure
Thanks The-Little-Wolf
2026-04-20 20:41:40 +02:00
The-Little-Wolf
a6e92f43ea [XAM/XNOTIFY] - Fixes and more flags
- Properly set is_system in XamNotifyCreateListener
- Save is_system for later use
- Correct X_NOTIFICATION_ID
- Add missing XNotificationID flags
2026-04-19 22:03:31 +02:00
Herman S.
658bd5db70 [Xboxkrnl] Return error code from KeSetAffinityThread on null thread
If the guest-supplied thread pointer doesn't resolve to an XThread,
we previously returned STATUS_SUCCESS without setting the affinity
or writing previous_affinity_ptr, leaving callers believing the call
succeeded. Real NT kernel would crash on a bad pointer, but that's not
easy for us to replicate so return STATUS_INVALID_HANDLE instead and
log the pointer value so the condition is visible rather than silent.
2026-04-13 13:07:53 +09:00
Herman S.
d42411ec2a [Kernel] Fix NtReleaseSemaphore returning wrong status code 2026-04-13 12:59:36 +09:00
Herman S.
c17a3b19fb [Kernel] Implement per-process TLS allocation
Previous global TLS bitmap was shared across all processes. Now
per-process TLS bitmaps stored X_KPROCESS structures which should
better match Xbox360 architecture.
2026-04-13 12:42:42 +09:00
Herman S.
80c6751b82 [UI] Eliminate mouse requirement for initial profile create dialogs
Enable keyboard navigation and accept Enter to complete profile creation
2026-04-13 08:16:05 +09:00
The-Little-Wolf
a292248bee [XAM/CONTENT] - Stub XamContentLaunchImage
- Stub XamContentLaunchImage and XamContentLaunchImageInternalEx
- Creates a common function for all XamContentLaunchImage functions
2026-04-12 19:38:41 +02:00
Herman S.
65b74819aa [Threading] Implement priority boost on wake
When a thread wakes from a kernel wait, the Xenon scheduler boosts its
effective priority by the increment passed to the signaling call
(KeSetEvent, KeReleaseSemaphore, KeReleaseMutant). The boost is clamped
to the per-thread max_dynamic_priority cap, respects the guest
boost_disabled flag, and is drained on the next quantum expiry.
Guest KTHREAD priority fields are now initialized from parent process
defaults, and the previously unknown fields involved have been renamed
to match their identified purpose.
2026-04-11 17:05:05 +09:00
Herman S.
b3d8a21b72 [Threading] Add thread priority mapping with timer-driven quantum decay
And default ignore_thread_priorities to false.

Map Xenon's 0-31 priority range across all 5 host priority levels
instead of collapsing 0-17 into kNormal.

Use timer-driven quantum decay (~20ms period) matching Xenon's
60-quantum / 3-per-tick cycle to prevent starvation by gradually lowering
effective priority for non-real-time threads (< 18), piggybacking on the
existing 1ms timestamp timer.
2026-04-10 08:21:42 +09:00
Herman S.
61c8eb0707 [Threading] Improve same-CPU spinlock contention
Spinlock acquire now checks if the lock holder shares the same guest
CPU and yields more aggressively (Sleep(0)) when contending on the
same Xenon HW thread, which should better approximate real kernel's
implicit serialization.

Child threads without an explicit affinity mask now inherit the
parent's guest CPU assignment instead of round-robining, so the
spinlock check correctly identifies parent-child co-location.
2026-04-09 21:14:39 +09:00
Adrian
e23376afcc [Kernel] Fixed NtSignalAndWaitForSingleObjectEx prototype 2026-04-07 20:05:12 +02:00
Adrian
d3d0478403 [Kernel] Fixed ObCreateSymbolicLink returning error if symbolic link is already registered
Fixed Crackdown greyed out Play Now - CO-OP option.
2026-03-29 21:15:20 +02:00
Adrian
d680f5a499 [Kernel] Fixed XTimer reporting resume support
Fixed Quake 4 performance issues
2026-03-28 20:46:25 +01:00
Herman S.
8cd7f69cbc [Kernel] Fix macro collisions with macOS system headers
Rename IPPROTO_TCP/UDP/VDP enum values to XE_IPPROTO_* to avoid
collision with macOS <netinet/in.h> macros. Add #undef WAIT_ANY
guard for macOS <sys/wait.h> macro.
2026-03-27 00:11:59 +09:00
Herman S.
cb12f7fa1e [Build] Generalize POSIX platform guards
Most non-Windows code paths use standard POSIX APIs (sockets, signals,
dlopen, threading) that work on any POSIX platform. Change Linux-specific
guards to !WIN32 or #else where the code is portable. Linux-specific
APIs (SIGRTMIN, Vulkan/X11, fontconfig/GTK) remain Linux-guarded.
2026-03-26 23:10:47 +09:00
Herman S.
597a0c2d1e [Xboxkrnl] Use towupper in RtlUpcaseUnicodeChar for portability
std::ctype<char16_t> is a non-standard extension that's not available
on all platforms. Neither this nor the original technically match the
Windows kernel's fixed Unicode table approach and can produce different
results based on system locale.
2026-03-26 23:10:47 +09:00