diff options
| author | TSRBerry <20988865+TSRBerry@users.noreply.github.com> | 2023-08-09 23:27:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-09 18:27:45 -0300 |
| commit | 5e9678c8fad4625026268e457f4c3e23bdc22697 (patch) | |
| tree | f63ea9b82af78209909a49a84a8cab02c1e8275a /src/Ryujinx.HLE/Loaders | |
| parent | 773e239db7ceb2c55aa15f9787add4430edcdfcf (diff) | |
Allow access to code memory for exefs mods (#5518)
* Allow access to code memory for exefs mods
* Add ASLR workaround for Skyline
* Hardcode allowCodeMemoryForJit to true
Diffstat (limited to 'src/Ryujinx.HLE/Loaders')
| -rw-r--r-- | src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs | 5 | ||||
| -rw-r--r-- | src/Ryujinx.HLE/Loaders/Processes/ProcessLoaderHelper.cs | 7 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs b/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs index 040d1143..07bbaf12 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs @@ -89,9 +89,6 @@ namespace Ryujinx.HLE.Loaders.Processes.Extensions Logger.Warning?.Print(LogClass.Ptc, "Detected unsupported ExeFs modifications. PTC disabled."); } - // We allow it for nx-hbloader because it can be used to launch homebrew. - bool allowCodeMemoryForJit = programId == 0x010000000000100DUL || isHomebrew; - string programName = ""; if (!isHomebrew && programId > 0x010000000000FFFF) @@ -119,7 +116,7 @@ namespace Ryujinx.HLE.Loaders.Processes.Extensions metaLoader, nacpData, enablePtc, - allowCodeMemoryForJit, + true, programName, metaLoader.GetProgramId(), null, diff --git a/src/Ryujinx.HLE/Loaders/Processes/ProcessLoaderHelper.cs b/src/Ryujinx.HLE/Loaders/Processes/ProcessLoaderHelper.cs index d14a013a..292a5c12 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/ProcessLoaderHelper.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/ProcessLoaderHelper.cs @@ -28,6 +28,11 @@ namespace Ryujinx.HLE.Loaders.Processes { static class ProcessLoaderHelper { + // NOTE: If you want to change this value make sure to increment the InternalVersion of Ptc and PtcProfiler. + // You also need to add a new migration path and adjust the existing ones. + // TODO: Remove this workaround when ASLR is implemented. + private const ulong CodeStartOffset = 0x500000UL; + public static LibHac.Result RegisterProgramMapInfo(Switch device, PartitionFileSystem partitionFileSystem) { ulong applicationId = 0; @@ -242,7 +247,7 @@ namespace Ryujinx.HLE.Loaders.Processes ulong argsStart = 0; uint argsSize = 0; - ulong codeStart = (meta.Flags & 1) != 0 ? 0x8000000UL : 0x200000UL; + ulong codeStart = ((meta.Flags & 1) != 0 ? 0x8000000UL : 0x200000UL) + CodeStartOffset; uint codeSize = 0; var buildIds = executables.Select(e => (e switch |
