diff --git a/doc/hosting-flask.md b/doc/hosting-flask.md index c583149f7..3de273fb2 100644 --- a/doc/hosting-flask.md +++ b/doc/hosting-flask.md @@ -2,8 +2,6 @@ The website will be structured like so: ``` websrv.py -templates/tmpl.html -templates/tmpl_lite.html templates/play.html static/classisphere.js static/default.zip @@ -39,54 +37,31 @@ if __name__ == "__main__": app.run() ``` -#### templates/tmpl.html -```HTML - - - - - - - - - -
- {% block main %} {% endblock %} -
- - -``` - -#### templates/tmpl_lite.html -```HTML - - - - - - - -
- {% block main %} {% endblock %} -
- - -``` - #### templates/play.html ```HTML {% set mobile_mode = request.user_agent.platform in ('android', 'iphone', 'ipad') %} + + + + + + + {% if mobile_mode %} -{% extends 'tmpl_lite.html' %} + {% else %} -{% extends 'tmpl.html' %} + {% endif %} -{% block main %} +
-{% else %} -{% endif %} -{% endblock %} + var Module = { + preRun: [ preloadIndexedDB, resizeGameCanvas ], + postRun: [], + arguments: {{game_args|safe}}, + print: function(text) { + if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' '); + console.log(text); + }, + printErr: function(text) { + if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' '); + console.error(text); + }, + canvas: (function() { return document.getElementById('GameCanvas'); })(), + setStatus: function(text) { + console.log(text); + document.getElementById('logmsg').innerHTML = text; + }, + totalDependencies: 0, + monitorRunDependencies: function(left) { + this.totalDependencies = Math.max(this.totalDependencies, left); + Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.'); + } + }; + Module.setStatus('Downloading...'); + window.onerror = function(event) { + // TODO: do not warn on ok events like simulating an infinite loop or exitStatus + Module.setStatus('Exception thrown, see JavaScript console'); + Module.setStatus = function(text) { + if (text) Module.printErr('[post-exception status] ' + text); + }; + }; + + +
+ + ``` #### static/classisphere.js -Download `classicube.s3.amazonaws.com/client/latest/ClassiCube.js` for this +Download `cs.classicube.net/c_client/latest/ClassiCube.js` for this #### static/default.zip Download `classicube.net/static/default.zip` for this @@ -226,7 +194,7 @@ Download some version of jQuery for this. Version 2.1.1 is known to work. * If you don't want the game to resize to fit different resolutions, remove the `resizeGameCanvas` code. -* tmpl_lite.html and mobile_mode is used to deliver a minified page for mobile/tablet devices +* mobile_mode is used to deliver a minified page for mobile/tablet devices ## Results diff --git a/doc/hosting-webclient.md b/doc/hosting-webclient.md index 29602a9df..0da552aed 100644 --- a/doc/hosting-webclient.md +++ b/doc/hosting-webclient.md @@ -1,6 +1,6 @@ So you want to host your own version of the webclient? It's pretty easy to do, you need 3 files: -1) The game .js file -2) A web page to initialise the .js and display the game +1) A web page to initialise the .js and display the game +2) The game .js file 3) The default texture pack ### Example setup @@ -11,8 +11,8 @@ For example, let's assume our site is setup like this: * `example.com/static/default.zip` For simplicitly, -1) Download `classicube.net/static/classicube.js`, then upload it to `static/classisphere.js` on the webserver -2) Download `classicube.net/static/default.zip`, then upload it to `static/default.zip` on the webserver +1) Download `cs.classicube.net/c_client/latest/classicube.js`, then upload it to `static/classisphere.js` on the webserver +2) Download `classicube.net/static/default.zip`, then upload it to `static/default.zip` on the webserver The play.html page is the trickiest part, because how to implement this is website-specific. (depends on how your website is styled, what webserver you use, what programming language is used to generate the html, etc) diff --git a/src/Logger.c b/src/Logger.c index cbe521900..0e415081c 100644 --- a/src/Logger.c +++ b/src/Logger.c @@ -651,31 +651,31 @@ void Logger_Abort2(cc_result result, const char* raw_msg) { AbortCommon(result, raw_msg, NULL); } #elif defined CC_BUILD_WIN -static LONG WINAPI UnhandledFilter(struct _EXCEPTION_POINTERS* pInfo) { +static LONG WINAPI UnhandledFilter(struct _EXCEPTION_POINTERS* info) { String msg; char msgBuffer[128 + 1]; cc_uint32 code; cc_uintptr addr; DWORD i, numArgs; - code = (cc_uint32)pInfo->ExceptionRecord->ExceptionCode; - addr = (cc_uintptr)pInfo->ExceptionRecord->ExceptionAddress; + code = (cc_uint32)info->ExceptionRecord->ExceptionCode; + addr = (cc_uintptr)info->ExceptionRecord->ExceptionAddress; String_InitArray_NT(msg, msgBuffer); String_Format2(&msg, "Unhandled exception 0x%h at 0x%x", &code, &addr); - numArgs = pInfo->ExceptionRecord->NumberParameters; + numArgs = info->ExceptionRecord->NumberParameters; if (numArgs) { numArgs = min(numArgs, EXCEPTION_MAXIMUM_PARAMETERS); String_AppendConst(&msg, " ["); for (i = 0; i < numArgs; i++) { - String_Format1(&msg, "0x%x,", &pInfo->ExceptionRecord->ExceptionInformation[i]); + String_Format1(&msg, "0x%x,", &info->ExceptionRecord->ExceptionInformation[i]); } String_Append(&msg, ']'); } msg.buffer[msg.length] = '\0'; - AbortCommon(0, msg.buffer, pInfo->ContextRecord); + AbortCommon(0, msg.buffer, info->ContextRecord); return EXCEPTION_EXECUTE_HANDLER; /* TODO: different flag */ } void Logger_Hook(void) { SetUnhandledExceptionFilter(UnhandledFilter); }