diff --git a/ChocolArm64/AThread.cs b/ChocolArm64/AThread.cs index 4fc79d5ef2..7b8360f8fe 100644 --- a/ChocolArm64/AThread.cs +++ b/ChocolArm64/AThread.cs @@ -18,8 +18,6 @@ namespace ChocolArm64 public event EventHandler WorkFinished; - public int ThreadId => ThreadState.ThreadId; - private int IsExecuting; public AThread(ATranslator Translator, AMemory Memory, long EntryPoint) diff --git a/ChocolArm64/Memory/AMemory.cs b/ChocolArm64/Memory/AMemory.cs index 1b4ff6fb19..566e6b54ce 100644 --- a/ChocolArm64/Memory/AMemory.cs +++ b/ChocolArm64/Memory/AMemory.cs @@ -41,7 +41,7 @@ namespace ChocolArm64.Memory } } - private Dictionary Monitors; + private Dictionary Monitors; private ConcurrentDictionary ObservedPages; @@ -53,7 +53,7 @@ namespace ChocolArm64.Memory public AMemory(IntPtr Ram) { - Monitors = new Dictionary(); + Monitors = new Dictionary(); ObservedPages = new ConcurrentDictionary(); @@ -75,7 +75,7 @@ namespace ChocolArm64.Memory { ClearExclusive(State); - Monitors.Remove(State.ThreadId); + Monitors.Remove(State); } } @@ -93,11 +93,11 @@ namespace ChocolArm64.Memory } } - if (!Monitors.TryGetValue(ThreadState.ThreadId, out ArmMonitor ThreadMon)) + if (!Monitors.TryGetValue(ThreadState, out ArmMonitor ThreadMon)) { ThreadMon = new ArmMonitor(); - Monitors.Add(ThreadState.ThreadId, ThreadMon); + Monitors.Add(ThreadState, ThreadMon); } ThreadMon.Position = Position; @@ -113,7 +113,7 @@ namespace ChocolArm64.Memory Monitor.Enter(Monitors); - if (!Monitors.TryGetValue(ThreadState.ThreadId, out ArmMonitor ThreadMon)) + if (!Monitors.TryGetValue(ThreadState, out ArmMonitor ThreadMon)) { return false; } @@ -130,7 +130,7 @@ namespace ChocolArm64.Memory public void ClearExclusiveForStore(AThreadState ThreadState) { - if (Monitors.TryGetValue(ThreadState.ThreadId, out ArmMonitor ThreadMon)) + if (Monitors.TryGetValue(ThreadState, out ArmMonitor ThreadMon)) { ThreadMon.ExState = false; } @@ -142,7 +142,7 @@ namespace ChocolArm64.Memory { lock (Monitors) { - if (Monitors.TryGetValue(ThreadState.ThreadId, out ArmMonitor ThreadMon)) + if (Monitors.TryGetValue(ThreadState, out ArmMonitor ThreadMon)) { ThreadMon.ExState = false; } diff --git a/ChocolArm64/State/AThreadState.cs b/ChocolArm64/State/AThreadState.cs index a84e3242bf..7b69d81714 100644 --- a/ChocolArm64/State/AThreadState.cs +++ b/ChocolArm64/State/AThreadState.cs @@ -40,9 +40,6 @@ namespace ChocolArm64.State public bool Zero; public bool Negative; - public int ProcessId; - public int ThreadId; - public bool Running { get; set; } public long TpidrEl0 { get; set; } @@ -100,6 +97,11 @@ namespace ChocolArm64.State TickCounter.Start(); } + internal bool Synchronize() + { + return Running; + } + internal void OnBreak(long Position, int Imm) { Break?.Invoke(this, new AInstExceptionEventArgs(Position, Imm)); diff --git a/ChocolArm64/Translation/AILEmitterCtx.cs b/ChocolArm64/Translation/AILEmitterCtx.cs index 3fa46e96d6..40e33ba8ea 100644 --- a/ChocolArm64/Translation/AILEmitterCtx.cs +++ b/ChocolArm64/Translation/AILEmitterCtx.cs @@ -110,6 +110,8 @@ namespace ChocolArm64.Translation if (OpcIndex == 0) { MarkLabel(GetLabel(CurrBlock.Position)); + + EmitSynchronization(); } CurrOp.Emitter(this); @@ -117,6 +119,25 @@ namespace ChocolArm64.Translation ILBlock.Add(new AILBarrier()); } + private void EmitSynchronization() + { + EmitLdarg(ATranslatedSub.StateArgIdx); + + EmitPrivateCall(typeof(AThreadState), nameof(AThreadState.Synchronize)); + + EmitLdc_I4(0); + + AILLabel LblContinue = new AILLabel(); + + Emit(OpCodes.Bne_Un_S, LblContinue); + + EmitLdc_I8(0); + + Emit(OpCodes.Ret); + + MarkLabel(LblContinue); + } + public bool TryOptEmitSubroutineCall() { if (CurrBlock.Next == null) diff --git a/Ryujinx.Audio/IAalOutput.cs b/Ryujinx.Audio/IAalOutput.cs index e903c5c5cc..1dfac377f7 100644 --- a/Ryujinx.Audio/IAalOutput.cs +++ b/Ryujinx.Audio/IAalOutput.cs @@ -1,6 +1,8 @@ +using System; + namespace Ryujinx.Audio { - public interface IAalOutput + public interface IAalOutput : IDisposable { int OpenTrack(int SampleRate, int Channels, ReleaseCallback Callback); diff --git a/Ryujinx.Audio/OpenAL/OpenALAudioOut.cs b/Ryujinx.Audio/OpenAL/OpenALAudioOut.cs index 85e2d803e9..80a070c9f3 100644 --- a/Ryujinx.Audio/OpenAL/OpenALAudioOut.cs +++ b/Ryujinx.Audio/OpenAL/OpenALAudioOut.cs @@ -8,7 +8,7 @@ using System.Threading; namespace Ryujinx.Audio.OpenAL { - public class OpenALAudioOut : IAalOutput + public class OpenALAudioOut : IAalOutput, IDisposable { private const int MaxTracks = 256; @@ -222,10 +222,17 @@ namespace Ryujinx.Audio.OpenAL Td.CallReleaseCallbackIfNeeded(); } - //If it's not slept it will waste cycles + //If it's not slept it will waste cycles. Thread.Sleep(10); } while (KeepPolling); + + foreach (Track Td in Tracks.Values) + { + Td.Dispose(); + } + + Tracks.Clear(); } public int OpenTrack(int SampleRate, int Channels, ReleaseCallback Callback) @@ -342,5 +349,18 @@ namespace Ryujinx.Audio.OpenAL return PlaybackState.Stopped; } + + public void Dispose() + { + Dispose(true); + } + + protected virtual void Dispose(bool Disposing) + { + if (Disposing) + { + KeepPolling = false; + } + } } } \ No newline at end of file diff --git a/Ryujinx.Graphics/Gal/IGalShader.cs b/Ryujinx.Graphics/Gal/IGalShader.cs index 5174c03931..e906e6cdcb 100644 --- a/Ryujinx.Graphics/Gal/IGalShader.cs +++ b/Ryujinx.Graphics/Gal/IGalShader.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; namespace Ryujinx.Graphics.Gal diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLFrameBuffer.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLFrameBuffer.cs index 30a3de64a0..62f82495c5 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OGLFrameBuffer.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OGLFrameBuffer.cs @@ -1,4 +1,3 @@ -using OpenTK; using OpenTK.Graphics.OpenGL; using System; using System.Collections.Generic; diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLRasterizer.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLRasterizer.cs index 0802147857..b6e9745453 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OGLRasterizer.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OGLRasterizer.cs @@ -1,6 +1,5 @@ using OpenTK.Graphics.OpenGL; using System; -using System.Collections.Generic; namespace Ryujinx.Graphics.Gal.OpenGL { diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLShaderProgram.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLShaderProgram.cs index c4e6a881f8..c87b0d4053 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OGLShaderProgram.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OGLShaderProgram.cs @@ -1,7 +1,6 @@ using OpenTK.Graphics.OpenGL; using System; using System.Collections.Generic; -using System.Linq; namespace Ryujinx.Graphics.Gal.OpenGL { diff --git a/Ryujinx.Graphics/Gal/Shader/ShaderDecodeSpecial.cs b/Ryujinx.Graphics/Gal/Shader/ShaderDecodeSpecial.cs index 591631ff99..f1be005f9c 100644 --- a/Ryujinx.Graphics/Gal/Shader/ShaderDecodeSpecial.cs +++ b/Ryujinx.Graphics/Gal/Shader/ShaderDecodeSpecial.cs @@ -1,6 +1,4 @@ -using System; - -using static Ryujinx.Graphics.Gal.Shader.ShaderDecodeHelper; +using static Ryujinx.Graphics.Gal.Shader.ShaderDecodeHelper; namespace Ryujinx.Graphics.Gal.Shader { diff --git a/Ryujinx.HLE/OsHle/Exceptions/GuestBrokeExecutionException.cs b/Ryujinx.HLE/Exceptions/GuestBrokeExecutionException.cs similarity index 85% rename from Ryujinx.HLE/OsHle/Exceptions/GuestBrokeExecutionException.cs rename to Ryujinx.HLE/Exceptions/GuestBrokeExecutionException.cs index 2ed7f19e3b..fe41b02a69 100644 --- a/Ryujinx.HLE/OsHle/Exceptions/GuestBrokeExecutionException.cs +++ b/Ryujinx.HLE/Exceptions/GuestBrokeExecutionException.cs @@ -1,6 +1,6 @@ using System; -namespace Ryujinx.HLE.OsHle.Exceptions +namespace Ryujinx.HLE.Exceptions { public class GuestBrokeExecutionException : Exception { diff --git a/Ryujinx.HLE/Loaders/Npdm/NpdmException.cs b/Ryujinx.HLE/Exceptions/InvalidNpdmException.cs similarity index 77% rename from Ryujinx.HLE/Loaders/Npdm/NpdmException.cs rename to Ryujinx.HLE/Exceptions/InvalidNpdmException.cs index d87a6461da..58d044345e 100644 --- a/Ryujinx.HLE/Loaders/Npdm/NpdmException.cs +++ b/Ryujinx.HLE/Exceptions/InvalidNpdmException.cs @@ -1,9 +1,9 @@ -using System; - -namespace Ryujinx.HLE.Loaders.Npdm -{ - public class InvalidNpdmException : Exception - { - public InvalidNpdmException(string ExMsg) : base(ExMsg) { } - } -} +using System; + +namespace Ryujinx.HLE.Exceptions +{ + public class InvalidNpdmException : Exception + { + public InvalidNpdmException(string ExMsg) : base(ExMsg) { } + } +} diff --git a/Ryujinx.HLE/OsHle/Exceptions/UndefinedInstructionException.cs b/Ryujinx.HLE/Exceptions/UndefinedInstructionException.cs similarity index 90% rename from Ryujinx.HLE/OsHle/Exceptions/UndefinedInstructionException.cs rename to Ryujinx.HLE/Exceptions/UndefinedInstructionException.cs index d9f0b8cf9c..24bf9efdde 100644 --- a/Ryujinx.HLE/OsHle/Exceptions/UndefinedInstructionException.cs +++ b/Ryujinx.HLE/Exceptions/UndefinedInstructionException.cs @@ -1,6 +1,6 @@ using System; -namespace Ryujinx.HLE.OsHle.Exceptions +namespace Ryujinx.HLE.Exceptions { public class UndefinedInstructionException : Exception { diff --git a/Ryujinx.HLE/Gpu/Texture/TextureHelper.cs b/Ryujinx.HLE/Gpu/Texture/TextureHelper.cs index 1d621c9226..10a64f3641 100644 --- a/Ryujinx.HLE/Gpu/Texture/TextureHelper.cs +++ b/Ryujinx.HLE/Gpu/Texture/TextureHelper.cs @@ -140,7 +140,7 @@ namespace Ryujinx.HLE.Gpu.Texture } } - throw new NotImplementedException(Texture.Format.ToString()); + throw new NotImplementedException("0x" + Texture.Format.ToString("x2")); } public static int CompressedTextureSize(int TextureWidth, int TextureHeight, int BlockWidth, int BlockHeight, int Bpb) diff --git a/Ryujinx.HLE/Gpu/Texture/TextureReader.cs b/Ryujinx.HLE/Gpu/Texture/TextureReader.cs index 0c6103af80..0cf055db8b 100644 --- a/Ryujinx.HLE/Gpu/Texture/TextureReader.cs +++ b/Ryujinx.HLE/Gpu/Texture/TextureReader.cs @@ -47,7 +47,7 @@ namespace Ryujinx.HLE.Gpu.Texture case GalTextureFormat.Astc2D10x6: return Read16BptCompressedTexture(Memory, Texture, 10, 6); } - throw new NotImplementedException(Texture.Format.ToString()); + throw new NotImplementedException("0x" + Texture.Format.ToString("x2")); } private unsafe static byte[] Read1Bpp(IAMemory Memory, TextureInfo Texture) diff --git a/Ryujinx.HLE/Gpu/Texture/TextureWriter.cs b/Ryujinx.HLE/Gpu/Texture/TextureWriter.cs index 113dc6f611..6c3dda6bea 100644 --- a/Ryujinx.HLE/Gpu/Texture/TextureWriter.cs +++ b/Ryujinx.HLE/Gpu/Texture/TextureWriter.cs @@ -1,6 +1,4 @@ using ChocolArm64.Memory; -using Ryujinx.Graphics.Gal; -using System; namespace Ryujinx.HLE.Gpu.Texture { diff --git a/Ryujinx.HLE/OsHle/Diagnostics/Demangler.cs b/Ryujinx.HLE/HOS/Diagnostics/Demangler.cs similarity index 99% rename from Ryujinx.HLE/OsHle/Diagnostics/Demangler.cs rename to Ryujinx.HLE/HOS/Diagnostics/Demangler.cs index 6646dede6e..aea979c26c 100644 --- a/Ryujinx.HLE/OsHle/Diagnostics/Demangler.cs +++ b/Ryujinx.HLE/HOS/Diagnostics/Demangler.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; -namespace Ryujinx.HLE.OsHle.Diagnostics +namespace Ryujinx.HLE.HOS.Diagnostics { static class Demangler { diff --git a/Ryujinx.HLE/OsHle/ErrorCode.cs b/Ryujinx.HLE/HOS/ErrorCode.cs similarity index 86% rename from Ryujinx.HLE/OsHle/ErrorCode.cs rename to Ryujinx.HLE/HOS/ErrorCode.cs index 1e07f9b249..767664f8d7 100644 --- a/Ryujinx.HLE/OsHle/ErrorCode.cs +++ b/Ryujinx.HLE/HOS/ErrorCode.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle +namespace Ryujinx.HLE.HOS { static class ErrorCode { diff --git a/Ryujinx.HLE/OsHle/ErrorModule.cs b/Ryujinx.HLE/HOS/ErrorModule.cs similarity index 99% rename from Ryujinx.HLE/OsHle/ErrorModule.cs rename to Ryujinx.HLE/HOS/ErrorModule.cs index 924ee95160..5c6c9b0565 100644 --- a/Ryujinx.HLE/OsHle/ErrorModule.cs +++ b/Ryujinx.HLE/HOS/ErrorModule.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle +namespace Ryujinx.HLE.HOS { enum ErrorModule { diff --git a/Ryujinx.HLE/OsHle/Font/SharedFontManager.cs b/Ryujinx.HLE/HOS/Font/SharedFontManager.cs similarity index 96% rename from Ryujinx.HLE/OsHle/Font/SharedFontManager.cs rename to Ryujinx.HLE/HOS/Font/SharedFontManager.cs index 12b6973e00..0be5e89670 100644 --- a/Ryujinx.HLE/OsHle/Font/SharedFontManager.cs +++ b/Ryujinx.HLE/HOS/Font/SharedFontManager.cs @@ -1,10 +1,10 @@ using Ryujinx.HLE.Memory; -using Ryujinx.HLE.OsHle.Utilities; using Ryujinx.HLE.Resource; +using Ryujinx.HLE.Utilities; using System.Collections.Generic; using System.IO; -namespace Ryujinx.HLE.OsHle.Font +namespace Ryujinx.HLE.HOS.Font { class SharedFontManager { @@ -34,7 +34,7 @@ namespace Ryujinx.HLE.OsHle.Font Memory = Device.Memory; - FontsPath = Path.Combine(Device.VFs.GetSystemPath(), "fonts"); + FontsPath = Path.Combine(Device.FileSystem.GetSystemPath(), "fonts"); } public void EnsureInitialized() diff --git a/Ryujinx.HLE/OsHle/Font/SharedFontType.cs b/Ryujinx.HLE/HOS/Font/SharedFontType.cs similarity index 88% rename from Ryujinx.HLE/OsHle/Font/SharedFontType.cs rename to Ryujinx.HLE/HOS/Font/SharedFontType.cs index 80f42a7da6..53dca62664 100644 --- a/Ryujinx.HLE/OsHle/Font/SharedFontType.cs +++ b/Ryujinx.HLE/HOS/Font/SharedFontType.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Font +namespace Ryujinx.HLE.HOS.Font { public enum SharedFontType { diff --git a/Ryujinx.HLE/OsHle/GlobalStateTable.cs b/Ryujinx.HLE/HOS/GlobalStateTable.cs similarity index 98% rename from Ryujinx.HLE/OsHle/GlobalStateTable.cs rename to Ryujinx.HLE/HOS/GlobalStateTable.cs index fb71e46b9f..faf47b2ee5 100644 --- a/Ryujinx.HLE/OsHle/GlobalStateTable.cs +++ b/Ryujinx.HLE/HOS/GlobalStateTable.cs @@ -1,7 +1,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle +namespace Ryujinx.HLE.HOS { class GlobalStateTable { diff --git a/Ryujinx.HLE/OsHle/Homebrew.cs b/Ryujinx.HLE/HOS/Homebrew.cs similarity index 98% rename from Ryujinx.HLE/OsHle/Homebrew.cs rename to Ryujinx.HLE/HOS/Homebrew.cs index 90c6c4c641..1f862a4ae8 100644 --- a/Ryujinx.HLE/OsHle/Homebrew.cs +++ b/Ryujinx.HLE/HOS/Homebrew.cs @@ -1,7 +1,7 @@ using ChocolArm64.Memory; using System.Text; -namespace Ryujinx.HLE.OsHle +namespace Ryujinx.HLE.HOS { static class Homebrew { diff --git a/Ryujinx.HLE/OsHle/Horizon.cs b/Ryujinx.HLE/HOS/Horizon.cs similarity index 68% rename from Ryujinx.HLE/OsHle/Horizon.cs rename to Ryujinx.HLE/HOS/Horizon.cs index 1fd210dd53..a557967523 100644 --- a/Ryujinx.HLE/OsHle/Horizon.cs +++ b/Ryujinx.HLE/HOS/Horizon.cs @@ -1,27 +1,27 @@ +using Ryujinx.HLE.HOS.Font; +using Ryujinx.HLE.HOS.Kernel; +using Ryujinx.HLE.HOS.SystemState; using Ryujinx.HLE.Loaders.Executables; using Ryujinx.HLE.Loaders.Npdm; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Font; -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.SystemState; using System; using System.Collections.Concurrent; using System.IO; -namespace Ryujinx.HLE.OsHle +namespace Ryujinx.HLE.HOS { public class Horizon : IDisposable { internal const int HidSize = 0x40000; internal const int FontSize = 0x1100000; - private Switch Ns; + private Switch Device; private KProcessScheduler Scheduler; private ConcurrentDictionary Processes; - public SystemStateMgr SystemState { get; private set; } + public SystemStateMgr State { get; private set; } internal KSharedMemory HidSharedMem { get; private set; } internal KSharedMemory FontSharedMem { get; private set; } @@ -30,18 +30,18 @@ namespace Ryujinx.HLE.OsHle internal KEvent VsyncEvent { get; private set; } - public Horizon(Switch Ns) + public Horizon(Switch Device) { - this.Ns = Ns; + this.Device = Device; - Scheduler = new KProcessScheduler(Ns.Log); + Scheduler = new KProcessScheduler(Device.Log); Processes = new ConcurrentDictionary(); - SystemState = new SystemStateMgr(); + State = new SystemStateMgr(); - if (!Ns.Memory.Allocator.TryAllocate(HidSize, out long HidPA) || - !Ns.Memory.Allocator.TryAllocate(FontSize, out long FontPA)) + if (!Device.Memory.Allocator.TryAllocate(HidSize, out long HidPA) || + !Device.Memory.Allocator.TryAllocate(FontSize, out long FontPA)) { throw new InvalidOperationException(); } @@ -49,7 +49,7 @@ namespace Ryujinx.HLE.OsHle HidSharedMem = new KSharedMemory(HidPA, HidSize); FontSharedMem = new KSharedMemory(FontPA, FontSize); - Font = new SharedFontManager(Ns, FontSharedMem.PA); + Font = new SharedFontManager(Device, FontSharedMem.PA); VsyncEvent = new KEvent(); } @@ -58,7 +58,7 @@ namespace Ryujinx.HLE.OsHle { if (RomFsFile != null) { - Ns.VFs.LoadRomFs(RomFsFile); + Device.FileSystem.LoadRomFs(RomFsFile); } string NpdmFileName = Path.Combine(ExeFsDir, "main.npdm"); @@ -67,7 +67,7 @@ namespace Ryujinx.HLE.OsHle if (File.Exists(NpdmFileName)) { - Ns.Log.PrintInfo(LogClass.Loader, $"Loading main.npdm..."); + Device.Log.PrintInfo(LogClass.Loader, $"Loading main.npdm..."); using (FileStream Input = new FileStream(NpdmFileName, FileMode.Open)) { @@ -76,7 +76,7 @@ namespace Ryujinx.HLE.OsHle } else { - Ns.Log.PrintWarning(LogClass.Loader, $"NPDM file not found, using default values!"); + Device.Log.PrintWarning(LogClass.Loader, $"NPDM file not found, using default values!"); } Process MainProcess = MakeProcess(MetaData); @@ -90,7 +90,7 @@ namespace Ryujinx.HLE.OsHle continue; } - Ns.Log.PrintInfo(LogClass.Loader, $"Loading {Path.GetFileNameWithoutExtension(File)}..."); + Device.Log.PrintInfo(LogClass.Loader, $"Loading {Path.GetFileNameWithoutExtension(File)}..."); using (FileStream Input = new FileStream(File, FileMode.Open)) { @@ -124,18 +124,20 @@ namespace Ryujinx.HLE.OsHle bool IsNro = Path.GetExtension(FilePath).ToLower() == ".nro"; string Name = Path.GetFileNameWithoutExtension(FilePath); - string SwitchFilePath = Ns.VFs.SystemPathToSwitchPath(FilePath); + string SwitchFilePath = Device.FileSystem.SystemPathToSwitchPath(FilePath); if (IsNro && (SwitchFilePath == null || !SwitchFilePath.StartsWith("sdmc:/"))) { string SwitchPath = $"sdmc:/switch/{Name}{Homebrew.TemporaryNroSuffix}"; - string TempPath = Ns.VFs.SwitchPathToSystemPath(SwitchPath); + string TempPath = Device.FileSystem.SwitchPathToSystemPath(SwitchPath); string SwitchDir = Path.GetDirectoryName(TempPath); + if (!Directory.Exists(SwitchDir)) { Directory.CreateDirectory(SwitchDir); } + File.Copy(FilePath, TempPath, true); FilePath = TempPath; @@ -169,7 +171,7 @@ namespace Ryujinx.HLE.OsHle ProcessId++; } - Process = new Process(Ns, Scheduler, ProcessId, MetaData); + Process = new Process(Device, Scheduler, ProcessId, MetaData); Processes.TryAdd(ProcessId, Process); } @@ -186,42 +188,24 @@ namespace Ryujinx.HLE.OsHle internal void ExitProcess(int ProcessId) { - if (Processes.TryGetValue(ProcessId, out Process Process) && Process.NeedsHbAbi) + if (Processes.TryRemove(ProcessId, out Process Process)) { - string NextNro = Homebrew.ReadHbAbiNextLoadPath(Process.Memory, Process.HbAbiDataPosition); - - Ns.Log.PrintInfo(LogClass.Loader, $"HbAbi NextLoadPath {NextNro}"); - - if (NextNro == string.Empty) - { - NextNro = "sdmc:/hbmenu.nro"; - } - - NextNro = NextNro.Replace("sdmc:", string.Empty); - - NextNro = Ns.VFs.GetFullPath(Ns.VFs.GetSdCardPath(), NextNro); - - if (File.Exists(NextNro)) - { - LoadProgram(NextNro); - } - } - - if (Processes.TryRemove(ProcessId, out Process)) - { - Process.StopAllThreadsAsync(); Process.Dispose(); if (Processes.Count == 0) { - Ns.OnFinish(EventArgs.Empty); + Unload(); + + Device.Unload(); } } } - internal bool TryGetProcess(int ProcessId, out Process Process) + private void Unload() { - return Processes.TryGetValue(ProcessId, out Process); + VsyncEvent.Dispose(); + + Scheduler.Dispose(); } public void Dispose() @@ -235,13 +219,8 @@ namespace Ryujinx.HLE.OsHle { foreach (Process Process in Processes.Values) { - Process.StopAllThreadsAsync(); Process.Dispose(); } - - VsyncEvent.Dispose(); - - Scheduler.Dispose(); } } } diff --git a/Ryujinx.HLE/OsHle/IdDictionary.cs b/Ryujinx.HLE/HOS/IdDictionary.cs similarity index 98% rename from Ryujinx.HLE/OsHle/IdDictionary.cs rename to Ryujinx.HLE/HOS/IdDictionary.cs index dcb8d0f724..03d15498f6 100644 --- a/Ryujinx.HLE/OsHle/IdDictionary.cs +++ b/Ryujinx.HLE/HOS/IdDictionary.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle +namespace Ryujinx.HLE.HOS { class IdDictionary { diff --git a/Ryujinx.HLE/OsHle/Ipc/IpcBuffDesc.cs b/Ryujinx.HLE/HOS/Ipc/IpcBuffDesc.cs similarity index 95% rename from Ryujinx.HLE/OsHle/Ipc/IpcBuffDesc.cs rename to Ryujinx.HLE/HOS/Ipc/IpcBuffDesc.cs index 12bff0fba4..346d696e34 100644 --- a/Ryujinx.HLE/OsHle/Ipc/IpcBuffDesc.cs +++ b/Ryujinx.HLE/HOS/Ipc/IpcBuffDesc.cs @@ -1,6 +1,6 @@ using System.IO; -namespace Ryujinx.HLE.OsHle.Ipc +namespace Ryujinx.HLE.HOS.Ipc { struct IpcBuffDesc { diff --git a/Ryujinx.HLE/OsHle/Ipc/IpcHandleDesc.cs b/Ryujinx.HLE/HOS/Ipc/IpcHandleDesc.cs similarity index 98% rename from Ryujinx.HLE/OsHle/Ipc/IpcHandleDesc.cs rename to Ryujinx.HLE/HOS/Ipc/IpcHandleDesc.cs index 609cc6e05f..081b569520 100644 --- a/Ryujinx.HLE/OsHle/Ipc/IpcHandleDesc.cs +++ b/Ryujinx.HLE/HOS/Ipc/IpcHandleDesc.cs @@ -1,7 +1,7 @@ using System; using System.IO; -namespace Ryujinx.HLE.OsHle.Ipc +namespace Ryujinx.HLE.HOS.Ipc { class IpcHandleDesc { diff --git a/Ryujinx.HLE/OsHle/Ipc/IpcHandler.cs b/Ryujinx.HLE/HOS/Ipc/IpcHandler.cs similarity index 98% rename from Ryujinx.HLE/OsHle/Ipc/IpcHandler.cs rename to Ryujinx.HLE/HOS/Ipc/IpcHandler.cs index cdb844cfe2..08a4cdb5d0 100644 --- a/Ryujinx.HLE/OsHle/Ipc/IpcHandler.cs +++ b/Ryujinx.HLE/HOS/Ipc/IpcHandler.cs @@ -1,9 +1,9 @@ using ChocolArm64.Memory; -using Ryujinx.HLE.OsHle.Handles; +using Ryujinx.HLE.HOS.Kernel; using System; using System.IO; -namespace Ryujinx.HLE.OsHle.Ipc +namespace Ryujinx.HLE.HOS.Ipc { static class IpcHandler { diff --git a/Ryujinx.HLE/OsHle/Ipc/IpcMagic.cs b/Ryujinx.HLE/HOS/Ipc/IpcMagic.cs similarity index 86% rename from Ryujinx.HLE/OsHle/Ipc/IpcMagic.cs rename to Ryujinx.HLE/HOS/Ipc/IpcMagic.cs index c3f9655fb8..72770b90ed 100644 --- a/Ryujinx.HLE/OsHle/Ipc/IpcMagic.cs +++ b/Ryujinx.HLE/HOS/Ipc/IpcMagic.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Ipc +namespace Ryujinx.HLE.HOS.Ipc { abstract class IpcMagic { diff --git a/Ryujinx.HLE/OsHle/Ipc/IpcMessage.cs b/Ryujinx.HLE/HOS/Ipc/IpcMessage.cs similarity index 99% rename from Ryujinx.HLE/OsHle/Ipc/IpcMessage.cs rename to Ryujinx.HLE/HOS/Ipc/IpcMessage.cs index 0a64a16426..c8153fdb4b 100644 --- a/Ryujinx.HLE/OsHle/Ipc/IpcMessage.cs +++ b/Ryujinx.HLE/HOS/Ipc/IpcMessage.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.IO; -namespace Ryujinx.HLE.OsHle.Ipc +namespace Ryujinx.HLE.HOS.Ipc { class IpcMessage { diff --git a/Ryujinx.HLE/OsHle/Ipc/IpcMessageType.cs b/Ryujinx.HLE/HOS/Ipc/IpcMessageType.cs similarity index 87% rename from Ryujinx.HLE/OsHle/Ipc/IpcMessageType.cs rename to Ryujinx.HLE/HOS/Ipc/IpcMessageType.cs index 3db6844e0a..e258accc9b 100644 --- a/Ryujinx.HLE/OsHle/Ipc/IpcMessageType.cs +++ b/Ryujinx.HLE/HOS/Ipc/IpcMessageType.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Ipc +namespace Ryujinx.HLE.HOS.Ipc { enum IpcMessageType { diff --git a/Ryujinx.HLE/OsHle/Ipc/IpcPtrBuffDesc.cs b/Ryujinx.HLE/HOS/Ipc/IpcPtrBuffDesc.cs similarity index 95% rename from Ryujinx.HLE/OsHle/Ipc/IpcPtrBuffDesc.cs rename to Ryujinx.HLE/HOS/Ipc/IpcPtrBuffDesc.cs index f5a9f651e4..21f5d3bcd9 100644 --- a/Ryujinx.HLE/OsHle/Ipc/IpcPtrBuffDesc.cs +++ b/Ryujinx.HLE/HOS/Ipc/IpcPtrBuffDesc.cs @@ -1,6 +1,6 @@ using System.IO; -namespace Ryujinx.HLE.OsHle.Ipc +namespace Ryujinx.HLE.HOS.Ipc { struct IpcPtrBuffDesc { diff --git a/Ryujinx.HLE/OsHle/Ipc/IpcRecvListBuffDesc.cs b/Ryujinx.HLE/HOS/Ipc/IpcRecvListBuffDesc.cs similarity index 92% rename from Ryujinx.HLE/OsHle/Ipc/IpcRecvListBuffDesc.cs rename to Ryujinx.HLE/HOS/Ipc/IpcRecvListBuffDesc.cs index 59191c1658..1d0a8c8074 100644 --- a/Ryujinx.HLE/OsHle/Ipc/IpcRecvListBuffDesc.cs +++ b/Ryujinx.HLE/HOS/Ipc/IpcRecvListBuffDesc.cs @@ -1,6 +1,6 @@ using System.IO; -namespace Ryujinx.HLE.OsHle.Ipc +namespace Ryujinx.HLE.HOS.Ipc { struct IpcRecvListBuffDesc { diff --git a/Ryujinx.HLE/OsHle/Ipc/ServiceProcessRequest.cs b/Ryujinx.HLE/HOS/Ipc/ServiceProcessRequest.cs similarity index 66% rename from Ryujinx.HLE/OsHle/Ipc/ServiceProcessRequest.cs rename to Ryujinx.HLE/HOS/Ipc/ServiceProcessRequest.cs index 47f72cb708..da4a7e75a6 100644 --- a/Ryujinx.HLE/OsHle/Ipc/ServiceProcessRequest.cs +++ b/Ryujinx.HLE/HOS/Ipc/ServiceProcessRequest.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Ipc +namespace Ryujinx.HLE.HOS.Ipc { delegate long ServiceProcessRequest(ServiceCtx Context); } \ No newline at end of file diff --git a/Ryujinx.HLE/OsHle/Kernel/AddressArbiter.cs b/Ryujinx.HLE/HOS/Kernel/AddressArbiter.cs similarity index 93% rename from Ryujinx.HLE/OsHle/Kernel/AddressArbiter.cs rename to Ryujinx.HLE/HOS/Kernel/AddressArbiter.cs index ce9ef0cd87..d7df0a727d 100644 --- a/Ryujinx.HLE/OsHle/Kernel/AddressArbiter.cs +++ b/Ryujinx.HLE/HOS/Kernel/AddressArbiter.cs @@ -1,10 +1,9 @@ using ChocolArm64.Memory; using ChocolArm64.State; -using Ryujinx.HLE.OsHle.Handles; -using static Ryujinx.HLE.OsHle.ErrorCode; +using static Ryujinx.HLE.HOS.ErrorCode; -namespace Ryujinx.HLE.OsHle.Kernel +namespace Ryujinx.HLE.HOS.Kernel { static class AddressArbiter { @@ -27,12 +26,12 @@ namespace Ryujinx.HLE.OsHle.Kernel return 0; } - public static ulong WaitForAddressIfLessThan(Process Process, - AThreadState ThreadState, - AMemory Memory, - long Address, - int Value, - ulong Timeout, + public static ulong WaitForAddressIfLessThan(Process Process, + AThreadState ThreadState, + AMemory Memory, + long Address, + int Value, + ulong Timeout, bool ShouldDecrement) { Memory.SetExclusive(ThreadState, Address); @@ -75,11 +74,11 @@ namespace Ryujinx.HLE.OsHle.Kernel return WaitForAddress(Process, ThreadState, Address, Timeout); } - public static ulong WaitForAddressIfEqual(Process Process, - AThreadState ThreadState, - AMemory Memory, - long Address, - int Value, + public static ulong WaitForAddressIfEqual(Process Process, + AThreadState ThreadState, + AMemory Memory, + long Address, + int Value, ulong Timeout) { if (Memory.ReadInt32(Address) != Value) diff --git a/Ryujinx.HLE/OsHle/Handles/AddressSpaceType.cs b/Ryujinx.HLE/HOS/Kernel/AddressSpaceType.cs similarity index 81% rename from Ryujinx.HLE/OsHle/Handles/AddressSpaceType.cs rename to Ryujinx.HLE/HOS/Kernel/AddressSpaceType.cs index 946c51e1db..c97caf42a8 100644 --- a/Ryujinx.HLE/OsHle/Handles/AddressSpaceType.cs +++ b/Ryujinx.HLE/HOS/Kernel/AddressSpaceType.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Handles +namespace Ryujinx.HLE.HOS.Kernel { enum AddressSpaceType { diff --git a/Ryujinx.HLE/OsHle/Handles/KEvent.cs b/Ryujinx.HLE/HOS/Kernel/KEvent.cs similarity index 57% rename from Ryujinx.HLE/OsHle/Handles/KEvent.cs rename to Ryujinx.HLE/HOS/Kernel/KEvent.cs index df5108f98a..eaaafaba33 100644 --- a/Ryujinx.HLE/OsHle/Handles/KEvent.cs +++ b/Ryujinx.HLE/HOS/Kernel/KEvent.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Handles +namespace Ryujinx.HLE.HOS.Kernel { class KEvent : KSynchronizationObject { } } \ No newline at end of file diff --git a/Ryujinx.HLE/OsHle/Handles/KMemoryBlock.cs b/Ryujinx.HLE/HOS/Kernel/KMemoryBlock.cs similarity index 97% rename from Ryujinx.HLE/OsHle/Handles/KMemoryBlock.cs rename to Ryujinx.HLE/HOS/Kernel/KMemoryBlock.cs index e33b6cb9b3..6100741b5c 100644 --- a/Ryujinx.HLE/OsHle/Handles/KMemoryBlock.cs +++ b/Ryujinx.HLE/HOS/Kernel/KMemoryBlock.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Handles +namespace Ryujinx.HLE.HOS.Kernel { class KMemoryBlock { diff --git a/Ryujinx.HLE/OsHle/Handles/KMemoryInfo.cs b/Ryujinx.HLE/HOS/Kernel/KMemoryInfo.cs similarity index 96% rename from Ryujinx.HLE/OsHle/Handles/KMemoryInfo.cs rename to Ryujinx.HLE/HOS/Kernel/KMemoryInfo.cs index 3f79f000d5..9b73b32b1e 100644 --- a/Ryujinx.HLE/OsHle/Handles/KMemoryInfo.cs +++ b/Ryujinx.HLE/HOS/Kernel/KMemoryInfo.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Handles +namespace Ryujinx.HLE.HOS.Kernel { class KMemoryInfo { diff --git a/Ryujinx.HLE/OsHle/Handles/KMemoryManager.cs b/Ryujinx.HLE/HOS/Kernel/KMemoryManager.cs similarity index 99% rename from Ryujinx.HLE/OsHle/Handles/KMemoryManager.cs rename to Ryujinx.HLE/HOS/Kernel/KMemoryManager.cs index 76c5a53def..0432aa8808 100644 --- a/Ryujinx.HLE/OsHle/Handles/KMemoryManager.cs +++ b/Ryujinx.HLE/HOS/Kernel/KMemoryManager.cs @@ -1,12 +1,11 @@ using ChocolArm64.Memory; using Ryujinx.HLE.Memory; -using Ryujinx.HLE.OsHle.Kernel; using System; using System.Collections.Generic; -using static Ryujinx.HLE.OsHle.ErrorCode; +using static Ryujinx.HLE.HOS.ErrorCode; -namespace Ryujinx.HLE.OsHle.Handles +namespace Ryujinx.HLE.HOS.Kernel { class KMemoryManager { @@ -43,7 +42,7 @@ namespace Ryujinx.HLE.OsHle.Handles public KMemoryManager(Process Process) { CpuMemory = Process.Memory; - Allocator = Process.Ns.Memory.Allocator; + Allocator = Process.Device.Memory.Allocator; long CodeRegionSize; long MapRegionSize; diff --git a/Ryujinx.HLE/OsHle/Handles/KProcessHandleTable.cs b/Ryujinx.HLE/HOS/Kernel/KProcessHandleTable.cs similarity index 94% rename from Ryujinx.HLE/OsHle/Handles/KProcessHandleTable.cs rename to Ryujinx.HLE/HOS/Kernel/KProcessHandleTable.cs index d22b63c683..db0eaa44f9 100644 --- a/Ryujinx.HLE/OsHle/Handles/KProcessHandleTable.cs +++ b/Ryujinx.HLE/HOS/Kernel/KProcessHandleTable.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Handles +namespace Ryujinx.HLE.HOS.Kernel { class KProcessHandleTable { diff --git a/Ryujinx.HLE/OsHle/Handles/KProcessScheduler.cs b/Ryujinx.HLE/HOS/Kernel/KProcessScheduler.cs similarity index 96% rename from Ryujinx.HLE/OsHle/Handles/KProcessScheduler.cs rename to Ryujinx.HLE/HOS/Kernel/KProcessScheduler.cs index 7d5e228460..2120f16c8e 100644 --- a/Ryujinx.HLE/OsHle/Handles/KProcessScheduler.cs +++ b/Ryujinx.HLE/HOS/Kernel/KProcessScheduler.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Concurrent; using System.Threading; -namespace Ryujinx.HLE.OsHle.Handles +namespace Ryujinx.HLE.HOS.Kernel { class KProcessScheduler : IDisposable { @@ -124,6 +124,16 @@ namespace Ryujinx.HLE.OsHle.Handles AllThreads[Thread].WaitSync.Set(); } + public void ForceWakeUp(KThread Thread) + { + if (AllThreads.TryGetValue(Thread, out SchedulerThread SchedThread)) + { + SchedThread.WaitSync.Set(); + SchedThread.WaitActivity.Set(); + SchedThread.WaitSched.Set(); + } + } + public void ChangeCore(KThread Thread, int IdealCore, int CoreMask) { lock (SchedLock) diff --git a/Ryujinx.HLE/OsHle/Handles/KSession.cs b/Ryujinx.HLE/HOS/Kernel/KSession.cs similarity index 90% rename from Ryujinx.HLE/OsHle/Handles/KSession.cs rename to Ryujinx.HLE/HOS/Kernel/KSession.cs index e85de36c8f..4b21d3a638 100644 --- a/Ryujinx.HLE/OsHle/Handles/KSession.cs +++ b/Ryujinx.HLE/HOS/Kernel/KSession.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Services; +using Ryujinx.HLE.HOS.Services; using System; -namespace Ryujinx.HLE.OsHle.Handles +namespace Ryujinx.HLE.HOS.Kernel { class KSession : IDisposable { diff --git a/Ryujinx.HLE/OsHle/Handles/KSharedMemory.cs b/Ryujinx.HLE/HOS/Kernel/KSharedMemory.cs similarity index 87% rename from Ryujinx.HLE/OsHle/Handles/KSharedMemory.cs rename to Ryujinx.HLE/HOS/Kernel/KSharedMemory.cs index 5c41047470..cdd31667b8 100644 --- a/Ryujinx.HLE/OsHle/Handles/KSharedMemory.cs +++ b/Ryujinx.HLE/HOS/Kernel/KSharedMemory.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Handles +namespace Ryujinx.HLE.HOS.Kernel { class KSharedMemory { diff --git a/Ryujinx.HLE/OsHle/Handles/KSynchronizationObject.cs b/Ryujinx.HLE/HOS/Kernel/KSynchronizationObject.cs similarity index 93% rename from Ryujinx.HLE/OsHle/Handles/KSynchronizationObject.cs rename to Ryujinx.HLE/HOS/Kernel/KSynchronizationObject.cs index 0e7d06f6d7..b83b00047e 100644 --- a/Ryujinx.HLE/OsHle/Handles/KSynchronizationObject.cs +++ b/Ryujinx.HLE/HOS/Kernel/KSynchronizationObject.cs @@ -1,7 +1,7 @@ using System; using System.Threading; -namespace Ryujinx.HLE.OsHle.Handles +namespace Ryujinx.HLE.HOS.Kernel { class KSynchronizationObject : IDisposable { diff --git a/Ryujinx.HLE/OsHle/Handles/KThread.cs b/Ryujinx.HLE/HOS/Kernel/KThread.cs similarity index 92% rename from Ryujinx.HLE/OsHle/Handles/KThread.cs rename to Ryujinx.HLE/HOS/Kernel/KThread.cs index 2b980d17b1..171fefc519 100644 --- a/Ryujinx.HLE/OsHle/Handles/KThread.cs +++ b/Ryujinx.HLE/HOS/Kernel/KThread.cs @@ -1,7 +1,7 @@ using ChocolArm64; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Handles +namespace Ryujinx.HLE.HOS.Kernel { class KThread : KSynchronizationObject { @@ -33,18 +33,20 @@ namespace Ryujinx.HLE.OsHle.Handles public long LastPc { get; set; } - public int ThreadId => Thread.ThreadId; + public int ThreadId { get; private set; } public KThread( AThread Thread, Process Process, int ProcessorId, - int Priority) + int Priority, + int ThreadId) { this.Thread = Thread; this.Process = Process; this.ProcessorId = ProcessorId; this.IdealCore = ProcessorId; + this.ThreadId = ThreadId; MutexWaiters = new List(); diff --git a/Ryujinx.HLE/OsHle/Handles/KTlsPageManager.cs b/Ryujinx.HLE/HOS/Kernel/KTlsPageManager.cs similarity index 97% rename from Ryujinx.HLE/OsHle/Handles/KTlsPageManager.cs rename to Ryujinx.HLE/HOS/Kernel/KTlsPageManager.cs index f116f5489f..1fb2ce6ad8 100644 --- a/Ryujinx.HLE/OsHle/Handles/KTlsPageManager.cs +++ b/Ryujinx.HLE/HOS/Kernel/KTlsPageManager.cs @@ -1,6 +1,6 @@ using System; -namespace Ryujinx.HLE.OsHle.Handles +namespace Ryujinx.HLE.HOS.Kernel { class KTlsPageManager { diff --git a/Ryujinx.HLE/OsHle/Handles/KTransferMemory.cs b/Ryujinx.HLE/HOS/Kernel/KTransferMemory.cs similarity index 89% rename from Ryujinx.HLE/OsHle/Handles/KTransferMemory.cs rename to Ryujinx.HLE/HOS/Kernel/KTransferMemory.cs index 5f9c040947..6ebffa7e49 100644 --- a/Ryujinx.HLE/OsHle/Handles/KTransferMemory.cs +++ b/Ryujinx.HLE/HOS/Kernel/KTransferMemory.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Handles +namespace Ryujinx.HLE.HOS.Kernel { class KTransferMemory { diff --git a/Ryujinx.HLE/OsHle/Kernel/KernelErr.cs b/Ryujinx.HLE/HOS/Kernel/KernelErr.cs similarity index 96% rename from Ryujinx.HLE/OsHle/Kernel/KernelErr.cs rename to Ryujinx.HLE/HOS/Kernel/KernelErr.cs index a62fc1bfef..e76ae11e5f 100644 --- a/Ryujinx.HLE/OsHle/Kernel/KernelErr.cs +++ b/Ryujinx.HLE/HOS/Kernel/KernelErr.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Kernel +namespace Ryujinx.HLE.HOS.Kernel { static class KernelErr { diff --git a/Ryujinx.HLE/OsHle/Handles/MemoryAttribute.cs b/Ryujinx.HLE/HOS/Kernel/MemoryAttribute.cs similarity index 91% rename from Ryujinx.HLE/OsHle/Handles/MemoryAttribute.cs rename to Ryujinx.HLE/HOS/Kernel/MemoryAttribute.cs index e234d7f08b..8f3197cb0c 100644 --- a/Ryujinx.HLE/OsHle/Handles/MemoryAttribute.cs +++ b/Ryujinx.HLE/HOS/Kernel/MemoryAttribute.cs @@ -1,6 +1,6 @@ using System; -namespace Ryujinx.HLE.OsHle.Handles +namespace Ryujinx.HLE.HOS.Kernel { [Flags] enum MemoryAttribute : byte diff --git a/Ryujinx.HLE/OsHle/Handles/MemoryPermission.cs b/Ryujinx.HLE/HOS/Kernel/MemoryPermission.cs similarity index 88% rename from Ryujinx.HLE/OsHle/Handles/MemoryPermission.cs rename to Ryujinx.HLE/HOS/Kernel/MemoryPermission.cs index 416f171e2d..63539c2eba 100644 --- a/Ryujinx.HLE/OsHle/Handles/MemoryPermission.cs +++ b/Ryujinx.HLE/HOS/Kernel/MemoryPermission.cs @@ -1,6 +1,6 @@ using System; -namespace Ryujinx.HLE.OsHle.Handles +namespace Ryujinx.HLE.HOS.Kernel { [Flags] enum MemoryPermission : byte diff --git a/Ryujinx.HLE/OsHle/Handles/MemoryState.cs b/Ryujinx.HLE/HOS/Kernel/MemoryState.cs similarity index 98% rename from Ryujinx.HLE/OsHle/Handles/MemoryState.cs rename to Ryujinx.HLE/HOS/Kernel/MemoryState.cs index 5437d6a33c..2c37723c18 100644 --- a/Ryujinx.HLE/OsHle/Handles/MemoryState.cs +++ b/Ryujinx.HLE/HOS/Kernel/MemoryState.cs @@ -1,6 +1,6 @@ using System; -namespace Ryujinx.HLE.OsHle +namespace Ryujinx.HLE.HOS.Kernel { [Flags] enum MemoryState : uint diff --git a/Ryujinx.HLE/OsHle/Kernel/NsTimeConverter.cs b/Ryujinx.HLE/HOS/Kernel/NsTimeConverter.cs similarity index 90% rename from Ryujinx.HLE/OsHle/Kernel/NsTimeConverter.cs rename to Ryujinx.HLE/HOS/Kernel/NsTimeConverter.cs index 966fdacae2..b8008f7579 100644 --- a/Ryujinx.HLE/OsHle/Kernel/NsTimeConverter.cs +++ b/Ryujinx.HLE/HOS/Kernel/NsTimeConverter.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Kernel +namespace Ryujinx.HLE.HOS.Kernel { static class NsTimeConverter { diff --git a/Ryujinx.HLE/OsHle/Handles/SchedulerThread.cs b/Ryujinx.HLE/HOS/Kernel/SchedulerThread.cs similarity index 96% rename from Ryujinx.HLE/OsHle/Handles/SchedulerThread.cs rename to Ryujinx.HLE/HOS/Kernel/SchedulerThread.cs index 5bdefe74e9..bab7b03e61 100644 --- a/Ryujinx.HLE/OsHle/Handles/SchedulerThread.cs +++ b/Ryujinx.HLE/HOS/Kernel/SchedulerThread.cs @@ -1,7 +1,7 @@ using System; using System.Threading; -namespace Ryujinx.HLE.OsHle.Handles +namespace Ryujinx.HLE.HOS.Kernel { class SchedulerThread : IDisposable { diff --git a/Ryujinx.HLE/OsHle/Kernel/SvcHandler.cs b/Ryujinx.HLE/HOS/Kernel/SvcHandler.cs similarity index 90% rename from Ryujinx.HLE/OsHle/Kernel/SvcHandler.cs rename to Ryujinx.HLE/HOS/Kernel/SvcHandler.cs index a33ffe5e78..fcb72c140e 100644 --- a/Ryujinx.HLE/OsHle/Kernel/SvcHandler.cs +++ b/Ryujinx.HLE/HOS/Kernel/SvcHandler.cs @@ -2,13 +2,12 @@ using ChocolArm64.Events; using ChocolArm64.Memory; using ChocolArm64.State; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Handles; using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Threading; -namespace Ryujinx.HLE.OsHle.Kernel +namespace Ryujinx.HLE.HOS.Kernel { partial class SvcHandler { @@ -16,7 +15,7 @@ namespace Ryujinx.HLE.OsHle.Kernel private Dictionary SvcFuncs; - private Switch Ns; + private Switch Device; private Process Process; private AMemory Memory; @@ -27,7 +26,7 @@ namespace Ryujinx.HLE.OsHle.Kernel private static Random Rng; - public SvcHandler(Switch Ns, Process Process) + public SvcHandler(Switch Device, Process Process) { SvcFuncs = new Dictionary() { @@ -73,7 +72,7 @@ namespace Ryujinx.HLE.OsHle.Kernel { 0x34, SvcWaitForAddress } }; - this.Ns = Ns; + this.Device = Device; this.Process = Process; this.Memory = Process.Memory; @@ -93,19 +92,19 @@ namespace Ryujinx.HLE.OsHle.Kernel if (SvcFuncs.TryGetValue(e.Id, out SvcFunc Func)) { - Ns.Log.PrintDebug(LogClass.KernelSvc, $"{Func.Method.Name} called."); + Device.Log.PrintDebug(LogClass.KernelSvc, $"{Func.Method.Name} called."); Func(ThreadState); Process.Scheduler.Reschedule(Process.GetThread(ThreadState.Tpidr)); - Ns.Log.PrintDebug(LogClass.KernelSvc, $"{Func.Method.Name} ended."); + Device.Log.PrintDebug(LogClass.KernelSvc, $"{Func.Method.Name} ended."); } else { Process.PrintStackTrace(ThreadState); - throw new NotImplementedException(e.Id.ToString("x4")); + throw new NotImplementedException($"0x{e.Id:x4}"); } } diff --git a/Ryujinx.HLE/OsHle/Kernel/SvcMemory.cs b/Ryujinx.HLE/HOS/Kernel/SvcMemory.cs similarity index 74% rename from Ryujinx.HLE/OsHle/Kernel/SvcMemory.cs rename to Ryujinx.HLE/HOS/Kernel/SvcMemory.cs index 68d8729304..b9bca74ad2 100644 --- a/Ryujinx.HLE/OsHle/Kernel/SvcMemory.cs +++ b/Ryujinx.HLE/HOS/Kernel/SvcMemory.cs @@ -1,10 +1,9 @@ using ChocolArm64.State; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Handles; -using static Ryujinx.HLE.OsHle.ErrorCode; +using static Ryujinx.HLE.HOS.ErrorCode; -namespace Ryujinx.HLE.OsHle.Kernel +namespace Ryujinx.HLE.HOS.Kernel { partial class SvcHandler { @@ -14,7 +13,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if ((Size & 0x1fffff) != 0 || Size != (uint)Size) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Heap size 0x{Size:x16} is not aligned!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Heap size 0x{Size:x16} is not aligned!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidSize); @@ -31,7 +30,7 @@ namespace Ryujinx.HLE.OsHle.Kernel } else { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!"); } } @@ -42,7 +41,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!PageAligned(Position)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress); @@ -51,7 +50,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!PageAligned(Size) || Size == 0) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidSize); @@ -66,7 +65,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (Attributes != AttributeMask || (Attributes | MemoryAttribute.Uncached) != MemoryAttribute.Uncached) { - Ns.Log.PrintWarning(LogClass.KernelSvc, "Invalid memory attributes!"); + Device.Log.PrintWarning(LogClass.KernelSvc, "Invalid memory attributes!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidMaskValue); @@ -81,7 +80,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (Result != 0) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!"); } else { @@ -99,7 +98,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!PageAligned(Src | Dst)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, "Addresses are not page aligned!"); + Device.Log.PrintWarning(LogClass.KernelSvc, "Addresses are not page aligned!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress); @@ -108,7 +107,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!PageAligned(Size) || Size == 0) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidSize); @@ -117,7 +116,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if ((ulong)(Src + Size) <= (ulong)Src || (ulong)(Dst + Size) <= (ulong)Dst) { - Ns.Log.PrintWarning(LogClass.KernelSvc, "Addresses outside of range!"); + Device.Log.PrintWarning(LogClass.KernelSvc, "Addresses outside of range!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm); @@ -126,7 +125,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!InsideAddrSpace(Src, Size)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Src address 0x{Src:x16} out of range!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Src address 0x{Src:x16} out of range!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm); @@ -135,7 +134,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!InsideNewMapRegion(Dst, Size)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Dst address 0x{Dst:x16} out of range!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Dst address 0x{Dst:x16} out of range!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidMemRange); @@ -146,7 +145,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (Result != 0) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!"); } ThreadState.X0 = (ulong)Result; @@ -160,7 +159,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!PageAligned(Src | Dst)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, "Addresses are not page aligned!"); + Device.Log.PrintWarning(LogClass.KernelSvc, "Addresses are not page aligned!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress); @@ -169,7 +168,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!PageAligned(Size) || Size == 0) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidSize); @@ -178,7 +177,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if ((ulong)(Src + Size) <= (ulong)Src || (ulong)(Dst + Size) <= (ulong)Dst) { - Ns.Log.PrintWarning(LogClass.KernelSvc, "Addresses outside of range!"); + Device.Log.PrintWarning(LogClass.KernelSvc, "Addresses outside of range!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm); @@ -187,7 +186,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!InsideAddrSpace(Src, Size)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Src address 0x{Src:x16} out of range!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Src address 0x{Src:x16} out of range!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm); @@ -196,7 +195,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!InsideNewMapRegion(Dst, Size)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Dst address 0x{Dst:x16} out of range!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Dst address 0x{Dst:x16} out of range!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidMemRange); @@ -207,7 +206,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (Result != 0) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!"); } ThreadState.X0 = (ulong)Result; @@ -241,7 +240,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!PageAligned(Position)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress); @@ -250,7 +249,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!PageAligned(Size) || Size == 0) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidSize); @@ -259,7 +258,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if ((ulong)(Position + Size) <= (ulong)Position) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid region address 0x{Position:x16} / size 0x{Size:x16}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid region address 0x{Position:x16} / size 0x{Size:x16}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm); @@ -270,7 +269,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if ((Permission | MemoryPermission.Write) != MemoryPermission.ReadAndWrite) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid permission {Permission}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid permission {Permission}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidPermission); @@ -281,7 +280,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (SharedMemory == null) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid shared memory handle 0x{Handle:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid shared memory handle 0x{Handle:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle); @@ -290,7 +289,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!InsideAddrSpace(Position, Size) || InsideMapRegion(Position, Size) || InsideHeapRegion(Position, Size)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} out of range!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} out of range!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm); @@ -299,7 +298,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (SharedMemory.Size != Size) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} does not match shared memory size 0x{SharedMemory.Size:16}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} does not match shared memory size 0x{SharedMemory.Size:16}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidSize); @@ -310,7 +309,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (Result != 0) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!"); } ThreadState.X0 = (ulong)Result; @@ -324,7 +323,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!PageAligned(Position)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress); @@ -333,7 +332,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!PageAligned(Size) || Size == 0) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidSize); @@ -342,7 +341,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if ((ulong)(Position + Size) <= (ulong)Position) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid region address 0x{Position:x16} / size 0x{Size:x16}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid region address 0x{Position:x16} / size 0x{Size:x16}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm); @@ -353,7 +352,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (SharedMemory == null) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid shared memory handle 0x{Handle:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid shared memory handle 0x{Handle:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle); @@ -362,7 +361,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!InsideAddrSpace(Position, Size) || InsideMapRegion(Position, Size) || InsideHeapRegion(Position, Size)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} out of range!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} out of range!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm); @@ -373,7 +372,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (Result != 0) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!"); } ThreadState.X0 = (ulong)Result; @@ -386,7 +385,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!PageAligned(Position)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress); @@ -395,7 +394,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!PageAligned(Size) || Size == 0) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress); @@ -404,7 +403,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if ((ulong)(Position + Size) <= (ulong)Position) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid region address 0x{Position:x16} / size 0x{Size:x16}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid region address 0x{Position:x16} / size 0x{Size:x16}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm); @@ -415,7 +414,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (Permission > MemoryPermission.ReadAndWrite || Permission == MemoryPermission.Write) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid permission {Permission}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid permission {Permission}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidPermission); @@ -439,7 +438,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!PageAligned(Position)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress); @@ -448,7 +447,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!PageAligned(Size) || Size == 0) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidSize); @@ -457,7 +456,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if ((ulong)(Position + Size) <= (ulong)Position) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid region address 0x{Position:x16} / size 0x{Size:x16}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid region address 0x{Position:x16} / size 0x{Size:x16}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm); @@ -466,7 +465,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!InsideAddrSpace(Position, Size)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid address {Position:x16}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid address {Position:x16}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm); @@ -477,7 +476,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (Result != 0) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!"); } ThreadState.X0 = (ulong)Result; @@ -490,7 +489,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!PageAligned(Position)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress); @@ -499,7 +498,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!PageAligned(Size) || Size == 0) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidSize); @@ -508,7 +507,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if ((ulong)(Position + Size) <= (ulong)Position) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid region address 0x{Position:x16} / size 0x{Size:x16}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid region address 0x{Position:x16} / size 0x{Size:x16}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm); @@ -517,7 +516,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (!InsideAddrSpace(Position, Size)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid address {Position:x16}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid address {Position:x16}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm); @@ -528,7 +527,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (Result != 0) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!"); } ThreadState.X0 = (ulong)Result; diff --git a/Ryujinx.HLE/OsHle/Kernel/SvcSystem.cs b/Ryujinx.HLE/HOS/Kernel/SvcSystem.cs similarity index 88% rename from Ryujinx.HLE/OsHle/Kernel/SvcSystem.cs rename to Ryujinx.HLE/HOS/Kernel/SvcSystem.cs index f833745b7a..7cc1c8588e 100644 --- a/Ryujinx.HLE/OsHle/Kernel/SvcSystem.cs +++ b/Ryujinx.HLE/HOS/Kernel/SvcSystem.cs @@ -1,16 +1,15 @@ using ChocolArm64.Memory; using ChocolArm64.State; +using Ryujinx.HLE.Exceptions; +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Services; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Exceptions; -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Ipc; -using Ryujinx.HLE.OsHle.Services; using System; using System.Threading; -using static Ryujinx.HLE.OsHle.ErrorCode; +using static Ryujinx.HLE.HOS.ErrorCode; -namespace Ryujinx.HLE.OsHle.Kernel +namespace Ryujinx.HLE.HOS.Kernel { partial class SvcHandler { @@ -20,7 +19,7 @@ namespace Ryujinx.HLE.OsHle.Kernel private void SvcExitProcess(AThreadState ThreadState) { - Ns.Os.ExitProcess(ThreadState.ProcessId); + Device.System.ExitProcess(Process.ProcessId); } private void SvcClearEvent(AThreadState ThreadState) @@ -40,7 +39,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (Obj == null) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid handle 0x{Handle:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid handle 0x{Handle:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle); @@ -75,7 +74,7 @@ namespace Ryujinx.HLE.OsHle.Kernel } else { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid event handle 0x{Handle:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid event handle 0x{Handle:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle); } @@ -87,10 +86,10 @@ namespace Ryujinx.HLE.OsHle.Kernel int HandlesCount = (int)ThreadState.X2; ulong Timeout = ThreadState.X3; - Ns.Log.PrintDebug(LogClass.KernelSvc, - "HandlesPtr = " + HandlesPtr .ToString("x16") + ", " + - "HandlesCount = " + HandlesCount.ToString("x8") + ", " + - "Timeout = " + Timeout .ToString("x16")); + Device.Log.PrintDebug(LogClass.KernelSvc, + "HandlesPtr = 0x" + HandlesPtr .ToString("x16") + ", " + + "HandlesCount = 0x" + HandlesCount.ToString("x8") + ", " + + "Timeout = 0x" + Timeout .ToString("x16")); if ((uint)HandlesCount > 0x40) { @@ -111,7 +110,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (SyncObj == null) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid handle 0x{Handle:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid handle 0x{Handle:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle); @@ -175,7 +174,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (Thread == null) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{ThreadHandle:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{ThreadHandle:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle); @@ -240,7 +239,7 @@ namespace Ryujinx.HLE.OsHle.Kernel IpcMessage Cmd = new IpcMessage(CmdData, CmdPtr); - long Result = IpcHandler.IpcCall(Ns, Process, Memory, Session, Cmd, CmdPtr); + long Result = IpcHandler.IpcCall(Device, Process, Memory, Session, Cmd, CmdPtr); Thread.Yield(); @@ -250,7 +249,7 @@ namespace Ryujinx.HLE.OsHle.Kernel } else { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid session handle 0x{Handle:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid session handle 0x{Handle:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle); } @@ -274,7 +273,7 @@ namespace Ryujinx.HLE.OsHle.Kernel string Str = AMemoryHelper.ReadAsciiString(Memory, Position, Size); - Ns.Log.PrintWarning(LogClass.KernelSvc, Str); + Device.Log.PrintWarning(LogClass.KernelSvc, Str); ThreadState.X0 = 0; } @@ -321,11 +320,11 @@ namespace Ryujinx.HLE.OsHle.Kernel break; case 6: - ThreadState.X1 = (ulong)Process.Ns.Memory.Allocator.TotalAvailableSize; + ThreadState.X1 = (ulong)Process.Device.Memory.Allocator.TotalAvailableSize; break; case 7: - ThreadState.X1 = (ulong)Process.Ns.Memory.Allocator.TotalUsedSize; + ThreadState.X1 = (ulong)Process.Device.Memory.Allocator.TotalUsedSize; break; case 8: @@ -365,7 +364,7 @@ namespace Ryujinx.HLE.OsHle.Kernel default: Process.PrintStackTrace(ThreadState); - throw new NotImplementedException($"SvcGetInfo: {InfoType} {Handle:x8} {InfoId}"); + throw new NotImplementedException($"SvcGetInfo: {InfoType} 0x{Handle:x8} {InfoId}"); } ThreadState.X0 = 0; diff --git a/Ryujinx.HLE/OsHle/Kernel/SvcThread.cs b/Ryujinx.HLE/HOS/Kernel/SvcThread.cs similarity index 85% rename from Ryujinx.HLE/OsHle/Kernel/SvcThread.cs rename to Ryujinx.HLE/HOS/Kernel/SvcThread.cs index 0452485045..69e75ec0af 100644 --- a/Ryujinx.HLE/OsHle/Kernel/SvcThread.cs +++ b/Ryujinx.HLE/HOS/Kernel/SvcThread.cs @@ -1,11 +1,10 @@ using ChocolArm64.State; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Handles; using System.Threading; -using static Ryujinx.HLE.OsHle.ErrorCode; +using static Ryujinx.HLE.HOS.ErrorCode; -namespace Ryujinx.HLE.OsHle.Kernel +namespace Ryujinx.HLE.HOS.Kernel { partial class SvcHandler { @@ -19,7 +18,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if ((uint)Priority > 0x3f) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid priority 0x{Priority:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid priority 0x{Priority:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidPriority); @@ -33,7 +32,7 @@ namespace Ryujinx.HLE.OsHle.Kernel } else if ((uint)ProcessorId > 3) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid core id 0x{ProcessorId:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid core id 0x{ProcessorId:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidCoreId); @@ -66,7 +65,7 @@ namespace Ryujinx.HLE.OsHle.Kernel } else { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle); } @@ -83,7 +82,7 @@ namespace Ryujinx.HLE.OsHle.Kernel { ulong TimeoutNs = ThreadState.X0; - Ns.Log.PrintDebug(LogClass.KernelSvc, "Timeout = " + TimeoutNs.ToString("x16")); + Device.Log.PrintDebug(LogClass.KernelSvc, "Timeout = 0x" + TimeoutNs.ToString("x16")); KThread CurrThread = Process.GetThread(ThreadState.Tpidr); @@ -114,7 +113,7 @@ namespace Ryujinx.HLE.OsHle.Kernel } else { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle); } @@ -125,9 +124,9 @@ namespace Ryujinx.HLE.OsHle.Kernel int Handle = (int)ThreadState.X0; int Priority = (int)ThreadState.X1; - Ns.Log.PrintDebug(LogClass.KernelSvc, - "Handle = " + Handle .ToString("x8") + ", " + - "Priority = " + Priority.ToString("x8")); + Device.Log.PrintDebug(LogClass.KernelSvc, + "Handle = 0x" + Handle .ToString("x8") + ", " + + "Priority = 0x" + Priority.ToString("x8")); KThread Thread = GetThread(ThreadState.Tpidr, Handle); @@ -139,7 +138,7 @@ namespace Ryujinx.HLE.OsHle.Kernel } else { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle); } @@ -149,7 +148,7 @@ namespace Ryujinx.HLE.OsHle.Kernel { int Handle = (int)ThreadState.X2; - Ns.Log.PrintDebug(LogClass.KernelSvc, "Handle = " + Handle.ToString("x8")); + Device.Log.PrintDebug(LogClass.KernelSvc, "Handle = 0x" + Handle.ToString("x8")); KThread Thread = GetThread(ThreadState.Tpidr, Handle); @@ -161,7 +160,7 @@ namespace Ryujinx.HLE.OsHle.Kernel } else { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle); } @@ -173,10 +172,10 @@ namespace Ryujinx.HLE.OsHle.Kernel int IdealCore = (int)ThreadState.X1; long CoreMask = (long)ThreadState.X2; - Ns.Log.PrintDebug(LogClass.KernelSvc, - "Handle = " + Handle .ToString("x8") + ", " + - "IdealCore = " + IdealCore.ToString("x8") + ", " + - "CoreMask = " + CoreMask .ToString("x16")); + Device.Log.PrintDebug(LogClass.KernelSvc, + "Handle = 0x" + Handle .ToString("x8") + ", " + + "IdealCore = 0x" + IdealCore.ToString("x8") + ", " + + "CoreMask = 0x" + CoreMask .ToString("x16")); KThread Thread = GetThread(ThreadState.Tpidr, Handle); @@ -193,7 +192,7 @@ namespace Ryujinx.HLE.OsHle.Kernel { if ((IdealCore | 2) != -1) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid core id 0x{IdealCore:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid core id 0x{IdealCore:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidCoreId); @@ -202,7 +201,7 @@ namespace Ryujinx.HLE.OsHle.Kernel } else if ((CoreMask & (1 << IdealCore)) == 0) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid core mask 0x{CoreMask:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid core mask 0x{CoreMask:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidMaskValue); @@ -212,7 +211,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (Thread == null) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle); @@ -224,7 +223,7 @@ namespace Ryujinx.HLE.OsHle.Kernel //-3 is used as "don't update", the old IdealCore value is kept. if (IdealCore == -3 && (CoreMask & (1 << Thread.IdealCore)) == 0) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid core mask 0x{CoreMask:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid core mask 0x{CoreMask:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidMaskValue); @@ -254,7 +253,7 @@ namespace Ryujinx.HLE.OsHle.Kernel } else { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle); } @@ -275,7 +274,7 @@ namespace Ryujinx.HLE.OsHle.Kernel } else { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle); } @@ -290,7 +289,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (Thread == null) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle); @@ -299,7 +298,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (Process.GetThread(ThreadState.Tpidr) == Thread) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Thread handle 0x{Handle:x8} is current thread!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Thread handle 0x{Handle:x8} is current thread!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidThread); diff --git a/Ryujinx.HLE/OsHle/Kernel/SvcThreadSync.cs b/Ryujinx.HLE/HOS/Kernel/SvcThreadSync.cs similarity index 79% rename from Ryujinx.HLE/OsHle/Kernel/SvcThreadSync.cs rename to Ryujinx.HLE/HOS/Kernel/SvcThreadSync.cs index 164a85cac4..7097d0f71a 100644 --- a/Ryujinx.HLE/OsHle/Kernel/SvcThreadSync.cs +++ b/Ryujinx.HLE/HOS/Kernel/SvcThreadSync.cs @@ -1,11 +1,10 @@ using ChocolArm64.State; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Handles; using System; -using static Ryujinx.HLE.OsHle.ErrorCode; +using static Ryujinx.HLE.HOS.ErrorCode; -namespace Ryujinx.HLE.OsHle.Kernel +namespace Ryujinx.HLE.HOS.Kernel { partial class SvcHandler { @@ -17,23 +16,23 @@ namespace Ryujinx.HLE.OsHle.Kernel long MutexAddress = (long)ThreadState.X1; int WaitThreadHandle = (int)ThreadState.X2; - Ns.Log.PrintDebug(LogClass.KernelSvc, - "OwnerThreadHandle = " + OwnerThreadHandle.ToString("x8") + ", " + - "MutexAddress = " + MutexAddress .ToString("x16") + ", " + - "WaitThreadHandle = " + WaitThreadHandle .ToString("x8")); + Device.Log.PrintDebug(LogClass.KernelSvc, + "OwnerThreadHandle = 0x" + OwnerThreadHandle.ToString("x8") + ", " + + "MutexAddress = 0x" + MutexAddress .ToString("x16") + ", " + + "WaitThreadHandle = 0x" + WaitThreadHandle .ToString("x8")); if (IsPointingInsideKernel(MutexAddress)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid mutex address 0x{MutexAddress:x16}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid mutex address 0x{MutexAddress:x16}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm); return; } - if (IsWordAddressUnaligned(MutexAddress)) + if (IsAddressNotWordAligned(MutexAddress)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned mutex address 0x{MutexAddress:x16}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned mutex address 0x{MutexAddress:x16}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress); @@ -44,7 +43,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (OwnerThread == null) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid owner thread handle 0x{OwnerThreadHandle:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid owner thread handle 0x{OwnerThreadHandle:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle); @@ -55,7 +54,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (WaitThread == null) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid requesting thread handle 0x{WaitThreadHandle:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid requesting thread handle 0x{WaitThreadHandle:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle); @@ -73,20 +72,20 @@ namespace Ryujinx.HLE.OsHle.Kernel { long MutexAddress = (long)ThreadState.X0; - Ns.Log.PrintDebug(LogClass.KernelSvc, "MutexAddress = " + MutexAddress.ToString("x16")); + Device.Log.PrintDebug(LogClass.KernelSvc, "MutexAddress = 0x" + MutexAddress.ToString("x16")); if (IsPointingInsideKernel(MutexAddress)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid mutex address 0x{MutexAddress:x16}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid mutex address 0x{MutexAddress:x16}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm); return; } - if (IsWordAddressUnaligned(MutexAddress)) + if (IsAddressNotWordAligned(MutexAddress)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned mutex address 0x{MutexAddress:x16}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned mutex address 0x{MutexAddress:x16}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress); @@ -105,24 +104,24 @@ namespace Ryujinx.HLE.OsHle.Kernel int ThreadHandle = (int)ThreadState.X2; ulong Timeout = ThreadState.X3; - Ns.Log.PrintDebug(LogClass.KernelSvc, - "MutexAddress = " + MutexAddress .ToString("x16") + ", " + - "CondVarAddress = " + CondVarAddress.ToString("x16") + ", " + - "ThreadHandle = " + ThreadHandle .ToString("x8") + ", " + - "Timeout = " + Timeout .ToString("x16")); + Device.Log.PrintDebug(LogClass.KernelSvc, + "MutexAddress = 0x" + MutexAddress .ToString("x16") + ", " + + "CondVarAddress = 0x" + CondVarAddress.ToString("x16") + ", " + + "ThreadHandle = 0x" + ThreadHandle .ToString("x8") + ", " + + "Timeout = 0x" + Timeout .ToString("x16")); if (IsPointingInsideKernel(MutexAddress)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid mutex address 0x{MutexAddress:x16}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid mutex address 0x{MutexAddress:x16}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm); return; } - if (IsWordAddressUnaligned(MutexAddress)) + if (IsAddressNotWordAligned(MutexAddress)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned mutex address 0x{MutexAddress:x16}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned mutex address 0x{MutexAddress:x16}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress); @@ -133,7 +132,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (Thread == null) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{ThreadHandle:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{ThreadHandle:x8}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle); @@ -157,9 +156,9 @@ namespace Ryujinx.HLE.OsHle.Kernel long CondVarAddress = (long)ThreadState.X0; int Count = (int)ThreadState.X1; - Ns.Log.PrintDebug(LogClass.KernelSvc, - "CondVarAddress = " + CondVarAddress.ToString("x16") + ", " + - "Count = " + Count .ToString("x8")); + Device.Log.PrintDebug(LogClass.KernelSvc, + "CondVarAddress = 0x" + CondVarAddress.ToString("x16") + ", " + + "Count = 0x" + Count .ToString("x8")); KThread CurrThread = Process.GetThread(ThreadState.Tpidr); @@ -179,7 +178,7 @@ namespace Ryujinx.HLE.OsHle.Kernel { int MutexValue = Memory.ReadInt32(MutexAddress); - Ns.Log.PrintDebug(LogClass.KernelSvc, "MutexValue = " + MutexValue.ToString("x8")); + Device.Log.PrintDebug(LogClass.KernelSvc, "MutexValue = 0x" + MutexValue.ToString("x8")); if (MutexValue != (OwnerThreadHandle | MutexHasListenersMask)) { @@ -192,7 +191,7 @@ namespace Ryujinx.HLE.OsHle.Kernel InsertWaitingMutexThreadUnsafe(OwnerThreadHandle, WaitThread); } - Ns.Log.PrintDebug(LogClass.KernelSvc, "Entering wait state..."); + Device.Log.PrintDebug(LogClass.KernelSvc, "Entering wait state..."); Process.Scheduler.EnterWait(CurrThread); } @@ -204,24 +203,24 @@ namespace Ryujinx.HLE.OsHle.Kernel int Value = (int)ThreadState.X2; ulong Timeout = ThreadState.X3; - Ns.Log.PrintDebug(LogClass.KernelSvc, - "Address = " + Address.ToString("x16") + ", " + - "ArbitrationType = " + Type .ToString() + ", " + - "Value = " + Value .ToString("x8") + ", " + - "Timeout = " + Timeout.ToString("x16")); + Device.Log.PrintDebug(LogClass.KernelSvc, + "Address = 0x" + Address.ToString("x16") + ", " + + "ArbitrationType = 0x" + Type .ToString() + ", " + + "Value = 0x" + Value .ToString("x8") + ", " + + "Timeout = 0x" + Timeout.ToString("x16")); if (IsPointingInsideKernel(Address)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid address 0x{Address:x16}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid address 0x{Address:x16}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm); return; } - if (IsWordAddressUnaligned(Address)) + if (IsAddressNotWordAligned(Address)) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned address 0x{Address:x16}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned address 0x{Address:x16}!"); ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress); @@ -282,13 +281,13 @@ namespace Ryujinx.HLE.OsHle.Kernel Process.Scheduler.WakeUp(OwnerThread); - Ns.Log.PrintDebug(LogClass.KernelSvc, "Gave mutex to thread id " + OwnerThread.ThreadId + "!"); + Device.Log.PrintDebug(LogClass.KernelSvc, "Gave mutex to thread id " + OwnerThread.ThreadId + "!"); } else { Memory.WriteInt32ToSharedAddr(MutexAddress, 0); - Ns.Log.PrintDebug(LogClass.KernelSvc, "No threads waiting mutex!"); + Device.Log.PrintDebug(LogClass.KernelSvc, "No threads waiting mutex!"); } } } @@ -313,7 +312,7 @@ namespace Ryujinx.HLE.OsHle.Kernel Process.ThreadArbiterList.Add(WaitThread); } - Ns.Log.PrintDebug(LogClass.KernelSvc, "Entering wait state..."); + Device.Log.PrintDebug(LogClass.KernelSvc, "Entering wait state..."); if (Timeout != ulong.MaxValue) { @@ -333,7 +332,7 @@ namespace Ryujinx.HLE.OsHle.Kernel Process.ThreadArbiterList.Remove(WaitThread); - Ns.Log.PrintDebug(LogClass.KernelSvc, "Timed out..."); + Device.Log.PrintDebug(LogClass.KernelSvc, "Timed out..."); return false; } @@ -361,7 +360,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (WaitThread == null) { - Ns.Log.PrintDebug(LogClass.KernelSvc, "No more threads to wake up!"); + Device.Log.PrintDebug(LogClass.KernelSvc, "No more threads to wake up!"); break; } @@ -393,7 +392,7 @@ namespace Ryujinx.HLE.OsHle.Kernel MutexValue = Memory.ReadInt32(MutexAddress); } - Ns.Log.PrintDebug(LogClass.KernelSvc, "MutexValue = " + MutexValue.ToString("x8")); + Device.Log.PrintDebug(LogClass.KernelSvc, "MutexValue = 0x" + MutexValue.ToString("x8")); if (MutexValue == 0) { @@ -437,7 +436,7 @@ namespace Ryujinx.HLE.OsHle.Kernel if (OwnerThread == null) { - Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{OwnerThreadHandle:x8}!"); + Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{OwnerThreadHandle:x8}!"); return; } @@ -516,7 +515,7 @@ namespace Ryujinx.HLE.OsHle.Kernel return ((ulong)Address + 0x1000000000) < 0xffffff000; } - private bool IsWordAddressUnaligned(long Address) + private bool IsAddressNotWordAligned(long Address) { return (Address & 3) != 0; } diff --git a/Ryujinx.HLE/OsHle/Handles/ThreadQueue.cs b/Ryujinx.HLE/HOS/Kernel/ThreadQueue.cs similarity index 99% rename from Ryujinx.HLE/OsHle/Handles/ThreadQueue.cs rename to Ryujinx.HLE/HOS/Kernel/ThreadQueue.cs index 09dcb3d088..815e86ad2a 100644 --- a/Ryujinx.HLE/OsHle/Handles/ThreadQueue.cs +++ b/Ryujinx.HLE/HOS/Kernel/ThreadQueue.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Handles +namespace Ryujinx.HLE.HOS.Kernel { class ThreadQueue { diff --git a/Ryujinx.HLE/OsHle/Process.cs b/Ryujinx.HLE/HOS/Process.cs similarity index 79% rename from Ryujinx.HLE/OsHle/Process.cs rename to Ryujinx.HLE/HOS/Process.cs index 96fe3610d5..bfda93f494 100644 --- a/Ryujinx.HLE/OsHle/Process.cs +++ b/Ryujinx.HLE/HOS/Process.cs @@ -2,30 +2,29 @@ using ChocolArm64; using ChocolArm64.Events; using ChocolArm64.Memory; using ChocolArm64.State; +using Ryujinx.HLE.Exceptions; +using Ryujinx.HLE.HOS.Diagnostics; +using Ryujinx.HLE.HOS.Kernel; +using Ryujinx.HLE.HOS.Services.Nv; +using Ryujinx.HLE.HOS.SystemState; using Ryujinx.HLE.Loaders; using Ryujinx.HLE.Loaders.Executables; using Ryujinx.HLE.Loaders.Npdm; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Diagnostics; -using Ryujinx.HLE.OsHle.Exceptions; -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Kernel; -using Ryujinx.HLE.OsHle.Services.Nv; -using Ryujinx.HLE.OsHle.SystemState; -using Ryujinx.HLE.OsHle.Utilities; +using Ryujinx.HLE.Utilities; using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Text; -namespace Ryujinx.HLE.OsHle +namespace Ryujinx.HLE.HOS { class Process : IDisposable { private const int TickFreq = 19_200_000; - public Switch Ns { get; private set; } + public Switch Device { get; private set; } public bool NeedsHbAbi { get; private set; } @@ -57,8 +56,6 @@ namespace Ryujinx.HLE.OsHle private ConcurrentDictionary Threads; - private KThread MainThread; - private List Executables; private Dictionary SymbolTable; @@ -69,14 +66,14 @@ namespace Ryujinx.HLE.OsHle private bool Disposed; - public Process(Switch Ns, KProcessScheduler Scheduler, int ProcessId, Npdm MetaData) + public Process(Switch Device, KProcessScheduler Scheduler, int ProcessId, Npdm MetaData) { - this.Ns = Ns; + this.Device = Device; this.Scheduler = Scheduler; this.MetaData = MetaData; this.ProcessId = ProcessId; - Memory = new AMemory(Ns.Memory.RamPointer); + Memory = new AMemory(Device.Memory.RamPointer); MemoryManager = new KMemoryManager(this); @@ -90,7 +87,7 @@ namespace Ryujinx.HLE.OsHle AppletState = new AppletStateMgr(); - SvcHandler = new SvcHandler(Ns, this); + SvcHandler = new SvcHandler(Device, this); Threads = new ConcurrentDictionary(); @@ -106,7 +103,7 @@ namespace Ryujinx.HLE.OsHle throw new ObjectDisposedException(nameof(Process)); } - Ns.Log.PrintInfo(LogClass.Loader, $"Image base at 0x{ImageBase:x16}."); + Device.Log.PrintInfo(LogClass.Loader, $"Image base at 0x{ImageBase:x16}."); Executable Executable = new Executable(Program, MemoryManager, Memory, ImageBase); @@ -156,7 +153,7 @@ namespace Ryujinx.HLE.OsHle return false; } - MainThread = HandleTable.GetData(Handle); + KThread MainThread = HandleTable.GetData(Handle); if (NeedsHbAbi) { @@ -170,7 +167,7 @@ namespace Ryujinx.HLE.OsHle MemoryState.MappedMemory, MemoryPermission.ReadAndWrite); - string SwitchPath = Ns.VFs.SystemPathToSwitchPath(Executables[0].FilePath); + string SwitchPath = Device.FileSystem.SystemPathToSwitchPath(Executables[0].FilePath); Homebrew.WriteHbAbiData(Memory, HbAbiDataPosition, Handle, SwitchPath); @@ -183,24 +180,6 @@ namespace Ryujinx.HLE.OsHle return true; } - public void StopAllThreadsAsync() - { - if (Disposed) - { - throw new ObjectDisposedException(nameof(Process)); - } - - if (MainThread != null) - { - MainThread.Thread.StopExecution(); - } - - foreach (KThread Thread in Threads.Values) - { - Thread.Thread.StopExecution(); - } - } - public int MakeThread( long EntryPoint, long StackTop, @@ -215,18 +194,16 @@ namespace Ryujinx.HLE.OsHle AThread CpuThread = new AThread(GetTranslator(), Memory, EntryPoint); - KThread Thread = new KThread(CpuThread, this, ProcessorId, Priority); + long Tpidr = GetFreeTls(); + + int ThreadId = (int)((Tpidr - MemoryManager.TlsIoRegionStart) / 0x200) + 1; + + KThread Thread = new KThread(CpuThread, this, ProcessorId, Priority, ThreadId); Thread.LastPc = EntryPoint; int Handle = HandleTable.OpenHandle(Thread); - long Tpidr = GetFreeTls(); - - int ThreadId = (int)((Tpidr - MemoryManager.TlsIoRegionStart) / 0x200) + 1; - - CpuThread.ThreadState.ProcessId = ProcessId; - CpuThread.ThreadState.ThreadId = ThreadId; CpuThread.ThreadState.CntfrqEl0 = TickFreq; CpuThread.ThreadState.Tpidr = Tpidr; @@ -330,7 +307,7 @@ namespace Ryujinx.HLE.OsHle } } - Ns.Log.PrintDebug(LogClass.Cpu, $"Executing at 0x{e.Position:x16} {e.SubName} {NsoName}"); + Device.Log.PrintDebug(LogClass.Cpu, $"Executing at 0x{e.Position:x16} {e.SubName} {NsoName}"); } public void PrintStackTrace(AThreadState ThreadState) @@ -355,7 +332,7 @@ namespace Ryujinx.HLE.OsHle Trace.AppendLine(" " + SubName + " (" + GetNsoNameAndAddress(Position) + ")"); } - Ns.Log.PrintInfo(LogClass.Cpu, Trace.ToString()); + Device.Log.PrintInfo(LogClass.Cpu, Trace.ToString()); } private string GetNsoNameAndAddress(long Position) @@ -390,12 +367,7 @@ namespace Ryujinx.HLE.OsHle if (Threads.Count == 0) { - if (ShouldDispose) - { - Dispose(); - } - - Ns.Os.ExitProcess(ProcessId); + Device.System.ExitProcess(ProcessId); } } @@ -409,6 +381,35 @@ namespace Ryujinx.HLE.OsHle return Thread; } + private void Unload() + { + if (Disposed || Threads.Count > 0) + { + return; + } + + Disposed = true; + + foreach (object Obj in HandleTable.Clear()) + { + if (Obj is KSession Session) + { + Session.Dispose(); + } + } + + INvDrvServices.UnloadProcess(this); + + AppletState.Dispose(); + + if (NeedsHbAbi && Executables.Count > 0 && Executables[0].FilePath.EndsWith(Homebrew.TemporaryNroSuffix)) + { + File.Delete(Executables[0].FilePath); + } + + Device.Log.PrintInfo(LogClass.Loader, $"Process {ProcessId} exiting..."); + } + public void Dispose() { Dispose(true); @@ -416,41 +417,21 @@ namespace Ryujinx.HLE.OsHle protected virtual void Dispose(bool Disposing) { - if (Disposing && !Disposed) + if (Disposing) { - //If there is still some thread running, disposing the objects is not - //safe as the thread may try to access those resources. Instead, we set - //the flag to have the Process disposed when all threads finishes. - //Note: This may not happen if the guest code gets stuck on a infinite loop. if (Threads.Count > 0) { - ShouldDispose = true; - - Ns.Log.PrintInfo(LogClass.Loader, $"Process {ProcessId} waiting all threads terminate..."); - - return; - } - - Disposed = true; - - foreach (object Obj in HandleTable.Clear()) - { - if (Obj is KSession Session) + foreach (KThread Thread in Threads.Values) { - Session.Dispose(); + Thread.Thread.StopExecution(); + + Scheduler.ForceWakeUp(Thread); } } - - if (NeedsHbAbi && Executables.Count > 0 && Executables[0].FilePath.EndsWith(Homebrew.TemporaryNroSuffix)) + else { - File.Delete(Executables[0].FilePath); + Unload(); } - - INvDrvServices.UnloadProcess(this); - - AppletState.Dispose(); - - Ns.Log.PrintInfo(LogClass.Loader, $"Process {ProcessId} exiting..."); } } } diff --git a/Ryujinx.HLE/OsHle/ServiceCtx.cs b/Ryujinx.HLE/HOS/ServiceCtx.cs similarity index 83% rename from Ryujinx.HLE/OsHle/ServiceCtx.cs rename to Ryujinx.HLE/HOS/ServiceCtx.cs index eb9ff5fd88..d8c9fdf6ed 100644 --- a/Ryujinx.HLE/OsHle/ServiceCtx.cs +++ b/Ryujinx.HLE/HOS/ServiceCtx.cs @@ -1,13 +1,13 @@ using ChocolArm64.Memory; -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; using System.IO; -namespace Ryujinx.HLE.OsHle +namespace Ryujinx.HLE.HOS { class ServiceCtx { - public Switch Ns { get; private set; } + public Switch Device { get; private set; } public Process Process { get; private set; } public AMemory Memory { get; private set; } public KSession Session { get; private set; } @@ -17,7 +17,7 @@ namespace Ryujinx.HLE.OsHle public BinaryWriter ResponseData { get; private set; } public ServiceCtx( - Switch Ns, + Switch Device, Process Process, AMemory Memory, KSession Session, @@ -26,7 +26,7 @@ namespace Ryujinx.HLE.OsHle BinaryReader RequestData, BinaryWriter ResponseData) { - this.Ns = Ns; + this.Device = Device; this.Process = Process; this.Memory = Memory; this.Session = Session; diff --git a/Ryujinx.HLE/OsHle/Services/Acc/AccErr.cs b/Ryujinx.HLE/HOS/Services/Acc/AccErr.cs similarity index 67% rename from Ryujinx.HLE/OsHle/Services/Acc/AccErr.cs rename to Ryujinx.HLE/HOS/Services/Acc/AccErr.cs index 5daef1aa57..144d6680fa 100644 --- a/Ryujinx.HLE/OsHle/Services/Acc/AccErr.cs +++ b/Ryujinx.HLE/HOS/Services/Acc/AccErr.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Acc +namespace Ryujinx.HLE.HOS.Services.Acc { static class AccErr { diff --git a/Ryujinx.HLE/OsHle/Services/Acc/IAccountServiceForApplication.cs b/Ryujinx.HLE/HOS/Services/Acc/IAccountServiceForApplication.cs similarity index 78% rename from Ryujinx.HLE/OsHle/Services/Acc/IAccountServiceForApplication.cs rename to Ryujinx.HLE/HOS/Services/Acc/IAccountServiceForApplication.cs index 34376a7b58..36dfd9efa9 100644 --- a/Ryujinx.HLE/OsHle/Services/Acc/IAccountServiceForApplication.cs +++ b/Ryujinx.HLE/HOS/Services/Acc/IAccountServiceForApplication.cs @@ -1,12 +1,11 @@ -using ChocolArm64.Memory; +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.SystemState; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; -using Ryujinx.HLE.OsHle.SystemState; using System.Collections.Generic; -using static Ryujinx.HLE.OsHle.ErrorCode; +using static Ryujinx.HLE.HOS.ErrorCode; -namespace Ryujinx.HLE.OsHle.Services.Acc +namespace Ryujinx.HLE.HOS.Services.Acc { class IAccountServiceForApplication : IpcService { @@ -31,7 +30,7 @@ namespace Ryujinx.HLE.OsHle.Services.Acc public long GetUserCount(ServiceCtx Context) { - Context.ResponseData.Write(Context.Ns.Os.SystemState.GetUserCount()); + Context.ResponseData.Write(Context.Device.System.State.GetUserCount()); return 0; } @@ -42,19 +41,19 @@ namespace Ryujinx.HLE.OsHle.Services.Acc Context.RequestData.ReadInt64(), Context.RequestData.ReadInt64()); - Context.ResponseData.Write(Context.Ns.Os.SystemState.TryGetUser(Uuid, out _) ? 1 : 0); + Context.ResponseData.Write(Context.Device.System.State.TryGetUser(Uuid, out _) ? 1 : 0); return 0; } public long ListAllUsers(ServiceCtx Context) { - return WriteUserList(Context, Context.Ns.Os.SystemState.GetAllUsers()); + return WriteUserList(Context, Context.Device.System.State.GetAllUsers()); } public long ListOpenUsers(ServiceCtx Context) { - return WriteUserList(Context, Context.Ns.Os.SystemState.GetOpenUsers()); + return WriteUserList(Context, Context.Device.System.State.GetOpenUsers()); } private long WriteUserList(ServiceCtx Context, IEnumerable Profiles) @@ -84,7 +83,7 @@ namespace Ryujinx.HLE.OsHle.Services.Acc public long GetLastOpenedUser(ServiceCtx Context) { - UserProfile LastOpened = Context.Ns.Os.SystemState.LastOpenUser; + UserProfile LastOpened = Context.Device.System.State.LastOpenUser; LastOpened.Uuid.Write(Context.ResponseData); @@ -97,9 +96,9 @@ namespace Ryujinx.HLE.OsHle.Services.Acc Context.RequestData.ReadInt64(), Context.RequestData.ReadInt64()); - if (!Context.Ns.Os.SystemState.TryGetUser(Uuid, out UserProfile Profile)) + if (!Context.Device.System.State.TryGetUser(Uuid, out UserProfile Profile)) { - Context.Ns.Log.PrintWarning(LogClass.ServiceAcc, $"User 0x{Uuid} not found!"); + Context.Device.Log.PrintWarning(LogClass.ServiceAcc, $"User 0x{Uuid} not found!"); return MakeError(ErrorModule.Account, AccErr.UserNotFound); } @@ -111,7 +110,7 @@ namespace Ryujinx.HLE.OsHle.Services.Acc public long InitializeApplicationInfo(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceAcc, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAcc, "Stubbed."); return 0; } diff --git a/Ryujinx.HLE/OsHle/Services/Acc/IManagerForApplication.cs b/Ryujinx.HLE/HOS/Services/Acc/IManagerForApplication.cs similarity index 78% rename from Ryujinx.HLE/OsHle/Services/Acc/IManagerForApplication.cs rename to Ryujinx.HLE/HOS/Services/Acc/IManagerForApplication.cs index ce3865f485..813a1b17e5 100644 --- a/Ryujinx.HLE/OsHle/Services/Acc/IManagerForApplication.cs +++ b/Ryujinx.HLE/HOS/Services/Acc/IManagerForApplication.cs @@ -1,8 +1,8 @@ +using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Acc +namespace Ryujinx.HLE.HOS.Services.Acc { class IManagerForApplication : IpcService { @@ -21,14 +21,14 @@ namespace Ryujinx.HLE.OsHle.Services.Acc public long CheckAvailability(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceAcc, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAcc, "Stubbed."); return 0; } public long GetAccountId(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceAcc, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAcc, "Stubbed."); Context.ResponseData.Write(0xcafeL); diff --git a/Ryujinx.HLE/OsHle/Services/Acc/IProfile.cs b/Ryujinx.HLE/HOS/Services/Acc/IProfile.cs similarity index 86% rename from Ryujinx.HLE/OsHle/Services/Acc/IProfile.cs rename to Ryujinx.HLE/HOS/Services/Acc/IProfile.cs index bb1e885ebf..960cc49c01 100644 --- a/Ryujinx.HLE/OsHle/Services/Acc/IProfile.cs +++ b/Ryujinx.HLE/HOS/Services/Acc/IProfile.cs @@ -1,12 +1,12 @@ using ChocolArm64.Memory; +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.SystemState; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; -using Ryujinx.HLE.OsHle.SystemState; -using Ryujinx.HLE.OsHle.Utilities; +using Ryujinx.HLE.Utilities; using System.Collections.Generic; using System.Text; -namespace Ryujinx.HLE.OsHle.Services.Acc +namespace Ryujinx.HLE.HOS.Services.Acc { class IProfile : IpcService { @@ -29,7 +29,7 @@ namespace Ryujinx.HLE.OsHle.Services.Acc public long Get(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceAcc, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAcc, "Stubbed."); long Position = Context.Request.ReceiveBuff[0].Position; diff --git a/Ryujinx.HLE/OsHle/Services/Am/AmErr.cs b/Ryujinx.HLE/HOS/Services/Am/AmErr.cs similarity index 66% rename from Ryujinx.HLE/OsHle/Services/Am/AmErr.cs rename to Ryujinx.HLE/HOS/Services/Am/AmErr.cs index 6622463927..4e7771b809 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/AmErr.cs +++ b/Ryujinx.HLE/HOS/Services/Am/AmErr.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { static class AmErr { diff --git a/Ryujinx.HLE/OsHle/Services/Am/FocusState.cs b/Ryujinx.HLE/HOS/Services/Am/FocusState.cs similarity index 67% rename from Ryujinx.HLE/OsHle/Services/Am/FocusState.cs rename to Ryujinx.HLE/HOS/Services/Am/FocusState.cs index 074f159eb3..e8ae722369 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/FocusState.cs +++ b/Ryujinx.HLE/HOS/Services/Am/FocusState.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { enum FocusState { diff --git a/Ryujinx.HLE/OsHle/Services/Am/IAllSystemAppletProxiesService.cs b/Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs similarity index 90% rename from Ryujinx.HLE/OsHle/Services/Am/IAllSystemAppletProxiesService.cs rename to Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs index 8dc17cecf6..2d44526a25 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/IAllSystemAppletProxiesService.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { class IAllSystemAppletProxiesService : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Am/IApplicationCreator.cs b/Ryujinx.HLE/HOS/Services/Am/IApplicationCreator.cs similarity index 86% rename from Ryujinx.HLE/OsHle/Services/Am/IApplicationCreator.cs rename to Ryujinx.HLE/HOS/Services/Am/IApplicationCreator.cs index 6ee5b5c2e5..c5ed09f5ff 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/IApplicationCreator.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IApplicationCreator.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { class IApplicationCreator : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Am/IApplicationFunctions.cs b/Ryujinx.HLE/HOS/Services/Am/IApplicationFunctions.cs similarity index 83% rename from Ryujinx.HLE/OsHle/Services/Am/IApplicationFunctions.cs rename to Ryujinx.HLE/HOS/Services/Am/IApplicationFunctions.cs index e25b524abb..0a10d2a66c 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/IApplicationFunctions.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IApplicationFunctions.cs @@ -1,8 +1,8 @@ +using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { class IApplicationFunctions : IpcService { @@ -39,7 +39,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am long UIdLow = Context.RequestData.ReadInt64(); long UIdHigh = Context.RequestData.ReadInt64(); - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); Context.ResponseData.Write(0L); @@ -48,7 +48,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am public long GetDesiredLanguage(ServiceCtx Context) { - Context.ResponseData.Write(Context.Ns.Os.SystemState.DesiredLanguageCode); + Context.ResponseData.Write(Context.Device.System.State.DesiredLanguageCode); return 0; } @@ -59,7 +59,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am string Result = GetFormattedErrorCode(ErrorCode); - Context.Ns.Log.PrintInfo(LogClass.ServiceAm, $"Result = 0x{ErrorCode:x8} ({Result})."); + Context.Device.Log.PrintInfo(LogClass.ServiceAm, $"Result = 0x{ErrorCode:x8} ({Result})."); return 0; } @@ -90,7 +90,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am public long GetPseudoDeviceId(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); Context.ResponseData.Write(0L); Context.ResponseData.Write(0L); @@ -100,7 +100,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am public long InitializeGamePlayRecording(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } @@ -109,7 +109,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am { int State = Context.RequestData.ReadInt32(); - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } diff --git a/Ryujinx.HLE/OsHle/Services/Am/IApplicationProxy.cs b/Ryujinx.HLE/HOS/Services/Am/IApplicationProxy.cs similarity index 96% rename from Ryujinx.HLE/OsHle/Services/Am/IApplicationProxy.cs rename to Ryujinx.HLE/HOS/Services/Am/IApplicationProxy.cs index ec0285025b..4003f1515a 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/IApplicationProxy.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IApplicationProxy.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { class IApplicationProxy : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Am/IApplicationProxyService.cs b/Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs similarity index 90% rename from Ryujinx.HLE/OsHle/Services/Am/IApplicationProxyService.cs rename to Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs index 6b39b265db..fb518af93c 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/IApplicationProxyService.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { class IApplicationProxyService : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Am/IAudioController.cs b/Ryujinx.HLE/HOS/Services/Am/IAudioController.cs similarity index 79% rename from Ryujinx.HLE/OsHle/Services/Am/IAudioController.cs rename to Ryujinx.HLE/HOS/Services/Am/IAudioController.cs index 3cb6318169..8968ad72c3 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/IAudioController.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IAudioController.cs @@ -1,8 +1,8 @@ +using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { class IAudioController : IpcService { @@ -27,7 +27,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am float AppletVolume = Context.RequestData.ReadSingle(); float LibraryAppletVolume = Context.RequestData.ReadSingle(); - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } @@ -36,7 +36,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am { Context.ResponseData.Write(1f); - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } @@ -45,7 +45,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am { Context.ResponseData.Write(1f); - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } @@ -55,7 +55,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am float Unknown0 = Context.RequestData.ReadSingle(); long Unknown1 = Context.RequestData.ReadInt64(); - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } @@ -64,7 +64,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am { float Unknown0 = Context.RequestData.ReadSingle(); - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } diff --git a/Ryujinx.HLE/OsHle/Services/Am/ICommonStateGetter.cs b/Ryujinx.HLE/HOS/Services/Am/ICommonStateGetter.cs similarity index 87% rename from Ryujinx.HLE/OsHle/Services/Am/ICommonStateGetter.cs rename to Ryujinx.HLE/HOS/Services/Am/ICommonStateGetter.cs index 2d04151c65..3cdfbbdb95 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/ICommonStateGetter.cs +++ b/Ryujinx.HLE/HOS/Services/Am/ICommonStateGetter.cs @@ -1,11 +1,11 @@ +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Ipc; using System.Collections.Generic; -using static Ryujinx.HLE.OsHle.ErrorCode; +using static Ryujinx.HLE.HOS.ErrorCode; -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { class ICommonStateGetter : IpcService { @@ -57,7 +57,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am public long GetOperationMode(ServiceCtx Context) { - OperationMode Mode = Context.Ns.Os.SystemState.DockedMode + OperationMode Mode = Context.Device.System.State.DockedMode ? OperationMode.Docked : OperationMode.Handheld; @@ -68,7 +68,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am public long GetPerformanceMode(ServiceCtx Context) { - Apm.PerformanceMode Mode = Context.Ns.Os.SystemState.DockedMode + Apm.PerformanceMode Mode = Context.Device.System.State.DockedMode ? Apm.PerformanceMode.Docked : Apm.PerformanceMode.Handheld; @@ -81,7 +81,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am { Context.ResponseData.Write((byte)0); //Unknown value. - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } @@ -107,7 +107,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } diff --git a/Ryujinx.HLE/OsHle/Services/Am/IDebugFunctions.cs b/Ryujinx.HLE/HOS/Services/Am/IDebugFunctions.cs similarity index 86% rename from Ryujinx.HLE/OsHle/Services/Am/IDebugFunctions.cs rename to Ryujinx.HLE/HOS/Services/Am/IDebugFunctions.cs index b07c68dd84..d86743c08d 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/IDebugFunctions.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IDebugFunctions.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { class IDebugFunctions : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Am/IDisplayController.cs b/Ryujinx.HLE/HOS/Services/Am/IDisplayController.cs similarity index 86% rename from Ryujinx.HLE/OsHle/Services/Am/IDisplayController.cs rename to Ryujinx.HLE/HOS/Services/Am/IDisplayController.cs index 8785f07199..c4d495793d 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/IDisplayController.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IDisplayController.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { class IDisplayController : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Am/IGlobalStateController.cs b/Ryujinx.HLE/HOS/Services/Am/IGlobalStateController.cs similarity index 86% rename from Ryujinx.HLE/OsHle/Services/Am/IGlobalStateController.cs rename to Ryujinx.HLE/HOS/Services/Am/IGlobalStateController.cs index 0fbcb28407..e646327fed 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/IGlobalStateController.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IGlobalStateController.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { class IGlobalStateController : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Am/IHomeMenuFunctions.cs b/Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs similarity index 81% rename from Ryujinx.HLE/OsHle/Services/Am/IHomeMenuFunctions.cs rename to Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs index 1005fe0c5e..95028ca047 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/IHomeMenuFunctions.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs @@ -1,9 +1,9 @@ +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { class IHomeMenuFunctions : IpcService { @@ -27,7 +27,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am public long RequestToGetForeground(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } @@ -38,7 +38,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } diff --git a/Ryujinx.HLE/OsHle/Services/Am/ILibraryAppletAccessor.cs b/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletAccessor.cs similarity index 78% rename from Ryujinx.HLE/OsHle/Services/Am/ILibraryAppletAccessor.cs rename to Ryujinx.HLE/HOS/Services/Am/ILibraryAppletAccessor.cs index b1955cc6d6..e099ec64a7 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/ILibraryAppletAccessor.cs +++ b/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletAccessor.cs @@ -1,9 +1,9 @@ -using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; +using Ryujinx.HLE.Logging; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { class ILibraryAppletAccessor : IpcService { @@ -35,28 +35,28 @@ namespace Ryujinx.HLE.OsHle.Services.Am Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } public long Start(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } public long GetResult(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } public long PushInData(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } diff --git a/Ryujinx.HLE/OsHle/Services/Am/ILibraryAppletCreator.cs b/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletCreator.cs similarity index 92% rename from Ryujinx.HLE/OsHle/Services/Am/ILibraryAppletCreator.cs rename to Ryujinx.HLE/HOS/Services/Am/ILibraryAppletCreator.cs index 66973fc6ce..065574c784 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/ILibraryAppletCreator.cs +++ b/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletCreator.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { class ILibraryAppletCreator : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Am/ISelfController.cs b/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs similarity index 78% rename from Ryujinx.HLE/OsHle/Services/Am/ISelfController.cs rename to Ryujinx.HLE/HOS/Services/Am/ISelfController.cs index 9b3dded2cc..ccd96e0d2d 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/ISelfController.cs +++ b/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs @@ -1,9 +1,9 @@ +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { class ISelfController : IpcService { @@ -36,22 +36,22 @@ namespace Ryujinx.HLE.OsHle.Services.Am public long Exit(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); - + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + return 0; } public long LockExit(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); - + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + return 0; } public long UnlockExit(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); - + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + return 0; } @@ -63,7 +63,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } @@ -72,7 +72,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am { bool Enable = Context.RequestData.ReadByte() != 0 ? true : false; - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } @@ -81,7 +81,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am { bool Enable = Context.RequestData.ReadByte() != 0 ? true : false; - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } @@ -90,7 +90,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am { bool Enable = Context.RequestData.ReadByte() != 0 ? true : false; - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } @@ -101,7 +101,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am bool Flag2 = Context.RequestData.ReadByte() != 0 ? true : false; bool Flag3 = Context.RequestData.ReadByte() != 0 ? true : false; - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } @@ -110,7 +110,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am { bool Enable = Context.RequestData.ReadByte() != 0 ? true : false; - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } @@ -119,7 +119,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am { bool Enable = Context.RequestData.ReadByte() != 0 ? true : false; - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } @@ -127,8 +127,8 @@ namespace Ryujinx.HLE.OsHle.Services.Am public long SetScreenShotImageOrientation(ServiceCtx Context) { int Orientation = Context.RequestData.ReadInt32(); - - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } @@ -137,7 +137,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am { bool Enable = Context.RequestData.ReadByte() != 0 ? true : false; - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } diff --git a/Ryujinx.HLE/OsHle/Services/Am/IStorage.cs b/Ryujinx.HLE/HOS/Services/Am/IStorage.cs similarity index 90% rename from Ryujinx.HLE/OsHle/Services/Am/IStorage.cs rename to Ryujinx.HLE/HOS/Services/Am/IStorage.cs index 0aa1f571be..10778122c6 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/IStorage.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IStorage.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { class IStorage : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Am/IStorageAccessor.cs b/Ryujinx.HLE/HOS/Services/Am/IStorageAccessor.cs similarity index 96% rename from Ryujinx.HLE/OsHle/Services/Am/IStorageAccessor.cs rename to Ryujinx.HLE/HOS/Services/Am/IStorageAccessor.cs index c2a8c11e23..a60cf1494f 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/IStorageAccessor.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IStorageAccessor.cs @@ -1,8 +1,8 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { class IStorageAccessor : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Am/ISystemAppletProxy.cs b/Ryujinx.HLE/HOS/Services/Am/ISystemAppletProxy.cs similarity index 97% rename from Ryujinx.HLE/OsHle/Services/Am/ISystemAppletProxy.cs rename to Ryujinx.HLE/HOS/Services/Am/ISystemAppletProxy.cs index e0d78e34a6..c08d401802 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/ISystemAppletProxy.cs +++ b/Ryujinx.HLE/HOS/Services/Am/ISystemAppletProxy.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { class ISystemAppletProxy : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Am/IWindowController.cs b/Ryujinx.HLE/HOS/Services/Am/IWindowController.cs similarity index 78% rename from Ryujinx.HLE/OsHle/Services/Am/IWindowController.cs rename to Ryujinx.HLE/HOS/Services/Am/IWindowController.cs index d9ab5db3c5..1a5a716f9a 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/IWindowController.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IWindowController.cs @@ -1,8 +1,8 @@ +using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { class IWindowController : IpcService { @@ -21,7 +21,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am public long GetAppletResourceUserId(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); Context.ResponseData.Write(0L); @@ -30,7 +30,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am public long AcquireForegroundRights(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return 0; } diff --git a/Ryujinx.HLE/OsHle/Services/Am/MessageInfo.cs b/Ryujinx.HLE/HOS/Services/Am/MessageInfo.cs similarity index 79% rename from Ryujinx.HLE/OsHle/Services/Am/MessageInfo.cs rename to Ryujinx.HLE/HOS/Services/Am/MessageInfo.cs index bae985fbaf..65fddbedc2 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/MessageInfo.cs +++ b/Ryujinx.HLE/HOS/Services/Am/MessageInfo.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { enum MessageInfo { diff --git a/Ryujinx.HLE/OsHle/Services/Am/OperationMode.cs b/Ryujinx.HLE/HOS/Services/Am/OperationMode.cs similarity index 66% rename from Ryujinx.HLE/OsHle/Services/Am/OperationMode.cs rename to Ryujinx.HLE/HOS/Services/Am/OperationMode.cs index 632ce9316c..cb11fff97d 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/OperationMode.cs +++ b/Ryujinx.HLE/HOS/Services/Am/OperationMode.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { enum OperationMode { diff --git a/Ryujinx.HLE/OsHle/Services/Am/StorageHelper.cs b/Ryujinx.HLE/HOS/Services/Am/StorageHelper.cs similarity index 94% rename from Ryujinx.HLE/OsHle/Services/Am/StorageHelper.cs rename to Ryujinx.HLE/HOS/Services/Am/StorageHelper.cs index 56e2a6529e..b97ffc1ec9 100644 --- a/Ryujinx.HLE/OsHle/Services/Am/StorageHelper.cs +++ b/Ryujinx.HLE/HOS/Services/Am/StorageHelper.cs @@ -1,6 +1,6 @@ using System.IO; -namespace Ryujinx.HLE.OsHle.Services.Am +namespace Ryujinx.HLE.HOS.Services.Am { class StorageHelper { diff --git a/Ryujinx.HLE/OsHle/Services/Apm/IManager.cs b/Ryujinx.HLE/HOS/Services/Apm/IManager.cs similarity index 89% rename from Ryujinx.HLE/OsHle/Services/Apm/IManager.cs rename to Ryujinx.HLE/HOS/Services/Apm/IManager.cs index 22150d6e0a..50822def63 100644 --- a/Ryujinx.HLE/OsHle/Services/Apm/IManager.cs +++ b/Ryujinx.HLE/HOS/Services/Apm/IManager.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Apm +namespace Ryujinx.HLE.HOS.Services.Apm { class IManager : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Apm/ISession.cs b/Ryujinx.HLE/HOS/Services/Apm/ISession.cs similarity index 89% rename from Ryujinx.HLE/OsHle/Services/Apm/ISession.cs rename to Ryujinx.HLE/HOS/Services/Apm/ISession.cs index 3c9bf07c4d..739e264d58 100644 --- a/Ryujinx.HLE/OsHle/Services/Apm/ISession.cs +++ b/Ryujinx.HLE/HOS/Services/Apm/ISession.cs @@ -1,8 +1,8 @@ +using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Apm +namespace Ryujinx.HLE.HOS.Services.Apm { class ISession : IpcService { @@ -33,7 +33,7 @@ namespace Ryujinx.HLE.OsHle.Services.Apm Context.ResponseData.Write((uint)PerformanceConfiguration.PerformanceConfiguration1); - Context.Ns.Log.PrintStub(LogClass.ServiceApm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceApm, "Stubbed."); return 0; } diff --git a/Ryujinx.HLE/OsHle/Services/Apm/PerformanceConfiguration.cs b/Ryujinx.HLE/HOS/Services/Apm/PerformanceConfiguration.cs similarity index 93% rename from Ryujinx.HLE/OsHle/Services/Apm/PerformanceConfiguration.cs rename to Ryujinx.HLE/HOS/Services/Apm/PerformanceConfiguration.cs index 07d59285b1..b24adfb361 100644 --- a/Ryujinx.HLE/OsHle/Services/Apm/PerformanceConfiguration.cs +++ b/Ryujinx.HLE/HOS/Services/Apm/PerformanceConfiguration.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Apm +namespace Ryujinx.HLE.HOS.Services.Apm { enum PerformanceConfiguration : uint { diff --git a/Ryujinx.HLE/OsHle/Services/Apm/PerformanceMode.cs b/Ryujinx.HLE/HOS/Services/Apm/PerformanceMode.cs similarity index 65% rename from Ryujinx.HLE/OsHle/Services/Apm/PerformanceMode.cs rename to Ryujinx.HLE/HOS/Services/Apm/PerformanceMode.cs index d89e27607e..c4ab3cf2d2 100644 --- a/Ryujinx.HLE/OsHle/Services/Apm/PerformanceMode.cs +++ b/Ryujinx.HLE/HOS/Services/Apm/PerformanceMode.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Apm +namespace Ryujinx.HLE.HOS.Services.Apm { enum PerformanceMode { diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudErr.cs b/Ryujinx.HLE/HOS/Services/Aud/AudErr.cs similarity index 82% rename from Ryujinx.HLE/OsHle/Services/Aud/AudErr.cs rename to Ryujinx.HLE/HOS/Services/Aud/AudErr.cs index 72c3e65eb9..cecea86057 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudErr.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudErr.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Aud +namespace Ryujinx.HLE.HOS.Services.Aud { static class AudErr { diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudioOut/AudioOutData.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioOut/AudioOutData.cs similarity index 86% rename from Ryujinx.HLE/OsHle/Services/Aud/AudioOut/AudioOutData.cs rename to Ryujinx.HLE/HOS/Services/Aud/AudioOut/AudioOutData.cs index 6887a38bed..e25ebe6640 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudioOut/AudioOutData.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioOut/AudioOutData.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Ryujinx.HLE.OsHle.Services.Aud.AudioOut +namespace Ryujinx.HLE.HOS.Services.Aud.AudioOut { [StructLayout(LayoutKind.Sequential)] struct AudioOutData diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudioOut/IAudioOut.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioOut/IAudioOut.cs similarity index 97% rename from Ryujinx.HLE/OsHle/Services/Aud/AudioOut/IAudioOut.cs rename to Ryujinx.HLE/HOS/Services/Aud/AudioOut/IAudioOut.cs index d89fc293af..81561f046f 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudioOut/IAudioOut.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioOut/IAudioOut.cs @@ -1,11 +1,11 @@ using ChocolArm64.Memory; using Ryujinx.Audio; -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; using System; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Aud.AudioOut +namespace Ryujinx.HLE.HOS.Services.Aud.AudioOut { class IAudioOut : IpcService, IDisposable { diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/AudioConsts.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/AudioConsts.cs similarity index 72% rename from Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/AudioConsts.cs rename to Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/AudioConsts.cs index fed41959d7..773ef6dd66 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/AudioConsts.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/AudioConsts.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer +namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { static class AudioConsts { diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/BehaviorIn.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/BehaviorIn.cs similarity index 78% rename from Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/BehaviorIn.cs rename to Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/BehaviorIn.cs index 4e33de6214..69b6d52247 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/BehaviorIn.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/BehaviorIn.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer +namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { [StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)] struct BehaviorIn diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/BiquadFilter.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/BiquadFilter.cs similarity index 85% rename from Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/BiquadFilter.cs rename to Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/BiquadFilter.cs index 9fa4cd3303..51dddf20e5 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/BiquadFilter.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/BiquadFilter.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer +namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { [StructLayout(LayoutKind.Sequential, Size = 0xc, Pack = 1)] struct BiquadFilter diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/IAudioRenderer.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs similarity index 96% rename from Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/IAudioRenderer.cs rename to Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs index f91a8da37e..8c83338d1d 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/IAudioRenderer.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs @@ -1,15 +1,15 @@ using ChocolArm64.Memory; using Ryujinx.Audio; using Ryujinx.Audio.Adpcm; +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Ipc; -using Ryujinx.HLE.OsHle.Utilities; +using Ryujinx.HLE.Utilities; using System; using System.Collections.Generic; using System.Runtime.InteropServices; -namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer +namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { class IAudioRenderer : IpcService, IDisposable { @@ -200,14 +200,14 @@ namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer public long StartAudioRenderer(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); return 0; } public long StopAudioRenderer(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); return 0; } @@ -309,6 +309,8 @@ namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer { if (Disposing) { + AudioOut.CloseTrack(Track); + UpdateEvent.Dispose(); } } diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/MemoryPoolContext.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolContext.cs similarity index 78% rename from Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/MemoryPoolContext.cs rename to Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolContext.cs index b7af1d3f82..2b68c40d52 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/MemoryPoolContext.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolContext.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer +namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { class MemoryPoolContext { diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/MemoryPoolIn.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolIn.cs similarity index 86% rename from Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/MemoryPoolIn.cs rename to Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolIn.cs index c852b5198a..f6e424ee6f 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/MemoryPoolIn.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolIn.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer +namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { [StructLayout(LayoutKind.Sequential, Size = 0x20, Pack = 4)] struct MemoryPoolIn diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/MemoryPoolOut.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolOut.cs similarity index 82% rename from Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/MemoryPoolOut.cs rename to Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolOut.cs index dd65df8641..f0621e3e6f 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/MemoryPoolOut.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolOut.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer +namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { [StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)] struct MemoryPoolOut diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/MemoryPoolState.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolState.cs similarity index 80% rename from Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/MemoryPoolState.cs rename to Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolState.cs index f96a0c09d7..6baf507c01 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/MemoryPoolState.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/MemoryPoolState.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer +namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { enum MemoryPoolState : int { diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/PlayState.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/PlayState.cs similarity index 65% rename from Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/PlayState.cs rename to Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/PlayState.cs index e8bcf64f3f..f09bf46e2e 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/PlayState.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/PlayState.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer +namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { enum PlayState : byte { diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/Resampler.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/Resampler.cs similarity index 99% rename from Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/Resampler.cs rename to Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/Resampler.cs index 31e0ebecd9..baa0bc6245 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/Resampler.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/Resampler.cs @@ -1,6 +1,6 @@ using System; -namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer +namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { static class Resampler { diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/UpdateDataHeader.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/UpdateDataHeader.cs similarity index 90% rename from Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/UpdateDataHeader.cs rename to Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/UpdateDataHeader.cs index a6dfbc0bce..a71e865d20 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/UpdateDataHeader.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/UpdateDataHeader.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer +namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { struct UpdateDataHeader { diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/VoiceChannelResourceIn.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceChannelResourceIn.cs similarity index 75% rename from Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/VoiceChannelResourceIn.cs rename to Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceChannelResourceIn.cs index 0916b03e2e..2a6f424f99 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/VoiceChannelResourceIn.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceChannelResourceIn.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer +namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { [StructLayout(LayoutKind.Sequential, Size = 0x70, Pack = 1)] struct VoiceChannelResourceIn diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/VoiceContext.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceContext.cs similarity index 98% rename from Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/VoiceContext.cs rename to Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceContext.cs index 1bf9ed73e8..bee574ff85 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/VoiceContext.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceContext.cs @@ -2,7 +2,7 @@ using ChocolArm64.Memory; using Ryujinx.Audio.Adpcm; using System; -namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer +namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { class VoiceContext { diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/VoiceIn.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceIn.cs similarity index 94% rename from Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/VoiceIn.cs rename to Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceIn.cs index 790affb20e..fc83b65b59 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/VoiceIn.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceIn.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer +namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { [StructLayout(LayoutKind.Sequential, Size = 0x170, Pack = 1)] struct VoiceIn diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/VoiceOut.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceOut.cs similarity index 82% rename from Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/VoiceOut.cs rename to Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceOut.cs index 1fcf929f27..6551acdb52 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/VoiceOut.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceOut.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer +namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { [StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)] struct VoiceOut diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/WaveBuffer.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/WaveBuffer.cs similarity index 90% rename from Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/WaveBuffer.cs rename to Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/WaveBuffer.cs index 6b56b9081a..bb188877e6 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudioRenderer/WaveBuffer.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/WaveBuffer.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer +namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { [StructLayout(LayoutKind.Sequential, Size = 0x38, Pack = 1)] struct WaveBuffer diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudioRendererParameter.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRendererParameter.cs similarity index 93% rename from Ryujinx.HLE/OsHle/Services/Aud/AudioRendererParameter.cs rename to Ryujinx.HLE/HOS/Services/Aud/AudioRendererParameter.cs index d7e1df01ac..4d01a0de3c 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudioRendererParameter.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRendererParameter.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Ryujinx.HLE.OsHle.Services.Aud +namespace Ryujinx.HLE.HOS.Services.Aud { [StructLayout(LayoutKind.Sequential)] struct AudioRendererParameter diff --git a/Ryujinx.HLE/OsHle/Services/Aud/IAudioDevice.cs b/Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs similarity index 83% rename from Ryujinx.HLE/OsHle/Services/Aud/IAudioDevice.cs rename to Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs index cc5fc244cf..2e6056efb4 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/IAudioDevice.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs @@ -1,11 +1,11 @@ +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; +using Ryujinx.HLE.HOS.SystemState; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Ipc; -using Ryujinx.HLE.OsHle.SystemState; using System.Collections.Generic; using System.Text; -namespace Ryujinx.HLE.OsHle.Services.Aud +namespace Ryujinx.HLE.HOS.Services.Aud { class IAudioDevice : IpcService { @@ -55,7 +55,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud if ((Position - BasePosition) + Buffer.Length > Size) { - Context.Ns.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {Size} too small!"); + Context.Device.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {Size} too small!"); break; } @@ -79,14 +79,14 @@ namespace Ryujinx.HLE.OsHle.Services.Aud string DeviceName = Encoding.ASCII.GetString(DeviceNameBuffer); - Context.Ns.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); return 0; } public long GetActiveAudioDeviceName(ServiceCtx Context) { - string Name = Context.Ns.Os.SystemState.ActiveAudioOutput; + string Name = Context.Device.System.State.ActiveAudioOutput; long Position = Context.Request.ReceiveBuff[0].Position; long Size = Context.Request.ReceiveBuff[0].Size; @@ -99,7 +99,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud } else { - Context.Ns.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {Size} too small!"); + Context.Device.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {Size} too small!"); } return 0; @@ -111,7 +111,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); - Context.Ns.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); return 0; } @@ -120,7 +120,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud { Context.ResponseData.Write(2); - Context.Ns.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); return 0; } @@ -141,7 +141,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud if ((Position - BasePosition) + Buffer.Length > Size) { - Context.Ns.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {Size} too small!"); + Context.Device.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {Size} too small!"); break; } @@ -164,7 +164,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud string DeviceName = Encoding.UTF8.GetString(DeviceNameBuffer); - Context.Ns.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); return 0; } @@ -173,14 +173,14 @@ namespace Ryujinx.HLE.OsHle.Services.Aud { Context.ResponseData.Write(1f); - Context.Ns.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); return 0; } public long GetActiveAudioDeviceNameAuto(ServiceCtx Context) { - string Name = Context.Ns.Os.SystemState.ActiveAudioOutput; + string Name = Context.Device.System.State.ActiveAudioOutput; (long Position, long Size) = Context.Request.GetBufferType0x22(); @@ -192,7 +192,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud } else { - Context.Ns.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {Size} too small!"); + Context.Device.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {Size} too small!"); } return 0; @@ -204,7 +204,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); - Context.Ns.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); return 0; } @@ -215,7 +215,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); - Context.Ns.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); return 0; } diff --git a/Ryujinx.HLE/OsHle/Services/Aud/IAudioOutManager.cs b/Ryujinx.HLE/HOS/Services/Aud/IAudioOutManager.cs similarity index 87% rename from Ryujinx.HLE/OsHle/Services/Aud/IAudioOutManager.cs rename to Ryujinx.HLE/HOS/Services/Aud/IAudioOutManager.cs index 7a3bc4d4fa..8d2435b083 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/IAudioOutManager.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/IAudioOutManager.cs @@ -1,15 +1,15 @@ using ChocolArm64.Memory; using Ryujinx.Audio; +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; +using Ryujinx.HLE.HOS.Services.Aud.AudioOut; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Ipc; -using Ryujinx.HLE.OsHle.Services.Aud.AudioOut; using System.Collections.Generic; using System.Text; -using static Ryujinx.HLE.OsHle.ErrorCode; +using static Ryujinx.HLE.HOS.ErrorCode; -namespace Ryujinx.HLE.OsHle.Services.Aud +namespace Ryujinx.HLE.HOS.Services.Aud { class IAudioOutManager : IpcService { @@ -86,7 +86,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud } else { - Context.Ns.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {Size} too small!"); + Context.Device.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {Size} too small!"); } Context.ResponseData.Write(NameCount); @@ -108,7 +108,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud if (DeviceName != DefaultAudioOutput) { - Context.Ns.Log.PrintWarning(LogClass.Audio, "Invalid device name!"); + Context.Device.Log.PrintWarning(LogClass.Audio, "Invalid device name!"); return MakeError(ErrorModule.Audio, AudErr.DeviceNotFound); } @@ -121,7 +121,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud } else { - Context.Ns.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {ReceiveSize} too small!"); + Context.Device.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {ReceiveSize} too small!"); } int SampleRate = Context.RequestData.ReadInt32(); @@ -134,7 +134,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud if (SampleRate != DefaultSampleRate) { - Context.Ns.Log.PrintWarning(LogClass.Audio, "Invalid sample rate!"); + Context.Device.Log.PrintWarning(LogClass.Audio, "Invalid sample rate!"); return MakeError(ErrorModule.Audio, AudErr.UnsupportedSampleRate); } @@ -153,7 +153,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud ReleaseEvent.WaitEvent.Set(); }; - IAalOutput AudioOut = Context.Ns.AudioOut; + IAalOutput AudioOut = Context.Device.AudioOut; int Track = AudioOut.OpenTrack(SampleRate, Channels, Callback); diff --git a/Ryujinx.HLE/OsHle/Services/Aud/IAudioRendererManager.cs b/Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs similarity index 92% rename from Ryujinx.HLE/OsHle/Services/Aud/IAudioRendererManager.cs rename to Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs index 5e2dec9f2e..faa422901b 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/IAudioRendererManager.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs @@ -1,13 +1,13 @@ using Ryujinx.Audio; +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Services.Aud.AudioRenderer; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; -using Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer; -using Ryujinx.HLE.OsHle.Utilities; +using Ryujinx.HLE.Utilities; using System.Collections.Generic; -using static Ryujinx.HLE.OsHle.ErrorCode; +using static Ryujinx.HLE.HOS.ErrorCode; -namespace Ryujinx.HLE.OsHle.Services.Aud +namespace Ryujinx.HLE.HOS.Services.Aud { class IAudioRendererManager : IpcService { @@ -36,7 +36,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud public long OpenAudioRenderer(ServiceCtx Context) { - IAalOutput AudioOut = Context.Ns.AudioOut; + IAalOutput AudioOut = Context.Device.AudioOut; AudioRendererParameter Params = GetAudioRendererParameter(Context); @@ -98,7 +98,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud Context.ResponseData.Write(Size); - Context.Ns.Log.PrintDebug(LogClass.ServiceAudio, $"WorkBufferSize is 0x{Size:x16}."); + Context.Device.Log.PrintDebug(LogClass.ServiceAudio, $"WorkBufferSize is 0x{Size:x16}."); return 0; } @@ -106,7 +106,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud { Context.ResponseData.Write(0L); - Context.Ns.Log.PrintWarning(LogClass.ServiceAudio, $"Library Revision 0x{Params.Revision:x8} is not supported!"); + Context.Device.Log.PrintWarning(LogClass.ServiceAudio, $"Library Revision 0x{Params.Revision:x8} is not supported!"); return MakeError(ErrorModule.Audio, AudErr.UnsupportedRevision); } diff --git a/Ryujinx.HLE/OsHle/Services/Aud/SampleFormat.cs b/Ryujinx.HLE/HOS/Services/Aud/SampleFormat.cs similarity index 82% rename from Ryujinx.HLE/OsHle/Services/Aud/SampleFormat.cs rename to Ryujinx.HLE/HOS/Services/Aud/SampleFormat.cs index 06ab492996..8da8038178 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/SampleFormat.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/SampleFormat.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Aud +namespace Ryujinx.HLE.HOS.Services.Aud { enum SampleFormat : byte { diff --git a/Ryujinx.HLE/OsHle/Services/Bcat/IBcatService.cs b/Ryujinx.HLE/HOS/Services/Bcat/IBcatService.cs similarity index 85% rename from Ryujinx.HLE/OsHle/Services/Bcat/IBcatService.cs rename to Ryujinx.HLE/HOS/Services/Bcat/IBcatService.cs index b7754d6b63..6263dfa815 100644 --- a/Ryujinx.HLE/OsHle/Services/Bcat/IBcatService.cs +++ b/Ryujinx.HLE/HOS/Services/Bcat/IBcatService.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Bcat +namespace Ryujinx.HLE.HOS.Services.Bcat { class IBcatService : IpcService { @@ -16,6 +16,6 @@ namespace Ryujinx.HLE.OsHle.Services.Bcat //... }; } - + } } diff --git a/Ryujinx.HLE/OsHle/Services/Bcat/IDeliveryCacheStorageService.cs b/Ryujinx.HLE/HOS/Services/Bcat/IDeliveryCacheStorageService.cs similarity index 86% rename from Ryujinx.HLE/OsHle/Services/Bcat/IDeliveryCacheStorageService.cs rename to Ryujinx.HLE/HOS/Services/Bcat/IDeliveryCacheStorageService.cs index 0b84d809e4..7a55c6c896 100644 --- a/Ryujinx.HLE/OsHle/Services/Bcat/IDeliveryCacheStorageService.cs +++ b/Ryujinx.HLE/HOS/Services/Bcat/IDeliveryCacheStorageService.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Bcat +namespace Ryujinx.HLE.HOS.Services.Bcat { class IDeliveryCacheStorageService : IpcService { @@ -16,6 +16,6 @@ namespace Ryujinx.HLE.OsHle.Services.Bcat //... }; } - + } } diff --git a/Ryujinx.HLE/OsHle/Services/Bcat/IServiceCreator.cs b/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs similarity index 93% rename from Ryujinx.HLE/OsHle/Services/Bcat/IServiceCreator.cs rename to Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs index cc1fc6f8c8..55583c9408 100644 --- a/Ryujinx.HLE/OsHle/Services/Bcat/IServiceCreator.cs +++ b/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Bcat +namespace Ryujinx.HLE.HOS.Services.Bcat { class IServiceCreator : IpcService { @@ -23,7 +23,7 @@ namespace Ryujinx.HLE.OsHle.Services.Bcat long Id = Context.RequestData.ReadInt64(); MakeObject(Context, new IBcatService()); - + return 0; } diff --git a/Ryujinx.HLE/OsHle/Services/Bsd/BsdError.cs b/Ryujinx.HLE/HOS/Services/Bsd/BsdError.cs similarity index 57% rename from Ryujinx.HLE/OsHle/Services/Bsd/BsdError.cs rename to Ryujinx.HLE/HOS/Services/Bsd/BsdError.cs index 114130dcf5..675edcc3dd 100644 --- a/Ryujinx.HLE/OsHle/Services/Bsd/BsdError.cs +++ b/Ryujinx.HLE/HOS/Services/Bsd/BsdError.cs @@ -1,7 +1,7 @@ -namespace Ryujinx.HLE.OsHle.Services.Bsd +namespace Ryujinx.HLE.HOS.Services.Bsd { //bsd_errno == (SocketException.ErrorCode - 10000) - public enum BsdError + enum BsdError { Timeout = 60 } diff --git a/Ryujinx.HLE/OsHle/Services/Bsd/BsdSocket.cs b/Ryujinx.HLE/HOS/Services/Bsd/BsdSocket.cs similarity index 86% rename from Ryujinx.HLE/OsHle/Services/Bsd/BsdSocket.cs rename to Ryujinx.HLE/HOS/Services/Bsd/BsdSocket.cs index 9cde99478c..2361ed31b7 100644 --- a/Ryujinx.HLE/OsHle/Services/Bsd/BsdSocket.cs +++ b/Ryujinx.HLE/HOS/Services/Bsd/BsdSocket.cs @@ -1,7 +1,7 @@ using System.Net; using System.Net.Sockets; -namespace Ryujinx.HLE.OsHle.Services.Bsd +namespace Ryujinx.HLE.HOS.Services.Bsd { class BsdSocket { diff --git a/Ryujinx.HLE/OsHle/Services/Bsd/IClient.cs b/Ryujinx.HLE/HOS/Services/Bsd/IClient.cs similarity index 99% rename from Ryujinx.HLE/OsHle/Services/Bsd/IClient.cs rename to Ryujinx.HLE/HOS/Services/Bsd/IClient.cs index 15ce92a163..b5a457db56 100644 --- a/Ryujinx.HLE/OsHle/Services/Bsd/IClient.cs +++ b/Ryujinx.HLE/HOS/Services/Bsd/IClient.cs @@ -1,12 +1,12 @@ -using Ryujinx.HLE.OsHle.Ipc; -using Ryujinx.HLE.OsHle.Utilities; +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.Utilities; using System.Collections.Generic; using System.IO; using System.Net; using System.Net.Sockets; using System.Threading.Tasks; -namespace Ryujinx.HLE.OsHle.Services.Bsd +namespace Ryujinx.HLE.HOS.Services.Bsd { class IClient : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Caps/IAlbumAccessorService.cs b/Ryujinx.HLE/HOS/Services/Caps/IAlbumAccessorService.cs similarity index 86% rename from Ryujinx.HLE/OsHle/Services/Caps/IAlbumAccessorService.cs rename to Ryujinx.HLE/HOS/Services/Caps/IAlbumAccessorService.cs index 04a81f903a..6d96b769bc 100644 --- a/Ryujinx.HLE/OsHle/Services/Caps/IAlbumAccessorService.cs +++ b/Ryujinx.HLE/HOS/Services/Caps/IAlbumAccessorService.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Caps +namespace Ryujinx.HLE.HOS.Services.Caps { class IAlbumAccessorService : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Caps/IScreenshotService.cs b/Ryujinx.HLE/HOS/Services/Caps/IScreenshotService.cs similarity index 85% rename from Ryujinx.HLE/OsHle/Services/Caps/IScreenshotService.cs rename to Ryujinx.HLE/HOS/Services/Caps/IScreenshotService.cs index 9b1005edc2..5a54d56397 100644 --- a/Ryujinx.HLE/OsHle/Services/Caps/IScreenshotService.cs +++ b/Ryujinx.HLE/HOS/Services/Caps/IScreenshotService.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Caps +namespace Ryujinx.HLE.HOS.Services.Caps { class IScreenshotService : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Friend/IFriendService.cs b/Ryujinx.HLE/HOS/Services/Friend/IFriendService.cs similarity index 81% rename from Ryujinx.HLE/OsHle/Services/Friend/IFriendService.cs rename to Ryujinx.HLE/HOS/Services/Friend/IFriendService.cs index e241138ffd..3b06ba8afc 100644 --- a/Ryujinx.HLE/OsHle/Services/Friend/IFriendService.cs +++ b/Ryujinx.HLE/HOS/Services/Friend/IFriendService.cs @@ -1,9 +1,9 @@ +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.SystemState; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; -using Ryujinx.HLE.OsHle.SystemState; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Friend +namespace Ryujinx.HLE.HOS.Services.Friend { class IFriendService : IpcService { @@ -26,7 +26,7 @@ namespace Ryujinx.HLE.OsHle.Services.Friend Context.RequestData.ReadInt64(), Context.RequestData.ReadInt64()); - if (Context.Ns.Os.SystemState.TryGetUser(Uuid, out UserProfile Profile)) + if (Context.Device.System.State.TryGetUser(Uuid, out UserProfile Profile)) { Profile.OnlinePlayState = OpenCloseState.Closed; } @@ -41,7 +41,7 @@ namespace Ryujinx.HLE.OsHle.Services.Friend Context.RequestData.ReadInt64()); //TODO. - Context.Ns.Log.PrintStub(LogClass.ServiceFriend, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceFriend, "Stubbed."); return 0; } diff --git a/Ryujinx.HLE/OsHle/Services/Friend/IServiceCreator.cs b/Ryujinx.HLE/HOS/Services/Friend/IServiceCreator.cs similarity index 89% rename from Ryujinx.HLE/OsHle/Services/Friend/IServiceCreator.cs rename to Ryujinx.HLE/HOS/Services/Friend/IServiceCreator.cs index 6b9a265f6c..065e230dc4 100644 --- a/Ryujinx.HLE/OsHle/Services/Friend/IServiceCreator.cs +++ b/Ryujinx.HLE/HOS/Services/Friend/IServiceCreator.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Friend +namespace Ryujinx.HLE.HOS.Services.Friend { class IServiceCreator : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/FspSrv/FsErr.cs b/Ryujinx.HLE/HOS/Services/FspSrv/FsErr.cs similarity index 80% rename from Ryujinx.HLE/OsHle/Services/FspSrv/FsErr.cs rename to Ryujinx.HLE/HOS/Services/FspSrv/FsErr.cs index bdc70959fa..39eadcec62 100644 --- a/Ryujinx.HLE/OsHle/Services/FspSrv/FsErr.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/FsErr.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.FspSrv +namespace Ryujinx.HLE.HOS.Services.FspSrv { static class FsErr { diff --git a/Ryujinx.HLE/OsHle/Services/FspSrv/IDirectory.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IDirectory.cs similarity index 97% rename from Ryujinx.HLE/OsHle/Services/FspSrv/IDirectory.cs rename to Ryujinx.HLE/HOS/Services/FspSrv/IDirectory.cs index bb4b7a030b..d6ae084f89 100644 --- a/Ryujinx.HLE/OsHle/Services/FspSrv/IDirectory.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/IDirectory.cs @@ -1,10 +1,10 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System; using System.Collections.Generic; using System.IO; using System.Text; -namespace Ryujinx.HLE.OsHle.Services.FspSrv +namespace Ryujinx.HLE.HOS.Services.FspSrv { class IDirectory : IpcService, IDisposable { diff --git a/Ryujinx.HLE/OsHle/Services/FspSrv/IFile.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs similarity index 97% rename from Ryujinx.HLE/OsHle/Services/FspSrv/IFile.cs rename to Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs index a610a3ab88..194d942090 100644 --- a/Ryujinx.HLE/OsHle/Services/FspSrv/IFile.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs @@ -1,9 +1,9 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System; using System.Collections.Generic; using System.IO; -namespace Ryujinx.HLE.OsHle.Services.FspSrv +namespace Ryujinx.HLE.HOS.Services.FspSrv { class IFile : IpcService, IDisposable { diff --git a/Ryujinx.HLE/OsHle/Services/FspSrv/IFileSystem.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs similarity index 89% rename from Ryujinx.HLE/OsHle/Services/FspSrv/IFileSystem.cs rename to Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs index 61c6d11507..b77043bddb 100644 --- a/Ryujinx.HLE/OsHle/Services/FspSrv/IFileSystem.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs @@ -1,12 +1,12 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System; using System.Collections.Generic; using System.IO; using System.Text; -using static Ryujinx.HLE.OsHle.ErrorCode; +using static Ryujinx.HLE.HOS.ErrorCode; -namespace Ryujinx.HLE.OsHle.Services.FspSrv +namespace Ryujinx.HLE.HOS.Services.FspSrv { class IFileSystem : IpcService { @@ -51,7 +51,7 @@ namespace Ryujinx.HLE.OsHle.Services.FspSrv long Mode = Context.RequestData.ReadInt64(); int Size = Context.RequestData.ReadInt32(); - string FileName = Context.Ns.VFs.GetFullPath(Path, Name); + string FileName = Context.Device.FileSystem.GetFullPath(Path, Name); if (FileName == null) { @@ -80,7 +80,7 @@ namespace Ryujinx.HLE.OsHle.Services.FspSrv { string Name = ReadUtf8String(Context); - string FileName = Context.Ns.VFs.GetFullPath(Path, Name); + string FileName = Context.Device.FileSystem.GetFullPath(Path, Name); if (!File.Exists(FileName)) { @@ -101,7 +101,7 @@ namespace Ryujinx.HLE.OsHle.Services.FspSrv { string Name = ReadUtf8String(Context); - string DirName = Context.Ns.VFs.GetFullPath(Path, Name); + string DirName = Context.Device.FileSystem.GetFullPath(Path, Name); if (DirName == null) { @@ -137,7 +137,7 @@ namespace Ryujinx.HLE.OsHle.Services.FspSrv { string Name = ReadUtf8String(Context); - string DirName = Context.Ns.VFs.GetFullPath(Path, Name); + string DirName = Context.Device.FileSystem.GetFullPath(Path, Name); if (!Directory.Exists(DirName)) { @@ -159,8 +159,8 @@ namespace Ryujinx.HLE.OsHle.Services.FspSrv string OldName = ReadUtf8String(Context, 0); string NewName = ReadUtf8String(Context, 1); - string OldFileName = Context.Ns.VFs.GetFullPath(Path, OldName); - string NewFileName = Context.Ns.VFs.GetFullPath(Path, NewName); + string OldFileName = Context.Device.FileSystem.GetFullPath(Path, OldName); + string NewFileName = Context.Device.FileSystem.GetFullPath(Path, NewName); if (!File.Exists(OldFileName)) { @@ -187,8 +187,8 @@ namespace Ryujinx.HLE.OsHle.Services.FspSrv string OldName = ReadUtf8String(Context, 0); string NewName = ReadUtf8String(Context, 1); - string OldDirName = Context.Ns.VFs.GetFullPath(Path, OldName); - string NewDirName = Context.Ns.VFs.GetFullPath(Path, NewName); + string OldDirName = Context.Device.FileSystem.GetFullPath(Path, OldName); + string NewDirName = Context.Device.FileSystem.GetFullPath(Path, NewName); if (!Directory.Exists(OldDirName)) { @@ -214,7 +214,7 @@ namespace Ryujinx.HLE.OsHle.Services.FspSrv { string Name = ReadUtf8String(Context); - string FileName = Context.Ns.VFs.GetFullPath(Path, Name); + string FileName = Context.Device.FileSystem.GetFullPath(Path, Name); if (File.Exists(FileName)) { @@ -240,7 +240,7 @@ namespace Ryujinx.HLE.OsHle.Services.FspSrv string Name = ReadUtf8String(Context); - string FileName = Context.Ns.VFs.GetFullPath(Path, Name); + string FileName = Context.Device.FileSystem.GetFullPath(Path, Name); if (!File.Exists(FileName)) { @@ -274,7 +274,7 @@ namespace Ryujinx.HLE.OsHle.Services.FspSrv string Name = ReadUtf8String(Context); - string DirName = Context.Ns.VFs.GetFullPath(Path, Name); + string DirName = Context.Device.FileSystem.GetFullPath(Path, Name); if (!Directory.Exists(DirName)) { @@ -309,7 +309,7 @@ namespace Ryujinx.HLE.OsHle.Services.FspSrv { string Name = ReadUtf8String(Context); - Context.ResponseData.Write(Context.Ns.VFs.GetDrive().AvailableFreeSpace); + Context.ResponseData.Write(Context.Device.FileSystem.GetDrive().AvailableFreeSpace); return 0; } @@ -318,7 +318,7 @@ namespace Ryujinx.HLE.OsHle.Services.FspSrv { string Name = ReadUtf8String(Context); - Context.ResponseData.Write(Context.Ns.VFs.GetDrive().TotalSize); + Context.ResponseData.Write(Context.Device.FileSystem.GetDrive().TotalSize); return 0; } @@ -327,7 +327,7 @@ namespace Ryujinx.HLE.OsHle.Services.FspSrv { string Name = ReadUtf8String(Context); - string DirName = Context.Ns.VFs.GetFullPath(Path, Name); + string DirName = Context.Device.FileSystem.GetFullPath(Path, Name); if (!Directory.Exists(DirName)) { diff --git a/Ryujinx.HLE/OsHle/Services/FspSrv/IFileSystemProxy.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs similarity index 77% rename from Ryujinx.HLE/OsHle/Services/FspSrv/IFileSystemProxy.cs rename to Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs index 84a0bc3de0..14edcc759e 100644 --- a/Ryujinx.HLE/OsHle/Services/FspSrv/IFileSystemProxy.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs @@ -1,8 +1,8 @@ +using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.FspSrv +namespace Ryujinx.HLE.HOS.Services.FspSrv { class IFileSystemProxy : IpcService { @@ -31,35 +31,35 @@ namespace Ryujinx.HLE.OsHle.Services.FspSrv public long OpenSdCardFileSystem(ServiceCtx Context) { - MakeObject(Context, new IFileSystem(Context.Ns.VFs.GetSdCardPath())); + MakeObject(Context, new IFileSystem(Context.Device.FileSystem.GetSdCardPath())); return 0; } public long CreateSaveDataFileSystem(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceFs, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceFs, "Stubbed."); return 0; } public long OpenSaveDataFileSystem(ServiceCtx Context) { - MakeObject(Context, new IFileSystem(Context.Ns.VFs.GetGameSavesPath())); + MakeObject(Context, new IFileSystem(Context.Device.FileSystem.GetGameSavesPath())); return 0; } public long OpenDataStorageByCurrentProcess(ServiceCtx Context) { - MakeObject(Context, new IStorage(Context.Ns.VFs.RomFs)); + MakeObject(Context, new IStorage(Context.Device.FileSystem.RomFs)); return 0; } public long OpenPatchDataStorageByCurrentProcess(ServiceCtx Context) { - MakeObject(Context, new IStorage(Context.Ns.VFs.RomFs)); + MakeObject(Context, new IStorage(Context.Device.FileSystem.RomFs)); return 0; } diff --git a/Ryujinx.HLE/OsHle/Services/FspSrv/IStorage.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IStorage.cs similarity index 94% rename from Ryujinx.HLE/OsHle/Services/FspSrv/IStorage.cs rename to Ryujinx.HLE/HOS/Services/FspSrv/IStorage.cs index 56c27d03db..5118fa457b 100644 --- a/Ryujinx.HLE/OsHle/Services/FspSrv/IStorage.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/IStorage.cs @@ -1,8 +1,8 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; using System.IO; -namespace Ryujinx.HLE.OsHle.Services.FspSrv +namespace Ryujinx.HLE.HOS.Services.FspSrv { class IStorage : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Hid/IActiveVibrationDeviceList.cs b/Ryujinx.HLE/HOS/Services/Hid/IActiveVibrationDeviceList.cs similarity index 90% rename from Ryujinx.HLE/OsHle/Services/Hid/IActiveVibrationDeviceList.cs rename to Ryujinx.HLE/HOS/Services/Hid/IActiveVibrationDeviceList.cs index 12eaf7063b..6e666919db 100644 --- a/Ryujinx.HLE/OsHle/Services/Hid/IActiveVibrationDeviceList.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/IActiveVibrationDeviceList.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Hid +namespace Ryujinx.HLE.HOS.Services.Hid { class IActiveApplicationDeviceList : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Hid/IAppletResource.cs b/Ryujinx.HLE/HOS/Services/Hid/IAppletResource.cs similarity index 88% rename from Ryujinx.HLE/OsHle/Services/Hid/IAppletResource.cs rename to Ryujinx.HLE/HOS/Services/Hid/IAppletResource.cs index 5c32ca837d..012ccb4053 100644 --- a/Ryujinx.HLE/OsHle/Services/Hid/IAppletResource.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/IAppletResource.cs @@ -1,8 +1,8 @@ -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Hid +namespace Ryujinx.HLE.HOS.Services.Hid { class IAppletResource : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Hid/IHidServer.cs b/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs similarity index 81% rename from Ryujinx.HLE/OsHle/Services/Hid/IHidServer.cs rename to Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs index f23164ce3f..70f1f1f1f5 100644 --- a/Ryujinx.HLE/OsHle/Services/Hid/IHidServer.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs @@ -1,11 +1,11 @@ +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; using Ryujinx.HLE.Input; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; -using Ryujinx.HLE.OsHle.Handles; using System; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Hid +namespace Ryujinx.HLE.HOS.Services.Hid { class IHidServer : IpcService, IDisposable { @@ -50,14 +50,14 @@ namespace Ryujinx.HLE.OsHle.Services.Hid public long CreateAppletResource(ServiceCtx Context) { - MakeObject(Context, new IAppletResource(Context.Ns.Os.HidSharedMem)); + MakeObject(Context, new IAppletResource(Context.Device.System.HidSharedMem)); return 0; } public long ActivateDebugPad(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); return 0; } @@ -66,7 +66,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid { long AppletResourceUserId = Context.RequestData.ReadInt64(); - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); return 0; } @@ -75,7 +75,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid { long AppletResourceUserId = Context.RequestData.ReadInt64(); - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); return 0; } @@ -84,7 +84,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid { long AppletResourceUserId = Context.RequestData.ReadInt64(); - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); return 0; } @@ -95,7 +95,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid long AppletResourceUserId = Context.RequestData.ReadInt64(); - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); return 0; } @@ -106,7 +106,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid int Unknown = Context.RequestData.ReadInt32(); long AppletResourceUserId = Context.RequestData.ReadInt64(); - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); return 0; } @@ -124,7 +124,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid { Context.ResponseData.Write(0); - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); return 0; } @@ -134,7 +134,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid long Unknown0 = Context.RequestData.ReadInt64(); long Unknown8 = Context.RequestData.ReadInt64(); - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); return 0; } @@ -143,7 +143,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid { long Unknown = Context.RequestData.ReadInt64(); - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); return 0; } @@ -152,7 +152,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid { long Unknown = Context.RequestData.ReadInt64(); - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); return 0; } @@ -163,7 +163,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid Context.ResponseData.Write(0L); - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); return 0; } @@ -173,7 +173,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid long Unknown0 = Context.RequestData.ReadInt64(); long Unknown8 = Context.RequestData.ReadInt64(); - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); return 0; } @@ -182,7 +182,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid { Context.ResponseData.Write(0L); - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); return 0; } @@ -193,7 +193,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid long AppletUserResourceId = Context.RequestData.ReadInt64(); - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); return 0; } @@ -205,7 +205,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid long AppletUserResourceId = Context.RequestData.ReadInt64(); long NpadJoyDeviceType = Context.RequestData.ReadInt64(); - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); return 0; } @@ -216,7 +216,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid long AppletUserResourceId = Context.RequestData.ReadInt64(); - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); return 0; } @@ -227,7 +227,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid long Unknown8 = Context.RequestData.ReadInt32(); long AppletUserResourceId = Context.RequestData.ReadInt64(); - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); return 0; } @@ -237,7 +237,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid long AppletUserResourceId = Context.RequestData.ReadInt64(); long Unknown = Context.RequestData.ReadInt64(); - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); return 0; } @@ -246,7 +246,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid { int VibrationDeviceHandle = Context.RequestData.ReadInt32(); - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); Context.ResponseData.Write(0L); //VibrationDeviceInfoForIpc @@ -264,7 +264,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid long AppletUserResourceId = Context.RequestData.ReadInt64(); - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); return 0; } @@ -278,7 +278,7 @@ namespace Ryujinx.HLE.OsHle.Services.Hid public long SendVibrationValues(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceHid, "Stubbed."); return 0; } diff --git a/Ryujinx.HLE/OsHle/Services/IIpcService.cs b/Ryujinx.HLE/HOS/Services/IIpcService.cs similarity index 69% rename from Ryujinx.HLE/OsHle/Services/IIpcService.cs rename to Ryujinx.HLE/HOS/Services/IIpcService.cs index 6067538047..f6bafe978d 100644 --- a/Ryujinx.HLE/OsHle/Services/IIpcService.cs +++ b/Ryujinx.HLE/HOS/Services/IIpcService.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services +namespace Ryujinx.HLE.HOS.Services { interface IIpcService { diff --git a/Ryujinx.HLE/OsHle/Services/IpcService.cs b/Ryujinx.HLE/HOS/Services/IpcService.cs similarity index 95% rename from Ryujinx.HLE/OsHle/Services/IpcService.cs rename to Ryujinx.HLE/HOS/Services/IpcService.cs index 3c1a136f1b..8e487d55c1 100644 --- a/Ryujinx.HLE/OsHle/Services/IpcService.cs +++ b/Ryujinx.HLE/HOS/Services/IpcService.cs @@ -1,11 +1,11 @@ +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Ipc; using System; using System.Collections.Generic; using System.IO; -namespace Ryujinx.HLE.OsHle.Services +namespace Ryujinx.HLE.HOS.Services { abstract class IpcService : IIpcService { @@ -91,7 +91,7 @@ namespace Ryujinx.HLE.OsHle.Services { Context.ResponseData.BaseStream.Seek(IsDomain ? 0x20 : 0x10, SeekOrigin.Begin); - Context.Ns.Log.PrintDebug(LogClass.KernelIpc, $"{Service.GetType().Name}: {ProcessRequest.Method.Name}"); + Context.Device.Log.PrintDebug(LogClass.KernelIpc, $"{Service.GetType().Name}: {ProcessRequest.Method.Name}"); long Result = ProcessRequest(Context); diff --git a/Ryujinx.HLE/OsHle/Services/Lm/ILogService.cs b/Ryujinx.HLE/HOS/Services/Lm/ILogService.cs similarity index 89% rename from Ryujinx.HLE/OsHle/Services/Lm/ILogService.cs rename to Ryujinx.HLE/HOS/Services/Lm/ILogService.cs index c3aeb1844b..d79da51570 100644 --- a/Ryujinx.HLE/OsHle/Services/Lm/ILogService.cs +++ b/Ryujinx.HLE/HOS/Services/Lm/ILogService.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Lm +namespace Ryujinx.HLE.HOS.Services.Lm { class ILogService : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Lm/ILogger.cs b/Ryujinx.HLE/HOS/Services/Lm/ILogger.cs similarity index 78% rename from Ryujinx.HLE/OsHle/Services/Lm/ILogger.cs rename to Ryujinx.HLE/HOS/Services/Lm/ILogger.cs index 90edf2ad39..42d57c6fcd 100644 --- a/Ryujinx.HLE/OsHle/Services/Lm/ILogger.cs +++ b/Ryujinx.HLE/HOS/Services/Lm/ILogger.cs @@ -1,10 +1,10 @@ +using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; using System.Collections.Generic; using System.IO; using System.Text; -namespace Ryujinx.HLE.OsHle.Services.Lm +namespace Ryujinx.HLE.HOS.Services.Lm { class ILogger : IpcService { @@ -72,11 +72,11 @@ namespace Ryujinx.HLE.OsHle.Services.Lm switch((LmLogLevel)Level) { - case LmLogLevel.Trace: Context.Ns.Log.PrintDebug (LogClass.ServiceLm, Text); break; - case LmLogLevel.Info: Context.Ns.Log.PrintInfo (LogClass.ServiceLm, Text); break; - case LmLogLevel.Warning: Context.Ns.Log.PrintWarning(LogClass.ServiceLm, Text); break; - case LmLogLevel.Error: Context.Ns.Log.PrintError (LogClass.ServiceLm, Text); break; - case LmLogLevel.Critical: Context.Ns.Log.PrintError (LogClass.ServiceLm, Text); break; + case LmLogLevel.Trace: Context.Device.Log.PrintDebug (LogClass.ServiceLm, Text); break; + case LmLogLevel.Info: Context.Device.Log.PrintInfo (LogClass.ServiceLm, Text); break; + case LmLogLevel.Warning: Context.Device.Log.PrintWarning(LogClass.ServiceLm, Text); break; + case LmLogLevel.Error: Context.Device.Log.PrintError (LogClass.ServiceLm, Text); break; + case LmLogLevel.Critical: Context.Device.Log.PrintError (LogClass.ServiceLm, Text); break; } } diff --git a/Ryujinx.HLE/OsHle/Services/Lm/LmLogField.cs b/Ryujinx.HLE/HOS/Services/Lm/LmLogField.cs similarity index 82% rename from Ryujinx.HLE/OsHle/Services/Lm/LmLogField.cs rename to Ryujinx.HLE/HOS/Services/Lm/LmLogField.cs index 33593103ba..bd8c8e886a 100644 --- a/Ryujinx.HLE/OsHle/Services/Lm/LmLogField.cs +++ b/Ryujinx.HLE/HOS/Services/Lm/LmLogField.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Lm +namespace Ryujinx.HLE.HOS.Services.Lm { enum LmLogField { diff --git a/Ryujinx.HLE/OsHle/Services/Lm/LmLogLevel.cs b/Ryujinx.HLE/HOS/Services/Lm/LmLogLevel.cs similarity index 73% rename from Ryujinx.HLE/OsHle/Services/Lm/LmLogLevel.cs rename to Ryujinx.HLE/HOS/Services/Lm/LmLogLevel.cs index d051a595a9..70554c42c0 100644 --- a/Ryujinx.HLE/OsHle/Services/Lm/LmLogLevel.cs +++ b/Ryujinx.HLE/HOS/Services/Lm/LmLogLevel.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Lm +namespace Ryujinx.HLE.HOS.Services.Lm { enum LmLogLevel { diff --git a/Ryujinx.HLE/OsHle/Services/Mm/IRequest.cs b/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs similarity index 74% rename from Ryujinx.HLE/OsHle/Services/Mm/IRequest.cs rename to Ryujinx.HLE/HOS/Services/Mm/IRequest.cs index c60b7f5231..e65ef08679 100644 --- a/Ryujinx.HLE/OsHle/Services/Mm/IRequest.cs +++ b/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs @@ -1,8 +1,8 @@ +using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Mm +namespace Ryujinx.HLE.HOS.Services.Mm { class IRequest : IpcService { @@ -22,14 +22,14 @@ namespace Ryujinx.HLE.OsHle.Services.Mm public long Initialize(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceMm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceMm, "Stubbed."); return 0; } public long SetAndWait(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceMm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceMm, "Stubbed."); return 0; } @@ -38,7 +38,7 @@ namespace Ryujinx.HLE.OsHle.Services.Mm { Context.ResponseData.Write(0); - Context.Ns.Log.PrintStub(LogClass.ServiceMm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceMm, "Stubbed."); return 0; } diff --git a/Ryujinx.HLE/OsHle/Services/Nfp/DeviceState.cs b/Ryujinx.HLE/HOS/Services/Nfp/DeviceState.cs similarity index 57% rename from Ryujinx.HLE/OsHle/Services/Nfp/DeviceState.cs rename to Ryujinx.HLE/HOS/Services/Nfp/DeviceState.cs index 1863e0d920..0452789362 100644 --- a/Ryujinx.HLE/OsHle/Services/Nfp/DeviceState.cs +++ b/Ryujinx.HLE/HOS/Services/Nfp/DeviceState.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nfp +namespace Ryujinx.HLE.HOS.Services.Nfp { enum DeviceState { diff --git a/Ryujinx.HLE/OsHle/Services/Nfp/IUser.cs b/Ryujinx.HLE/HOS/Services/Nfp/IUser.cs similarity index 80% rename from Ryujinx.HLE/OsHle/Services/Nfp/IUser.cs rename to Ryujinx.HLE/HOS/Services/Nfp/IUser.cs index 4b423ba715..eac90da421 100644 --- a/Ryujinx.HLE/OsHle/Services/Nfp/IUser.cs +++ b/Ryujinx.HLE/HOS/Services/Nfp/IUser.cs @@ -1,10 +1,10 @@ -using Ryujinx.HLE.Input; +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; +using Ryujinx.HLE.Input; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Nfp +namespace Ryujinx.HLE.HOS.Services.Nfp { class IUser : IpcService { @@ -44,7 +44,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nfp public long Initialize(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceNfp, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNfp, "Stubbed."); State = State.Initialized; @@ -53,7 +53,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nfp public long AttachActivateEvent(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceNfp, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNfp, "Stubbed."); int Handle = Context.Process.HandleTable.OpenHandle(ActivateEvent); @@ -64,7 +64,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nfp public long AttachDeactivateEvent(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceNfp, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNfp, "Stubbed."); int Handle = Context.Process.HandleTable.OpenHandle(DeactivateEvent); @@ -77,7 +77,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nfp { Context.ResponseData.Write((int)State); - Context.Ns.Log.PrintStub(LogClass.ServiceNfp, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNfp, "Stubbed."); return 0; } @@ -86,7 +86,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nfp { Context.ResponseData.Write((int)DeviceState); - Context.Ns.Log.PrintStub(LogClass.ServiceNfp, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNfp, "Stubbed."); return 0; } @@ -95,14 +95,14 @@ namespace Ryujinx.HLE.OsHle.Services.Nfp { Context.ResponseData.Write((int)NpadId); - Context.Ns.Log.PrintStub(LogClass.ServiceNfp, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNfp, "Stubbed."); return 0; } public long AttachAvailabilityChangeEvent(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceNfp, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNfp, "Stubbed."); int Handle = Context.Process.HandleTable.OpenHandle(AvailabilityChangeEvent); diff --git a/Ryujinx.HLE/OsHle/Services/Nfp/IUserManager.cs b/Ryujinx.HLE/HOS/Services/Nfp/IUserManager.cs similarity index 88% rename from Ryujinx.HLE/OsHle/Services/Nfp/IUserManager.cs rename to Ryujinx.HLE/HOS/Services/Nfp/IUserManager.cs index 845ce7cf0a..770f0341ec 100644 --- a/Ryujinx.HLE/OsHle/Services/Nfp/IUserManager.cs +++ b/Ryujinx.HLE/HOS/Services/Nfp/IUserManager.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Nfp +namespace Ryujinx.HLE.HOS.Services.Nfp { class IUserManager : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Nfp/State.cs b/Ryujinx.HLE/HOS/Services/Nfp/State.cs similarity index 65% rename from Ryujinx.HLE/OsHle/Services/Nfp/State.cs rename to Ryujinx.HLE/HOS/Services/Nfp/State.cs index c1f0bb1a49..0b4b3c1b05 100644 --- a/Ryujinx.HLE/OsHle/Services/Nfp/State.cs +++ b/Ryujinx.HLE/HOS/Services/Nfp/State.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nfp +namespace Ryujinx.HLE.HOS.Services.Nfp { enum State { diff --git a/Ryujinx.HLE/OsHle/Services/Nifm/IGeneralService.cs b/Ryujinx.HLE/HOS/Services/Nifm/IGeneralService.cs similarity index 66% rename from Ryujinx.HLE/OsHle/Services/Nifm/IGeneralService.cs rename to Ryujinx.HLE/HOS/Services/Nifm/IGeneralService.cs index 83bb9f370c..ec68247ba9 100644 --- a/Ryujinx.HLE/OsHle/Services/Nifm/IGeneralService.cs +++ b/Ryujinx.HLE/HOS/Services/Nifm/IGeneralService.cs @@ -1,13 +1,15 @@ +using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; using System; using System.Collections.Generic; using System.Linq; using System.Net; -using System.Net.Sockets; using System.Net.NetworkInformation; +using System.Net.Sockets; -namespace Ryujinx.HLE.OsHle.Services.Nifm +using static Ryujinx.HLE.HOS.ErrorCode; + +namespace Ryujinx.HLE.HOS.Services.Nifm { class IGeneralService : IpcService { @@ -24,16 +26,13 @@ namespace Ryujinx.HLE.OsHle.Services.Nifm }; } - public const int NoInternetConnection = 0x2586e; - - //CreateRequest(i32) public long CreateRequest(ServiceCtx Context) { int Unknown = Context.RequestData.ReadInt32(); MakeObject(Context, new IRequest()); - Context.Ns.Log.PrintStub(LogClass.ServiceNifm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNifm, "Stubbed."); return 0; } @@ -42,15 +41,16 @@ namespace Ryujinx.HLE.OsHle.Services.Nifm { if (!NetworkInterface.GetIsNetworkAvailable()) { - return NoInternetConnection; + return MakeError(ErrorModule.Nifm, NifmErr.NoInternetConnection); } - IPHostEntry Host = Dns.GetHostEntry(Dns.GetHostName()); - IPAddress Address = Host.AddressList.FirstOrDefault(A => A.AddressFamily == AddressFamily.InterNetwork); + IPHostEntry Host = Dns.GetHostEntry(Dns.GetHostName()); + + IPAddress Address = Host.AddressList.FirstOrDefault(A => A.AddressFamily == AddressFamily.InterNetwork); Context.ResponseData.Write(BitConverter.ToUInt32(Address.GetAddressBytes())); - Context.Ns.Log.PrintInfo(LogClass.ServiceNifm, $"Console's local IP is {Address.ToString()}"); + Context.Device.Log.PrintInfo(LogClass.ServiceNifm, $"Console's local IP is \"{Address}\"."); return 0; } diff --git a/Ryujinx.HLE/OsHle/Services/Nifm/IRequest.cs b/Ryujinx.HLE/HOS/Services/Nifm/IRequest.cs similarity index 81% rename from Ryujinx.HLE/OsHle/Services/Nifm/IRequest.cs rename to Ryujinx.HLE/HOS/Services/Nifm/IRequest.cs index 2056187ddd..7bd30ff905 100644 --- a/Ryujinx.HLE/OsHle/Services/Nifm/IRequest.cs +++ b/Ryujinx.HLE/HOS/Services/Nifm/IRequest.cs @@ -1,10 +1,10 @@ +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Ipc; using System; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Nifm +namespace Ryujinx.HLE.HOS.Services.Nifm { class IRequest : IpcService, IDisposable { @@ -35,14 +35,14 @@ namespace Ryujinx.HLE.OsHle.Services.Nifm { Context.ResponseData.Write(1); - Context.Ns.Log.PrintStub(LogClass.ServiceNifm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNifm, "Stubbed."); return 0; } public long GetResult(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceNifm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNifm, "Stubbed."); return 0; } @@ -59,21 +59,21 @@ namespace Ryujinx.HLE.OsHle.Services.Nifm public long Cancel(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceNifm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNifm, "Stubbed."); return 0; } public long Submit(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceNifm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNifm, "Stubbed."); return 0; } public long SetConnectionConfirmationOption(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceNifm, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNifm, "Stubbed."); return 0; } diff --git a/Ryujinx.HLE/OsHle/Services/Nifm/IStaticService.cs b/Ryujinx.HLE/HOS/Services/Nifm/IStaticService.cs similarity index 92% rename from Ryujinx.HLE/OsHle/Services/Nifm/IStaticService.cs rename to Ryujinx.HLE/HOS/Services/Nifm/IStaticService.cs index c6d773f58e..19e7d2470c 100644 --- a/Ryujinx.HLE/OsHle/Services/Nifm/IStaticService.cs +++ b/Ryujinx.HLE/HOS/Services/Nifm/IStaticService.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Nifm +namespace Ryujinx.HLE.HOS.Services.Nifm { class IStaticService : IpcService { diff --git a/Ryujinx.HLE/HOS/Services/Nifm/NifmErr.cs b/Ryujinx.HLE/HOS/Services/Nifm/NifmErr.cs new file mode 100644 index 0000000000..3abeb8389f --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Nifm/NifmErr.cs @@ -0,0 +1,7 @@ +namespace Ryujinx.HLE.HOS.Services.Nifm +{ + static class NifmErr + { + public const int NoInternetConnection = 300; + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/OsHle/Services/Ns/IAddOnContentManager.cs b/Ryujinx.HLE/HOS/Services/Ns/IAddOnContentManager.cs similarity index 81% rename from Ryujinx.HLE/OsHle/Services/Ns/IAddOnContentManager.cs rename to Ryujinx.HLE/HOS/Services/Ns/IAddOnContentManager.cs index f3e7146e5e..b8455d4144 100644 --- a/Ryujinx.HLE/OsHle/Services/Ns/IAddOnContentManager.cs +++ b/Ryujinx.HLE/HOS/Services/Ns/IAddOnContentManager.cs @@ -1,8 +1,8 @@ +using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Ns +namespace Ryujinx.HLE.HOS.Services.Ns { class IAddOnContentManager : IpcService { @@ -23,14 +23,14 @@ namespace Ryujinx.HLE.OsHle.Services.Ns { Context.ResponseData.Write(0); - Context.Ns.Log.PrintStub(LogClass.ServiceNs, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNs, "Stubbed."); return 0; } public static long ListAddOnContent(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceNs, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNs, "Stubbed."); //TODO: This is supposed to write a u32 array aswell. //It's unknown what it contains. diff --git a/Ryujinx.HLE/OsHle/Services/Ns/IServiceGetterInterface.cs b/Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs similarity index 86% rename from Ryujinx.HLE/OsHle/Services/Ns/IServiceGetterInterface.cs rename to Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs index 3650f8a42a..a27cfe607c 100644 --- a/Ryujinx.HLE/OsHle/Services/Ns/IServiceGetterInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Ns +namespace Ryujinx.HLE.HOS.Services.Ns { class IServiceGetterInterface : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Ns/ISystemUpdateInterface.cs b/Ryujinx.HLE/HOS/Services/Ns/ISystemUpdateInterface.cs similarity index 86% rename from Ryujinx.HLE/OsHle/Services/Ns/ISystemUpdateInterface.cs rename to Ryujinx.HLE/HOS/Services/Ns/ISystemUpdateInterface.cs index adb6add9c4..6ade886508 100644 --- a/Ryujinx.HLE/OsHle/Services/Ns/ISystemUpdateInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Ns/ISystemUpdateInterface.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Ns +namespace Ryujinx.HLE.HOS.Services.Ns { class ISystemUpdateInterface : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Ns/IVulnerabilityManagerInterface.cs b/Ryujinx.HLE/HOS/Services/Ns/IVulnerabilityManagerInterface.cs similarity index 86% rename from Ryujinx.HLE/OsHle/Services/Ns/IVulnerabilityManagerInterface.cs rename to Ryujinx.HLE/HOS/Services/Ns/IVulnerabilityManagerInterface.cs index 6a2c3d3b5f..cff334c0cc 100644 --- a/Ryujinx.HLE/OsHle/Services/Ns/IVulnerabilityManagerInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Ns/IVulnerabilityManagerInterface.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Ns +namespace Ryujinx.HLE.HOS.Services.Ns { class IVulnerabilityManagerInterface : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/INvDrvServices.cs b/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs similarity index 91% rename from Ryujinx.HLE/OsHle/Services/Nv/INvDrvServices.cs rename to Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs index 4654d15f65..bfc76931de 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/INvDrvServices.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs @@ -1,16 +1,16 @@ using ChocolArm64.Memory; +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; +using Ryujinx.HLE.HOS.Services.Nv.NvGpuAS; +using Ryujinx.HLE.HOS.Services.Nv.NvGpuGpu; +using Ryujinx.HLE.HOS.Services.Nv.NvHostChannel; +using Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl; +using Ryujinx.HLE.HOS.Services.Nv.NvMap; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Ipc; -using Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS; -using Ryujinx.HLE.OsHle.Services.Nv.NvGpuGpu; -using Ryujinx.HLE.OsHle.Services.Nv.NvHostChannel; -using Ryujinx.HLE.OsHle.Services.Nv.NvHostCtrl; -using Ryujinx.HLE.OsHle.Services.Nv.NvMap; using System; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Nv +namespace Ryujinx.HLE.HOS.Services.Nv { class INvDrvServices : IpcService, IDisposable { @@ -143,7 +143,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv public long FinishInitialize(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); return 0; } @@ -177,14 +177,14 @@ namespace Ryujinx.HLE.OsHle.Services.Nv { if (CmdIn(Cmd) && Context.Request.GetBufferType0x21().Position == 0) { - Context.Ns.Log.PrintError(LogClass.ServiceNv, "Input buffer is null!"); + Context.Device.Log.PrintError(LogClass.ServiceNv, "Input buffer is null!"); return NvResult.InvalidInput; } if (CmdOut(Cmd) && Context.Request.GetBufferType0x22().Position == 0) { - Context.Ns.Log.PrintError(LogClass.ServiceNv, "Output buffer is null!"); + Context.Device.Log.PrintError(LogClass.ServiceNv, "Output buffer is null!"); return NvResult.InvalidInput; } diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvFd.cs b/Ryujinx.HLE/HOS/Services/Nv/NvFd.cs similarity index 80% rename from Ryujinx.HLE/OsHle/Services/Nv/NvFd.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvFd.cs index 96fce80a7a..96f97f41e1 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvFd.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvFd.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv +namespace Ryujinx.HLE.HOS.Services.Nv { class NvFd { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuAS/NvGpuASAllocSpace.cs b/Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASAllocSpace.cs similarity index 79% rename from Ryujinx.HLE/OsHle/Services/Nv/NvGpuAS/NvGpuASAllocSpace.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASAllocSpace.cs index 9d955d6253..bca2f9f4a1 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuAS/NvGpuASAllocSpace.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASAllocSpace.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS +namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS { struct NvGpuASAllocSpace { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuAS/NvGpuASCtx.cs b/Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASCtx.cs similarity index 98% rename from Ryujinx.HLE/OsHle/Services/Nv/NvGpuAS/NvGpuASCtx.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASCtx.cs index e718182a30..d69ec719c9 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuAS/NvGpuASCtx.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASCtx.cs @@ -1,8 +1,7 @@ -using ChocolArm64.Memory; using Ryujinx.HLE.Gpu.Memory; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS +namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS { class NvGpuASCtx { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuAS/NvGpuASIoctl.cs b/Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASIoctl.cs similarity index 88% rename from Ryujinx.HLE/OsHle/Services/Nv/NvGpuAS/NvGpuASIoctl.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASIoctl.cs index 3c67cef09b..c9be18eadc 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuAS/NvGpuASIoctl.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASIoctl.cs @@ -1,11 +1,11 @@ using ChocolArm64.Memory; using Ryujinx.HLE.Gpu.Memory; +using Ryujinx.HLE.HOS.Services.Nv.NvMap; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Services.Nv.NvMap; using System; using System.Collections.Concurrent; -namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS +namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS { class NvGpuASIoctl { @@ -42,7 +42,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS long InputPosition = Context.Request.GetBufferType0x21().Position; long OutputPosition = Context.Request.GetBufferType0x22().Position; - Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); return NvResult.Success; } @@ -78,7 +78,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS { Args.Offset = 0; - Context.Ns.Log.PrintWarning(LogClass.ServiceNv, $"Failed to allocate size {Size:x16}!"); + Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Failed to allocate size {Size:x16}!"); Result = NvResult.OutOfMemory; } @@ -115,7 +115,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS } else { - Context.Ns.Log.PrintWarning(LogClass.ServiceNv, + Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Failed to free offset 0x{Args.Offset:x16} size 0x{Size:x16}!"); Result = NvResult.InvalidInput; @@ -145,7 +145,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS } else { - Context.Ns.Log.PrintWarning(LogClass.ServiceNv, $"Invalid buffer offset {Args.Offset:x16}!"); + Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid buffer offset {Args.Offset:x16}!"); } } @@ -167,7 +167,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS if (Map == null) { - Context.Ns.Log.PrintWarning(LogClass.ServiceNv, $"Invalid NvMap handle 0x{Args.NvMapHandle:x8}!"); + Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid NvMap handle 0x{Args.NvMapHandle:x8}!"); return NvResult.InvalidInput; } @@ -188,7 +188,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS { string Msg = string.Format(MapErrorMsg, VA, Args.MappingSize); - Context.Ns.Log.PrintWarning(LogClass.ServiceNv, Msg); + Context.Device.Log.PrintWarning(LogClass.ServiceNv, Msg); return NvResult.InvalidInput; } @@ -197,7 +197,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS } else { - Context.Ns.Log.PrintWarning(LogClass.ServiceNv, $"Address 0x{Args.Offset:x16} not mapped!"); + Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Address 0x{Args.Offset:x16} not mapped!"); return NvResult.InvalidInput; } @@ -231,7 +231,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS { string Msg = string.Format(MapErrorMsg, Args.Offset, Size); - Context.Ns.Log.PrintWarning(LogClass.ServiceNv, Msg); + Context.Device.Log.PrintWarning(LogClass.ServiceNv, Msg); Result = NvResult.InvalidInput; } @@ -245,7 +245,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS { Args.Offset = 0; - Context.Ns.Log.PrintWarning(LogClass.ServiceNv, $"Failed to map size 0x{Size:x16}!"); + Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Failed to map size 0x{Size:x16}!"); Result = NvResult.InvalidInput; } @@ -265,7 +265,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS long InputPosition = Context.Request.GetBufferType0x21().Position; long OutputPosition = Context.Request.GetBufferType0x22().Position; - Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); return NvResult.Success; } @@ -275,7 +275,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS long InputPosition = Context.Request.GetBufferType0x21().Position; long OutputPosition = Context.Request.GetBufferType0x22().Position; - Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); return NvResult.Success; } @@ -296,7 +296,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS if (Map == null) { - Context.Ns.Log.PrintWarning(LogClass.ServiceNv, $"Invalid NvMap handle 0x{Args.NvMapHandle:x8}!"); + Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid NvMap handle 0x{Args.NvMapHandle:x8}!"); return NvResult.InvalidInput; } @@ -306,7 +306,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS if (Result < 0) { - Context.Ns.Log.PrintWarning(LogClass.ServiceNv, + Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Page 0x{Args.Offset:x16} size 0x{Args.Pages:x16} not allocated!"); return NvResult.InvalidInput; diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuAS/NvGpuASMapBufferEx.cs b/Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASMapBufferEx.cs similarity index 84% rename from Ryujinx.HLE/OsHle/Services/Nv/NvGpuAS/NvGpuASMapBufferEx.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASMapBufferEx.cs index f3ee40b666..4bdb4bf7ce 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuAS/NvGpuASMapBufferEx.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASMapBufferEx.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS +namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS { struct NvGpuASMapBufferEx { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuAS/NvGpuASRemap.cs b/Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASRemap.cs similarity index 81% rename from Ryujinx.HLE/OsHle/Services/Nv/NvGpuAS/NvGpuASRemap.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASRemap.cs index e0ccb113b4..a24221bac5 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuAS/NvGpuASRemap.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASRemap.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS +namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS { struct NvGpuASRemap { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuAS/NvGpuASUnmapBuffer.cs b/Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASUnmapBuffer.cs similarity index 60% rename from Ryujinx.HLE/OsHle/Services/Nv/NvGpuAS/NvGpuASUnmapBuffer.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASUnmapBuffer.cs index 790da3c261..beb07fe2e8 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuAS/NvGpuASUnmapBuffer.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASUnmapBuffer.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS +namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS { struct NvGpuASUnmapBuffer { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuGetActiveSlotMask.cs b/Ryujinx.HLE/HOS/Services/Nv/NvGpuGpu/NvGpuGpuGetActiveSlotMask.cs similarity index 66% rename from Ryujinx.HLE/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuGetActiveSlotMask.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvGpuGpu/NvGpuGpuGetActiveSlotMask.cs index 71edebbb94..e20d21f967 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuGetActiveSlotMask.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvGpuGpu/NvGpuGpuGetActiveSlotMask.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuGpu +namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuGpu { struct NvGpuGpuGetActiveSlotMask { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuGetCharacteristics.cs b/Ryujinx.HLE/HOS/Services/Nv/NvGpuGpu/NvGpuGpuGetCharacteristics.cs similarity index 96% rename from Ryujinx.HLE/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuGetCharacteristics.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvGpuGpu/NvGpuGpuGetCharacteristics.cs index a519fed1fe..9a925138ed 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuGetCharacteristics.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvGpuGpu/NvGpuGpuGetCharacteristics.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuGpu +namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuGpu { struct NvGpuGpuGetCharacteristics { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuGetTpcMasks.cs b/Ryujinx.HLE/HOS/Services/Nv/NvGpuGpu/NvGpuGpuGetTpcMasks.cs similarity index 80% rename from Ryujinx.HLE/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuGetTpcMasks.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvGpuGpu/NvGpuGpuGetTpcMasks.cs index 17a7da6218..751363c60e 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuGetTpcMasks.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvGpuGpu/NvGpuGpuGetTpcMasks.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuGpu +namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuGpu { struct NvGpuGpuGetTpcMasks { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuIoctl.cs b/Ryujinx.HLE/HOS/Services/Nv/NvGpuGpu/NvGpuGpuIoctl.cs similarity index 94% rename from Ryujinx.HLE/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuIoctl.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvGpuGpu/NvGpuGpuIoctl.cs index c034994c69..5ae45c1e9d 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuIoctl.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvGpuGpu/NvGpuGpuIoctl.cs @@ -3,7 +3,7 @@ using Ryujinx.HLE.Logging; using System; using System.Diagnostics; -namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuGpu +namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuGpu { class NvGpuGpuIoctl { @@ -46,7 +46,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuGpu AMemoryHelper.Write(Context.Memory, OutputPosition, Args); - Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); return NvResult.Success; } @@ -70,7 +70,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuGpu AMemoryHelper.Write(Context.Memory, OutputPosition, Args); - Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); return NvResult.Success; } @@ -80,7 +80,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuGpu long InputPosition = Context.Request.GetBufferType0x21().Position; long OutputPosition = Context.Request.GetBufferType0x22().Position; - Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); return NvResult.Success; } @@ -163,7 +163,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuGpu AMemoryHelper.Write(Context.Memory, OutputPosition, Args); - Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); return NvResult.Success; } diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuZcullGetCtxSize.cs b/Ryujinx.HLE/HOS/Services/Nv/NvGpuGpu/NvGpuGpuZcullGetCtxSize.cs similarity index 59% rename from Ryujinx.HLE/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuZcullGetCtxSize.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvGpuGpu/NvGpuGpuZcullGetCtxSize.cs index 21bcacebf3..3ac9f92b60 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuZcullGetCtxSize.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvGpuGpu/NvGpuGpuZcullGetCtxSize.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuGpu +namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuGpu { struct NvGpuGpuZcullGetCtxSize { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuZcullGetInfo.cs b/Ryujinx.HLE/HOS/Services/Nv/NvGpuGpu/NvGpuGpuZcullGetInfo.cs similarity index 89% rename from Ryujinx.HLE/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuZcullGetInfo.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvGpuGpu/NvGpuGpuZcullGetInfo.cs index 168051ed3c..4a7cafd544 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuZcullGetInfo.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvGpuGpu/NvGpuGpuZcullGetInfo.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuGpu +namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuGpu { struct NvGpuGpuZcullGetInfo { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvHelper.cs b/Ryujinx.HLE/HOS/Services/Nv/NvHelper.cs similarity index 70% rename from Ryujinx.HLE/OsHle/Services/Nv/NvHelper.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvHelper.cs index 22f1feccef..d9a1c45267 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvHelper.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvHelper.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv +namespace Ryujinx.HLE.HOS.Services.Nv { static class NvHelper { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvHostChannel/NvChannel.cs b/Ryujinx.HLE/HOS/Services/Nv/NvHostChannel/NvChannel.cs similarity index 53% rename from Ryujinx.HLE/OsHle/Services/Nv/NvHostChannel/NvChannel.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvHostChannel/NvChannel.cs index 486c38069e..54e709f9d3 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvHostChannel/NvChannel.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvHostChannel/NvChannel.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostChannel +namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel { class NvChannel { diff --git a/Ryujinx.HLE/HOS/Services/Nv/NvHostChannel/NvChannelName.cs b/Ryujinx.HLE/HOS/Services/Nv/NvHostChannel/NvChannelName.cs new file mode 100644 index 0000000000..a2b5ea4cbf --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Nv/NvHostChannel/NvChannelName.cs @@ -0,0 +1,7 @@ +namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel +{ + enum NvChannelName + { + Gpu + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvHostChannel/NvHostChannelIoctl.cs b/Ryujinx.HLE/HOS/Services/Nv/NvHostChannel/NvHostChannelIoctl.cs similarity index 90% rename from Ryujinx.HLE/OsHle/Services/Nv/NvHostChannel/NvHostChannelIoctl.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvHostChannel/NvHostChannelIoctl.cs index 3e030643e7..842447f3f5 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvHostChannel/NvHostChannelIoctl.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvHostChannel/NvHostChannelIoctl.cs @@ -1,11 +1,11 @@ using ChocolArm64.Memory; using Ryujinx.HLE.Gpu.Memory; +using Ryujinx.HLE.HOS.Services.Nv.NvGpuAS; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS; using System; using System.Collections.Concurrent; -namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostChannel +namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel { class NvHostChannelIoctl { @@ -57,7 +57,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostChannel long InputPosition = Context.Request.GetBufferType0x21().Position; long OutputPosition = Context.Request.GetBufferType0x22().Position; - Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); return NvResult.Success; } @@ -67,7 +67,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostChannel long InputPosition = Context.Request.GetBufferType0x21().Position; long OutputPosition = Context.Request.GetBufferType0x22().Position; - Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); return NvResult.Success; } @@ -110,7 +110,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostChannel long InputPosition = Context.Request.GetBufferType0x21().Position; long OutputPosition = Context.Request.GetBufferType0x22().Position; - Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); return NvResult.Success; } @@ -120,7 +120,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostChannel long InputPosition = Context.Request.GetBufferType0x21().Position; long OutputPosition = Context.Request.GetBufferType0x22().Position; - Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); return NvResult.Success; } @@ -130,7 +130,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostChannel long InputPosition = Context.Request.GetBufferType0x21().Position; long OutputPosition = Context.Request.GetBufferType0x22().Position; - Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); return NvResult.Success; } @@ -140,7 +140,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostChannel long InputPosition = Context.Request.GetBufferType0x21().Position; long OutputPosition = Context.Request.GetBufferType0x22().Position; - Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); return NvResult.Success; } @@ -150,7 +150,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostChannel long InputPosition = Context.Request.GetBufferType0x21().Position; long OutputPosition = Context.Request.GetBufferType0x22().Position; - Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); return NvResult.Success; } @@ -189,7 +189,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostChannel NvGpuPBEntry[] PushBuffer = NvGpuPushBuffer.Decode(Data); - Context.Ns.Gpu.Fifo.PushBuffer(Vmm, PushBuffer); + Context.Device.Gpu.Fifo.PushBuffer(Vmm, PushBuffer); } public static NvChannel GetChannel(ServiceCtx Context, NvChannelName Channel) diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvHostChannel/NvHostChannelSubmitGpfifo.cs b/Ryujinx.HLE/HOS/Services/Nv/NvHostChannel/NvHostChannelSubmitGpfifo.cs similarity index 78% rename from Ryujinx.HLE/OsHle/Services/Nv/NvHostChannel/NvHostChannelSubmitGpfifo.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvHostChannel/NvHostChannelSubmitGpfifo.cs index ee945839ea..edebcfeb28 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvHostChannel/NvHostChannelSubmitGpfifo.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvHostChannel/NvHostChannelSubmitGpfifo.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostChannel +namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel { struct NvHostChannelSubmitGpfifo { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs b/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs similarity index 95% rename from Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs index 7f20345381..2bfe88821b 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs @@ -5,7 +5,7 @@ using System.Collections.Concurrent; using System.Text; using System.Threading; -namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostCtrl +namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl { class NvHostCtrlIoctl { @@ -95,7 +95,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostCtrl { if (StringValue.Length > 0x100) { - Context.Ns.Log.PrintError(Logging.LogClass.ServiceNv, $"{Domain}!{Name} String value size is too big!"); + Context.Device.Log.PrintError(Logging.LogClass.ServiceNv, $"{Domain}!{Name} String value size is too big!"); } else { @@ -118,7 +118,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostCtrl Context.Memory.WriteBytes(OutputPosition + 0x82, SettingBuffer); - Context.Ns.Log.PrintDebug(Logging.LogClass.ServiceNv, $"Got setting {Domain}!{Name}"); + Context.Device.Log.PrintDebug(Logging.LogClass.ServiceNv, $"Got setting {Domain}!{Name}"); } return NvResult.Success; @@ -144,7 +144,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostCtrl int EventId = Context.Memory.ReadInt32(InputPosition); - Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); return NvResult.Success; } @@ -201,7 +201,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostCtrl } else { - Context.Ns.Log.PrintDebug(LogClass.ServiceNv, "Waiting syncpt with timeout of " + Args.Timeout + "ms..."); + Context.Device.Log.PrintDebug(LogClass.ServiceNv, "Waiting syncpt with timeout of " + Args.Timeout + "ms..."); using (ManualResetEvent WaitEvent = new ManualResetEvent(false)) { @@ -232,7 +232,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostCtrl } } - Context.Ns.Log.PrintDebug(LogClass.ServiceNv, "Resuming..."); + Context.Device.Log.PrintDebug(LogClass.ServiceNv, "Resuming..."); } if (Extended) diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtRead.cs b/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtRead.cs similarity index 65% rename from Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtRead.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtRead.cs index 7801f467a9..275b613255 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtRead.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtRead.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostCtrl +namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl { struct NvHostCtrlSyncptRead { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtWait.cs b/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtWait.cs similarity index 71% rename from Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtWait.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtWait.cs index 29a75dd7d8..96e2f968cd 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtWait.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtWait.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostCtrl +namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl { struct NvHostCtrlSyncptWait { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtWaitEx.cs b/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtWaitEx.cs similarity index 75% rename from Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtWaitEx.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtWaitEx.cs index 79f84214bf..6aaa471831 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtWaitEx.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtWaitEx.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostCtrl +namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl { struct NvHostCtrlSyncptWaitEx { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlUserCtx.cs b/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostCtrlUserCtx.cs similarity index 88% rename from Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlUserCtx.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostCtrlUserCtx.cs index 5d414a2e5f..fcb8083692 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlUserCtx.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostCtrlUserCtx.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostCtrl +namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl { class NvHostCtrlUserCtx { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostEvent.cs b/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostEvent.cs similarity index 71% rename from Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostEvent.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostEvent.cs index bb294d7275..71e5f1e63b 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostEvent.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostEvent.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostCtrl +namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl { class NvHostEvent { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostEventState.cs b/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostEventState.cs similarity index 72% rename from Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostEventState.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostEventState.cs index fa4583b8ce..61870c7f92 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostEventState.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostEventState.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostCtrl +namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl { enum NvHostEventState { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostSyncPt.cs b/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostSyncPt.cs similarity index 98% rename from Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostSyncPt.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostSyncPt.cs index 47d63f794b..9ffa93f250 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostSyncPt.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostSyncPt.cs @@ -3,7 +3,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Threading; -namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostCtrl +namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl { class NvHostSyncpt { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapAlloc.cs b/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapAlloc.cs similarity index 81% rename from Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapAlloc.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapAlloc.cs index 10634b860e..bc61baade7 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapAlloc.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapAlloc.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap +namespace Ryujinx.HLE.HOS.Services.Nv.NvMap { struct NvMapAlloc { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapCreate.cs b/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapCreate.cs similarity index 66% rename from Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapCreate.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapCreate.cs index 8f3be79d02..dd4bff9890 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapCreate.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapCreate.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap +namespace Ryujinx.HLE.HOS.Services.Nv.NvMap { struct NvMapCreate { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapFree.cs b/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapFree.cs similarity index 79% rename from Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapFree.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapFree.cs index bc66fc7173..d946987ef9 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapFree.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapFree.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap +namespace Ryujinx.HLE.HOS.Services.Nv.NvMap { struct NvMapFree { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapFromId.cs b/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapFromId.cs similarity index 65% rename from Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapFromId.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapFromId.cs index 31c751317e..e49257ea6d 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapFromId.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapFromId.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap +namespace Ryujinx.HLE.HOS.Services.Nv.NvMap { struct NvMapFromId { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapGetId.cs b/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapGetId.cs similarity index 65% rename from Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapGetId.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapGetId.cs index 780815d27f..1f4f32900f 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapGetId.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapGetId.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap +namespace Ryujinx.HLE.HOS.Services.Nv.NvMap { struct NvMapGetId { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapHandle.cs b/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapHandle.cs similarity index 93% rename from Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapHandle.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapHandle.cs index f349a03ef6..3f8a151792 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapHandle.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapHandle.cs @@ -1,6 +1,6 @@ using System.Threading; -namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap +namespace Ryujinx.HLE.HOS.Services.Nv.NvMap { class NvMapHandle { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapHandleParam.cs b/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapHandleParam.cs similarity index 77% rename from Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapHandleParam.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapHandleParam.cs index ab1b0577d8..b360343cd1 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapHandleParam.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapHandleParam.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap +namespace Ryujinx.HLE.HOS.Services.Nv.NvMap { enum NvMapHandleParam { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapIoctl.cs b/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapIoctl.cs similarity index 87% rename from Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapIoctl.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapIoctl.cs index e5b2982590..782f7b800c 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapIoctl.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapIoctl.cs @@ -1,10 +1,10 @@ using ChocolArm64.Memory; using Ryujinx.HLE.Gpu.Memory; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Utilities; +using Ryujinx.HLE.Utilities; using System.Collections.Concurrent; -namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap +namespace Ryujinx.HLE.HOS.Services.Nv.NvMap { class NvMapIoctl { @@ -29,7 +29,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap case 0x010e: return GetId (Context); } - Context.Ns.Log.PrintWarning(LogClass.ServiceNv, $"Unsupported Ioctl command 0x{Cmd:x8}!"); + Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Unsupported Ioctl command 0x{Cmd:x8}!"); return NvResult.NotSupported; } @@ -43,7 +43,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap if (Args.Size == 0) { - Context.Ns.Log.PrintWarning(LogClass.ServiceNv, $"Invalid size 0x{Args.Size:x8}!"); + Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid size 0x{Args.Size:x8}!"); return NvResult.InvalidInput; } @@ -52,7 +52,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap Args.Handle = AddNvMap(Context, new NvMapHandle(Size)); - Context.Ns.Log.PrintInfo(LogClass.ServiceNv, $"Created map {Args.Handle} with size 0x{Size:x8}!"); + Context.Device.Log.PrintInfo(LogClass.ServiceNv, $"Created map {Args.Handle} with size 0x{Size:x8}!"); AMemoryHelper.Write(Context.Memory, OutputPosition, Args); @@ -70,7 +70,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap if (Map == null) { - Context.Ns.Log.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{Args.Handle:x8}!"); + Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{Args.Handle:x8}!"); return NvResult.InvalidInput; } @@ -95,14 +95,14 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap if (Map == null) { - Context.Ns.Log.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{Args.Handle:x8}!"); + Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{Args.Handle:x8}!"); return NvResult.InvalidInput; } if ((Args.Align & (Args.Align - 1)) != 0) { - Context.Ns.Log.PrintWarning(LogClass.ServiceNv, $"Invalid alignment 0x{Args.Align:x8}!"); + Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid alignment 0x{Args.Align:x8}!"); return NvResult.InvalidInput; } @@ -130,7 +130,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap //When the address is zero, we need to allocate //our own backing memory for the NvMap. //TODO: Is this allocation inside the transfer memory? - if (!Context.Ns.Memory.Allocator.TryAllocate((uint)Size, out Address)) + if (!Context.Device.Memory.Allocator.TryAllocate((uint)Size, out Address)) { Result = NvResult.OutOfMemory; } @@ -159,7 +159,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap if (Map == null) { - Context.Ns.Log.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{Args.Handle:x8}!"); + Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{Args.Handle:x8}!"); return NvResult.InvalidInput; } @@ -168,7 +168,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap { DeleteNvMap(Context, Args.Handle); - Context.Ns.Log.PrintInfo(LogClass.ServiceNv, $"Deleted map {Args.Handle}!"); + Context.Device.Log.PrintInfo(LogClass.ServiceNv, $"Deleted map {Args.Handle}!"); Args.Address = Map.Address; Args.Flags = 0; @@ -197,7 +197,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap if (Map == null) { - Context.Ns.Log.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{Args.Handle:x8}!"); + Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{Args.Handle:x8}!"); return NvResult.InvalidInput; } @@ -231,7 +231,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap if (Map == null) { - Context.Ns.Log.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{Args.Handle:x8}!"); + Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{Args.Handle:x8}!"); return NvResult.InvalidInput; } diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapParam.cs b/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapParam.cs similarity index 71% rename from Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapParam.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapParam.cs index 218cb700a7..b5213efe59 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapParam.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapParam.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap +namespace Ryujinx.HLE.HOS.Services.Nv.NvMap { struct NvMapParam { diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvResult.cs b/Ryujinx.HLE/HOS/Services/Nv/NvResult.cs similarity index 92% rename from Ryujinx.HLE/OsHle/Services/Nv/NvResult.cs rename to Ryujinx.HLE/HOS/Services/Nv/NvResult.cs index 78ae5ae33b..86ecd97558 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvResult.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvResult.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv +namespace Ryujinx.HLE.HOS.Services.Nv { static class NvResult { diff --git a/Ryujinx.HLE/OsHle/Services/Pctl/IParentalControlService.cs b/Ryujinx.HLE/HOS/Services/Pctl/IParentalControlService.cs similarity index 83% rename from Ryujinx.HLE/OsHle/Services/Pctl/IParentalControlService.cs rename to Ryujinx.HLE/HOS/Services/Pctl/IParentalControlService.cs index 60a69f58c9..d484d312f3 100644 --- a/Ryujinx.HLE/OsHle/Services/Pctl/IParentalControlService.cs +++ b/Ryujinx.HLE/HOS/Services/Pctl/IParentalControlService.cs @@ -1,8 +1,8 @@ +using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Pctl +namespace Ryujinx.HLE.HOS.Services.Pctl { class IParentalControlService : IpcService { @@ -32,7 +32,7 @@ namespace Ryujinx.HLE.OsHle.Services.Pctl } else { - Context.Ns.Log.PrintWarning(LogClass.ServicePctl, "Service is already initialized!"); + Context.Device.Log.PrintWarning(LogClass.ServicePctl, "Service is already initialized!"); } return 0; diff --git a/Ryujinx.HLE/OsHle/Services/Pctl/IParentalControlServiceFactory.cs b/Ryujinx.HLE/HOS/Services/Pctl/IParentalControlServiceFactory.cs similarity index 92% rename from Ryujinx.HLE/OsHle/Services/Pctl/IParentalControlServiceFactory.cs rename to Ryujinx.HLE/HOS/Services/Pctl/IParentalControlServiceFactory.cs index 7ef91d7fb6..157d594d2c 100644 --- a/Ryujinx.HLE/OsHle/Services/Pctl/IParentalControlServiceFactory.cs +++ b/Ryujinx.HLE/HOS/Services/Pctl/IParentalControlServiceFactory.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Pctl +namespace Ryujinx.HLE.HOS.Services.Pctl { class IParentalControlServiceFactory : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Pl/ISharedFontManager.cs b/Ryujinx.HLE/HOS/Services/Pl/ISharedFontManager.cs similarity index 88% rename from Ryujinx.HLE/OsHle/Services/Pl/ISharedFontManager.cs rename to Ryujinx.HLE/HOS/Services/Pl/ISharedFontManager.cs index 4788c5aff8..92821217ba 100644 --- a/Ryujinx.HLE/OsHle/Services/Pl/ISharedFontManager.cs +++ b/Ryujinx.HLE/HOS/Services/Pl/ISharedFontManager.cs @@ -1,8 +1,8 @@ -using Ryujinx.HLE.OsHle.Font; -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Font; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Pl +namespace Ryujinx.HLE.HOS.Services.Pl { class ISharedFontManager : IpcService { @@ -47,7 +47,7 @@ namespace Ryujinx.HLE.OsHle.Services.Pl { SharedFontType FontType = (SharedFontType)Context.RequestData.ReadInt32(); - Context.ResponseData.Write(Context.Ns.Os.Font.GetFontSize(FontType)); + Context.ResponseData.Write(Context.Device.System.Font.GetFontSize(FontType)); return 0; } @@ -56,16 +56,16 @@ namespace Ryujinx.HLE.OsHle.Services.Pl { SharedFontType FontType = (SharedFontType)Context.RequestData.ReadInt32(); - Context.ResponseData.Write(Context.Ns.Os.Font.GetSharedMemoryAddressOffset(FontType)); + Context.ResponseData.Write(Context.Device.System.Font.GetSharedMemoryAddressOffset(FontType)); return 0; } public long GetSharedMemoryNativeHandle(ServiceCtx Context) { - Context.Ns.Os.Font.EnsureInitialized(); + Context.Device.System.Font.EnsureInitialized(); - int Handle = Context.Process.HandleTable.OpenHandle(Context.Ns.Os.FontSharedMem); + int Handle = Context.Process.HandleTable.OpenHandle(Context.Device.System.FontSharedMem); Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); @@ -115,9 +115,9 @@ namespace Ryujinx.HLE.OsHle.Services.Pl Context.Memory.WriteInt32(TypesPosition + Offset, (int)FontType); - Context.Memory.WriteInt32(OffsetsPosition + Offset, Context.Ns.Os.Font.GetSharedMemoryAddressOffset(FontType)); + Context.Memory.WriteInt32(OffsetsPosition + Offset, Context.Device.System.Font.GetSharedMemoryAddressOffset(FontType)); - Context.Memory.WriteInt32(FontSizeBufferPosition + Offset, Context.Ns.Os.Font.GetFontSize(FontType)); + Context.Memory.WriteInt32(FontSizeBufferPosition + Offset, Context.Device.System.Font.GetFontSize(FontType)); return true; } diff --git a/Ryujinx.HLE/OsHle/Services/Prepo/IPrepoService.cs b/Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs similarity index 80% rename from Ryujinx.HLE/OsHle/Services/Prepo/IPrepoService.cs rename to Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs index f313921a78..fa39854d1d 100644 --- a/Ryujinx.HLE/OsHle/Services/Prepo/IPrepoService.cs +++ b/Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs @@ -1,8 +1,8 @@ +using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Prepo +namespace Ryujinx.HLE.HOS.Services.Prepo { class IPrepoService : IpcService { @@ -20,7 +20,7 @@ namespace Ryujinx.HLE.OsHle.Services.Prepo public static long SaveReportWithUser(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServicePrepo, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServicePrepo, "Stubbed."); return 0; } diff --git a/Ryujinx.HLE/OsHle/Services/ServiceFactory.cs b/Ryujinx.HLE/HOS/Services/ServiceFactory.cs similarity index 81% rename from Ryujinx.HLE/OsHle/Services/ServiceFactory.cs rename to Ryujinx.HLE/HOS/Services/ServiceFactory.cs index 712698b9af..babceb7db9 100644 --- a/Ryujinx.HLE/OsHle/Services/ServiceFactory.cs +++ b/Ryujinx.HLE/HOS/Services/ServiceFactory.cs @@ -1,30 +1,28 @@ -using Ryujinx.HLE.OsHle.Services.Acc; -using Ryujinx.HLE.OsHle.Services.Am; -using Ryujinx.HLE.OsHle.Services.Apm; -using Ryujinx.HLE.OsHle.Services.Aud; -using Ryujinx.HLE.OsHle.Services.Bcat; -using Ryujinx.HLE.OsHle.Services.Bsd; -using Ryujinx.HLE.OsHle.Services.Caps; -using Ryujinx.HLE.OsHle.Services.Friend; -using Ryujinx.HLE.OsHle.Services.FspSrv; -using Ryujinx.HLE.OsHle.Services.Hid; -using Ryujinx.HLE.OsHle.Services.Lm; -using Ryujinx.HLE.OsHle.Services.Mm; -using Ryujinx.HLE.OsHle.Services.Nfp; -using Ryujinx.HLE.OsHle.Services.Ns; -using Ryujinx.HLE.OsHle.Services.Nv; -using Ryujinx.HLE.OsHle.Services.Pctl; -using Ryujinx.HLE.OsHle.Services.Pl; -using Ryujinx.HLE.OsHle.Services.Prepo; -using Ryujinx.HLE.OsHle.Services.Set; -using Ryujinx.HLE.OsHle.Services.Sfdnsres; -using Ryujinx.HLE.OsHle.Services.Sm; -using Ryujinx.HLE.OsHle.Services.Spl; -using Ryujinx.HLE.OsHle.Services.Ssl; -using Ryujinx.HLE.OsHle.Services.Vi; +using Ryujinx.HLE.HOS.Services.Acc; +using Ryujinx.HLE.HOS.Services.Am; +using Ryujinx.HLE.HOS.Services.Apm; +using Ryujinx.HLE.HOS.Services.Aud; +using Ryujinx.HLE.HOS.Services.Bsd; +using Ryujinx.HLE.HOS.Services.Caps; +using Ryujinx.HLE.HOS.Services.FspSrv; +using Ryujinx.HLE.HOS.Services.Hid; +using Ryujinx.HLE.HOS.Services.Lm; +using Ryujinx.HLE.HOS.Services.Mm; +using Ryujinx.HLE.HOS.Services.Nfp; +using Ryujinx.HLE.HOS.Services.Ns; +using Ryujinx.HLE.HOS.Services.Nv; +using Ryujinx.HLE.HOS.Services.Pctl; +using Ryujinx.HLE.HOS.Services.Pl; +using Ryujinx.HLE.HOS.Services.Prepo; +using Ryujinx.HLE.HOS.Services.Set; +using Ryujinx.HLE.HOS.Services.Sfdnsres; +using Ryujinx.HLE.HOS.Services.Sm; +using Ryujinx.HLE.HOS.Services.Spl; +using Ryujinx.HLE.HOS.Services.Ssl; +using Ryujinx.HLE.HOS.Services.Vi; using System; -namespace Ryujinx.HLE.OsHle.Services +namespace Ryujinx.HLE.HOS.Services { static class ServiceFactory { @@ -97,10 +95,10 @@ namespace Ryujinx.HLE.OsHle.Services case "lm": return new ILogService(); - + case "mm:u": return new IRequest(); - + case "nfp:user": return new IUserManager(); diff --git a/Ryujinx.HLE/OsHle/Services/Set/ISettingsServer.cs b/Ryujinx.HLE/HOS/Services/Set/ISettingsServer.cs similarity index 91% rename from Ryujinx.HLE/OsHle/Services/Set/ISettingsServer.cs rename to Ryujinx.HLE/HOS/Services/Set/ISettingsServer.cs index 0feccfa264..690d6de93f 100644 --- a/Ryujinx.HLE/OsHle/Services/Set/ISettingsServer.cs +++ b/Ryujinx.HLE/HOS/Services/Set/ISettingsServer.cs @@ -1,8 +1,8 @@ -using Ryujinx.HLE.OsHle.Ipc; -using Ryujinx.HLE.OsHle.SystemState; +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.SystemState; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Set +namespace Ryujinx.HLE.HOS.Services.Set { class ISettingsServer : IpcService { @@ -23,7 +23,7 @@ namespace Ryujinx.HLE.OsHle.Services.Set public static long GetLanguageCode(ServiceCtx Context) { - Context.ResponseData.Write(Context.Ns.Os.SystemState.DesiredLanguageCode); + Context.ResponseData.Write(Context.Device.System.State.DesiredLanguageCode); return 0; } diff --git a/Ryujinx.HLE/OsHle/Services/Set/ISystemSettingsServer.cs b/Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs similarity index 87% rename from Ryujinx.HLE/OsHle/Services/Set/ISystemSettingsServer.cs rename to Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs index ef083e4c2b..dc1469674c 100644 --- a/Ryujinx.HLE/OsHle/Services/Set/ISystemSettingsServer.cs +++ b/Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs @@ -1,11 +1,11 @@ -using Ryujinx.HLE.OsHle.Ipc; -using Ryujinx.HLE.OsHle.SystemState; +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.SystemState; using System; using System.Collections.Generic; using System.IO; using System.Text; -namespace Ryujinx.HLE.OsHle.Services.Set +namespace Ryujinx.HLE.HOS.Services.Set { class ISystemSettingsServer : IpcService { @@ -75,7 +75,7 @@ namespace Ryujinx.HLE.OsHle.Services.Set public static long GetColorSetId(ServiceCtx Context) { - Context.ResponseData.Write((int)Context.Ns.Os.SystemState.ThemeColor); + Context.ResponseData.Write((int)Context.Device.System.State.ThemeColor); return 0; } @@ -84,7 +84,7 @@ namespace Ryujinx.HLE.OsHle.Services.Set { int ColorSetId = Context.RequestData.ReadInt32(); - Context.Ns.Os.SystemState.ThemeColor = (ColorSet)ColorSetId; + Context.Device.System.State.ThemeColor = (ColorSet)ColorSetId; return 0; } @@ -115,7 +115,7 @@ namespace Ryujinx.HLE.OsHle.Services.Set { if (StringValue.Length + 1 > ReplySize) { - Context.Ns.Log.PrintError(Logging.LogClass.ServiceSet, $"{AskedSetting} String value size is too big!"); + Context.Device.Log.PrintError(Logging.LogClass.ServiceSet, $"{AskedSetting} String value size is too big!"); } else { @@ -138,11 +138,11 @@ namespace Ryujinx.HLE.OsHle.Services.Set Context.Memory.WriteBytes(ReplyPos, SettingBuffer); - Context.Ns.Log.PrintDebug(Logging.LogClass.ServiceSet, $"{AskedSetting} set value: {NxSetting} as {NxSetting.GetType()}"); + Context.Device.Log.PrintDebug(Logging.LogClass.ServiceSet, $"{AskedSetting} set value: {NxSetting} as {NxSetting.GetType()}"); } else { - Context.Ns.Log.PrintError(Logging.LogClass.ServiceSet, $"{AskedSetting} not found!"); + Context.Device.Log.PrintError(Logging.LogClass.ServiceSet, $"{AskedSetting} not found!"); } return 0; diff --git a/Ryujinx.HLE/OsHle/Services/Set/NxSettings.cs b/Ryujinx.HLE/HOS/Services/Set/NxSettings.cs similarity index 99% rename from Ryujinx.HLE/OsHle/Services/Set/NxSettings.cs rename to Ryujinx.HLE/HOS/Services/Set/NxSettings.cs index dc4a0b96fb..7d1dd2ed78 100644 --- a/Ryujinx.HLE/OsHle/Services/Set/NxSettings.cs +++ b/Ryujinx.HLE/HOS/Services/Set/NxSettings.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Set +namespace Ryujinx.HLE.HOS.Services.Set { static class NxSettings { diff --git a/Ryujinx.HLE/OsHle/Services/Sfdnsres/IResolver.cs b/Ryujinx.HLE/HOS/Services/Sfdnsres/IResolver.cs similarity index 84% rename from Ryujinx.HLE/OsHle/Services/Sfdnsres/IResolver.cs rename to Ryujinx.HLE/HOS/Services/Sfdnsres/IResolver.cs index 2fa81eb9b3..26dbedf441 100644 --- a/Ryujinx.HLE/OsHle/Services/Sfdnsres/IResolver.cs +++ b/Ryujinx.HLE/HOS/Services/Sfdnsres/IResolver.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Sfdnsres +namespace Ryujinx.HLE.HOS.Services.Sfdnsres { class IResolver : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Sm/IUserInterface.cs b/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs similarity index 94% rename from Ryujinx.HLE/OsHle/Services/Sm/IUserInterface.cs rename to Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs index a0a174f5e6..efa64ee7dd 100644 --- a/Ryujinx.HLE/OsHle/Services/Sm/IUserInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs @@ -1,8 +1,8 @@ -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Sm +namespace Ryujinx.HLE.HOS.Services.Sm { class IUserInterface : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Spl/IRandomInterface.cs b/Ryujinx.HLE/HOS/Services/Spl/IRandomInterface.cs similarity index 94% rename from Ryujinx.HLE/OsHle/Services/Spl/IRandomInterface.cs rename to Ryujinx.HLE/HOS/Services/Spl/IRandomInterface.cs index 489ca52ce6..6391d981ce 100644 --- a/Ryujinx.HLE/OsHle/Services/Spl/IRandomInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Spl/IRandomInterface.cs @@ -1,9 +1,9 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System; using System.Collections.Generic; using System.Security.Cryptography; -namespace Ryujinx.HLE.OsHle.Services.Spl +namespace Ryujinx.HLE.HOS.Services.Spl { class IRandomInterface : IpcService, IDisposable { diff --git a/Ryujinx.HLE/OsHle/Services/Ssl/ISslService.cs b/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs similarity index 81% rename from Ryujinx.HLE/OsHle/Services/Ssl/ISslService.cs rename to Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs index 0bf4c14465..b59527f707 100644 --- a/Ryujinx.HLE/OsHle/Services/Ssl/ISslService.cs +++ b/Ryujinx.HLE/HOS/Services/Ssl/ISslService.cs @@ -1,8 +1,8 @@ +using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Ssl +namespace Ryujinx.HLE.HOS.Services.Ssl { class ISslService : IpcService { @@ -22,7 +22,7 @@ namespace Ryujinx.HLE.OsHle.Services.Ssl { int Version = Context.RequestData.ReadInt32(); - Context.Ns.Log.PrintStub(LogClass.ServiceSsl, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceSsl, "Stubbed."); return 0; } diff --git a/Ryujinx.HLE/OsHle/Services/Time/IStaticService.cs b/Ryujinx.HLE/HOS/Services/Time/IStaticService.cs similarity index 96% rename from Ryujinx.HLE/OsHle/Services/Time/IStaticService.cs rename to Ryujinx.HLE/HOS/Services/Time/IStaticService.cs index 55601a8947..66f16501cf 100644 --- a/Ryujinx.HLE/OsHle/Services/Time/IStaticService.cs +++ b/Ryujinx.HLE/HOS/Services/Time/IStaticService.cs @@ -1,8 +1,8 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Time +namespace Ryujinx.HLE.HOS.Services.Time { class IStaticService : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Time/ISteadyClock.cs b/Ryujinx.HLE/HOS/Services/Time/ISteadyClock.cs similarity index 94% rename from Ryujinx.HLE/OsHle/Services/Time/ISteadyClock.cs rename to Ryujinx.HLE/HOS/Services/Time/ISteadyClock.cs index e2cb34e3c3..e4020bb144 100644 --- a/Ryujinx.HLE/OsHle/Services/Time/ISteadyClock.cs +++ b/Ryujinx.HLE/HOS/Services/Time/ISteadyClock.cs @@ -1,8 +1,8 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Time +namespace Ryujinx.HLE.HOS.Services.Time { class ISteadyClock : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Time/ISystemClock.cs b/Ryujinx.HLE/HOS/Services/Time/ISystemClock.cs similarity index 97% rename from Ryujinx.HLE/OsHle/Services/Time/ISystemClock.cs rename to Ryujinx.HLE/HOS/Services/Time/ISystemClock.cs index 27b65c3c6d..f574826a0d 100644 --- a/Ryujinx.HLE/OsHle/Services/Time/ISystemClock.cs +++ b/Ryujinx.HLE/HOS/Services/Time/ISystemClock.cs @@ -1,8 +1,8 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Time +namespace Ryujinx.HLE.HOS.Services.Time { class ISystemClock : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Time/ITimeZoneService.cs b/Ryujinx.HLE/HOS/Services/Time/ITimeZoneService.cs similarity index 80% rename from Ryujinx.HLE/OsHle/Services/Time/ITimeZoneService.cs rename to Ryujinx.HLE/HOS/Services/Time/ITimeZoneService.cs index 87ef02f999..6df28659d1 100644 --- a/Ryujinx.HLE/OsHle/Services/Time/ITimeZoneService.cs +++ b/Ryujinx.HLE/HOS/Services/Time/ITimeZoneService.cs @@ -1,10 +1,12 @@ +using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; using System; using System.Collections.Generic; using System.Text; -namespace Ryujinx.HLE.OsHle.Services.Time +using static Ryujinx.HLE.HOS.ErrorCode; + +namespace Ryujinx.HLE.HOS.Services.Time { class ITimeZoneService : IpcService { @@ -51,7 +53,8 @@ namespace Ryujinx.HLE.OsHle.Services.Time public long SetDeviceLocationName(ServiceCtx Context) { byte[] LocationName = Context.RequestData.ReadBytes(0x24); - string TzID = Encoding.ASCII.GetString(LocationName).TrimEnd('\0'); + + string TzID = Encoding.ASCII.GetString(LocationName).TrimEnd('\0'); long ResultCode = 0; @@ -59,9 +62,9 @@ namespace Ryujinx.HLE.OsHle.Services.Time { TimeZone = TimeZoneInfo.FindSystemTimeZoneById(TzID); } - catch (TimeZoneNotFoundException e) + catch (TimeZoneNotFoundException) { - ResultCode = 0x7BA74; + ResultCode = MakeError(ErrorModule.Time, 0x3dd); } return ResultCode; @@ -79,12 +82,13 @@ namespace Ryujinx.HLE.OsHle.Services.Time long BufferPosition = Context.Response.SendBuff[0].Position; long BufferSize = Context.Response.SendBuff[0].Size; - int i = 0; + int Offset = 0; + foreach (TimeZoneInfo info in TimeZoneInfo.GetSystemTimeZones()) { byte[] TzData = Encoding.ASCII.GetBytes(info.Id); - Context.Memory.WriteBytes(BufferPosition + i, TzData); + Context.Memory.WriteBytes(BufferPosition + Offset, TzData); int Padding = 0x24 - TzData.Length; @@ -93,8 +97,9 @@ namespace Ryujinx.HLE.OsHle.Services.Time Context.ResponseData.Write((byte)0); } - i += 0x24; + Offset += 0x24; } + return 0; } @@ -105,28 +110,31 @@ namespace Ryujinx.HLE.OsHle.Services.Time if (BufferSize != 0x4000) { - Context.Ns.Log.PrintWarning(LogClass.ServiceTime, $"TimeZoneRule buffer size is 0x{BufferSize:x} (expected 0x4000)"); + Context.Device.Log.PrintWarning(LogClass.ServiceTime, $"TimeZoneRule buffer size is 0x{BufferSize:x} (expected 0x4000)"); } long ResultCode = 0; byte[] LocationName = Context.RequestData.ReadBytes(0x24); - string TzID = Encoding.ASCII.GetString(LocationName).TrimEnd('\0'); + + string TzID = Encoding.ASCII.GetString(LocationName).TrimEnd('\0'); // Check if the Time Zone exists, otherwise error out. try { TimeZoneInfo Info = TimeZoneInfo.FindSystemTimeZoneById(TzID); - byte[] TzData = Encoding.ASCII.GetBytes(Info.Id); + + byte[] TzData = Encoding.ASCII.GetBytes(Info.Id); // FIXME: This is not in ANY cases accurate, but the games don't care about the content of the buffer, they only pass it. // TODO: Reverse the TZif2 conversion in PCV to make this match with real hardware. Context.Memory.WriteBytes(BufferPosition, TzData); } - catch (TimeZoneNotFoundException e) + catch (TimeZoneNotFoundException) { - Context.Ns.Log.PrintWarning(LogClass.ServiceTime, $"Timezone not found for string: {TzID} (len: {TzID.Length})"); - ResultCode = 0x7BA74; + Context.Device.Log.PrintWarning(LogClass.ServiceTime, $"Timezone not found for string: {TzID} (len: {TzID.Length})"); + + ResultCode = MakeError(ErrorModule.Time, 0x3dd); } return ResultCode; @@ -135,7 +143,8 @@ namespace Ryujinx.HLE.OsHle.Services.Time private long ToCalendarTimeWithTz(ServiceCtx Context, long PosixTime, TimeZoneInfo Info) { DateTime CurrentTime = Epoch.AddSeconds(PosixTime); - CurrentTime = TimeZoneInfo.ConvertTimeFromUtc(CurrentTime, Info); + + CurrentTime = TimeZoneInfo.ConvertTimeFromUtc(CurrentTime, Info); Context.ResponseData.Write((ushort)CurrentTime.Year); Context.ResponseData.Write((byte)CurrentTime.Month); @@ -161,12 +170,13 @@ namespace Ryujinx.HLE.OsHle.Services.Time if (BufferSize != 0x4000) { - Context.Ns.Log.PrintWarning(LogClass.ServiceTime, $"TimeZoneRule buffer size is 0x{BufferSize:x} (expected 0x4000)"); + Context.Device.Log.PrintWarning(LogClass.ServiceTime, $"TimeZoneRule buffer size is 0x{BufferSize:x} (expected 0x4000)"); } // TODO: Reverse the TZif2 conversion in PCV to make this match with real hardware. byte[] TzData = Context.Memory.ReadBytes(BufferPosition, 0x24); - string TzID = Encoding.ASCII.GetString(TzData).TrimEnd('\0'); + + string TzID = Encoding.ASCII.GetString(TzData).TrimEnd('\0'); long ResultCode = 0; @@ -177,10 +187,11 @@ namespace Ryujinx.HLE.OsHle.Services.Time ResultCode = ToCalendarTimeWithTz(Context, PosixTime, Info); } - catch (TimeZoneNotFoundException e) + catch (TimeZoneNotFoundException) { - Context.Ns.Log.PrintWarning(LogClass.ServiceTime, $"Timezone not found for string: {TzID} (len: {TzID.Length})"); - ResultCode = 0x7BA74; + Context.Device.Log.PrintWarning(LogClass.ServiceTime, $"Timezone not found for string: {TzID} (len: {TzID.Length})"); + + ResultCode = MakeError(ErrorModule.Time, 0x3dd); } return ResultCode; @@ -209,12 +220,13 @@ namespace Ryujinx.HLE.OsHle.Services.Time if (BufferSize != 0x4000) { - Context.Ns.Log.PrintWarning(LogClass.ServiceTime, $"TimeZoneRule buffer size is 0x{BufferSize:x} (expected 0x4000)"); + Context.Device.Log.PrintWarning(LogClass.ServiceTime, $"TimeZoneRule buffer size is 0x{BufferSize:x} (expected 0x4000)"); } // TODO: Reverse the TZif2 conversion in PCV to make this match with real hardware. byte[] TzData = Context.Memory.ReadBytes(BufferPosition, 0x24); - string TzID = Encoding.ASCII.GetString(TzData).TrimEnd('\0'); + + string TzID = Encoding.ASCII.GetString(TzData).TrimEnd('\0'); long ResultCode = 0; @@ -225,10 +237,11 @@ namespace Ryujinx.HLE.OsHle.Services.Time return ToPosixTimeWithTz(Context, CalendarTime, Info); } - catch (TimeZoneNotFoundException e) + catch (TimeZoneNotFoundException) { - Context.Ns.Log.PrintWarning(LogClass.ServiceTime, $"Timezone not found for string: {TzID} (len: {TzID.Length})"); - ResultCode = 0x7BA74; + Context.Device.Log.PrintWarning(LogClass.ServiceTime, $"Timezone not found for string: {TzID} (len: {TzID.Length})"); + + ResultCode = MakeError(ErrorModule.Time, 0x3dd); } return ResultCode; diff --git a/Ryujinx.HLE/OsHle/Services/Time/SystemClockType.cs b/Ryujinx.HLE/HOS/Services/Time/SystemClockType.cs similarity index 72% rename from Ryujinx.HLE/OsHle/Services/Time/SystemClockType.cs rename to Ryujinx.HLE/HOS/Services/Time/SystemClockType.cs index d581d9ca5f..54b7df3f81 100644 --- a/Ryujinx.HLE/OsHle/Services/Time/SystemClockType.cs +++ b/Ryujinx.HLE/HOS/Services/Time/SystemClockType.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Time +namespace Ryujinx.HLE.HOS.Services.Time { enum SystemClockType { diff --git a/Ryujinx.HLE/OsHle/Services/Vi/Display.cs b/Ryujinx.HLE/HOS/Services/Vi/Display.cs similarity index 80% rename from Ryujinx.HLE/OsHle/Services/Vi/Display.cs rename to Ryujinx.HLE/HOS/Services/Vi/Display.cs index 3da51c478f..50fe5e1d19 100644 --- a/Ryujinx.HLE/OsHle/Services/Vi/Display.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/Display.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Services.Vi +namespace Ryujinx.HLE.HOS.Services.Vi { class Display { diff --git a/Ryujinx.HLE/OsHle/Services/Vi/GbpBuffer.cs b/Ryujinx.HLE/HOS/Services/Vi/GbpBuffer.cs similarity index 97% rename from Ryujinx.HLE/OsHle/Services/Vi/GbpBuffer.cs rename to Ryujinx.HLE/HOS/Services/Vi/GbpBuffer.cs index b9e9054ba8..4f00c3de4b 100644 --- a/Ryujinx.HLE/OsHle/Services/Vi/GbpBuffer.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/GbpBuffer.cs @@ -1,6 +1,6 @@ using System.IO; -namespace Ryujinx.HLE.OsHle.Services.Android +namespace Ryujinx.HLE.HOS.Services.Android { struct GbpBuffer { diff --git a/Ryujinx.HLE/OsHle/Services/Vi/IApplicationDisplayService.cs b/Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs similarity index 95% rename from Ryujinx.HLE/OsHle/Services/Vi/IApplicationDisplayService.cs rename to Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs index 17dc47e149..3006b73a50 100644 --- a/Ryujinx.HLE/OsHle/Services/Vi/IApplicationDisplayService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs @@ -1,12 +1,12 @@ using ChocolArm64.Memory; -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; using System.IO; using System.Text; -using static Ryujinx.HLE.OsHle.Services.Android.Parcel; +using static Ryujinx.HLE.HOS.Services.Android.Parcel; -namespace Ryujinx.HLE.OsHle.Services.Vi +namespace Ryujinx.HLE.HOS.Services.Vi { class IApplicationDisplayService : IpcService { @@ -41,7 +41,7 @@ namespace Ryujinx.HLE.OsHle.Services.Vi public long GetRelayService(ServiceCtx Context) { - MakeObject(Context, new IHOSBinderDriver(Context.Ns.Gpu.Renderer)); + MakeObject(Context, new IHOSBinderDriver(Context.Device.Gpu.Renderer)); return 0; } @@ -62,7 +62,7 @@ namespace Ryujinx.HLE.OsHle.Services.Vi public long GetIndirectDisplayTransactionService(ServiceCtx Context) { - MakeObject(Context, new IHOSBinderDriver(Context.Ns.Gpu.Renderer)); + MakeObject(Context, new IHOSBinderDriver(Context.Device.Gpu.Renderer)); return 0; } @@ -174,7 +174,7 @@ namespace Ryujinx.HLE.OsHle.Services.Vi { string Name = GetDisplayName(Context); - int Handle = Context.Process.HandleTable.OpenHandle(Context.Ns.Os.VsyncEvent); + int Handle = Context.Process.HandleTable.OpenHandle(Context.Device.System.VsyncEvent); Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); diff --git a/Ryujinx.HLE/OsHle/Services/Vi/IApplicationRootService.cs b/Ryujinx.HLE/HOS/Services/Vi/IApplicationRootService.cs similarity index 90% rename from Ryujinx.HLE/OsHle/Services/Vi/IApplicationRootService.cs rename to Ryujinx.HLE/HOS/Services/Vi/IApplicationRootService.cs index 93b05156da..e86734e6e6 100644 --- a/Ryujinx.HLE/OsHle/Services/Vi/IApplicationRootService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/IApplicationRootService.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Vi +namespace Ryujinx.HLE.HOS.Services.Vi { class IApplicationRootService : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Vi/IHOSBinderDriver.cs b/Ryujinx.HLE/HOS/Services/Vi/IHOSBinderDriver.cs similarity index 94% rename from Ryujinx.HLE/OsHle/Services/Vi/IHOSBinderDriver.cs rename to Ryujinx.HLE/HOS/Services/Vi/IHOSBinderDriver.cs index 85283b75c1..bf5f20a2a1 100644 --- a/Ryujinx.HLE/OsHle/Services/Vi/IHOSBinderDriver.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/IHOSBinderDriver.cs @@ -1,11 +1,11 @@ using Ryujinx.Graphics.Gal; -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Ipc; -using Ryujinx.HLE.OsHle.Services.Android; +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; +using Ryujinx.HLE.HOS.Services.Android; using System; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Vi +namespace Ryujinx.HLE.HOS.Services.Vi { class IHOSBinderDriver : IpcService, IDisposable { diff --git a/Ryujinx.HLE/OsHle/Services/Vi/IManagerDisplayService.cs b/Ryujinx.HLE/HOS/Services/Vi/IManagerDisplayService.cs similarity index 75% rename from Ryujinx.HLE/OsHle/Services/Vi/IManagerDisplayService.cs rename to Ryujinx.HLE/HOS/Services/Vi/IManagerDisplayService.cs index d7a51b0e83..61f0ffaa51 100644 --- a/Ryujinx.HLE/OsHle/Services/Vi/IManagerDisplayService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/IManagerDisplayService.cs @@ -1,8 +1,8 @@ +using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Vi +namespace Ryujinx.HLE.HOS.Services.Vi { class IManagerDisplayService : IpcService { @@ -23,26 +23,31 @@ namespace Ryujinx.HLE.OsHle.Services.Vi public static long CreateManagedLayer(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceVi, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceVi, "Stubbed."); + Context.ResponseData.Write(0L); //LayerId + return 0; } public long DestroyManagedLayer(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceVi, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceVi, "Stubbed."); + return 0; } public static long AddToLayerStack(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceVi, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceVi, "Stubbed."); + return 0; } public static long SetLayerVisibility(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceVi, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceVi, "Stubbed."); + return 0; } } diff --git a/Ryujinx.HLE/OsHle/Services/Vi/IManagerRootService.cs b/Ryujinx.HLE/HOS/Services/Vi/IManagerRootService.cs similarity index 90% rename from Ryujinx.HLE/OsHle/Services/Vi/IManagerRootService.cs rename to Ryujinx.HLE/HOS/Services/Vi/IManagerRootService.cs index 7c131dac87..14b8fc3c37 100644 --- a/Ryujinx.HLE/OsHle/Services/Vi/IManagerRootService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/IManagerRootService.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Vi +namespace Ryujinx.HLE.HOS.Services.Vi { class IManagerRootService : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Vi/ISystemDisplayService.cs b/Ryujinx.HLE/HOS/Services/Vi/ISystemDisplayService.cs similarity index 80% rename from Ryujinx.HLE/OsHle/Services/Vi/ISystemDisplayService.cs rename to Ryujinx.HLE/HOS/Services/Vi/ISystemDisplayService.cs index 360268b9be..5657ba69f3 100644 --- a/Ryujinx.HLE/OsHle/Services/Vi/ISystemDisplayService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/ISystemDisplayService.cs @@ -1,8 +1,8 @@ +using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Vi +namespace Ryujinx.HLE.HOS.Services.Vi { class ISystemDisplayService : IpcService { @@ -22,22 +22,26 @@ namespace Ryujinx.HLE.OsHle.Services.Vi public static long SetLayerZ(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceVi, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceVi, "Stubbed."); + return 0; } public static long SetLayerVisibility(ServiceCtx Context) { - Context.Ns.Log.PrintStub(LogClass.ServiceVi, "Stubbed."); + Context.Device.Log.PrintStub(LogClass.ServiceVi, "Stubbed."); + return 0; } public static long GetDisplayMode(ServiceCtx Context) { + //TODO: De-hardcode resolution. Context.ResponseData.Write(1280); Context.ResponseData.Write(720); Context.ResponseData.Write(60.0f); Context.ResponseData.Write(0); + return 0; } } diff --git a/Ryujinx.HLE/OsHle/Services/Vi/ISystemRootService.cs b/Ryujinx.HLE/HOS/Services/Vi/ISystemRootService.cs similarity index 90% rename from Ryujinx.HLE/OsHle/Services/Vi/ISystemRootService.cs rename to Ryujinx.HLE/HOS/Services/Vi/ISystemRootService.cs index 21581baa08..d9b7c220ba 100644 --- a/Ryujinx.HLE/OsHle/Services/Vi/ISystemRootService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/ISystemRootService.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Vi +namespace Ryujinx.HLE.HOS.Services.Vi { class ISystemRootService : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Vi/NvFlinger.cs b/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs similarity index 96% rename from Ryujinx.HLE/OsHle/Services/Vi/NvFlinger.cs rename to Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs index 04b50bb350..12c1731130 100644 --- a/Ryujinx.HLE/OsHle/Services/Vi/NvFlinger.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs @@ -1,17 +1,17 @@ using Ryujinx.Graphics.Gal; using Ryujinx.HLE.Gpu.Texture; +using Ryujinx.HLE.HOS.Kernel; +using Ryujinx.HLE.HOS.Services.Nv.NvMap; using Ryujinx.HLE.Logging; -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Services.Nv.NvMap; using System; using System.Collections.Generic; using System.IO; using System.Text; using System.Threading; -using static Ryujinx.HLE.OsHle.Services.Android.Parcel; +using static Ryujinx.HLE.HOS.Services.Android.Parcel; -namespace Ryujinx.HLE.OsHle.Services.Android +namespace Ryujinx.HLE.HOS.Services.Android { class NvFlinger : IDisposable { @@ -113,7 +113,7 @@ namespace Ryujinx.HLE.OsHle.Services.Android if (Commands.TryGetValue((InterfaceName, Code), out ServiceProcessParcel ProcReq)) { - Context.Ns.Log.PrintDebug(LogClass.ServiceVi, $"{InterfaceName} {ProcReq.Method.Name}"); + Context.Device.Log.PrintDebug(LogClass.ServiceVi, $"{InterfaceName} {ProcReq.Method.Name}"); return ProcReq(Context, Reader); } @@ -164,7 +164,7 @@ namespace Ryujinx.HLE.OsHle.Services.Android private long GbpQueueBuffer(ServiceCtx Context, BinaryReader ParcelReader) { - Context.Ns.Statistics.RecordGameFrameTime(); + Context.Device.Statistics.RecordGameFrameTime(); //TODO: Errors. int Slot = ParcelReader.ReadInt32(); @@ -307,7 +307,7 @@ namespace Ryujinx.HLE.OsHle.Services.Android //TODO: Support double buffering here aswell, it is broken for GPU //frame buffers because it seems to be completely out of sync. - if (Context.Ns.Gpu.Engine3d.IsFrameBufferPosition(FbAddr)) + if (Context.Device.Gpu.Engine3d.IsFrameBufferPosition(FbAddr)) { //Frame buffer is rendered to by the GPU, we can just //bind the frame buffer texture, it's not necessary to read anything. @@ -324,7 +324,7 @@ namespace Ryujinx.HLE.OsHle.Services.Android Renderer.QueueAction(() => Renderer.FrameBuffer.Set(Data, FbWidth, FbHeight)); } - Context.Ns.Gpu.Renderer.QueueAction(() => ReleaseBuffer(Slot)); + Context.Device.Gpu.Renderer.QueueAction(() => ReleaseBuffer(Slot)); } private void ReleaseBuffer(int Slot) diff --git a/Ryujinx.HLE/OsHle/Services/Vi/Parcel.cs b/Ryujinx.HLE/HOS/Services/Vi/Parcel.cs similarity index 97% rename from Ryujinx.HLE/OsHle/Services/Vi/Parcel.cs rename to Ryujinx.HLE/HOS/Services/Vi/Parcel.cs index 009ed8c127..bb84279597 100644 --- a/Ryujinx.HLE/OsHle/Services/Vi/Parcel.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/Parcel.cs @@ -1,7 +1,7 @@ using System; using System.IO; -namespace Ryujinx.HLE.OsHle.Services.Android +namespace Ryujinx.HLE.HOS.Services.Android { static class Parcel { diff --git a/Ryujinx.HLE/OsHle/SystemState/AppletStateMgr.cs b/Ryujinx.HLE/HOS/SystemState/AppletStateMgr.cs similarity index 92% rename from Ryujinx.HLE/OsHle/SystemState/AppletStateMgr.cs rename to Ryujinx.HLE/HOS/SystemState/AppletStateMgr.cs index a656d2187e..ee0e6fea3c 100644 --- a/Ryujinx.HLE/OsHle/SystemState/AppletStateMgr.cs +++ b/Ryujinx.HLE/HOS/SystemState/AppletStateMgr.cs @@ -1,9 +1,9 @@ -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Services.Am; +using Ryujinx.HLE.HOS.Kernel; +using Ryujinx.HLE.HOS.Services.Am; using System; using System.Collections.Concurrent; -namespace Ryujinx.HLE.OsHle.SystemState +namespace Ryujinx.HLE.HOS.SystemState { class AppletStateMgr : IDisposable { diff --git a/Ryujinx.HLE/OsHle/SystemState/ColorSet.cs b/Ryujinx.HLE/HOS/SystemState/ColorSet.cs similarity index 68% rename from Ryujinx.HLE/OsHle/SystemState/ColorSet.cs rename to Ryujinx.HLE/HOS/SystemState/ColorSet.cs index adcdf00dd2..4d7a7e2f0d 100644 --- a/Ryujinx.HLE/OsHle/SystemState/ColorSet.cs +++ b/Ryujinx.HLE/HOS/SystemState/ColorSet.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.SystemState +namespace Ryujinx.HLE.HOS.SystemState { public enum ColorSet { diff --git a/Ryujinx.HLE/OsHle/SystemState/OpenCloseState.cs b/Ryujinx.HLE/HOS/SystemState/OpenCloseState.cs similarity index 65% rename from Ryujinx.HLE/OsHle/SystemState/OpenCloseState.cs rename to Ryujinx.HLE/HOS/SystemState/OpenCloseState.cs index c43a260fef..a2678b5c02 100644 --- a/Ryujinx.HLE/OsHle/SystemState/OpenCloseState.cs +++ b/Ryujinx.HLE/HOS/SystemState/OpenCloseState.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.SystemState +namespace Ryujinx.HLE.HOS.SystemState { public enum OpenCloseState { diff --git a/Ryujinx.HLE/OsHle/SystemState/SystemLanguage.cs b/Ryujinx.HLE/HOS/SystemState/SystemLanguage.cs similarity index 90% rename from Ryujinx.HLE/OsHle/SystemState/SystemLanguage.cs rename to Ryujinx.HLE/HOS/SystemState/SystemLanguage.cs index 946d0a3b18..2046ed62f5 100644 --- a/Ryujinx.HLE/OsHle/SystemState/SystemLanguage.cs +++ b/Ryujinx.HLE/HOS/SystemState/SystemLanguage.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.SystemState +namespace Ryujinx.HLE.HOS.SystemState { public enum SystemLanguage { diff --git a/Ryujinx.HLE/OsHle/SystemState/SystemStateMgr.cs b/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs similarity index 98% rename from Ryujinx.HLE/OsHle/SystemState/SystemStateMgr.cs rename to Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs index bf0c0efb97..bd1dbd78d6 100644 --- a/Ryujinx.HLE/OsHle/SystemState/SystemStateMgr.cs +++ b/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs @@ -3,7 +3,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; -namespace Ryujinx.HLE.OsHle.SystemState +namespace Ryujinx.HLE.HOS.SystemState { public class SystemStateMgr { diff --git a/Ryujinx.HLE/OsHle/SystemState/UserId.cs b/Ryujinx.HLE/HOS/SystemState/UserId.cs similarity index 96% rename from Ryujinx.HLE/OsHle/SystemState/UserId.cs rename to Ryujinx.HLE/HOS/SystemState/UserId.cs index 278ea9f772..1e7c53dd00 100644 --- a/Ryujinx.HLE/OsHle/SystemState/UserId.cs +++ b/Ryujinx.HLE/HOS/SystemState/UserId.cs @@ -1,9 +1,9 @@ -using Ryujinx.HLE.OsHle.Utilities; +using Ryujinx.HLE.Utilities; using System; using System.IO; using System.Linq; -namespace Ryujinx.HLE.OsHle.SystemState +namespace Ryujinx.HLE.HOS.SystemState { public struct UserId { diff --git a/Ryujinx.HLE/OsHle/SystemState/UserProfile.cs b/Ryujinx.HLE/HOS/SystemState/UserProfile.cs similarity index 95% rename from Ryujinx.HLE/OsHle/SystemState/UserProfile.cs rename to Ryujinx.HLE/HOS/SystemState/UserProfile.cs index b5b52339e1..63852cdf4f 100644 --- a/Ryujinx.HLE/OsHle/SystemState/UserProfile.cs +++ b/Ryujinx.HLE/HOS/SystemState/UserProfile.cs @@ -1,6 +1,6 @@ using System; -namespace Ryujinx.HLE.OsHle.SystemState +namespace Ryujinx.HLE.HOS.SystemState { class UserProfile { diff --git a/Ryujinx.HLE/Hid/Hid.cs b/Ryujinx.HLE/Hid/Hid.cs index 492eb30a86..0353b3baec 100644 --- a/Ryujinx.HLE/Hid/Hid.cs +++ b/Ryujinx.HLE/Hid/Hid.cs @@ -1,4 +1,4 @@ -using Ryujinx.HLE.OsHle; +using Ryujinx.HLE.HOS; using System; namespace Ryujinx.HLE.Input diff --git a/Ryujinx.HLE/Loaders/Executable.cs b/Ryujinx.HLE/Loaders/Executable.cs index ba5f8d7ed2..6a3f0b9735 100644 --- a/Ryujinx.HLE/Loaders/Executable.cs +++ b/Ryujinx.HLE/Loaders/Executable.cs @@ -1,8 +1,8 @@ using ChocolArm64.Memory; +using Ryujinx.HLE.HOS; +using Ryujinx.HLE.HOS.Kernel; using Ryujinx.HLE.Loaders.Executables; -using Ryujinx.HLE.OsHle; -using Ryujinx.HLE.OsHle.Handles; -using Ryujinx.HLE.OsHle.Utilities; +using Ryujinx.HLE.Utilities; using System.Collections.Generic; using System.IO; diff --git a/Ryujinx.HLE/Loaders/Npdm/ACI0.cs b/Ryujinx.HLE/Loaders/Npdm/ACI0.cs index 47b30a3c2a..fd6fd6c3c2 100644 --- a/Ryujinx.HLE/Loaders/Npdm/ACI0.cs +++ b/Ryujinx.HLE/Loaders/Npdm/ACI0.cs @@ -1,55 +1,53 @@ -using System; +using Ryujinx.HLE.Exceptions; using System.IO; namespace Ryujinx.HLE.Loaders.Npdm { class ACI0 { - public string TitleId; + private const int ACI0Magic = 'A' << 0 | 'C' << 8 | 'I' << 16 | '0' << 24; - private int FSAccessHeaderOffset; - private int FSAccessHeaderSize; - private int ServiceAccessControlOffset; - private int ServiceAccessControlSize; - private int KernelAccessControlOffset; - private int KernelAccessControlSize; + public long TitleId { get; private set; } - public FSAccessHeader FSAccessHeader; - public ServiceAccessControl ServiceAccessControl; - public KernelAccessControl KernelAccessControl; + public int FsVersion { get; private set; } + public ulong FsPermissionsBitmask { get; private set; } - public const long ACI0Magic = 'A' << 0 | 'C' << 8 | 'I' << 16 | '0' << 24; + public ServiceAccessControl ServiceAccessControl { get; private set; } + public KernelAccessControl KernelAccessControl { get; private set; } - public ACI0(Stream ACI0Stream, int Offset) + public ACI0(Stream Stream, int Offset) { - ACI0Stream.Seek(Offset, SeekOrigin.Begin); + Stream.Seek(Offset, SeekOrigin.Begin); - BinaryReader Reader = new BinaryReader(ACI0Stream); + BinaryReader Reader = new BinaryReader(Stream); if (Reader.ReadInt32() != ACI0Magic) { throw new InvalidNpdmException("ACI0 Stream doesn't contain ACI0 section!"); } - ACI0Stream.Seek(0x0C, SeekOrigin.Current); + Stream.Seek(0xc, SeekOrigin.Current); - byte[] TempTitleId = Reader.ReadBytes(8); - Array.Reverse(TempTitleId); - TitleId = BitConverter.ToString(TempTitleId).Replace("-", ""); + TitleId = Reader.ReadInt64(); - // Reserved (Not currently used, potentially to be used for lowest title ID in future.) - ACI0Stream.Seek(0x08, SeekOrigin.Current); + //Reserved. + Stream.Seek(8, SeekOrigin.Current); - FSAccessHeaderOffset = Reader.ReadInt32(); - FSAccessHeaderSize = Reader.ReadInt32(); - ServiceAccessControlOffset = Reader.ReadInt32(); - ServiceAccessControlSize = Reader.ReadInt32(); - KernelAccessControlOffset = Reader.ReadInt32(); - KernelAccessControlSize = Reader.ReadInt32(); + int FsAccessHeaderOffset = Reader.ReadInt32(); + int FsAccessHeaderSize = Reader.ReadInt32(); + int ServiceAccessControlOffset = Reader.ReadInt32(); + int ServiceAccessControlSize = Reader.ReadInt32(); + int KernelAccessControlOffset = Reader.ReadInt32(); + int KernelAccessControlSize = Reader.ReadInt32(); - FSAccessHeader = new FSAccessHeader(ACI0Stream, Offset + FSAccessHeaderOffset, FSAccessHeaderSize); - ServiceAccessControl = new ServiceAccessControl(ACI0Stream, Offset + ServiceAccessControlOffset, ServiceAccessControlSize); - KernelAccessControl = new KernelAccessControl(ACI0Stream, Offset + KernelAccessControlOffset, KernelAccessControlSize); + FsAccessHeader FsAccessHeader = new FsAccessHeader(Stream, Offset + FsAccessHeaderOffset, FsAccessHeaderSize); + + FsVersion = FsAccessHeader.Version; + FsPermissionsBitmask = FsAccessHeader.PermissionsBitmask; + + ServiceAccessControl = new ServiceAccessControl(Stream, Offset + ServiceAccessControlOffset, ServiceAccessControlSize); + + KernelAccessControl = new KernelAccessControl(Stream, Offset + KernelAccessControlOffset, KernelAccessControlSize); } } } diff --git a/Ryujinx.HLE/Loaders/Npdm/ACID.cs b/Ryujinx.HLE/Loaders/Npdm/ACID.cs index 09768a9283..7ead32942d 100644 --- a/Ryujinx.HLE/Loaders/Npdm/ACID.cs +++ b/Ryujinx.HLE/Loaders/Npdm/ACID.cs @@ -1,36 +1,29 @@ -using System; +using Ryujinx.HLE.Exceptions; using System.IO; namespace Ryujinx.HLE.Loaders.Npdm { class ACID { - public byte[] RSA2048Signature; - public byte[] RSA2048Modulus; - public int Unknown1; - public int Flags; + private const int ACIDMagic = 'A' << 0 | 'C' << 8 | 'I' << 16 | 'D' << 24; - public string TitleIdRangeMin; - public string TitleIdRangeMax; + public byte[] RSA2048Signature { get; private set; } + public byte[] RSA2048Modulus { get; private set; } + public int Unknown1 { get; private set; } + public int Flags { get; private set; } - private int FSAccessControlOffset; - private int FSAccessControlSize; - private int ServiceAccessControlOffset; - private int ServiceAccessControlSize; - private int KernelAccessControlOffset; - private int KernelAccessControlSize; + public long TitleIdRangeMin { get; private set; } + public long TitleIdRangeMax { get; private set; } - public FSAccessControl FSAccessControl; - public ServiceAccessControl ServiceAccessControl; - public KernelAccessControl KernelAccessControl; + public FsAccessControl FsAccessControl { get; private set; } + public ServiceAccessControl ServiceAccessControl { get; private set; } + public KernelAccessControl KernelAccessControl { get; private set; } - public const long ACIDMagic = 'A' << 0 | 'C' << 8 | 'I' << 16 | 'D' << 24; - - public ACID(Stream ACIDStream, int Offset) + public ACID(Stream Stream, int Offset) { - ACIDStream.Seek(Offset, SeekOrigin.Begin); + Stream.Seek(Offset, SeekOrigin.Begin); - BinaryReader Reader = new BinaryReader(ACIDStream); + BinaryReader Reader = new BinaryReader(Stream); RSA2048Signature = Reader.ReadBytes(0x100); RSA2048Modulus = Reader.ReadBytes(0x100); @@ -40,28 +33,29 @@ namespace Ryujinx.HLE.Loaders.Npdm throw new InvalidNpdmException("ACID Stream doesn't contain ACID section!"); } - Unknown1 = Reader.ReadInt32(); // Size field used with the above signature(?). - Reader.ReadInt32(); // Padding / Unused - Flags = Reader.ReadInt32(); // Bit0 must be 1 on retail, on devunit 0 is also allowed. Bit1 is unknown. + //Size field used with the above signature (?). + Unknown1 = Reader.ReadInt32(); - byte[] TempTitleIdRangeMin = Reader.ReadBytes(8); - Array.Reverse(TempTitleIdRangeMin); - TitleIdRangeMin = BitConverter.ToString(TempTitleIdRangeMin).Replace("-", ""); + Reader.ReadInt32(); - byte[] TempTitleIdRangeMax = Reader.ReadBytes(8); - Array.Reverse(TempTitleIdRangeMax); - TitleIdRangeMax = BitConverter.ToString(TempTitleIdRangeMax).Replace("-", ""); + //Bit0 must be 1 on retail, on devunit 0 is also allowed. Bit1 is unknown. + Flags = Reader.ReadInt32(); - FSAccessControlOffset = Reader.ReadInt32(); - FSAccessControlSize = Reader.ReadInt32(); - ServiceAccessControlOffset = Reader.ReadInt32(); - ServiceAccessControlSize = Reader.ReadInt32(); - KernelAccessControlOffset = Reader.ReadInt32(); - KernelAccessControlSize = Reader.ReadInt32(); + TitleIdRangeMin = Reader.ReadInt64(); + TitleIdRangeMax = Reader.ReadInt64(); - FSAccessControl = new FSAccessControl(ACIDStream, Offset + FSAccessControlOffset, FSAccessControlSize); - ServiceAccessControl = new ServiceAccessControl(ACIDStream, Offset + ServiceAccessControlOffset, ServiceAccessControlSize); - KernelAccessControl = new KernelAccessControl(ACIDStream, Offset + KernelAccessControlOffset, KernelAccessControlSize); + int FsAccessControlOffset = Reader.ReadInt32(); + int FsAccessControlSize = Reader.ReadInt32(); + int ServiceAccessControlOffset = Reader.ReadInt32(); + int ServiceAccessControlSize = Reader.ReadInt32(); + int KernelAccessControlOffset = Reader.ReadInt32(); + int KernelAccessControlSize = Reader.ReadInt32(); + + FsAccessControl = new FsAccessControl(Stream, Offset + FsAccessControlOffset, FsAccessControlSize); + + ServiceAccessControl = new ServiceAccessControl(Stream, Offset + ServiceAccessControlOffset, ServiceAccessControlSize); + + KernelAccessControl = new KernelAccessControl(Stream, Offset + KernelAccessControlOffset, KernelAccessControlSize); } } } diff --git a/Ryujinx.HLE/Loaders/Npdm/ApplicationType.cs b/Ryujinx.HLE/Loaders/Npdm/ApplicationType.cs new file mode 100644 index 0000000000..ad27903280 --- /dev/null +++ b/Ryujinx.HLE/Loaders/Npdm/ApplicationType.cs @@ -0,0 +1,9 @@ +namespace Ryujinx.HLE.Loaders.Npdm +{ + enum ApplicationType + { + SystemModule, + Application, + Applet + } +} diff --git a/Ryujinx.HLE/Loaders/Npdm/FSAccessControl.cs b/Ryujinx.HLE/Loaders/Npdm/FSAccessControl.cs deleted file mode 100644 index ca8eac2e76..0000000000 --- a/Ryujinx.HLE/Loaders/Npdm/FSAccessControl.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.IO; - -namespace Ryujinx.HLE.Loaders.Npdm -{ - public class FSAccessControl - { - public int Version; - public ulong PermissionsBitmask; - public int Unknown1; - public int Unknown2; - public int Unknown3; - public int Unknown4; - - public FSAccessControl(Stream FSAccessHeaderStream, int Offset, int Size) - { - FSAccessHeaderStream.Seek(Offset, SeekOrigin.Begin); - - BinaryReader Reader = new BinaryReader(FSAccessHeaderStream); - - Version = Reader.ReadInt32(); - PermissionsBitmask = Reader.ReadUInt64(); - Unknown1 = Reader.ReadInt32(); - Unknown2 = Reader.ReadInt32(); - Unknown3 = Reader.ReadInt32(); - Unknown4 = Reader.ReadInt32(); - } - } -} diff --git a/Ryujinx.HLE/Loaders/Npdm/FSAccessHeader.cs b/Ryujinx.HLE/Loaders/Npdm/FSAccessHeader.cs deleted file mode 100644 index 0ba3af7341..0000000000 --- a/Ryujinx.HLE/Loaders/Npdm/FSAccessHeader.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.IO; - -namespace Ryujinx.HLE.Loaders.Npdm -{ - public class FSAccessHeader - { - public int Version; - public ulong PermissionsBitmask; - public int DataSize; - public int ContentOwnerIDSize; - public int DataAndContentOwnerIDSize; - - public FSAccessHeader(Stream FSAccessHeaderStream, int Offset, int Size) - { - FSAccessHeaderStream.Seek(Offset, SeekOrigin.Begin); - - BinaryReader Reader = new BinaryReader(FSAccessHeaderStream); - - Version = Reader.ReadInt32(); - PermissionsBitmask = Reader.ReadUInt64(); - DataSize = Reader.ReadInt32(); - - if (DataSize != 0x1C) - { - throw new InvalidNpdmException("FSAccessHeader is corrupted!"); - } - - ContentOwnerIDSize = Reader.ReadInt32(); - DataAndContentOwnerIDSize = Reader.ReadInt32(); - - if (DataAndContentOwnerIDSize != 0x1C) - { - throw new InvalidNpdmException("ContentOwnerID section is not implemented!"); - } - } - } -} diff --git a/Ryujinx.HLE/Loaders/Npdm/FsAccessControl.cs b/Ryujinx.HLE/Loaders/Npdm/FsAccessControl.cs new file mode 100644 index 0000000000..00faf32161 --- /dev/null +++ b/Ryujinx.HLE/Loaders/Npdm/FsAccessControl.cs @@ -0,0 +1,28 @@ +using System.IO; + +namespace Ryujinx.HLE.Loaders.Npdm +{ + class FsAccessControl + { + public int Version { get; private set; } + public ulong PermissionsBitmask { get; private set; } + public int Unknown1 { get; private set; } + public int Unknown2 { get; private set; } + public int Unknown3 { get; private set; } + public int Unknown4 { get; private set; } + + public FsAccessControl(Stream Stream, int Offset, int Size) + { + Stream.Seek(Offset, SeekOrigin.Begin); + + BinaryReader Reader = new BinaryReader(Stream); + + Version = Reader.ReadInt32(); + PermissionsBitmask = Reader.ReadUInt64(); + Unknown1 = Reader.ReadInt32(); + Unknown2 = Reader.ReadInt32(); + Unknown3 = Reader.ReadInt32(); + Unknown4 = Reader.ReadInt32(); + } + } +} diff --git a/Ryujinx.HLE/Loaders/Npdm/FsAccessHeader.cs b/Ryujinx.HLE/Loaders/Npdm/FsAccessHeader.cs new file mode 100644 index 0000000000..50e823093c --- /dev/null +++ b/Ryujinx.HLE/Loaders/Npdm/FsAccessHeader.cs @@ -0,0 +1,37 @@ +using Ryujinx.HLE.Exceptions; +using System; +using System.IO; + +namespace Ryujinx.HLE.Loaders.Npdm +{ + class FsAccessHeader + { + public int Version { get; private set; } + public ulong PermissionsBitmask { get; private set; } + + public FsAccessHeader(Stream Stream, int Offset, int Size) + { + Stream.Seek(Offset, SeekOrigin.Begin); + + BinaryReader Reader = new BinaryReader(Stream); + + Version = Reader.ReadInt32(); + PermissionsBitmask = Reader.ReadUInt64(); + + int DataSize = Reader.ReadInt32(); + + if (DataSize != 0x1c) + { + throw new InvalidNpdmException("FsAccessHeader is corrupted!"); + } + + int ContentOwnerIdSize = Reader.ReadInt32(); + int DataAndContentOwnerIdSize = Reader.ReadInt32(); + + if (DataAndContentOwnerIdSize != 0x1c) + { + throw new NotImplementedException("ContentOwnerId section is not implemented!"); + } + } + } +} diff --git a/Ryujinx.HLE/Loaders/Npdm/FsPermissionBool.cs b/Ryujinx.HLE/Loaders/Npdm/FsPermissionBool.cs new file mode 100644 index 0000000000..571b7b5a80 --- /dev/null +++ b/Ryujinx.HLE/Loaders/Npdm/FsPermissionBool.cs @@ -0,0 +1,33 @@ +namespace Ryujinx.HLE.Loaders.Npdm +{ + enum FsPermissionBool : ulong + { + BisCache = 0x8000000000000080, + EraseMmc = 0x8000000000000080, + GameCardCertificate = 0x8000000000000010, + GameCardIdSet = 0x8000000000000010, + GameCardDriver = 0x8000000000000200, + GameCardAsic = 0x8000000000000200, + SaveDataCreate = 0x8000000000002020, + SaveDataDelete0 = 0x8000000000000060, + SystemSaveDataCreate0 = 0x8000000000000028, + SystemSaveDataCreate1 = 0x8000000000000020, + SaveDataDelete1 = 0x8000000000004028, + SaveDataIterators0 = 0x8000000000000060, + SaveDataIterators1 = 0x8000000000004020, + SaveThumbnails = 0x8000000000020000, + PosixTime = 0x8000000000000400, + SaveDataExtraData = 0x8000000000004060, + GlobalMode = 0x8000000000080000, + SpeedEmulation = 0x8000000000080000, + NULL = 0, + PaddingFiles = 0xC000000000800000, + SaveData_Debug = 0xC000000001000000, + SaveData_SystemManagement = 0xC000000002000000, + Unknown0x16 = 0x8000000004000000, + Unknown0x17 = 0x8000000008000000, + Unknown0x18 = 0x8000000010000000, + Unknown0x19 = 0x8000000000000800, + Unknown0x1A = 0x8000000000004020 + } +} diff --git a/Ryujinx.HLE/Loaders/Npdm/FsPermissionRw.cs b/Ryujinx.HLE/Loaders/Npdm/FsPermissionRw.cs new file mode 100644 index 0000000000..ca21279b5e --- /dev/null +++ b/Ryujinx.HLE/Loaders/Npdm/FsPermissionRw.cs @@ -0,0 +1,45 @@ +namespace Ryujinx.HLE.Loaders.Npdm +{ + enum FsPermissionRw : ulong + { + MountContentType2 = 0x8000000000000801, + MountContentType5 = 0x8000000000000801, + MountContentType3 = 0x8000000000000801, + MountContentType4 = 0x8000000000000801, + MountContentType6 = 0x8000000000000801, + MountContentType7 = 0x8000000000000801, + Unknown0x6 = 0x8000000000000000, + ContentStorageAccess = 0x8000000000000800, + ImageDirectoryAccess = 0x8000000000001000, + MountBisType28 = 0x8000000000000084, + MountBisType29 = 0x8000000000000080, + MountBisType30 = 0x8000000000008080, + MountBisType31 = 0x8000000000008080, + Unknown0xD = 0x8000000000000080, + SdCardAccess = 0xC000000000200000, + GameCardUser = 0x8000000000000010, + SaveDataAccess0 = 0x8000000000040020, + SystemSaveDataAccess0 = 0x8000000000000028, + SaveDataAccess1 = 0x8000000000000020, + SystemSaveDataAccess1 = 0x8000000000000020, + BisPartition0 = 0x8000000000010082, + BisPartition10 = 0x8000000000010080, + BisPartition20 = 0x8000000000010080, + BisPartition21 = 0x8000000000010080, + BisPartition22 = 0x8000000000010080, + BisPartition23 = 0x8000000000010080, + BisPartition24 = 0x8000000000010080, + BisPartition25 = 0x8000000000010080, + BisPartition26 = 0x8000000000000080, + BisPartition27 = 0x8000000000000084, + BisPartition28 = 0x8000000000000084, + BisPartition29 = 0x8000000000000080, + BisPartition30 = 0x8000000000000080, + BisPartition31 = 0x8000000000000080, + BisPartition32 = 0x8000000000000080, + Unknown0x23 = 0xC000000000200000, + GameCard_System = 0x8000000000000100, + MountContent_System = 0x8000000000100008, + HostAccess = 0xC000000000400000 + } +} diff --git a/Ryujinx.HLE/Loaders/Npdm/KernelAccessControl.cs b/Ryujinx.HLE/Loaders/Npdm/KernelAccessControl.cs index 46fad63e8e..0b45ebfbbd 100644 --- a/Ryujinx.HLE/Loaders/Npdm/KernelAccessControl.cs +++ b/Ryujinx.HLE/Loaders/Npdm/KernelAccessControl.cs @@ -1,79 +1,40 @@ -using System.Collections.Generic; +using Ryujinx.HLE.Exceptions; +using System; +using System.Collections.ObjectModel; using System.IO; namespace Ryujinx.HLE.Loaders.Npdm { - public class KernelAccessControlIRQ + class KernelAccessControl { - public uint IRQ0; - public uint IRQ1; - } + public ReadOnlyCollection Items; - public class KernelAccessControlMMIO - { - public ulong Address; - public ulong Size; - public bool IsRO; - public bool IsNormal; - } - - public class KernelAccessControlItems - { - public bool HasKernelFlags; - public uint LowestThreadPriority; - public uint HighestThreadPriority; - public uint LowestCpuId; - public uint HighestCpuId; - - public bool HasSVCFlags; - public int[] SVCsAllowed; - - public List NormalMMIO; - public List PageMMIO; - public List IRQ; - - public bool HasApplicationType; - public int ApplicationType; - - public bool HasKernelVersion; - public int KernelVersionRelease; - - public bool HasHandleTableSize; - public int HandleTableSize; - - public bool HasDebugFlags; - public bool AllowDebug; - public bool ForceDebug; - } - - public class KernelAccessControl - { - public KernelAccessControlItems[] Items; - - public KernelAccessControl(Stream FSAccessControlsStream, int Offset, int Size) + public KernelAccessControl(Stream Stream, int Offset, int Size) { - FSAccessControlsStream.Seek(Offset, SeekOrigin.Begin); + Stream.Seek(Offset, SeekOrigin.Begin); - BinaryReader Reader = new BinaryReader(FSAccessControlsStream); + BinaryReader Reader = new BinaryReader(Stream); - Items = new KernelAccessControlItems[Size / 4]; + KernelAccessControlItem[] Items = new KernelAccessControlItem[Size / 4]; - for (int i = 0; i < Size / 4; i++) + for (int Index = 0; Index < Size / 4; Index++) { uint Descriptor = Reader.ReadUInt32(); - if (Descriptor == 0xFFFFFFFF) //Ignore the descriptor + //Ignore the descriptor. + if (Descriptor == 0xffffffff) { continue; } - Items[i] = new KernelAccessControlItems(); + Items[Index] = new KernelAccessControlItem(); int LowBits = 0; while ((Descriptor & 1) != 0) { Descriptor >>= 1; + LowBits++; } @@ -81,128 +42,132 @@ namespace Ryujinx.HLE.Loaders.Npdm switch (LowBits) { - case 3: // Kernel flags + //Kernel flags. + case 3: { - Items[i].HasKernelFlags = true; + Items[Index].HasKernelFlags = true; - Items[i].HighestThreadPriority = Descriptor & 0x3F; - Items[i].LowestThreadPriority = (Descriptor >> 6) & 0x3F; - Items[i].LowestCpuId = (Descriptor >> 12) & 0xFF; - Items[i].HighestCpuId = (Descriptor >> 20) & 0xFF; + Items[Index].HighestThreadPriority = (Descriptor >> 0) & 0x3f; + Items[Index].LowestThreadPriority = (Descriptor >> 6) & 0x3f; + Items[Index].LowestCpuId = (Descriptor >> 12) & 0xff; + Items[Index].HighestCpuId = (Descriptor >> 20) & 0xff; break; } - case 4: // Syscall mask + //Syscall mask. + case 4: { - Items[i].HasSVCFlags = true; + Items[Index].HasSvcFlags = true; - Items[i].SVCsAllowed = new int[0x80]; + Items[Index].AllowedSvcs = new bool[0x80]; int SysCallBase = (int)(Descriptor >> 24) * 0x18; for (int SysCall = 0; SysCall < 0x18 && SysCallBase + SysCall < 0x80; SysCall++) { - Items[i].SVCsAllowed[SysCallBase + SysCall] = (int)Descriptor & 1; + Items[Index].AllowedSvcs[SysCallBase + SysCall] = (Descriptor & 1) != 0; + Descriptor >>= 1; } break; } - case 6: // Map IO/Normal - Never tested. + //Map IO/Normal. + case 6: { - KernelAccessControlMMIO TempNormalMMIO = new KernelAccessControlMMIO - { - Address = (Descriptor & 0xFFFFFF) << 12, - IsRO = (Descriptor >> 24) != 0 - }; + ulong Address = (Descriptor & 0xffffff) << 12; + bool IsRo = (Descriptor >> 24) != 0; - if (i == Size / 4 - 1) + if (Index == Size / 4 - 1) { throw new InvalidNpdmException("Invalid Kernel Access Control Descriptors!"); } Descriptor = Reader.ReadUInt32(); - if ((Descriptor & 0x7F) != 0x3F) + if ((Descriptor & 0x7f) != 0x3f) { throw new InvalidNpdmException("Invalid Kernel Access Control Descriptors!"); } Descriptor >>= 7; - TempNormalMMIO.Size = (Descriptor & 0xFFFFFF) << 12; - TempNormalMMIO.IsNormal = (Descriptor >> 24) != 0; - Items[i].NormalMMIO.Add(TempNormalMMIO); - i++; + ulong MmioSize = (Descriptor & 0xffffff) << 12; + bool IsNormal = (Descriptor >> 24) != 0; + + Items[Index].NormalMmio.Add(new KernelAccessControlMmio(Address, MmioSize, IsRo, IsNormal)); + + Index++; break; } - case 7: // Map Normal Page - Never tested. + //Map Normal Page. + case 7: { - KernelAccessControlMMIO TempPageMMIO = new KernelAccessControlMMIO - { - Address = Descriptor << 12, - Size = 0x1000, - IsRO = false, - IsNormal = false - }; + ulong Address = Descriptor << 12; - Items[i].PageMMIO.Add(TempPageMMIO); + Items[Index].PageMmio.Add(new KernelAccessControlMmio(Address, 0x1000, false, false)); break; } - case 11: // IRQ Pair - Never tested. + //IRQ Pair. + case 11: { - KernelAccessControlIRQ TempIRQ = new KernelAccessControlIRQ - { - IRQ0 = Descriptor & 0x3FF, - IRQ1 = (Descriptor >> 10) & 0x3FF - }; + Items[Index].Irq.Add(new KernelAccessControlIrq( + (Descriptor >> 0) & 0x3ff, + (Descriptor >> 10) & 0x3ff)); break; } - case 13: // App Type + //Application Type. + case 13: { - Items[i].HasApplicationType = true; - Items[i].ApplicationType = (int)Descriptor & 7; + Items[Index].HasApplicationType = true; + + Items[Index].ApplicationType = (int)Descriptor & 7; break; } - case 14: // Kernel Release Version + //Kernel Release Version. + case 14: { - Items[i].HasKernelVersion = true; + Items[Index].HasKernelVersion = true; - Items[i].KernelVersionRelease = (int)Descriptor; + Items[Index].KernelVersionRelease = (int)Descriptor; break; } - case 15: // Handle Table Size + //Handle Table Size. + case 15: { - Items[i].HasHandleTableSize = true; + Items[Index].HasHandleTableSize = true; - Items[i].HandleTableSize = (int)Descriptor; + Items[Index].HandleTableSize = (int)Descriptor; break; } - case 16: // Debug Flags + //Debug Flags. + case 16: { - Items[i].HasDebugFlags = true; + Items[Index].HasDebugFlags = true; - Items[i].AllowDebug = (Descriptor & 1) != 0; - Items[i].ForceDebug = ((Descriptor >> 1) & 1) != 0; + Items[Index].AllowDebug = ((Descriptor >> 0) & 1) != 0; + Items[Index].ForceDebug = ((Descriptor >> 1) & 1) != 0; break; } } } + + this.Items = Array.AsReadOnly(Items); } } } diff --git a/Ryujinx.HLE/Loaders/Npdm/KernelAccessControlIrq.cs b/Ryujinx.HLE/Loaders/Npdm/KernelAccessControlIrq.cs new file mode 100644 index 0000000000..636713317a --- /dev/null +++ b/Ryujinx.HLE/Loaders/Npdm/KernelAccessControlIrq.cs @@ -0,0 +1,14 @@ +namespace Ryujinx.HLE.Loaders.Npdm +{ + struct KernelAccessControlIrq + { + public uint Irq0 { get; private set; } + public uint Irq1 { get; private set; } + + public KernelAccessControlIrq(uint Irq0, uint Irq1) + { + this.Irq0 = Irq0; + this.Irq1 = Irq1; + } + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/Loaders/Npdm/KernelAccessControlMmio.cs b/Ryujinx.HLE/Loaders/Npdm/KernelAccessControlMmio.cs new file mode 100644 index 0000000000..1ec79c8870 --- /dev/null +++ b/Ryujinx.HLE/Loaders/Npdm/KernelAccessControlMmio.cs @@ -0,0 +1,22 @@ +namespace Ryujinx.HLE.Loaders.Npdm +{ + struct KernelAccessControlMmio + { + public ulong Address { get; private set; } + public ulong Size { get; private set; } + public bool IsRo { get; private set; } + public bool IsNormal { get; private set; } + + public KernelAccessControlMmio( + ulong Address, + ulong Size, + bool IsRo, + bool IsNormal) + { + this.Address = Address; + this.Size = Size; + this.IsRo = IsRo; + this.IsNormal = IsNormal; + } + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/Loaders/Npdm/KernelAccessItem.cs b/Ryujinx.HLE/Loaders/Npdm/KernelAccessItem.cs new file mode 100644 index 0000000000..42015c3ea2 --- /dev/null +++ b/Ryujinx.HLE/Loaders/Npdm/KernelAccessItem.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; + +namespace Ryujinx.HLE.Loaders.Npdm +{ + struct KernelAccessControlItem + { + public bool HasKernelFlags { get; set; } + public uint LowestThreadPriority { get; set; } + public uint HighestThreadPriority { get; set; } + public uint LowestCpuId { get; set; } + public uint HighestCpuId { get; set; } + + public bool HasSvcFlags { get; set; } + public bool[] AllowedSvcs { get; set; } + + public List NormalMmio { get; set; } + public List PageMmio { get; set; } + public List Irq { get; set; } + + public bool HasApplicationType { get; set; } + public int ApplicationType { get; set; } + + public bool HasKernelVersion { get; set; } + public int KernelVersionRelease { get; set; } + + public bool HasHandleTableSize { get; set; } + public int HandleTableSize { get; set; } + + public bool HasDebugFlags { get; set; } + public bool AllowDebug { get; set; } + public bool ForceDebug { get; set; } + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/Loaders/Npdm/Npdm.cs b/Ryujinx.HLE/Loaders/Npdm/Npdm.cs index eaa662f03b..8aacfd99ef 100644 --- a/Ryujinx.HLE/Loaders/Npdm/Npdm.cs +++ b/Ryujinx.HLE/Loaders/Npdm/Npdm.cs @@ -1,4 +1,5 @@ -using Ryujinx.HLE.OsHle.Utilities; +using Ryujinx.HLE.Exceptions; +using Ryujinx.HLE.Utilities; using System.IO; using System.Text; @@ -9,77 +10,69 @@ namespace Ryujinx.HLE.Loaders.Npdm //http://switchbrew.org/index.php?title=NPDM class Npdm { - public bool Is64Bits; - public int AddressSpaceWidth; - public byte MainThreadPriority; - public byte DefaultCpuId; - public int SystemResourceSize; - public int ProcessCategory; - public int MainEntrypointStackSize; - public string TitleName; - public byte[] ProductCode; - public ulong FSPerms; + private const int MetaMagic = 'M' << 0 | 'E' << 8 | 'T' << 16 | 'A' << 24; - private int ACI0Offset; - private int ACI0Size; - private int ACIDOffset; - private int ACIDSize; + public bool Is64Bits { get; private set; } + public int AddressSpaceWidth { get; private set; } + public byte MainThreadPriority { get; private set; } + public byte DefaultCpuId { get; private set; } + public int SystemResourceSize { get; private set; } + public int ProcessCategory { get; private set; } + public int MainEntrypointStackSize { get; private set; } + public string TitleName { get; private set; } + public byte[] ProductCode { get; private set; } - public ACI0 ACI0; - public ACID ACID; + public ACI0 ACI0 { get; private set; } + public ACID ACID { get; private set; } - public const long NpdmMagic = 'M' << 0 | 'E' << 8 | 'T' << 16 | 'A' << 24; - - public Npdm(Stream NPDMStream) + public Npdm(Stream Stream) { - BinaryReader Reader = new BinaryReader(NPDMStream); + BinaryReader Reader = new BinaryReader(Stream); - if (Reader.ReadInt32() != NpdmMagic) + if (Reader.ReadInt32() != MetaMagic) { throw new InvalidNpdmException("NPDM Stream doesn't contain NPDM file!"); } - Reader.ReadInt64(); // Padding / Unused + Reader.ReadInt64(); + + //MmuFlags, bit0: 64-bit instructions, bits1-3: address space width (1=64-bit, 2=32-bit). Needs to be <= 0xF. + byte MmuFlags = Reader.ReadByte(); - // MmuFlags, bit0: 64-bit instructions, bits1-3: address space width (1=64-bit, 2=32-bit). Needs to be <= 0xF - byte MmuFlags = Reader.ReadByte(); Is64Bits = (MmuFlags & 1) != 0; AddressSpaceWidth = (MmuFlags >> 1) & 7; - Reader.ReadByte(); // Padding / Unused + Reader.ReadByte(); - MainThreadPriority = Reader.ReadByte(); // (0-63) + MainThreadPriority = Reader.ReadByte(); //(0-63). DefaultCpuId = Reader.ReadByte(); - Reader.ReadInt32(); // Padding / Unused + Reader.ReadInt32(); - // System resource size (max size as of 5.x: 534773760). Unknown usage. + //System resource size (max size as of 5.x: 534773760). SystemResourceSize = EndianSwap.Swap32(Reader.ReadInt32()); - // ProcessCategory (0: regular title, 1: kernel built-in). Should be 0 here. + //ProcessCategory (0: regular title, 1: kernel built-in). Should be 0 here. ProcessCategory = EndianSwap.Swap32(Reader.ReadInt32()); - // Main entrypoint stack size - // (Should(?) be page-aligned. In non-nspwn scenarios, values of 0 can also rarely break in Horizon. - // This might be something auto-adapting or a security feature of some sort ?) + //Main entrypoint stack size. MainEntrypointStackSize = Reader.ReadInt32(); byte[] TempTitleName = Reader.ReadBytes(0x10); - TitleName = Encoding.UTF8.GetString(TempTitleName, 0, TempTitleName.Length).Trim('\0'); - ProductCode = Reader.ReadBytes(0x10); // Unknown value + TitleName = Encoding.UTF8.GetString(TempTitleName, 0, TempTitleName.Length).Trim('\0'); - NPDMStream.Seek(0x30, SeekOrigin.Current); // Skip reserved bytes + ProductCode = Reader.ReadBytes(0x10); - ACI0Offset = Reader.ReadInt32(); - ACI0Size = Reader.ReadInt32(); - ACIDOffset = Reader.ReadInt32(); - ACIDSize = Reader.ReadInt32(); + Stream.Seek(0x30, SeekOrigin.Current); - ACI0 = new ACI0(NPDMStream, ACI0Offset); - ACID = new ACID(NPDMStream, ACIDOffset); + int ACI0Offset = Reader.ReadInt32(); + int ACI0Size = Reader.ReadInt32(); + int ACIDOffset = Reader.ReadInt32(); + int ACIDSize = Reader.ReadInt32(); - FSPerms = ACI0.FSAccessHeader.PermissionsBitmask & ACID.FSAccessControl.PermissionsBitmask; + ACI0 = new ACI0(Stream, ACI0Offset); + ACID = new ACID(Stream, ACIDOffset); } } } diff --git a/Ryujinx.HLE/Loaders/Npdm/NpdmInfo.cs b/Ryujinx.HLE/Loaders/Npdm/NpdmInfo.cs deleted file mode 100644 index 72e6b3e254..0000000000 --- a/Ryujinx.HLE/Loaders/Npdm/NpdmInfo.cs +++ /dev/null @@ -1,215 +0,0 @@ -namespace Ryujinx.HLE.Loaders.Npdm -{ - enum FSPermissionRW : ulong - { - MountContentType2 = 0x8000000000000801, - MountContentType5 = 0x8000000000000801, - MountContentType3 = 0x8000000000000801, - MountContentType4 = 0x8000000000000801, - MountContentType6 = 0x8000000000000801, - MountContentType7 = 0x8000000000000801, - Unknown0x6 = 0x8000000000000000, - ContentStorageAccess = 0x8000000000000800, - ImageDirectoryAccess = 0x8000000000001000, - MountBisType28 = 0x8000000000000084, - MountBisType29 = 0x8000000000000080, - MountBisType30 = 0x8000000000008080, - MountBisType31 = 0x8000000000008080, - Unknown0xD = 0x8000000000000080, - SdCardAccess = 0xC000000000200000, - GameCardUser = 0x8000000000000010, - SaveDataAccess0 = 0x8000000000040020, - SystemSaveDataAccess0 = 0x8000000000000028, - SaveDataAccess1 = 0x8000000000000020, - SystemSaveDataAccess1 = 0x8000000000000020, - BisPartition0 = 0x8000000000010082, - BisPartition10 = 0x8000000000010080, - BisPartition20 = 0x8000000000010080, - BisPartition21 = 0x8000000000010080, - BisPartition22 = 0x8000000000010080, - BisPartition23 = 0x8000000000010080, - BisPartition24 = 0x8000000000010080, - BisPartition25 = 0x8000000000010080, - BisPartition26 = 0x8000000000000080, - BisPartition27 = 0x8000000000000084, - BisPartition28 = 0x8000000000000084, - BisPartition29 = 0x8000000000000080, - BisPartition30 = 0x8000000000000080, - BisPartition31 = 0x8000000000000080, - BisPartition32 = 0x8000000000000080, - Unknown0x23 = 0xC000000000200000, - GameCard_System = 0x8000000000000100, - MountContent_System = 0x8000000000100008, - HostAccess = 0xC000000000400000 - }; - - enum FSPermissionBool : ulong - { - BisCache = 0x8000000000000080, - EraseMmc = 0x8000000000000080, - GameCardCertificate = 0x8000000000000010, - GameCardIdSet = 0x8000000000000010, - GameCardDriver = 0x8000000000000200, - GameCardAsic = 0x8000000000000200, - SaveDataCreate = 0x8000000000002020, - SaveDataDelete0 = 0x8000000000000060, - SystemSaveDataCreate0 = 0x8000000000000028, - SystemSaveDataCreate1 = 0x8000000000000020, - SaveDataDelete1 = 0x8000000000004028, - SaveDataIterators0 = 0x8000000000000060, - SaveDataIterators1 = 0x8000000000004020, - SaveThumbnails = 0x8000000000020000, - PosixTime = 0x8000000000000400, - SaveDataExtraData = 0x8000000000004060, - GlobalMode = 0x8000000000080000, - SpeedEmulation = 0x8000000000080000, - NULL = 0, - PaddingFiles = 0xC000000000800000, - SaveData_Debug = 0xC000000001000000, - SaveData_SystemManagement = 0xC000000002000000, - Unknown0x16 = 0x8000000004000000, - Unknown0x17 = 0x8000000008000000, - Unknown0x18 = 0x8000000010000000, - Unknown0x19 = 0x8000000000000800, - Unknown0x1A = 0x8000000000004020 - } - - enum NpdmApplicationType - { - SystemModule, - Application, - Applet - } - - enum SvcName - { - svcUnknown0, - svcSetHeapSize, - svcSetMemoryPermission, - svcSetMemoryAttribute, - svcMapMemory, - svcUnmapMemory, - svcQueryMemory, - svcExitProcess, - svcCreateThread, - svcStartThread, - svcExitThread, - svcSleepThread, - svcGetThreadPriority, - svcSetThreadPriority, - svcGetThreadCoreMask, - svcSetThreadCoreMask, - svcGetCurrentProcessorNumber, - svcSignalEvent, - svcClearEvent, - svcMapSharedMemory, - svcUnmapSharedMemory, - svcCreateTransferMemory, - svcCloseHandle, - svcResetSignal, - svcWaitSynchronization, - svcCancelSynchronization, - svcArbitrateLock, - svcArbitrateUnlock, - svcWaitProcessWideKeyAtomic, - svcSignalProcessWideKey, - svcGetSystemTick, - svcConnectToNamedPort, - svcSendSyncRequestLight, - svcSendSyncRequest, - svcSendSyncRequestWithUserBuffer, - svcSendAsyncRequestWithUserBuffer, - svcGetProcessId, - svcGetThreadId, - svcBreak, - svcOutputDebugString, - svcReturnFromException, - svcGetInfo, - svcFlushEntireDataCache, - svcFlushDataCache, - svcMapPhysicalMemory, - svcUnmapPhysicalMemory, - svcGetFutureThreadInfo, - svcGetLastThreadInfo, - svcGetResourceLimitLimitValue, - svcGetResourceLimitCurrentValue, - svcSetThreadActivity, - svcGetThreadContext3, - svcWaitForAddress, - svcSignalToAddress, - svcUnknown1, - svcUnknown2, - svcUnknown3, - svcUnknown4, - svcUnknown5, - svcUnknown6, - svcDumpInfo, - svcDumpInfoNew, - svcUnknown7, - svcUnknown8, - svcCreateSession, - svcAcceptSession, - svcReplyAndReceiveLight, - svcReplyAndReceive, - svcReplyAndReceiveWithUserBuffer, - svcCreateEvent, - svcUnknown9, - svcUnknown10, - svcMapPhysicalMemoryUnsafe, - svcUnmapPhysicalMemoryUnsafe, - svcSetUnsafeLimit, - svcCreateCodeMemory, - svcControlCodeMemory, - svcSleepSystem, - svcReadWriteRegister, - svcSetProcessActivity, - svcCreateSharedMemory, - svcMapTransferMemory, - svcUnmapTransferMemory, - svcCreateInterruptEvent, - svcQueryPhysicalAddress, - svcQueryIoMapping, - svcCreateDeviceAddressSpace, - svcAttachDeviceAddressSpace, - svcDetachDeviceAddressSpace, - svcMapDeviceAddressSpaceByForce, - svcMapDeviceAddressSpaceAligned, - svcMapDeviceAddressSpace, - svcUnmapDeviceAddressSpace, - svcInvalidateProcessDataCache, - svcStoreProcessDataCache, - svcFlushProcessDataCache, - svcDebugActiveProcess, - svcBreakDebugProcess, - svcTerminateDebugProcess, - svcGetDebugEvent, - svcContinueDebugEvent, - svcGetProcessList, - svcGetThreadList, - svcGetDebugThreadContext, - svcSetDebugThreadContext, - svcQueryDebugProcessMemory, - svcReadDebugProcessMemory, - svcWriteDebugProcessMemory, - svcSetHardwareBreakPoint, - svcGetDebugThreadParam, - svcUnknown11, - svcGetSystemInfo, - svcCreatePort, - svcManageNamedPort, - svcConnectToPort, - svcSetProcessMemoryPermission, - svcMapProcessMemory, - svcUnmapProcessMemory, - svcQueryProcessMemory, - svcMapProcessCodeMemory, - svcUnmapProcessCodeMemory, - svcCreateProcess, - svcStartProcess, - svcTerminateProcess, - svcGetProcessInfo, - svcCreateResourceLimit, - svcSetResourceLimitLimitValue, - svcCallSecureMonitor - }; -} diff --git a/Ryujinx.HLE/Loaders/Npdm/ServiceAccessControl.cs b/Ryujinx.HLE/Loaders/Npdm/ServiceAccessControl.cs index ddd7d7ed2b..910eacb38b 100644 --- a/Ryujinx.HLE/Loaders/Npdm/ServiceAccessControl.cs +++ b/Ryujinx.HLE/Loaders/Npdm/ServiceAccessControl.cs @@ -1,34 +1,42 @@ using System.Collections.Generic; +using System.Collections.ObjectModel; using System.IO; using System.Text; namespace Ryujinx.HLE.Loaders.Npdm { - public class ServiceAccessControl + class ServiceAccessControl { - public List<(string, bool)> Services = new List<(string, bool)>(); + public IReadOnlyDictionary Services { get; private set; } - public ServiceAccessControl(Stream ServiceAccessControlStream, int Offset, int Size) + public ServiceAccessControl(Stream Stream, int Offset, int Size) { - ServiceAccessControlStream.Seek(Offset, SeekOrigin.Begin); + Stream.Seek(Offset, SeekOrigin.Begin); - BinaryReader Reader = new BinaryReader(ServiceAccessControlStream); + BinaryReader Reader = new BinaryReader(Stream); int ByteReaded = 0; + Dictionary Services = new Dictionary(); + while (ByteReaded != Size) { byte ControlByte = Reader.ReadByte(); - if (ControlByte == 0x00) break; + if (ControlByte == 0) + { + break; + } - int Length = ((ControlByte & 0x07)) + 1; - bool RegisterAllowed = ((ControlByte & 0x80) != 0); + int Length = ((ControlByte & 0x07)) + 1; + bool RegisterAllowed = ((ControlByte & 0x80) != 0); - Services.Add((Encoding.ASCII.GetString(Reader.ReadBytes(Length), 0, Length), RegisterAllowed)); + Services.Add(Encoding.ASCII.GetString(Reader.ReadBytes(Length), 0, Length), RegisterAllowed); ByteReaded += Length + 1; } + + this.Services = new ReadOnlyDictionary(Services); } } } diff --git a/Ryujinx.HLE/Loaders/Npdm/SvcName.cs b/Ryujinx.HLE/Loaders/Npdm/SvcName.cs new file mode 100644 index 0000000000..e519e05ec0 --- /dev/null +++ b/Ryujinx.HLE/Loaders/Npdm/SvcName.cs @@ -0,0 +1,134 @@ +namespace Ryujinx.HLE.Loaders.Npdm +{ + enum SvcName + { + Reserved0, + SetHeapSize, + SetMemoryPermission, + SetMemoryAttribute, + MapMemory, + UnmapMemory, + QueryMemory, + ExitProcess, + CreateThread, + StartThread, + ExitThread, + SleepThread, + GetThreadPriority, + SetThreadPriority, + GetThreadCoreMask, + SetThreadCoreMask, + GetCurrentProcessorNumber, + SignalEvent, + ClearEvent, + MapSharedMemory, + UnmapSharedMemory, + CreateTransferMemory, + CloseHandle, + ResetSignal, + WaitSynchronization, + CancelSynchronization, + ArbitrateLock, + ArbitrateUnlock, + WaitProcessWideKeyAtomic, + SignalProcessWideKey, + GetSystemTick, + ConnectToNamedPort, + SendSyncRequestLight, + SendSyncRequest, + SendSyncRequestWithUserBuffer, + SendAsyncRequestWithUserBuffer, + GetProcessId, + GetThreadId, + Break, + OutputDebugString, + ReturnFromException, + GetInfo, + FlushEntireDataCache, + FlushDataCache, + MapPhysicalMemory, + UnmapPhysicalMemory, + GetFutureThreadInfo, + GetLastThreadInfo, + GetResourceLimitLimitValue, + GetResourceLimitCurrentValue, + SetThreadActivity, + GetThreadContext3, + WaitForAddress, + SignalToAddress, + Reserved1, + Reserved2, + Reserved3, + Reserved4, + Reserved5, + Reserved6, + DumpInfo, + DumpInfoNew, + Reserved7, + Reserved8, + CreateSession, + AcceptSession, + ReplyAndReceiveLight, + ReplyAndReceive, + ReplyAndReceiveWithUserBuffer, + CreateEvent, + Reserved9, + Reserved10, + MapPhysicalMemoryUnsafe, + UnmapPhysicalMemoryUnsafe, + SetUnsafeLimit, + CreateCodeMemory, + ControlCodeMemory, + SleepSystem, + ReadWriteRegister, + SetProcessActivity, + CreateSharedMemory, + MapTransferMemory, + UnmapTransferMemory, + CreateInterruptEvent, + QueryPhysicalAddress, + QueryIoMapping, + CreateDeviceAddressSpace, + AttachDeviceAddressSpace, + DetachDeviceAddressSpace, + MapDeviceAddressSpaceByForce, + MapDeviceAddressSpaceAligned, + MapDeviceAddressSpace, + UnmapDeviceAddressSpace, + InvalidateProcessDataCache, + StoreProcessDataCache, + FlushProcessDataCache, + DebugActiveProcess, + BreakDebugProcess, + TerminateDebugProcess, + GetDebugEvent, + ContinueDebugEvent, + GetProcessList, + GetThreadList, + GetDebugThreadContext, + SetDebugThreadContext, + QueryDebugProcessMemory, + ReadDebugProcessMemory, + WriteDebugProcessMemory, + SetHardwareBreakPoint, + GetDebugThreadParam, + Reserved11, + GetSystemInfo, + CreatePort, + ManageNamedPort, + ConnectToPort, + SetProcessMemoryPermission, + MapProcessMemory, + UnmapProcessMemory, + QueryProcessMemory, + MapProcessCodeMemory, + UnmapProcessCodeMemory, + CreateProcess, + StartProcess, + TerminateProcess, + GetProcessInfo, + CreateResourceLimit, + SetResourceLimitLimitValue, + CallSecureMonitor + } +} diff --git a/Ryujinx.HLE/OsHle/MemoryType.cs b/Ryujinx.HLE/OsHle/MemoryType.cs deleted file mode 100644 index 64b0794729..0000000000 --- a/Ryujinx.HLE/OsHle/MemoryType.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace Ryujinx.HLE.OsHle -{ - enum MemoryType - { - Unmapped = 0, - Io = 1, - Normal = 2, - CodeStatic = 3, - CodeMutable = 4, - Heap = 5, - SharedMemory = 6, - ModCodeStatic = 8, - ModCodeMutable = 9, - IpcBuffer0 = 10, - MappedMemory = 11, - ThreadLocal = 12, - TransferMemoryIsolated = 13, - TransferMemory = 14, - ProcessMemory = 15, - Reserved = 16, - IpcBuffer1 = 17, - IpcBuffer3 = 18, - KernelStack = 19 - } -} \ No newline at end of file diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvHostChannel/NvChannelName.cs b/Ryujinx.HLE/OsHle/Services/Nv/NvHostChannel/NvChannelName.cs deleted file mode 100644 index a46a6d9874..0000000000 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvHostChannel/NvChannelName.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostChannel -{ - enum NvChannelName - { - Gpu - } -} \ No newline at end of file diff --git a/Ryujinx.HLE/Switch.cs b/Ryujinx.HLE/Switch.cs index 165922e904..03dc44e851 100644 --- a/Ryujinx.HLE/Switch.cs +++ b/Ryujinx.HLE/Switch.cs @@ -1,10 +1,10 @@ using Ryujinx.Audio; using Ryujinx.Graphics.Gal; using Ryujinx.HLE.Gpu; +using Ryujinx.HLE.HOS; using Ryujinx.HLE.Input; using Ryujinx.HLE.Logging; using Ryujinx.HLE.Memory; -using Ryujinx.HLE.OsHle; using System; namespace Ryujinx.HLE @@ -19,16 +19,14 @@ namespace Ryujinx.HLE internal NvGpu Gpu { get; private set; } - internal VirtualFileSystem VFs { get; private set; } + internal VirtualFileSystem FileSystem { get; private set; } - public Horizon Os { get; private set; } + public Horizon System { get; private set; } public PerformanceStatistics Statistics { get; private set; } public Hid Hid { get; private set; } - public event EventHandler Finish; - public Switch(IGalRenderer Renderer, IAalOutput AudioOut) { if (Renderer == null) @@ -49,23 +47,23 @@ namespace Ryujinx.HLE Gpu = new NvGpu(Renderer); - VFs = new VirtualFileSystem(); + FileSystem = new VirtualFileSystem(); - Os = new Horizon(this); + System = new Horizon(this); Statistics = new PerformanceStatistics(); - Hid = new Hid(this, Os.HidSharedMem.PA); + Hid = new Hid(this, System.HidSharedMem.PA); } public void LoadCart(string ExeFsDir, string RomFsFile = null) { - Os.LoadCart(ExeFsDir, RomFsFile); + System.LoadCart(ExeFsDir, RomFsFile); } public void LoadProgram(string FileName) { - Os.LoadProgram(FileName); + System.LoadProgram(FileName); } public bool WaitFifo() @@ -78,10 +76,11 @@ namespace Ryujinx.HLE Gpu.Fifo.DispatchCalls(); } - public virtual void OnFinish(EventArgs e) + internal void Unload() { - Os.Dispose(); - Finish?.Invoke(this, e); + FileSystem.Dispose(); + + Memory.Dispose(); } public void Dispose() @@ -93,8 +92,7 @@ namespace Ryujinx.HLE { if (Disposing) { - Os.Dispose(); - VFs.Dispose(); + System.Dispose(); } } } diff --git a/Ryujinx.HLE/OsHle/Utilities/EndianSwap.cs b/Ryujinx.HLE/Utilities/EndianSwap.cs similarity index 90% rename from Ryujinx.HLE/OsHle/Utilities/EndianSwap.cs rename to Ryujinx.HLE/Utilities/EndianSwap.cs index 46a2edcb6c..d773516d35 100644 --- a/Ryujinx.HLE/OsHle/Utilities/EndianSwap.cs +++ b/Ryujinx.HLE/Utilities/EndianSwap.cs @@ -1,9 +1,9 @@ -namespace Ryujinx.HLE.OsHle.Utilities +namespace Ryujinx.HLE.Utilities { static class EndianSwap { public static short Swap16(short Value) => (short)(((Value >> 8) & 0xff) | (Value << 8)); - + public static int Swap32(int Value) { uint UintVal = (uint)Value; diff --git a/Ryujinx.HLE/OsHle/Utilities/IntUtils.cs b/Ryujinx.HLE/Utilities/IntUtils.cs similarity index 93% rename from Ryujinx.HLE/OsHle/Utilities/IntUtils.cs rename to Ryujinx.HLE/Utilities/IntUtils.cs index 010dbb20d1..57e9d396f3 100644 --- a/Ryujinx.HLE/OsHle/Utilities/IntUtils.cs +++ b/Ryujinx.HLE/Utilities/IntUtils.cs @@ -1,4 +1,4 @@ -namespace Ryujinx.HLE.OsHle.Utilities +namespace Ryujinx.HLE.Utilities { static class IntUtils { diff --git a/Ryujinx.HLE/OsHle/Utilities/StringUtils.cs b/Ryujinx.HLE/Utilities/StringUtils.cs similarity index 97% rename from Ryujinx.HLE/OsHle/Utilities/StringUtils.cs rename to Ryujinx.HLE/Utilities/StringUtils.cs index 90f34695c4..e8d6550ad1 100644 --- a/Ryujinx.HLE/OsHle/Utilities/StringUtils.cs +++ b/Ryujinx.HLE/Utilities/StringUtils.cs @@ -3,7 +3,7 @@ using System.Globalization; using System.Linq; using System.Text; -namespace Ryujinx.HLE.OsHle.Utilities +namespace Ryujinx.HLE.Utilities { static class StringUtils { diff --git a/Ryujinx.HLE/OsHle/Utilities/StructReader.cs b/Ryujinx.HLE/Utilities/StructReader.cs similarity index 96% rename from Ryujinx.HLE/OsHle/Utilities/StructReader.cs rename to Ryujinx.HLE/Utilities/StructReader.cs index e218288b6e..6e942a9b0d 100644 --- a/Ryujinx.HLE/OsHle/Utilities/StructReader.cs +++ b/Ryujinx.HLE/Utilities/StructReader.cs @@ -1,7 +1,7 @@ using ChocolArm64.Memory; using System.Runtime.InteropServices; -namespace Ryujinx.HLE.OsHle.Utilities +namespace Ryujinx.HLE.Utilities { class StructReader { diff --git a/Ryujinx.HLE/OsHle/Utilities/StructWriter.cs b/Ryujinx.HLE/Utilities/StructWriter.cs similarity index 93% rename from Ryujinx.HLE/OsHle/Utilities/StructWriter.cs rename to Ryujinx.HLE/Utilities/StructWriter.cs index 7daa95fb63..8b88105c6a 100644 --- a/Ryujinx.HLE/OsHle/Utilities/StructWriter.cs +++ b/Ryujinx.HLE/Utilities/StructWriter.cs @@ -1,7 +1,7 @@ using ChocolArm64.Memory; using System.Runtime.InteropServices; -namespace Ryujinx.HLE.OsHle.Utilities +namespace Ryujinx.HLE.Utilities { class StructWriter { diff --git a/Ryujinx/Config.cs b/Ryujinx/Config.cs index ec0f05b799..2c02c50f19 100644 --- a/Ryujinx/Config.cs +++ b/Ryujinx/Config.cs @@ -31,7 +31,7 @@ namespace Ryujinx Device.Log.SetEnable(LogLevel.Warning, Convert.ToBoolean(Parser.Value("Logging_Enable_Warn"))); Device.Log.SetEnable(LogLevel.Error, Convert.ToBoolean(Parser.Value("Logging_Enable_Error"))); - Device.Os.SystemState.DockedMode = Convert.ToBoolean(Parser.Value("Docked_Mode")); + Device.System.State.DockedMode = Convert.ToBoolean(Parser.Value("Docked_Mode")); string[] FilteredLogClasses = Parser.Value("Logging_Filtered_Classes").Split(',', StringSplitOptions.RemoveEmptyEntries); diff --git a/Ryujinx/Ui/GLScreen.cs b/Ryujinx/Ui/GLScreen.cs index dfc0b9a418..2c683f5efb 100644 --- a/Ryujinx/Ui/GLScreen.cs +++ b/Ryujinx/Ui/GLScreen.cs @@ -4,7 +4,6 @@ using OpenTK.Input; using Ryujinx.Graphics.Gal; using Ryujinx.HLE; using Ryujinx.HLE.Input; -using Ryujinx.UI.Input; using System; using System.Threading; @@ -19,7 +18,7 @@ namespace Ryujinx private const int TargetFPS = 60; - private Switch Ns; + private Switch Device; private IGalRenderer Renderer; @@ -35,13 +34,13 @@ namespace Ryujinx private string NewTitle; - public GLScreen(Switch Ns, IGalRenderer Renderer) + public GLScreen(Switch Device, IGalRenderer Renderer) : base(1280, 720, new GraphicsMode(), "Ryujinx", 0, DisplayDevice.Default, 3, 3, GraphicsContextFlags.ForwardCompatible) { - this.Ns = Ns; + this.Device = Device; this.Renderer = Renderer; Location = new Point( @@ -63,9 +62,9 @@ namespace Ryujinx while (Exists && !IsExiting) { - if (Ns.WaitFifo()) + if (Device.WaitFifo()) { - Ns.ProcessFrame(); + Device.ProcessFrame(); } Renderer.RunActions(); @@ -152,7 +151,7 @@ namespace Ryujinx //Controller Input CurrentButton |= Config.JoyConController.GetButtons(); - + //Keyboard has priority stick-wise if (LeftJoystickDX == 0 && LeftJoystickDY == 0) { @@ -163,7 +162,7 @@ namespace Ryujinx { (RightJoystickDX, RightJoystickDY) = Config.JoyConController.GetRightStick(); } - + LeftJoystick = new HidJoystickPosition { DX = LeftJoystickDX, @@ -226,23 +225,23 @@ namespace Ryujinx HasTouch = true; - Ns.Hid.SetTouchPoints(CurrentPoint); + Device.Hid.SetTouchPoints(CurrentPoint); } } if (!HasTouch) { - Ns.Hid.SetTouchPoints(); + Device.Hid.SetTouchPoints(); } - Ns.Hid.SetJoyconButton( + Device.Hid.SetJoyconButton( HidControllerId.CONTROLLER_HANDHELD, HidControllerLayouts.Handheld_Joined, CurrentButton, LeftJoystick, RightJoystick); - Ns.Hid.SetJoyconButton( + Device.Hid.SetJoyconButton( HidControllerId.CONTROLLER_HANDHELD, HidControllerLayouts.Main, CurrentButton, @@ -254,10 +253,10 @@ namespace Ryujinx { Renderer.FrameBuffer.Render(); - Ns.Statistics.RecordSystemFrameTime(); + Device.Statistics.RecordSystemFrameTime(); - double HostFps = Ns.Statistics.GetSystemFrameRate(); - double GameFps = Ns.Statistics.GetGameFrameRate(); + double HostFps = Device.Statistics.GetSystemFrameRate(); + double GameFps = Device.Statistics.GetGameFrameRate(); NewTitle = $"Ryujinx | Host FPS: {HostFps:0.0} | Game FPS: {GameFps:0.0}"; @@ -265,7 +264,7 @@ namespace Ryujinx SwapBuffers(); - Ns.Os.SignalVsync(); + Device.System.SignalVsync(); } protected override void OnUnload(EventArgs e) diff --git a/Ryujinx/Ui/Program.cs b/Ryujinx/Ui/Program.cs index a0de2e9fd7..7acf73a552 100644 --- a/Ryujinx/Ui/Program.cs +++ b/Ryujinx/Ui/Program.cs @@ -18,11 +18,11 @@ namespace Ryujinx IAalOutput AudioOut = new OpenALAudioOut(); - Switch Ns = new Switch(Renderer, AudioOut); + Switch Device = new Switch(Renderer, AudioOut); - Config.Read(Ns); + Config.Read(Device); - Ns.Log.Updated += ConsoleLog.PrintLog; + Device.Log.Updated += ConsoleLog.PrintLog; if (args.Length == 1) { @@ -39,20 +39,20 @@ namespace Ryujinx { Console.WriteLine("Loading as cart with RomFS."); - Ns.LoadCart(args[0], RomFsFiles[0]); + Device.LoadCart(args[0], RomFsFiles[0]); } else { Console.WriteLine("Loading as cart WITHOUT RomFS."); - Ns.LoadCart(args[0]); + Device.LoadCart(args[0]); } } else if (File.Exists(args[0])) { Console.WriteLine("Loading as homebrew."); - Ns.LoadProgram(args[0]); + Device.LoadProgram(args[0]); } } else @@ -60,18 +60,14 @@ namespace Ryujinx Console.WriteLine("Please specify the folder with the NSOs/IStorage or a NSO/NRO."); } - using (GLScreen Screen = new GLScreen(Ns, Renderer)) + using (GLScreen Screen = new GLScreen(Device, Renderer)) { - Ns.Finish += (Sender, Args) => - { - Screen.Exit(); - }; - Screen.MainLoop(); - Ns.OnFinish(EventArgs.Empty); + + Device.Dispose(); } - Environment.Exit(0); + AudioOut.Dispose(); } } }