mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-04 21:34:41 +00:00
Update inlcuded ttvfs
This commit is contained in:
parent
fe0a91129f
commit
ffa26e4105
22 changed files with 327 additions and 153 deletions
|
@ -10,3 +10,7 @@ add_library(ttvfs_cfileapi ${cfileapi_SRC})
|
|||
|
||||
target_link_libraries(ttvfs_cfileapi ttvfs)
|
||||
|
||||
install(TARGETS ttvfs_cfileapi DESTINATION lib)
|
||||
|
||||
install(DIRECTORY ./ DESTINATION include/ttvfs
|
||||
FILES_MATCHING PATTERN "*.h")
|
||||
|
|
|
@ -16,12 +16,6 @@ void ttvfs_setroot(ttvfs::Root *root)
|
|||
|
||||
VFILE *vfopen(const char *fn, const char *mode)
|
||||
{
|
||||
if (strchr(mode, 'w'))
|
||||
{
|
||||
assert(0 && "ttvfs_stdio: File writing via VFS not yet supported!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
VFILE *vf = vfs->GetFile(fn);
|
||||
if (!vf || !vf->open(mode))
|
||||
return NULL;
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
// * Define VFS_ENABLE_C_API to 1 to use ttvfs overrides.
|
||||
|
||||
/*
|
||||
This file is a minimal wrapper to replace the C API and std::ifstream.
|
||||
Note that if you have an advanced needs, this wrapper API is not for you.
|
||||
This file is a poor man's wrapper to replace the C API and std::ifstream.
|
||||
Note that if you have any advanced needs, this wrapper API is not for you.
|
||||
|
||||
To use it, go through your code and rename all FILE* to VFILE*,
|
||||
and fopen() and related to vfopen() (so just put a 'v' in front).
|
||||
Instead of std::ifstream, use InStream. If you use std::fstream for reading ONLY,
|
||||
also use InStream.
|
||||
Make sure that a FILE* is not opened twice at any time - this is not supported.
|
||||
|
||||
Note that the seek and tell functions do not offer 64 bit offsets in this API.
|
||||
*/
|
||||
|
@ -35,6 +36,8 @@ typedef ttvfs::File VFILE;
|
|||
|
||||
void ttvfs_setroot(ttvfs::Root *root);
|
||||
|
||||
// Note that vfopen() returns the same pointer for the same file name,
|
||||
// so effectively a file is a singleton object.
|
||||
VFILE *vfopen(const char *fn, const char *mode);
|
||||
size_t vfread(void *ptr, size_t size, size_t count, VFILE *vf);
|
||||
int vfclose(VFILE *vf);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue