diff options
| author | Thomas Guillemard <thog@protonmail.com> | 2018-10-10 01:01:49 +0200 |
|---|---|---|
| committer | Ac_K <Acoustik666@gmail.com> | 2018-10-10 01:01:49 +0200 |
| commit | d5c0de8362941f957846a71d09a40a6eb77a22fa (patch) | |
| tree | 23a6e5939e814d0a02314523343a5c3ad784bbe8 /Ryujinx.HLE/HOS/Process.cs | |
| parent | 65c67bb4a5d19d81048fd84c3ec599ff531629fd (diff) | |
Implement IRoInterface (#445)
* Implement IRoInterface
This is required by Super Mario Party.
This commit also adds MapProcessCodeMemory and UnmapProcessCodeMemory functions in KMemoryManager. Those two calls might not reflect what the SVC of the same names do.
* Fix some code style issues
* Use MakeError to clarify error code
* Add NRR and NRO constants
* Fix some codestyle issues
* Fix InvalidMemoryState error code
Diffstat (limited to 'Ryujinx.HLE/HOS/Process.cs')
| -rw-r--r-- | Ryujinx.HLE/HOS/Process.cs | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/Ryujinx.HLE/HOS/Process.cs b/Ryujinx.HLE/HOS/Process.cs index 3817f561..ab0ab18b 100644 --- a/Ryujinx.HLE/HOS/Process.cs +++ b/Ryujinx.HLE/HOS/Process.cs @@ -106,13 +106,37 @@ namespace Ryujinx.HLE.HOS throw new ObjectDisposedException(nameof(Process)); } - Device.Log.PrintInfo(LogClass.Loader, $"Image base at 0x{ImageBase:x16}."); + long ImageEnd = LoadProgram(Program, ImageBase); - Executable Executable = new Executable(Program, MemoryManager, Memory, ImageBase); + ImageBase = IntUtils.AlignUp(ImageEnd, KMemoryManager.PageSize); + } + + public long LoadProgram(IExecutable Program, long ExecutableBase) + { + if (Disposed) + { + throw new ObjectDisposedException(nameof(Process)); + } + + Device.Log.PrintInfo(LogClass.Loader, $"Image base at 0x{ExecutableBase:x16}."); + + Executable Executable = new Executable(Program, MemoryManager, Memory, ExecutableBase); Executables.Add(Executable); - ImageBase = IntUtils.AlignUp(Executable.ImageEnd, KMemoryManager.PageSize); + return Executable.ImageEnd; + } + + public void RemoveProgram(long ExecutableBase) + { + foreach (Executable Executable in Executables) + { + if (Executable.ImageBase == ExecutableBase) + { + Executables.Remove(Executable); + break; + } + } } public void SetEmptyArgs() |
