Commit Graph

8539 Commits

Author SHA1 Message Date
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
Adrian
2072d9bdf1 [APP] Limit logging SPA properties
Fixed Cracdown logging large tabulate table causing garbage text in the log.
2026-05-08 20:02:20 +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
Gliniak
ec18a89da4 [APP] Allow profiler to be enabled via cmake option
- Hide profiler buttons if profiler is disabled
- From default it is disabled
2026-05-04 19:53:37 +02:00
Gliniak
9467c77f08 [GPU] Fixed crash related to disassemble_pm4 option.
In case of auto draw there is a chance it will crash due to uninitialized struct
2026-05-02 18:17:01 +02:00
bomabomabomaboma
08c0cf5ad0 [GPU] Improved fake ZPD for QueryBatch titles 2026-05-02 18:00:21 +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
Radosław Gliński
6dca89834e [VFS] Removed error path that seems to be invalid
Seems like console do not care about returning directory with non-directory flag
2026-04-28 13:33:29 +02:00
Gliniak
60f77c3622 [VFS] Skip treating NT Device paths root as non-directory.
This fixes cache initialization failure
2026-04-27 20:19:10 +02:00
Gliniak
cff0773e00 [HID] Portal: Simplified device searching procedure 2026-04-26 13:26:30 +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
Wunkolo
8e1b286578 [x64] Add GFNI and AVX512VBMI optimizations for VECTOR_SHL(Int8)
Uses `{v}gf2p8mulb` as a general int8-multiplication instruction to do
variable Int8 bit-shifts.
Uses `{v}gf2p8affineqb` in the case that all of the shift values are the same.

Based on this original PR I had made to Xenia:
https://github.com/xenia-project/xenia/pull/2247
and this little write-up I did on this method:
https://wunkolo.github.io/post/2020/11/gf2p8affineqb-int8-shifting/
2026-04-23 22:07:39 +02:00
Adrian
e2200e8435 [BUILD] Fixed clang format selecting wrong binary architecture 2026-04-23 07:27:17 +02:00
Adrian
5174c2f2e0 [BUILD] Remove IMGUI_USE_STB_SPRINTF for checked builds 2026-04-22 19:50:17 +02:00
Adrian
68d409ebba [Kernel] Fixed releasing XObject handles on title termination 2026-04-21 22:42:12 +02:00
Gliniak
e91faca1c4 [VFS] Return more proper error codes in OpenFile
- Added handling for opening file with directory flag
2026-04-21 21:58:49 +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
Adrian
73e3caa5e1 [CPU] Disable instruction info cache if context promotion is disabled
Fixed XMA writing to unknown registers when context promotion is disabled.
2026-04-19 20:51:12 +02:00
Gliniak
049a55f036 [CPU/Posix] Fixed crash caused by calling mmap on empty file 2026-04-19 20:21:24 +02:00
Adrian
bc7bc76d68 [APP] Fixed loading profile icon via login slots 2026-04-19 18:32:23 +02:00
Herman S.
4fcb8e4498 [Memory] Treat AllocRange high_page_number as exclusive
The free-block tracker search in BaseHeap::AllocRange treats
high_page_number as inclusive, shifting allocator-returned addresses
by one stride relative to the old loop-based search. Some titles
encode allocator-returned addresses in PPC code and break when that
layout shifts (Far Cry 3, Far Cry 4, Watchdogs).

In addition, reapply xe::align on the high side of AllocRange
(essentially reverting c28019e33). Without the round-up, a caller
passing a min/max window exactly the size of its request loses a
stride at the top and fails the early page_count size check.
2026-04-14 13:59:45 +09:00
Herman S.
763b160c7a [Threading/Linux] Add fallback to nice values
SCHED_FIFO requires CAP_SYS_NICE or root, try SCHED_FIFO first for real-time
priority control, then fall back to setpriority() nice values if permission
is denied.
2026-04-13 16:23:27 +09:00
Herman S.
844cc6e2ed [Memory] Remove unnecessary 256MB carve-out from v00000000 virtual heap
The 4KB-page virtual heap (v00000000, 0x00000000-0x3FFFFFFF) had 256MB
reserved at its top end for thread stacks, but thread stacks only use
the 64KB-page heap (v40000000) at 0x70000000-0x7F000000. This wasted
256MB of allocatable address space.

Keep the carve-out only on the v40000000 heap where stacks actually reside.
2026-04-13 13:16:55 +09: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.
2590f03bc1 [Emulator] Delegate to UI thread instead of assert 2026-04-13 12:20:22 +09:00
Herman S.
c261027225 [UI] Fix leaked locked_achievement_icon_ texture on drawer teardown
Reset locked_achievement_icon_ alongside font_texture_ and
notification_icon_textures_ when the immediate drawer is cleared,
preventing a debug assertion in D3D12ImmediateDrawer's destructor.
2026-04-13 12:19:56 +09:00
Herman S.
7887efa69f [APU] fix potential semaphore leak on invalid client index 2026-04-13 12:16:24 +09:00
Herman S.
c28019e333 [Memory] Fix AllocRange upper bound and update PhysicalHeap tests
BaseHeap::AllocRange was rounding the inclusive high_address UP via
xe::align(), which could push the search range one alignment stride
past the requested end. The new free-block-tracker top-down search
treats high_page_number as an inclusive max (usable_end =
high_page_number + 1), so the round-up caused it to return a base
page one stride beyond the caller's bound — most visibly when
PhysicalHeap::Alloc passed parent_heap_end = GetPhysicalAddress(...)
just below a page boundary, producing a translated address one page
past the child heap and tripping "passed out of range address range"
in BaseHeap::AllocFixed.

Drop the xe::align on the high side so high_address stays a true
inclusive bound. The low_address round-up is still correct since
allocations must START at or above the aligned low.
2026-04-13 11:38:01 +09:00
Herman S.
ea02e8d317 [Memory] Add free block tracker to BaseHeap for O(log n) allocation
Replace linear page_table_ scans in AllocRange with a std::map-based
free block index that tracks contiguous free regions.

Insertions now coalesce with adjacent blocks on release and AllocFixed
uses the targeted tracker for pure reserves and falls back to a full rebuild
for mixed-state commits.

Also fixing PhysicalHeap leaking parent memory on child allocation failure,
Reset() not restoring unreserved_page_count_ and some incorrect method names
in PhysicalHeap error messages
2026-04-13 09:31:48 +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
Gliniak
1da37db584 [Winkey] Passthrough: Added support for hid key codes.
Thanks Devildwarf for initial implementation
2026-04-12 09:47:12 +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
Herman S.
4acda223db [CPU] Remove ATOMIC_EXCHANGE opcode (dead code) 2026-04-08 00:05:29 +09:00
Herman S.
ade7e610bb [XMA] Fix stall detection false positive in Work loop
Stall detection was triggering during multi-pass subframe consumption
(e.g. stereo with subframe_decode_count < total subframes), breaking
audio looping in games like Tomb Raider. Now only detects a stall when
no subframes were pending, so Consume-only iterations aren't mistaken
for no-progress cycles. Fixes Halo 4 without regressing Tomb Raider.
2026-04-07 23:14:08 +09:00