Commit Graph

2076 Commits

Author SHA1 Message Date
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
Herman S.
ec5bd872d5 [Build/Kernel] Guard zlib-ng x86 SIMD defines behind XE_TARGET_X86_64 2026-03-26 16:28:27 +09:00
The-Little-Wolf
c4f4412df9 [Xam/Info] - Implement GetSystemTimeAsFileTime & QueryPerformanceFrequency
- Implement QueryPerformanceFrequency, GetSystemTimeAsFileTime
- Used in Aurora and dash launch
2026-03-24 22:36:53 +01:00
Adrian
4ed7fa3af3 [UI] Fixed input focus interfering with gamepad navigation 2026-03-23 21:26:17 +01:00
Adrian
022a29fe58 [XAM] Fixed potential use-after-free on profile login 2026-03-21 22:11:35 +01:00
Adrian
3f74dfef10 [XAM] Improved gamertag validation 2026-03-14 23:47:45 +01:00
Gliniak
8ccf01d151 [UI] Update gamertag input field only on change
No need to validate gamertag every frame
2026-03-14 23:25:09 +01:00
Gliniak
d37c22aad0 [HID] Redesigned support for Portals
- Added hotplug support on Windows
- Added support for XamInputNonControllerGetRawEx & XamInputNonControllerSetRawEx
2026-03-14 23:01:38 +01:00
Gliniak
5f62db9289 [Kernel] Added kHighFrequency for RtlInitializeCriticalSectionAndSpinCount 2026-03-11 19:54:19 +01:00
Herman S.
b24ea8ef99 [CPU/XThread] Add DWARF .eh_frame unwind info for JIT code on Linux
Generate per-function CIE+FDE records and register them via
__register_frame so the C++ exception unwinder can propagate through
JIT frames. Replace setjmp/longjmp fiber reentry with throw/catch
on Linux to ensure destructors and RAII guards run during fiber
stack switches.
2026-03-11 00:02:34 +09:00
Herman S.
f45a254774 [Linux/Threading] Self-suspend with condition variable instead of spin 2026-03-11 00:02:26 +09:00
Herman S.
9f8961c185 [XThread] Fix TLS pointer bug
Guest code may directly read the tls_address field from thread
structure to access TLS, and it expects the dynamic TLS area pointer
2026-03-11 00:02:16 +09:00
Herman S.
22f21fada9 [XThread] Replace guest exception handling with setjmp/longjmp 2026-03-11 00:01:35 +09:00
Herman S.
4f1394bbaa [Kernel/Threading] Fix some kernel threading issues
- broken atomic exchange on linux
- spinlock release memory buffer
- race in thread suspension
- removed misleading volatile qualifiers
2026-03-10 23:53:03 +09:00
Herman S.
3585b6e592 [Kernel] Replace BCrypt RSA with portable bignum implementation
Removes the Windows-only BCrypt dependency from XeCryptBnQwNeRsaPubCrypt
and replaces it with a portable modular exponentiation implementation
using 64-bit arithmetic, enabling RSA signature verification on all
platforms. Adds Catch2 tests validating the implementation with a
2048-bit RSA key.
2026-03-10 16:20:38 +09:00
Herman S.
50ef5c2691 [Kernel] Fix data race on XFile position 2026-03-09 16:14:22 +09:00
Herman S.
341d3b66a8 [Kernel] Thread safety fixes for xfile, xmutant, and xtimer objects 2026-03-09 14:15:14 +09:00
Herman S.
b0a387c6ea [XboxKrnl] Don't crash the host on guest trap 2026-03-09 14:15:14 +09:00
Herman S.
6203d382e2 [Kernel] Clear object handles before release in ObjectTable::Reset
During bulk teardown, objects still had stale handle entries when
Release() triggered their destructors, hitting the handles_.empty()
assertion.
2026-03-09 14:15:14 +09:00
Herman S.
a00fd0eb12 [Kernel] Remove some log spam 2026-03-09 14:15:14 +09:00
Herman S.
5ac07f686d [Xboxkrnl] Remove devkit memory access assert and replace with warning 2026-03-09 14:15:14 +09:00
Herman S.
92b07391df [Linux/Threading] change self-suspend to wait to be resumed 2026-03-09 13:43:56 +09:00
Herman S.
137baa2b9f [Kernel] Ensure file mutex is initialized 2026-03-09 13:43:56 +09:00
Herman S.
32b8c341ee [Kernel] ReleaseSemaphore for Posix to match Windows semantics 2026-03-09 13:43:56 +09:00
Herman S.
bc3585d0ef Keep threads from trying to suspend themselves on Linux
Avoids certain sporadic lockups (usually on startup)
2026-03-09 13:43:56 +09:00
Herman S.
02fccd9113 [Kernel/XMP] Add title-specific file I/O hooks for XMP volume sync
Some games persist BGM volume through their own save files but never
call XMPSetVolume. Add a TitlePatch system that intercepts NtReadFile/
NtWriteFile to apply game-specific logic as well as logic to identify
the memory location that the volume data is read into and monitor that
memory location for changes, updating XMP player volume if it changes
during gameplay.

Includes patches for known games with this issue:
Dead or Alive Xtreme 2 (544307D2), PGR4 (4D5307F9) and PGR3 (4D5307D1)
2026-03-09 08:59:15 +09:00
Herman S.
eb914ae77d [Kernel] Return null on handle type mismatch instead of asserting 2026-03-09 00:07:45 +09:00