From 17f41fd361995d414abc3a384f88b95bc1c8bc90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Wed, 22 Nov 2023 22:57:44 +0100 Subject: [PATCH] bring vfs_reload() back --- bind/v4k.lua | 3 ++- engine/joint/v4k.h | 5 ++++- engine/split/v4k_file.c | 4 +++- engine/split/v4k_file.h | 1 + engine/v4k.c | 4 +++- engine/v4k.h | 1 + 6 files changed, 14 insertions(+), 4 deletions(-) diff --git a/bind/v4k.lua b/bind/v4k.lua index 94a547b..2a57fa0 100644 --- a/bind/v4k.lua +++ b/bind/v4k.lua @@ -2236,6 +2236,7 @@ SCRIPT_DEBUGGER = 2, char * vfs_read(const char *pathfile); char * vfs_load(const char *pathfile, int *size); int vfs_size(const char *pathfile); + void vfs_reload(); const char * vfs_resolve(const char *fuzzyname); FILE* vfs_handle(const char *pathfile); void * cache_insert(const char *key, void *value, int size); @@ -3186,7 +3187,7 @@ unsigned play; bool paused; struct atlas_t *a; } sprite_t; -enum { OBJTYPE_sprite_t = 10 }; typedef struct { unsigned static_assert_on_L__LINE__ : !!(10 <= 255); } static_assert_on_Lconcat(_L,3780)___COUNTER__; typedef struct { unsigned static_assert_on_L__LINE__ : !!(sizeof(sprite_t)); } static_assert_on_Lconcat(_L,3780)___COUNTER__;; +enum { OBJTYPE_sprite_t = 10 }; typedef struct { unsigned static_assert_on_L__LINE__ : !!(10 <= 255); } static_assert_on_Lconcat(_L,3781)___COUNTER__; typedef struct { unsigned static_assert_on_L__LINE__ : !!(sizeof(sprite_t)); } static_assert_on_Lconcat(_L,3781)___COUNTER__;; void sprite_ctor(sprite_t *s); void sprite_dtor(sprite_t *s); void sprite_tick(sprite_t *s); diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index b2768b8..8e5c48e 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -16018,6 +16018,7 @@ API char * vfs_read(const char *pathfile); API char * vfs_load(const char *pathfile, int *size); API int vfs_size(const char *pathfile); +API void vfs_reload(); API const char * vfs_resolve(const char *fuzzyname); // guess best match. @todo: fuzzy path //API const char*vfs_extract(const char *pathfile); // extracts vfs file into local filesystem (temporary file), so it can be read by foreign/3rd party libs API FILE* vfs_handle(const char *pathfile); // same as above, but returns file handle instead. preferred way, will clean descriptors at exit @@ -355777,10 +355778,12 @@ static array(struct vfs_entry) vfs_hints; // mounted raw assets static array(struct vfs_entry) vfs_entries; // mounted cooked assets static bool vfs_mount_hints(const char *path); -static + void vfs_reload() { const char *app = app_name(); + dir_cache = 0; // @leak + array_resize(vfs_hints, 0); // @leak array_resize(vfs_entries, 0); // @leak diff --git a/engine/split/v4k_file.c b/engine/split/v4k_file.c index 824e95c..68d4730 100644 --- a/engine/split/v4k_file.c +++ b/engine/split/v4k_file.c @@ -581,10 +581,12 @@ static array(struct vfs_entry) vfs_hints; // mounted raw assets static array(struct vfs_entry) vfs_entries; // mounted cooked assets static bool vfs_mount_hints(const char *path); -static + void vfs_reload() { const char *app = app_name(); + dir_cache = 0; // @leak + array_resize(vfs_hints, 0); // @leak array_resize(vfs_entries, 0); // @leak diff --git a/engine/split/v4k_file.h b/engine/split/v4k_file.h index 75950ba..a7d2f90 100644 --- a/engine/split/v4k_file.h +++ b/engine/split/v4k_file.h @@ -68,6 +68,7 @@ API char * vfs_read(const char *pathfile); API char * vfs_load(const char *pathfile, int *size); API int vfs_size(const char *pathfile); +API void vfs_reload(); API const char * vfs_resolve(const char *fuzzyname); // guess best match. @todo: fuzzy path //API const char*vfs_extract(const char *pathfile); // extracts vfs file into local filesystem (temporary file), so it can be read by foreign/3rd party libs API FILE* vfs_handle(const char *pathfile); // same as above, but returns file handle instead. preferred way, will clean descriptors at exit diff --git a/engine/v4k.c b/engine/v4k.c index bb2c3ab..033416d 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -8040,10 +8040,12 @@ static array(struct vfs_entry) vfs_hints; // mounted raw assets static array(struct vfs_entry) vfs_entries; // mounted cooked assets static bool vfs_mount_hints(const char *path); -static + void vfs_reload() { const char *app = app_name(); + dir_cache = 0; // @leak + array_resize(vfs_hints, 0); // @leak array_resize(vfs_entries, 0); // @leak diff --git a/engine/v4k.h b/engine/v4k.h index 6364ea3..9b0ec7a 100644 --- a/engine/v4k.h +++ b/engine/v4k.h @@ -2085,6 +2085,7 @@ API char * vfs_read(const char *pathfile); API char * vfs_load(const char *pathfile, int *size); API int vfs_size(const char *pathfile); +API void vfs_reload(); API const char * vfs_resolve(const char *fuzzyname); // guess best match. @todo: fuzzy path //API const char*vfs_extract(const char *pathfile); // extracts vfs file into local filesystem (temporary file), so it can be read by foreign/3rd party libs API FILE* vfs_handle(const char *pathfile); // same as above, but returns file handle instead. preferred way, will clean descriptors at exit