NightFox’s Lib
Functions | Variables
General functions of NFLib

Functions related to error handling and other general settings. More...

Functions

 __attribute__ ((noreturn)) void NF_Error(u32 code
 Stops program execution and shows the error on the screen. More...
 
void NF_SetRootFolder (const char *folder)
 Defines the root folder of your project (FAT or NitroFS). More...
 
void NF_DmaMemCopy (void *destination, const void *source, u32 size)
 Function copy blocks of memory from RAM to VRAM fast. More...
 

Variables

char NF_ROOTFOLDER [64]
 Root folder used by NFLib.
 

Detailed Description

Functions related to error handling and other general settings.

Function Documentation

◆ __attribute__()

__attribute__ ( (noreturn)  )

Stops program execution and shows the error on the screen.

This command is used internally by the lib to generate debug messages and it will rarely be used in you code.

101: File not found. 102: Not enough memory. 103: Not enough free slots. 104: Background not found. 105: Background not created. 106: Value outside of bounds. 107: Not enough contiguous blocks in VRAM (tiles). 108: Not enough contiguous blocks in VRAM (maps). 109: ID already used. 110: ID not loaded in RAM. 111: ID not loaded in VRAM. 112: Sprite not created. 113: Not enough VRAM. 114: Text layer doesn't exist. 115: Background dimensions are invalid (not multiple of 256). 116: File too big. 117: Affine background dimensions are invalid. 118: Affine creation layer is invalid.

Parameters
codeError code.
textDescription.
valueAdditional info.

◆ NF_DmaMemCopy()

void NF_DmaMemCopy ( void *  destination,
const void *  source,
u32  size 
)

Function copy blocks of memory from RAM to VRAM fast.

DMA copies from RAM to VRAM are the most efficient. The function checks if the data is aligned for the DMA copy. If not, it uses memcpy() insead.

Example:

// Copy to address 0x06000000 (VRAM_A) 128 KB of memory from "buffer"
NF_DmaMemCopy((void*)0x06000000, buffer, 131072);
void NF_DmaMemCopy(void *destination, const void *source, u32 size)
Function copy blocks of memory from RAM to VRAM fast.
Definition: nf_basic.c:288
Parameters
destinationDestination pointer.
sourceSource pointer.
sizeNumber of bytes to copy.

◆ NF_SetRootFolder()

void NF_SetRootFolder ( const char *  folder)

Defines the root folder of your project (FAT or NitroFS).

This makes it easy to change the name of folder that contains all files of your project after it’s compiled. It’s imperative the use of this function before loading any file from FAT.

If you want to use NitroFS, use "NITROFS" as root folder name. You must configure your Makefile correctly to include the NitroFS files in your ROM. When using a flashcard, it must support argv. Use Homebrew Menu to launch the ROM if your flashcard doesn't support it.

Example:

// Define "mygame" folder as root for your project using FAT
NF_SetRootFolder("mygame");
void NF_SetRootFolder(const char *folder)
Defines the root folder of your project (FAT or NitroFS).
Definition: nf_basic.c:157
Parameters
folder