diff options
| author | mageven <62494521+mageven@users.noreply.github.com> | 2020-07-09 10:01:15 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-09 14:31:15 +1000 |
| commit | 189c0c9c726b3a700272831cd5cf10b2fc817cc2 (patch) | |
| tree | 724e5d808c061917ae686e1e557c504fff3cd24f /Ryujinx.HLE/HOS/Services | |
| parent | c050994995268494d46a6cac1d4ffa931effa0f6 (diff) | |
Implement modding support (#1249)
* Implement Modding Support
* Executables: Rewrite to use contiguous mem and Spans
* Reorder ExeFs, Npdm, ControlData and SaveData calls
After discussion with gdkchan, it was decided it's best to call
LoadExeFs after all other loads are done as it starts the guest process.
* Build RomFs manually instead of Layering FS
Layered FS approach has considerable latency when building the final
romfs. So, we manually replace files in a single romfs instance.
* Add RomFs modding via storage file
* Fix and cleanup MemPatch
* Add dynamically loaded NRO patching
* Support exefs file replacement
* Rewrite ModLoader to use mods-search architecture
* Disable PPTC when exefs patches are detected
Disable PPTC on exefs replacements too
* Rewrite ModLoader, again
* Increased maintainability and matches Atmosphere closely
* Creates base mods structure if it doesn't exist
* Add Exefs partition replacement
* IPSwitch: Fix nsobid parsing
* Move mod logs to new LogClass
* Allow custom suffixes to title dirs again
* Address nits
* Add a per-App "Open Mods Directory" context menu item
Creates the path if not present.
* Normalize tooltips verbiage
* Use LocalStorage and remove unused namespaces
Diffstat (limited to 'Ryujinx.HLE/HOS/Services')
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Ro/IRoInterface.cs | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Ro/IRoInterface.cs b/Ryujinx.HLE/HOS/Services/Ro/IRoInterface.cs index 3ff622b6..46374acc 100644 --- a/Ryujinx.HLE/HOS/Services/Ro/IRoInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Ro/IRoInterface.cs @@ -1,4 +1,5 @@ -using Ryujinx.Common; +using LibHac.FsSystem; +using Ryujinx.Common; using Ryujinx.Cpu; using Ryujinx.HLE.HOS.Kernel.Common; using Ryujinx.HLE.HOS.Kernel.Memory; @@ -163,33 +164,36 @@ namespace Ryujinx.HLE.HOS.Services.Ro stream.Position = 0; - NroExecutable executable = new NroExecutable(stream, nroAddress, bssAddress); + NroExecutable nro = new NroExecutable(stream.AsStorage(), nroAddress, bssAddress); - // check if everything is page align. - if ((executable.Text.Length & 0xFFF) != 0 || (executable.Ro.Length & 0xFFF) != 0 || - (executable.Data.Length & 0xFFF) != 0 || (executable.BssSize & 0xFFF) != 0) + // Check if everything is page align. + if ((nro.Text.Length & 0xFFF) != 0 || (nro.Ro.Length & 0xFFF) != 0 || + (nro.Data.Length & 0xFFF) != 0 || (nro.BssSize & 0xFFF) != 0) { return ResultCode.InvalidNro; } - // check if everything is contiguous. - if (executable.RoOffset != executable.TextOffset + executable.Text.Length || - executable.DataOffset != executable.RoOffset + executable.Ro.Length || - nroFileSize != executable.DataOffset + executable.Data.Length) + // Check if everything is contiguous. + if (nro.RoOffset != nro.TextOffset + nro.Text.Length || + nro.DataOffset != nro.RoOffset + nro.Ro.Length || + nroFileSize != nro.DataOffset + nro.Data.Length) { return ResultCode.InvalidNro; } - // finally check the bss size match. - if ((ulong)executable.BssSize != bssSize) + // Check the bss size match. + if ((ulong)nro.BssSize != bssSize) { return ResultCode.InvalidNro; } - int totalSize = executable.Text.Length + executable.Ro.Length + executable.Data.Length + executable.BssSize; + int totalSize = nro.Text.Length + nro.Ro.Length + nro.Data.Length + nro.BssSize; + + // Apply patches + context.Device.FileSystem.ModLoader.ApplyNroPatches(nro); res = new NroInfo( - executable, + nro, nroHash, nroAddress, nroSize, |
