From 521751795a1c97c0d97f6f8904a3be69b13d3a9d Mon Sep 17 00:00:00 2001 From: gdkchan Date: Thu, 16 Aug 2018 20:47:36 -0300 Subject: [PATCH] Code style fixes and nits on the HLE project (#355) * Some style fixes and nits on ITimeZoneService * Remove some unneeded usings * Remove the Ryujinx.HLE.OsHle.Handles namespace * Remove hbmenu automatic load on process exit * Rename Ns to Device, rename Os to System, rename SystemState to State * Move Exceptions and Utilities out of OsHle * Rename OsHle to HOS * Rename OsHle folder to HOS * IManagerDisplayService and ISystemDisplayService style fixes * BsdError shouldn't be public * Add a empty new line before using static * Remove unused file * Some style fixes on NPDM * Exit gracefully when the application is closed * Code style fixes on IGeneralService * Add 0x prefix on values printed as hex * Small improvements on finalization code * Move ProcessId and ThreadId out of AThreadState * Rename VFs to FileSystem * FsAccessHeader shouldn't be public. Also fix file names casing * More case changes on NPDM * Remove unused files * Move using to the correct place on NPDM * Use properties on KernelAccessControlMmio * Address PR feedback --- ChocolArm64/AThread.cs | 2 - ChocolArm64/Memory/AMemory.cs | 16 +- ChocolArm64/State/AThreadState.cs | 8 +- ChocolArm64/Translation/AILEmitterCtx.cs | 21 ++ Ryujinx.Audio/IAalOutput.cs | 4 +- Ryujinx.Audio/OpenAL/OpenALAudioOut.cs | 24 +- Ryujinx.Graphics/Gal/IGalShader.cs | 1 - Ryujinx.Graphics/Gal/OpenGL/OGLFrameBuffer.cs | 1 - Ryujinx.Graphics/Gal/OpenGL/OGLRasterizer.cs | 1 - .../Gal/OpenGL/OGLShaderProgram.cs | 1 - .../Gal/Shader/ShaderDecodeSpecial.cs | 4 +- .../GuestBrokeExecutionException.cs | 2 +- .../InvalidNpdmException.cs} | 18 +- .../UndefinedInstructionException.cs | 2 +- Ryujinx.HLE/Gpu/Texture/TextureHelper.cs | 2 +- Ryujinx.HLE/Gpu/Texture/TextureReader.cs | 2 +- Ryujinx.HLE/Gpu/Texture/TextureWriter.cs | 2 - .../{OsHle => HOS}/Diagnostics/Demangler.cs | 2 +- Ryujinx.HLE/{OsHle => HOS}/ErrorCode.cs | 2 +- Ryujinx.HLE/{OsHle => HOS}/ErrorModule.cs | 2 +- .../{OsHle => HOS}/Font/SharedFontManager.cs | 6 +- .../{OsHle => HOS}/Font/SharedFontType.cs | 2 +- .../{OsHle => HOS}/GlobalStateTable.cs | 2 +- Ryujinx.HLE/{OsHle => HOS}/Homebrew.cs | 2 +- Ryujinx.HLE/{OsHle => HOS}/Horizon.cs | 81 +++---- Ryujinx.HLE/{OsHle => HOS}/IdDictionary.cs | 2 +- Ryujinx.HLE/{OsHle => HOS}/Ipc/IpcBuffDesc.cs | 2 +- .../{OsHle => HOS}/Ipc/IpcHandleDesc.cs | 2 +- Ryujinx.HLE/{OsHle => HOS}/Ipc/IpcHandler.cs | 4 +- Ryujinx.HLE/{OsHle => HOS}/Ipc/IpcMagic.cs | 2 +- Ryujinx.HLE/{OsHle => HOS}/Ipc/IpcMessage.cs | 2 +- .../{OsHle => HOS}/Ipc/IpcMessageType.cs | 2 +- .../{OsHle => HOS}/Ipc/IpcPtrBuffDesc.cs | 2 +- .../{OsHle => HOS}/Ipc/IpcRecvListBuffDesc.cs | 2 +- .../Ipc/ServiceProcessRequest.cs | 2 +- .../{OsHle => HOS}/Kernel/AddressArbiter.cs | 27 ++- .../Kernel}/AddressSpaceType.cs | 2 +- .../{OsHle/Handles => HOS/Kernel}/KEvent.cs | 2 +- .../Handles => HOS/Kernel}/KMemoryBlock.cs | 2 +- .../Handles => HOS/Kernel}/KMemoryInfo.cs | 2 +- .../Handles => HOS/Kernel}/KMemoryManager.cs | 7 +- .../Kernel}/KProcessHandleTable.cs | 2 +- .../Kernel}/KProcessScheduler.cs | 12 +- .../{OsHle/Handles => HOS/Kernel}/KSession.cs | 4 +- .../Handles => HOS/Kernel}/KSharedMemory.cs | 2 +- .../Kernel}/KSynchronizationObject.cs | 2 +- .../{OsHle/Handles => HOS/Kernel}/KThread.cs | 8 +- .../Handles => HOS/Kernel}/KTlsPageManager.cs | 2 +- .../Handles => HOS/Kernel}/KTransferMemory.cs | 2 +- .../{OsHle => HOS}/Kernel/KernelErr.cs | 2 +- .../Handles => HOS/Kernel}/MemoryAttribute.cs | 2 +- .../Kernel}/MemoryPermission.cs | 2 +- .../Handles => HOS/Kernel}/MemoryState.cs | 2 +- .../{OsHle => HOS}/Kernel/NsTimeConverter.cs | 2 +- .../Handles => HOS/Kernel}/SchedulerThread.cs | 2 +- .../{OsHle => HOS}/Kernel/SvcHandler.cs | 15 +- .../{OsHle => HOS}/Kernel/SvcMemory.cs | 97 ++++---- .../{OsHle => HOS}/Kernel/SvcSystem.cs | 41 ++-- .../{OsHle => HOS}/Kernel/SvcThread.cs | 51 ++--- .../{OsHle => HOS}/Kernel/SvcThreadSync.cs | 91 ++++---- .../Handles => HOS/Kernel}/ThreadQueue.cs | 2 +- Ryujinx.HLE/{OsHle => HOS}/Process.cs | 137 +++++------ Ryujinx.HLE/{OsHle => HOS}/ServiceCtx.cs | 12 +- .../{OsHle => HOS}/Services/Acc/AccErr.cs | 2 +- .../Acc/IAccountServiceForApplication.cs | 25 +- .../Services/Acc/IManagerForApplication.cs | 8 +- .../{OsHle => HOS}/Services/Acc/IProfile.cs | 10 +- .../{OsHle => HOS}/Services/Am/AmErr.cs | 2 +- .../{OsHle => HOS}/Services/Am/FocusState.cs | 2 +- .../Am/IAllSystemAppletProxiesService.cs | 4 +- .../Services/Am/IApplicationCreator.cs | 4 +- .../Services/Am/IApplicationFunctions.cs | 16 +- .../Services/Am/IApplicationProxy.cs | 4 +- .../Services/Am/IApplicationProxyService.cs | 4 +- .../Services/Am/IAudioController.cs | 14 +- .../Services/Am/ICommonStateGetter.cs | 16 +- .../Services/Am/IDebugFunctions.cs | 4 +- .../Services/Am/IDisplayController.cs | 4 +- .../Services/Am/IGlobalStateController.cs | 4 +- .../Services/Am/IHomeMenuFunctions.cs | 10 +- .../Services/Am/ILibraryAppletAccessor.cs | 16 +- .../Services/Am/ILibraryAppletCreator.cs | 4 +- .../Services/Am/ISelfController.cs | 38 ++-- .../{OsHle => HOS}/Services/Am/IStorage.cs | 4 +- .../Services/Am/IStorageAccessor.cs | 4 +- .../Services/Am/ISystemAppletProxy.cs | 4 +- .../Services/Am/IWindowController.cs | 8 +- .../{OsHle => HOS}/Services/Am/MessageInfo.cs | 2 +- .../Services/Am/OperationMode.cs | 2 +- .../Services/Am/StorageHelper.cs | 2 +- .../{OsHle => HOS}/Services/Apm/IManager.cs | 4 +- .../{OsHle => HOS}/Services/Apm/ISession.cs | 6 +- .../Services/Apm/PerformanceConfiguration.cs | 2 +- .../Services/Apm/PerformanceMode.cs | 2 +- .../{OsHle => HOS}/Services/Aud/AudErr.cs | 2 +- .../Services/Aud/AudioOut/AudioOutData.cs | 2 +- .../Services/Aud/AudioOut/IAudioOut.cs | 6 +- .../Services/Aud/AudioRenderer/AudioConsts.cs | 2 +- .../Services/Aud/AudioRenderer/BehaviorIn.cs | 2 +- .../Aud/AudioRenderer/BiquadFilter.cs | 2 +- .../Aud/AudioRenderer/IAudioRenderer.cs | 14 +- .../Aud/AudioRenderer/MemoryPoolContext.cs | 2 +- .../Aud/AudioRenderer/MemoryPoolIn.cs | 2 +- .../Aud/AudioRenderer/MemoryPoolOut.cs | 2 +- .../Aud/AudioRenderer/MemoryPoolState.cs | 2 +- .../Services/Aud/AudioRenderer/PlayState.cs | 2 +- .../Services/Aud/AudioRenderer/Resampler.cs | 2 +- .../Aud/AudioRenderer/UpdateDataHeader.cs | 2 +- .../AudioRenderer/VoiceChannelResourceIn.cs | 2 +- .../Aud/AudioRenderer/VoiceContext.cs | 2 +- .../Services/Aud/AudioRenderer/VoiceIn.cs | 2 +- .../Services/Aud/AudioRenderer/VoiceOut.cs | 2 +- .../Services/Aud/AudioRenderer/WaveBuffer.cs | 2 +- .../Services/Aud/AudioRendererParameter.cs | 2 +- .../Services/Aud/IAudioDevice.cs | 34 +-- .../Services/Aud/IAudioOutManager.cs | 20 +- .../Services/Aud/IAudioRendererManager.cs | 16 +- .../Services/Aud/SampleFormat.cs | 2 +- .../Services/Bcat/IBcatService.cs | 6 +- .../Bcat/IDeliveryCacheStorageService.cs | 6 +- .../Services/Bcat/IServiceCreator.cs | 6 +- .../{OsHle => HOS}/Services/Bsd/BsdError.cs | 4 +- .../{OsHle => HOS}/Services/Bsd/BsdSocket.cs | 2 +- .../{OsHle => HOS}/Services/Bsd/IClient.cs | 6 +- .../Services/Caps/IAlbumAccessorService.cs | 4 +- .../Services/Caps/IScreenshotService.cs | 4 +- .../Services/Friend/IFriendService.cs | 10 +- .../Services/Friend/IServiceCreator.cs | 4 +- .../{OsHle => HOS}/Services/FspSrv/FsErr.cs | 2 +- .../Services/FspSrv/IDirectory.cs | 4 +- .../{OsHle => HOS}/Services/FspSrv/IFile.cs | 4 +- .../Services/FspSrv/IFileSystem.cs | 34 +-- .../Services/FspSrv/IFileSystemProxy.cs | 14 +- .../Services/FspSrv/IStorage.cs | 4 +- .../Hid/IActiveVibrationDeviceList.cs | 4 +- .../Services/Hid/IAppletResource.cs | 6 +- .../{OsHle => HOS}/Services/Hid/IHidServer.cs | 50 ++-- .../{OsHle => HOS}/Services/IIpcService.cs | 4 +- .../{OsHle => HOS}/Services/IpcService.cs | 8 +- .../{OsHle => HOS}/Services/Lm/ILogService.cs | 4 +- .../{OsHle => HOS}/Services/Lm/ILogger.cs | 14 +- .../{OsHle => HOS}/Services/Lm/LmLogField.cs | 2 +- .../{OsHle => HOS}/Services/Lm/LmLogLevel.cs | 2 +- .../{OsHle => HOS}/Services/Mm/IRequest.cs | 10 +- .../Services/Nfp/DeviceState.cs | 2 +- .../{OsHle => HOS}/Services/Nfp/IUser.cs | 22 +- .../Services/Nfp/IUserManager.cs | 4 +- .../{OsHle => HOS}/Services/Nfp/State.cs | 2 +- .../Services/Nifm/IGeneralService.cs | 22 +- .../{OsHle => HOS}/Services/Nifm/IRequest.cs | 16 +- .../Services/Nifm/IStaticService.cs | 4 +- Ryujinx.HLE/HOS/Services/Nifm/NifmErr.cs | 7 + .../Services/Ns/IAddOnContentManager.cs | 8 +- .../Services/Ns/IServiceGetterInterface.cs | 4 +- .../Services/Ns/ISystemUpdateInterface.cs | 4 +- .../Ns/IVulnerabilityManagerInterface.cs | 4 +- .../Services/Nv/INvDrvServices.cs | 22 +- .../{OsHle => HOS}/Services/Nv/NvFd.cs | 2 +- .../Services/Nv/NvGpuAS/NvGpuASAllocSpace.cs | 2 +- .../Services/Nv/NvGpuAS/NvGpuASCtx.cs | 3 +- .../Services/Nv/NvGpuAS/NvGpuASIoctl.cs | 30 +-- .../Services/Nv/NvGpuAS/NvGpuASMapBufferEx.cs | 2 +- .../Services/Nv/NvGpuAS/NvGpuASRemap.cs | 2 +- .../Services/Nv/NvGpuAS/NvGpuASUnmapBuffer.cs | 2 +- .../Nv/NvGpuGpu/NvGpuGpuGetActiveSlotMask.cs | 2 +- .../Nv/NvGpuGpu/NvGpuGpuGetCharacteristics.cs | 2 +- .../Nv/NvGpuGpu/NvGpuGpuGetTpcMasks.cs | 2 +- .../Services/Nv/NvGpuGpu/NvGpuGpuIoctl.cs | 10 +- .../Nv/NvGpuGpu/NvGpuGpuZcullGetCtxSize.cs | 2 +- .../Nv/NvGpuGpu/NvGpuGpuZcullGetInfo.cs | 2 +- .../{OsHle => HOS}/Services/Nv/NvHelper.cs | 2 +- .../Services/Nv/NvHostChannel/NvChannel.cs | 2 +- .../Nv/NvHostChannel/NvChannelName.cs | 7 + .../Nv/NvHostChannel/NvHostChannelIoctl.cs | 20 +- .../NvHostChannelSubmitGpfifo.cs | 2 +- .../Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs | 12 +- .../Nv/NvHostCtrl/NvHostCtrlSyncPtRead.cs | 2 +- .../Nv/NvHostCtrl/NvHostCtrlSyncPtWait.cs | 2 +- .../Nv/NvHostCtrl/NvHostCtrlSyncPtWaitEx.cs | 2 +- .../Nv/NvHostCtrl/NvHostCtrlUserCtx.cs | 2 +- .../Services/Nv/NvHostCtrl/NvHostEvent.cs | 2 +- .../Nv/NvHostCtrl/NvHostEventState.cs | 2 +- .../Services/Nv/NvHostCtrl/NvHostSyncPt.cs | 2 +- .../Services/Nv/NvMap/NvMapAlloc.cs | 2 +- .../Services/Nv/NvMap/NvMapCreate.cs | 2 +- .../Services/Nv/NvMap/NvMapFree.cs | 2 +- .../Services/Nv/NvMap/NvMapFromId.cs | 2 +- .../Services/Nv/NvMap/NvMapGetId.cs | 2 +- .../Services/Nv/NvMap/NvMapHandle.cs | 2 +- .../Services/Nv/NvMap/NvMapHandleParam.cs | 2 +- .../Services/Nv/NvMap/NvMapIoctl.cs | 26 +-- .../Services/Nv/NvMap/NvMapParam.cs | 2 +- .../{OsHle => HOS}/Services/Nv/NvResult.cs | 2 +- .../Services/Pctl/IParentalControlService.cs | 6 +- .../Pctl/IParentalControlServiceFactory.cs | 4 +- .../Services/Pl/ISharedFontManager.cs | 18 +- .../Services/Prepo/IPrepoService.cs | 6 +- .../{OsHle => HOS}/Services/ServiceFactory.cs | 52 ++--- .../Services/Set/ISettingsServer.cs | 8 +- .../Services/Set/ISystemSettingsServer.cs | 16 +- .../{OsHle => HOS}/Services/Set/NxSettings.cs | 2 +- .../Services/Sfdnsres/IResolver.cs | 4 +- .../Services/Sm/IUserInterface.cs | 6 +- .../Services/Spl/IRandomInterface.cs | 4 +- .../Services/Ssl/ISslService.cs | 6 +- .../Services/Time/IStaticService.cs | 4 +- .../Services/Time/ISteadyClock.cs | 4 +- .../Services/Time/ISystemClock.cs | 4 +- .../Services/Time/ITimeZoneService.cs | 63 +++-- .../Services/Time/SystemClockType.cs | 2 +- .../{OsHle => HOS}/Services/Vi/Display.cs | 2 +- .../{OsHle => HOS}/Services/Vi/GbpBuffer.cs | 2 +- .../Services/Vi/IApplicationDisplayService.cs | 12 +- .../Services/Vi/IApplicationRootService.cs | 4 +- .../Services/Vi/IHOSBinderDriver.cs | 8 +- .../Services/Vi/IManagerDisplayService.cs | 17 +- .../Services/Vi/IManagerRootService.cs | 4 +- .../Services/Vi/ISystemDisplayService.cs | 12 +- .../Services/Vi/ISystemRootService.cs | 4 +- .../{OsHle => HOS}/Services/Vi/NvFlinger.cs | 16 +- .../{OsHle => HOS}/Services/Vi/Parcel.cs | 2 +- .../SystemState/AppletStateMgr.cs | 6 +- .../{OsHle => HOS}/SystemState/ColorSet.cs | 2 +- .../SystemState/OpenCloseState.cs | 2 +- .../SystemState/SystemLanguage.cs | 2 +- .../SystemState/SystemStateMgr.cs | 2 +- .../{OsHle => HOS}/SystemState/UserId.cs | 4 +- .../{OsHle => HOS}/SystemState/UserProfile.cs | 2 +- Ryujinx.HLE/Hid/Hid.cs | 2 +- Ryujinx.HLE/Loaders/Executable.cs | 6 +- Ryujinx.HLE/Loaders/Npdm/ACI0.cs | 58 +++-- Ryujinx.HLE/Loaders/Npdm/ACID.cs | 72 +++--- Ryujinx.HLE/Loaders/Npdm/ApplicationType.cs | 9 + Ryujinx.HLE/Loaders/Npdm/FSAccessControl.cs | 28 --- Ryujinx.HLE/Loaders/Npdm/FSAccessHeader.cs | 37 --- Ryujinx.HLE/Loaders/Npdm/FsAccessControl.cs | 28 +++ Ryujinx.HLE/Loaders/Npdm/FsAccessHeader.cs | 37 +++ Ryujinx.HLE/Loaders/Npdm/FsPermissionBool.cs | 33 +++ Ryujinx.HLE/Loaders/Npdm/FsPermissionRw.cs | 45 ++++ .../Loaders/Npdm/KernelAccessControl.cs | 171 ++++++-------- .../Loaders/Npdm/KernelAccessControlIrq.cs | 14 ++ .../Loaders/Npdm/KernelAccessControlMmio.cs | 22 ++ Ryujinx.HLE/Loaders/Npdm/KernelAccessItem.cs | 33 +++ Ryujinx.HLE/Loaders/Npdm/Npdm.cs | 79 +++---- Ryujinx.HLE/Loaders/Npdm/NpdmInfo.cs | 215 ------------------ .../Loaders/Npdm/ServiceAccessControl.cs | 26 ++- Ryujinx.HLE/Loaders/Npdm/SvcName.cs | 134 +++++++++++ Ryujinx.HLE/OsHle/MemoryType.cs | 25 -- .../Nv/NvHostChannel/NvChannelName.cs | 7 - Ryujinx.HLE/Switch.cs | 28 ++- .../{OsHle => }/Utilities/EndianSwap.cs | 4 +- Ryujinx.HLE/{OsHle => }/Utilities/IntUtils.cs | 2 +- .../{OsHle => }/Utilities/StringUtils.cs | 2 +- .../{OsHle => }/Utilities/StructReader.cs | 2 +- .../{OsHle => }/Utilities/StructWriter.cs | 2 +- Ryujinx/Config.cs | 2 +- Ryujinx/Ui/GLScreen.cs | 31 ++- Ryujinx/Ui/Program.cs | 24 +- 258 files changed, 1574 insertions(+), 1546 deletions(-) rename Ryujinx.HLE/{OsHle => }/Exceptions/GuestBrokeExecutionException.cs (85%) rename Ryujinx.HLE/{Loaders/Npdm/NpdmException.cs => Exceptions/InvalidNpdmException.cs} (77%) rename Ryujinx.HLE/{OsHle => }/Exceptions/UndefinedInstructionException.cs (90%) rename Ryujinx.HLE/{OsHle => HOS}/Diagnostics/Demangler.cs (99%) rename Ryujinx.HLE/{OsHle => HOS}/ErrorCode.cs (86%) rename Ryujinx.HLE/{OsHle => HOS}/ErrorModule.cs (99%) rename Ryujinx.HLE/{OsHle => HOS}/Font/SharedFontManager.cs (96%) rename Ryujinx.HLE/{OsHle => HOS}/Font/SharedFontType.cs (88%) rename Ryujinx.HLE/{OsHle => HOS}/GlobalStateTable.cs (98%) rename Ryujinx.HLE/{OsHle => HOS}/Homebrew.cs (98%) rename Ryujinx.HLE/{OsHle => HOS}/Horizon.cs (68%) rename Ryujinx.HLE/{OsHle => HOS}/IdDictionary.cs (98%) rename Ryujinx.HLE/{OsHle => HOS}/Ipc/IpcBuffDesc.cs (95%) rename Ryujinx.HLE/{OsHle => HOS}/Ipc/IpcHandleDesc.cs (98%) rename Ryujinx.HLE/{OsHle => HOS}/Ipc/IpcHandler.cs (98%) rename Ryujinx.HLE/{OsHle => HOS}/Ipc/IpcMagic.cs (86%) rename Ryujinx.HLE/{OsHle => HOS}/Ipc/IpcMessage.cs (99%) rename Ryujinx.HLE/{OsHle => HOS}/Ipc/IpcMessageType.cs (87%) rename Ryujinx.HLE/{OsHle => HOS}/Ipc/IpcPtrBuffDesc.cs (95%) rename Ryujinx.HLE/{OsHle => HOS}/Ipc/IpcRecvListBuffDesc.cs (92%) rename Ryujinx.HLE/{OsHle => HOS}/Ipc/ServiceProcessRequest.cs (66%) rename Ryujinx.HLE/{OsHle => HOS}/Kernel/AddressArbiter.cs (93%) rename Ryujinx.HLE/{OsHle/Handles => HOS/Kernel}/AddressSpaceType.cs (81%) rename Ryujinx.HLE/{OsHle/Handles => HOS/Kernel}/KEvent.cs (57%) rename Ryujinx.HLE/{OsHle/Handles => HOS/Kernel}/KMemoryBlock.cs (97%) rename Ryujinx.HLE/{OsHle/Handles => HOS/Kernel}/KMemoryInfo.cs (96%) rename Ryujinx.HLE/{OsHle/Handles => HOS/Kernel}/KMemoryManager.cs (99%) rename Ryujinx.HLE/{OsHle/Handles => HOS/Kernel}/KProcessHandleTable.cs (94%) rename Ryujinx.HLE/{OsHle/Handles => HOS/Kernel}/KProcessScheduler.cs (96%) rename Ryujinx.HLE/{OsHle/Handles => HOS/Kernel}/KSession.cs (90%) rename Ryujinx.HLE/{OsHle/Handles => HOS/Kernel}/KSharedMemory.cs (87%) rename Ryujinx.HLE/{OsHle/Handles => HOS/Kernel}/KSynchronizationObject.cs (93%) rename Ryujinx.HLE/{OsHle/Handles => HOS/Kernel}/KThread.cs (92%) rename Ryujinx.HLE/{OsHle/Handles => HOS/Kernel}/KTlsPageManager.cs (97%) rename Ryujinx.HLE/{OsHle/Handles => HOS/Kernel}/KTransferMemory.cs (89%) rename Ryujinx.HLE/{OsHle => HOS}/Kernel/KernelErr.cs (96%) rename Ryujinx.HLE/{OsHle/Handles => HOS/Kernel}/MemoryAttribute.cs (91%) rename Ryujinx.HLE/{OsHle/Handles => HOS/Kernel}/MemoryPermission.cs (88%) rename Ryujinx.HLE/{OsHle/Handles => HOS/Kernel}/MemoryState.cs (98%) rename Ryujinx.HLE/{OsHle => HOS}/Kernel/NsTimeConverter.cs (90%) rename Ryujinx.HLE/{OsHle/Handles => HOS/Kernel}/SchedulerThread.cs (96%) rename Ryujinx.HLE/{OsHle => HOS}/Kernel/SvcHandler.cs (90%) rename Ryujinx.HLE/{OsHle => HOS}/Kernel/SvcMemory.cs (74%) rename Ryujinx.HLE/{OsHle => HOS}/Kernel/SvcSystem.cs (88%) rename Ryujinx.HLE/{OsHle => HOS}/Kernel/SvcThread.cs (85%) rename Ryujinx.HLE/{OsHle => HOS}/Kernel/SvcThreadSync.cs (79%) rename Ryujinx.HLE/{OsHle/Handles => HOS/Kernel}/ThreadQueue.cs (99%) rename Ryujinx.HLE/{OsHle => HOS}/Process.cs (79%) rename Ryujinx.HLE/{OsHle => HOS}/ServiceCtx.cs (83%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Acc/AccErr.cs (67%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Acc/IAccountServiceForApplication.cs (78%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Acc/IManagerForApplication.cs (78%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Acc/IProfile.cs (86%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/AmErr.cs (66%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/FocusState.cs (67%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/IAllSystemAppletProxiesService.cs (90%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/IApplicationCreator.cs (86%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/IApplicationFunctions.cs (83%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/IApplicationProxy.cs (96%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/IApplicationProxyService.cs (90%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/IAudioController.cs (79%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/ICommonStateGetter.cs (87%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/IDebugFunctions.cs (86%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/IDisplayController.cs (86%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/IGlobalStateController.cs (86%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/IHomeMenuFunctions.cs (81%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/ILibraryAppletAccessor.cs (78%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/ILibraryAppletCreator.cs (92%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/ISelfController.cs (78%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/IStorage.cs (90%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/IStorageAccessor.cs (96%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/ISystemAppletProxy.cs (97%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/IWindowController.cs (78%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/MessageInfo.cs (79%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/OperationMode.cs (66%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Am/StorageHelper.cs (94%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Apm/IManager.cs (89%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Apm/ISession.cs (89%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Apm/PerformanceConfiguration.cs (93%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Apm/PerformanceMode.cs (65%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/AudErr.cs (82%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/AudioOut/AudioOutData.cs (86%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/AudioOut/IAudioOut.cs (97%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/AudioRenderer/AudioConsts.cs (72%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/AudioRenderer/BehaviorIn.cs (78%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/AudioRenderer/BiquadFilter.cs (85%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/AudioRenderer/IAudioRenderer.cs (96%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/AudioRenderer/MemoryPoolContext.cs (78%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/AudioRenderer/MemoryPoolIn.cs (86%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/AudioRenderer/MemoryPoolOut.cs (82%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/AudioRenderer/MemoryPoolState.cs (80%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/AudioRenderer/PlayState.cs (65%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/AudioRenderer/Resampler.cs (99%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/AudioRenderer/UpdateDataHeader.cs (90%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/AudioRenderer/VoiceChannelResourceIn.cs (75%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/AudioRenderer/VoiceContext.cs (98%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/AudioRenderer/VoiceIn.cs (94%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/AudioRenderer/VoiceOut.cs (82%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/AudioRenderer/WaveBuffer.cs (90%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/AudioRendererParameter.cs (93%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/IAudioDevice.cs (83%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/IAudioOutManager.cs (87%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/IAudioRendererManager.cs (92%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Aud/SampleFormat.cs (82%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Bcat/IBcatService.cs (85%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Bcat/IDeliveryCacheStorageService.cs (86%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Bcat/IServiceCreator.cs (93%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Bsd/BsdError.cs (57%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Bsd/BsdSocket.cs (86%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Bsd/IClient.cs (99%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Caps/IAlbumAccessorService.cs (86%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Caps/IScreenshotService.cs (85%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Friend/IFriendService.cs (81%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Friend/IServiceCreator.cs (89%) rename Ryujinx.HLE/{OsHle => HOS}/Services/FspSrv/FsErr.cs (80%) rename Ryujinx.HLE/{OsHle => HOS}/Services/FspSrv/IDirectory.cs (97%) rename Ryujinx.HLE/{OsHle => HOS}/Services/FspSrv/IFile.cs (97%) rename Ryujinx.HLE/{OsHle => HOS}/Services/FspSrv/IFileSystem.cs (89%) rename Ryujinx.HLE/{OsHle => HOS}/Services/FspSrv/IFileSystemProxy.cs (77%) rename Ryujinx.HLE/{OsHle => HOS}/Services/FspSrv/IStorage.cs (94%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Hid/IActiveVibrationDeviceList.cs (90%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Hid/IAppletResource.cs (88%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Hid/IHidServer.cs (81%) rename Ryujinx.HLE/{OsHle => HOS}/Services/IIpcService.cs (69%) rename Ryujinx.HLE/{OsHle => HOS}/Services/IpcService.cs (95%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Lm/ILogService.cs (89%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Lm/ILogger.cs (78%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Lm/LmLogField.cs (82%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Lm/LmLogLevel.cs (73%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Mm/IRequest.cs (74%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nfp/DeviceState.cs (57%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nfp/IUser.cs (80%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nfp/IUserManager.cs (88%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nfp/State.cs (65%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nifm/IGeneralService.cs (66%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nifm/IRequest.cs (81%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nifm/IStaticService.cs (92%) create mode 100644 Ryujinx.HLE/HOS/Services/Nifm/NifmErr.cs rename Ryujinx.HLE/{OsHle => HOS}/Services/Ns/IAddOnContentManager.cs (81%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Ns/IServiceGetterInterface.cs (86%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Ns/ISystemUpdateInterface.cs (86%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Ns/IVulnerabilityManagerInterface.cs (86%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/INvDrvServices.cs (91%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvFd.cs (80%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvGpuAS/NvGpuASAllocSpace.cs (79%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvGpuAS/NvGpuASCtx.cs (98%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvGpuAS/NvGpuASIoctl.cs (88%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvGpuAS/NvGpuASMapBufferEx.cs (84%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvGpuAS/NvGpuASRemap.cs (81%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvGpuAS/NvGpuASUnmapBuffer.cs (60%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvGpuGpu/NvGpuGpuGetActiveSlotMask.cs (66%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvGpuGpu/NvGpuGpuGetCharacteristics.cs (96%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvGpuGpu/NvGpuGpuGetTpcMasks.cs (80%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvGpuGpu/NvGpuGpuIoctl.cs (94%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvGpuGpu/NvGpuGpuZcullGetCtxSize.cs (59%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvGpuGpu/NvGpuGpuZcullGetInfo.cs (89%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvHelper.cs (70%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvHostChannel/NvChannel.cs (53%) create mode 100644 Ryujinx.HLE/HOS/Services/Nv/NvHostChannel/NvChannelName.cs rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvHostChannel/NvHostChannelIoctl.cs (90%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvHostChannel/NvHostChannelSubmitGpfifo.cs (78%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs (95%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtRead.cs (65%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtWait.cs (71%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvHostCtrl/NvHostCtrlSyncPtWaitEx.cs (75%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvHostCtrl/NvHostCtrlUserCtx.cs (88%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvHostCtrl/NvHostEvent.cs (71%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvHostCtrl/NvHostEventState.cs (72%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvHostCtrl/NvHostSyncPt.cs (98%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvMap/NvMapAlloc.cs (81%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvMap/NvMapCreate.cs (66%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvMap/NvMapFree.cs (79%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvMap/NvMapFromId.cs (65%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvMap/NvMapGetId.cs (65%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvMap/NvMapHandle.cs (93%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvMap/NvMapHandleParam.cs (77%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvMap/NvMapIoctl.cs (87%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvMap/NvMapParam.cs (71%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Nv/NvResult.cs (92%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Pctl/IParentalControlService.cs (83%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Pctl/IParentalControlServiceFactory.cs (92%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Pl/ISharedFontManager.cs (88%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Prepo/IPrepoService.cs (80%) rename Ryujinx.HLE/{OsHle => HOS}/Services/ServiceFactory.cs (81%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Set/ISettingsServer.cs (91%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Set/ISystemSettingsServer.cs (87%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Set/NxSettings.cs (99%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Sfdnsres/IResolver.cs (84%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Sm/IUserInterface.cs (94%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Spl/IRandomInterface.cs (94%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Ssl/ISslService.cs (81%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Time/IStaticService.cs (96%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Time/ISteadyClock.cs (94%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Time/ISystemClock.cs (97%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Time/ITimeZoneService.cs (80%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Time/SystemClockType.cs (72%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Vi/Display.cs (80%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Vi/GbpBuffer.cs (97%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Vi/IApplicationDisplayService.cs (95%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Vi/IApplicationRootService.cs (90%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Vi/IHOSBinderDriver.cs (94%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Vi/IManagerDisplayService.cs (75%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Vi/IManagerRootService.cs (90%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Vi/ISystemDisplayService.cs (80%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Vi/ISystemRootService.cs (90%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Vi/NvFlinger.cs (96%) rename Ryujinx.HLE/{OsHle => HOS}/Services/Vi/Parcel.cs (97%) rename Ryujinx.HLE/{OsHle => HOS}/SystemState/AppletStateMgr.cs (92%) rename Ryujinx.HLE/{OsHle => HOS}/SystemState/ColorSet.cs (68%) rename Ryujinx.HLE/{OsHle => HOS}/SystemState/OpenCloseState.cs (65%) rename Ryujinx.HLE/{OsHle => HOS}/SystemState/SystemLanguage.cs (90%) rename Ryujinx.HLE/{OsHle => HOS}/SystemState/SystemStateMgr.cs (98%) rename Ryujinx.HLE/{OsHle => HOS}/SystemState/UserId.cs (96%) rename Ryujinx.HLE/{OsHle => HOS}/SystemState/UserProfile.cs (95%) create mode 100644 Ryujinx.HLE/Loaders/Npdm/ApplicationType.cs delete mode 100644 Ryujinx.HLE/Loaders/Npdm/FSAccessControl.cs delete mode 100644 Ryujinx.HLE/Loaders/Npdm/FSAccessHeader.cs create mode 100644 Ryujinx.HLE/Loaders/Npdm/FsAccessControl.cs create mode 100644 Ryujinx.HLE/Loaders/Npdm/FsAccessHeader.cs create mode 100644 Ryujinx.HLE/Loaders/Npdm/FsPermissionBool.cs create mode 100644 Ryujinx.HLE/Loaders/Npdm/FsPermissionRw.cs create mode 100644 Ryujinx.HLE/Loaders/Npdm/KernelAccessControlIrq.cs create mode 100644 Ryujinx.HLE/Loaders/Npdm/KernelAccessControlMmio.cs create mode 100644 Ryujinx.HLE/Loaders/Npdm/KernelAccessItem.cs delete mode 100644 Ryujinx.HLE/Loaders/Npdm/NpdmInfo.cs create mode 100644 Ryujinx.HLE/Loaders/Npdm/SvcName.cs delete mode 100644 Ryujinx.HLE/OsHle/MemoryType.cs delete mode 100644 Ryujinx.HLE/OsHle/Services/Nv/NvHostChannel/NvChannelName.cs rename Ryujinx.HLE/{OsHle => }/Utilities/EndianSwap.cs (90%) rename Ryujinx.HLE/{OsHle => }/Utilities/IntUtils.cs (93%) rename Ryujinx.HLE/{OsHle => }/Utilities/StringUtils.cs (97%) rename Ryujinx.HLE/{OsHle => }/Utilities/StructReader.cs (96%) rename Ryujinx.HLE/{OsHle => }/Utilities/StructWriter.cs (93%) diff --git a/ChocolArm64/AThread.cs b/ChocolArm64/AThread.cs index 4fc79d5ef..7b8360f8f 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 1b4ff6fb1..566e6b54c 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 a84e3242b..7b69d8171 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 3fa46e96d..40e33ba8e 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 e903c5c5c..1dfac377f 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 85e2d803e..80a070c9f 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 5174c0393..e906e6cdc 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 30a3de64a..62f82495c 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 080214785..b6e974545 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 c4e6a881f..c87b0d405 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 591631ff9..f1be005f9 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 2ed7f19e3..fe41b02a6 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 d87a6461d..58d044345 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 d9f0b8cf9..24bf9efdd 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 1d621c922..10a64f364 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 0c6103af8..0cf055db8 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 113dc6f61..6c3dda6be 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 6646dede6..aea979c26 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 1e07f9b24..767664f8d 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 924ee9516..5c6c9b056 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 12b6973e0..0be5e8967 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 80f42a7da..53dca6266 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 fb71e46b9..faf47b2ee 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 90c6c4c64..1f862a4ae 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 1fd210dd5..a55796752 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 dcb8d0f72..03d15498f 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 12bff0fba..346d696e3 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 609cc6e05..081b56952 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 cdb844cfe..08a4cdb5d 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 c3f9655fb..72770b90e 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 0a64a1642..c8153fdb4 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 3db6844e0..e258accc9 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 f5a9f651e..21f5d3bcd 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 59191c165..1d0a8c807 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 47f72cb70..da4a7e75a 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 ce9ef0cd8..d7df0a727 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 946c51e1d..c97caf42a 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 df5108f98..eaaafaba3 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 e33b6cb9b..6100741b5 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 3f79f000d..9b73b32b1 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 76c5a53de..0432aa880 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 d22b63c68..db0eaa44f 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 7d5e22846..2120f16c8 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 e85de36c8..4b21d3a63 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 5c4104747..cdd31667b 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 0e7d06f6d..b83b00047 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 2b980d17b..171fefc51 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 f116f5489..1fb2ce6ad 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 5f9c04094..6ebffa7e4 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 a62fc1bfe..e76ae11e5 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 e234d7f08..8f3197cb0 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 416f171e2..63539c2eb 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 5437d6a33..2c37723c1 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 966fdacae..b8008f757 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 5bdefe74e..bab7b03e6 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 a33ffe5e7..fcb72c140 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 68d872930..b9bca74ad 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 f833745b7..7cc1c8588 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 045248504..69e75ec0a 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 164a85cac..7097d0f71 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 09dcb3d08..815e86ad2 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 96fe3610d..bfda93f49 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 eb9ff5fd8..d8c9fdf6e 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 5daef1aa5..144d6680f 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 34376a7b5..36dfd9efa 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 ce3865f48..813a1b17e 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 bb1e885eb..960cc49c0 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 662246392..4e7771b80 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 074f159eb..e8ae72236 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 8dc17cecf..2d44526a2 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 6ee5b5c2e..c5ed09f5f 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 e25b524ab..0a10d2a66 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 ec0285025..4003f1515 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 6b39b265d..fb518af93 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 3cb631816..8968ad72c 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 2d04151c6..3cdfbbdb9 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 b07c68dd8..d86743c08 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 8785f0719..c4d495793 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 0fbcb2840..e646327fe 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 1005fe0c5..95028ca04 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 b1955cc6d..e099ec64a 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 66973fc6c..065574c78 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 9b3dded2c..ccd96e0d2 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 0aa1f571b..10778122c 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 c2a8c11e2..a60cf1494 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 e0d78e34a..c08d40180 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 d9ab5db3c..1a5a716f9 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 bae985fba..65fddbedc 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 632ce9316..cb11fff97 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 56e2a6529..b97ffc1ec 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 22150d6e0..50822def6 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 3c9bf07c4..739e264d5 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 07d59285b..b24adfb36 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 d89e27607..c4ab3cf2d 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 72c3e65eb..cecea8605 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 6887a38be..e25ebe664 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 d89fc293a..81561f046 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 fed41959d..773ef6dd6 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 4e33de621..69b6d5224 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 9fa4cd330..51dddf20e 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 f91a8da37..8c83338d1 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 b7af1d3f8..2b68c40d5 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 c852b5198..f6e424ee6 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 dd65df864..f0621e3e6 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 f96a0c09d..6baf507c0 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 e8bcf64f3..f09bf46e2 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 31e0ebecd..baa0bc624 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 a6dfbc0bc..a71e865d2 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 0916b03e2..2a6f424f9 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 1bf9ed73e..bee574ff8 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 790affb20..fc83b65b5 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 1fcf929f2..6551acdb5 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 6b56b9081..bb188877e 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 d7e1df01a..4d01a0de3 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 cc5fc244c..2e6056efb 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 7a3bc4d4f..8d2435b08 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 5e2dec9f2..faa422901 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 06ab49299..8da803817 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 b7754d6b6..6263dfa81 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 0b84d809e..7a55c6c89 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 cc1fc6f8c..55583c940 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 114130dcf..675edcc3d 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 9cde99478..2361ed31b 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 15ce92a16..b5a457db5 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 04a81f903..6d96b769b 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 9b1005edc..5a54d5639 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 e241138ff..3b06ba8af 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 6b9a265f6..065e230dc 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 bdc70959f..39eadcec6 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 bb4b7a030..d6ae084f8 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 a610a3ab8..194d94209 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 61c6d1150..b77043bdd 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 84a0bc3de..14edcc759 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 56c27d03d..5118fa457 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 12eaf7063..6e666919d 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 5c32ca837..012ccb405 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 f23164ce3..70f1f1f1f 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 606753804..f6bafe978 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 3c1a136f1..8e487d55c 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 c3aeb1844..d79da5157 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 90edf2ad3..42d57c6fc 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 33593103b..bd8c8e886 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 d051a595a..70554c42c 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 c60b7f523..e65ef0867 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 1863e0d92..045278936 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 4b423ba71..eac90da42 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 845ce7cf0..770f0341e 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 c1f0bb1a4..0b4b3c1b0 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 83bb9f370..ec68247ba 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 2056187dd..7bd30ff90 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 c6d773f58..19e7d2470 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 000000000..3abeb8389 --- /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 f3e7146e5..b8455d414 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 3650f8a42..a27cfe607 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 adb6add9c..6ade88650 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 6a2c3d3b5..cff334c0c 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 4654d15f6..bfc76931d 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 96fce80a7..96f97f41e 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 9d955d625..bca2f9f4a 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 e718182a3..d69ec719c 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 3c67cef09..c9be18ead 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 f3ee40b66..4bdb4bf7c 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 e0ccb113b..a24221bac 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 790da3c26..beb07fe2e 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 71edebbb9..e20d21f96 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 a519fed1f..9a925138e 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 17a7da621..751363c60 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 c034994c6..5ae45c1e9 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 21bcacebf..3ac9f92b6 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 168051ed3..4a7cafd54 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 22f1fecce..d9a1c4526 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 486c38069..54e709f9d 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 000000000..a2b5ea4cb --- /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 3e030643e..842447f3f 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 ee945839e..edebcfeb2 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 7f2034538..2bfe88821 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 7801f467a..275b61325 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 29a75dd7d..96e2f968c 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 79f84214b..6aaa47183 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 5d414a2e5..fcb808369 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 bb294d727..71e5f1e63 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 fa4583b8c..61870c7f9 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 47d63f794..9ffa93f25 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 10634b860..bc61baade 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 8f3be79d0..dd4bff989 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 bc66fc717..d946987ef 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 31c751317..e49257ea6 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 780815d27..1f4f32900 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 f349a03ef..3f8a15179 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 ab1b0577d..b360343cd 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 e5b298259..782f7b800 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 218cb700a..b5213efe5 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 78ae5ae33..86ecd9755 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 60a69f58c..d484d312f 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 7ef91d7fb..157d594d2 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 4788c5aff..92821217b 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 f313921a7..fa39854d1 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 712698b9a..babceb7db 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 0feccfa26..690d6de93 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 ef083e4c2..dc1469674 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 dc4a0b96f..7d1dd2ed7 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 2fa81eb9b..26dbedf44 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 a0a174f5e..efa64ee7d 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 489ca52ce..6391d981c 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 0bf4c1446..b59527f70 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 55601a894..66f16501c 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 e2cb34e3c..e4020bb14 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 27b65c3c6..f574826a0 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 87ef02f99..6df28659d 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 d581d9ca5..54b7df3f8 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 3da51c478..50fe5e1d1 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 b9e9054ba..4f00c3de4 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 17dc47e14..3006b73a5 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 93b05156d..e86734e6e 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 85283b75c..bf5f20a2a 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 d7a51b0e8..61f0ffaa5 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 7c131dac8..14b8fc3c3 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 360268b9b..5657ba69f 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 21581baa0..d9b7c220b 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 04b50bb35..12c173113 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 009ed8c12..bb8427959 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 a656d2187..ee0e6fea3 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 adcdf00dd..4d7a7e2f0 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 c43a260fe..a2678b5c0 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 946d0a3b1..2046ed62f 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 bf0c0efb9..bd1dbd78d 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 278ea9f77..1e7c53dd0 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 b5b52339e..63852cdf4 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 492eb30a8..0353b3bae 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 ba5f8d7ed..6a3f0b973 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 47b30a3c2..fd6fd6c3c 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 09768a928..7ead32942 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 000000000..ad2790328 --- /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 ca8eac2e7..000000000 --- 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 0ba3af734..000000000 --- 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 000000000..00faf3216 --- /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 000000000..50e823093 --- /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 000000000..571b7b5a8 --- /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 000000000..ca21279b5 --- /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 46fad63e8..0b45ebfbb 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 000000000..636713317 --- /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 000000000..1ec79c887 --- /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 000000000..42015c3ea --- /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 eaa662f03..8aacfd99e 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 72e6b3e25..000000000 --- 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 ddd7d7ed2..910eacb38 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 000000000..e519e05ec --- /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 64b079472..000000000 --- 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 a46a6d987..000000000 --- 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 165922e90..03dc44e85 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 46a2edcb6..d773516d3 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 010dbb20d..57e9d396f 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 90f34695c..e8d6550ad 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 e218288b6..6e942a9b0 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 7daa95fb6..8b88105c6 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 ec0f05b79..2c02c50f1 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 dfc0b9a41..2c683f5ef 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 a0de2e9fd..7acf73a55 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(); } } }