2
3
4
5
6
7
8
9
10
11
12#ifndef EVMU_FILE_MANAGER_H
13#define EVMU_FILE_MANAGER_H
18
19
20
21#define EVMU_FILE_MANAGER_TYPE (GBL_TYPEID
(EvmuFileManager))
22#define EVMU_FILE_MANAGER(self) (GBL_CAST(EvmuFileManager, self))
23#define EVMU_FILE_MANAGER_CLASS(klass) (GBL_CLASS_CAST(EvmuFileManager, klass))
24#define EVMU_FILE_MANAGER_GET_CLASS(self) (GBL_CLASSOF(EvmuFileManager, self))
27#define EVMU_FILE_MANAGER_NAME "filemanager"
29#define GBL_SELF_TYPE EvmuFileManager
34
35
36
37
38
39
40
42GBL_FORWARD_DECLARE_STRUCT(EvmuFileManager)
45
46
47
48
49
50GBL_CLASS_DERIVE(EvmuFileManager, EvmuFat)
51 EVMU_RESULT (*pFnLoad) (GBL_SELF,
const char* pPath);
52 EVMU_RESULT (*pFnSave) (GBL_SELF,
const char* pPath);
53 EVMU_RESULT (*pFnExport)(GBL_CSELF,
const EvmuDirEntry* pEntry,
const char* pPath);
57
58
59
60
61
62
63
64
65
66
67
71GBL_SIGNALS(EvmuFileManager,
72 (fileAdded, (GBL_INSTANCE_TYPE, pReceiver), (GBL_POINTER_TYPE, pDirEntry)),
73 (fileRemoved, (GBL_INSTANCE_TYPE, pReceiver), (GBL_POINTER_TYPE, pDirEntry))
81
82
83
84
94
95
96
97
110 EvmuDirEntryIterFn pFnIt,
111 void* pClosure) GBL_NOEXCEPT;
115
116
117
118
121 EvmuNewFileInfo* pInfo,
122 const void* pData) GBL_NOEXCEPT;
125 EvmuDirEntry* pEntry) GBL_NOEXCEPT;
128 const EvmuDirEntry* pEntry,
135 const EvmuDirEntry* pEntry,
138 size_t offset) GBL_NOEXCEPT;
141 const EvmuDirEntry* pEntry,
142 const char* pPath) GBL_NOEXCEPT;
146
147
148
149
152 const EvmuDirEntry* pEntry) GBL_NOEXCEPT;
155 const EvmuDirEntry* pEntry) GBL_NOEXCEPT;
158 const EvmuDirEntry* pEntry) GBL_NOEXCEPT;
161 const EvmuDirEntry* pEntry) GBL_NOEXCEPT;
#define EVMU_EXPORT
Define used for adding attributes to export public symbols.
GblType EvmuFileManager_type(void)
Returns the GblType UUID associated with EvmuFileManager.
High-level file-oriented flash API.
GblBool EvmuFileManager_foreach(const EvmuFileManager *pSelf, EvmuDirEntryIterFn pFnIt, void *pClosure)
Iterates over directory entries, passing each with pClosure to pFnIt, returning early with GBL_TRUE i...
EVMU_RESULT EvmuFileManager_defrag(EvmuFileManager *pSelf)
Defragments the filesystem, consolidating all free blocks, storing all files contiguously.
EvmuDirEntry * EvmuFileManager_alloc(EvmuFileManager *pSelf, EvmuNewFileInfo *pInfo, const void *pData)
Creates storage for a new file with the given info, copying its contents into the filesystem.
size_t EvmuFileManager_write(const EvmuFileManager *pSelf, const EvmuDirEntry *pEntry, const void *pBuffer, size_t size, size_t offset)
Performs a generic write from an existing file, returning the number of bytes successfully written.
uint16_t EvmuFileManager_crc(const EvmuFileManager *pSelf, const EvmuDirEntry *pEntry)
Calculates the 16-bit CRC for an existing file on the filesystem.
size_t EvmuFileManager_read(const EvmuFileManager *pSelf, const EvmuDirEntry *pEntry, void *pBuffer, size_t size, size_t offset, GblBool inclHdr)
Performs a generic read from an existing file, returning the number of bytes successfully read.
EvmuVms * EvmuFileManager_vms(const EvmuFileManager *pSelf, const EvmuDirEntry *pEntry)
Returns the VMS header segment (ONLY) for an existing file (not the entire VMS data with icons,...
size_t EvmuFileManager_free(EvmuFileManager *pSelf, EvmuDirEntry *pEntry)
Destroys an existing file, releasing resources back to the filesystem.
EvmuDirEntry * EvmuFileManager_find(const EvmuFileManager *pSelf, const char *pName)
Searches for a directory entry with the given name, returning it if found or returning NULL if not fo...
EvmuDirEntry * EvmuFileManager_file(const EvmuFileManager *pSelf, size_t index)
Returns the directory entry for the file at the given index, or NULL if there isn't one.
size_t EvmuFileManager_index(const EvmuFileManager *pSelf, const EvmuDirEntry *pEntry)
Returns the file index corresponding to a given directory entry for a file.
size_t EvmuFileManager_count(const EvmuFileManager *pSelf)
Returns the number of files which are currently loaded within the filesystem.
EVMU_RESULT EvmuFileManager_save(const EvmuFileManager *pSelf, const char *pPath)
Saves a binary image of the entire contents of flash to a file, whose format is determined by its ext...
EvmuDirEntry * EvmuFileManager_iconData(const EvmuFileManager *pSelf)
Returns the directory entry for the currently loaded ICONDATA.VMS file, or NULL if there isn't one.
EVMU_RESULT EvmuFileManager_export(const EvmuFileManager *pSelf, const EvmuDirEntry *pEntry, const char *pPath)
Exports an existing file to the given path, with the file format automatically deduced from the exten...
EvmuDirEntry * EvmuFileManager_game(const EvmuFileManager *pSelf)
Returns the directory entry for the currently loaded GAME file, or NULL if there isn't one.
EVMU_RESULT EvmuFileManager_load(EvmuFileManager *pSelf, const char *pPath)
Loads a generic image whose type is determined by its extension into flash.
size_t EvmuFileManager_bytes(const EvmuFileManager *pSelf, const EvmuDirEntry *pEntry)
Returns the total byte size of the file on the filesystem, including the VMS header,...
#define GBL_CLASS_CAST(cType, klass)
#define GBL_CLASSOF(cType, self)
#define GBL_CAST(cType, self)