aboutsummaryrefslogtreecommitdiff
path: root/src/core/loader/nso.h
Commit message (Collapse)AuthorAgeFilesLines
* [loader] add ZBIC (zstd variant) NSO decompression support for Switch 22.0+ ↵PavelBARABANOV2026-09-271-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#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: Support multiple modules per patcherGPUCode2024-01-151-1/+2
|
* arm: Implement native code execution backendLiam2023-11-251-1/+6
|
* 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.
* hle: kernel: Rename Process to KProcess.bunnei2021-05-051-3/+3
|
* loader: Resolve instances of variable shadowingLioncash2021-04-271-7/+9
| | | | | Eliminates variable shadowing cases across all the loaders to bring us closer to enabling variable shadowing as an error in core.
* vfs: Use existing type aliases consistentlyLioncash2020-12-101-1/+1
| | | | | Makes use of the VirtualDir and VirtualFile aliases across the board instead of having a few isolated places that don't use it.
* 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.
* core/loader: Remove dependencies on the global system instanceLioncash2020-09-161-4/+8
| | | | | | | | | 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: Fix loader size and arguments.bunnei2020-04-171-2/+1
|
* loader: provide default arguments (zero byte) to NSOsMichael Scire2020-01-221-0/+2
| | | | | | | | | | 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.
* loader: Move NSO module tracking to AppLoaderZach Hilman2019-05-261-0/+5
| | | Also cleanup of general stuff
* core/core: Move process execution start to System's Load()Lioncash2019-04-111-1/+1
| | | | | | | | | This gives us significantly more control over where in the initialization process we start execution of the main process. Previously we were running the main process before the CPU or GPU threads were initialized (not good). This amends execution to start after all of our threads are properly set up.
* file_sys/patch_manager: Deduplicate NSO headerLioncash2019-03-221-0/+39
| | | | | | This source file was utilizing its own version of the NSO header. Instead of keeping this around, we can have the patch manager also use the version of the header that we have defined in loader/nso.h
* loader: Remove Linker inheritance from NRO and NSO loadersLioncash2019-03-191-2/+2
| | | | | | Neither the NRO or NSO loaders actually make use of the functions or members provided by the Linker interface, so we can just remove the inheritance altogether.
* loaders: Make GetFileType() a const qualified member functionLioncash2018-12-051-1/+1
| | | | | | No implementations actually modify instance state (and it would be questionable to do that in the first place given the name), so we can make this a const member function.
* loader/nso: Remove dependency on the System classLioncash2018-12-021-2/+6
| | | | | Similar to the NRO changes, we can also pass the process explicitly as a parameter from Load instead of indirecting through the System class.
* nso: Return an optional address from LoadModuleLioncash2018-10-151-3/+4
| | | | | If a malformed NSO is attempted to be loaded, we shouldn't continue onwards. We should be reporting an error and bailing out.
* nso: Make LoadModule take a VfsFile by const referenceLioncash2018-10-141-1/+2
|
* nso/nro: Use default allocation size for arg_dataZach Hilman2018-10-071-0/+2
|
* nso/nro: Add NSO arguments structure to data sectionZach Hilman2018-10-071-1/+8
| | | | Only added if arguments string is non-empty and a pass is requested by loader.
* nso: Optimize loading of IPS patchesZach Hilman2018-10-021-1/+1
| | | | Avoid resource-heavy classes and remove quasi-duplicated code.
* nso: Add framework to support patching of uncompressed NSOsZach Hilman2018-10-011-1/+3
|
* loader: Make the Load() function take a process as a regular reference, not ↵Lioncash2018-09-291-3/+1
| | | | | | | | | | a SharedPtr A process should never require being reference counted in this situation. If the handle to a process is freed before this function is called, it's definitely a bug with our lifetime management, so we can put the requirement in place for the API that the process must be a valid instance.
* kernel: Move object class to its own source filesLioncash2018-08-011-1/+1
| | | | | | General moving to keep kernel object types separate from the direct kernel code. Also essentially a preliminary cleanup before eliminating global kernel state in the kernel code.
* Virtual Filesystem 2: Electric Boogaloo (#676)Zach Hilman2018-07-181-12/+5
| | | | | | | | | | * Virtual Filesystem * Fix delete bug and documentate * Review fixes + other stuff * Fix puyo regression
* Revert "Virtual Filesystem (#597)"bunnei2018-07-071-5/+12
| | | | This reverts commit 12e9522b32d972a8e9b327c7ee7c14040a61ffdd.
* Virtual Filesystem (#597)Zach Hilman2018-07-061-12/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add VfsFile and VfsDirectory classes * Finish abstract Vfs classes * Implement RealVfsFile (computer fs backend) * Finish RealVfsFile and RealVfsDirectory * Finished OffsetVfsFile * More changes * Fix import paths * Major refactor * Remove double const * Use experimental/filesystem or filesystem depending on compiler * Port partition_filesystem * More changes * More Overhaul * FSP_SRV fixes * Fixes and testing * Try to get filesystem to compile * Filesystem on linux * Remove std::filesystem and document/test * Compile fixes * Missing include * Bug fixes * Fixes * Rename v_file and v_dir * clang-format fix * Rename NGLOG_* to LOG_* * Most review changes * Fix TODO * Guess 'main' to be Directory by filename
* Add support for decrypted NCA files (#567)Zach Hilman2018-06-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Start to add NCA support in loader * More nca stuff * More changes to nca.cpp * Now identifies decrypted NCA cont. * Game list fixes and more structs and stuff * More updates to Nca class * Now reads ExeFs (i think) * ACTUALLY LOADS EXEFS! * RomFS loads and games execute * Cleanup and Finalize * plumbing, cleanup and testing * fix some things that i didnt think of before * Preliminary Review Changes * Review changes for bunnei and subv
* Kernel: Store the program id in the Process class instead of the CodeSet class.Subv2018-03-011-1/+1
| | | | There may be many CodeSets per Process, so it's wasteful and overcomplicated to store the program id in each of them.
* loader: Check error on NPDM load, use TID for CodeSetshinyquagsire232018-02-251-1/+1
|
* loader: Clean up ctors and includes.bunnei2018-01-201-3/+1
|
* loader: Refactor to also pass filepath into IdentifyType.bunnei2018-01-201-4/+3
|
* nso: Remove code specific to directory loading.bunnei2018-01-201-1/+2
|
* Remove relocation on NSO/NROgdkchan2018-01-171-1/+1
|
* clang-formatMerryMage2018-01-161-2/+1
|
* yuzu: Update license text to be consistent across project.bunnei2018-01-131-1/+1
|
* Merge remote-tracking branch 'upstream/master' into nxbunnei2017-10-091-1/+1
| | | | | | | | | | | | | | | | | # Conflicts: # src/core/CMakeLists.txt # src/core/arm/dynarmic/arm_dynarmic.cpp # src/core/arm/dyncom/arm_dyncom.cpp # src/core/hle/kernel/process.cpp # src/core/hle/kernel/thread.cpp # src/core/hle/kernel/thread.h # src/core/hle/kernel/vm_manager.cpp # src/core/loader/3dsx.cpp # src/core/loader/elf.cpp # src/core/loader/ncch.cpp # src/core/memory.cpp # src/core/memory.h # src/core/memory_setup.h
* loader: Various improvements for NSO/NRO loaders.bunnei2017-10-091-5/+3
|
* loader: Add support for NRO, as well as various fixes and shared linker.bunnei2017-10-051-18/+2
|
* nso: Fixes to support homebrew NSOs without a MOD header.bunnei2017-10-031-1/+1
|
* nso: Refactor and allocate .bss section.bunnei2017-09-301-1/+24
|
* loader: Add support for loading an NSO.bunnei2017-09-301-0/+38