+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Zelda 3 hangs after Ganon's third ground pound
Pages: [1] 2
Author Topic: Zelda 3 hangs after Ganon's third ground pound  (Read 2 times)
Smirgu
Guest
« on: November 21, 2008, 12:11:38 pm »

Hi!

I did a Zelda 3 translation along with some palette and graphic changes ages ago. The reason I never released it, was that there was a problem with Ganon. For some reason this hacked rom causes Ganon's ground pounds to shake the screen very badly. The game still survives the two first ground pounds (the whole screen just momentarily shakes off its normal position), but the third ground pound shakes the position permanently, and nothing else happens any more: you just here the music and a still screen.

Any ideas what causes this kind of a thing? Has any one experience a similar or even same bug? What could be done to fix this? Back in the day when I was working on this, I think I also tried shortening the translations a lot, but with those shortenings I only got rid of another bug with some of the dialogue texts.
Tauwasser
Guest
« Reply #1 on: November 21, 2008, 01:24:18 pm »

Reason: You overwrote something that was not text or there is something in RAM that was never supposed to be overwritten, because i.e. attacks were always 5 letters, not it's 6 and overwriting stuff.
Solution: Redo all changes and test after each
Better Solution: Grab a debugger and start finding out what makes it go wrong. For SNES there should be screen registers for x and y movement, so you might find something out when breaking on these.

cYa,

Tauwasser
Smirgu
Guest
« Reply #2 on: November 21, 2008, 02:19:34 pm »

Quote from: Tauwasser on November 21, 2008, 01:24:18 pm
Reason: You overwrote something that was not text

By writing to the monologue with Hyrule Magic? How can people do so sophisticated things like the Parallel worlds if a simple thing like changing monologue can already mix up the relationships between text and other data?

Quote
or there is something in RAM that was never supposed to be overwritten
Some text?

Quote
, because i.e. attacks were always 5 letters, not it's 6 and overwriting stuff.
I don't quite understand that sentence. Attacks were 5, not it's 6?

Quote
Solution: Redo all changes and test after each
Yeah well, there's always that. Won't go into that though - ESPECIALLY since Hyrule Magic doesn't offer a possibility to export/import one kind of change (monologue, world map, palettes, etc) at a time.


Quote
Better Solution: Grab a debugger and start finding out what makes it go wrong. For SNES there should be screen registers for x and y movement, so you might find something out when breaking on these.
Quote
Is there some debugger you'd recommend? A quick search brought Geiger’s Snes9x Debugger up. Is that good?
DarknessSavior
Guest
« Reply #3 on: November 21, 2008, 02:24:01 pm »

Geiger is basically your only option, unless you have a machine capable of running an older version of bsnes (and chances are, you don't).

~DS
Tauwasser
Guest
« Reply #4 on: November 21, 2008, 02:29:35 pm »

It was supposed to say "now it's 6". I figured you might have made attack names longer or something. Usually these kind of things happen when the game expects text to fit into a certain amount of predefined space. Many games for consoles with very limited ram have their layout like this:

################
################
ABCDEFGHIJKLMNOP

# is the alotted space in ram
A to P might be important variables, preloaded asm code etc.
Now, in my example a sentence with 32 characters would just work fine, however, if text is loaded after A and text is 33 long, it will overwrite A. That's how bugs like the one you're describing occurred to me often. It might be something other though - anti piracy comes to mind.

Geiger's Snes9x is a good one - however, you will need some expertise to actually do anything useful with it. There are several tech docs out there (check for Anomie's and I think Byuu's). These will give you a bit of an understanding of what is actually happening.

cYa,

Tauwasser
Smirgu
Guest
« Reply #5 on: November 21, 2008, 02:53:40 pm »

Quote from: Tauwasser on November 21, 2008, 02:29:35 pm
It was supposed to say "now it's 6". I figured you might have made attack names longer or something.

I don't think I've tempered with anything like that since I've only changed the monologue.

Quote
Usually these kind of things happen when the game expects text to fit into a certain amount of predefined space. Many games for consoles with very limited ram have their layout like this:

################
################
ABCDEFGHIJKLMNOP

# is the alotted space in ram
A to P might be important variables, preloaded asm code etc.
Now, in my example a sentence with 32 characters would just work fine, however, if text is loaded after A and text is 33 long, it will overwrite A. That's how bugs like the one you're describing occurred to me often. It might be something other though - anti piracy comes to mind.

Geiger's Snes9x is a good one - however, you will need some expertise to actually do anything useful with it. There are several tech docs out there (check for Anomie's and I think Byuu's). These will give you a bit of an understanding of what is actually happening.

cYa,

Tauwasser

Yep. Well, I'll probably have a look at the debugger some time later.
MathOnNapkins
Guest
« Reply #6 on: November 22, 2008, 03:04:46 pm »

I may be able to help, but no guarantees. Is the dialogue the only thing you changed in the game? If so I may be able to fix it for you.
Smirgu
Guest
« Reply #7 on: November 23, 2008, 02:59:49 am »

Quote from: MathOnNapkins on November 22, 2008, 03:04:46 pm
I may be able to help, but no guarantees. Is the dialogue the only thing you changed in the game? If so I may be able to fix it for you.

You've experience a similar thing? The dialogue isn't the only thing I've changed, but I believe it's the one that's causing trouble. In addition to monologue I've changed palettes (at least Link's and the crystal's) and Menu screens.

By the way, I tried the Geiger's debugger, and it suggested to remove the rom file's header. I did so, and to a great surprise Ganon didn't hang now - although the ground pounds still shook the screen pretty badly. At first I thought removing the header fixed it, but, as I've tried it today again, now it hangs again, so I guess it was just a coincidence: now on two tries it first hung already after the first ground pound and then the second (still, the third ground pound in the topic wasn't based on just one test). If I remember correctly, i tried this many times three years ago (yep, it's been a while Cheesy ), and Ganon always hung.

Ps. this is the sprite status Geiger prints when the game has crashed. Some of the positions are negative, which I suppose isn't a normal situation:

X:-228 Y:240 vH3s X:-192 Y:240 vh3s X:127 Y:240 vh3S X:127 Y:240 vh3S
X:-156 Y:240 vh0s X:-148 Y:240 vh0s X:-140 Y:240 vh0s X:-132 Y:240 vh0s
X:-124 Y:240 vh0s X:-116 Y:240 vh0s X:128 Y:240 vH2S X:128 Y:240 vH2S
X:254 Y:240 vH3S X:238 Y:240 vh3S X:201 Y:240 vh3S X:167 Y:240 vh2s
X:189 Y:240 vH3S X:173 Y:240 vh3S X:192 Y:240 vh3S X:207 Y:240 vH2S
X:183 Y:240 vh2S X:199 Y:240 vh2S X:183 Y:240 vh2S X:199 Y:240 vH2S
X:173 Y:240 vh2S X:173 Y:240 vh2S X:207 Y:240 vH2S X:183 Y:240 vh2S
X:199 Y:240 vH2S X:180 Y:240 vh2S X:202 Y:240 vH2S X:181 Y:240 vh2S
X:184 Y:240 vh2S X:220 Y:240 vh2S X:206 Y:240 vh2S X:166 Y:240 vh2S
X:149 Y:240 vh2S X:176 Y:240 vh2S X:216 Y:240 vh2S X:244 Y:240 vh2S
X:134 Y:240 vh2S X:150 Y:240 vH2S X:132 Y:240 vh2S X:152 Y:240 vH2S
X:124 Y:240 vh2S X:124 Y:240 vh2S X:160 Y:240 vH2S X:160 Y:240 vH2S
X:154 Y:240 vH2S X: 95 Y:240 vh3S X: 50 Y:240 vH3S X: 86 Y:240 vh2S
X:134 Y:240 vh2S X:150 Y:240 vH2S X:134 Y:240 vh2S X:150 Y:240 vH2S
X:134 Y:240 vh2S X:150 Y:240 vH2S X:132 Y:240 vh2S X:152 Y:240 vH2S
X:124 Y:240 vh2S X:124 Y:240 vh2S X:160 Y:240 vH2S X:160 Y:240 vH2S
X:160 Y:240 vH2S X:145 Y:240 vH2S X:-51 Y:240 vh3S X:-27 Y:240 vH3S
X: 84 Y:240 vh2S X:120 Y:240 vh2S X:137 Y:240 vh2S X:153 Y:240 vH2S
X:137 Y:240 vh2S X:153 Y:240 vH2S X:137 Y:240 vh2S X:153 Y:240 vH2S
X:135 Y:240 vh2S X:155 Y:240 vH2S X:127 Y:240 vh2S X:127 Y:240 vh2S
X:163 Y:240 vH2S X:163 Y:240 vH2S X:137 Y:240 vH2S X: 96 Y:240 vH2S
X: 77 Y:240 vh2S X: 99 Y:240 vH2S X:114 Y:240 vh2S X:134 Y:240 vH2S
X:106 Y:240 vh2S X:106 Y:240 vh2S X:142 Y:240 vH2S X:142 Y:240 vH2S
X:161 Y:240 vH2S X:133 Y:240 vh2S X:133 Y:240 vh2S X:169 Y:240 vH2S
X:169 Y:240 vH2S X:  0 Y:240 vh0s X:  0 Y:240 vh0s X:  0 Y:240 vh0s
X:181 Y:240 vh2S X:-54 Y:240 Vh2s X:139 Y:126 vh2S X:182 Y:240 vh2S
X:143 Y:119 vh2S X:143 Y:127 vh2S X:157 Y:240 vh2S X:187 Y:240 vh2S
X:166 Y:240 vh2s X:-128 Y:240 vh2s X:143 Y:135 vh2s X:151 Y:135 vH2s
X:  0 Y:240 vh0s X:  0 Y:240 vh0s X:  0 Y:240 vh0s X:  0 Y:240 vh0s
X:124 Y:240 vh2s X:  0 Y:240 vh0s X:  0 Y:240 vh0s X:  0 Y:240 vh0s
X:  0 Y:240 vh0s X:  0 Y:240 vh0s X:  0 Y:240 vh0s X:  0 Y:240 vh0s
X:  0 Y:240 vh0s X:189 Y:240 vh3S X:191 Y:240 vh3S X:193 Y:240 vh3S
MathOnNapkins
Guest
« Reply #8 on: November 23, 2008, 05:20:40 am »

Can you supply the patch and a savestate? It's pretty hard to know what 's wrong with out looking at it. Sprite positions being negative doesn't really tell me anything.
Smirgu
Guest
« Reply #9 on: November 25, 2008, 10:49:55 am »

Quote from: MathOnNapkins on November 23, 2008, 05:20:40 am
Can you supply the patch and a savestate? It's pretty hard to know what 's wrong with out looking at it. Sprite positions being negative doesn't really tell me anything.
Here's the patch and a snes9x statefile just at the first ground pound:

http://www.savefile.com/files/1903683
MathOnNapkins
Guest
« Reply #10 on: November 26, 2008, 08:36:39 am »

All righty, I'll have a look at this tonight, hopefully. This is a finnish translation? (based on the file name Zelda_fi?)
Smirgu
Guest
« Reply #11 on: November 27, 2008, 12:45:47 am »

Quote from: MathOnNapkins on November 26, 2008, 08:36:39 am
All righty, I'll have a look at this tonight, hopefully.
Thanks.

Quote
This is a finnish translation? (based on the file name Zelda_fi?)
Yep. Wink
MathOnNapkins
Guest
« Reply #12 on: November 28, 2008, 02:26:22 pm »

I think I figured out the reason it was crashing. Assuming your rom has no header, change the bytes at address 0xE8000 from 7F 80 to 01 FF. I think those got corrupted as the result of Hyrule Magic's monologue editor going crazy. The monologue is in the previous bank of the rom, so I'm not surprised. Let me know if you continue to have problems. Basically what was happening was the scroll was going crazy and causing Ganon's sprite code to go nuts. Instead of shaking the ground the normal way by srolling -1 and +1 alternately, it was doing like -0x80 and 0x7F alternately as a scroll adjustment.

I tested this several times (5 + with and without this modification) and I think your problem is solved.
Smirgu
Guest
« Reply #13 on: November 30, 2008, 12:45:20 pm »

Quote from: MathOnNapkins on November 28, 2008, 02:26:22 pm
I think I figured out the reason it was crashing. Assuming your rom has no header, change the bytes at address 0xE8000 from 7F 80 to 01 FF. I think those got corrupted as the result of Hyrule Magic's monologue editor going crazy. The monologue is in the previous bank of the rom, so I'm not surprised. Let me know if you continue to have problems. Basically what was happening was the scroll was going crazy and causing Ganon's sprite code to go nuts. Instead of shaking the ground the normal way by srolling -1 and +1 alternately, it was doing like -0x80 and 0x7F alternately as a scroll adjustment.

I tested this several times (5 + with and without this modification) and I think your problem is solved.

Hi! Thanks a lot. That truly seemed to do the trick. Out of curiosity, what kind of process did you go through to find this out? I mean that it was exactly these two bytes that created problems and what values they should be? Did you just take the correct values from the original rom?
MathOnNapkins
Guest
« Reply #14 on: December 01, 2008, 11:27:11 am »

Much like Tauwasser's gut told him, my gut told me it was a problem with the scrolls getting out of hand. I've been hacking this game for years so I know my way around. In this case it was the BG2 offset at RAM locations $7E011A and $7E011C (going off memory here). These numbers get added to the Y and X scroll values, respectively, for the screen. It causes the "quaking" look on the screen by quickly alternating between -1 and +1. I tracked down in the code of the game where $7E011C was being written to during the Ganon fight. I used a write breakpoint on 7E011C in Geiger's Snes9x Debugger. From there I determined (by going backwards) that the values for the scroll offsets were being read from CPU location $1D8000 (which translates to $E8000 in the rom). You have to know 65c816 assembly language fairly well to understand what's going on though. After I determined that those numbers were nonsense I looked at a clean rom and just copied them over to test it out. I surmise that the source of this problem was Hyrule Magic screwing up on monologue b/c you said your hack had extensive monologue changes (it's a translation after all) and by the fact that 7F is the byte that in the monologue data indicates "end of message" and that 80 indicates "go to the second set of monologue data". It's just too much of a coincidence for it to be anything else, I think.

As for the crashing itself, it seemed to be random whether it occurred at all. I didn't bother looking any further what was specifically crashing in Ganon's code due to the scrolls being off b/c I was sure this was the answer.
« Last Edit: December 01, 2008, 11:35:34 am by MathOnNapkins »
Pages: [1] 2  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC