// SDK location: /user/pspthreadman.h:1401 // SDK declaration: int sceKernelTryAllocateFpl(SceUID uid, void **data); public int sceKernelTryAllocateFpl(int uid, int data) { KFixedPool pool = _kernel.GetHandle <KFixedPool>(uid); if (pool == null) { return(-1); } KMemoryBlock block = pool.Allocate(); if (block == null) { return(-1); } Debug.Assert(data != 0); unsafe { uint *pdata = ( uint * )_memorySystem.Translate(( uint )data); * pdata = block.Address; } return(0); }
// SDK location: /user/pspthreadman.h:1391 // SDK declaration: int sceKernelAllocateFplCB(SceUID uid, void **data, unsigned int *timeout); public int sceKernelAllocateFplCB(int uid, int data, int timeout) { KFixedPool pool = _kernel.GetHandle <KFixedPool>(uid); if (pool == null) { return(-1); } KMemoryBlock block = pool.Allocate(); if (block != null) { Debug.Assert(data != 0); unsafe { uint *pdata = ( uint * )_memorySystem.Translate(( uint )data); * pdata = block.Address; } return(0); } else { uint timeoutUs = 0; if (timeout != 0) { unsafe { uint *ptimeout = ( uint * )_memorySystem.Translate(( uint )timeout); timeoutUs = *ptimeout; } } KThread thread = _kernel.ActiveThread; Debug.Assert(thread != null); thread.Wait(pool, ( uint )data, timeoutUs, true); return(0); } }