Title : Playing CrossCode within a web browser
Author: Solène
Date  : 09 December 2019
Tags  : gaming openbsd68 openindiana

Good news for my gamers readers. It's not really fresh news but it has never
been written anywhere.

The commercial video game [Crosscode](https://www.gog.com/game/crosscode) is
written in HTML5, making it available on every system having chromium or
firefox. The limitation is that it may not support gamepad (except if you find
a way to make it work).

A demo is downloadable at this address
https://radicalfishgames.itch.io/crosscode and should work using the following

You need to buy the game to be able to play it, it's not free and not
opensource. Once you bought it, the process is easy:

1. Download the linux installer from GOG (from steam it may be too)
2. Extract the data
3. Patch a file if you want to use firefox
4. Serve the files through a http server

The first step is to buy the game and get the installer.

Once you get a file named like "crosscode\_1\_2\_0\_4\_32613.sh", run `unzip`
on it, it's a shell script but only a self contained archive that can extract
itself using the small shell script at the top.

Change directory into `data/noarch/game/assets` and apply this patch, if you
don't know how to apply a patch or don't want to, you only need to
remove/comment the part you can see in the following patch:

    --- node-webkit.html.orig	Mon Dec  9 17:27:17 2019
    +++ node-webkit.html	Mon Dec  9 17:27:39 2019
    @@ -51,12 +51,12 @@
     <script type="text/javascript">
         // make sure we don't let node-webkit show it's error page
         // TODO for release mode, there should be an option to write to a file or something.
    -    window['process'].once('uncaughtException', function() {
    +/*    window['process'].once('uncaughtException', function() {
             var win = require('nw.gui').Window.get();
             if(!(win.isDevToolsOpen && win.isDevToolsOpen())) {
                 win.showDevTools && win.showDevTools();
    -    });
    +    });*/
         function doStartCrossCodePlz(){

Then you need to start a http server in the current path, an easy way to do it
is using... php! Because php contains a http server, you can start the server
with the following command:

    $ php -S

Now, you can play the game by opening http://localhost:8080/node-webkit.html

I really thank Thomas Frohwein aka thfr@ for finding this out!

Tested on OpenBSD and OpenIndiana, it works fine on an Intel Core 2 Duo T9400
(CPU from 2008).