# NNS_GfdAllocLnkPlttVram

## C Specification

      #include <nnsys/gfd.h>

      NNSGfdPlttKey NNS_GfdAllocLnkPlttVram( u32 szByte, BOOL b4Pltt, u32 opt );

## Arguments

szByte | The size of the region to allocate (8 to 524280 bytes)
b4Pltt | Determines whether it is a 4-color palette. TRUE if it is a 4-color palette.
opt | Option. This is not used.

## Return Values

Returns a palette key that shows the allocated VRAM region. If the allocation fails, the function returns `NNS_GFD_ALLOC_ERROR_PLTTKEY`, a key that shows an error.

## Description

Allocates the VRAM region used as the texture palette and obtains a palette key. When `b4Pltt` is TRUE, the function allocates memory for a 4-color palette. Note: The 4-color palette has specific limitations:

- You cannot reference memory addresses 0x10000 and over.
- The 4-color palette requires an 8-byte alignment.

)
The empty region generated with alignment adjustments are registered as empty region blocks.
When new management information blocks are insufficient, allocation fails.
To avoid unnecessary alignment adjustments (and empty regions), we recommend allocating memory for the 4-color palette separately from memory for other palette formats that do not require 8-byte alignment.

If an allocation request is made for a size below the minimum that can be expressed for the key, the request size is rounded up to the minimum. If an allocation request is made for a size above the maximum that can be expressed for the key, the allocation process will not be performed and an error key will be returned.

## See Also

``

01/31/2005 Added a cautionary statement regarding the size range.

NNS_GfdFreeLnkPlttVram

## Revision History

10/12/2004 Initial version.