mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2025-01-01 14:33:34 +01:00
core: slightly better integration of BFile calls
This commit is contained in:
parent
32aef78600
commit
d655aa934f
2 changed files with 35 additions and 32 deletions
|
@ -53,8 +53,7 @@ int BFile_Open(uint16_t const *file, enum BFile_OpenMode mode);
|
||||||
int BFile_Close(int fd);
|
int BFile_Close(int fd);
|
||||||
|
|
||||||
/* BFile_Size(): Retrieve size of an open file
|
/* BFile_Size(): Retrieve size of an open file
|
||||||
|
@fd Open file descriptor
|
||||||
@fd File descriptor
|
|
||||||
Returns the file size in bytes, or a negative BFile error code*/
|
Returns the file size in bytes, or a negative BFile error code*/
|
||||||
int BFile_Size(int fd);
|
int BFile_Size(int fd);
|
||||||
|
|
||||||
|
@ -84,40 +83,42 @@ int BFile_Write(int fd, void const *data, int even_size);
|
||||||
Returns a BFile error code. */
|
Returns a BFile error code. */
|
||||||
int BFile_Read(int handle, void *data, int size, int whence);
|
int BFile_Read(int handle, void *data, int size, int whence);
|
||||||
|
|
||||||
/* BFile_FindFirst(): Search a directory for file with matching name.
|
/* BFile_FindFirst(): Search a directory for file with matching name
|
||||||
Doesn't work on Main memory.
|
Doesn't work on Main memory. Only four search handle can be opened, you need
|
||||||
Only four search handle can be opened, you need to close them to be able to reuse them.
|
to close them to be able to reuse them. Search is NOT case sensitive and *
|
||||||
Search is NOT case sensitive and * can be used to match any string.
|
can be used as a wildcard.
|
||||||
|
|
||||||
@search FONTCHARACTER file path to match
|
@search FONTCHARACTER file path to match
|
||||||
@shandle Search handle to pass to BFile_FindNext or BFile_FindClose
|
@shandle Search handle to pass to BFile_FindNext or BFile_FindClose
|
||||||
@founfile FONTCHARACTER found file path
|
@founfile FONTCHARACTER found file path
|
||||||
@fileinfo Structure containing a lot of information on the found file
|
@fileinfo Structure containing a lot of information on the found file
|
||||||
Return 0 on success, -1 if no file found, or negative value on error. */
|
Returns 0 on success, -1 if no file found, or negative value on error. */
|
||||||
typedef struct tag_FILE_INFO
|
struct BFile_FileInfo
|
||||||
{
|
{
|
||||||
unsigned short id; //file index
|
uint16_t index;
|
||||||
unsigned short type; //file type
|
uint16_t type;
|
||||||
unsigned long fsize; //file size
|
uint32_t file_size;
|
||||||
unsigned long dsize; //date size (file - header)
|
/* Data size (file size minus the header) */
|
||||||
unsigned int property; //if 0 file complete
|
uint32_t data_size;
|
||||||
unsigned long adress; //top adress of data (direct access is unadvised)
|
/* Is 0 if the file is complete */
|
||||||
} FILE_INFO;
|
uint32_t property;
|
||||||
int BFile_FindFirst(uint16_t const *search, int *shandle, uint16_t *foundfile, FILE_INFO *fileinfo);
|
/* Address of first fragmented (do not use directly) */
|
||||||
|
uint32_t address;
|
||||||
|
};
|
||||||
|
int BFile_FindFirst(uint16_t const *search, int *shandle, uint16_t *foundfile,
|
||||||
|
struct BFile_FileInfo *fileinfo);
|
||||||
|
|
||||||
/* BFile_FindNext(): Continue a search a directory for file with matching name.
|
/* BFile_FindNext(): Continue a search a directory for file with matching name
|
||||||
Only four search handle can be opened, u need to close them to be able to reuse them.
|
|
||||||
|
|
||||||
@shandle Search handle from BFile_FindFirst
|
@shandle Search handle from BFile_FindFirst
|
||||||
@founfile FONTCHARACTER found file path
|
@founfile FONTCHARACTER found file path
|
||||||
@fileinfo Structure containing a lot of information on the found file
|
@fileinfo Structure containing a lot of information on the found file
|
||||||
Return 0 on success, -1 if no file found, or negative value on error. */
|
Returns 0 on success, -1 if end is reached, or negative value on error. */
|
||||||
int BFile_FindNext(int shandle, uint16_t *foundfile, FILE_INFO *fileinfo);
|
int BFile_FindNext(int shandle, uint16_t *foundfile,
|
||||||
|
struct BFile_FileInfo *fileinfo);
|
||||||
|
|
||||||
/* BFile_FindClose(): Close the specified search handle
|
/* BFile_FindClose(): Close the specified search handle
|
||||||
Only four search handle can be opened, u need to close them to be able to reuse them.
|
@shandle Search handle from BFile_FindFirst
|
||||||
|
|
||||||
@shandle Search handle from BFile_FindFirst
|
|
||||||
Return 0 on success or negative value on error. */
|
Return 0 on success or negative value on error. */
|
||||||
int BFile_FindClose(int shandle);
|
int BFile_FindClose(int shandle);
|
||||||
|
|
||||||
|
|
|
@ -87,11 +87,13 @@ _BFile_Write:
|
||||||
_BFile_Read:
|
_BFile_Read:
|
||||||
syscall(0x0432)
|
syscall(0x0432)
|
||||||
|
|
||||||
# int BFile_FindFirst(uint16_t const *search, int *shandle, uint16_t *foundfile, FILE_INFO *fileinfo)
|
# int BFile_FindFirst(uint16_t const *search, int *shandle,
|
||||||
|
# uint16_t *foundfile, struct BFile_FileInfo *fileinfo)
|
||||||
_BFile_FindFirst:
|
_BFile_FindFirst:
|
||||||
syscall(0x043b)
|
syscall(0x043b)
|
||||||
|
|
||||||
# int BFile_FindNext(int shandle, uint16_t *foundfile, FILE_INFO *fileinfo)
|
# int BFile_FindNext(int shandle, uint16_t *foundfile,
|
||||||
|
# struct BFile_FileInfo *fileinfo)
|
||||||
_BFile_FindNext:
|
_BFile_FindNext:
|
||||||
syscall(0x043c)
|
syscall(0x043c)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue