diff --git a/_mirror b/_mirror index 494a0e2..157a5b6 160000 --- a/_mirror +++ b/_mirror @@ -1 +1 @@ -Subproject commit 494a0e216d2b4984065994372960d15f197c1e07 +Subproject commit 157a5b6b152ab165a72a98ab9e05f4d47ad0b0de diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index 0ece522..ec69b3b 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -336624,6 +336624,7 @@ void vfs_reload() { // vfs_resolve() will use these art_folder locations as hints when cook-on-demand is in progress. // cook-on-demand will not be able to resolve a virtual pathfile if there are no cooked assets on disk, // unless there is a record of what's actually on disk somewhere, and that's where the hints belong to. + if( COOK_ON_DEMAND ) for each_substring(ART,",",art_folder) { vfs_mount_hints(art_folder); } @@ -336659,6 +336660,8 @@ void ark_list( const char *infile, zip **z ) { static bool vfs_mount_(const char *path, array(struct vfs_entry) *entries) { + const char *path_bak = path; + zip *z = NULL; tar *t = NULL; pak *p = NULL; dir *d = NULL; int is_folder = ('/' == path[strlen(path)-1]); if( is_folder ) d = dir_open(path, "rb"); @@ -336702,6 +336705,8 @@ bool vfs_mount_(const char *path, array(struct vfs_entry) *entries) { // append to list array_push(*entries, (struct vfs_entry){filename, fileid, filesize}); } + + PRINTF("Mounted VFS volume '%s' (%u entries)\n", path_bak, fn_count[dir->type](dir->archive) ); } return 1; @@ -347154,22 +347159,22 @@ int postfx_load_from_mem( postfx *fx, const char *name, const char *fs ) { passfx *p = &fx->pass[ slot & 63 ]; p->name = STRDUP(name); - const char *vs = vfs_read("shaders/vs_0_2_fullscreen_quad_B.glsl"); - - // patch fragment - char *fs2 = (char*)CALLOC(1, 128*1024); - strcat(fs2, vfs_read("shaders/fs_2_4_preamble.glsl")); - - if( strstr(fs, "mainImage") ) { - strcat(fs2, vfs_read("shaders/fs_main_shadertoy.glsl") ); + // preload stuff + static const char *vs = 0; + static const char *preamble = 0; + static const char *shadertoy = 0; + static char *fs2 = 0; + do_once { + vs = STRDUP(vfs_read("shaders/vs_0_2_fullscreen_quad_B.glsl")); + preamble = STRDUP(vfs_read("shaders/fs_2_4_preamble.glsl")); + shadertoy = STRDUP(vfs_read("shaders/fs_main_shadertoy.glsl")); + fs2 = (char*)CALLOC(1, 128*1024); } - - strcat(fs2, fs); + // patch fragment + snprintf(fs2, 128*1024, "%s%s%s", preamble, strstr(fs, "mainImage") ? shadertoy : "", fs ); p->program = shader(vs, fs2, "vtexcoord", "fragColor" , NULL); - FREE(fs2); - glUseProgram(p->program); // needed? for( int i = 0; i < countof(p->uniforms); ++i ) p->uniforms[i] = -1; @@ -357016,8 +357021,8 @@ static void v4k_post_init(float refresh_rate) { for( i = 0; i <= 2; ++i ) { if(i == 0) ui_init(); // init these on thread #0, since both will be compiling shaders, and shaders need to be compiled from the very same thread than glfwMakeContextCurrent() was set up if(i == 0) scene_init(); // init these on thread #0, since both will be compiling shaders, and shaders need to be compiled from the very same thread than glfwMakeContextCurrent() was set up + if(i == 0) window_icon(va("%s.png", app_name())); if(i == 1) input_init(); - if(i == 2) window_icon(va("%s.png", app_name())); } // display window diff --git a/engine/split/v4k_file.c b/engine/split/v4k_file.c index 80f7c09..96a0953 100644 --- a/engine/split/v4k_file.c +++ b/engine/split/v4k_file.c @@ -600,6 +600,7 @@ void vfs_reload() { // vfs_resolve() will use these art_folder locations as hints when cook-on-demand is in progress. // cook-on-demand will not be able to resolve a virtual pathfile if there are no cooked assets on disk, // unless there is a record of what's actually on disk somewhere, and that's where the hints belong to. + if( COOK_ON_DEMAND ) for each_substring(ART,",",art_folder) { vfs_mount_hints(art_folder); } @@ -635,6 +636,8 @@ void ark_list( const char *infile, zip **z ) { static bool vfs_mount_(const char *path, array(struct vfs_entry) *entries) { + const char *path_bak = path; + zip *z = NULL; tar *t = NULL; pak *p = NULL; dir *d = NULL; int is_folder = ('/' == path[strlen(path)-1]); if( is_folder ) d = dir_open(path, "rb"); @@ -678,6 +681,8 @@ bool vfs_mount_(const char *path, array(struct vfs_entry) *entries) { // append to list array_push(*entries, (struct vfs_entry){filename, fileid, filesize}); } + + PRINTF("Mounted VFS volume '%s' (%u entries)\n", path_bak, fn_count[dir->type](dir->archive) ); } return 1; diff --git a/engine/split/v4k_main.c b/engine/split/v4k_main.c index ccdbd9d..f4ef1f3 100644 --- a/engine/split/v4k_main.c +++ b/engine/split/v4k_main.c @@ -32,8 +32,8 @@ static void v4k_post_init(float refresh_rate) { for( i = 0; i <= 2; ++i ) { if(i == 0) ui_init(); // init these on thread #0, since both will be compiling shaders, and shaders need to be compiled from the very same thread than glfwMakeContextCurrent() was set up if(i == 0) scene_init(); // init these on thread #0, since both will be compiling shaders, and shaders need to be compiled from the very same thread than glfwMakeContextCurrent() was set up + if(i == 0) window_icon(va("%s.png", app_name())); if(i == 1) input_init(); - if(i == 2) window_icon(va("%s.png", app_name())); } // display window diff --git a/engine/split/v4k_render.c b/engine/split/v4k_render.c index 5141378..264f66c 100644 --- a/engine/split/v4k_render.c +++ b/engine/split/v4k_render.c @@ -3228,22 +3228,22 @@ int postfx_load_from_mem( postfx *fx, const char *name, const char *fs ) { passfx *p = &fx->pass[ slot & 63 ]; p->name = STRDUP(name); - const char *vs = vfs_read("shaders/vs_0_2_fullscreen_quad_B.glsl"); - - // patch fragment - char *fs2 = (char*)CALLOC(1, 128*1024); - strcat(fs2, vfs_read("shaders/fs_2_4_preamble.glsl")); - - if( strstr(fs, "mainImage") ) { - strcat(fs2, vfs_read("shaders/fs_main_shadertoy.glsl") ); + // preload stuff + static const char *vs = 0; + static const char *preamble = 0; + static const char *shadertoy = 0; + static char *fs2 = 0; + do_once { + vs = STRDUP(vfs_read("shaders/vs_0_2_fullscreen_quad_B.glsl")); + preamble = STRDUP(vfs_read("shaders/fs_2_4_preamble.glsl")); + shadertoy = STRDUP(vfs_read("shaders/fs_main_shadertoy.glsl")); + fs2 = (char*)CALLOC(1, 128*1024); } - - strcat(fs2, fs); + // patch fragment + snprintf(fs2, 128*1024, "%s%s%s", preamble, strstr(fs, "mainImage") ? shadertoy : "", fs ); p->program = shader(vs, fs2, "vtexcoord", "fragColor" , NULL); - FREE(fs2); - glUseProgram(p->program); // needed? for( int i = 0; i < countof(p->uniforms); ++i ) p->uniforms[i] = -1; diff --git a/engine/v4k.c b/engine/v4k.c index 76e699c..2dae04a 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -5586,6 +5586,7 @@ void vfs_reload() { // vfs_resolve() will use these art_folder locations as hints when cook-on-demand is in progress. // cook-on-demand will not be able to resolve a virtual pathfile if there are no cooked assets on disk, // unless there is a record of what's actually on disk somewhere, and that's where the hints belong to. + if( COOK_ON_DEMAND ) for each_substring(ART,",",art_folder) { vfs_mount_hints(art_folder); } @@ -5621,6 +5622,8 @@ void ark_list( const char *infile, zip **z ) { static bool vfs_mount_(const char *path, array(struct vfs_entry) *entries) { + const char *path_bak = path; + zip *z = NULL; tar *t = NULL; pak *p = NULL; dir *d = NULL; int is_folder = ('/' == path[strlen(path)-1]); if( is_folder ) d = dir_open(path, "rb"); @@ -5664,6 +5667,8 @@ bool vfs_mount_(const char *path, array(struct vfs_entry) *entries) { // append to list array_push(*entries, (struct vfs_entry){filename, fileid, filesize}); } + + PRINTF("Mounted VFS volume '%s' (%u entries)\n", path_bak, fn_count[dir->type](dir->archive) ); } return 1; @@ -16116,22 +16121,22 @@ int postfx_load_from_mem( postfx *fx, const char *name, const char *fs ) { passfx *p = &fx->pass[ slot & 63 ]; p->name = STRDUP(name); - const char *vs = vfs_read("shaders/vs_0_2_fullscreen_quad_B.glsl"); - - // patch fragment - char *fs2 = (char*)CALLOC(1, 128*1024); - strcat(fs2, vfs_read("shaders/fs_2_4_preamble.glsl")); - - if( strstr(fs, "mainImage") ) { - strcat(fs2, vfs_read("shaders/fs_main_shadertoy.glsl") ); + // preload stuff + static const char *vs = 0; + static const char *preamble = 0; + static const char *shadertoy = 0; + static char *fs2 = 0; + do_once { + vs = STRDUP(vfs_read("shaders/vs_0_2_fullscreen_quad_B.glsl")); + preamble = STRDUP(vfs_read("shaders/fs_2_4_preamble.glsl")); + shadertoy = STRDUP(vfs_read("shaders/fs_main_shadertoy.glsl")); + fs2 = (char*)CALLOC(1, 128*1024); } - - strcat(fs2, fs); + // patch fragment + snprintf(fs2, 128*1024, "%s%s%s", preamble, strstr(fs, "mainImage") ? shadertoy : "", fs ); p->program = shader(vs, fs2, "vtexcoord", "fragColor" , NULL); - FREE(fs2); - glUseProgram(p->program); // needed? for( int i = 0; i < countof(p->uniforms); ++i ) p->uniforms[i] = -1; @@ -25978,8 +25983,8 @@ static void v4k_post_init(float refresh_rate) { for( i = 0; i <= 2; ++i ) { if(i == 0) ui_init(); // init these on thread #0, since both will be compiling shaders, and shaders need to be compiled from the very same thread than glfwMakeContextCurrent() was set up if(i == 0) scene_init(); // init these on thread #0, since both will be compiling shaders, and shaders need to be compiled from the very same thread than glfwMakeContextCurrent() was set up + if(i == 0) window_icon(va("%s.png", app_name())); if(i == 1) input_init(); - if(i == 2) window_icon(va("%s.png", app_name())); } // display window diff --git a/tools/ark.c b/tools/ark.c index 899795a..ca5fb20 100644 --- a/tools/ark.c +++ b/tools/ark.c @@ -25,7 +25,7 @@ // // Where, each archive-entry is { // [zero] 472-byte aligned zero padding -// [mark] 64-bit magic id 'Ark\x1' (if \1krA is found, swap endianness) +// [mark] 64-bit magic id 'ArK1' (if 1KrA is found, swap endianness) // [time] 64-bit time stamp in seconds (unix epoch) // [dlen] 64-bit data length // [hash] 64-bit data hash @@ -39,7 +39,7 @@ #include #include -#define ARK1 'ArK\x1' +#define ARK1 'ArK1' #define ARK1_PADDING (512 - 40) // 472 #ifndef ARK_PRINTF diff --git a/tools/ark.exe b/tools/ark.exe index b630d64..eff651f 100644 Binary files a/tools/ark.exe and b/tools/ark.exe differ