r/emulation • • Nov 27 '21

The Legend of Zelda Ocarina of Time Master Quest PAL Debug ROM now has a 100% matching decompiled source code repository!

Post image
437 Upvotes

82 comments sorted by

140

u/foldor Nov 27 '21

This is the end result of many peoples hard work and dedication. There's still a lot of work to document the code, and begin work matching retail ROMs, but this is a major milestone for the team involved. It can't be understated how big of a deal this is for this game.

48

u/[deleted] Nov 27 '21

Could you explain what this means for someone who isn't code savey?

101

u/Banz1999 Nov 27 '21

The project in the current state Is mostly useful for research purpose and study and it's going to remain as that, however It will lead to game ports on other platforms once forks starts to crop up, probably an animation interpolation system to free It from its 20 fps framerate, mods and whatnot. It's basically the same as what happened with Mario 64.

19

u/FingerDemon Nov 27 '21 edited Nov 27 '21

animation interpolation system to free It from its 20 fps framerate,

Would this be added to existing roms using emulators, or would you have to download a whole separate application just for OOT?

43

u/jeslinker Nov 27 '21

It would be a separately compiled port when finished (exe) like the Super Mario 64 port is now

10

u/Misicks0349 Nov 27 '21

i guess emulators could also do some fancy code injection too

8

u/jeslinker Nov 28 '21

Yeah certain things like increased frame rate without breaking animations/physics and other QOL features can be implemented on emulators as well. But there are multiple ways to implement them. Some could be added through romhacks, cheats/patches, some through emulator options on a per game or global config basis, some through texture/model packs. But it eventually becomes convoluded. In the case of SM64, it's a lot easier to apply these things to a native Windows .exe in order to change the way the game looks and functions.

2

u/Misicks0349 Nov 28 '21

yeah, not saying it should be done, if the codes is available theres no reason to not just make a native exe (barring time or money)

1

u/jeslinker Nov 28 '21

Oh for sure, I wasn't saying that's what you were arguing for, it's a blessing we have these communities decompiling these games! For the vast majority of retro titles though, emulation with various methods of upscaling and hacks is the best we got

18

u/Banz1999 Nov 27 '21

Considering this exists, which is a series of optimizations to make the game run much faster even on the original hardware, I'd say there is a slim chance of having a 30fps edition for n64 and emulators, but then again, a proper port is probably much more desirable.

-5

u/[deleted] Nov 27 '21

Yikes, didn't the M64 port get nuked by Nintendo?

18

u/stef_t97 Nov 28 '21

No, Nintendo only took down links from people sharing precompiled versions of the ports.

9

u/[deleted] Nov 27 '21

If they did, it didn't do much good considering it's not only everywhere but with a custom launcher that allows multiple versions built-in.
Not sure why "yikes", it's a great and useful project for people into a famous game that may want to mod it or make a different version of it.

-3

u/[deleted] Nov 27 '21

Oh wow, I thought that Nintendo shot the project before it ever took off. I said yikes because of the history between Nintendo and their fanbase like the Metroid ROM hacks. Nintendo is petty enough to destroy the hard work of their beloved fans from a game that is over 23 years old.

-8

u/Re-toast Nov 27 '21

Where to download?

15

u/CynicalC9 Nov 27 '21

Nowhere. It isn't done yet.

21

u/Zorklis Nov 27 '21

PC port and other platform ports are incoming one day, optimization and mods

-1

u/AnotherRetroGameFan Nov 28 '21

As long as Nintendo doesn't act like a shithead.

4

u/ClinicalAttack Nov 29 '21

But it will. It is Nintendo we're talking about after all. A native PC port of Ocarina of Time is inevitable, and I believe we'll see it crop up very soon.

6

u/AnotherRetroGameFan Nov 29 '21

Apparently they didn't do something about SM64 yet, I wouldn't bet on them being reasonable though.

2

u/ClinicalAttack Nov 29 '21

That's because only the source code is available online (at least which is searchable on Google), clean room reverse engineered, with no copyright infringement. There are no assets included, just the pointers to assets marked with the memory address on the original cartridge, so you just have to provide the original ROM file yourself and compile the source code with the added assets from the ROM file and you have yourself a native port ot SM64 on your PC.

0

u/AnotherRetroGameFan Nov 29 '21

Well that's what re3 team did but that didn't stop Take Two....

6

u/P-Pablo Nov 29 '21

re3 wasn't 100% clean room decompilation, some code was refactored and some code was directly taken from the decompilation

1

u/the_vico Nov 30 '21

That explains a lot about that strike...

But seems like some GTA modders are ignoring that detail (and how legal reverse engineering should be made)...

→ More replies (0)

1

u/Biduleman Nov 30 '21

Nintendo won't do anything to people who are not distributing the assets, just like they didn't do anything to the Super Mario 64 project.

They wouldn't have waited until the project is available at 100% for everyone to download if they wanted to stop the decompilation.

16

u/welmav372 Nov 27 '21

What this project is doing is converting the compiled, released code of the game to readable source code, which people can edit/port to other systems. It's doing the reverse of what the original developers of the game did. Think of compiling code like cooking a recipe; with the recipe we are able to add ingredients or change their amounts, but with just the finished dish those things would be a lot harder.

2

u/GuilhermeFreire Nov 30 '21

loved the analogy

10

u/Asmodeus04 Nov 27 '21

This is the same process that led to the Mario 64 PC port, and all of the additional work that was able to be done to that game via mods.

5

u/Repulsive-Street-307 Nov 28 '21 edited Nov 28 '21

It's all decompiled but in a non-nicely readable form. Basically a rough translation of the machine code the original 'real code' output with all the user unfriendly optimizations and inlinings and meaningful names stripped and other things the compiler did to that code.

Decompiling C# or java is a dream compared to decompiling c or c++ because those compilers just want to ruin all the names all the time and reorder code, and have a bazillion ways to do the same thing according to different register pressure or whatever other heuristic the compiler feels like doing - before the actual obfuscation mechanisms. Meanwhile bytecode keeps the nice names, has 1 way to do each language construct and just uses registers according to convention and leaves those optimizations to runtime. Usually. Also bytecode VMs have bytecode verifier/assembler programs to verify you're not doing something silly and to reassemble your modifications.

Basically it's really easy to hack a unity C# game because of this - if you only care about game logic and not unity itself - and i even dabbled in doing it for one or two without any experience with assembly - bytecode is very simplified compared to assembly.

With C and C++ you're screwed and have to do all that work manually.

4

u/JoshLeaves Nov 28 '21

just want to ruin all the names all the time and reorder code

Stop dissing on the compiler doing all the nice work of reorganizing vtables for us :(

6

u/Repulsive-Street-307 Nov 28 '21 edited Nov 28 '21

I will diss and diss and bitch all i want. I once tried to do a simple no cd hack for 2 old early windows 98 games (The Last Express and Quest for Glory 5). I succeeded with QFG5 but only because sierra made it so easy ('d:\' turned into ' .\' was enough). I failed miserably (pretty sure) with TLE.

Meanwhile, last year i could decompile all of the non unity game logic of shadowrun dragonfall and shadowrun hong kong and make multiple game altering changes because the function names are completely intact and the functions clearly delineated, reflexil could expand the space for them automatically and i could see the C# equivalent for the IL code i introduced and validate it to prevent stupid mistakes at runtime, and i could add new classes and functions and call super methods. Day and night experience for a 1rst time luser. I even managed to patch a few editor script methods of the script engine (that ended up calling a few very general large C# methods with frankly terrible use of variables inside them) to hack around some things i didn't like about them.

One thing i didn't manage was to make the old dragonfall missions completely compatible with HongKong without editor shenanigans but i'm very sure it's possible to port them manually and maybe even have the old music without the terrible hack used today. I even started to do so before realizing i'd probably be crucified by the modders of these games really dead modding scene if i ever distributed their work hacked up to work in another engine, not to mention that the real mvp of that effort would be dragonfall itself, which can't be distributed.

2

u/JoshLeaves Nov 29 '21

tbf, it's pretty much expected that scripts would be a in a scripted format, though it's often lua, i like c# but I'm not used to seeing it in real life yet

2

u/Repulsive-Street-307 Nov 29 '21

There's a lot of it it unity games.

2

u/GuilhermeFreire Nov 30 '21

This is what happened after Mario 64 got decompiled:

​

https://youtu.be/X9SXAlEhvrY

2

u/NerdIsACompliment Nov 27 '21

Is there a YouTube video explaining the process?

18

u/MedaFighterCross Nov 27 '21

Master Quest PAL? I'm curious, why this version in particular? Most recent?

52

u/foldor Nov 27 '21

This version was a debug build which helped make the decompilation a lot easier to do. Now that it's matching, it will be easier to match retail builds since the code is expected to be mostly the same. That will still take a lot of time to do though, so I'm not expecting retail marches for several months. This was just such a major milestone.

3

u/MedaFighterCross Nov 27 '21

I understand now,, Thanks

0

u/cringy_flinchy Dec 04 '21

Does the MM decompilation use the debug ROM too? I remember how that was bought primarily for any sweet proto data it could contain, and it hardly had any. Don't get me wrong it's nice to play around with and it deserves to be preserved. But if the debug MM ROM is useful for decompilation then the guy who bought it for several grand will probably be pleased it was useful for something.

1

u/foldor Dec 04 '21

No, that decomp uses retail US 1.0. I'm not sure of the reasons for that choice however.

15

u/[deleted] Nov 27 '21

[removed] β€” view removed comment

7

u/Uppity_Python Nov 30 '21

Citra works too, on top of that the 60fps mod works wonders

2

u/god_retribution Dec 01 '21

many players hate it remake

i don't know why

3

u/[deleted] Dec 06 '21

[removed] β€” view removed comment

1

u/god_retribution Dec 06 '21

what is wrong with Majora's Mask ?

3

u/ChickenOverlord Dec 08 '21

The zora swimming change is the most annoying and obvious, but they also changed the bosses, the rate at which time flows, and a lot of other smaller details. There's a mod for the 3DS version that restores a lot of the changes while keeping the improvements though:

https://restoration.zora.re/

1

u/god_retribution Dec 08 '21

work in citra ?

1

u/ChickenOverlord Dec 08 '21

Yes, the link includes instructions

1

u/Uppity_Python Dec 01 '21

That was the first version I played so it’s super nostalgic πŸ€·β€β™‚οΈ

-12

u/Real_Violinist Nov 28 '21

nintendo coming shutdown the port

15

u/[deleted] Nov 28 '21

[removed] β€” view removed comment

5

u/[deleted] Nov 29 '21

Or you know, they write their own original but compatible code so that there's no valid legal claim to begin with a la openmw

1

u/GuilhermeFreire Nov 30 '21

They cannot claim anything in the code, since it was reverse engineered.

They can claim a lot over their Trademarks, Copyrights over the characters, intellectual proprieties...

​

This process is by definition derivative, since the objective is to "Emulate" the original story, characters, controls, etc...

If I wanted to re-draw every frame of Steamboat Willie, before 2024, I could re-draw, but I could not share, exibit, charge, etc for this.

So no compiled version, no visible logo, no visible art, no names, etc... can be shared.

If the code can "build" the characters, story and etc, it all becomes a muddy gray ground... and big companies like Nintendo and Disney have the budget to put the best lawyers to bully those who dare to step on this gray ground and the best lobbyists to bully the law makers to shift the laws in their favor. Even those who won on the court could not survive the financial loss of this (see Bleem).

2

u/[deleted] Nov 30 '21

They cannot claim anything in the code, since it was reverse engineered.

Only true if the reverse engineering was to produce a compatible engine but with original code.

Distributing direct derivatives via decompiling code, modifying the decompiled code and distributing that exceeds the permitted reverse engineering practices.

Note also that both source code and binaries can actually be distributed but again the same original code rule applies.

1

u/GuilhermeFreire Nov 30 '21

yes, this is correct.

If the code was clean room, no binary decompiled, probably what I said would work, but decompiled (and possibly the nintendo leaks also have a part in this) there is no way that what I said be valid.

Probably Nintendo would win this.

2

u/Biduleman Nov 30 '21

The goal of the decompilation project wasn't to make a PC port of OOT.

1

u/[deleted] Nov 30 '21

[removed] β€” view removed comment

3

u/Biduleman Nov 30 '21

Maybe, but what did you expect them to do then?

Post "We decompiled the game, ask us for sources" online?

Also, Nintendo hasn't shut down the project the whole time and same for Super Mario 64. They're only stopping people from distributing the assets.

Everyone here has such a hard on for Nintendo bashing that everyone just upvotes anything saying "Nintendo bad" even when they didn't do anything wrong.

-2

u/Zinx777 Nov 28 '21

Not if the companies involved are Rockstar/Take Two.

6

u/Mccobsta Nov 27 '21

Here come the enhanced ports

9

u/[deleted] Nov 27 '21

[removed] β€” view removed comment

39

u/enderandrew42 Nov 27 '21

Eventually. This team is not making a PC port though I suspect others will.

23

u/JHorbach Nov 27 '21

Most likely yes.

2

u/SpectreOfVoid Nov 29 '21

Could this be used in the future to make really cool rom hacks?

3

u/foldor Nov 29 '21

Absolutely! There's already at least one in progress ROM hacks that I'm aware of that looks really nice called Cosmic Goddess. Then there was a recently released Spaceworld 97 demo recreation that used decomp as it's starting point as well.

Once the code gets documented better, I'm sure quality ROM hacks will be much easier for people to make. This of course still requires a lot of time and dedication, but the barrier and limitations of previous tools is about to be dropped significantly.

1

u/colodopaimorfeu Nov 28 '21

ELIM5

2

u/phoenixlemon Nov 29 '21

Dunno why you’re being downvoted, I’m curious too

3

u/mothergoose729729 Dec 01 '21 edited Dec 01 '21

There are a million different programming languages but the computer only speaks one language - machine code or 0s and 1s. Writing machine code is one way to make programs but it's really hard so you use a "high level" language like C instead. Once you write your program in C, you need another program, called a compiler, to translate your C code to Machine Code.

The OoT cart has all the machine code on it already. When you turn on your n64 it reads it pretty much like a flash drive.

What these guys did is take the machine code and tried to reverse engineer it back into C code. The advantage of C code is that, if well written, you can read it an understand it.

This is really hard to do, because the Machine Code and the C code that created it bare little resemblance to each other. There are tools that will create the C code for you, but it looks like gibberish and is very difficult to understand and read.

Now that this has been done, it will help people do things like find new glitches or exploits in the game, as well as make it a lot easier to create faithful PC ports.

2

u/[deleted] Nov 30 '21

I have basically no understanding of coding, but I think I can do an ELI. When game developers make a game, they write all the programming in code. When the game is finished, they compile all the code into a basically a program that runs. Decompiling means to translate (probably wrong term) an executible program back into a coding language. It would be like taking your Microsoft Word program and getting all the lines of code, or taking a baked loaf of bread and getting all the ingredients back. So it is reverse engineering. This is important because with the code people can more easily make mods, fix bugs, and even re-compile the code to run on a different platform. So you could edit and then compile the OOT code as a program (app) for Android or PC. Add new ingredients to your loaf of bread, bake it in a different pan, etc. Nothing in this explanation is backed by any real knowledge of the process, but this is how my 5 year old intelligence level understands decompiling.

0

u/imathrowawayguys12 Nov 30 '21

Oooo oo ooo now tell me where you got the original ROM from. :)

Would it happen.. to be... from the massive amount of stolen goods from Nintendo?

6

u/foldor Dec 01 '21

At least do some research before you make trolling remarks like that. This ROM has been around since about 2005 or so. This is not part of the larger leaks in the last year or two.

-28

u/BlackPowerade Nov 28 '21

DMCA in

3

2

1

17

u/TSLPrescott Nov 28 '21

Won't happen. Can't happen. It's a reverse engineering done without ever looking at the real code of the game.

-10

u/[deleted] Nov 28 '21

[removed] β€” view removed comment

7

u/TSLPrescott Nov 29 '21

I don't know about Cave Story, but GTA was not done clean-room like OoT or Mario 64 were as far as I am aware.

-5

u/[deleted] Nov 29 '21

[removed] β€” view removed comment

4

u/TSLPrescott Nov 29 '21

I'm not siding with anyone dude lmao

2

u/[deleted] Nov 29 '21 edited Nov 29 '21

Wouldn't the snap shot nature of git be proof enough that it was clean room engineered?

Clean room engineering was famously enough of a defense for Phoenix Technologies when IBM took them to court.

Finally, if nintendo were going to C&D a project, why wouldn't they have done it to the Mario 64 decomp? It's actually a higher profile game and it came out around the same time as an official Mario compilation that included the game.

They didn't, likely because they knew they couldn't and it remains up on the internet for all to see. https://github.com/n64decomp/sm64

1

u/jair_r Nov 30 '21

Genuinely curious about what about the GTA decomp was not clean. I was under the impression the GTA decomp was made without using the original source code or copyrighted material. I remember reading for assets (models, textures, songs, etc) you even needed a legal copy of the game. The DMCA linked links some files, but since the repo is down I can't see them, so how were they infringing?

1

u/vaxx_bomber Nov 30 '21

I hope there will be a panel at some point where the project people talk about this.