nds_nflib/include/nf_basic.h
Antonio Niño Díaz c34dbb2912 library: Remove version number from source files
This is misleading unless it's updated every single time there is a
commit, which isn't realistic.
2023-05-11 23:49:33 +01:00

114 lines
3.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// SPDX-License-Identifier: MIT
//
// Copyright (c) 2009-2014 Cesar Rincon "NightFox"
//
// NightFox LIB - Include de funciones basicas
// http://www.nightfoxandco.com/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __NF_BASIC_H__
#define __NF_BASIC_H__
/// @file nf_basic.h
/// @brief General functions of NFLib
/// @defgroup nf_basic General functions of NFLib
///
/// Functions related to error handling and other general settings.
///
/// @{
#include <nds.h>
/// Root folder used by NFLib
extern char NF_ROOTFOLDER[64];
/// 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.
///
/// @param code Error code.
/// @param text Description.
/// @param value Additional info.
void NF_Error(u16 code, const char *text, u32 value);
/// 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 its compiled. Its 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");
/// ```
///
/// @param folder
void NF_SetRootFolder(const char *folder);
/// 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);
/// ```
///
/// @param destination Destination pointer.
/// @param source Source pointer.
/// @param size Number of bytes to copy.
void NF_DmaMemCopy(void *destination, const void *source, u32 size);
/// Returns the language ID set by the user in the firmware.
///
/// 0 : Japanese
/// 1 : English
/// 2 : French
/// 3 : German
/// 4 : Italian
/// 5 : Spanish
/// 6 : Chinese
///
/// @return The language ID.
u8 NF_GetLanguage(void);
/// @}
#endif
#ifdef __cplusplus
}
#endif