main
Dominik Madarász 2023-10-22 00:05:22 +02:00
parent 011fb89b4b
commit f727f387ae
9 changed files with 48 additions and 39 deletions

@ -1 +1 @@
Subproject commit f7cf64ed703b21981c5c5e600bd55c43e0b9e66e Subproject commit b7dc66559ecfae5c485f883470384eaf7e9fb55f

View File

@ -14148,7 +14148,7 @@ extern "C" {
#define ifdef_release ifdef_false #define ifdef_release ifdef_false
#endif #endif
#if ENABLE_RETAIL #if ENABLE_RETAIL // NDEBUG>=2 ?
#define ifdef_retail ifdef_true #define ifdef_retail ifdef_true
#else #else
#define ifdef_retail ifdef_false #define ifdef_retail ifdef_false
@ -336213,11 +336213,14 @@ int cook(void *userdata) {
cook_subscript_t cs = mcs.cs[pass]; cook_subscript_t cs = mcs.cs[pass];
// log to batch file for forensic purposes, if explicitly requested // log to batch file for forensic purposes, if explicitly requested
static __thread bool logging = 0; do_once logging = !!flag("--cook-debug") || cook_debug; static __thread int logging = -1; if(logging < 0) logging = !!flag("--cook-debug") || cook_debug;
if( logging ) { if( logging ) {
FILE *logfile = fopen(va("cook%d.cmd",job->threadid), "a+t"); static __thread FILE *logfile = 0; if(!logfile) fseek(logfile = fopen(va("cook%d.cmd",job->threadid), "a+t"), 0L, SEEK_END);
if( logfile ) { fprintf(logfile, "@rem %s\n%s\n", cs.outname, cs.script); fclose(logfile); } if( logfile ) {
fprintf(stderr, "%s\n", cs.script); fprintf(logfile, "@rem %s\n%s\n", cs.outname, cs.script);
fprintf(logfile, "for %%%%i in (\"%s\") do md _cook\\%%%%~pi\\%%%%~ni%%%%~xi 1>nul 2>nul\n", infile);
fprintf(logfile, "for %%%%i in (\"%s\") do xcopy /y %s _cook\\%%%%~pi\\%%%%~ni%%%%~xi\n\n", infile, file_normalize(cs.outfile));
}
} }
// invoke cooking script and recap status // invoke cooking script and recap status
@ -343241,12 +343244,12 @@ char* ftoa4(vec4 v) {
float atof1(const char *s) { float atof1(const char *s) {
char buf[64]; char buf[64];
return sscanf(s, "%64[^]\r\n,}]", buf) == 1 ? (float)eval(buf) : (float)NAN; return sscanf(s, "%63[^]\r\n,}]", buf) == 1 ? (float)eval(buf) : (float)NAN;
} }
vec2 atof2(const char *s) { vec2 atof2(const char *s) {
vec2 v = { 0 }; vec2 v = { 0 };
char buf1[64],buf2[64]; char buf1[64],buf2[64];
int num = sscanf(s, "%64[^]\r\n,}],%64[^]\r\n,}]", buf1, buf2); int num = sscanf(s, "%63[^]\r\n,}],%63[^]\r\n,}]", buf1, buf2);
if( num > 0 ) v.x = eval(buf1); if( num > 0 ) v.x = eval(buf1);
if( num > 1 ) v.y = eval(buf2); if( num > 1 ) v.y = eval(buf2);
return v; return v;
@ -343254,7 +343257,7 @@ vec2 atof2(const char *s) {
vec3 atof3(const char *s) { vec3 atof3(const char *s) {
vec3 v = {0}; vec3 v = {0};
char buf1[64],buf2[64],buf3[64]; char buf1[64],buf2[64],buf3[64];
int num = sscanf(s, "%64[^]\r\n,}],%64[^]\r\n,}],%64[^]\r\n,}]", buf1, buf2, buf3); int num = sscanf(s, "%63[^]\r\n,}],%63[^]\r\n,}],%63[^]\r\n,}]", buf1, buf2, buf3);
if( num > 0 ) v.x = eval(buf1); if( num > 0 ) v.x = eval(buf1);
if( num > 1 ) v.y = eval(buf2); if( num > 1 ) v.y = eval(buf2);
if( num > 2 ) v.z = eval(buf3); if( num > 2 ) v.z = eval(buf3);
@ -343263,7 +343266,7 @@ vec3 atof3(const char *s) {
vec4 atof4(const char *s) { vec4 atof4(const char *s) {
vec4 v = {0}; vec4 v = {0};
char buf1[64],buf2[64],buf3[64],buf4[64]; char buf1[64],buf2[64],buf3[64],buf4[64];
int num = sscanf(s, "%64[^]\r\n,}],%64[^]\r\n,}],%64[^]\r\n,}],%64[^]\r\n,}]", buf1, buf2, buf3, buf4); int num = sscanf(s, "%63[^]\r\n,}],%63[^]\r\n,}],%63[^]\r\n,}],%63[^]\r\n,}]", buf1, buf2, buf3, buf4);
if( num > 0 ) v.x = eval(buf1); if( num > 0 ) v.x = eval(buf1);
if( num > 1 ) v.y = eval(buf2); if( num > 1 ) v.y = eval(buf2);
if( num > 2 ) v.z = eval(buf3); if( num > 2 ) v.z = eval(buf3);
@ -348010,7 +348013,7 @@ unsigned fbo(unsigned color_texture_id, unsigned depth_texture_id, int flags) {
if( color_texture_id ) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color_texture_id, 0); if( color_texture_id ) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color_texture_id, 0);
if( depth_texture_id ) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depth_texture_id, 0); if( depth_texture_id ) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depth_texture_id, 0);
#if 0 #if 0 // this is working; it's just not enabled for now
else { else {
// create a non-sampleable renderbuffer object for depth and stencil attachments // create a non-sampleable renderbuffer object for depth and stencil attachments
unsigned int rbo; unsigned int rbo;
@ -355566,7 +355569,7 @@ void window_drop_callback(GLFWwindow* window, int count, const char** paths) {
void window_hints(unsigned flags) { void window_hints(unsigned flags) {
#ifdef __APPLE__ #ifdef __APPLE__
//glfwInitHint( GLFW_COCOA_CHDIR_RESOURCES, GLFW_FALSE ); //glfwInitHint( GLFW_COCOA_CHDIR_RESOURCES, GLFW_FALSE );
//glfwWindowHint( GLFW_COCOA_RETINA_FRAMEBUFFER, GLFW_FALSE ); glfwWindowHint( GLFW_COCOA_RETINA_FRAMEBUFFER, GLFW_FALSE );
//glfwWindowHint( GLFW_COCOA_GRAPHICS_SWITCHING, GLFW_FALSE ); //glfwWindowHint( GLFW_COCOA_GRAPHICS_SWITCHING, GLFW_FALSE );
//glfwWindowHint( GLFW_COCOA_MENUBAR, GLFW_FALSE ); //glfwWindowHint( GLFW_COCOA_MENUBAR, GLFW_FALSE );
#endif #endif
@ -356441,7 +356444,7 @@ int window_record(const char *outfile_mp4) {
vec2 window_dpi() { vec2 window_dpi() {
vec2 dpi = vec2(1,1); vec2 dpi = vec2(1,1);
#ifndef __EMSCRIPTEN__ #if !defined(__EMSCRIPTEN__) && !defined(__APPLE__)
glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &dpi.x, &dpi.y); glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &dpi.x, &dpi.y);
#endif #endif
return dpi; return dpi;
@ -357183,7 +357186,7 @@ obj *obj_mergeini(void *o, const char *ini) { // @testme
ini = sqr+1; ini = sqr+1;
char T[64] = {0}; char T[64] = {0};
if( sscanf(ini, "%64[^]]", &T) != 1 ) return 0; // @todo: parse version as well if( sscanf(ini, "%63[^]]", T) != 1 ) return 0; // @todo: parse version as well
ini += strlen(T); ini += strlen(T);
for each_member(T,R) { for each_member(T,R) {
@ -357467,7 +357470,7 @@ void *obj_make(const char *str) {
else T = I < J ? I : J; else T = I < J ? I : J;
char name[64] = {0}; char name[64] = {0};
if( sscanf(T+1, T == I ? "%64[^]]" : "%64[^:=]", &name) != 1 ) return 0; if( sscanf(T+1, T == I ? "%63[^]]" : "%63[^:=]", name) != 1 ) return 0;
int has_components = 0; // @todo: support entities too int has_components = 0; // @todo: support entities too

View File

@ -117,7 +117,7 @@
#define ifdef_release ifdef_false #define ifdef_release ifdef_false
#endif #endif
#if ENABLE_RETAIL #if ENABLE_RETAIL // NDEBUG>=2 ?
#define ifdef_retail ifdef_true #define ifdef_retail ifdef_true
#else #else
#define ifdef_retail ifdef_false #define ifdef_retail ifdef_false

View File

@ -509,11 +509,14 @@ int cook(void *userdata) {
cook_subscript_t cs = mcs.cs[pass]; cook_subscript_t cs = mcs.cs[pass];
// log to batch file for forensic purposes, if explicitly requested // log to batch file for forensic purposes, if explicitly requested
static __thread bool logging = 0; do_once logging = !!flag("--cook-debug") || cook_debug; static __thread int logging = -1; if(logging < 0) logging = !!flag("--cook-debug") || cook_debug;
if( logging ) { if( logging ) {
FILE *logfile = fopen(va("cook%d.cmd",job->threadid), "a+t"); static __thread FILE *logfile = 0; if(!logfile) fseek(logfile = fopen(va("cook%d.cmd",job->threadid), "a+t"), 0L, SEEK_END);
if( logfile ) { fprintf(logfile, "@rem %s\n%s\n", cs.outname, cs.script); fclose(logfile); } if( logfile ) {
fprintf(stderr, "%s\n", cs.script); fprintf(logfile, "@rem %s\n%s\n", cs.outname, cs.script);
fprintf(logfile, "for %%%%i in (\"%s\") do md _cook\\%%%%~pi\\%%%%~ni%%%%~xi 1>nul 2>nul\n", infile);
fprintf(logfile, "for %%%%i in (\"%s\") do xcopy /y %s _cook\\%%%%~pi\\%%%%~ni%%%%~xi\n\n", infile, file_normalize(cs.outfile));
}
} }
// invoke cooking script and recap status // invoke cooking script and recap status

View File

@ -499,7 +499,7 @@ obj *obj_mergeini(void *o, const char *ini) { // @testme
ini = sqr+1; ini = sqr+1;
char T[64] = {0}; char T[64] = {0};
if( sscanf(ini, "%64[^]]", &T) != 1 ) return 0; // @todo: parse version as well if( sscanf(ini, "%63[^]]", T) != 1 ) return 0; // @todo: parse version as well
ini += strlen(T); ini += strlen(T);
for each_member(T,R) { for each_member(T,R) {
@ -783,7 +783,7 @@ void *obj_make(const char *str) {
else T = I < J ? I : J; else T = I < J ? I : J;
char name[64] = {0}; char name[64] = {0};
if( sscanf(T+1, T == I ? "%64[^]]" : "%64[^:=]", &name) != 1 ) return 0; if( sscanf(T+1, T == I ? "%63[^]]" : "%63[^:=]", name) != 1 ) return 0;
int has_components = 0; // @todo: support entities too int has_components = 0; // @todo: support entities too

View File

@ -95,12 +95,12 @@ char* ftoa4(vec4 v) {
float atof1(const char *s) { float atof1(const char *s) {
char buf[64]; char buf[64];
return sscanf(s, "%64[^]\r\n,}]", buf) == 1 ? (float)eval(buf) : (float)NAN; return sscanf(s, "%63[^]\r\n,}]", buf) == 1 ? (float)eval(buf) : (float)NAN;
} }
vec2 atof2(const char *s) { vec2 atof2(const char *s) {
vec2 v = { 0 }; vec2 v = { 0 };
char buf1[64],buf2[64]; char buf1[64],buf2[64];
int num = sscanf(s, "%64[^]\r\n,}],%64[^]\r\n,}]", buf1, buf2); int num = sscanf(s, "%63[^]\r\n,}],%63[^]\r\n,}]", buf1, buf2);
if( num > 0 ) v.x = eval(buf1); if( num > 0 ) v.x = eval(buf1);
if( num > 1 ) v.y = eval(buf2); if( num > 1 ) v.y = eval(buf2);
return v; return v;
@ -108,7 +108,7 @@ vec2 atof2(const char *s) {
vec3 atof3(const char *s) { vec3 atof3(const char *s) {
vec3 v = {0}; vec3 v = {0};
char buf1[64],buf2[64],buf3[64]; char buf1[64],buf2[64],buf3[64];
int num = sscanf(s, "%64[^]\r\n,}],%64[^]\r\n,}],%64[^]\r\n,}]", buf1, buf2, buf3); int num = sscanf(s, "%63[^]\r\n,}],%63[^]\r\n,}],%63[^]\r\n,}]", buf1, buf2, buf3);
if( num > 0 ) v.x = eval(buf1); if( num > 0 ) v.x = eval(buf1);
if( num > 1 ) v.y = eval(buf2); if( num > 1 ) v.y = eval(buf2);
if( num > 2 ) v.z = eval(buf3); if( num > 2 ) v.z = eval(buf3);
@ -117,7 +117,7 @@ vec3 atof3(const char *s) {
vec4 atof4(const char *s) { vec4 atof4(const char *s) {
vec4 v = {0}; vec4 v = {0};
char buf1[64],buf2[64],buf3[64],buf4[64]; char buf1[64],buf2[64],buf3[64],buf4[64];
int num = sscanf(s, "%64[^]\r\n,}],%64[^]\r\n,}],%64[^]\r\n,}],%64[^]\r\n,}]", buf1, buf2, buf3, buf4); int num = sscanf(s, "%63[^]\r\n,}],%63[^]\r\n,}],%63[^]\r\n,}],%63[^]\r\n,}]", buf1, buf2, buf3, buf4);
if( num > 0 ) v.x = eval(buf1); if( num > 0 ) v.x = eval(buf1);
if( num > 1 ) v.y = eval(buf2); if( num > 1 ) v.y = eval(buf2);
if( num > 2 ) v.z = eval(buf3); if( num > 2 ) v.z = eval(buf3);

View File

@ -3080,7 +3080,7 @@ unsigned fbo(unsigned color_texture_id, unsigned depth_texture_id, int flags) {
if( color_texture_id ) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color_texture_id, 0); if( color_texture_id ) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color_texture_id, 0);
if( depth_texture_id ) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depth_texture_id, 0); if( depth_texture_id ) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depth_texture_id, 0);
#if 0 #if 0 // this is working; it's just not enabled for now
else { else {
// create a non-sampleable renderbuffer object for depth and stencil attachments // create a non-sampleable renderbuffer object for depth and stencil attachments
unsigned int rbo; unsigned int rbo;

View File

@ -4321,11 +4321,14 @@ int cook(void *userdata) {
cook_subscript_t cs = mcs.cs[pass]; cook_subscript_t cs = mcs.cs[pass];
// log to batch file for forensic purposes, if explicitly requested // log to batch file for forensic purposes, if explicitly requested
static __thread bool logging = 0; do_once logging = !!flag("--cook-debug") || cook_debug; static __thread int logging = -1; if(logging < 0) logging = !!flag("--cook-debug") || cook_debug;
if( logging ) { if( logging ) {
FILE *logfile = fopen(va("cook%d.cmd",job->threadid), "a+t"); static __thread FILE *logfile = 0; if(!logfile) fseek(logfile = fopen(va("cook%d.cmd",job->threadid), "a+t"), 0L, SEEK_END);
if( logfile ) { fprintf(logfile, "@rem %s\n%s\n", cs.outname, cs.script); fclose(logfile); } if( logfile ) {
fprintf(stderr, "%s\n", cs.script); fprintf(logfile, "@rem %s\n%s\n", cs.outname, cs.script);
fprintf(logfile, "for %%%%i in (\"%s\") do md _cook\\%%%%~pi\\%%%%~ni%%%%~xi 1>nul 2>nul\n", infile);
fprintf(logfile, "for %%%%i in (\"%s\") do xcopy /y %s _cook\\%%%%~pi\\%%%%~ni%%%%~xi\n\n", infile, file_normalize(cs.outfile));
}
} }
// invoke cooking script and recap status // invoke cooking script and recap status
@ -11349,12 +11352,12 @@ char* ftoa4(vec4 v) {
float atof1(const char *s) { float atof1(const char *s) {
char buf[64]; char buf[64];
return sscanf(s, "%64[^]\r\n,}]", buf) == 1 ? (float)eval(buf) : (float)NAN; return sscanf(s, "%63[^]\r\n,}]", buf) == 1 ? (float)eval(buf) : (float)NAN;
} }
vec2 atof2(const char *s) { vec2 atof2(const char *s) {
vec2 v = { 0 }; vec2 v = { 0 };
char buf1[64],buf2[64]; char buf1[64],buf2[64];
int num = sscanf(s, "%64[^]\r\n,}],%64[^]\r\n,}]", buf1, buf2); int num = sscanf(s, "%63[^]\r\n,}],%63[^]\r\n,}]", buf1, buf2);
if( num > 0 ) v.x = eval(buf1); if( num > 0 ) v.x = eval(buf1);
if( num > 1 ) v.y = eval(buf2); if( num > 1 ) v.y = eval(buf2);
return v; return v;
@ -11362,7 +11365,7 @@ vec2 atof2(const char *s) {
vec3 atof3(const char *s) { vec3 atof3(const char *s) {
vec3 v = {0}; vec3 v = {0};
char buf1[64],buf2[64],buf3[64]; char buf1[64],buf2[64],buf3[64];
int num = sscanf(s, "%64[^]\r\n,}],%64[^]\r\n,}],%64[^]\r\n,}]", buf1, buf2, buf3); int num = sscanf(s, "%63[^]\r\n,}],%63[^]\r\n,}],%63[^]\r\n,}]", buf1, buf2, buf3);
if( num > 0 ) v.x = eval(buf1); if( num > 0 ) v.x = eval(buf1);
if( num > 1 ) v.y = eval(buf2); if( num > 1 ) v.y = eval(buf2);
if( num > 2 ) v.z = eval(buf3); if( num > 2 ) v.z = eval(buf3);
@ -11371,7 +11374,7 @@ vec3 atof3(const char *s) {
vec4 atof4(const char *s) { vec4 atof4(const char *s) {
vec4 v = {0}; vec4 v = {0};
char buf1[64],buf2[64],buf3[64],buf4[64]; char buf1[64],buf2[64],buf3[64],buf4[64];
int num = sscanf(s, "%64[^]\r\n,}],%64[^]\r\n,}],%64[^]\r\n,}],%64[^]\r\n,}]", buf1, buf2, buf3, buf4); int num = sscanf(s, "%63[^]\r\n,}],%63[^]\r\n,}],%63[^]\r\n,}],%63[^]\r\n,}]", buf1, buf2, buf3, buf4);
if( num > 0 ) v.x = eval(buf1); if( num > 0 ) v.x = eval(buf1);
if( num > 1 ) v.y = eval(buf2); if( num > 1 ) v.y = eval(buf2);
if( num > 2 ) v.z = eval(buf3); if( num > 2 ) v.z = eval(buf3);
@ -16118,7 +16121,7 @@ unsigned fbo(unsigned color_texture_id, unsigned depth_texture_id, int flags) {
if( color_texture_id ) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color_texture_id, 0); if( color_texture_id ) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color_texture_id, 0);
if( depth_texture_id ) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depth_texture_id, 0); if( depth_texture_id ) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depth_texture_id, 0);
#if 0 #if 0 // this is working; it's just not enabled for now
else { else {
// create a non-sampleable renderbuffer object for depth and stencil attachments // create a non-sampleable renderbuffer object for depth and stencil attachments
unsigned int rbo; unsigned int rbo;
@ -25291,7 +25294,7 @@ obj *obj_mergeini(void *o, const char *ini) { // @testme
ini = sqr+1; ini = sqr+1;
char T[64] = {0}; char T[64] = {0};
if( sscanf(ini, "%64[^]]", &T) != 1 ) return 0; // @todo: parse version as well if( sscanf(ini, "%63[^]]", T) != 1 ) return 0; // @todo: parse version as well
ini += strlen(T); ini += strlen(T);
for each_member(T,R) { for each_member(T,R) {
@ -25575,7 +25578,7 @@ void *obj_make(const char *str) {
else T = I < J ? I : J; else T = I < J ? I : J;
char name[64] = {0}; char name[64] = {0};
if( sscanf(T+1, T == I ? "%64[^]]" : "%64[^:=]", &name) != 1 ) return 0; if( sscanf(T+1, T == I ? "%63[^]]" : "%63[^:=]", name) != 1 ) return 0;
int has_components = 0; // @todo: support entities too int has_components = 0; // @todo: support entities too

View File

@ -215,7 +215,7 @@ extern "C" {
#define ifdef_release ifdef_false #define ifdef_release ifdef_false
#endif #endif
#if ENABLE_RETAIL #if ENABLE_RETAIL // NDEBUG>=2 ?
#define ifdef_retail ifdef_true #define ifdef_retail ifdef_true
#else #else
#define ifdef_retail ifdef_false #define ifdef_retail ifdef_false