aboutsummaryrefslogtreecommitdiff
path: root/src/common
Commit message (Collapse)AuthorAgeFilesLines
* video_core: NVIDIA DLSS through NVIDIA Streamline in place of a game's DLSSDuck9127 hours4-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a Graphics setting, "Use NVIDIA DLSS in place of a game's DLSS" (nvidia_dlss, off by default). When it is on, in Windows builds configured with EGLANTINE_STREAMLINE_SDK, the evaluation Eglantine already replaces with FSR 3.1 goes to NVIDIA DLSS on GeForce RTX cards, with the same inputs (colour, depth, motion vectors, jitter). When DLSS can't run, FSR 3.1 runs as before. Only Streamline's MIT-licensed headers are compiled in; nothing of NVIDIA's is linked or shipped. At run time Eglantine looks for sl.interposer.dll in the user folder's "streamline" folder (or EDEN_STREAMLINE_DIR, or "streamline" next to the executable), checks its Streamline signature and starts Streamline with manual hooking. Streamline's plugins come from that folder or the NVIDIA app's downloads. DLSS itself is nvngx_dlss.dll in the same folder, else the newest DLSS 310 or later that the NVIDIA app has downloaded, checked for NVIDIA's Authenticode signature and copied as streamline/nvidia-app/nvngx_dlss.dll. Like other tools that call DLSS outside a game, it uses its own fixed project id with the custom engine type. - Preset K for all modes (EDEN_NX2_DLSS_PRESET overrides it): the default Performance model (M) and L draw thin dark horizontal lines in some frames at 2x resolution scale; K doesn't. - HDR input with auto exposure; the mode follows the render/output ratio. - Buffer device address stays enabled when DLSS needs it, for DLSS only. - The upscaler waits for the device instead of submitting when it is destroyed: by then the game's channels are released, and a submit read the state tracker's stale flags (a crash when stopping a game). With the setting off, or in builds without the SDK path (the setting is hidden there), nothing changes. Testing: Windows 11, RTX 5080, Fire Emblem: Fortune's Weave docked at 1x (720p -> 1440p) and 2x (1440p -> 2880p), CLI runs and GUI play, stopping and restarting games with DLSS on. Not tested on other GPUs or games. Assisted-by: Claude Opus 5.5 (implementation, debugging) Signed-off-by: Duck912 <350528965+Duck912@users.noreply.github.com>
* common: measure the TSC only on CPUs without CPUID leaf 0x15 (#373)Duck18 hours1-2/+4
| | | | | | | | | | | | | | | | | The fallback that measures the TSC rate when the CPU reports none was meant for AMD, which has no leaf 0x15 at all. It also caught Intel CPUs that have the leaf but report a crystal frequency of 0 (Coffee Lake, e.g. the i5-9400F) and moved them from the OS clock to the measured RDTSC clock. With the same fallback in another Eden-based build, an i5-9400F crashed about 3.5 s after launch; limiting the fallback to CPUs without the leaf fixed it for that tester. Those Intel CPUs now keep the OS clock, as before the fallback. AMD CPUs still get the measured RDTSC clock (a Ryzen 7 9800X3D reports max leaf 0xd, so nothing changes there). Assisted-by: Claude Opus 5.5 (debugging, porting and drafting) Signed-off-by: Duck912 <350528965+Duck912@users.noreply.github.com>
* Merge pull request #313 from cira0100/ldn/room-handshakeMako24 hours2-5/+28
|\
| * network: close each bsd fd once and drop unwanted or malformed room packetscirakg24 hours2-5/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Two threads closing the same fd both copied the descriptor and both called Close(), so a host socket could be closed twice, and the second closesocket could hit an unrelated socket that had reused the host fd. CloseImpl now frees the slot under file_descriptors_mutex first and only that thread closes the socket; the other gets EBADF. OnProxyPacketReceived decompressed every room packet when any fd had a socket, including native sockets and proxy sockets on other ports. Sockets now report through AcceptsProxyPacket whether they want a packet, and only those are collected, so an unwanted packet is not decompressed. DecompressDataZSTD passed the frame's declared size straight to the vector constructor, so a malformed or unsized frame from a room member threw on the room thread. The new TryDecompressDataZSTD rejects invalid, unsized and oversized frames, and bsd drops such packets with a warning. DecompressDataZSTD now returns an empty vector for them instead of throwing. Assisted-by: Claude Opus 5.5 (investigation and implementation)
* | fix: update BUILD_ID definition and improve path handling in GameListWorkerkraibse25 hours1-0/+1
|/
* settings: default to ScaleForce and FXAAsnowstormxd28 hours2-2/+4
| | | | | | Include both filters in the accepted MKW preset and verify defaults and saved-preference overrides. Assisted by Codex.
* settings: restore the recommended MKW settings promptsnowstormxd28 hours1-0/+35
| | | | | | Apply accepted settings visibly and save them, then reapply after per-game configuration. Include handheld mode. Assisted by Codex.
* settings: default to handheld mode on all platformssnowstormxd30 hours1-4/+0
| | | | Assisted by Codex.
* core: skip empty bitmap ranges during cache and scheduler traversalsnowstormxd30 hours1-6/+10
| | | | | | Adapted bitmap scans from sylvieistaken/selevet-eglantine performance build 4. Keep the wide-priority fallback and fix the first live slot after empty bitmap words. Include randomized lifecycle and ordering checks. Assisted by Codex.
* Merge nx2 into nx2-experimentalkraibse35 hours1-2/+25
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Resolved by area: - audio feature_support.h: nx2's native revision handling. - fiber.cpp: ours, which also drops the unused rewind stack. - host_memory.cpp: ours granule bitmap and HintCold, plus nx2's fallocate hole punching per whole dirty granule on Linux. - texture_cache.h: nx2's old-age eviction pass, then our Collect(). - kepler_compute.cpp: shared upscale slots, then Fortune's Weave's, then the Kirby Air Riders scan. - nx2_gsv.h: ours, plus nx2's GetBufferMaxResolution and graphics device ids (1-based). - nvhost_ctrl_gpu.cpp: engine support flag bits 40-44. - lower_to_maxwell.h: ours as the base, with nx2's seven lowering commits applied one at a time. Second texture descriptor buffers are read bindless in TEX, TLD.SCR (level zero) and SUST; FSEL keeps its operand modifiers; TXD takes any channel mask. lower_to_maxwell.h lowers 837 Fortune's Weave and 1183 Mario Kart World shader dumps with the same rejects as nx2 and ours (12 and 0). Assisted-by: Claude Sonnet 5.5 (conflict analysis and drafting)
| * Linux and AMD: BC3 flashing on RADV, ASTC decode stalls, lower RAM usage, a ↵Whovian6441 hours2-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | buffer cache crash (#260) * host_memory: punch holes in the backing on Linux instead of zero filling freed memory Freeing guest memory zero filled the memfd backing with memset, which commits every page it touches. fallocate(PUNCH_HOLE) hands the pages back to the kernel instead, and they read as zero afterwards. Only the partial pages at the ends are still cleared by hand. Mario Kart World on Linux (RX 9070 XT, 31 GB): peak RSS 23.1 -> 15.9 GB. EDEN_PUNCH_HOLE=0 restores the memset. Assisted-by: Claude Opus 5.5 (debugging, profiling and code drafts) * fiber: don't zero fill the stacks, untouched pages stay unbacked The value initialised stack arrays were zero filled when each fiber was made, which commits the whole stack. Left uninitialised, the pages a fiber never touches stay unbacked. Together with the descriptor ring change, about 1.2 GB less RSS in Mario Kart World. Assisted-by: Claude Opus 5.5 (debugging, profiling and code drafts) * vulkan: don't zero fill the descriptor update ring Same as the fiber stacks: make_unique value initialised the whole ring for every frame in flight. Entries are always written before they are read, so allocate it without initialising it. Assisted-by: Claude Opus 5.5 (debugging, profiling and code drafts) * vulkan: wait for the GPU after an ASTC transcode decode like the other ASTC decodes TranscodeAstcToBcn (astc_recompression Bc1/Bc3 with GPU decode) was the only ASTC decode recorded with wait = false. On RADV (RX 9070 XT, Mesa) Mario Kart World with BC3 flashed heavily all over the screen, while the uncompressed GPU decode, which waits, did not. CPU decode with BC3 does not flash either. Waiting after the transcode removes the flashing; full pipeline barriers around its copy did not, so the wait hides a race somewhere else rather than fixing one in the transcode itself. Assisted-by: Claude Opus 5.5 (debugging, profiling and code drafts) * vulkan: submit after an ASTC decode instead of waiting for the GPU by default Every ASTC decode ended with scheduler.Finish(). Over a 19 minute Mario Kart World Grand Prix that stalled the GPU thread 30.7 s in total, up to 1.2 s out of every 5 s while new textures stream in (track sections, race starts), which is where the hitches were. Flushing keeps the ordering that stops the BC3 flashing on RADV without the CPU waiting: no flashing in play, and frames over 100 ms went from dozens to 3 in about 7 minutes. EDEN_NX2_ASTC_FLUSH=0 restores the wait. Assisted-by: Claude Opus 5.5 (debugging, profiling and code drafts) * texture_cache: over the expected use, evict costly images unused for 1800 frames first The collector never deletes CostlyLoad images outside aggressive mode, so once a cup moves on, the previous tracks' textures stay resident and the cache sits over its expected use deleting the cheap images still in use. When over the expected use, costly images unused for 1800 frames (half a minute) now go first. Mario Kart World Grand Prix on an RX 9070 XT: frames over 20 ms 8.8% -> 4.0%, 58.7 fps average. EDEN_NX2_TC_OLD_AGE=<frames> sets the age, 0 turns it off. Assisted-by: Claude Opus 5.5 (debugging, profiling and code drafts) * buffer_cache: no buffer for device addresses past the page table FindBuffer indexed page_table, which covers 2^36 bytes, with any address. Mario Kart World crashed after about 4.5 minutes with a uniform buffer at 0x72253b2f2890 (FindBuffer <- UpdateUniformBuffers <- DrawEnd from a macro), reading far past the table. Treat such an address as no buffer. Where that address comes from is still unknown; this only stops the crash. Assisted-by: Claude Opus 5.5 (debugging, profiling and code drafts)
* | Merge remote-tracking branch 'origin/fix/memory-skip-zero-clears' into ↵Takoroka2 days2-1/+76
|\ \ | | | | | | | | | | | | | | | | | | test/linux-all-prs-plus # Conflicts: # src/common/host_memory.h
| * | memory: skip clearing guest memory that is still zeroTakoroka5 days2-1/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The kernel clears every page it hands out, and the backing memory is a page-file section the host only gives RAM to once a page is touched. So the clears themselves made every page of a game's heap resident: Mario Kart World (12 GB layout) had a 12.5 GB working set 20 s after boot. HostMemory keeps two bits per 64 KiB of backing: used (handed out by the kernel at least once) and dirty (may hold data). Pages returned to the kernel mark their granules dirty, and a zero clear only touches dirty granules; a granule cleared in full is clean again. A new kernel on the same memory marks everything a previous one used dirty, so leaked processes can't leak data into the next game. KMemoryManager's optimized-process fill and KSharedMemory's clear go through the same path. Mario Kart World, title screen and attract demo, 180 s: working set 20 s in 4.7-6.4 GB instead of 12.5 GB, peak 14-17.6 GB instead of 20.1 GB.
* | | Merge remote-tracking branch 'origin/fix/sparse-vector-free-region' into ↵Takoroka2 days1-3/+4
|\ \ \ | | | | | | | | | | | | test/linux-all-prs
| * | | common: forget a sparse vector's region when it is freedTakoroka2 days1-3/+4
| | |/ | |/| | | | | | | | | | | | | | | | | | | Regions are kept in host pages but were looked up by byte address when freed, so none was ever removed, and the fault handler kept matching faults in released address ranges (and in the page after each region, as the end was treated as inclusive).
* | | Merge remote-tracking branch 'origin/fix/fiber-stack-no-zero-fill' into ↵Takoroka2 days1-6/+7
|\ \ \ | | | | | | | | | | | | test/linux-all-prs
| * | | fiber: leave guest thread stacks uninitialized, drop the unused rewind stackTakoroka2 days1-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each fiber zero-filled two 2 MiB std::arrays, the stack and a rewind stack nothing ever switched to, so every guest thread held 4 MiB of RAM however little stack it used: ~750 MiB for title 1's ~190 threads. The stack is now allocated without being touched, so the host backs only the pages a thread uses. (cherry picked from commit f5e7d0f2eed854a0f821f8a04253f04cf77db575)
* | | | Merge remote-tracking branch 'origin/fix/cold-hint-uploaded-memory' into ↵Takoroka2 days2-0/+27
|\ \ \ \ | | | | | | | | | | | | | | | test/linux-all-prs
| * | | | texture_cache: mark guest memory textures were uploaded from coldTakoroka2 days2-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Once a texture is uploaded the host GPU has its own copy, and the guest rarely reads that memory again, but it stayed in the emulator's working set. Every 600 frames the guest ranges of images uploaded since (64 KiB or more, not GPU-written or sparse) are marked cold through HostMemory::HintCold, backing and CPU view, from a low-priority worker, so the OS pages them out before anything else when it needs RAM. Their contents stay; using them brings them back. Mario Kart World's title screen at ~10 minutes: game memory in RAM 4.8-5.5 -> 3.6 GB, the emulator's real RAM 10.6-11.9 -> 9.4 GB, frames over 100 ms not worse. (cherry picked from commit ea36b2c5ca352f8c8cdcc829a2d3bde9bdc06ece)
| * | | | nx2: let the host page out texture pool backing firstTakoroka4 days2-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch 2 sparse blocks and GPU-only regions get guest memory when a game writes them (Mario Kart World copies 2-4 GB of compressed textures into its sparse texture pools) and the texture cache reads it again only when it builds an image there. Every 30 s, mark that backing cold: its pages leave the working set (VirtualUnlock on Windows, MADV_PAGEOUT on Linux) so the OS compresses or pages them out before anything else when RAM is short. The contents stay. Mario Kart World: 8.5 GB of RAM in use at five minutes instead of 9.0 GB on a machine with RAM to spare, frame times unchanged.
* | | | | Merge remote-tracking branch 'origin/fix/astc-bc3-default' into ↵Takoroka2 days1-1/+3
|\ \ \ \ \ | |_|_|/ / |/| | | | | | | | | test/linux-all-prs
| * | | | settings: recompress ASTC to BC3 by defaultTakoroka4 days1-1/+3
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | GPUs without ASTC support keep ASTC textures uncompressed (RGBA8) unless recompression is on, four times the VRAM of BC3. Mario Kart World on an 8 GB card used 7.3-7.8 GB of a 7.1 GB budget, the rest paged into system RAM (1.1 GB); with BC3 it uses 6.7-6.9 GB and pages 0.25 GB.
* | / / macOS: fix the build with AppleClang and use the Eglantine app iconSssnowyyy3 days1-1/+1
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | The zbic_compression.cpp warning suppressions only matched the Clang and GNU compiler IDs, so AppleClang failed it with -Werror=unused-function. The bundle pointed at dist/eglantine.icns, which was never added after the rename (and the fallback to eden.icns shows Eden's logo); generate it from dist/Eglantine.png and use it. Assisted-by: Claude Opus 5.5 (debugging and code changes)
* | | 1st pass of review: code cleanup & windows testnéo Luigi3 days2-0/+16
| | | | | | | | | | | | Assisted-by: Claude Opus 5.5 (review, cleanup and log analysis)
* | | texture_cache: keep Switch 2 VRAM use under the driver's budgetWael3rd3 days2-0/+14
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mario Kart World filled the GPU after a few minutes on 8 GB cards, and on 16 GB cards with uncompressed ASTC: textures were created without memory (garbage), then the emulator crashed. The Switch 2 collector thresholds came from the sum of all heap budgets, but on AMD the host-visible device-local heap is the same VRAM, so the critical threshold ended above the real budget and the collector never kicked in. Unbacked images were also counted at their full size. Thresholds now follow the main device-local heap's budget, re-read every 30 frames, and images count the memory they really have. Switch 2 titles on GPUs under 12 GiB re-compress ASTC to BC3 for the session when it is set to Uncompressed (EDEN_NX2_KEEP_ASTC=1 opts out), and EDEN_NX2_VRAM_LIMIT_MIB simulates a smaller GPU for testing. Assisted-by: Claude Opus 5.5 (diagnosis and code)
* | Added FSR 3 Upscaling and Frame GenerationDjihads804 days3-1/+12
| |
* | texture_cache: re-decode only the written layers of large ASTC arraysTakoroka4 days1-0/+7
|/ | | | | | | | | | | | | | | | | | | Any write into an image marked all of it CPU-modified, so each terrain tile Mario Kart World streams into its 8192x8192x68 ASTC arrays re-read and re-decoded the whole 1.45 GB array: a 2 GiB staging buffer and a full GPU wait each time, 15-16 GB of uploads per 600 frames. Large layered images on the accelerated ASTC path (64 MiB and up) now record the layers written since their last upload and stay tracked; a refresh reads and decodes only those layers, one dispatch per layer and level into a single-layer storage view. The texture cache's 600-frame report counts uploads from guest memory, their size and how many went by layer. Upload scratch buffers grown past 64 MiB for one huge image (341 MiB for the terrain layer pools) are freed at the next frame instead of kept for the session. Mario Kart World, 180 s: after loading, uploads drop from 15-16 GB to 0.2-0.5 GB per 600 frames, the largest from 1453 MiB to 2-15 MiB.
* nx2: run the guest counter at 31.25 MHz for Switch 2 titlesTakoroka5 days2-8/+45
| | | | | | | | | | | | | | | | | | | | The Switch 2 counter runs at 31.25 MHz and its SDK converts ticks with that constant: Mario Kart World's sdk builds 31,250,000 in nn::os::GetSystemTickFrequency, TickManager::ConvertToTimeSpan and TickManager::ConvertToTick (19.2 MHz appears nowhere). Eglantine counted at the Switch 1 rate for every title, so every tick-based time in a Switch 2 game was off by 1.63x: elapsed times read short, and a deadline of one 60 Hz frame converted to ticks waited ~27 ms. The wall clock now has a guest counter frequency, set at boot: 31.25 MHz for Switch 2 programs, 19.2 MHz otherwise, EDEN_NX2_CNTFRQ=<Hz> to force one. CNTPCT reads, CNTFRQ_EL0, svcGetSystemTick, thread tick counts and the time services' tick conversions follow it, and the CNTPCT spin detection keeps its ~1.7 us threshold. Mario Kart World, title screen and attract demo, 180 s, same build: frame times unchanged (17-19 ms once warm), process CPU time 848 s instead of 930 s.
* kernel: clear the fastmem arena when the application process is closedTakoroka5 days1-0/+4
| | | | | | | | | | | | | | | Loading a Switch 2 game after another one in the same window hung or crashed it at boot. The first game's process still had 55-60 references at kernel shutdown, so it was never finalized and its memory stayed mapped in the fastmem arena. The next game's mappings at the same addresses then failed ("Failed to split placeholder" / "Failed to map placeholder"), and it ran on the first game's memory: Mario Kart World loaded after another Switch 2 game jumped to a garbage address from rtld, or hung. Detach the closed process from the arena (a late finalize must not unmap the next game's memory), unmap the whole arena, and log when the process was still referenced.
* common: pass-through hash for integer and pointer keys; RangeSet::IntersectsTakoroka5 days5-2/+39
| | | | | | | | | | | Common::unordered_map/set defaulted to std::hash, a byte-wise FNV-1a on MSVC for integers and pointers, which boost's flat containers then mix again: the GPU thread's page maps (shader and query cache invalidation, per inline upload) spent ~1% in it. Integer and pointer keys now go through as they are and boost mixes them. BufferCache::IsRegionGpuModified visited every GPU-written range inside the query just to answer yes or no; without per-fence downloads those ranges stay fragmented and it was ~4% of title 1's GPU thread (inline uploads). RangeSet::Intersects answers with one lookup. Inline uploads: 10.5% -> 7.5% of the GPU thread.
* video_core: skip empty fences; one lock per cache per fence; single-pass ↵Takoroka5 days1-18/+15
| | | | | | | | | | | | | overlap subtract Switch 2 titles signal a fence for each compute dispatch's release (5,000-7,000 a second in title 1). With fast GPU fences the callback runs at once, so a fence with no downloads, queries or queued operations does nothing: those (~20%) are no longer made (one in 64 still is, for the operations fences carry). Each cache's lock is now taken once per fence (the flush check took both together first). The overlap range set's Subtract restarted its search after every erase (quadratic); the fencing thread runs it for every downloaded range while holding the buffer cache. The GPU profiler counts fences, skipped fences and buffer download bytes.
* video_core: less waiting on the GPU caches' locksTakoroka6 days2-0/+99
| | | | | | | | | | | | | | | - The texture and buffer caches' mutexes spin briefly before sleeping (Common::SpinRecursiveMutex): the GPU thread, the fencing thread and CPU write traps take them tens of thousands of times a second for microseconds, and a sleeping waiter's wake-up took longer than that. Title 1's GPU thread slept 7.7% of its time there, now 3.7%. - Fences commit and pop texture and buffer downloads separately, and only when there are any (one fence per compute dispatch in Switch 2 titles): the fencing thread no longer holds both caches while it copies buffer downloads. - Inline uploads and pre-draw invalidation take the caches one at a time again: holding one while std::lock waited for the other waited longer.
* nx2: measure the TSC on AMD, no rethrows for rejected shaders, debug hooks ↵Takoroka6 days1-0/+7
| | | | | | | | | | | | | | | off the hot path - AMD CPUs have no CPUID leaf 0x15, so the TSC frequency stayed 0 and every guest CNTPCT read went through QueryPerformanceCounter (~10% of the game's main core in title 1). Measure it like Intel CPUs without a crystal frequency. - A rejected native shader was rethrown (two C++ throws) every time it was bound; return false instead (~1-2% of the GPU thread). - The semaphore watch, pushbuffer entry hashing, first-write trace and per-macro debug logs ran on every command word or macro call; they now cost a flag check unless their environment variable is set (~4% of the GPU thread). Also starts the macro engine's profile zone.
* Fix build with MSVC 14.51 (VS 2026)Takoroka7 days2-2/+2
| | | | | | | - sparse_large_vector: ULONG_PTR -> u64 needs static_cast, not reinterpret_cast - zbic_compression: silence C4505/C5245 for the amalgamated zstd.c, which is compiled as project code and hits /we4505 - launch_params: explicit int -> bool (C4800 is an error here)
* [video_core, settings] readback for nce invalidations (#4490) optimization ↵xbzk8 days1-2/+0
| | | | | | | | | | | | | | | | | | and nuke toggles (#4502) (#4531) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md). - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Follow up for #4490: Originally i was racing locks between dirty and clean invalidations, but +94% were clean so it was causing useless locks. Solutioin was to share locks between both. P.S.: THIS IS INTENDED TO FIX RANDOM CRASHES IN UE, OBJECTIVELY REPRODUCIBLE IN ENDER MAGNOLIA IN ANDROID. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4531 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: Shinmegumi <shinmegumi@eden-emu.dev>
* [core] Support block-compressed NSZ and XCZ (#4552)PavelBARABANOV8 days2-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md). - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- - Add NCZBLOCK (nsz -B / .xcz) reader: each read decodes only the covered blocks and re-encrypts CTR sections, no disk output. - Allow installing solid .nsz to NAND via DecompressNCZForInstall (lazy, incremental decode with frontier, O(n) instead of O(n^2)). - Accept BKTR updates with thousands of sections (MaxSectionCount = 0x10000). - Wire .nsz/.xcz into loader, registered cache, scanner, and NAND install (content_manager.h), and reject solid NCZ from the game list. - Bump the pinned zstd to 33618c8 in cpmfile.json, which includes the upstream AArch64 revert ([33618c89](https://github.com/facebook/zstd/commit/33618c89e511637f8a6ef955b3501766d71feb53)) for a ZSTD_decodeSequence branch optimization that could corrupt data on ARM64; without it, solid NCZ decoding on Android fails with "Data corruption detected". NCZ format and CTR counter semantics follow the reference nsz tool and its Rust port: - https://github.com/nicoboss/nsz (Decompressor.py, BlockDecompressorReader.py) - https://docs.rs/nsz-rs/0.3.0/src/nsz_rs/decompress.rs.html The last-block edge case (decompressed size is an exact multiple of block size) is handled as described in https://github.com/nicoboss/nsz/issues/210 Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4552 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: Shinmegumi <shinmegumi@eden-emu.dev>
* [patcher, ro, settings] runtime tls patch (#4492) optimization and nuke ↵xbzk2026-10-151-2/+0
| | | | | | | | | | | | | | | | toggle (#4502) (#4523) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- This is a follow up for the biomutant fix. By the time i knew it was shallow, coz i was running patchtext routine even for svc and modules, causing a routine which were needed to run 14 times to run 4000+ instead. Since some perf loss was reported in 30 sep nightly, and it caused ac3r to not boot, we had added a temp toggle, which is now being removed as optimizations + fix are in. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4523 Reviewed-by: lizzie <lizzie@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
* [video_core] Skip fragment shaders with known issues on non-NVIDIA drivers ↵MaranBr2026-10-081-3/+0
| | | | | | | | | | | | | | | (#4503) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Skip fragment shaders using a pattern that is not supported by non-NVIDIA drivers. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4503 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
* [android, renderer_vulkan] Сhange default settings (#4509)PavelBARABANOV2026-10-081-12/+12
| | | | | | | | | | | | | | | | | | - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Airplane mode: On - needed to launch many games. Nvdec: CPU - fixes most issues in cutscenes. AudioEngine: Sdl3 (only Android) - "Auto" includes Cubeb on Android, but SDL3 works better. Async GPU: On - In most games, this provides a 30% boost in performance. Async presentation: On (Remove async presentation toggle from Android, It is no longer needed). Co-authored-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4509 Reviewed-by: Maufeat <sahyno1996@gmail.com> Reviewed-by: lizzie <lizzie@eden-emu.dev>
* [settings] add PR4490 & PR4492 toggles (#4502)xbzk2026-10-051-0/+4
| | | | | | | | | | | | | | - [X] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [X] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [X] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- TEMPORARY! Pushed under Camille's instruction. Will be dropped as soon as they get optimized. Aimed to avoid reported perf impact from PRs 4490 and 4492 on 30-sep-2026 nightly, Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4502 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
* [settings,qt] merge of "disable controller applet" toggle with "controller ↵xbzk2026-09-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | applet mode" picker (#4498) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Small good simplification to nuke a toggle which costed me almost an entire day of work when fixing controller applet issues: There were two settings related to Controller applet: -"disable controller applet", which is a boolean toggle; -"controller configuration" applet mode, which is a "Real"/"Custom" picker; All i did was to nuke the toggle and add a third option "Disabled" to the picker. Users which used the disable toggle will have to pick Disabled; Real/Custom settings wont be affected since their indexes remains. All options tested against diablo 3. All working as intended. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4498 Reviewed-by: lizzie <lizzie@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
* [loader] add ZBIC (zstd variant) NSO decompression support for Switch 22.0+ ↵PavelBARABANOV2026-09-273-0/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#4482) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- A new NSO compression method was introduced in Switch 22.0.0. This is a customized variant of zstd and is used when NSO flags have bit 7 set. Key characteristics: - ZSTD_MAGICNUMBER is set to 0x4349425A (b'ZBIC') instead of 0xFD2FB528 - ZSTD_LEGACY_SUPPORT is set to 0 - ZSTD_TRACE is set to 1, zstd version used is 1.5.7 (10507) - FSE_readNCount is replaced with a BIC (Binary Interpolative Coding) version which improves compression of entropy tables significantly Source: https://switchbrew.org/wiki/22.0.0 Implementation: - Detect ZBIC segments via NSO flag bit 7 (NsoFlags_UseZbicCompression) and/or ZBIC magic scan in nso.cpp - Fall back to LZ4 when ZBIC is not detected or returns unexpected size - Handle segment 0 alternate offset (0x100 vs 0x108) for both ZBIC and LZ4 References: - Atmosphère loader/strat zstd-zbic integration: https://github.com/Atmosphere-NX/Atmosphere/commit/082115187a0509cb6b8a757de639a4e4741b8712 - nxdumptool ZBIC segment compression support: https://github.com/DarkMatterCore/nxdumptool/commit/441e5c0904f29427987433be4eb057a2843d222a - STORM_SWITCH ZBIC implementation: https://github.com/ReiKatari/STORM_SWITCH/commit/1e09eb82b760aaf340b810031400991c0740c091 Tested with firmware 23.0.0 and ZBIC-compressed NSOs. Co-authored-by: xbzk <xbzk@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4482 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: lizzie <lizzie@eden-emu.dev> Reviewed-by: Maufeat <sahyno1996@gmail.com>
* [common/sparse_large_vector] correct Win32 exception handler (#4481)Exverge2026-09-262-28/+49
| | | | | | | | | | | | | | | - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Adds mutex to prevent multiple threads from accessing the vector at the same time and corrects the Windows exception handler to use the correct faulting address used by the exception handler (previously used the instruction address instead of the fault address) and properly shifts the stored values for the handler. Fixes weird compiler-specific bugs on Windows Co-authored-by: bruno <protoxseven@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4481 Reviewed-by: lizzie <lizzie@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
* [buffer_cache] Simplify GPU fence synchronization and remove GPU buffer ↵MaranBr2026-09-263-14/+2
| | | | | | | | | | | | | | | | | | | readback (#4477) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- This is understood to improve GPU synchronization within the buffer cache in certain edge cases. GPU Fence Strict is no longer necessary. We now apply the stronger synchronization only in the specific case that actually requires it. The GPU Buffer Readback has been removed, as it is no longer needed following PR #4473. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4477 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
* [common] Use `std::make_unique_for_overwrite<T>` in ScratchBuffer, remove ↵lizzie2026-09-253-34/+6
| | | | | | | | | | | | | | | | | | | | polyfill (#4432) Original `make_unique_for_overwrite.h` is well defined acc. to standard https://en.cppreference.com/cpp/memory/unique_ptr/make_unique, but by now most libc++ supports the function, so no need for polyfill. Test that this didn't break anything (for example, Megaman game that has video at the start), or anything using VIC/IPC. Signed-off-by: lizzie <lizzie@eden-emu.dev> - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4432 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
* [common/sparse_large_vector] decommit unused pages + fix first page in ↵Exverge2026-09-232-3/+32
| | | | | | | | | | | | | | | zeroed region (#4471) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Fixes a bug where the first page of a zeroed out region would not be properly zeroed, and now frees unused memory. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4471 Reviewed-by: lizzie <lizzie@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
* [common/error] remove preprocessor macros for strerror_r gating (#4450)lizzie2026-09-191-20/+18
| | | | | | | | | | | | | | | | We use C++, we can just use SFINAE for this. Signed-off-by: lizzie <lizzie@eden-emu.dev> - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4450 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: Shinmegumi <shinmegumi@eden-emu.dev>
* [common] Fix RDTSC nanosecond conversion (#4422)Feng Chen2026-09-172-3/+5
| | | | | | | | | | | | | | | | Split the RDTSC ticks-per-nanosecond ratio into integer and Q0.64 fractional components. This avoids overflowing GetFixedPoint64Factor for TSC frequencies above 1 GHz while preserving the multiply-only conversion path. Use the invariant clock only above 1 GHz because the reverse nanoseconds-per-tick factor cannot represent an exact ratio of one. - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4422 Reviewed-by: lizzie <lizzie@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
* [msvc] fix build errors (#4451)lizzie2026-09-171-1/+2
| | | | | | | | | | | | | | | | | MSVC doesn't consider atomic<u64> to be trivially copyable on x86 (why?). And other chary idiosyncrasies from constructing `std::optional<uint8_t>` Signed-off-by: lizzie <lizzie@eden-emu.dev> - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4451 Reviewed-by: Maufeat <sahyno1996@gmail.com> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
* [common/page_table] unmark non-constexpr functions (#4433)lizzie2026-09-171-3/+3
| | | | | | | | | | | | | | | | | | `std::atomic` member functions don't translate unto `constexpr`. Trivial change, fixes CI warning. Signed-off-by: lizzie <lizzie@eden-emu.dev> - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4433 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>