40 lines
1.6 KiB
C
40 lines
1.6 KiB
C
#ifndef NOVA64_FS_H
|
|
#define NOVA64_FS_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
/* ========================================================================== */
|
|
/* File System API */
|
|
/* ========================================================================== */
|
|
|
|
/**
|
|
* @brief Reads a file from the filesystem into a buffer.
|
|
* Supports drive identifiers: "SYS:" (internal system store),
|
|
* "EXA:" (cartridge slot 0), "EXB:" (cartridge slot 1), etc.
|
|
* @param file_path Null-terminated file path with drive identifier
|
|
* (e.g., "SYS:/init.wasm" or "EXA:/game.wasm").
|
|
* @param buffer Pointer to destination buffer where file contents will be
|
|
* copied.
|
|
* @param buffer_size Size in bytes of the destination buffer.
|
|
* @return True if file was successfully read into buffer, false on error
|
|
* (file not found, read error, or buffer too small).
|
|
* @note Uses the sd_read_sector callback from nova64_io_interface_t.
|
|
* The callback must be registered via nova64_init() before calling
|
|
* this function.
|
|
*/
|
|
bool nova64_read_file_to_buffer(const char *file_path, uint8_t *buffer,
|
|
size_t buffer_size);
|
|
|
|
/**
|
|
* @brief Gets the size of a file in the filesystem.
|
|
* @param file_path Null-terminated file path with drive identifier
|
|
* (e.g., "SYS:/init.wasm" or "EXA:/game.wasm").
|
|
* @return Size of the file in bytes on success, or -1 on error
|
|
* (file not found, read error, etc.).
|
|
*/
|
|
int32_t nova64_get_file_size(const char *file_path);
|
|
|
|
#endif // NOVA64_FS_H
|