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
 

EdwardTheWatzo

Member
Newcomer
Joined
Feb 3, 2024
Messages
15
Trophies
0
XP
267
Country
Australia
Where do you get the windows binary tho? It wants me to compile it from source on the github and I can't manage to do it.
I don't know a lot about this stuff. If you can tell me the file name I'll upload it.

I'm just gonna upload this.
 

Attachments

  • dxcompiler.dll, dxil.dll and SDL2.dll.zip
    9.6 MB · Views: 61
  • Like
Reactions: Jayro

_47iscool

Game Hacker (offline)
Member
Joined
Nov 18, 2013
Messages
999
Trophies
1
XP
1,777
Country
United States
Maybe the PS2 can now eventually get more N64 ports like Ocarina of Time. It would also be nice to have Ocarina on DS(i) as well since it got SM64.
 

PZT

Well-Known Member
Member
Joined
Nov 23, 2017
Messages
132
Trophies
0
Age
125
XP
590
Country
United States
showing off a port of Rocket: Robot on Wheels was such a tease, especially since there's nowhere to check for news on it, yeah yeah Majora's Mask woohoo
 

L-Star

Member
Newcomer
Joined
Jun 6, 2024
Messages
9
Trophies
0
XP
154
Country
Japan
Seems promising! Interested to see what they will do with it. Maybe the original animal crossing for N64 will also get some love
 

regnad

Button Masher
Member
Joined
May 19, 2008
Messages
2,572
Trophies
2
Age
54
XP
4,117
Country
Japan

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.



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


So was this project abandoned? After a minor patch for MM recomp right after initial release, there hasn’t been a peep from any of the related projects on GitHub. ☹️
 
  • Wow
  • Like
Reactions: raxadian and cearp

vgmoose

Well-Known Member
Member
Joined
Jan 31, 2016
Messages
364
Trophies
1
Website
github.com
XP
3,386
Country
United States
So was this project abandoned? After a minor patch for MM recomp right after initial release, there hasn’t been a peep from any of the related projects on GitHub. ☹️
There's a PR with upcoming changes to support custom textures, and it has builds with instructions on how to run it. They plan on adding this support in 1.2, but until then, the texture support is already working really well!

PR: https://github.com/Zelda64Recomp/Zelda64Recomp/pull/447
 
  • Like
Reactions: cearp and raxadian

regnad

Button Masher
Member
Joined
May 19, 2008
Messages
2,572
Trophies
2
Age
54
XP
4,117
Country
Japan
There's a PR with upcoming changes to support custom textures, and it has builds with instructions on how to run it. They plan on adding this support in 1.2, but until then, the texture support is already working really well!

PR: https://github.com/Zelda64Recomp/Zelda64Recomp/pull/447
Glad to hear it!

2ship2harkinian also hasn’t been updated in quite a while. I wish it’d get save states like the OoT Harkinian port.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    NinStar @ NinStar: https://www.youtube.com/watch?v=SHb-3oIAFTs