aboutsummaryrefslogtreecommitdiff
path: root/src/core/loader/nso.cpp
Commit message (Collapse)AuthorAgeFilesLines
* nx2: frame-locked input replay and quieter logsTakoroka7 days1-0/+1
| | | | | | | | | | | EDEN_NX2_KEY_RECORD records keyboard transitions as "f<frame>:code" against a global count of guest presents; EDEN_NX2_KEY_SCRIPT replays them on the same frames (or by seconds, as before), so a played session reproduces exactly. Debug aids: the PC/LR/SP of the first unmapped reads, NSO load addresses, EDEN_NX2_IPC_SUMMARY (request counts every 5 s), EDEN_NX2_FORCE_LOD0. Unmapped-access logging is rate limited and the per-draw/semaphore spam is demoted, so long sessions stay under the log size cap.
* [loader] add ZBIC (zstd variant) NSO decompression support for Switch 22.0+ ↵PavelBARABANOV2026-09-271-4/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#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>
* [core, hle, video_core, memory] Improve multi-process, display layers, ↵Maufeat2026-08-291-1/+4
| | | | | | | | | | | | | | | | | | | | | dynamic shader cache and rework overlay (#4238) - [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. ------------------- - Dynamic shader cache reloading capability for qlaunch - Multi-process improvements (thanks to @frank1734), instead of just using the main application we now respect caller process (also did it for HID devices while I was at it) - Layer stack masks & shared buffer screenshot for video core, added different masks (screenshot, recording, etc.) this was discovered as an issue due to how in qlaunch the transition was not right between applications. May not be perfect but also fixes screenshots while using qlaunch - Reworked overlay display management (input and visibility) - instead of random numbers as I've previously did, I decided to add an AppletZIndex enum for better readability. Also split capability of input by touch and gamepad. - etc. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4238 Reviewed-by: Samuel <lizzie@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
* [fmt] use {#:x} instead of 0x{:#x} (#4170)lizzie2026-07-251-1/+1
| | | | | | | | | | continuation of #309 but applying to even more files than before :) also makes them lowercase because `0xfafafa` is better as `0XFAFAFA` Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4170 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: Maufeat <sahyno1996@gmail.com>
* [video_core, hle] remove redundant parent references in system structs (#3908)lizzie2026-06-231-1/+1
| | | | | | | | | | reworked a bit to remove references of parent objects and instead pass as arguments to methods to prevent useless reloads Signed-off-by: lizzie <lizzie@eden-emu.dev> Co-authored-by: maufeat <sahyno1996@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3908 Reviewed-by: Maufeat <sahyno1996@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev>
* [common/logging] Simplify logging logic and fix issues when logging before ↵lizzie2026-03-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | system is created (#3688) - our logging code was bigger than spdlog itself, why???? just keep it simple - fix issues when logging before logging system is even started - removes the "initialized logging twice" issue - removes uneeded indirection in file logging - uses direct formatting instead of jumping hoopla-around the fmt::format() ressult - code duplication and dead code removal as usual I did explore dup2() but I think it's not worth the hassle I did try `fwopen()` but it's better if things are just kept as-is. there is a lot of noise because I removed a bunch of redundant files on logging and just put everything in one file now normally this wouldn't be a good idea, however consider: the complexity of logging; it's less than 500 lines... does it really need a whole subsystem?!?!?! ITS JUST LOGGING Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3688 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: DraVee <chimera@dravee.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [core/loader] prevent program_image reallocations in NSO+KIP loading methods ↵lizzie2026-02-281-59/+40
| | | | | | | | | | | | | | | (#3639) also changes some methods to std::span<> as well, but mainly std::vector<> in the NSO/KIP loading stuff is not needed to be memcpy'ed and memmove'd around this should save a marginal amount of loading time (RDR1) Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3639 Reviewed-by: DraVee <dravee@eden-emu.dev> Reviewed-by: Maufeat <sahyno1996@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [nce] add split patch mode to support modules bigger than 128MB (#3489)Maufeat2026-02-071-4/+32
| | | | | | | | | | nce patcher was extended to support modules larger than 128MB due to ARM64 branch limit. now added a pre-patch and (existing) post-patch module code. Allowwing MRS/MSR/SVC handler to remain within branch branch range Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3489 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: Maufeat <sahyno1996@gmail.com> Co-committed-by: Maufeat <sahyno1996@gmail.com>
* [fmt] use {:#X} for format instead of 0x{:X} (#309)lizzie2025-08-271-1/+4
| | | | | | | | Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/309 Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [core, nce] module_id cache key handling (#195)wildcard2025-08-041-0/+3
| | | | | | | | | | Uses Module_id plus offset for cache key, Module_id is unique to each module. Also passes the module_id everytime new patcher is created in case the module is too big. Co-authored-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/195 Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: wildcard <nubieluv@gmail.com> Co-committed-by: wildcard <nubieluv@gmail.com>
* core: Support multiple modules per patcherGPUCode2024-01-151-20/+21
|
* core: Rename patcher fileGPUCode2023-11-291-1/+1
|
* loader: fix gcc compileLiam2023-11-261-1/+1
|
* loader: apply nso patch to offset program imageLiam2023-11-251-4/+6
|
* core: Define HAS_NCE macroGPUCode2023-11-251-3/+3
|
* Address some review commentsGPUCode2023-11-251-7/+8
|
* arm: Implement native code execution backendLiam2023-11-251-7/+49
|
* core: improve debug workflowLiam2023-09-141-2/+3
|
* kernel: offset code entry point for 39-bit address space type (#11326)liamwhite2023-08-251-1/+1
|
* k_process: PageTable -> GetPageTableLiam2023-07-141-1/+1
|
* kernel: use KTypedAddress for addressesLiam2023-03-221-1/+1
|
* general: rename CurrentProcess to ApplicationProcessLiam2023-02-131-1/+1
|
* code: dodge PAGE_SIZE #defineKyle Kienapfel2022-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | Some header files, specifically for OSX and Musl libc define PAGE_SIZE to be a number This is great except in yuzu we're using PAGE_SIZE as a variable Specific example `static constexpr u64 PAGE_SIZE = u64(1) << PAGE_BITS;` PAGE_SIZE PAGE_BITS PAGE_MASK are all similar variables. Simply deleted the underscores, and then added YUZU_ prefix Might be worth noting that there are multiple uses in different classes/namespaces This list may not be exhaustive Core::Memory 12 bits (4096) QueryCacheBase 12 bits ShaderCache 14 bits (16384) TextureCache 20 bits (1048576, or 1MB) Fixes #8779
* general: fix compilation on MinGW GCC 12Liam2022-06-131-5/+4
|
* general: Convert source file copyright comments over to SPDXMorph2022-04-231-3/+2
| | | | | This formats all copyright comments according to SPDX formatting guidelines. Additionally, this resolves the remaining GPLv2 only licensed files by relicensing them to GPLv2.0-or-later.
* general: Make most settings a BasicSettinglat9nq2021-06-281-2/+2
| | | | | | | | | | | Creates a new BasicSettings class in common/settings, and forces setting a default and label for each setting that uses it in common/settings. Moves defaults and labels from both frontends into common settings. Creates a helper function in each frontend to facillitate reading the settings now with the new default and label properties. Settings::Setting is also now a subclass of Settings::BasicSetting. Also adds documentation for both Setting and BasicSetting.
* common: fs: Rework the Common Filesystem interface to make use of ↵Morph2021-05-251-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | std::filesystem (#6270) * common: fs: fs_types: Create filesystem types Contains various filesystem types used by the Common::FS library * common: fs: fs_util: Add std::string to std::u8string conversion utility * common: fs: path_util: Add utlity functions for paths Contains various utility functions for getting or manipulating filesystem paths used by the Common::FS library * common: fs: file: Rewrite the IOFile implementation * common: fs: Reimplement Common::FS library using std::filesystem * common: fs: fs_paths: Add fs_paths to replace common_paths * common: fs: path_util: Add the rest of the path functions * common: Remove the previous Common::FS implementation * general: Remove unused fs includes * string_util: Remove unused function and include * nvidia_flags: Migrate to the new Common::FS library * settings: Migrate to the new Common::FS library * logging: backend: Migrate to the new Common::FS library * core: Migrate to the new Common::FS library * perf_stats: Migrate to the new Common::FS library * reporter: Migrate to the new Common::FS library * telemetry_session: Migrate to the new Common::FS library * key_manager: Migrate to the new Common::FS library * bis_factory: Migrate to the new Common::FS library * registered_cache: Migrate to the new Common::FS library * xts_archive: Migrate to the new Common::FS library * service: acc: Migrate to the new Common::FS library * applets/profile: Migrate to the new Common::FS library * applets/web: Migrate to the new Common::FS library * service: filesystem: Migrate to the new Common::FS library * loader: Migrate to the new Common::FS library * gl_shader_disk_cache: Migrate to the new Common::FS library * nsight_aftermath_tracker: Migrate to the new Common::FS library * vulkan_library: Migrate to the new Common::FS library * configure_debug: Migrate to the new Common::FS library * game_list_worker: Migrate to the new Common::FS library * config: Migrate to the new Common::FS library * configure_filesystem: Migrate to the new Common::FS library * configure_per_game_addons: Migrate to the new Common::FS library * configure_profile_manager: Migrate to the new Common::FS library * configure_ui: Migrate to the new Common::FS library * input_profiles: Migrate to the new Common::FS library * yuzu_cmd: config: Migrate to the new Common::FS library * yuzu_cmd: Migrate to the new Common::FS library * vfs_real: Migrate to the new Common::FS library * vfs: Migrate to the new Common::FS library * vfs_libzip: Migrate to the new Common::FS library * service: bcat: Migrate to the new Common::FS library * yuzu: main: Migrate to the new Common::FS library * vfs_real: Delete the contents of an existing file in CreateFile Current usages of CreateFile expect to delete the contents of an existing file, retain this behavior for now. * input_profiles: Don't iterate the input profile dir if it does not exist Silences an error produced in the log if the directory does not exist. * game_list_worker: Skip parsing file if the returned VfsFile is nullptr Prevents crashes in GetLoader when the virtual file is nullptr * common: fs: Validate paths for path length * service: filesystem: Open the mod load directory as read only
* hle: kernel: Rename Process to KProcess.bunnei2021-05-051-3/+3
|
* loader: Resolve instances of variable shadowingLioncash2021-04-271-11/+11
| | | | | Eliminates variable shadowing cases across all the loaders to bring us closer to enabling variable shadowing as an error in core.
* common: Move settings to common from core.bunnei2021-04-141-1/+1
| | | | - Removes a dependency on core and input_common from common.
* hle: kernel: Migrate PageHeap/PageTable to KPageHeap/KPageTable.bunnei2021-02-181-1/+1
|
* hle: kernel: KThread: Reorganize thread priority defaults.bunnei2021-01-281-2/+2
|
* core: hle: kernel: Rename Thread to KThread.bunnei2021-01-281-1/+1
|
* core: Eliminate remaining usages of the global system instanceLioncash2020-11-271-4/+1
| | | | | | Removes all remaining usages of the global system instance. After this, migration can begin to migrate to being constructed and managed entirely by the various frontends.
* patch_manager: Remove usages of the global system instanceLioncash2020-11-181-1/+1
| | | | | | | With this, only 19 usages of the global system instance remain within the core library. We're almost there.
* core/CMakeLists: Make some warnings errorsLioncash2020-10-131-1/+1
| | | | | | | | | Makes our error coverage a little more consistent across the board by applying it to Linux side of things as well. This also makes it more consistent with the warning settings in other libraries in the project. This also updates httplib to 0.7.9, as there are several warning cleanups made that allow us to enable several warnings as errors.
* General: Make use of std::nullopt where applicableLioncash2020-09-221-3/+3
| | | | | | | | Allows some implementations to avoid completely zeroing out the internal buffer of the optional, and instead only set the validity byte within the structure. This also makes it consistent how we return empty optionals.
* loader/nso: Remove unnecessary [[maybe_unused]]Lioncash2020-09-161-2/+1
|
* core/loader: Remove dependencies on the global system instanceLioncash2020-09-161-4/+4
| | | | | | | | | Now all that remains is: 18 instances in file_sys code 14 instances in GDB stub code (this can be tossed wholesale) 4 instances in HLE code 2 instances in settings code.
* loader/nso: Resolve moves not occurring in DecompressSegmentLioncash2020-04-171-1/+1
| | | | | | | | Given the std::vector was const, an automatic move out of the function could not occur. We can allow automatic return value optimizations to occur by making the buffer non-const.
* loader: nso: Fix loader size and arguments.bunnei2020-04-171-10/+12
|
* core: memory: Move to Core::Memory namespace.bunnei2020-04-171-2/+2
| | | | - helpful to disambiguate Kernel::Memory namespace.
* loader: nso: Fix loading of static objects to be properly sized and aligned.bunnei2020-04-171-19/+9
|
* loader: provide default arguments (zero byte) to NSOsMichael Scire2020-01-221-3/+8
| | | | | | | | | | Certain newer unity games (Terraria, Pokemon Mystery Dungeon) require that the argument region be populated. Failure to do so results in an integer underflow in argument count, and eventually an unmapped read at 0x800000000. Providing this default fixes this. Note that the behavior of official software is as yet unverified, arguments-wise.
* core/loaders: Simplify PhysicalMemory usage.Markus Wick2020-01-181-5/+7
| | | | | It is currently a std::vector, however we might want to replace it with a more fancy allocator. So we can't use the C++ iterators any more.
* core/loader: Track the NSO build ID of the current processZach Hilman2019-09-301-0/+1
|
* nso: Pass build ID directlyZach Hilman2019-09-211-2/+1
| | | As opposed to converting to string and then back to hex array
* VM_Manager: Align allocated memory to 256bytesFernando Sahmkow2019-07-191-1/+1
| | | | | | This commit ensures that all backing memory allocated for the Guest CPU is aligned to 256 bytes. This due to how gpu memory works and the heavy constraints it has in the alignment of physical memory.
* Merge pull request #2482 from DarkLordZach/prepobunnei2019-06-211-0/+9
|\ | | | | core: Add detailed local reporting feature for development
| * loader: Move NSO module tracking to AppLoaderZach Hilman2019-05-261-3/+9
| | | | | | Also cleanup of general stuff