Skip to content

Commit

Permalink
Enduro start day
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Suarez committed Dec 8, 2024
1 parent d0cba28 commit 8af30c9
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 53 deletions.
113 changes: 61 additions & 52 deletions docs/assets/enduro/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if (ENVIRONMENT_IS_NODE) {

// --pre-jses are emitted after the Module integration code, so that they can
// refer to Module (if they choose; they can also define Module)
// include: /tmp/tmpy5nwczww.js
// include: /tmp/tmp98izcznz.js

Module['expectedDataFileDownloads'] ??= 0;
Module['expectedDataFileDownloads']++;
Expand Down Expand Up @@ -220,21 +220,21 @@ Module['FS_createPath']("/resources", "robocode", true, true);

})();

// end include: /tmp/tmpy5nwczww.js
// include: /tmp/tmpwh_1q8mp.js
// end include: /tmp/tmp98izcznz.js
// include: /tmp/tmpjj0a8kne.js

// All the pre-js content up to here must remain later on, we need to run
// it.
if (Module['$ww'] || (typeof ENVIRONMENT_IS_PTHREAD != 'undefined' && ENVIRONMENT_IS_PTHREAD)) Module['preRun'] = [];
var necessaryPreJSTasks = Module['preRun'].slice();
// end include: /tmp/tmpwh_1q8mp.js
// include: /tmp/tmpkbl26p0_.js
// end include: /tmp/tmpjj0a8kne.js
// include: /tmp/tmpu_wz7bgk.js

if (!Module['preRun']) throw 'Module.preRun should exist because file support used it; did a pre-js delete it?';
necessaryPreJSTasks.forEach((task) => {
if (Module['preRun'].indexOf(task) < 0) throw 'All preRun tasks that exist before user pre-js code should remain after; did you replace Module or modify Module.preRun?';
});
// end include: /tmp/tmpkbl26p0_.js
// end include: /tmp/tmpu_wz7bgk.js


// Sometimes an existing Module object exists with properties
Expand Down Expand Up @@ -1304,9 +1304,8 @@ function GetWindowInnerHeight() { return window.innerHeight; }
assert(typeof ptr == 'number', `UTF8ToString expects a number (got ${typeof ptr})`);
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : '';
};
var ___assert_fail = (condition, filename, line, func) => {
var ___assert_fail = (condition, filename, line, func) =>
abort(`Assertion failed: ${UTF8ToString(condition)}, at: ` + [filename ? UTF8ToString(filename) : 'unknown filename', line, func ? UTF8ToString(func) : 'unknown function']);
};



Expand Down Expand Up @@ -1761,7 +1760,7 @@ function GetWindowInnerHeight() { return window.innerHeight; }
var MEMFS = {
ops_table:null,
mount(mount) {
return MEMFS.createNode(null, '/', 16384 | 511 /* 0777 */, 0);
return MEMFS.createNode(null, '/', 16895, 0);
},
createNode(parent, name, mode, dev) {
if (FS.isBlkdev(mode) || FS.isFIFO(mode)) {
Expand Down Expand Up @@ -1962,7 +1961,7 @@ function GetWindowInnerHeight() { return window.innerHeight; }
return entries;
},
symlink(parent, newname, oldpath) {
var node = MEMFS.createNode(parent, newname, 511 /* 0777 */ | 40960, 0);
var node = MEMFS.createNode(parent, newname, 0o777 | 40960, 0);
node.link = oldpath;
return node;
},
Expand Down Expand Up @@ -2180,9 +2179,7 @@ function GetWindowInnerHeight() { return window.innerHeight; }



var strError = (errno) => {
return UTF8ToString(_strerror(errno));
};
var strError = (errno) => UTF8ToString(_strerror(errno));

var ERRNO_CODES = {
'EPERM': 63,
Expand Down Expand Up @@ -2852,14 +2849,35 @@ function GetWindowInnerHeight() { return window.innerHeight; }
}
return parent.node_ops.mknod(parent, name, mode, dev);
},
create(path, mode) {
mode = mode !== undefined ? mode : 438 /* 0666 */;
statfs(path) {

// NOTE: None of the defaults here are true. We're just returning safe and
// sane values.
var rtn = {
bsize: 4096,
frsize: 4096,
blocks: 1e6,
bfree: 5e5,
bavail: 5e5,
files: FS.nextInode,
ffree: FS.nextInode - 1,
fsid: 42,
flags: 2,
namelen: 255,
};

var parent = FS.lookupPath(path, {follow: true}).node;
if (parent?.node_ops.statfs) {
Object.assign(rtn, parent.node_ops.statfs(parent.mount.opts.root));
}
return rtn;
},
create(path, mode = 0o666) {
mode &= 4095;
mode |= 32768;
return FS.mknod(path, mode, 0);
},
mkdir(path, mode) {
mode = mode !== undefined ? mode : 511 /* 0777 */;
mkdir(path, mode = 0o777) {
mode &= 511 | 512;
mode |= 16384;
return FS.mknod(path, mode, 0);
Expand All @@ -2880,7 +2898,7 @@ function GetWindowInnerHeight() { return window.innerHeight; }
mkdev(path, mode, dev) {
if (typeof dev == 'undefined') {
dev = mode;
mode = 438 /* 0666 */;
mode = 0o666;
}
mode |= 8192;
return FS.mknod(path, mode, dev);
Expand Down Expand Up @@ -2978,7 +2996,7 @@ function GetWindowInnerHeight() { return window.innerHeight; }
// do the underlying fs rename
try {
old_dir.node_ops.rename(old_node, new_dir, new_name);
// update old node (we do this here to avoid each backend
// update old node (we do this here to avoid each backend
// needing to)
old_node.parent = new_dir;
} catch (e) {
Expand Down Expand Up @@ -3048,7 +3066,7 @@ function GetWindowInnerHeight() { return window.innerHeight; }
if (!link.node_ops.readlink) {
throw new FS.ErrnoError(28);
}
return PATH_FS.resolve(FS.getPath(link.parent), link.node_ops.readlink(link));
return link.node_ops.readlink(link);
},
stat(path, dontFollow) {
var lookup = FS.lookupPath(path, { follow: !dontFollow });
Expand Down Expand Up @@ -3153,13 +3171,12 @@ function GetWindowInnerHeight() { return window.innerHeight; }
timestamp: Math.max(atime, mtime)
});
},
open(path, flags, mode) {
open(path, flags, mode = 0o666) {
if (path === "") {
throw new FS.ErrnoError(44);
}
flags = typeof flags == 'string' ? FS_modeStringToFlags(flags) : flags;
if ((flags & 64)) {
mode = typeof mode == 'undefined' ? 438 /* 0666 */ : mode;
mode = (mode & 4095) | 32768;
} else {
mode = 0;
Expand Down Expand Up @@ -3482,7 +3499,7 @@ function GetWindowInnerHeight() { return window.innerHeight; }
FS.mkdir('/proc/self/fd');
FS.mount({
mount() {
var node = FS.createNode(proc_self, 'fd', 16384 | 511 /* 0777 */, 73);
var node = FS.createNode(proc_self, 'fd', 16895, 73);
node.node_ops = {
lookup(parent, name) {
var fd = +name;
Expand Down Expand Up @@ -4180,9 +4197,8 @@ function GetWindowInnerHeight() { return window.innerHeight; }
}
}

var __abort_js = () => {
var __abort_js = () =>
abort('native code called abort()');
};

var nowIsMonotonic = 1;
var __emscripten_get_now_is_monotonic = () => nowIsMonotonic;
Expand Down Expand Up @@ -4327,7 +4343,7 @@ function GetWindowInnerHeight() { return window.innerHeight; }
var specialHTMLTargets = [0, typeof document != 'undefined' ? document : 0, typeof window != 'undefined' ? window : 0];
var findEventTarget = (target) => {
target = maybeCStringToJsString(target);
var domElement = specialHTMLTargets[target] || (typeof document != 'undefined' ? document.querySelector(target) : undefined);
var domElement = specialHTMLTargets[target] || (typeof document != 'undefined' ? document.querySelector(target) : null);
return domElement;
};

Expand Down Expand Up @@ -4442,22 +4458,18 @@ function GetWindowInnerHeight() { return window.innerHeight; }
return !!(ctx.mdibvbi = ctx.getExtension('WEBGL_multi_draw_instanced_base_vertex_base_instance'));
};

var webgl_enable_EXT_polygon_offset_clamp = (ctx) => {
return !!(ctx.extPolygonOffsetClamp = ctx.getExtension('EXT_polygon_offset_clamp'));
};
var webgl_enable_EXT_polygon_offset_clamp = (ctx) =>
!!(ctx.extPolygonOffsetClamp = ctx.getExtension('EXT_polygon_offset_clamp'));

var webgl_enable_EXT_clip_control = (ctx) => {
return !!(ctx.extClipControl = ctx.getExtension('EXT_clip_control'));
};
var webgl_enable_EXT_clip_control = (ctx) =>
!!(ctx.extClipControl = ctx.getExtension('EXT_clip_control'));

var webgl_enable_WEBGL_polygon_mode = (ctx) => {
return !!(ctx.webglPolygonMode = ctx.getExtension('WEBGL_polygon_mode'));
};
var webgl_enable_WEBGL_polygon_mode = (ctx) =>
!!(ctx.webglPolygonMode = ctx.getExtension('WEBGL_polygon_mode'));

var webgl_enable_WEBGL_multi_draw = (ctx) => {
var webgl_enable_WEBGL_multi_draw = (ctx) =>
// Closure is expected to be allowed to minify the '.multiDrawWebgl' property, so not accessing it quoted.
return !!(ctx.multiDrawWebgl = ctx.getExtension('WEBGL_multi_draw'));
};
!!(ctx.multiDrawWebgl = ctx.getExtension('WEBGL_multi_draw'));

var getEmscriptenSupportedExtensions = (ctx) => {
// Restrict the list of advertised extensions to those that we actually
Expand Down Expand Up @@ -4633,7 +4645,7 @@ function GetWindowInnerHeight() { return window.innerHeight; }
// Active Emscripten GL layer context object.
GL.currentContext = GL.contexts[contextHandle];
// Active WebGL context object.
Module.ctx = GLctx = GL.currentContext?.GLctx;
Module['ctx'] = GLctx = GL.currentContext?.GLctx;
return !(contextHandle && !GLctx);
},
getContext:(contextHandle) => {
Expand Down Expand Up @@ -5520,16 +5532,14 @@ function GetWindowInnerHeight() { return window.innerHeight; }
};

/** @suppress {duplicate } */
var _glGetActiveAttrib = (program, index, bufSize, length, size, type, name) => {
var _glGetActiveAttrib = (program, index, bufSize, length, size, type, name) =>
__glGetActiveAttribOrUniform('getActiveAttrib', program, index, bufSize, length, size, type, name);
};
var _emscripten_glGetActiveAttrib = _glGetActiveAttrib;


/** @suppress {duplicate } */
var _glGetActiveUniform = (program, index, bufSize, length, size, type, name) => {
var _glGetActiveUniform = (program, index, bufSize, length, size, type, name) =>
__glGetActiveAttribOrUniform('getActiveUniform', program, index, bufSize, length, size, type, name);
};
var _emscripten_glGetActiveUniform = _glGetActiveUniform;

/** @suppress {duplicate } */
Expand Down Expand Up @@ -5620,9 +5630,8 @@ function GetWindowInnerHeight() { return window.innerHeight; }


/** @suppress {duplicate } */
var _glGetAttribLocation = (program, name) => {
return GLctx.getAttribLocation(GL.programs[program], UTF8ToString(name));
};
var _glGetAttribLocation = (program, name) =>
GLctx.getAttribLocation(GL.programs[program], UTF8ToString(name));
var _emscripten_glGetAttribLocation = _glGetAttribLocation;

var readI53FromI64 = (ptr) => {
Expand All @@ -5642,7 +5651,7 @@ function GetWindowInnerHeight() { return window.innerHeight; }
};


var webglGetExtensions = function $webglGetExtensions() {
var webglGetExtensions = () => {
var exts = getEmscriptenSupportedExtensions(GLctx);
exts = exts.concat(exts.map((e) => "GL_" + e));
return exts;
Expand Down Expand Up @@ -8266,7 +8275,7 @@ function GetWindowInnerHeight() { return window.innerHeight; }
}
},
createContext(/** @type {HTMLCanvasElement} */ canvas, useWebGL, setInModule, webGLContextAttributes) {
if (useWebGL && Module.ctx && canvas == Module['canvas']) return Module.ctx; // no need to recreate GL context if it's already been created for this canvas.
if (useWebGL && Module['ctx'] && canvas == Module['canvas']) return Module['ctx']; // no need to recreate GL context if it's already been created for this canvas.

var ctx;
var contextHandle;
Expand Down Expand Up @@ -8301,7 +8310,7 @@ function GetWindowInnerHeight() { return window.innerHeight; }

if (setInModule) {
if (!useWebGL) assert(typeof GLctx == 'undefined', 'cannot set in module if GLctx is used, but we are a non-GL context that would replace it');
Module.ctx = ctx;
Module['ctx'] = ctx;
if (useWebGL) GL.makeContextCurrent(contextHandle);
Browser.useWebGL = useWebGL;
Browser.moduleContextCreatedCallbacks.forEach((callback) => callback());
Expand Down Expand Up @@ -8977,7 +8986,7 @@ function GetWindowInnerHeight() { return window.innerHeight; }
MainLoop.tickStartTime = _emscripten_get_now();
}

if (MainLoop.method === 'timeout' && Module.ctx) {
if (MainLoop.method === 'timeout' && Module['ctx']) {
warnOnce('Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!');
MainLoop.method = ''; // just warn once per call to set main loop
}
Expand Down Expand Up @@ -9921,7 +9930,7 @@ function GetWindowInnerHeight() { return window.innerHeight; }
}

// If context creation failed, do not return a valid window
if (!Module.ctx && useWebGL) return 0;
if (!Module['ctx'] && useWebGL) return 0;

// Initializes the framebuffer size from the canvas
const canvas = Module['canvas'];
Expand Down Expand Up @@ -9954,7 +9963,7 @@ function GetWindowInnerHeight() { return window.innerHeight; }
for (var i = 0; i < GLFW.windows.length; i++)
if (GLFW.windows[i] !== null) return;

delete Module.ctx;
delete Module['ctx'];
},
swapBuffers:(winid) => {
},
Expand Down
Binary file modified docs/assets/enduro/game.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/assets/enduro/game.wasm.map

Large diffs are not rendered by default.

0 comments on commit 8af30c9

Please sign in to comment.