libctru  v2.4.1
Enumerations | Functions
vram.h File Reference

VRAM allocator. More...

Go to the source code of this file.

Enumerations

enum  vramAllocPos {
  VRAM_ALLOC_A = BIT(0) ,
  VRAM_ALLOC_B = BIT(1) ,
  VRAM_ALLOC_ANY = VRAM_ALLOC_A | VRAM_ALLOC_B
}
 

Functions

void * vramAlloc (size_t size)
 Allocates a 0x80-byte aligned buffer. More...
 
void * vramAllocAt (size_t size, vramAllocPos pos)
 Allocates a 0x80-byte aligned buffer in the given VRAM bank. More...
 
void * vramMemAlign (size_t size, size_t alignment)
 Allocates a buffer aligned to the given size. More...
 
void * vramMemAlignAt (size_t size, size_t alignment, vramAllocPos pos)
 Allocates a buffer aligned to the given size in the given VRAM bank. More...
 
void * vramRealloc (void *mem, size_t size)
 Reallocates a buffer. More...
 
size_t vramGetSize (void *mem)
 Retrieves the allocated size of a buffer. More...
 
void vramFree (void *mem)
 Frees a buffer. More...
 
u32 vramSpaceFree (void)
 Gets the current VRAM free space. More...
 

Detailed Description

VRAM allocator.

Function Documentation

◆ vramAlloc()

void* vramAlloc ( size_t  size)

Allocates a 0x80-byte aligned buffer.

Parameters
sizeSize of the buffer to allocate.
Returns
The allocated buffer.

◆ vramAllocAt()

void* vramAllocAt ( size_t  size,
vramAllocPos  pos 
)

Allocates a 0x80-byte aligned buffer in the given VRAM bank.

Parameters
sizeSize of the buffer to allocate.
posVRAM bank to use (see vramAllocPos).
Returns
The allocated buffer.

◆ vramFree()

void vramFree ( void *  mem)

Frees a buffer.

Parameters
memBuffer to free.

◆ vramGetSize()

size_t vramGetSize ( void *  mem)

Retrieves the allocated size of a buffer.

Returns
The size of the buffer.

◆ vramMemAlign()

void* vramMemAlign ( size_t  size,
size_t  alignment 
)

Allocates a buffer aligned to the given size.

Parameters
sizeSize of the buffer to allocate.
alignmentAlignment to use.
Returns
The allocated buffer.

◆ vramMemAlignAt()

void* vramMemAlignAt ( size_t  size,
size_t  alignment,
vramAllocPos  pos 
)

Allocates a buffer aligned to the given size in the given VRAM bank.

Parameters
sizeSize of the buffer to allocate.
alignmentAlignment to use.
posVRAM bank to use (see vramAllocPos).
Returns
The allocated buffer.

◆ vramRealloc()

void* vramRealloc ( void *  mem,
size_t  size 
)

Reallocates a buffer.

Note: Not implemented yet.

Parameters
memBuffer to reallocate.
sizeSize of the buffer to allocate.
Returns
The reallocated buffer.

◆ vramSpaceFree()

u32 vramSpaceFree ( void  )

Gets the current VRAM free space.

Returns
The current VRAM free space.