Commit Graph

8335 Commits

Author SHA1 Message Date
Herman S.
19c5401eda [GPU] Revert SPIR-V version back to 1.0 for internal shaders 2026-03-09 21:34:22 +09:00
Herman S.
50ef5c2691 [Kernel] Fix data race on XFile position 2026-03-09 16:14:22 +09:00
disjtqz
74ab7339a3 [CPU/Thread] setup r[2] constant value, only used by HV afaik 2026-03-09 14:20:10 +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.
0efd3a9610 [APU] Move XmaContext::Block() to base class with RAII locking 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.
9371e73d92 [APU] Fix audio crashes during shutdown 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.
341a735142 [x64] Fix vector mask issue and add missing tests 2026-03-09 14:15:14 +09:00
Herman S.
f41ea1296b [x64/Debug] Fix TrapDebugPrint to properly terminate string 2026-03-09 14:15:14 +09:00
Herman S.
7e0254b36c [CPU] Check for null when returning machine code ptr 2026-03-09 14:15:14 +09:00
Herman S.
bf6e1a81eb [Posix] Fix DeallocFixed crashes / memory leaks
BaseHeap::Dispose() walks the page table and calls
DeallocFixed(addr, 0, kRelease) for every allocated page region.
These addresses are within file-backed view mappings (i.e. guest memory).
On Windows, VirtualFree on file-mapped pages silently returns FALSE.
On POSIX, the code hit assert_always() and crashed. Changed to return false
to match Windows behavior.

Memory leaks from munmap(addr, 0):

Callers passed length=0 to DeallocFixed(kRelease). On Windows this works because
VirtualFree(addr, 0, MEM_RELEASE) means "release the entire region" — Windows
ignores the length parameter for MEM_RELEASE and always frees the whole
allocation. On POSIX, munmap(addr, 0) fails with EINVAL, so the memory was
silently leaked every time.
2026-03-09 13:43:56 +09:00
Herman S.
b7add3e0ec [CPU/PPC] Add Linux workaround for fdiv instruction format
On Linux, these instructions appear to use A format (FRA, FRB, FRT)
instead of the standard X format (RA, RB, RT). Need to verify if this
is needed on Windows or is Linux specific.
2026-03-09 13:43:56 +09:00
Herman S.
52297ea8f8 [Linux] Implement fast mutex similar to Windows version 2026-03-09 13:43:56 +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.
15483b02af [Memory] Linux cleanup shm files on exit
Prevents running out of /dev/shm space and crashing the whole system.
2026-03-09 13:43:56 +09:00
Herman S.
ae1706d1dc [Threads] Ensure proper RTTI/vtable emission for PosixWaitHandle 2026-03-09 13:43:56 +09:00
Herman S.
174d2d4205 [Posix Threading] Robust mutexes 2026-03-09 13:43:56 +09:00
Herman S.
1ae82023ea [Posix Threads] Refactored condition variables from static to per-instance members and replaced deadlock-prone predicate-based WaitMultiple with polling using try_lock. 2026-03-09 13:43:56 +09:00
Herman S.
c9eba5daf8 [Threading] Signal handler / self-suspension improvements 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.
81dd887e74 [Kernel] Thread suspend for posix to match windows semantics 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.
28e48410c5 Fix potential buffer overflow in posix memory handling 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.
37fabb9346 [GPU] Ensure vsync works correctly on Linux.
Linux scheduler quantum is 4-10ms so requesting 15ms sleep ends
up sleeping 16-19ms and overshoots our target causing games to run
at 57fps
2026-03-09 12:41:53 +09:00
Herman S.
9a704bff1e Fix menu hotkeys on Linux 2026-03-09 09:41:47 +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
Gliniak
54400cbc2c [Build] Integration with CLion 2026-03-08 22:01:06 +01:00
Gliniak
6dfb323fe6 [Cmake] Filter Configuration presets. This removes VS preset visibility on linux 2026-03-08 16:52:50 +01:00
Herman S.
77535b7cec [Base] Replace CRITICAL_SECTION with SRWLOCK based mutexes
xe_fast_mutex now also asserts on recursive lock attempts
2026-03-09 00:19:32 +09:00
Herman S.
de63bb18a6 [Base] Use function-local static for global_mutex
File-scope static initialization order is undefined across translation
units. Code that acquires the global critical region during early startup
could run before the mutex constructor, operating on uninitialized state.
A function-local static is constructed on first use, guaranteeing the
mutex is initialized before any caller can access it.
2026-03-09 00:18:08 +09:00
Herman S.
eb914ae77d [Kernel] Return null on handle type mismatch instead of asserting 2026-03-09 00:07:45 +09:00
Gliniak
b5a7767aae [XAM] Added some missing user settings.
Names put according to findings in: 54510896
2026-03-07 23:39:39 +01:00
Gliniak
9e5fc57f66 [Cmake] Added directory tree to VS solution.
This recreates structure from premake almost 1:1
2026-03-07 20:26:45 +01:00
Gliniak
6bb5453110 [Build] Removed hardcoded generator for VS2022
Thanks tam098782
2026-03-07 20:24:16 +01:00
Herman S.
a26bbaa674 [3PP] Update FFmpeg version to include latest updates 2026-03-07 20:08:00 +09:00
AllanCat
10cecae4c2 [XMA] Fixed min output space gating to match Consume() write granularity
The decoder gate required a full frame of free blocks (4 mono / 8 stereo +
padding) before allowing a decode pass, but Consume() only writes
subframe_decode_count blocks per call. Games like TGM Ace with
subframe_decode_count=2 on a small ring buffer could never meet the old
threshold, causing a permanent decoder stall.
2026-03-07 11:46:21 +09:00
AllanCat
e8263d3672 [XboxKrnl/Audio] Corrected XMASetLoopData's pointer type.
Fixed an issue where bgm was not looping for games that uses looping feature.
2026-03-07 11:02:23 +09:00
Gliniak
4b0007bfe5 [XMP] Fixed error caused by incorrect audio allocation for FFMPEG 2026-03-06 20:48:25 +01:00
Gliniak
6446150a5e [Cmake] Moved tests to separate folders 2026-03-06 19:59:38 +01:00
Herman S.
2912da02fe [D3D12] Fix gamma_unorm16 render target transfer shaders
Gamma stored as R16G16B16A16_UNORM is 64bpp in host memory but
represents a single 32bpp pixel, unlike true 64bpp formats which pack
two 32bpp pixels together. Separate dest_is_gamma_unorm16 from
dest_is_64bpp to avoid incorrect coordinate transforms.

Add output paths for gamma_unorm16 destinations:
- gamma→gamma: direct passthrough (already linear in R16G16B16A16)
- k_8_8_8_8→gamma: convert gamma-encoded source to linear
- Cross-format packed EDRAM: midpoint encoding to survive UNORM16
  quantization round-trip through PreSaturatedLinearToPWLGamma

Fixes red bleeding in Halo Reach, image halving in Just Cause 2,
Portal not rendering, and black rock/plant textures in Halo Reach.
2026-03-06 23:05:39 +09:00
Herman S.
65d42843b6 Merge remote-tracking branch 'xenia-master/master' into canary_experimental 2026-03-06 23:05:24 +09:00
Herman S.
086decfa6e [Build] Enable test discovery in VS Test Explorer 2026-03-05 16:18:23 +09:00
Herman S.
16d2cc05c5 [GPU] Use UNorm not signed EDRAM encoding in k_16_16 resolve packing.
The original commit (2eea146b) correctly added kXenosFormat_16_16_EDRAM
case labels and fixed the unpack clamp from -1.0 to -32.0, but
incorrectly changed the resolve pack functions from UNorm to signed EDRAM
encoding. The resolve destination is a regular texture sampled as UNorm
[0,1], not EDRAM. Using EDRAM packing double-encodes the [-32,32]
scaling, crushing all values by ~64x and caused visual issues
particularly in UE3 titles.

The bytecode submitted with the change was actually correct, but the
source had additional incorrect pieces that only manifested when shaders
were rebuilt.
2026-03-05 15:11:22 +09:00
Herman S.
545b8bb8e9 [Docs] Add spirv-tools related installation info for linux 2026-03-05 09:41:56 +09:00
Gliniak
e576f3d924 [Cmake] Added directory split in Visual studio (and probably other IDEs)
Back as it was:
- src
- third_party

There is CmakePredefinedTargets, but it cannot be hidden
There is also an issue with tests as they aren't visible
2026-03-04 20:12:09 +01:00
Herman S.
a1710699cd [UI] Fix use-after-free in NoProfileDialog when closing 2026-03-04 20:58:00 +09:00