Skip to content

Building on Windows 10

Matthew Connelly edited this page Jan 6, 2022 · 1 revision

Setup and Required Programs

Installing Chocolatey, Make and Emscripten

To build, you'll need Make to run the makefile and emscripten, the WASM compiler. To download these, I found the Chocolatey package manager the easiest to use. Download here: https://chocolatey.org/install

Once you've installed that, run powershell as an administrator.

Install Make by entering the following into powershell:

choco install make

Install emscripten, again in powershell:

choco install emscripten

Activating Emscripten

Now, still as administrator, navigate to emscripten's install directory, by entering the following:

cd C:\Users\YOUR_NAME\AppData\Local\emsdk

where YOUR_NAME is your username.

Before running the following commands, you may need to enter the following:

run Set-ExecutionPolicy RemoteSigned

If this is a security concern for you, after all setup scripts are done, you should revert this with:

run Set-ExecutionPolicy Default

I don't know anything about Windows security.

Lastly, while in the same directory, run the following commands to activate emscripten:

.\emsdk install latest

and then

.\emsdk activate latest

Building

Open a new powershell window (not as administrator this time) and change into the directory of the decompilation. If you have it in your downloads folder, in powershell that might look something like:

cd .\Downloads\Sonic-Decompilation-WASM\

Then run

make wasm-windows

This will make a directory called wasm, then compile the source code and put the output in that directory.

Playing

The fun part! In powershell, while still in the decompilation directory, change to the wasm directory:

cd .\wasm

Now you need to run a local server. When you installed emscripten, it should have installed python, amongst other things. You can run a server with python in this directory by entering:

python -m http.server

It should tell you that it is serving it on port 8000 by default. You can open your browser now and navigate to http://localhost:8000/

The game should be running there! To stop the server, you can press ctrl-c in the same powershell window or just close that powershell window.

If there is no sound, refresh the window and click on the canvas (black square) as soon as it loads. With Chrome at least, sound cannot autoplay unless the user has interacted with the page somehow first.