• Stars
    star
    620
  • Rank 72,387 (Top 2 %)
  • Language
    C++
  • License
    MIT License
  • Created about 3 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A web based N64 Emulator

N64 Wasm

Thanks for checking out N64 Wasm! An N64 emulator that runs in the browser. It is a port of the excellent RetroArch ParaLLEl Core to WebAssembly. This project started because I wanted to have a well playing open-source N64 emulator designed for the web. I also wanted to learn OpenGL and this was a good way to dive in. Game compatibility is decent with a good portion of the 3D games playable and at full speed on a mid-range computer - Mario 64, Ocarina of Time etc... There is currently an issue with some 2D games such as Dr Mario 64 and Pokemon Puzzle League which I am still investigating. I also tested on the iPhone 13 and Xbox Series X Browser and it works great.

Supports the following features -

  • Gamepad Support (Xbox and PS4 Controller tested)
  • Button and Keyboard Remapping
  • Save States and SRAM
    • They save in your browser so you can close and come back later
  • Import/Export Save Files (see settings.js)
  • Zoom Controls
  • Full Screen
  • Audio Support
  • Cloud Save States (Host your own server)
  • Multiple Controller Support
  • Mobile Controls
  • Gameshark Codes
  • Software Renderer Option
  • Mouse Controls (good for starcraft)

You can try it here: https://www.neilb.net/n64wasm/

Build Instructions

I used WSL on Windows but any Linux environment would work as well. First Install Emscripten version 2.0.7

  • create a folder somewhere in your environment to install emscripten
  • git clone https://github.com/emscripten-core/emsdk.git
  • cd emsdk
  • ./emsdk install 2.0.7
  • ./emsdk activate 2.0.7
  • source ./emsdk_env.sh
  • navigate back to the code folder in the N64Wasm repo
  • run make
  • then copy these 2 files from the code\ folder into the dist\ folder
    • n64wasm.js
    • n64wasm.wasm

Hosting

This emulator supports hosting the app yourself with your own rom list. Create a folder called roms in the dist\ folder and copy them there. Then go into romlist.js and uncomment the code and populate the paths and names of your roms.

var ROMLIST = [
    {url:"roms/rom1.z64",title:"Game 1"},
    {url:"roms/rom2.v64",title:"Game 2"},
    {url:"roms/rom3.v64",title:"Game 3"},
];

This will then display a dropdown on the UI to select a game

romlist

You can also enable Cloud Save States with some additional configuration. See this README for information on how to set that up.

Windows Version

If you want to actually do debugging you will want to get the Windows version working on your machine. Debugging in WebAssembly is practically non-existant other than logging print statements. I did all of my debugging and testing using the Windows version with Visual Studio 2019 and then would compile the web version with Emscripten. Make sure you are on a computer that has a graphics card which supports OpenGL.

  • To get it up and running open up the N64_Wasm.vcxproj file in notepad and update the paths
    • update all the paths for the includes and libraries to where these are on your machine
    • the ones referencing the code folders should be where your source code is
    • now you can open up N64_Wasm.vcxproj using Visual Studio 2019
  • Get the Libraries and headers for the following
    • the actual versions could vary but these were the ones I used
    • SDL2 - version 2.0.14
    • SDL2 Image - version 2.0.5
    • SDL2 TTF - version 2.0.15
    • GLEW - version 2.2.0
  • Copy a rom to your working directory
    • and replace the name of that rom in mymain.cpp
    • sprintf(rom_name, "%s", "game.z64");
  • Note - running in Release mode runs much faster than in Debug though you won't be able to set breakpoints

pcversion

Screenshots

screenshot screenshot screenshot screenshot screenshot

Mouse Controls

Mouse Control options are available which work really well for Starcraft 64. If you are playing Starcraft it's a good idea to enable the Software Renderer and also use the European version of the game which runs at 50fps. That will be a little easier on the CPU and should perform better.

screenshot screenshot screenshot

iPhone 13

screenshot

References

More Repositories

1

MarioHTML

My take on an iconic game written in TypeScript
TypeScript
469
star
2

MarioCompiler

A Super Mario Compiler written in JavaScript
Assembly
96
star
3

DosWasmX

Build your own DOS/Windows machine in the browser
C
54
star
4

TetrisJS

This is the classic game of Tetris written in pure HTML
TypeScript
38
star
5

CSharp-In-Browser

Fully web based C# Compiler
JavaScript
16
star
6

numero

TI-83 Emulator for Libretro
C
9
star
7

Emscripten-Tutorial

Companion code used for my YouTube tutorial on Emscripten
C
7
star
8

AzureGitRepos

This is a VS Code extension to easily download your Git Repos by navigating your Projects from the Command Palette
TypeScript
5
star
9

MP3-Player

Fully web based MP3 Player
TypeScript
4
star
10

TetrisNET

Online Multiplayer version of Tetris built with TypeScript and SignalR
TypeScript
4
star
11

TypeScriptPlayground

Fully web based TypeScript development environment with React support
TypeScript
4
star
12

nes_emulator

NES Emulator written in TypeScript
TypeScript
3
star
13

TypeScript-Compiler

Allows compiling of TypeScript in the Browser, no server side code! uses Monaco Editor for code syntax highlighting
HTML
2
star
14

React-Recruiter

A web app I developed for conducting React code interviews using .NET Core and TypeScript
TypeScript
2
star
15

PowerBIHackathon

TypeScript
1
star
16

Wake-On-LAN

Wakes up your computer using the Wake On Lan protocol
C#
1
star
17

MyCodespace

1
star
18

CPlusHelloWOrld

C++
1
star
19

PowerShellLearn

Some basic examples to learn PowerShell
PowerShell
1
star
20

Calculate-Onedrive-Size

Allows you to see in detail which OneDrive Folders are taking up the most space on your computer
C#
1
star
21

maddy-adventure

Microsoft MakeCode Project
TypeScript
1
star
22

CodeInterviewAppNode

TypeScript
1
star
23

mono-compile-in-browser

A project to get mono wasm to compile C# in browser
C#
1
star
24

gameboy-makecode

Experimental Gameboy emulator for Microsoft MakeCode
TypeScript
1
star
25

CodeInterviewApp

A web app I developed for conducting code interviews using .NET Core and TypeScript
TypeScript
1
star
26

RivetsSnippets

VS Code Extension that provides snippets for the RivetsJS Library
HTML
1
star