// GetStandardUserSystemClockAutomaticCorrectionEvent() -> handle<copy> public ResultCode GetStandardUserSystemClockAutomaticCorrectionEvent(ServiceCtx context) { if (_automaticCorrectionEvent == 0) { if (context.Process.HandleTable.GenerateHandle(_timeManager.StandardUserSystemClock.GetAutomaticCorrectionReadableEvent(), out _automaticCorrectionEvent) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_automaticCorrectionEvent); return(ResultCode.Success); }
private ResultCode GetAddOnContentListChangedEventImpl(ServiceCtx context) { if (_addOnContentListChangedEventHandle == 0) { if (context.Process.HandleTable.GenerateHandle(_addOnContentListChangedEvent.ReadableEvent, out _addOnContentListChangedEventHandle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_addOnContentListChangedEventHandle); return(ResultCode.Success); }
[Command(0)] //2.0.0+ // nn::friends::detail::ipc::INotificationService::GetEvent() -> handle<copy> public long GetEvent(ServiceCtx context) { if (_notificationEventHandle == 0) { if (context.Process.HandleTable.GenerateHandle(_notificationEvent.ReadableEvent, out _notificationEventHandle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_notificationEventHandle); return(0); }
// GetAppletStateChangedEvent() -> handle<copy> public ResultCode GetAppletStateChangedEvent(ServiceCtx context) { if (_stateChangedEventHandle == 0) { if (context.Process.HandleTable.GenerateHandle(_stateChangedEvent.ReadableEvent, out _stateChangedEventHandle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_stateChangedEventHandle); return(ResultCode.Success); }
public long QueryEvent(ServiceCtx Context) { int Fd = Context.RequestData.ReadInt32(); int EventId = Context.RequestData.ReadInt32(); //TODO: Use Fd/EventId, different channels have different events. int Handle = Context.Process.HandleTable.OpenHandle(Event); Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); Context.ResponseData.Write(0); return(0); }
// GetIrsensorSharedMemoryHandle(nn::applet::AppletResourceUserId, pid) -> handle<copy> public ResultCode GetIrsensorSharedMemoryHandle(ServiceCtx context) { if (_irsensorSharedMemoryHandle == 0) { if (context.Process.HandleTable.GenerateHandle(context.Device.System.IirsSharedMem, out _irsensorSharedMemoryHandle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_irsensorSharedMemoryHandle); return(ResultCode.Success); }
[CommandHipc(20)] // 6.0.0+ // GetSharedMemoryNativeHandle() -> handle<copy> public ResultCode GetSharedMemoryNativeHandle(ServiceCtx context) { if (_timeSharedMemoryNativeHandle == 0) { if (context.Process.HandleTable.GenerateHandle(_timeManager.SharedMemory.GetSharedMemory(), out _timeSharedMemoryNativeHandle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_timeSharedMemoryNativeHandle); return(ResultCode.Success); }
// GetSharedMemoryNativeHandle() -> handle<copy> public long GetSharedMemoryNativeHandle(ServiceCtx context) { if (_timeSharedMemoryNativeHandle == 0) { if (context.Process.HandleTable.GenerateHandle(context.Device.System.TimeSharedMem, out _timeSharedMemoryNativeHandle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_timeSharedMemoryNativeHandle); return(0); }
// GetLibraryAppletLaunchableEvent() -> handle<copy> public ResultCode GetLibraryAppletLaunchableEvent(ServiceCtx context) { _libraryAppletLaunchableEvent.ReadableEvent.Signal(); if (context.Process.HandleTable.GenerateHandle(_libraryAppletLaunchableEvent.ReadableEvent, out int handle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle); Logger.Stub?.PrintStub(LogClass.ServiceAm); return(ResultCode.Success); }
// RegisterBleEvent(pid) -> handle<copy> public ResultCode RegisterBleEvent(ServiceCtx context) { NxSettings.Settings.TryGetValue("bluetooth_debug!skip_boot", out object debugMode); if ((bool)debugMode) { context.Response.HandleDesc = IpcHandleDesc.MakeCopy(BluetoothEventManager.RegisterBleDebugEventHandle); } else { context.Response.HandleDesc = IpcHandleDesc.MakeCopy(BluetoothEventManager.RegisterBleEventHandle); } return(ResultCode.Success); }
[CommandHipc(12)] // 3.0.0+ // QueryAudioDeviceOutputEvent() -> handle<copy, event> public ResultCode QueryAudioDeviceOutputEvent(ServiceCtx context) { KEvent deviceOutputEvent = _impl.QueryAudioDeviceOutputEvent(); if (context.Process.HandleTable.GenerateHandle(deviceOutputEvent.ReadableEvent, out int handle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle); Logger.Stub?.PrintStub(LogClass.ServiceAudio); return(ResultCode.Success); }
public long GetLibraryAppletLaunchableEvent(ServiceCtx Context) { LaunchableEvent.ReadableEvent.Signal(); if (Context.Process.HandleTable.GenerateHandle(LaunchableEvent.ReadableEvent, out int Handle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return(0); }
// AtmosphereGetProcessInfo(os::ProcessId process_id) -> sf::OutCopyHandle out_process_handle, sf::Out<ncm::ProgramLocation> out_loc, sf::Out<cfg::OverrideStatus> out_status public ResultCode GetProcessInfo(ServiceCtx context) { ulong pid = context.RequestData.ReadUInt64(); KProcess process = KernelStatic.GetProcessByPid(pid); if (context.Process.HandleTable.GenerateHandle(process, out int processHandle) != KernelResult.Success) { throw new System.Exception("Out of handles!"); } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(processHandle); return(ResultCode.Success); }
public long GetAppletStateChangedEvent(ServiceCtx context) { _stateChangedEvent.ReadableEvent.Signal(); if (context.Process.HandleTable.GenerateHandle(_stateChangedEvent.ReadableEvent, out int handle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle); Logger.PrintStub(LogClass.ServiceAm, "Stubbed."); return(0); }
// CreateAsyncInterface(u64) -> (handle<copy>, object<nn::ec::IShopServiceAsync>) public ResultCode CreateAsyncInterface(ServiceCtx context) { MakeObject(context, new IShopServiceAsync()); if (context.Process.HandleTable.GenerateHandle(_event.ReadableEvent, out int handle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle); Logger.Stub?.PrintStub(LogClass.ServiceNim); return(ResultCode.Success); }
[Command(130)] // 8.0.0+ // GetGpuErrorDetectedSystemEvent() -> handle<copy> public ResultCode GetGpuErrorDetectedSystemEvent(ServiceCtx context) { if (context.Process.HandleTable.GenerateHandle(_gpuErrorDetectedSystemEvent.ReadableEvent, out int gpuErrorDetectedSystemEventHandle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(gpuErrorDetectedSystemEventHandle); // NOTE: This is used by "sdk" NSO during applet-application initialization. // A seperate thread is setup where event-waiting is handled. // When the Event is signaled, official sw will assert. return(ResultCode.Success); }
// GetAddOnContentListChangedEvent() -> handle<copy> public ResultCode GetAddOnContentListChangedEvent(ServiceCtx context) { // Official code seems to make an internal call to ns:am Cmd 84 GetDynamicCommitEvent() if (context.Process.HandleTable.GenerateHandle(_addOnContentListChangedEvent.ReadableEvent, out int handle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle); Logger.Stub?.PrintStub(LogClass.ServiceNs); return(ResultCode.Success); }
// GetCompletionEvent() -> handle<copy> public ResultCode GetCompletionEvent(ServiceCtx context) { if (_completionEvent == null) { _completionEvent = new KEvent(context.Device.System.KernelContext); } if (context.Process.HandleTable.GenerateHandle(_completionEvent.ReadableEvent, out int completionEventHandle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(completionEventHandle); return(ResultCode.Success); }
// AttachStateChangeEvent() -> handle<copy> public ResultCode AttachStateChangeEvent(ServiceCtx context) { if (_stateChangeEventHandle == 0) { if (context.Process.HandleTable.GenerateHandle(_networkInterface.StateChangeEvent.ReadableEvent, out _stateChangeEventHandle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_stateChangeEventHandle); // Return ResultCode.InvalidArgument if handle is null, doesn't occur in our case since we already throw an Exception. return(ResultCode.Success); }
// GetEventHandle() -> handle<copy> public ResultCode GetEventHandle(ServiceCtx context) { KEvent messageEvent = context.Device.System.AppletState.MessageEvent; if (_messageEventHandle == 0) { if (context.Process.HandleTable.GenerateHandle(messageEvent.ReadableEvent, out _messageEventHandle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_messageEventHandle); return(ResultCode.Success); }
[Command(61)] // 3.0.0+ // GetDefaultDisplayResolutionChangeEvent() -> handle<copy> public ResultCode GetDefaultDisplayResolutionChangeEvent(ServiceCtx context) { if (_displayResolutionChangedEventHandle == 0) { if (context.Process.HandleTable.GenerateHandle(context.Device.System.DisplayResolutionChangeEvent.ReadableEvent, out _displayResolutionChangedEventHandle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_displayResolutionChangedEventHandle); Logger.Stub?.PrintStub(LogClass.ServiceAm); return(ResultCode.Success); }
// GetDisplayVsyncEvent(u64) -> handle<copy> public ResultCode GetDisplayVSyncEvent(ServiceCtx context) { string name = GetDisplayName(context); if (_vsyncEventHandle == 0) { if (context.Process.HandleTable.GenerateHandle(context.Device.System.VsyncEvent.ReadableEvent, out _vsyncEventHandle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_vsyncEventHandle); return(ResultCode.Success); }
// GetSharedMemoryNativeHandle() -> handle<copy> public ResultCode GetSharedMemoryNativeHandle(ServiceCtx context) { context.Device.System.Font.EnsureInitialized(context.Device.System.ContentManager); if (_fontSharedMemHandle == 0) { if (context.Process.HandleTable.GenerateHandle(context.Device.System.FontSharedMem, out _fontSharedMemHandle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_fontSharedMemHandle); return(ResultCode.Success); }
// GetEvent() -> handle<copy> public ResultCode GetEvent(ServiceCtx context) { if (_eventHandle == 0) { if (context.Process.HandleTable.GenerateHandle(_event.ReadableEvent, out _eventHandle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_eventHandle); Logger.Stub?.PrintStub(LogClass.ServiceBcat); return(ResultCode.Success); }
// QuerySystemEvent() -> handle<copy, event> public ResultCode QuerySystemEvent(ServiceCtx context) { ResultCode result = _impl.QuerySystemEvent(out KEvent systemEvent); if (result == ResultCode.Success) { if (context.Process.HandleTable.GenerateHandle(systemEvent.ReadableEvent, out int handle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle); } return(result); }
[Command(23)] // 3.0.0+ // AttachAvailabilityChangeEvent() -> handle<copy> public ResultCode AttachAvailabilityChangeEvent(ServiceCtx context) { if (_availabilityChangeEventHandle == 0) { _availabilityChangeEvent = new KEvent(context.Device.System.KernelContext); if (context.Process.HandleTable.GenerateHandle(_availabilityChangeEvent.ReadableEvent, out _availabilityChangeEventHandle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_availabilityChangeEventHandle); return(ResultCode.Success); }
public long GetSystemEventReadableHandles(ServiceCtx context) { if (context.Process.HandleTable.GenerateHandle(_event0.ReadableEvent, out int handle0) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } if (context.Process.HandleTable.GenerateHandle(_event1.ReadableEvent, out int handle1) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle0, handle1); return(0); }
// QueryEvent(u32 fd, u32 event_id) -> (u32, handle<copy, event>) public ResultCode QueryEvent(ServiceCtx context) { int fd = context.RequestData.ReadInt32(); int eventId = context.RequestData.ReadInt32(); // TODO: Use Fd/EventId, different channels have different events. if (context.Process.HandleTable.GenerateHandle(_event.ReadableEvent, out int handle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle); context.ResponseData.Write(0); return(ResultCode.Success); }
// GetIrsensorSharedMemoryHandle(nn::applet::AppletResourceUserId, pid) -> handle<copy> public ResultCode GetIrsensorSharedMemoryHandle(ServiceCtx context) { // NOTE: Shared memory should use the appletResourceUserId. // ulong appletResourceUserId = context.RequestData.ReadUInt64(); if (_irsensorSharedMemoryHandle == 0) { if (context.Process.HandleTable.GenerateHandle(context.Device.System.IirsSharedMem, out _irsensorSharedMemoryHandle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_irsensorSharedMemoryHandle); return(ResultCode.Success); }
[Command(91)] // 6.0.0+ // GetAccumulatedSuspendedTickChangedEvent() -> handle<copy> public ResultCode GetAccumulatedSuspendedTickChangedEvent(ServiceCtx context) { if (_accumulatedSuspendedTickChangedEventHandle == 0) { _accumulatedSuspendedTickChangedEvent = new KEvent(context.Device.System.KernelContext); _accumulatedSuspendedTickChangedEvent.ReadableEvent.Signal(); if (context.Process.HandleTable.GenerateHandle(_accumulatedSuspendedTickChangedEvent.ReadableEvent, out _accumulatedSuspendedTickChangedEventHandle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } } context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_accumulatedSuspendedTickChangedEventHandle); return(ResultCode.Success); }