bug fixing
This commit is contained in:
parent
2ae45a5bb8
commit
606dfbea93
|
@ -16202,6 +16202,14 @@ static JSValue JS_CallInternal(JSContext *caller_ctx, JSValueConst func_obj,
|
|||
int argc, JSValue *argv, int flags)
|
||||
{
|
||||
JSRuntime *rt = caller_ctx->rt;
|
||||
/*
|
||||
JSValue nnjs = JS_GetPropertyStr(caller_ctx, func_obj, "name");
|
||||
const char *nnn = JS_ToCString(caller_ctx, nnjs);
|
||||
printf("fn %s", nnn);
|
||||
js_free(&rt->malloc_state, nnn);
|
||||
JS_FreeValue(caller_ctx, nnjs);
|
||||
*/
|
||||
|
||||
JSContext *ctx;
|
||||
JSObject *p;
|
||||
JSFunctionBytecode *b;
|
||||
|
|
|
@ -1515,7 +1515,6 @@ var replpanel = Object.copy(inputpanel, {
|
|||
this.win.selectable = true;
|
||||
var log = cmd(84);
|
||||
log = log.slice(-5000);
|
||||
|
||||
return [
|
||||
Mum.text({str:log, anchor:[0,0], offset:[0,-300].sub(this.scrolloffset), selectable: true}),
|
||||
Mum.text({str:this.value,color:Color.green, offset:[0,-290], caret: this.caret})
|
||||
|
|
|
@ -100,7 +100,6 @@ var gameobject = {
|
|||
|
||||
clear() {
|
||||
for (var k in this.objects) {
|
||||
Log.info(`Killing ${k}`);
|
||||
this.objects[k].kill();
|
||||
};
|
||||
this.objects = {};
|
||||
|
@ -519,7 +518,6 @@ var gameobject = {
|
|||
|
||||
for (var key in this.components) {
|
||||
Register.unregister_obj(this.components[key]);
|
||||
(`Destroying component ${key}`);
|
||||
this.components[key].kill();
|
||||
this.components[key].gameobject = undefined;
|
||||
delete this.components[key];
|
||||
|
|
|
@ -80,12 +80,15 @@ var Log = {
|
|||
},
|
||||
|
||||
stack(skip = 0) {
|
||||
var stack = (new Error()).stack;
|
||||
var err = new Error();
|
||||
var stack = err.stack;
|
||||
var n = stack.next('\n',0)+1;
|
||||
for (var i = 0; i < skip; i++)
|
||||
n = stack.next('\n', n)+1;
|
||||
|
||||
this.write(stack.slice(n));
|
||||
Log.write(err.name);
|
||||
Log.write(err.message);
|
||||
Log.write(err.stack);
|
||||
// Log.write(stack);
|
||||
},
|
||||
|
||||
clear() {
|
||||
|
|
|
@ -28,13 +28,14 @@ FILE *logfile = NULL;
|
|||
#define ERROR_BUFFER 1024
|
||||
#define CONSOLE_BUF 1024*1024 /* 5MB */
|
||||
|
||||
char *consolelog;
|
||||
char *consolelog = NULL;
|
||||
|
||||
static FILE *sout;
|
||||
|
||||
void log_init()
|
||||
{
|
||||
consolelog = malloc(CONSOLE_BUF+1);
|
||||
consolelog[0] = '\0';
|
||||
sout = fdopen(dup(1),"w");
|
||||
sout = stdout;
|
||||
}
|
||||
|
@ -55,12 +56,12 @@ void mYughLog(int category, int priority, int line, const char *file, const char
|
|||
int len = vsnprintf(NULL, 0, message, args)+1;
|
||||
char *msg = malloc(len);
|
||||
va_end(args);
|
||||
vsprintf(msg, message, arg2);
|
||||
vsnprintf(msg, len, message, arg2);
|
||||
va_end(arg2);
|
||||
|
||||
len = snprintf(NULL, 0, logfmt, file,line,logstr[priority], catstr[category], msg)+1;
|
||||
char *buffer = malloc(len);
|
||||
sprintf(buffer, logfmt, file, line, logstr[priority], catstr[category], msg);
|
||||
snprintf(buffer, len, logfmt, file, line, logstr[priority], catstr[category], msg);
|
||||
|
||||
fprintf(stderr, "%s", buffer);
|
||||
fflush(stderr);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "log.h"
|
||||
#include "render.h"
|
||||
#include <ctype.h>
|
||||
#include "log.h"
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -282,9 +283,8 @@ struct boundingbox text_bb(const char *text, float scale, float lw, float tracki
|
|||
{
|
||||
struct rgba dummy;
|
||||
HMM_Vec2 cursor = {0,0};
|
||||
const char *c = text;
|
||||
const char *line, *wordstart, *drawstart;
|
||||
line = drawstart = text;
|
||||
const char *line, *wordstart;
|
||||
line = text;
|
||||
|
||||
while (*line != '\0') {
|
||||
if (isblank(*line)) {
|
||||
|
|
|
@ -25,7 +25,7 @@ struct sFont {
|
|||
int descent;
|
||||
int linegap;
|
||||
float emscale;
|
||||
struct Character Characters[255];
|
||||
struct Character Characters[256];
|
||||
sg_image texID;
|
||||
};
|
||||
|
||||
|
|
|
@ -223,19 +223,20 @@ void input_init() {
|
|||
mouse_states[i] = INPUT_UP;
|
||||
}
|
||||
|
||||
char keybuf[50];
|
||||
#define KEYBUFLEN 50
|
||||
char keybuf[KEYBUFLEN];
|
||||
|
||||
const char *keyname_extd(int key) {
|
||||
|
||||
if (key > 289 && key < 302) {
|
||||
int num = key - 289;
|
||||
sprintf(keybuf, "f%d", num);
|
||||
snprintf(keybuf, KEYBUFLEN, "f%d", num);
|
||||
return keybuf;
|
||||
}
|
||||
|
||||
if (key >= 320 && key <= 329) {
|
||||
int num = key - 320;
|
||||
sprintf(keybuf, "kp%d", num);
|
||||
snprintf(keybuf, KEYBUFLEN, "kp%d", num);
|
||||
return keybuf;
|
||||
}
|
||||
|
||||
|
|
|
@ -866,7 +866,7 @@ JSValue duk_cmd(JSContext *js, JSValueConst this, int argc, JSValueConst *argv)
|
|||
break;
|
||||
|
||||
case 84:
|
||||
ret = JS_NewString(js, consolelog);
|
||||
ret = consolelog ? JS_NewString(js, consolelog) : JS_NewString(js,"");
|
||||
break;
|
||||
|
||||
case 85:
|
||||
|
|
|
@ -167,7 +167,7 @@ char *str_replace_ext(const char *s, const char *newext) {
|
|||
FILE *path_open(const char *tag, const char *fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsprintf(pathbuf, fmt, args);
|
||||
vsnprintf(pathbuf, MAXPATH+1, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
FILE *f = fopen(pathbuf, tag);
|
||||
|
|
|
@ -302,14 +302,6 @@ void script_callee(struct callee c, int argc, JSValue *argv) {
|
|||
js_callee_exec(&c, argc, argv);
|
||||
}
|
||||
|
||||
struct callee make_callee(JSValue fn, JSValue obj)
|
||||
{
|
||||
struct callee c;
|
||||
c.fn = JS_DupValue(js, fn);
|
||||
c.obj = JS_DupValue(js, obj);
|
||||
return c;
|
||||
}
|
||||
|
||||
void free_callee(struct callee c)
|
||||
{
|
||||
JS_FreeValue(js,c.fn);
|
||||
|
|
|
@ -32,7 +32,6 @@ time_t jso_file(const char *file);
|
|||
JSValue script_runfile(const char *file);
|
||||
void script_update(double dt);
|
||||
void script_draw();
|
||||
struct callee make_callee(JSValue fn, JSValue obj);
|
||||
void free_callee(struct callee c);
|
||||
|
||||
void duk_run_err();
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define M_PI 3.14159265358979323846
|
||||
#define MAX_FRAME_LENGTH 8192
|
||||
#define false 0
|
||||
#define true 1
|
||||
|
|
|
@ -773,7 +773,7 @@ static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, f
|
|||
#ifdef __STDC_LIB_EXT1__
|
||||
len = sprintf_s(buffer, sizeof(buffer), "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
|
||||
#else
|
||||
len = sprintf(buffer, "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
|
||||
len = snprintf(buffer, 128, "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
|
||||
#endif
|
||||
s->func(s->context, buffer, len);
|
||||
|
||||
|
|
|
@ -86,7 +86,11 @@ const char *engine_info() { return ENGINEINFO; }
|
|||
static int argc;
|
||||
static char **args;
|
||||
|
||||
struct datastream *bjork;
|
||||
void seghandle()
|
||||
{
|
||||
js_stacktrace();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void c_init() {
|
||||
|
||||
|
@ -272,6 +276,12 @@ int main(int argc, char **argv) {
|
|||
snprintf(fname, 100, "yugine-%ld.log", now);
|
||||
log_setfile(fname);
|
||||
}
|
||||
/*
|
||||
signal(SIGSEGV, seghandle);
|
||||
signal(SIGABRT, seghandle);
|
||||
signal(SIGFPE, seghandle);
|
||||
signal(SIGBUS, seghandle);
|
||||
*/
|
||||
#endif
|
||||
|
||||
#ifdef STEAM
|
||||
|
|
Loading…
Reference in a new issue