// SDK location: /user/pspthreadman.h:1164 // SDK declaration: int sceKernelTrySendMsgPipe(SceUID uid, void *message, unsigned int size, int unk1, void *unk2); public int sceKernelTrySendMsgPipe(int uid, int message, int size, int unk1, int outSize) { KMessagePipe handle = _kernel.GetHandle <KMessagePipe>(uid); if (handle == null) { Log.WriteLine(Verbosity.Normal, Feature.Bios, "sceKernelTrySendMsgPipe: kernel pipe handle not found: {0}", uid); return(-1); } if (_memory.ReadStream(message, handle.Stream, size) != size) { Log.WriteLine(Verbosity.Normal, Feature.Bios, "sceKernelTrySendMsgPipe: could not read enough for {0}", uid); return(-1); } if (outSize != 0) { unsafe { uint *poutSize = (uint *)_memorySystem.Translate((uint)outSize); * poutSize = (uint)size; } } handle.Signal(); //Log.WriteLine( Verbosity.Normal, Feature.Bios, "sceKernelTrySendMsgPipe: {0} {1:X8} {2} {3:X8} {4:X8}", uid, message, size, unk1, readsize ); //handle.Stream.Seek(0, SeekOrigin.Begin); return(0); }
// SDK location: /user/pspthreadman.h:1192 // SDK declaration: int sceKernelReceiveMsgPipeCB(SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout); public int sceKernelReceiveMsgPipeCB(int uid, int message, int size, int unk1, int outSize, int timeout) { KMessagePipe handle = _kernel.GetHandle <KMessagePipe>(uid); if (handle == null) { Log.WriteLine(Verbosity.Normal, Feature.Bios, "sceKernelReceiveMsgPipe: kernel pipe handle not found: {0}", uid); return(-1); } return(handle.MaybeWait(message, size, unk1, outSize, timeout, true)); }
public int sceKernelCreateMsgPipe( int _name, int part, int attr, int size, int opt ) { string name = _kernel.ReadString( ( uint )_name ); KPartition partition = _kernel.Partitions[ part ]; Debug.Assert( partition != null ); if( partition == null ) { return -1; } KMessagePipe handle = new KMessagePipe( _kernel, partition, name, size ); _kernel.AddHandle( handle ); Log.WriteLine( Verbosity.Normal, Feature.Bios, "sceKernelCreateMsgPipe: opened pipe {0} with ID {1}, for partition {2:X}", name, handle.UID, part ); return ( int )handle.UID; }
// SDK location: /user/pspthreadman.h:1123 // SDK declaration: int sceKernelDeleteMsgPipe(SceUID uid); public int sceKernelDeleteMsgPipe(int uid) { KMessagePipe pipe = _kernel.GetHandle <KMessagePipe>(uid); if (pipe == null) { return(unchecked ((int)0x8002019E)); } // Can't delete if someone is waiting... need to do something? Debug.Assert(pipe.WaitingThreads.Count == 0); if (pipe.WaitingThreads.Count > 0) { // Wake them? } _kernel.RemoveHandle(pipe.UID); return(0); }
// SDK location: /user/pspthreadman.h:1114 // SDK declaration: SceUID sceKernelCreateMsgPipe(const char *name, int part, int attr, void *unk1, void *opt); public int sceKernelCreateMsgPipe(int _name, int part, int attr, int size, int opt) { string name = _kernel.ReadString(( uint )_name); KPartition partition = _kernel.Partitions[part]; Debug.Assert(partition != null); if (partition == null) { return(-1); } KMessagePipe handle = new KMessagePipe(_kernel, partition, name, size); _kernel.AddHandle(handle); Log.WriteLine(Verbosity.Normal, Feature.Bios, "sceKernelCreateMsgPipe: opened pipe {0} with ID {1}, for partition {2:X}", name, handle.UID, part); return(( int )handle.UID); }