Romhacking.net

Romhacking => Personal Projects => Topic started by: Dom on August 27, 2021, 12:26:47 pm

Title: Advanced SNES ROM Utility
Post by: Dom on August 27, 2021, 12:26:47 pm
This thread can be used to discuss, ask questions, report bugs and make suggestions for improvement for the Advanced SNES ROM Utility :)

(https://www.romhacking.net/utilities/screenshots/1638screenshot1.png)

Relevant Link (https://www.romhacking.net/utilities/1638/)

Release date: 2021-08-25
Last modified: 2021-10-08
Current version: 0.9.6

History:
- v0.9.6 [2021-10-08] added BDF and XDELTA patching functionality. Handle LoROM SlowROM the same way as FastROM when expanding to 48 or 64 Mbit and more for improving compatibility (experimental). Note: If you have *.bdiff patch files, please rename them to *.bdf and also rename *.vcdiff to *.xdelta.
- v0.9.5 [2021-10-01] added BPS patching functionality. Support for expanding up to 64 MBit incl. mirroring (not well tested, so call it experimental). Support for expanding BS-X ROMs up to 32 MBit and fixing internal ROM size. Fixed refreshing bug of drop down boxes for selecting country and file sizes for expanding/splitting when a patch affects file size or country code.
- v0.9.1 [2021-09-12] added UPS patching functionality. Supports reversing patches, expanding and truncating to destination file size. Fixed CRC32 calculation for headered ROMs. Cleaned up design.
- v0.9    [2021-08-30] added IPS patching functionality. Supports patches with RLE hunks, expanding and truncating.
- v0.8.3 [2021-08-28] fixed detection of some GSU-2 ROMs, so detection now should work fine for all ROMs. When "Save As" was used, context is now on new file.
- v0.8.2 [2021-08-27] fixed application crash and wrong checksum calculation when loading few ROMs
- v0.8.1 [2021-08-25] intial release

To Do:
- Maybe: some improvements in expanding to 48/64 MBit (if neccessary)

Have fun  ;)
Title: Re: Advanced SNES ROM Utility
Post by: Ice Man on August 27, 2021, 01:40:38 pm
Nice to see you're still working on it. :D
Title: Re: Advanced SNES ROM Utility
Post by: Dom on August 27, 2021, 02:11:09 pm
Greetings  :happy:
Sure, after a quiet long time of silence, I decided to clean things up a little and make a redesign of code ::)
But I just found out there're still some minor corrections needed till it works flawless like the old one.
Had a problem detecting some GSU-2 ROMs. I guess I messed up the sequnce things get loaded.
So after fortune smiles at v0.8.2 there will soon be a v0.8.3  :laugh:

August 28, 2021, 05:48:56 am - (Auto Merged - Double Posts are not allowed before 7 days.)
Update submitted!  8)

Please let me know if you like the new "Save As" behaviour or if you prefer staying in context with the originally opened file.

August 30, 2021, 12:31:41 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
Submitted new version 0.9 with IPS patching  8)
Title: Re: Advanced SNES ROM Utility
Post by: the_E_y_Es on September 07, 2021, 06:55:52 pm
Hi there. Can I use this to redefine the RAM range of a given rom? In the past I used LunarExpand to increase rom filesize, but when loading the expanded rom in the debugger, I found that none of that extra space was actually there in the RAM. I've been told it is necessary to change the rom's manifest, or something. Do you think that could be added as a feature to this utility?
Title: Re: Advanced SNES ROM Utility
Post by: Dom on September 08, 2021, 01:52:42 pm
Hi!

Well, I'm not quite sure about that, but I guess the ROM header only stores information about the (S)RAM size.
Afaik there're also no banks for mirroring data. ROM is ROM and (S)RAM is (S)RAM, that's it!
There're even some games like Star Fox, without any information about (S)RAM, so this value doesn't seem to really matter.

You can change it in the header, but there're some special cases you can't (Star Fox), so it's better not to do that.
Easiest way, if you want to change it anyway, is to take a Hex Editor and change it manually.

SRAM: In LoROM go to offset 0x7FD8 in HiROM go to 0xFFD8
RAM: Only if new header was used (when HiROM 0x7FDA / LoROM 0xFFDA is 0x33) go to offset 0x7FBD in LoROM or 0xFFBD in HiROM

and change as followed:

0x00 = No RAM
0x01 = 16Kbit (2KB)
0x02 = 32Kbit (4KB)
0x03 = 64Kbit (8KB)
0x04 = 128Kbit (16KB)
0x05 = 256Kbit (32KB)
0x06 = 512Kbit (64KB)

Anyway, expanding is for fitting your ROM virtually to the physical size of an (E)EPROM/FlashROM for burning, if you want to make a repro cart or add some extra data if you're running out of free space within your ROM hacking project. This has nothing to do with (S)RAM  ;)
Title: Re: Advanced SNES ROM Utility
Post by: the_E_y_Es on September 11, 2021, 07:07:58 am
So expanding is only for the purposes of retro cartridges?

What if I want to add extra data/code to a ROM, but there is not enough free space? What should I do, then?
Title: Re: Advanced SNES ROM Utility
Post by: Dom on September 11, 2021, 11:08:33 am
At least, it has nothing to do with (S)RAM expanding  ;D
Sure, if you want to add some extra data for your ROM hacking project, expanding is also useful for handling this, of course  :happy:
Just expand your ROM and do some pointer things  ;)

Edit: I updated my last post to clarify this matter.
Title: Re: Advanced SNES ROM Utility
Post by: the_E_y_Es on September 11, 2021, 05:47:07 pm
I see. Thanks for the explanation.  :)
Title: Re: Advanced SNES ROM Utility
Post by: PowerPanda on September 15, 2021, 09:03:39 pm
It would be lovely if this could apply a patch +/- 200 bytes, in case you want to apply a headered patch to a non-headered rom, or vice versa.

And if we're wishing for the moon, the ability to repair checksums and change a rom's internal name would mean that I could retire a couple of other finnicky programs.

Thanks for seeking out feedback.
Title: Re: Advanced SNES ROM Utility
Post by: Dom on September 16, 2021, 10:09:32 am
First of all, thanks for leaving some feedback  :thumbsup:

Regarding to your question about adding/removing header in patches:
That's what you already can do by clicking on the button "Add Header" or "Remove Header" before applying a patch  ;)
Just read the description of the patch and stick to it. I don't think it's a patchers' job to manipulate a patches' offsets.
It also heavily depends on the format of the patch. IPS isn't even capable to verify the ROM it's applied to  :cookie:
UPS however can, but it just can tell if the ROM is the right one or not, that's it...

"...the ability to repair checksums and change a rom's internal name would mean that I could retire a couple of other finnicky programs."
Just do it  :beer:
You can even change names written in Kanji letters. I also spent a lot of time doing research for fixing checksums, so it should even be able to fix the problematic ones  ;)
Title: Re: Advanced SNES ROM Utility
Post by: mziab on September 20, 2021, 03:46:17 am
It would be lovely if this could apply a patch +/- 200 bytes, in case you want to apply a headered patch to a non-headered rom, or vice versa.

A bit off-topic, but if you're okay with using something web-based, Rom Patcher JS (https://www.romhacking.net/patch/) has this exact feature. It can add a temporary header or chop it off before applying the patch. As a bonus, it handles compressed files, too.
Title: Re: Advanced SNES ROM Utility
Post by: Dom on September 20, 2021, 06:04:01 am
I don't really get the benefit of your suggested web based tool  :huh:
It's still in the user's responsibilty to add or remove a header before applying a patch.
I guess @PowerPanda was looking for something like an automatic detection and correction.
Title: Re: Advanced SNES ROM Utility
Post by: mziab on September 20, 2021, 06:49:58 am
I don't really get the benefit of your suggested web based tool  :huh:
It's still in the user's responsibilty to add or remove a header before applying a patch.
I guess @PowerPanda was looking for something like an automatic detection and correction.

Well, for one thing, it detects whether a header is present (if it's a SNES rom) and presents the user with an appropriate checkbox to add/remove it, which takes away at least some opportunities for the less savvy to shoot themselves in the foot. Plus, doing it in one go while patching instead of a separate step seems like better usability to me.

PowerPanda didn't mention anything about it being automatic. That would be cool, but reliably detecting whether the actual patch needs a headered rom or not is another story, as I'm sure you're aware. Having a checkbox to add/remove the header and having the user fiddle with it at their own discretion until the patch works for them is probably the next best thing.
Title: Re: Advanced SNES ROM Utility
Post by: Dom on September 20, 2021, 07:47:32 am
Well, for one thing, it detects whether a header is present (if it's a SNES rom) and presents the user with an appropriate checkbox to add/remove it, which takes away at least some opportunities for the less savvy to shoot themselves in the foot. Plus, doing it in one go while patching instead of a separate step seems like better usability to me.

That's exactly what this tool also does...
Just give it a try  ;)

Load ROM, click remove or add header, than apply a patch, very easy.
Should be even the same amount of clicks needed  :happy:

That would be cool, but reliably detecting whether the actual patch needs a headered rom or not is another story, as I'm sure you're aware.

I totally agree in this point! Would be super cool, but at least for IPS, is impossible to do.
Maybe patching formats like UPS/BPS, containing input/output file validation, might be used for handling this, but that's another story (as you've already told :D )

Cheers  :beer:
Title: Re: Advanced SNES ROM Utility
Post by: mziab on September 20, 2021, 08:24:25 am
I admit I haven't actually tried your utility, since I'm on Linux. Glad to see we're on the same page after all. The wording of the original feature request made it seem like this wasn't supported.
Title: Re: Advanced SNES ROM Utility
Post by: Dom on October 02, 2021, 11:09:03 am
Update!

See information in first post :)
Title: Re: Advanced SNES ROM Utility
Post by: MysticLord on October 02, 2021, 04:44:47 pm
What other patch formats exist for the SNES?
Title: Re: Advanced SNES ROM Utility
Post by: Brutapode89 on October 02, 2021, 05:56:56 pm
Must I use Advanced SNES ROM Utility to make more text in french in SNES RPG like Final Fantasy?
Title: Re: Advanced SNES ROM Utility
Post by: Dom on October 03, 2021, 09:09:44 am
What other patch formats exist for the SNES?

I don't know exactly, but I guess IPS, UPS and BPS are the most common ones used for SNES.

Must I use Advanced SNES ROM Utility to make more text in french in SNES RPG like Final Fantasy?

Feel free to use it for expanding, if you run out of space :)
Title: Re: Advanced SNES ROM Utility
Post by: Brutapode89 on October 04, 2021, 06:38:48 pm
O.K., Dom. Will not be there glitches if the ROM Final Fantasy IV - Easy Type (J) is into 8,00 Mo?
Title: Re: Advanced SNES ROM Utility
Post by: MysticLord on October 04, 2021, 08:42:08 pm
I know I've seen *.xdelta patches for snes games, and I vaguely remember something called a *.bdiff (binary diff?), but I could be mistaken. Do we have tools to apply those patch formats? If we don't, is implementing them prohibitively complex (and of course do you want to make the effort)?
Title: Re: Advanced SNES ROM Utility
Post by: Dom on October 05, 2021, 10:53:37 am
O.K., Dom. Will not be there glitches if the ROM Final Fantasy IV - Easy Type (J) is into 8,00 Mo?
Especially expanding LoROM + SlowROM with an origin size of more than 16 Mbit to ExLoROM (48 Mbit or more) is causing some troubles at the moment. Final Fantasy IV - Easy Type (J) is only 8 Mbit, so there might be a good chance for it to work without any glitches. Just try it out and do some testing. Would be nice, if you could share your results. I tried and the only method working is expanding with mirroring. Do you really need more than 32 Mbit for your translation? If so, I would take a closer look at it this weekend  8)

I know I've seen *.xdelta patches for snes games, and I vaguely remember something called a *.bdiff (binary diff?), but I could be mistaken. Do we have tools to apply those patch formats? If we don't, is implementing them prohibitively complex (and of course do you want to make the effort)?
You're right! I also remember these kind of patches, but I guess they're very rare.

In my tool set, I found a tool called Delta Patcher by SadNES cITy Translations for *.xdelta.
But it seems I've never ran into *.bdiff, though there's a tool called BsPatch.

I managed to get *.bdiff working, but it doesn't seem to have any validation like BPS or UPS. So you easily can mess up your ROM, if you apply the same patch for a second, third or whatever time.

Xdelta is also known as VCDIFF and is a little more complex. But there seems to be a good chance for it, since this is available over NuGet package store  :)

October 08, 2021, 01:49:25 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
New version submitted!

XDELTA and BDF patches are supported now.

@Brutapode89: You now can try to expand your ROM, should work  ;)