![]() |
Jo Engine 2026.11.1
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 | |
| void | jo_fs_cd (const char *const sub_dir) |
| Change the current directory (equivalent of Unix cd command). | |
| 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". | |
| 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. | |
| bool | jo_fs_seek_forward (jo_file *const file, unsigned int nbytes) |
| Seek forward from current position of a file. | |
| int | __jo_fs_get_file_id (const char *const filename) |
| Get the identifier of a file in the current directory (Internal usage). | |
| void * | __jo_fs_open (const int file_id) |
| Open a file (Internal usage). | |
| void | __jo_fs_close (void *handle) |
| Close a file opened with __jo_fs_open() (Internal usage). | |
| int | __jo_fs_get_file_size (void *handle) |
| Get the size of a file in bytes (Internal usage). | |
| int | __jo_fs_get_sector_count (void *handle) |
| Get the size of a file in sectors (Internal usage). | |
| bool | __jo_fs_seek_sector (void *handle, const int sector) |
| Set the current position of a file (Internal usage). | |
| int | __jo_fs_read_sectors (void *handle, int sector_count, void *buf, const int buf_size) |
| Read sectors from the current position of a file (Internal usage). | |
| void | __jo_cd_play_tracks (const int from_track, const int to_track, const unsigned char play_mode) |
| Play CD audio tracks (Internal usage). | |
| void | __jo_cd_play_from_fad (const unsigned int fad, const int from_track, const int to_track, const unsigned char play_mode) |
| Play CD audio from a sector (Internal usage). | |
| int | __jo_cd_get_status (unsigned int *fad) |
| Get the CD drive status (Internal usage). | |
| void | __jo_cd_pause (void) |
| Pause the CD drive (Internal usage). | |
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 ().
| int __jo_cd_get_status | ( | unsigned int * | fad | ) |
Get the CD drive status (Internal usage).
| fad | Current sector (frame address) of the pickup (output, can be JO_NULL) |
| void __jo_cd_pause | ( | void | ) |
Pause the CD drive (Internal usage).
| void __jo_cd_play_from_fad | ( | const unsigned int | fad, |
| const int | from_track, | ||
| const int | to_track, | ||
| const unsigned char | play_mode ) |
Play CD audio from a sector (Internal usage).
| fad | First sector (frame address) |
| from_track | First track (played from its start if fad is not before the end of to_track) |
| to_track | Last track (played until its end) |
| play_mode | 0x00: no repeat, 0x01~0x0e: maximum repeats, 0x0f: endless repeat |
| void __jo_cd_play_tracks | ( | const int | from_track, |
| const int | to_track, | ||
| const unsigned char | play_mode ) |
Play CD audio tracks (Internal usage).
| from_track | First track (the first audio track is usually 2) |
| to_track | Last track (played until its end) |
| play_mode | 0x00: no repeat, 0x01~0x0e: maximum repeats, 0x0f: endless repeat |
| void __jo_fs_close | ( | void * | handle | ) |
Close a file opened with __jo_fs_open() (Internal usage).
| handle | File handle (JO_NULL is ignored) |
| int __jo_fs_get_file_id | ( | const char *const | filename | ) |
Get the identifier of a file in the current directory (Internal usage).
| filename | Filename (upper case, like "A.TXT") |
| int __jo_fs_get_file_size | ( | void * | handle | ) |
Get the size of a file in bytes (Internal usage).
| handle | File handle |
| int __jo_fs_get_sector_count | ( | void * | handle | ) |
Get the size of a file in sectors (Internal usage).
| handle | File handle |
| void * __jo_fs_open | ( | const int | file_id | ) |
Open a file (Internal usage).
| file_id | File identifier (see __jo_fs_get_file_id()) |
| int __jo_fs_read_sectors | ( | void * | handle, |
| int | sector_count, | ||
| void * | buf, | ||
| const int | buf_size ) |
Read sectors from the current position of a file (Internal usage).
| handle | File handle |
| sector_count | Number of sectors to read |
| buf | Output buffer |
| buf_size | Size of the output buffer (bytes after it are not written) |
| bool __jo_fs_seek_sector | ( | void * | handle, |
| const int | sector ) |
Set the current position of a file (Internal usage).
| handle | File handle |
| sector | Sector index from the beginning of the file |
| void 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 |
| 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 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 |
| 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 |
| 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) |