forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Patch to add Kernel Heap Functions to pspsysmem_kernel.h

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Mon Oct 16, 2006 5:33 am    Post subject: Patch to add Kernel Heap Functions to pspsysmem_kernel.h Reply with quote

This is a patch to add the prototypes of some heap functions of SysMemForKernel (sceKernelCreateHeap, sceKernelDeleteHeap, sceKernelAllocHeapMemory, sceKernelFreeHeapMemory, sceKernelHeapTotalFreeSize).

http://moonlight.lan.st/heap.patch

The usage is very easy and intuitive, anyways an example:

Code:

// Create a 32 KB heap.
int heapid = sceKernelCreateHeap(PSP_MEMORY_PARTITION_KERNEL, 32*1024,  1, "MyHeap");

if (heapid < 0)
{
    // Handle error here
   ...
}

// Allocate a 8 KB buffer from the heap
u8 *mybuffer = (u8 *)sceKernelAllocHeapMemory(heapid, 8192);
if (!mybuffer)
{
   // Handle error here
  ...
}

// Allocate other memory blocks here if you want
...

// Free the 8 KB buffer
if (sceKernelFreeHeapMemory(heapid, mybuffer) < 0)
{
   // Handle error here
   ...
}

// Free other memory blocks here if you allocated them
...

// Delete the heap
if (sceKernelDeleteHeap(heapid) < 0)
{
   // Handle error here
   ...
}

Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Mon Oct 16, 2006 8:56 am    Post subject: Reply with quote

committed
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group