New static recompiler tool N64Recomp aims to seamlessly modernize N64 games

zelda.png

As each year passes, retro games become harder and harder to play, as the physical media begins to fall apart and becomes more difficult and expensive to obtain. The onward marching of time and evolution of technology also means that video games that were once landmark titles in their day, are now thought of as clunky, awkward, or just not viable by today's standards.

These reasons are why so many individuals have dedicated years of their lives to reverse engineering beloved video games, combining their efforts to create decompilations that allow for classic games to be experienced in new ways, on new technology, with new features and improvements that were never possible on original hardware or through emulation. These decompilation projects take massive amounts of effort, however; for example, one such undertaking for The Legend of Zelda: Majora's Mask, has been worked on since early 2021, and after years of steady, painstaking progress, is still not yet ready for release.

A new piece of software might be a big game-changer in that department, though. A modder by the name of Mr-Wiseguy quietly released two projects--one of which is titled Zelda 64: Recompiled, which can play The Legend of Zelda: Majora's Mask with numerous modern-day features, including support for autosaves, ultrawide resolutions, high framerates, gyro aiming, custom textures, and more. All of this can be utilized by downloading his release of Zelda 64: Recompiled, and providing your own legal cart dump of Majora's Mask.



According to Mr-Wiseguy, the project was made using a tool he created: N64 Recomp. It is a static recompiler for Nintendo 64 games that can turn N64 binaries into C code, and then be compiled into a platform of your choosing. By using N64 Recomp, the modder was able to create "recompilations" of Nintendo 64 games that lack decompilations, such as Rocket Robot on Wheels, Banjo-Kazooie, and Superman 64.

A highly-detailed breakdown of the process is explained below.

The recompiler works by accepting a list of symbols and metadata alongside the binary with the goal of splitting the input binary into functions that are each individually recompiled into a C function, named according to the metadata.

Instructions are processed one-by-one and corresponding C code is emitted as each one gets processed. This translation is very literal in order to keep complexity low. For example, the instruction addiu $r4, $r4, 0x20, which adds 0x20 to the 32-bit value in the low bytes of register $r4 and stores the sign extended 64-bit result in $r4, gets recompiled into ctx->r4 = ADD32(ctx->r4, 0X20); The jal (jump-and-link) instruction is recompiled directly into a function call, and j or b instructions (unconditional jumps and branches) that can be identified as tail-call optimizations are also recompiled into function calls as well. Branch delay slots are handled by duplicating instructions as necessary. There are other specific behaviors for certain instructions, such as the recompiler attempting to turn a jr instruction into a switch-case statement if it can tell that it's being used with a jump table. The recompiler has mostly been tested on binaries built with old MIPS compilers (e.g. mips gcc 2.7.2 and IDO) as well as modern clang targeting mips. Modern mips gcc may trip up the recompiler due to certain optimizations it can do, but those cases can probably be avoided by setting specific compilation flags.

Every output function created by the recompiler is currently emitted into its own file. An option may be provided in the future to group functions together into output files, which should help improve build times of the recompiler output by reducing file I/O in the build process.

Recompiler output can be compiled with any C compiler (tested with msvc, gcc and clang). The output is expected to be used with a runtime that can provide the necessary functionality and macro implementations to run it. An example of most of the required macro implementations can be found in the Zelda 64: Recompiled project here, with the project also containing accompanying code for implementing the rest of the required runtime.

Additionally, a collaborative video between Mr-Wiseguy and YouTuber Narrel was released, which goes into further technical explanation on how the tool works, and what it can be capable of. It also showcases demos of recompiled games running.



Zelda 64: Recompiled currently supports The Legend of Zelda: Majora's Mask, with plans to support Ocarina of Time soon. A release on GitHub is linked below. N64 Recomp is not publically available yet, though you can browse the GitHub page for the project below as well, so that you can keep up to date on any new updates as they happen.

:arrow: Source: Zelda 64 Recompiled GitHub
:arrow: Source: N64Recomp GitHub
 

ShadowOne333

QVID PRO QVO
Editorial Team
Joined
Jan 17, 2013
Messages
12,234
Trophies
2
XP
34,674
Country
Mexico
I cannot express enough just how big of a deal this is. N64 hopefully is about to enter a renaissance era, and hopefully, we will get to see more official N64 remasters soon enough.

The only game I really hope this recompiler is compatible with is RE2.
Just imagine the N64 version of RE2 with hi-res textures, high quality audio and even restoring the FMVs to good HD quality.
And to top it off, remastered 3D models, and Ray tracing into it...

Ooooof, it'd be like the fixed camera RE2 Remake we never got.
 

Jayro

MediCat USB Dev
Developer
Joined
Jul 23, 2012
Messages
13,059
Trophies
4
Location
WA State
Website
ko-fi.com
XP
17,250
Country
United States
So wait... We can just decompile any N64 ROM now all willy-nilly? Didn't the other N64 decomps take years?

I'd love to see Excitebike 64 recompiled in HD with a high framerates and maybe faster bikes. My biggest gripe was how slow the bikes are and the floaty gravity.
 

CMDreamer

Well-Known Member
Member
Joined
Oct 29, 2014
Messages
1,712
Trophies
1
Age
39
XP
3,545
Country
Mexico
Let's all just hope N doesn't issue a DMCA...
Shouldn't as no original source code nor assets are being used for this, and if Nintendo gets clever enough it could be beneficial for them too.

Ray Tracing in development for N64 games! That's awesome!!!

Edit:

Now if someone could help me and tell me if the ROM needs any specific filename... Anyone? Thanks!
 
Last edited by CMDreamer,
  • Like
Reactions: Y0shII and yoyoyo69

MikaDubbz

Well-Known Member
Member
Joined
Dec 12, 2017
Messages
3,878
Trophies
1
Age
36
XP
7,368
Country
United States
Am I understanding this correctly? This streamlines the decompilation process (for N64 games specifically) so that instead of years to break these games down, it now can be done much much quicker?

If that's the case, please give us decomps for all the best N64 games and port them to the Wii U specifically please lol.
 

MikaDubbz

Well-Known Member
Member
Joined
Dec 12, 2017
Messages
3,878
Trophies
1
Age
36
XP
7,368
Country
United States
Alright this seems like a good place to ask: to what extent can this be utilized? Like if we wanted to combine all of the Mario Party 1-3 boards and mini games into Mario Party 3, is that feasible or completely out of the question? I mean Ship of Harkinian has successfully combined OoT and Master Quest into a single game, so in theory I'd think what I'm imagining shouldn't be completely impossible.
 

Moon164

Well-Known Member
Member
Joined
Nov 21, 2015
Messages
860
Trophies
0
Age
26
XP
2,986
Country
Brazil
One thing I love about these recompilation projects is that not only does it give you the freedom to run the game as best as possible on PC, but it also gives people the opportunity to port the games to whatever platforms they want.

It was incredible to be able to play Ocarina of Time on Wii U in Widescreen at 60fps, seeing the original Super Mario 64 running on a DSi was incredible, not to mention other projects like Sonic Mania that finally got a version for 3DS (which was going to be released but was canceled) and people are porting it to the Dreamcast, or OpenLara/Tomb Raider which runs on basically everything like the Sega 32x or GBA, there's even a port for a super unknown console called Zeebo, we have GTA 3/VC/San on the PSVita, we even have a port of Street Fighter 2 for the Virtual Boy and I don't even need to talk about Doom then.

I think this is simply amazing because not only does it give a chance to have a new way to keep old games alive and fresh, but it also gives older or forgotten consoles a chance to shine as well.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Sicklyboy @ Sicklyboy: Ready to sail the high seas