public long GetLibraryAppletLaunchableEvent(ServiceCtx Context) { LaunchableEvent.Signal(); int Handle = Context.Process.HandleTable.OpenHandle(LaunchableEvent); Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); return(0); }
// SDK location: /user/pspthreadman.h:665 // SDK declaration: int sceKernelClearEventFlag(SceUID evid, u32 bits); public int sceKernelClearEventFlag(int evid, int bits) { KEvent ev = _kernel.GetHandle <KEvent>(evid); if (ev == null) { return(-1); } ev.Value &= ( uint )bits; if (ev.Signal() == true) { // We woke something! _kernel.Schedule(); } return(0); }
public IAudioDevice(Horizon System) { m_Commands = new Dictionary <int, ServiceProcessRequest>() { { 0, ListAudioDeviceName }, { 1, SetAudioDeviceOutputVolume }, { 3, GetActiveAudioDeviceName }, { 4, QueryAudioDeviceSystemEvent }, { 5, GetActiveChannelCount }, { 6, ListAudioDeviceNameAuto }, { 7, SetAudioDeviceOutputVolumeAuto }, { 8, GetAudioDeviceOutputVolumeAuto }, { 10, GetActiveAudioDeviceNameAuto }, { 11, QueryAudioDeviceInputEvent }, { 12, QueryAudioDeviceOutputEvent } }; SystemEvent = new KEvent(System); //TODO: We shouldn't be signaling this here. SystemEvent.Signal(); }
private long OpenAudioOutImpl(ServiceCtx Context, long SendPosition, long SendSize, long ReceivePosition, long ReceiveSize) { string DeviceName = AMemoryHelper.ReadAsciiString( Context.Memory, SendPosition, SendSize); if (DeviceName == string.Empty) { DeviceName = DefaultAudioOutput; } if (DeviceName != DefaultAudioOutput) { Context.Device.Log.PrintWarning(LogClass.Audio, "Invalid device name!"); return(MakeError(ErrorModule.Audio, AudErr.DeviceNotFound)); } byte[] DeviceNameBuffer = Encoding.ASCII.GetBytes(DeviceName + "\0"); if ((ulong)DeviceNameBuffer.Length <= (ulong)ReceiveSize) { Context.Memory.WriteBytes(ReceivePosition, DeviceNameBuffer); } else { Context.Device.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {ReceiveSize} too small!"); } int SampleRate = Context.RequestData.ReadInt32(); int Channels = Context.RequestData.ReadInt32(); if (SampleRate == 0) { SampleRate = DefaultSampleRate; } if (SampleRate != DefaultSampleRate) { Context.Device.Log.PrintWarning(LogClass.Audio, "Invalid sample rate!"); return(MakeError(ErrorModule.Audio, AudErr.UnsupportedSampleRate)); } Channels = (ushort)Channels; if (Channels == 0) { Channels = DefaultChannelsCount; } KEvent ReleaseEvent = new KEvent(Context.Device.System); ReleaseCallback Callback = () => { ReleaseEvent.Signal(); }; IAalOutput AudioOut = Context.Device.AudioOut; int Track = AudioOut.OpenTrack(SampleRate, Channels, Callback); MakeObject(Context, new IAudioOut(AudioOut, ReleaseEvent, Track)); Context.ResponseData.Write(SampleRate); Context.ResponseData.Write(Channels); Context.ResponseData.Write((int)SampleFormat.PcmInt16); Context.ResponseData.Write((int)PlaybackState.Stopped); return(0); }
private void AudioCallback() { UpdateEvent.Signal(); }