Sign in to follow this  
Followers 0
indexphinger

Decompiling N64 games...

18 posts in this topic

Well, I had an Idea....Watching the awesome tech-demos for the old N64 games, they looked on par with ps2 games...

I was thinking....since emulators are often slow and require lots of power to emulate an otherwise powerhouse of a n64.

Why not just...port it to PC, draw better graphics and make an outdated game shine?

If anybody wants to help or give pointers, shoot!

I'm really good with C++ and Basic, and the visual variants. A bit of assembler too...

0

Share this post


Link to post
Share on other sites

This is infeasible for a variety of reasons.

Decompilation is pretty worthless for what you want to do; a lot of information is lost in the compilation process. While a decompiler may be able to generate valid C given a binary, it won't be pretty. Don't expect meaningful variable names, function names, or aggregate data types.

Even if you manage to make sense out of whatever is in the rom (which will be a decompiled mess, I presume) the game is going to be pretty tightly tied to the architecture. If you don't want to emulate the chips that handle graphics, input, sound, etc, you're going to have to rewrite all of that from scratch. Oh, and the code might be written to take advantage of the fixed clock speed of the processor. Good luck getting the timing right.

How slow are N64 emulators on modern hardware anyway? What are the bottlenecks? It would make more sense to improve an emulator than try to port even a single game.

You might be interested in texture packs, though.

0

Share this post


Link to post
Share on other sites
Well, I had an Idea....Watching the awesome tech-demos for the old N64 games, they looked on par with ps2 games...

I think you need to smoke less crack.

I was thinking....since emulators are often slow and require lots of power to emulate an otherwise powerhouse of a n64.

The N64 wasn't that fast. For then, I guess it was speedy, but now it's just a slowish MIPS machine. My Linksys router is faster. Doesn't do sound or graphics, but the CPU is faster.

Why not just...port it to PC, draw better graphics and make an outdated game shine?

To do that, all you have to do it throw away everything you have and start over again. Without the source code, you can't simple "port" the program to the PC. There are re-compilation techniques to turn code from one CPU into code for another CPU (for example, MIPS into x86), but here that's not really the problem. Emulating the CPU won't be that hard, even slow machines today could do that without much trouble.

Traditionally, emulating a video game machine had more to do with emulating the sound and graphics hardware than it did the CPU. The CPU is the easy part, it's extremely well documented (in most cases) and a relatively simple piece of hardware. People know about CPUs, but not many people know about the graphics chips. Especially in the earlier consoles (before 3d), the chips relied heavily on the timing of the rasterization, so the raster process itself had to be emulated.

But there are some shortcuts you can take with the N64. Since the graphics chip is a higher-level chip (software doesn't know or care about the rasterization), you can cheat and just feed it through OpenGL. Here, the "emulation" involves reconstituting the 3d graphics calls (primitives, vertexes, texture coordinates, etc) and making OpenGL calls with them.

There's also some related work going on here as well. Since the calls can be converted to OpenGL calls, you can inject your own calls in between. There's re-texturing project for Mario 64 that does this, and makes Mario 64 look a little more modern.

But.. long post short, emulation is the easiest way here. It might not be the fastest, but it's fast enough.

Edit: haha, beat me to it :P You even linked to the texture pack I was talking about.

0

Share this post


Link to post
Share on other sites

If you want to make a modern version of the games, you're better off writing your own code in a modern language.

0

Share this post


Link to post
Share on other sites
Well, I had an Idea....Watching the awesome tech-demos for the old N64 games, they looked on par with ps2 games...

I think you need to smoke less crack.

I was thinking....since emulators are often slow and require lots of power to emulate an otherwise powerhouse of a n64.

The N64 wasn't that fast. For then, I guess it was speedy, but now it's just a slowish MIPS machine. My Linksys router is faster. Doesn't do sound or graphics, but the CPU is faster.

Why not just...port it to PC, draw better graphics and make an outdated game shine?

To do that, all you have to do it throw away everything you have and start over again. Without the source code, you can't simple "port" the program to the PC. There are re-compilation techniques to turn code from one CPU into code for another CPU (for example, MIPS into x86), but here that's not really the problem. Emulating the CPU won't be that hard, even slow machines today could do that without much trouble.

Traditionally, emulating a video game machine had more to do with emulating the sound and graphics hardware than it did the CPU. The CPU is the easy part, it's extremely well documented (in most cases) and a relatively simple piece of hardware. People know about CPUs, but not many people know about the graphics chips. Especially in the earlier consoles (before 3d), the chips relied heavily on the timing of the rasterization, so the raster process itself had to be emulated.

But there are some shortcuts you can take with the N64. Since the graphics chip is a higher-level chip (software doesn't know or care about the rasterization), you can cheat and just feed it through OpenGL. Here, the "emulation" involves reconstituting the 3d graphics calls (primitives, vertexes, texture coordinates, etc) and making OpenGL calls with them.

There's also some related work going on here as well. Since the calls can be converted to OpenGL calls, you can inject your own calls in between. There's re-texturing project for Mario 64 that does this, and makes Mario 64 look a little more modern.

But.. long post short, emulation is the easiest way here. It might not be the fastest, but it's fast enough.

Edit: haha, beat me to it :P You even linked to the texture pack I was talking about.

Well, if you put it that way, I think looking into the OpenGL aspect might help me, by creating an emulator based on Project64 for example, convert all the things that can be converted to x86 because the CPU and the audio are what really makes me PO'ed when I'm playing videogames...like it doesnt feel right unless everything flows like it did on the orignal system, or better.

0

Share this post


Link to post
Share on other sites
Well, if you put it that way, I think looking into the OpenGL aspect might help me, by creating an emulator based on Project64 for example, convert all the things that can be converted to x86 because the CPU and the audio are what really makes me PO'ed when I'm playing videogames...like it doesnt feel right unless everything flows like it did on the orignal system, or better.

It's extremely difficult to get it just right. The problem is not emulating the CPU (as I mentioned before), but the other chips. They're not well documented and every aspect, every little quirk, etc is very difficult to work out. Also, the OpenGL thing I mentioned was an approximation. The OpenGL version will never look exactly the same as the N64 version.

If you want to look at emulation, take a step back and look at some simpler emulations. There are many NES emulators out there, and they work more or less 100% accurately. The chips are a lot simpler than in a more modern machine like the N64, so they're much easier to figure out.

0

Share this post


Link to post
Share on other sites
convert all the things that can be converted to x86

What do you even mean by that?

0

Share this post


Link to post
Share on other sites

I know there is a scene where they make higher rez skins for N64 games and then play them using a specific graphics plugin for one of the n64 emulators. Umm take a look at this link.

http://www.emutalk.net/forumdisplay.php?f=110

As far as decompiling old games I know there is a commented version of super mario bros and a half done one for metroid. Might be of some general interest.

http://www.romhacking.net/docs/%5B93%5DSmbre.zip

http://www.romhacking.net/docs/%5B367%5Dm1source.txt

0

Share this post


Link to post
Share on other sites

Those last two links are 404.

0

Share this post


Link to post
Share on other sites

You could take one of the open source N64 emulators and build on it. Work towards making N64 emulation better instead of trying to do what you're describing.

I can remember a time when NES emulators were slow and you had to set it to skip frames just to have it be playable. We've come a long way.

Edited by djmollusk
0

Share this post


Link to post
Share on other sites
I can remember a time when NES emulators were slow and you had to set it to skip frames just to have it be playable. We've come a long way.

Computers have also gotten a lot faster. A lot faster. Though I was using NES emulators around 1998 or so (Nesticle was awesome) and even then it worked... most of the time at least.

0

Share this post


Link to post
Share on other sites

yep computers are wayyyyyyyyyyy faster than in the 90's i mean a good cell/pda is like 208-528mhz withlike 64-256mb ram i mean ddr3 ram is faster than alot of computers from the 90's at 1600mhz/1.6ghz(i think 1billionhz is 1ghz) bus went from like 133-266mhz to like 2000-4000mhz if am3 if intel idk like 533-1024mhz? its probably the rom storage that makes the n64 good beacuse yeah the ps1 was supposed to be the second n64 but nintendo wimped out and sony made it anyways,

0

Share this post


Link to post
Share on other sites

I have done some hacking like this a while ago. My idea was to take an existing n64 emulator, append the rom and settings to the end of the executable, to make the roms executable.

Kind of like a packer for n64 roms.

Fairly simple to do given that there's already open source emulators out there, fun too. I just need to find the time to finish it off and polish it up some time (dont we all know that problem?).

0

Share this post


Link to post
Share on other sites
I have done some hacking like this a while ago. My idea was to take an existing n64 emulator, append the rom and settings to the end of the executable, to make the roms executable.

Kind of like a packer for n64 roms.

Fairly simple to do given that there's already open source emulators out there, fun too. I just need to find the time to finish it off and polish it up some time (dont we all know that problem?).

You can do that easily with a file "binder" or "joiner." It'll probably end up extracting everything to a temp directory and running an executable or batch file you specify. Either that or it could wrap any calls to open files and redirect them to the files in the archive.

Though this is rather useless. Why do I want an emulator that's bound to a ROM? Just give me an emulator and some ROM files. If you want to send it to someone, zip them up into one file.

0

Share this post


Link to post
Share on other sites
Though this is rather useless. Why do I want an emulator that's bound to a ROM? Just give me an emulator and some ROM files. If you want to send it to someone, zip them up into one file.

I dare to disagree. I mainly wrote this so i could save game specific control settings in the file itself, as well as UI mods depending on the game, as well as cheats.

But as i said, it was a pet project, not meant to be useful in any way, just fun to code :)

It WOULD actually be fun to build a networked version tho, using a few computers as thin clients.

Given a gbit network, you could easily handle the data stream for the video.

But, arr I'm rambling on, a few days in the trenches have left me tired and a bit rusty I'm afraid.

0

Share this post


Link to post
Share on other sites

But then you run into problems with latency. The time it takes the server to generate the video frame, compress it, send it to the client, and the client to decompress it and display it will probably be too long. Even small delays in latency have a big impact on the controls of a game.

0

Share this post


Link to post
Share on other sites

Just a random chime in about the n64 emulators and hardware requirements.

I have ran them with little or no problems on my old laptops.

1.6GHzPentium M

1.7GHzPentium M

1.8GHzPentium M

Intel ICH6M chipset graphics (915GM/GMS, 910GML Express)

1.25GB PC-2700

Not really impressive machines... About the same as current netbooks really.

Although i do remember perfect dark would have drops in fps from time to time. So aside from that the only other thing was sometime it was nessisary to tweak or just use different drivers especially video. But i suspect that was more due to my wonky chipset graphics than anything else and only affected certain games.

I mainly used Project 64 and 1964 as my emulators btw

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0