News:

11 March 2016 - Forum Rules

Main Menu

Fastrom Hacks

Started by kandowontu, February 27, 2023, 12:34:45 AM

Previous topic - Next topic

ifightdragons

I have no idea how to find kandowontu on Discord (I don't like that mess of an app anyway), and I don't use Twitter, so I'm just going to leave this here for him to hopefully see eventually:

Raiden Triad is completely broken on original hardware or FPGA. It slows down ten times more after applying the FastROM patch.

I wish these were developed and checked with original hardware in mind, then later corrected for eventual emulators.

Algunar

Quote from: ifightdragons on March 31, 2023, 08:48:52 AMRaiden Triad is completely broken on original hardware or FPGA. It slows down ten times more after applying the FastROM patch.

Well, if you are playing Raiden Triad instead of Raiden Trad on any kind of SNES hardware, this indeed improves the risks of severe bugs due to the bad quality of this Chinese bootleg copy of the game... ;D

Quote from: ifightdragons on March 31, 2023, 08:48:52 AMI wish these were developed and checked with original hardware in mind, then later corrected for eventual emulators.

On a much more serious note here though...I would have the exact opposite opinion, as most of SNES games are most probably played via emulation than on any real hardware form today...

Yet in an ideal world, all games patches would be tested on both hardware and emulation forms but...much easier said than done though.

However, kandowontu's list clearly mentions which (very few) games are confirmed to correctly run on hardware with fastrom patches...and Raiden Trad, unfortunately, does not seem to be part of these, regarding the awful gaming experience you have described here... :-\

kandowontu

Sorry, just had to jump in. He was patching the correct game, and he did find me on discord.

It seems that sometimes having interrupts running in fastrom can have adverse effects. So many that I'm considering not doing those anymore.

Moving the interrupts out of fastrom fixed this issue, and is available on the original download post (v1.1).

I had graphical issues with Cacoma Knight for the same reason and had to move the interrupts out of fastrom.

Finally, I was able to compare Choplifter III side by side with the "fastrom fix" that I moved the interrupts over to fastrom in...and it didn't save a single frame after multiple minutes of gameplay.

This tells me that its not essential and pretty much isn't needed.

Feel free to DM me with issues, as I will still check my inbox and respond there.

Last but not least, my MiSTer unit is *almost* ready, so I'll have the compatibility list filled for that soon!

Boss

Thats great @kandowontu . Any idea why your FastROMs aren't drag n drop on SNES Classic like the others are? They seem to work without issue but yours (Actraiser for example) boots but no sound? Could it be the same issue?

kandowontu

Quote from: Boss on March 31, 2023, 12:51:28 PMThats great @kandowontu . Any idea why your FastROMs aren't drag n drop on SNES Classic like the others are? They seem to work without issue but yours (Actraiser for example) boots but no sound? Could it be the same issue?

Canoe issues can be weird. In a few months I should have one so I can test myself.

Boss

Quote from: kandowontu on March 31, 2023, 01:53:46 PMCanoe issues can be weird. In a few months I should have one so I can test myself.

Cool. Canoe is a bit odd but its very well documented now thanks to Sluffy and everyone. Even stuff like SA-1 hacks (Gradius III, Plumber For All Seasons for example) work which was a surprise.

Would be interested in hearing what you find if you ever decide to update RHDN once you get a Mini. I tried quite a few of yours and most didn't work so it may be something in your framework that is incompatible with Canoe. The others may do it a different way which is why theirs work?

ifightdragons

#166
Quote from: Algunar on March 31, 2023, 10:46:42 AMWell, if you are playing Raiden Triad instead of Raiden Trad on any kind of SNES hardware, this indeed improves the risks of severe bugs due to the bad quality of this Chinese bootleg copy of the game... ;D

On a much more serious note here though...I would have the exact opposite opinion, as most of SNES games are most probably played via emulation than on any real hardware form today...

Yet in an ideal world, all games patches would be tested on both hardware and emulation forms but...much easier said than done though.

However, kandowontu's list clearly mentions which (very few) games are confirmed to correctly run on hardware with fastrom patches...and Raiden Trad, unfortunately, does not seem to be part of these, regarding the awful gaming experience you have described here... :-\


Haha, Triad... Yeah, no wonder it's not working  :laugh:

I hear ya on the hardware vs. emulator issue, and you're right that emulators are more prevalent.

But, I still feel it's important to realize how prevalent FPGA is becoming, and that ensuring games can run as true to original specs as possible, also is important.

Not to mention: If you start by optimizing for real hardware, chances are it will work well on emulators. The other way around is a lot trickier.
That's why I think the logical step is prioritizing real hardware, because in 99% of cases, it ensures compatibility with everything.

On a side note:
Thanks for showing me the ropes on Discord, kando.

I was lost there for a minute!

kandowontu

Quote from: Boss on March 31, 2023, 02:17:53 PMCool. Canoe is a bit odd but its very well documented now thanks to Sluffy and everyone. Even stuff like SA-1 hacks (Gradius III, Plumber For All Seasons for example) work which was a surprise.

Would be interested in hearing what you find if you ever decide to update RHDN once you get a Mini. I tried quite a few of yours and most didn't work so it may be something in your framework that is incompatible with Canoe. The others may do it a different way which is why theirs work?

I have no framework...I convert all JSL/JML calls to their bank $80+ equivalent and set $420D to 1.

Boss

Quote from: kandowontu on March 31, 2023, 03:00:49 PMI have no framework...I convert all JSL/JML calls to their bank $80+ equivalent and set $420D to 1.

Just had a quick look at the source code by Vitor and he appears to do the same. Maybe consider checking this:

https://www.romhacking.net/hacks/6432/

As his Parodius FastROM works perfectly on Canoe but yours doesn't. Granted his is Japanese and yours is PAL so its not a 1:1 comparison.

kandowontu

Quote from: Boss on March 31, 2023, 03:12:20 PMJust had a quick look at the source code by Vitor and he appears to do the same. Maybe consider checking this:

https://www.romhacking.net/hacks/6432/

As his Parodius FastROM works perfectly on Canoe but yours doesn't. Granted his is Japanese and yours is PAL so its not a 1:1 comparison.

Whats funny is I just had to fix this one to work on hardware because it did not work on console or MiSTer (literally just released a few minutes ago). I'll always take hardware over canoe personally.

Boss

Quote from: kandowontu on March 31, 2023, 03:31:39 PMWhats funny is I just had to fix this one to work on hardware because it did not work on console or MiSTer (literally just released a few minutes ago). I'll always take hardware over canoe personally.

I said in the Mario RPG thread that a modder shouldn't try and please everyone, only themselves.

Personally I prefer the Mini because a) its convenient b) HDMI c) cheap d) the filters look very close to how I remember it and e) no messing around with endless configuration. Some people are all about real hardware and all of that and thats good for them, not my choice though.

Thought I'd mention it because it was odd that so few of your patches work on a Mini where others do. Thats why I thought it might be a framework issue or something thats an easy fix that Canoe doesn't like/out of bounds. Actraiser for example loads but no music which seemed odd. Lots of others didn't even load.

One thing you can be sure of is if it loads on Canoe it will work on real hardware and other emulators because of how finicky it is. That and ther are already loads of patches/insight on here about it.

kandowontu

Quote from: Boss on March 31, 2023, 03:44:33 PMOne thing you can be sure of is if it loads on Canoe it will work on real hardware and other emulators because of how finicky it is.

I guess you didn't read what I wrote. The fastrom patch by MaxwelOlinda1 that you linked to before that works on canoe does NOT work on real hardware.

I also do not have a snes mini, as I said. So "converting games for me" doesn't entice me to spend hours to figure out why something isn't working for a device that I cannot test on.

Thanks for the advice, but I got this, and I will improve compatibility as I can.

Finally, please DM me for further communication. Thank you!

Boss

#172
(insert happy post that pleases everybody)

AxelStone

Quote from: Boss on March 31, 2023, 03:12:20 PMAs his Parodius FastROM works perfectly on Canoe but yours doesn't. Granted his is Japanese and yours is PAL so its not a 1:1 comparison.

Kanodowontu's patch for the PAL rom works for me in Canoe, in conjunction with the NTSC patch at least, didn't try otherwise.

slidelljohn

@kandowontu
I looked at the Raiden Trad - Fastrom patch and I think you should make a few modifications to it since there is still some slowrom that is being used during nmi.

I would change this:
$00/80FD 5C B8 FF 80 JMP $80FFB8[$80:FFB8]   
$80/FFB8 C2 38       REP #$38               
$80/FFBA C2 30       REP #$30               
$80/FFBC 5C 01 81 80 JMP $808101[$80:8101]   

Back to this:
$80/80FD C2 38       REP #$38               
$80/80FF C2 30       REP #$30                //This isnt doing anything. This is a sign that
                                             //optimizations can be made throughout the rom.

And I would change your vectors from this:
86 8D 86 8D 86 8D 86 8D 86 8D 49 83 00 80 87 8D
86 8D 86 8D 86 8D 86 8D 86 8D 49 83 00 80 87 8D

To this:
B0 FF B0 FF B0 FF B0 FF B0 FF B4 FF BC FF B8 FF
B0 FF B0 FF B0 FF B0 FF B0 FF B4 FF BC FF B8 FF

This would be the new jumps for the vectors:
5C 86 8D 80 5C 49 83 80 5C 87 8D 80 5C 00 80 80

I'm not sure if empty space is actually at 00:ffb0-00:ffbf but that is where I also put the jumps for the vectors. If that isn't empty space then extra space can be made from optimizing the reset function (00:8000) by using direct page to update the registers:

direct page
$80/xxxx 85 00       STA $00         [$00:2100] A:0080 X:2100 Y:0000 D:2100

without direct page
$80/8003 8D 00 21    STA $2100  [$00:2100]   A:0080 X:0000 Y:0000 D:0000

kandowontu

#175
Quote from: slidelljohn on April 02, 2023, 05:28:15 PM@kandowontu
I looked at the Raiden Trad - Fastrom patch and I think you should make a few modifications to it since there is still some slowrom that is being used during nmi.

I would change this:
$00/80FD 5C B8 FF 80 JMP $80FFB8[$80:FFB8]   
$80/FFB8 C2 38       REP #$38               
$80/FFBA C2 30       REP #$30               
$80/FFBC 5C 01 81 80 JMP $808101[$80:8101]   

Back to this:
$80/80FD C2 38       REP #$38               
$80/80FF C2 30       REP #$30                //This isnt doing anything. This is a sign that
                                             //optimizations can be made throughout the rom.

And I would change your vectors from this:
86 8D 86 8D 86 8D 86 8D 86 8D 49 83 00 80 87 8D
86 8D 86 8D 86 8D 86 8D 86 8D 49 83 00 80 87 8D

To this:
B0 FF B0 FF B0 FF B0 FF B0 FF B4 FF BC FF B8 FF
B0 FF B0 FF B0 FF B0 FF B0 FF B4 FF BC FF B8 FF

This would be the new jumps for the vectors:
5C 86 8D 80 5C 49 83 80 5C 87 8D 80 5C 00 80 80

I'm not sure if empty space is actually at 00:ffb0-00:ffbf but that is where I also put the jumps for the vectors. If that isn't empty space then extra space can be made from optimizing the reset function (00:8000) by using direct page to update the registers:

direct page
$80/xxxx 85 00       STA $00         [$00:2100] A:0080 X:2100 Y:0000 D:2100

without direct page
$80/8003 8D 00 21    STA $2100  [$00:2100]   A:0080 X:0000 Y:0000 D:0000

Interrupt vectors always run in slowrom. There is no way around this. The only option is to jump to the fastrom mirror of the interrupt as the first instruction of the interrupt.

This DOES break compatibility with some games and hardware though, and had to revert this change for some.

slidelljohn

Setting the first instruction of the vector to a fastrom jump breaks compatibility? I didn't know that. Do you have a example that I can test?

kandowontu

Quote from: slidelljohn on April 03, 2023, 09:36:43 AMSetting the first instruction of the vector to a fastrom jump breaks compatibility? I didn't know that. Do you have a example that I can test?

(sorry I misread, only the last part really applies to this)

Vectors are only WORD values, they have no bank value (Example: DW $808017 would only read $8017).

And by definition, interrupts ALWAYS jump to slowrom...and to be more specific, they jump to bank 0. This is one of the first issues I ran into (on my second conversion, Sim City) where the COP interrupt was always sending me back to slowrom. I was about to give up, when the SNES Development discord guys told me that interrupts always run in slowrom, just JML to the fastrom equivelant. You'll see this done in many fastrom games from the factory, that the only code running in fastrom is a JML to the fastrom mirror of the interrupt location.

But there is literally no way for an interrupt to jump directly to fastrom without a JML to it.

An example of a game breaking hardware compatibility would be Exhaust Heat.

Come find me on discord and I can provide some examples!

slidelljohn

Sorry for the confusion my friend.  :)
I know the vectors only start in slowrom (bank $00) and that is why I posted those codes for your fastrom patch. None of your vectors were jumping to fastrom for their first instruction. What I posted sets all of the vectors first instruction to fastrom jumps.

I read something saying that game was having issues on original hardware with your fastrom patch but it looks like you fixed it. That was the only reason I started looking at your code for this game. I was going to see if I could help get it to work on original hardware.

"Come find me on discord and I can provide some examples!"

I might eventually use the discord but for now I'll mainly be in these forums. I do have my twitter but I rarely use it. Would you mind posting some examples here for me to look at?

kandowontu

Quote from: slidelljohn on April 03, 2023, 10:49:31 AMSorry for the confusion my friend.  :)
I know the vectors only start in slowrom (bank $00) and that is why I posted those codes for your fastrom patch. None of your vectors were jumping to fastrom for their first instruction. What I posted sets all of the vectors first instruction to fastrom jumps.

I read something saying that game was having issues on original hardware with your fastrom patch but it looks like you fixed it. That was the only reason I started looking at your code for this game. I was going to see if I could help get it to work on original hardware.

"Come find me on discord and I can provide some examples!"

I might eventually use the discord but for now I'll mainly be in these forums. I do have my twitter but I rarely use it. Would you mind posting some examples here for me to look at?

$00/80FD 5C B8 FF 80 JMP $80FFB8[$80:FFB8]   <--- thats the first instruction, sorry if I'm confused xD

It jumps to dummy area towards the end of the bank, does the REP code that was originally being executed there and then jumps back to the rest of the routine to the address right after the 2 REPs.

As far as examples, here's one...here's the broken one that works on emulators but not mister (interrupt vectors point to a JML to the interrupt routine):

https://www.sendspace.com/file/gzf13i

Here's it with it fixed (interrupt routines are untouched, leading to slowrom access in them):

https://www.sendspace.com/file/m8po4t

However, it does seem in the end all be all, having interrupts in slowrom isn't so bad. I "fixed" choplifter III by moving the interrupts to fastrom and doing a side by side comparison, there was not a single frame saved.

So its annoying for breakpointing in a debugger, but it doesn't seem like it will affect gameplay.