Dreambox C/C++ SDK v1.0.0
C/C++ SDK for creating Dreambox games
|
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | IODIRENT |
Directory entry detailing information about a file or directory. More... | |
Macros | |
#define | IO_WHENCE_BEGIN 0 |
#define | IO_WHENCE_CURRENT 1 |
#define | IO_WHENCE_END 2 |
#define | IO_FILEMODE_READ 0 |
#define | IO_FILEMODE_WRITE 1 |
Typedefs | |
typedef void | IODIR |
Opaque handle to an open directory. More... | |
typedef void | IOFILE |
Opaque handle to an open file descriptor. More... | |
Functions | |
uint8_t | fs_deviceExists (const char *device) |
Check if the given storage device is present. More... | |
void | fs_deviceEject (const char *device) |
Eject the given storage device, if it supports it. More... | |
uint8_t | fs_fileExists (const char *filepath) |
Check if the file exists. More... | |
IOFILE * | fs_open (const char *filepath, uint32_t mode) |
Open a file for reading. More... | |
IOFILE * | fs_allocMemoryCard (const char *filename, const void *icon, const uint16_t *iconPalette, uint32_t numBlocks) |
Allocate a new file on the memory card. More... | |
uint32_t | fs_read (IOFILE *filehandle, void *buffer, uint32_t readLen) |
Read data from an open file stream. More... | |
uint32_t | fs_write (IOFILE *filehandle, const void *buffer, uint32_t readLen) |
Write to an open file stream. More... | |
uint32_t | fs_seek (IOFILE *filehandle, int32_t position, uint32_t whence) |
Seek to a position within the open file stream. More... | |
uint32_t | fs_tell (IOFILE *filehandle) |
Retrieve the current position within the open file stream. More... | |
uint8_t | fs_eof (IOFILE *filehandle) |
Retrieve whether the given file stream's position is at its end. More... | |
void | fs_close (IOFILE *filehandle) |
Close a previously opened file stream. More... | |
IODIR * | fs_openDir (const char *path) |
Open a directory. More... | |
IODIRENT * | fs_readDir (IODIR *dirHandle) |
Reads the next directory entry from the open directory. More... | |
void | fs_rewindDir (IODIR *dirHandle) |
Rewind open directory to the beginning of the listing. More... | |
void | fs_closeDir (IODIR *dirHandle) |
Close open directory. More... | |
typedef void IOFILE |
IOFILE * fs_allocMemoryCard | ( | const char * | filename, |
const void * | icon, | ||
const uint16_t * | iconPalette, | ||
uint32_t | numBlocks | ||
) |
Allocate a new file on the memory card.
filename | The name of the file to create (must not exceed 28 characters) |
icon | Pointer to a 16x16 4bpp icon to associate with the file |
iconPalette | Pointer to an array of RGB565 palette colors to use for the icon |
numBlocks | The number of 512-byte blocks to reserve for the file |
void fs_close | ( | IOFILE * | filehandle | ) |
Close a previously opened file stream.
filehandle | A handle previously returned from fs_open |
void fs_closeDir | ( | IODIR * | dirHandle | ) |
Close open directory.
dirHandle | A handle previously returned from fs_opendir |
void fs_deviceEject | ( | const char * | device | ) |
Eject the given storage device, if it supports it.
device | The storage device (valid values are "cd", "ma", and "mb") |
uint8_t fs_deviceExists | ( | const char * | device | ) |
Check if the given storage device is present.
device | The storage device (valid values are "cd", "ma", and "mb") |
uint8_t fs_eof | ( | IOFILE * | filehandle | ) |
Retrieve whether the given file stream's position is at its end.
filehandle | A handle previously returned from fs_open |
uint8_t fs_fileExists | ( | const char * | filepath | ) |
Check if the file exists.
filepath | Path to the file |
IOFILE * fs_open | ( | const char * | filepath, |
uint32_t | mode | ||
) |
Open a file for reading.
filepath | Path to the file to open |
mode | Mode to open the file in (valid values are IO_FILEMODE_READ, IO_FILEMODE_WRITE, and IO_FILEMODE_APPEND) |
IODIR * fs_openDir | ( | const char * | path | ) |
Open a directory.
path | Path to a directory to open |
uint32_t fs_read | ( | IOFILE * | filehandle, |
void * | buffer, | ||
uint32_t | readLen | ||
) |
Read data from an open file stream.
filehandle | A handle previously returned from fs_open |
buffer | Buffer to read data into |
readLen | Maximum number of bytes to read |
Reads the next directory entry from the open directory.
dirHandle | A handle previously returned from fs_opendir |
void fs_rewindDir | ( | IODIR * | dirHandle | ) |
Rewind open directory to the beginning of the listing.
dirHandle | A handle previously returned from fs_opendir |
uint32_t fs_seek | ( | IOFILE * | filehandle, |
int32_t | position, | ||
uint32_t | whence | ||
) |
Seek to a position within the open file stream.
filehandle | A handle previously returned from fs_open |
position | Seek position |
whence | Origin to seek relative to |
uint32_t fs_tell | ( | IOFILE * | filehandle | ) |
Retrieve the current position within the open file stream.
filehandle | A handle previously returned from fs_open |
uint32_t fs_write | ( | IOFILE * | filehandle, |
const void * | buffer, | ||
uint32_t | readLen | ||
) |
Write to an open file stream.
filehandle | A handle previously returned from fs_open |
buffer | Buffer to write from |
readLen | Number of bytes to write |