![]() |
Jo Engine 2026.11.6
Jo Sega Saturn Engine
|
Jo Engine File System function prototypes. More...
Go to the source code of this file.
Macros | |
| #define | JO_ROOT_DIR |
| Specify the root directory (on the CD) for jo_fs_read_file(), jo_map_load_from_file(), etc. | |
| #define | JO_CURRENT_DIR |
| Specify the current directory (on the CD) for jo_fs_read_file(), jo_map_load_from_file(), etc. | |
| #define | JO_PARENT_DIR |
| Specify the parent directory for jo_fs_read_file(), jo_map_load_from_file(), etc. | |
| #define | JO_CD_DRIVE_PAUSE |
| Drive status: the drive is paused. | |
| #define | JO_CD_DRIVE_PLAY |
| Drive status: the drive is playing (audio or data). | |
Typedefs | |
| typedef void(*) | jo_fs_async_read_callback(char *contents, int length, int optional_token) |
| Function prototype for (). | |
Functions | |
| bool | jo_fs_cd (const char *const sub_dir) |
| Change the current directory (equivalent of Unix cd command). | |
| bool | jo_fs_file_exists (const char *const filename) |
| Check if a file is in the current directory of the CD (no error printed when it is not: an optional file). | |
| char * | jo_fs_read_file_in_dir (const char *const filename, const char *const sub_dir, int *len) |
| Read a file on the CD. | |
| char * | jo_fs_read_file_ptr (const char *const filename, void *buf, int *len) |
| Read a file on the CD and put the contents to "buf". | |
| void | jo_fs_get_read_stats (unsigned int *const vblanks, unsigned int *const bytes, unsigned int *const files, const bool reset) |
| Statistics of the files read by jo_fs_read_file_ptr() (the time of a loading: the CD or the CPU). | |
| static __jo_force_inline char * | jo_fs_read_file (const char *const filename, int *len) |
| Read a file on the CD. | |
| bool | jo_fs_read_file_async_ptr (const char *const filename, jo_fs_async_read_callback callback, int optional_token, void *buf) |
| Read a file on the CD asynchronously and put the contents to "buf". | |
| void | jo_fs_wait_background_jobs (void) |
| Wait for the end of the reads of jo_fs_read_file_async() (their callbacks called, the files they start too). | |
| static __jo_force_inline bool | jo_fs_read_file_async (const char *const filename, jo_fs_async_read_callback callback, int optional_token) |
| Read a file on the CD asynchronously. | |
| bool | jo_fs_open (jo_file *const file, const char *const filename) |
| Open a file. | |
| void | jo_fs_close (jo_file *const file) |
| Close a file. | |
| void | jo_fs_set_read_sector_count (const int count) |
| Set the size of the read buffer of the files opened by jo_fs_open(). | |
| int | jo_fs_read_next_bytes (jo_file *const file, char *buffer, unsigned int nbytes) |
| Read bytes from a file. | |
| static __jo_force_inline bool | jo_fs_read_exact (jo_file *const file, void *const buffer, const unsigned int nbytes) |
| Read bytes from a file: all of them. | |
| bool | jo_fs_seek_forward (jo_file *const file, unsigned int nbytes) |
| Seek forward from current position of a file. | |
Jo Engine File System function prototypes.
| #define JO_CD_DRIVE_PAUSE |
Drive status: the drive is paused.
| #define JO_CD_DRIVE_PLAY |
Drive status: the drive is playing (audio or data).
| #define JO_CURRENT_DIR |
Specify the current directory (on the CD) for jo_fs_read_file(), jo_map_load_from_file(), etc.
| #define JO_PARENT_DIR |
Specify the parent directory for jo_fs_read_file(), jo_map_load_from_file(), etc.
| #define JO_ROOT_DIR |
Specify the root directory (on the CD) for jo_fs_read_file(), jo_map_load_from_file(), etc.
| typedef void(*) jo_fs_async_read_callback(char *contents, int length, int optional_token) |
Function prototype for ().
| bool jo_fs_cd | ( | const char *const | sub_dir | ) |
Change the current directory (equivalent of Unix cd command).
| sub_dir | Sub directory name (use JO_PARENT_DIR for parent directory) |
| void jo_fs_close | ( | jo_file *const | file | ) |
Close a file.
| file | Pointer to an allocated and valid jo_file struct |
| bool jo_fs_file_exists | ( | const char *const | filename | ) |
Check if a file is in the current directory of the CD (no error printed when it is not: an optional file).
| filename | File name (example: "LEVEL.BIN") |
| void jo_fs_get_read_stats | ( | unsigned int *const | vblanks, |
| unsigned int *const | bytes, | ||
| unsigned int *const | files, | ||
| const bool | reset ) |
Statistics of the files read by jo_fs_read_file_ptr() (the time of a loading: the CD or the CPU).
| vblanks | Time spent reading (VBLANK count), JO_NULL: not wanted |
| bytes | Bytes read |
| files | Files read |
| reset | The counts start again from 0 |
| bool jo_fs_open | ( | jo_file *const | file, |
| const char *const | filename ) |
Open a file.
| file | Pointer to an allocated jo_file struct |
| filename | Filename (upper case and shorter as possible like "A.TXT") |
|
static |
Read bytes from a file: all of them.
| file | Pointer to an allocated and valid jo_file struct |
| buffer | Pointer to an allocated buffer (length >= nbytes) |
| nbytes | Number of bytes to read |
|
static |
Read a file on the CD.
| filename | Filename (upper case and shorter as possible like "A.TXT") |
| len | return the file length |
|
static |
Read a file on the CD asynchronously.
| filename | Filename (upper case and shorter as possible like "A.TXT") |
| callback | Callback called when the file is loaded |
| optional_token | User value to identify the file |
| bool jo_fs_read_file_async_ptr | ( | const char *const | filename, |
| jo_fs_async_read_callback | callback, | ||
| int | optional_token, | ||
| void * | buf ) |
Read a file on the CD asynchronously and put the contents to "buf".
| filename | Filename (upper case and shorter as possible like "A.TXT") |
| callback | Callback called when the file is loaded |
| optional_token | User value to identify the file |
| buf | Output buffer: the file length + 1 byte at least (a null character is written after the contents) |
| char * jo_fs_read_file_in_dir | ( | const char *const | filename, |
| const char *const | sub_dir, | ||
| int * | len ) |
Read a file on the CD.
| filename | Filename (upper case and shorter as possible like "A.TXT") |
| sub_dir | Sub directory name (use JO_ROOT_DIR if the file is on the root directory) |
| len | return the file length |
| char * jo_fs_read_file_ptr | ( | const char *const | filename, |
| void * | buf, | ||
| int * | len ) |
Read a file on the CD and put the contents to "buf".
| filename | Filename (upper case and shorter as possible like "A.TXT") |
| buf | Output buffer: the file length + 1 byte at least (a null character is written after the contents) |
| len | return the file length |
| int jo_fs_read_next_bytes | ( | jo_file *const | file, |
| char * | buffer, | ||
| unsigned int | nbytes ) |
Read bytes from a file.
| file | Pointer to an allocated and valid jo_file struct |
| buffer | Pointer to an allocated buffer (length >= nbytes) |
| nbytes | number of bytes to read |
| bool jo_fs_seek_forward | ( | jo_file *const | file, |
| unsigned int | nbytes ) |
Seek forward from current position of a file.
| file | Pointer to an allocated and valid jo_file struct |
| nbytes | number of bytes to skip |
| void jo_fs_set_read_sector_count | ( | const int | count | ) |
Set the size of the read buffer of the files opened by jo_fs_open().
| count | Number of sectors (2048 bytes) read at once by jo_fs_read_next_bytes() (1 by default) |
| void jo_fs_wait_background_jobs | ( | void | ) |
Wait for the end of the reads of jo_fs_read_file_async() (their callbacks called, the files they start too).