SWILIB API (SG)    
Loading...
Searching...
No Matches
file.h
Go to the documentation of this file.
1#pragma once
2
11#ifndef __IN_SWILIB__
12#include "base.h"
13#include "wstring.h"
14#endif
15
17
18typedef struct DIR_ENTRY DIR_ENTRY;
19typedef struct FSTATS FSTATS;
20typedef struct FILE_PROP FILE_PROP;
21typedef struct TWavLen TWavLen;
22typedef struct FS_DRIVE FS_DRIVE;
23typedef struct FS_DRIVER FS_DRIVER;
24typedef struct FS_OPS FS_OPS;
25
30 FA_READONLY = 0x0001,
31 FA_HIDDEN = 0x0002,
32 FA_SYSTEM = 0x0004,
33 FA_DIRECTORY = 0x0010,
34 FA_ARCHIVE = 0x0020,
35};
36
41 S_SET = 0,
42 S_CUR = 1,
43 S_END = 2,
44};
45
50 P_WRITE = 0x100,
51 P_READ = 0x080,
52};
53
57#pragma pack(1)
58struct DIR_ENTRY {
59#ifdef NEWSGOLD
60 char unk0[40];
61 uint32_t file_size;
62 short file_attr;
63 uint32_t create_date_time;
64 char unk1[2];
65 char folder_name[128];
66 char unk2;
67 char file_name[128];
68 char unk3[11];
69 short wsfolder_name[128 + 1];
70 short wsfile_name[128 + 1];
71#else
72 char unk0[14];
73 short file_attr;
75 uint32_t file_size;
76 char unk1[16];
77 char folder_name[128];
78 char unk2;
79 char file_name[271];
80#endif
81};
82#pragma pack()
83
87struct FSTATS {
88 char unk1;
89 char unk2;
90 char unk3;
91 char unk4;
92 uint32_t size;
93 char unk5[12];
94 uint16_t mtime_date;
95 uint16_t mtime_time;
97 char unk6[12];
98};
99
101#ifdef NEWSGOLD
102 FILE_PROP_TYPE_GENERAL = 0x0400,
103 FILE_PROP_TYPE_VIDEO = 0xA800,
104 FILE_PROP_TYPE_PICTURE = 0x4000,
105 FILE_PROP_TYPE_AUDIO = 0x1000,
106 FILE_PROP_TYPE_MUSIC = 0x1800,
107#else
111#endif
112};
113
118struct FILE_PROP {
119#ifdef NEWSGOLD
120 uint32_t type;
121 WSHDR *filename;
123 int uid;
124 uint16_t width;
125 uint16_t height;
126 WSHDR *duration_mp3_ws;
127 uint32_t duration_mp3;
129 uint32_t duration_wav;
130 WSHDR *tag_title_ws;
131 WSHDR *tag_artist_ws;
132 WSHDR *tag_album_ws;
133 WSHDR *tag_track_ws;
134 WSHDR *tag_year_ws;
135 WSHDR *unk_tag_2_ws;
136 WSHDR *bitrate_ws;
137 WSHDR *audio_frequency_ws;
138 WSHDR *size_ws;
139#else
140 uint16_t type;
143 int uid;
144 uint16_t width;
145 uint16_t height;
147 uint32_t duration_wav;
150#endif
151};
152
157 A_ReadOnly = 0x0000,
158 A_WriteOnly = 0x0001,
159 A_ReadWrite = 0x0002,
160 A_NoShare = 0x0004,
161 A_Append = 0x0008,
162 A_Exclusive = 0x0010,
163 A_MMCStream = 0x0020,
164 A_Create = 0x0100,
165 A_Truncate = 0x0200,
167 A_FailOnReopen = 0x0800,
168 A_TXT = 0x4000,
169 A_BIN = 0x8000,
170};
171
175struct TWavLen {
176 unsigned short type;
182 long length;
185};
186
192struct FS_OPS {
193 int (*close)(int async, int fd, uint32_t *err, int req);
194 int (*fstat)(int async, int fd, FSTATS *stat, uint32_t *err, int req);
195 int (*fflush)(int async, int fd, uint32_t *err, int req);
196#ifdef NEWSGOLD
197 int (*format)(int async, int16_t drive, int param, uint32_t *err, int req);
198 int (*find_close)(int async, DIR_ENTRY *de, uint32_t *err, int req);
199 int (*get_file_attrib)(int async, const char *path, const WSHDR *wpath, uint8_t *attr, uint32_t *err, int req);
200 int (*get_free_space)(int async, int16_t drive, uint32_t *err, int req);
201 int (*find_first_file)(int async, DIR_ENTRY *de, const char *mask, const WSHDR *wmask, uint32_t *err, int req);
202 int (*find_next_file)(int async, DIR_ENTRY *de, uint32_t *err, int req);
203 int (*is_dir)(int async, const char *path, const WSHDR *wpath, uint32_t *err, int req);
204 int (*mkdir)(int async, const char *path, const WSHDR *wpath, uint32_t *err, int req);
205 int (*open)(int async, const char *path, const WSHDR *wpath, uint32_t mode, uint32_t perm, uint32_t *err, int req);
206 int (*read16)(int async, int fd, void *buf, int len, uint32_t *err, int req);
207 int (*read)(int async, int fd, void *buf, int len, uint32_t *err, int req);
208 int (*rename)(int async, const char *old_path, const WSHDR *old_wpath, const char *new_path, const WSHDR *new_wpath,
209 uint32_t *err, int req);
210 int (*rmdir)(int async, const char *path, const WSHDR *wpath, uint32_t *err, int req);
211 int (*lseek)(int async, int fd, int32_t offset, uint32_t origin, uint32_t *err, uint32_t *err2, int req);
212 int (*set_file_attrib)(int async, const char *path, const WSHDR *wpath, uint8_t attr, uint32_t *err, int req);
213 int (*set_file_size)(int async, int fd, uint32_t size, uint32_t *err, int req);
214 int (*set_file_time)(int async, int fd, uint16_t date, uint16_t time, uint32_t *err, int req);
215 int (*stat)(int async, const char *path, const WSHDR *wpath, FSTATS *stat, uint32_t *err, int req);
216 int (*truncate)(int async, int fd, int length, uint32_t *err, int req);
217 int (*unlink)(int async, const char *path, const WSHDR *wpath, uint32_t *err, int req);
218 int (*mount)(int async, int16_t drive, uint32_t *err, int req);
219 int (*unmount)(int async, int16_t drive, uint32_t *err, int req);
220 int (*write16)(int async, int fd, const void *buf, int len, uint32_t *err, int req);
221 int (*write)(int async, int fd, const void *buf, int len, uint32_t *err, int req);
222 void *unk_6C;
223 int (*get_drive_info)(int16_t drive, void *info);
224 int (*get_total_space)(int drive);
225 int (*unk_78)(int drive);
226 void *unk_7C;
227 void *unk_80;
228#else
229 int (*format)(int async, int16_t drive, uint32_t *err, int req);
230 int (*find_close)(int async, DIR_ENTRY *de, uint32_t *err, int req);
231 int (*get_file_attrib)(int async, const char *path, uint8_t *attr, uint32_t *err, int req);
232 int (*get_free_space)(int async, int16_t drive, uint32_t *err, int req);
233 int (*find_first_file)(int async, DIR_ENTRY *de, const char *mask, uint32_t *err, int req);
234 int (*find_next_file)(int async, DIR_ENTRY *de, uint32_t *err, int req);
235 int (*is_dir)(int async, const char *path, uint32_t *err, int req);
236 int (*mkdir)(int async, const char *path, uint32_t *err, int req);
237 int (*open)(int async, const char *path, uint32_t mode, uint32_t perm, uint32_t *err, int req);
238 int (*read16)(int async, int fd, void *buf, int len, uint32_t *err, int req);
239 int (*rename)(int async, const char *old_path, const char *new_path, uint32_t *err, int req);
240 int (*rmdir)(int async, const char *path, uint32_t *err, int req);
241 int (*lseek)(int async, int fd, int32_t offset, uint32_t origin, uint32_t *err, uint32_t *err2, int req);
242 int (*set_file_attrib)(int async, const char *path, uint8_t attr, uint32_t *err, int req);
243 int (*set_file_size)(int async, int fd, uint32_t size, uint32_t *err, int req);
244 int (*set_file_time)(int async, int fd, const void *datetime, uint32_t *err, int req);
245 int (*stat)(int async, const char *path, FSTATS *stat, uint32_t *err, int req);
246 int (*truncate)(int async, int fd, int length, uint32_t *err, int req);
247 int (*unlink)(int async, const char *path, uint32_t *err, int req);
248 void *unk_58;
249 int (*write16)(int async, int fd, const void *buf, int len, uint32_t *err, int req);
250 int (*get_drive_info)(int16_t drive, void *info);
251 int (*get_total_space)(int drive);
252 int (*unk_68)(int drive);
253 void *unk_6C;
254 void *unk_70;
255#endif
256};
257
261struct FS_DRIVER {
262 int used;
263 int id;
264 int16_t first_handle;
265 int16_t last_handle;
266 const FS_OPS *ops;
267};
268
272struct FS_DRIVE {
273 int used;
274#ifdef NEWSGOLD
275 uint16_t letter;
276#else
277 uint8_t letter;
278 uint8_t alias;
279#endif
280 int16_t drive;
282 int unk1;
283 uint8_t unk2[4];
284 const FS_OPS *ops;
285};
286
295__swi_begin(0x00A)
296int sys_open(const char *path, uint32_t mode, uint32_t permission, uint32_t *err)
297__swi_end(0x00A, sys_open, (path, mode, permission, err));
298
308__swi_begin(0x00B)
309int sys_read(int fd, void *buffer, int length, uint32_t *err)
310__swi_end(0x00B, sys_read, (fd, buffer, length, err));
311
321__swi_begin(0x00C)
322int sys_write(int fd, const void *buffer, int length, uint32_t *err)
323__swi_end(0x00C, sys_write, (fd, buffer, length, err));
324
331__swi_begin(0x00D)
332int sys_close(int fd, uint32_t *err)
333__swi_end(0x00D, sys_close, (fd, err));
334
341__swi_begin(0x00E)
342int sys_fflush(int fd, uint32_t *err)
343__swi_end(0x00E, sys_fflush, (fd, err));
344
354__swi_begin(0x00F)
355long sys_lseek(int fd, int32_t offset, uint32_t origin, uint32_t *err, uint32_t *err2)
356__swi_end(0x00F, sys_lseek, (fd, offset, origin, err, err2));
357
364__swi_begin(0x010)
365int sys_mkdir(const char *dirname, uint32_t *err)
366__swi_end(0x010, sys_mkdir, (dirname, err));
367
371__swi_begin(0x3B7)
372int sys_mkdir_ws(const WSHDR *dirname, uint32_t *err)
373__swi_end(0x3B7, sys_mkdir_ws, (dirname, err));
374
381__swi_begin(0x08F)
382int sys_rmdir(const char *dirname, uint32_t *err)
383__swi_end(0x08F, sys_rmdir, (dirname, err));
384
388__swi_begin(0x3B8)
389int sys_rmdir_ws(const WSHDR *path, uint32_t *err)
390__swi_end(0x3B8, sys_rmdir_ws, (path, err));
391
399__swi_begin(0x08E)
400int sys_rename(const char *old_name, const char *new_name, uint32_t *err)
401__swi_end(0x08E, sys_rename, (old_name, new_name, err));
402
406__swi_begin(0x3B9)
407int sys_rename_ws(const WSHDR *old_name, const WSHDR *new_name, uint32_t *err)
408__swi_end(0x3B9, sys_rename_ws, (old_name, new_name, err));
409
416__swi_begin(0x16B)
417int sys_unlink(const char *path, uint32_t *err)
418__swi_end(0x16B, sys_unlink, (path, err));
419
423__swi_begin(0x3BA)
424int sys_unlink_ws(const WSHDR *path, uint32_t *err)
425__swi_end(0x3BA, sys_unlink_ws, (path, err));
426
434__swi_begin(0x090)
435int sys_truncate(int fd, int length, uint32_t *err)
436__swi_end(0x090, sys_truncate, (fd, length, err));
437
445__swi_begin(0x084)
446int sys_stat(const char *path, FSTATS *stat, uint32_t *err)
447__swi_end(0x084, sys_stat, (path, stat, err));
448
452__swi_begin(0x3BB)
453int sys_stat_ws(const WSHDR *path, FSTATS *stat, uint32_t *err)
454__swi_end(0x3BB, sys_stat_ws, (path, stat, err));
455
463__swi_begin(0x38D)
464int sys_fstat(int fd, FSTATS *stat, uint32_t *err)
465__swi_end(0x38D, sys_fstat, (fd, stat, err));
466
473__swi_begin(0x38C)
474int sys_format(uint16_t drive, uint32_t *err)
475__swi_end(0x38C, sys_format, (drive, err));
476
483__swi_begin(0x3FB)
484int sys_mount(uint16_t drive, uint32_t *err)
485__swi_end(0x3FB, sys_mount, (drive, err));
486
493__swi_begin(0x3FC)
494int sys_unmount(uint16_t drive, uint32_t *err)
495__swi_end(0x3FC, sys_unmount, (drive, err));
496
504__swi_begin(0x03C)
505int setfilesize(int fd, uint32_t length, uint32_t *err)
506__swi_end(0x03C, setfilesize, (fd, length, err));
507
516__swi_begin(0x3FD)
517int setfiletime(int fd, uint16_t date, uint16_t time, uint32_t *err)
518__swi_end(0x3FD, setfiletime, (fd, date, time, err));
519
524__swi_begin(0x08E)
525int fmove(const char *old_name, const char *new_name, uint32_t *err)
526__swi_end(0x08E, fmove, (old_name, new_name, err));
527
535__swi_begin(0x091)
536int isdir(const char *path, uint32_t *err)
537__swi_end(0x091, isdir, (path, err));
538
542__swi_begin(0x3BC)
543int isdir_ws(const WSHDR *path, uint32_t *err)
544__swi_end(0x3BC, isdir_ws, (path, err));
545
551__swi_begin(0x2E3)
552int fexists(WSHDR *path)
553__swi_end(0x2E3, fexists, (path));
554
562__swi_begin(0x012)
563int GetFileAttrib(const char *path, uint8_t *attr, uint32_t *err)
564__swi_end(0x012, GetFileAttrib, (path, attr, err));
565
569__swi_begin(0x3BD)
570int GetFileAttrib_ws(const WSHDR *path, uint8_t *attr, uint32_t *err)
571__swi_end(0x3BD, GetFileAttrib_ws, (path, attr, err));
572
580__swi_begin(0x013)
581int SetFileAttrib(const char *path, uint8_t attr, uint32_t *err)
582__swi_end(0x013, SetFileAttrib, (path, attr, err));
583
587__swi_begin(0x3BE)
588int SetFileAttrib_ws(const WSHDR *path, uint8_t attr, uint32_t *err)
589__swi_end(0x3BE, SetFileAttrib_ws, (path, attr, err));
590
599__swi_begin(0x246)
600int GetFileProp(FILE_PROP *props, const WSHDR *file, const WSHDR *path)
601__swi_end(0x246, GetFileProp, (props, file, path));
602
603#ifdef NEWSGOLD
610__swi_begin(0x045)
611int GetWavLen(const char *path)
612__swi_end(0x045, GetWavLen, (path));
613#else
620__swi_begin(0x045)
621int GetWavLen(TWavLen *wav_info)
622__swi_end(0x045, GetWavLen, (wav_info));
623#endif
624
635__swi_begin(0x06B)
636int FindFirstFile(DIR_ENTRY *dir_entry, const char *mask, uint32_t *err)
637__swi_end(0x06B, FindFirstFile, (dir_entry, mask, err));
638
642__swi_begin(0x3BF)
643int FindFirstFile_ws(DIR_ENTRY *dir_entry, const WSHDR *mask, uint32_t *err)
644__swi_end(0x3BF, FindFirstFile_ws, (dir_entry, mask, err));
645
653__swi_begin(0x06C)
654int FindNextFile(DIR_ENTRY *dir_entry, uint32_t *err)
655__swi_end(0x06C, FindNextFile, (dir_entry, err));
656
664__swi_begin(0x083)
665int GetPathOfFoundFile(DIR_ENTRY *dir_entry, void *file_info)
666__swi_end(0x083, GetPathOfFoundFile, (dir_entry, file_info));
667
674__swi_begin(0x06D)
675int FindClose(DIR_ENTRY *dir_entry, uint32_t *err)
676__swi_end(0x06D, FindClose, (dir_entry, err));
677
684__swi_begin(0x08A)
685int GetFreeFlexSpace(int drive, uint32_t *err)
686__swi_end(0x08A, GetFreeFlexSpace, (drive, err));
687
694__swi_begin(0x08B)
695int GetTotalFlexSpace(int drive, uint32_t *err)
696__swi_end(0x08B, GetTotalFlexSpace, (drive, err));
697
698// ------------------------------------------------------
709__swi_begin(0x084)
710int GetFileStats(const char *path, FSTATS *stat, uint32_t *err)
711__swi_end(0x084, GetFileStats, (path, stat, err));
712
717__swi_begin(0x00A)
718int _open(const char *path, uint32_t mode, uint32_t permission, uint32_t *err)
719__swi_end(0x00A, _open, (path, mode, permission, err));
720
725__swi_begin(0x00B)
726int _read(int fd, void *buffer, int length, uint32_t *err)
727__swi_end(0x00B, _read, (fd, buffer, length, err));
728
733__swi_begin(0x00C)
734int _write(int fd, const void *buffer, int length, uint32_t *err)
735__swi_end(0x00C, _write, (fd, buffer, length, err));
736
741__swi_begin(0x00D)
742int _close(int fd, uint32_t *err)
743__swi_end(0x00D, _close, (fd, err));
744
749__swi_begin(0x00E)
750int _flush(int fd, uint32_t *err)
751__swi_end(0x00E, _flush, (fd, err));
752
757__swi_begin(0x00F)
758long _lseek(int fd, uint32_t offset, uint32_t origin, uint32_t *err, uint32_t *err2)
759__swi_end(0x00F, _lseek, (fd, offset, origin, err, err2));
760
765__swi_begin(0x010)
766int _mkdir(const char *dirname, uint32_t *err)
767__swi_end(0x010, _mkdir, (dirname, err));
768
773__swi_begin(0x08F)
774int _rmdir(const char *dirname, uint32_t *err)
775__swi_end(0x08F, _rmdir, (dirname, err));
776
781__swi_begin(0x16B)
782int _unlink(const char *path, uint32_t *err)
783__swi_end(0x16B, _unlink, (path, err));
784
789__swi_begin(0x090)
790int _truncate(int fd, int length, uint32_t *err)
791__swi_end(0x090, _truncate, (fd, length, err));
792
794// ------------------------------------------------------
795
807__swi_begin(0x4E3)
808void *FS_MemAlloc(int size)
809__swi_end(0x4E3, FS_MemAlloc, (size));
810
818__swi_begin(0x84E8)
820__swi_end(0x84E8, RamFsDrivers, ());
821
826__swi_begin(0x84E9)
828__swi_end(0x84E9, RamFsDrives, ());
829
832// ------------------------------------------------------
833#ifdef SWILIB_LEGACY_COMPAT
845__swi_begin(0x00A)
846int fopen(const char *path, uint32_t mode, uint32_t permission, uint32_t *err)
847__swi_end(0x00A, fopen, (path, mode, permission, err));
848
853__swi_begin(0x00B)
854int fread(int fd, void *buffer, int length, uint32_t *err)
855__swi_end(0x00B, fread, (fd, buffer, length, err));
856
861__swi_begin(0x00D)
862int fclose(int fd, uint32_t *err)
863__swi_end(0x00D, fclose, (fd, err));
864
869__swi_begin(0x00E)
870int fflush(int fd, uint32_t *err)
871__swi_end(0x00E, fflush, (fd, err));
872
877__swi_begin(0x00C)
878int fwrite(int fd, const void *buffer, int length, uint32_t *err)
879__swi_end(0x00C, fwrite, (fd, buffer, length, err));
880
885__swi_begin(0x00F)
886long lseek(int fd, uint32_t offset, uint32_t origin, uint32_t *err, uint32_t *err2)
887__swi_end(0x00F, lseek, (fd, offset, origin, err, err2));
888
893__swi_begin(0x010)
894int mkdir(const char *dirname, uint32_t *err)
895__swi_end(0x010, mkdir, (dirname, err));
896
901__swi_begin(0x08F)
902int rmdir(const char *dirname, uint32_t *err)
903__swi_end(0x08F, rmdir, (dirname, err));
904
909__swi_begin(0x16B)
910int unlink(const char *path, uint32_t *err)
911__swi_end(0x16B, unlink, (path, err));
912
917__swi_begin(0x090)
918int truncate(int fd, int length, uint32_t *err)
919__swi_end(0x090, truncate, (fd, length, err));
920
922#endif
923// ------------------------------------------------------
924
926
#define __swilib_begin
Definition doxygen.h:29
#define __swi_end(number, func, call)
Definition doxygen.h:33
#define __swi_begin(number)
Definition doxygen.h:32
#define __swilib_end
Definition doxygen.h:30
int(* find_next_file)(int async, DIR_ENTRY *de, uint32_t *err, int req)
Definition file.h:234
int(* close)(int async, int fd, uint32_t *err, int req)
Definition file.h:193
const FS_OPS * ops
Driver methods.
Definition file.h:284
uint8_t alias
Alternative drive letter, 0 = none.
Definition file.h:278
int unk_20
Definition file.h:184
int(* open)(int async, const char *path, uint32_t mode, uint32_t perm, uint32_t *err, int req)
Definition file.h:237
uint8_t letter
Drive letter.
Definition file.h:277
int(* set_file_attrib)(int async, const char *path, uint8_t attr, uint32_t *err, int req)
Definition file.h:242
char unk4
Definition file.h:91
int unk_08
Definition file.h:178
int(* fflush)(int async, int fd, uint32_t *err, int req)
Definition file.h:195
uint16_t mtime_time
Definition file.h:95
uint16_t type
IN: info type, see FilePropTypeID.
Definition file.h:140
void * unk_70
Definition file.h:254
int(* write16)(int async, int fd, const void *buf, int len, uint32_t *err, int req)
16-bit result
Definition file.h:249
char unk1
Definition file.h:88
int used
Nonzero when the entry is registered.
Definition file.h:273
char unk5[12]
Definition file.h:93
WSHDR * resolution_ws
OUT: Picture resolution in the human-readable format.
Definition file.h:142
int used
Nonzero when the entry is registered.
Definition file.h:262
int(* get_file_attrib)(int async, const char *path, uint8_t *attr, uint32_t *err, int req)
Definition file.h:231
int unk_1C
Definition file.h:183
int16_t last_handle
Last file handle of the driver.
Definition file.h:265
int(* is_dir)(int async, const char *path, uint32_t *err, int req)
Definition file.h:235
uint32_t size
Definition file.h:92
int(* get_free_space)(int async, int16_t drive, uint32_t *err, int req)
Definition file.h:232
int unk_10
Definition file.h:180
char unk1[16]
Definition file.h:76
int(* fstat)(int async, int fd, FSTATS *stat, uint32_t *err, int req)
Definition file.h:194
int(* set_file_time)(int async, int fd, const void *datetime, uint32_t *err, int req)
Definition file.h:244
char unk0[14]
Definition file.h:72
int(* stat)(int async, const char *path, FSTATS *stat, uint32_t *err, int req)
Definition file.h:245
int(* find_close)(int async, DIR_ENTRY *de, uint32_t *err, int req)
Definition file.h:230
int id
Driver ID.
Definition file.h:263
int(* rmdir)(int async, const char *path, uint32_t *err, int req)
Definition file.h:240
void * unk_6C
Definition file.h:253
int unk_14
Definition file.h:181
int(* mkdir)(int async, const char *path, uint32_t *err, int req)
Definition file.h:236
char folder_name[128]
Definition file.h:77
char unk2
Definition file.h:78
void * unk_58
Definition file.h:248
int(* rename)(int async, const char *old_path, const char *new_path, uint32_t *err, int req)
Definition file.h:239
char unk2
Definition file.h:89
int16_t first_handle
First file handle of the driver.
Definition file.h:264
int uid
IN: ID of the extension, see: GetExtUidByFileName_ws.
Definition file.h:143
WSHDR * video_ws
OUT: Video duration in the human-readable format.
Definition file.h:148
char unk6[12]
Definition file.h:97
int(* set_file_size)(int async, int fd, uint32_t size, uint32_t *err, int req)
Definition file.h:243
short file_attr
Definition file.h:73
int(* format)(int async, int16_t drive, uint32_t *err, int req)
Definition file.h:229
uint32_t create_date_time
Definition file.h:74
char unk3
Definition file.h:90
int(* get_total_space)(int drive)
Definition file.h:251
uint8_t unk2[4]
Definition file.h:283
char file_name[271]
Definition file.h:79
unsigned short type
Definition file.h:176
long length
OUT: .wav duration in clocks (1 clock - 4.615 ms)
Definition file.h:182
int unk1
Definition file.h:282
int(* lseek)(int async, int fd, int32_t offset, uint32_t origin, uint32_t *err, uint32_t *err2, int req)
Definition file.h:241
WSHDR * wfilename
IN: Path ot the .wav file.
Definition file.h:177
int driver_id
Driver ID, see RamFsDrivers.
Definition file.h:281
const FS_OPS * ops
Driver methods.
Definition file.h:266
WSHDR * filename
IN: full path to the file.
Definition file.h:141
uint16_t mtime_date
Definition file.h:94
uint16_t height
OUT: Picture resolution: height.
Definition file.h:145
int file_attr
Definition file.h:96
uint16_t width
OUT: Picture resolution: width.
Definition file.h:144
WSHDR * duration_wav_ws
OUT: Audio duration in the human-readable format.
Definition file.h:146
uint32_t file_size
Definition file.h:75
int(* read16)(int async, int fd, void *buf, int len, uint32_t *err, int req)
16-bit result
Definition file.h:238
int(* find_first_file)(int async, DIR_ENTRY *de, const char *mask, uint32_t *err, int req)
Definition file.h:233
uint32_t duration_wav
OUT: Audio duration in clocks (1 clock = 4.615 ms)
Definition file.h:147
int(* get_drive_info)(int16_t drive, void *info)
Fills a driver-specific drive info block.
Definition file.h:250
int16_t drive
Drive number.
Definition file.h:280
int unk_0C
Definition file.h:179
int(* truncate)(int async, int fd, int length, uint32_t *err, int req)
Definition file.h:246
int(* unlink)(int async, const char *path, uint32_t *err, int req)
Definition file.h:247
int video_len
OUT: Video duration in clocks (1 clock = 4.615 ms)
Definition file.h:149
int(* unk_68)(int drive)
Definition file.h:252
int sys_fflush(int fd, uint32_t *err)
Force write data from the OS write buffer.
long _lseek(int fd, uint32_t offset, uint32_t origin, uint32_t *err, uint32_t *err2)
Move to the desired position within the file.
int GetFreeFlexSpace(int drive, uint32_t *err)
Get free space on a specified disk.
int sys_rename_ws(const WSHDR *old_name, const WSHDR *new_name, uint32_t *err)
Rename file or directory.
int GetFileAttrib_ws(const WSHDR *path, uint8_t *attr, uint32_t *err)
Get attributes of the file or directory.
int GetWavLen(TWavLen *wav_info)
Get duration of the .wav file.
int setfiletime(int fd, uint16_t date, uint16_t time, uint32_t *err)
Set file date and time.
int sys_stat_ws(const WSHDR *path, FSTATS *stat, uint32_t *err)
Get information about the file or directory.
FilePermissionMode
Request permissions for file operations.
Definition file.h:49
int rmdir(const char *dirname, uint32_t *err)
Remove directory.
long sys_lseek(int fd, int32_t offset, uint32_t origin, uint32_t *err, uint32_t *err2)
Move to the desired position within the file.
int sys_close(int fd, uint32_t *err)
Close file descriptor.
FileAccessMode
File access mode.
Definition file.h:156
int truncate(int fd, int length, uint32_t *err)
Truncate the file to the given size.
int fclose(int fd, uint32_t *err)
Close file descriptor.
int sys_unlink_ws(const WSHDR *path, uint32_t *err)
Remove file.
FileSeekOrigin
Modes for seek()
Definition file.h:40
int unlink(const char *path, uint32_t *err)
Remove file.
int SetFileAttrib(const char *path, uint8_t attr, uint32_t *err)
Set attributes for the file or directory.
int sys_fstat(int fd, FSTATS *stat, uint32_t *err)
Get information about the file or directory by fd.
FileAttributes
Attributes for a file or directory.
Definition file.h:29
int sys_unlink(const char *path, uint32_t *err)
Remove file.
int SetFileAttrib_ws(const WSHDR *path, uint8_t attr, uint32_t *err)
Set attributes for the file or directory.
int _mkdir(const char *dirname, uint32_t *err)
Create a new directory.
int sys_mkdir(const char *dirname, uint32_t *err)
Create a new directory.
int _read(int fd, void *buffer, int length, uint32_t *err)
Read data from a file.
int _open(const char *path, uint32_t mode, uint32_t permission, uint32_t *err)
Open the file.
int mkdir(const char *dirname, uint32_t *err)
Create a new directory.
int sys_mount(uint16_t drive, uint32_t *err)
Mount drive by index.
int sys_read(int fd, void *buffer, int length, uint32_t *err)
Read data from a file.
int fopen(const char *path, uint32_t mode, uint32_t permission, uint32_t *err)
Open the file.
int _truncate(int fd, int length, uint32_t *err)
Truncate the file to the given size.
int sys_rmdir(const char *dirname, uint32_t *err)
Remove directory.
long lseek(int fd, uint32_t offset, uint32_t origin, uint32_t *err, uint32_t *err2)
Move to the desired position within the file.
int sys_truncate(int fd, int length, uint32_t *err)
Truncate the file to the given size.
int FindClose(DIR_ENTRY *dir_entry, uint32_t *err)
Close search session.
int _unlink(const char *path, uint32_t *err)
Remove file.
int sys_rename(const char *old_name, const char *new_name, uint32_t *err)
Rename file or directory.
int sys_unmount(uint16_t drive, uint32_t *err)
Unmount drive by index.
int sys_mkdir_ws(const WSHDR *dirname, uint32_t *err)
Create a new directory.
int _write(int fd, const void *buffer, int length, uint32_t *err)
Write data to a file.
int GetFileStats(const char *path, FSTATS *stat, uint32_t *err)
Get information about the file or directory.
int sys_rmdir_ws(const WSHDR *path, uint32_t *err)
Remove directory.
int sys_stat(const char *path, FSTATS *stat, uint32_t *err)
Get information about the file or directory.
int fread(int fd, void *buffer, int length, uint32_t *err)
Read data from a file.
int isdir_ws(const WSHDR *path, uint32_t *err)
Check whether a directory exists at the given path.
FS_DRIVE * RamFsDrives(void)
Get the file system drive table.
int GetTotalFlexSpace(int drive, uint32_t *err)
Get total space on a specified disk.
int isdir(const char *path, uint32_t *err)
Check whether a directory exists at the given path.
int _close(int fd, uint32_t *err)
Close file descriptor.
int sys_write(int fd, const void *buffer, int length, uint32_t *err)
Write data to a file.
int fmove(const char *old_name, const char *new_name, uint32_t *err)
Rename file or directory.
int sys_format(uint16_t drive, uint32_t *err)
Format drive by index.
int FindFirstFile_ws(DIR_ENTRY *dir_entry, const WSHDR *mask, uint32_t *err)
Open search session and get first result.
FS_DRIVER * RamFsDrivers(void)
Get the file system driver table.
int fflush(int fd, uint32_t *err)
Force write data from the OS write buffer.
int _rmdir(const char *dirname, uint32_t *err)
Remove directory.
int GetFileAttrib(const char *path, uint8_t *attr, uint32_t *err)
Get attributes of the file or directory.
int GetPathOfFoundFile(DIR_ENTRY *dir_entry, void *file_info)
Convert a directory-search result to the SG/X75 file-list record.
int sys_open(const char *path, uint32_t mode, uint32_t permission, uint32_t *err)
Open the file.
int GetFileProp(FILE_PROP *props, const WSHDR *file, const WSHDR *path)
Get extended file properties.
int _flush(int fd, uint32_t *err)
Force write data from the OS write buffer.
FilePropTypeID
Definition file.h:100
int setfilesize(int fd, uint32_t length, uint32_t *err)
Truncate or grow the file to the given size.
int FindNextFile(DIR_ENTRY *dir_entry, uint32_t *err)
Continue searching for files and get next result.
int fwrite(int fd, const void *buffer, int length, uint32_t *err)
Write data to a file.
int FindFirstFile(DIR_ENTRY *dir_entry, const char *mask, uint32_t *err)
Open search session and get first result.
void * FS_MemAlloc(int size)
Allocate memory from the file system heap.
int fexists(WSHDR *path)
Check if a regular file exists.
@ P_WRITE
Definition file.h:50
@ P_READ
Definition file.h:51
@ A_WriteOnly
Definition file.h:158
@ A_FailCreateOnExist
Definition file.h:166
@ A_ReadWrite
Definition file.h:159
@ A_Exclusive
Definition file.h:162
@ A_NoShare
Definition file.h:160
@ A_TXT
Definition file.h:168
@ A_ReadOnly
Definition file.h:157
@ A_BIN
Definition file.h:169
@ A_Truncate
Definition file.h:165
@ A_FailOnReopen
Definition file.h:167
@ A_MMCStream
Definition file.h:163
@ A_Append
Definition file.h:161
@ A_Create
Definition file.h:164
@ S_SET
Definition file.h:41
@ S_END
Definition file.h:43
@ S_CUR
Definition file.h:42
@ FA_HIDDEN
Definition file.h:31
@ FA_SYSTEM
Definition file.h:32
@ FA_READONLY
Definition file.h:30
@ FA_ARCHIVE
Definition file.h:34
@ FA_DIRECTORY
Definition file.h:33
@ FILE_PROP_TYPE_PICTURE
Picture info.
Definition file.h:109
@ FILE_PROP_TYPE_AUDIO
Audio info.
Definition file.h:110
@ FILE_PROP_TYPE_VIDEO
Video info.
Definition file.h:108
Directory entry.
Definition file.h:58
Extended file properties.
Definition file.h:118
File system drive (see RamFsDrives).
Definition file.h:272
File system driver (see RamFsDrivers).
Definition file.h:261
File system driver methods (see FS_DRIVER and FS_DRIVE).
Definition file.h:192
Information about a file or directory.
Definition file.h:87
.wav duration info.
Definition file.h:175
Wide-string header.
Definition wstring.h:35
#define const
Definition zconf.h:115