Jump to content

Gameshark Code Patcher (WIP)


Jason777
 Share

Recommended Posts

I've been working on something on-and-off recently: a patcher for all gameshark codes. The program would be geared towards OoT debug, but in theory it should work for all N64 games. I say this because I plan to include an "advanced" option where the user can specify free RAM space and areas where sections of the ROM are always loaded into the same area.

 

The neat thing about this tool is that it'll be able to handle conditional codes (D0, D1, D2, D3). Another thing is that it'll be able to patch practically all codes that one may throw at it (with the exception of 50 type codes... unless I add support) . This is all possible through an assembly routine I have made that reads a list of GS codes that directly follow it.

 

Codes that fall into an area of RAM that is always in the same space, that has no conditional code types, and can be converted easily to a ROM offset will be patched normally via simple modifications of bytes. Anything else uses the assembly routine I had mentioned above.

 

Another feature I plan to add to the program is the ability to show and modify (add, remove, edit) a list of "active" codes that are to be used by the assembly routine.

 

A preview:

 

  Reveal hidden contents

 

 

Credits:

The program is based off the concepts used in gameshark code patcher for SM64: http://jul.rustedlogic.net/thread.php?id=16157

It was made by ShenoxVII, Tamkis, and Kazeshin.

  • Like 3
Link to comment
Share on other sites

Zelda's Birthday 2 is one step closer to reality now.

 

My version of Roc's Feather 2(jump), Shiek's Magic's, Invisible Link, Exploding Arrows, and Death Mount Trail 2.

 

All new icons, new spells, new arrows, new cutscenes, and many suprise features!

 

New Ocarina Songs(hard coded).

 

It's no replacement for the URA project, but I hope I'll still get enough help to complete it.

 

6 new dungeons, new music, some new actors, ect.

 

3 new bosses, 3 old bosses.

 

Need help.

 

Many thanks!!!

  • Like 1
Link to comment
Share on other sites

  On 1/10/2014 at 4:25 AM, john_smith_account said:

Zelda's Birthday 2 is one step closer to reality now.

 

My version of Roc's Feather 2(jump), Shiek's Magic's, Invisible Link, Exploding Arrows, and Death Mount Trail 2.

 

All new icons, new spells, new arrows, new cutscenes, and many suprise features!

 

New Ocarina Songs(hard coded).

 

It's no replacement for the URA project, but I hope I'll still get enough help to complete it.

 

6 new dungeons, new music, some new actors, ect.

 

3 new bosses, 3 old bosses.

 

Need help.

 

Many thanks!!!

If you're in need of help, I'll do assembly or find addresses you need. Just private message me here and we shall further discuss.

 

Edit: Ocarina songs? I uploaded this onto spin's wiki three years ago

  • Like 1
Link to comment
Share on other sites

  • 8 months later...

Warning: I have not yet tested this method, but, in theory, it should work just fine.

 

â–²ChriisTiianâ–² asked me how to use this a couple of days ago. I figured I might give a little mini-tutorial on how to patch GS codes. Keep in mind that once my program is complete, this won't be the way things are done:

 

 

  Quote

Go to these URLs for some of the files needed:

First, I should say that this (GS Code Patcher Project) is largely untested and incomplete so the steps I'm giving you won't be the "official" way to do this once I actually get work started on it. Alright, now that the disclaimer is out of the way, let's get started.

 

STEP 1: Download z64hook-0.0.2.ppf and patch your ROM with it.

STEP 2: The patch of z64hook has us place our code at placed at 0x80600000 in the RAM and since my hack was already compiled with this RAM address as the start point, we can just take our assembled Gameshark Code Interpreter and paste write it wherever z64hook specifies us to place our code in the ROM. This is offset is 0x03600000, so go ahead paste-write it there.

STEP 3: Take all the GS codes you want to patch, as long as you don't go past 0x03601000 you can paste all the GS codes you want at 0x036000FC. As an example, say you wanted to patch the "replace roll with jump" GS code. You would literally overwrite (paste-write) the bytes at 0x036000FC with the complete GS code:

D1 22 47 80 3F A0 81 22 46 10 40FF
The original GS code was:

D1224780 3FA0
81224610 40FF
 

Limitiations:

Using z64hook-0.0.2.ppf, we can only place GSCI.bin at 0x03600000 which is a very popular spot in ROM to place any modifications that need to be relocated and this can cause trouble. The way to get around this for now, is to take z64hook's source code, modify it so that it uses GNU syntax and can be compilable by Galatea, and then modify the following lines to use a different ROM offset, then recompile:

LUI T1, 0x1360 ;This specifies 0x03600000 + 0x10000000... which actually describes the ROM offset to use (change this)
SW T1, 0x0004(T2)
Another thing that we are limited to is the amount of space that is transferred from ROM to RAM (0x1000 bytes). Take the source code of z64hook and modify these lines and then recompile:

LUI T1, 0x0000  ;To change transfer size, change this
ORI T1, R0, 0x0FFF ;And this (Subtract 1 from total size, 0x1000 = 0xFFF)
Another thing is the RAM address that the hack is placed at (0x80600000), but I'll only get into that if it actually bothers you.

 

I'd imagine it would get quite tedious when patching long GS codes so I think I'll cook up a quick program later today that takes a text file of GS codes and spits out a binary that is ready to be placed at 0x036000FC.

 

EDIT: According to â–²ChriisTiianâ–², the method is a success!!

  • Like 1
Link to comment
Share on other sites

That's cool. A long time ago I made a code for OoT before we knew about map select. It combined the use items anywhere with the ability to turn the interface on and off as needed and a value that determined the object set in the scene. You could use Farore's Wind to warp anywhere including into cutscenes that link could normally not appear in (like the end credits or goddess cutscene without appear in strange places code) Problem is, it was a bit unstable on the actual gameshark, probably because mine was old, and worked perfectly on emulator. It would be cool to patch that to rom and make my own debugging tools for a mod. 

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.