Dolphin, the GameCube and Wii emulator - Forums

Full Version: Dolphin Emulator and Webassembly
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone! I LOVE dolphin emulator and it's an absolutely *incredible* tool not just for playing games, but for studying them too. I love how this emulator allows you to take a deep-dive into the virtual memory to see how memory is handled and how things work. After trying to build an online program to reverse-engineer .gct files (compiled gecko codesets) and convert them to something more "human-readable" (you can see the current progress [here](https://pastebin.com/rfPGKjtX), tested on the ProjectM codeset), I looked into the Dolphin Emulator source code for some further insight. I wondered how the source code was organized - what files and directories contained what valuable information.

As I was looking I not-only learned that stuff, but I also learned that Dolphin Emulator is written almost entirely in C / C++. From this information I have a question:

In theory, could Dolphin Emulator be ported to webassembly and put on the web? :o

> Webassembly?

Here is Webassembly's official site:
https://webassembly.org/

Webassembly is a compilation target that has been implemented in many major browsers. In short, it allows low-level programming languages to run on the web by compiling them to WASM rather than code specific to the operating system. Here is a repository of languages that can reach this compiler target:
https://github.com/appcypher/awesome-wasm-langs

Among these are C and C++ with symbols representing full (or near-full) implementation.
You could probably make Dolphin work in Webassembly if you used interpreter mode and the software renderer, but the CPU JITs contain a lot of inline assembly code for the CPUs they support and there's no WebGL graphics backend.
In theory? Sure. In practice while maintaining a playable speed - probably not. The model behind wasm means that many of our jit optimizations would not be possible on such a platform.

Also, even if you wrote a wasm jit, it'd likely be quite slow at compiling blocks, so the experience would suffer as a result (e.g. stuttering).