fix uickjs string print issue
This commit is contained in:
parent
6d2696437c
commit
fd8b1b8006
|
@ -5,6 +5,7 @@ debug.termout = true;
|
|||
debug.console = false;
|
||||
debug.cheat = false;
|
||||
debug.meta = false;
|
||||
debug.showprofiler = false;
|
||||
|
||||
debug.fn_break = function(fn,obj = globalThis) {
|
||||
if (typeof fn !== 'function') return;
|
||||
|
|
|
@ -157,6 +157,7 @@ profile.best_t = function (t) {
|
|||
profile.report = function (start, msg = "[undefined report]") { console.info(`${msg} in ${profile.best_t(profile.now() - start)}`); };
|
||||
|
||||
var frame_avg = false;
|
||||
profile.frame_avg_t = 72000;
|
||||
|
||||
profile.start_frame_avg = function()
|
||||
{
|
||||
|
@ -183,31 +184,38 @@ profile.toggle_frame_avg = function()
|
|||
else profile.start_frame_avg();
|
||||
}
|
||||
|
||||
var profile_frames = {};
|
||||
var profile_frame_ts = [];
|
||||
var profile_cframe = profile_frames;
|
||||
var profile_framer = {
|
||||
series: [],
|
||||
avg: {},
|
||||
frame: 72000,
|
||||
};
|
||||
var profile_cframe = undefined;
|
||||
var pframe = 0;
|
||||
var profile_stack = [];
|
||||
|
||||
profile.frame = function profile_frame(title)
|
||||
{
|
||||
if (!frame_avg) return;
|
||||
|
||||
profile_frame_ts.push(profile_cframe);
|
||||
if (!profile_cframe) {
|
||||
profile_cframe = {};
|
||||
profile_framer.series.push({
|
||||
time:profile.now(),
|
||||
data:profile_cframe
|
||||
});
|
||||
} else
|
||||
profile_stack.push(profile_cframe);
|
||||
|
||||
profile_cframe[title] ??= {};
|
||||
profile_cframe = profile_cframe[title];
|
||||
profile_cframe._times ??= [];
|
||||
profile_cframe._times[pframe] ??= 0;
|
||||
profile_cframe._times[pframe] = profile.now() - profile_cframe._times[pframe];
|
||||
profile_cframe.time = profile.now();
|
||||
}
|
||||
|
||||
profile.endframe = function profile_endframe()
|
||||
{
|
||||
if (!frame_avg) return;
|
||||
|
||||
if (profile_cframe === profile_frames) return;
|
||||
profile_cframe._times[pframe] = profile.now() - profile_cframe._times[pframe];
|
||||
profile_cframe.time = profile.now() - profile_cframe.time;
|
||||
profile_cframe = profile_frame_ts.pop();
|
||||
if (profile_cframe === profile_frames) pframe++;
|
||||
}
|
||||
|
||||
var print_frame = function(frame, indent, title)
|
||||
|
|
|
@ -1007,7 +1007,7 @@ var imgui_fn = function()
|
|||
});
|
||||
imgui.menu("Debug", imdebug);
|
||||
imgui.menu("View", _ => {
|
||||
imtoggle("Profiler", gamestate, 'showprofiler');
|
||||
imtoggle("Profiler", debug, 'showprofiler');
|
||||
imtoggle("Terminal out", debug, 'termout');
|
||||
imtoggle("Meta [f7]", debug, 'meta');
|
||||
imtoggle("Cheats [f8]", debug, 'cheat');
|
||||
|
|
|
@ -12,12 +12,10 @@ if (os.sys() === 'macos') {
|
|||
appy.inputs['S-q'] = os.quit;
|
||||
}
|
||||
|
||||
//appy.inputs.f12 = function() { mum.debug = !mum.debug; }
|
||||
appy.inputs['C-space'] = function() {
|
||||
game.ooop = !game.ooop;
|
||||
}
|
||||
appy.inputs.f9 = function() { profile.print_mem(); }
|
||||
appy.inputs.f10 = function() { profile.toggle_frame_avg(); }
|
||||
appy.inputs.f7 = function() { debug.meta = !debug.meta; }
|
||||
appy.inputs.f8 = function() { debug.cheat = !debug.cheat; }
|
||||
appy.inputs.f9 = function() { debug.console = !debug.console; }
|
||||
appy.inputs.f10 = function() { debug.show = !debug.show; }
|
||||
appy.inputs.f11 = window.toggle_fullscreen;
|
||||
appy.inputs.f11.doc = "Toggle window fullscreen.";
|
||||
appy.inputs.f11.title = "Toggle Fullscreen";
|
||||
|
|
3
source/engine/thirdparty/quickjs/quickjs.c
vendored
3
source/engine/thirdparty/quickjs/quickjs.c
vendored
|
@ -2376,7 +2376,7 @@ void JS_FreeContext(JSContext *ctx)
|
|||
{
|
||||
JSMemoryUsage stats;
|
||||
JS_ComputeMemoryUsage(rt, &stats);
|
||||
JS_DumpMemoryUsage(stdout, &stats, rt);
|
||||
// JS_DumpMemoryUsage(stdout, &stats, rt);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2575,6 +2575,7 @@ static __maybe_unused void JS_DumpChar(JSRuntime *rt, int c, int sep)
|
|||
|
||||
static __maybe_unused void JS_DumpString(JSRuntime *rt, const JSString *p)
|
||||
{
|
||||
return; // TODO: Reimplment this
|
||||
int i, sep;
|
||||
|
||||
if (p == NULL) {
|
||||
|
|
Loading…
Reference in a new issue