Trouble with first ROM hack - Road Rash

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Post Reply
fshea31
Newbie
Posts: 6
Joined: Mon Oct 27, 2008 4:00 pm

Trouble with first ROM hack - Road Rash

Post by fshea31 »

I'm trying to do two things to Road Rash.

First off, I want to change the road (bg color) because it's not showing up properly when played on the PS2 using the PGEN emulator. Since it's showing up as white or light gray instead of black, I figured that if I experimented with different colors, I might be able to display it as the proper color.

Second, to enable easier punching I would like to swap the A and C buttons.

Now, I've done quite a bit of research on doing both of these, but I'm stumped. I downloaded the Gens KMod but can't figure out what information in the debugger is pertinent, and how I change it in the rom. I assume hex editing is necessary for changing the road color, but how do I know what address to go to?

And I assume ASM hacking is necessary for the button swap, but what do I change in the code?

Thanks for any help.
TmEE co.(TM)
Very interested
Posts: 2452
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) »

To do that you need to understand what the game is actually doing...

The road color being wrong is misemulation issue, and if you'd change the color yourself, it would still be wrong in your PS2 emulator as it doesn't seem to like mid-frame backdrop color changes (?).

For swapping buttons, it all depends on how game works, it maybe as easy as altering few instruction codes (so BTST #0 becomes BTST #2 for example)... to change the code you use some editor, be it HEX editor of some sort or MS-DOS editor (which I use).
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
fshea31
Newbie
Posts: 6
Joined: Mon Oct 27, 2008 4:00 pm

Post by fshea31 »

Yeah, the problem is with the emulator itself, but I was hoping to make two wrongs into a right.

When I isoloate the background with Gens KMod, it's a constant color that never changes. But the main road shows up on PGEN as different from the cross roads (which are just there for visual purposes), so it's definitely a long shot getting it correct, but I'd like to at least give it a try.

UPDATE: Here's some things I found online that might have to do with the bg color problem:

First off, this refers to an improvement to a different emulator:
"- improved rendering accuracy when backdrop color is modified during HBLANK (Road Rash I/II/III)"

Second, this Genesis programming guide: http://home.hiwaay.net/~jfrohwei/sega/genesis.html has the following line:
"P.S. don't look at Road Rash, it will drive you INSANE! It seems to run
entirely in VBLANK and HBLANK! I figured out the 4-TAP by looking for
Joystick accesses in the VBLANK code... easy!"

As far as the button swapping, I have some understanding of hex editing, but everything's garbled when I view the rom. At least when I break the code down with the Sega Assembler, it's organized and looks like something I can work with.
Eke
Very interested
Posts: 885
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke »

First off, this refers to an improvement to a different emulator:
"- improved rendering accuracy when backdrop color is modified during HBLANK (Road Rash I/II/III)"
actually, I wrote that: it was a fix I added in Genesis Plus GX some time ago :wink:

this was not refering to the road color but to a single line glitch that appeared on the horizon line when I modified HVC values and timings

Road Rash games indeed are very sensitive to timings and PGEN probably is not accurate enough or is doing something wrong
As TmEE said, changing the color won't fix it, the only way is to fix the emulator
fshea31
Newbie
Posts: 6
Joined: Mon Oct 27, 2008 4:00 pm

Post by fshea31 »

That's pretty funny, Eke. I guess the internet isn't so big after all.

I was questioning whether to try to fix the background because my initial thought was that no color was showing up where the road is, i.e. it was completely white. But then I got the feeling that it wasn't completely white, but a light gray, meaning, I assume, that some color is being displayed.

So if the rom is saying to display black, and it's displaying light gray, if I change the rom to say display something else, maybe it'll eventually display the proper black.
TascoDLX
Very interested
Posts: 262
Joined: Tue Feb 06, 2007 8:18 pm

Post by TascoDLX »

Is the sky the same color as the road?

Here's a screenshot from Gens KMod with all layers hidden:

Image

This shot only shows the backdrop color and you can see that the color changes twice for every frame (sky -> road, road -> sky). If the sky is the same color as the road, that means the change is not happening. If that's the case then the only thing you can do as far as hacking is replace the sky color with the road color. Either way, the sky will be the same color as the road.

If the road is a different color than the sky, that's another issue. The emulator could be fetching the wrong color/palette entry from CRAM.

In either case, you'll have to change a color in CRAM and that could cause other color issues because of paletting.
fshea31
Newbie
Posts: 6
Joined: Mon Oct 27, 2008 4:00 pm

Post by fshea31 »

Thanks TascoDLX for the screenshot. The road is not the same color as the sky. So where would the CRAM be changed? Is the rom opened with a hex editor, or do I have to break it down more? Under the Debug-->VDP - Registers, I see the BG Color is at register #07, with a value of 0x3F. Will this information help me at all?

By the way, to swap the buttons A and C I'm going to edit the emulator. Since the source code is available, I figured it'd be easier to just have two PGEN's--one for Road Rash and one for everything else.
TascoDLX
Very interested
Posts: 262
Joined: Tue Feb 06, 2007 8:18 pm

Post by TascoDLX »

fshea31 wrote:By the way, to swap the buttons A and C I'm going to edit the emulator. Since the source code is available, I figured it'd be easier to just have two PGEN's--one for Road Rash and one for everything else.
Ah yes, source code. Very good.

PGEN emulates the palette by CLUT in hardware and only updates it once per frame. This would indicate that the road *is* the same color as the sky unless there's a weird hilight bug (though, from the looks of the source code, PGEN doesn't appear to be emulating shadow/hilight). But I don't claim to know what the colors actually look like in PGEN.

The palette method that PGEN currently uses just won't work. There are only 64 (actually 61) colors available per frame. So if one palette entry is changed midframe then only one of those colors -- the old color or the color replacing it -- can be accurately rendered.

For this particular issue, fixing the emulator is probably easier than hacking the ROM. PGEN already renders line-by-line so you'll need to intercept CRAM writes done when the VDP is drawing and use some indexing tricks to handle the new colors.

In order to truly fix PGEN, the 8-bit CLUT would need to be replaced with something a bit more versatile. Thankfully you only need it fixed for one game ;)
tomaitheous
Very interested
Posts: 256
Joined: Tue Sep 11, 2007 9:10 pm

Post by tomaitheous »

Thankfully you only need it fixed for one game
What about Sonic 2? That does midframe CRAM updates in the water levels. Sonic 1 too, iirc. Or is this something slightly different?
fshea31
Newbie
Posts: 6
Joined: Mon Oct 27, 2008 4:00 pm

Post by fshea31 »

Thanks for everyone's help. I am definitely out of my league with this stuff, so I'm just going to keep the real Genesis hooked up.

When you spend all afternoon just trying to figure out how to re-compile the source code, and still can't figure it out, you know it's not your area.

Either way, the other game I still play--NBA Jam T.E.--runs slow on the PGEN, so it's probably best having the Genesis around.
Post Reply