News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Developed new IPS patcher, want to test it  (Read 3507 times)

ZPedro

  • Jr. Member
  • **
  • Posts: 22
    • View Profile
Developed new IPS patcher, want to test it
« on: October 26, 2015, 04:42:31 pm »
I have come here because I developed a new IPS patcher*, and before I release it, even as a beta, I first want to test it with difficult cases. So, do you people know of patches in IPS format (hosted here or elsewhere) that feature one or more of the following:
- the result is longer than the original, with the patch not specifying all extra bytes because it assumes that not specified bytes will be filled with 0x00
- the patch has sections that are out of sequence
- the patch has sections that overlap
- the patch has a section that starts at pointer 0x454F46 in the result
- the patch is otherwise known as difficult and not working in all patchers.

Thanks in advance for the help!

(my program only applies patches, I don't need to test patch generation)

*What, yet another patcher? Yes, but that one will be different; I'm not telling how just yet.

October 26, 2015, 04:48:22 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
For what it's worth, I already tested it with Zelda Starring Zelda (which contains a RLE section) and a few patches here that lengthen the original ROM, and I could play the result in both cases without apparent issue.
« Last Edit: October 26, 2015, 04:48:22 pm by ZPedro »
Tired of IPS patching with a desktop app? Try JPS!

snarfblam

  • Submission Reviewer
  • Hero Member
  • *****
  • Posts: 589
  • CANT HACK METROID
    • View Profile
    • snarfblam
Re: Developed new IPS patcher, want to test it
« Reply #1 on: October 26, 2015, 05:38:35 pm »
Why not download a whole bunch of patches, apply them with your patcher and with another patcher in a batch operation and compare the results for discrepancies? Of course that doesn't exclude additional tests for specific modes of failure, but would go a long way in demonstrating that the tool works well in practice.

ZPedro

  • Jr. Member
  • **
  • Posts: 22
    • View Profile
Re: Developed new IPS patcher, want to test it
« Reply #2 on: October 26, 2015, 05:49:53 pm »
@snarfblam : That is something I will consider (my patcher not being command-line, I will have to look at UI automation tools), but I would also like to make sure I am not reproducing the bugs from whichever patcher I would be comparing with.
Tired of IPS patching with a desktop app? Try JPS!

Nightcrawler

  • Hero Member
  • *****
  • Posts: 5757
    • View Profile
    • Nightcrawler's Translation Corporation
Re: Developed new IPS patcher, want to test it
« Reply #3 on: October 26, 2015, 06:31:19 pm »
I don't think that will be an issue if you use Lunar IPS. There are no bugs that I'm aware of after many years of use. I've used it to test my own patching code before, and I've also used it to patch probably 100 games at least. IPS is a pretty simple format. There isn't really much to test.

I would suggest designing a patcher for a format that isn't grossly outdated though. I think it would garner more attention, fanfare, and usefulness to the community.
TransCorp - Over 20 years of community dedication.
Dual Orb 2, Wozz, Emerald Dragon, Tenshi No Uta, Glory of Heracles IV SFC/SNES Translations

FAST6191

  • Hero Member
  • *****
  • Posts: 2595
    • View Profile
Re: Developed new IPS patcher, want to test it
« Reply #4 on: October 26, 2015, 07:23:20 pm »
I do not have any example ones you can test. A common one though was a patch missing the EOF marker at the end of the file, possibly also doing 16 megs of changes and thus being unable to have en EOF at the end.

I do not know if there were any commonly accepted methods used for greater than 16 megabyte files (various patchers did support offset commands).

Other than that what the others have said about troublesome patches and questioning the need, if it this something to learn programming/patch making then carry on. Otherwise IPS is mainly a legacy thing that stuck around far longer than it needed to, however the legacy is long and it is well entrenched in a lot of embedded hardware, a bit like interlacing in video I guess.

ZPedro

  • Jr. Member
  • **
  • Posts: 22
    • View Profile
Re: Developed new IPS patcher, want to test it
« Reply #5 on: October 26, 2015, 07:33:38 pm »
@Nightcrawler : Thanks, will try and compare with Lunar IPS. IPS is only the proof of concept format for my patcher, though I do intend to get it right nevertheless if only because of the large number of existing patches in IPS format; vcdiff/xdelta will probably be the next supported format, as it actually has traction outside the ROM hacking community.

@FAST6191 : Oh, it is definitely about learning and making proof of concepts of a few different things at once AND making patching more convenient. And yes, I am appalled that IPS patches are still being generated in this day and age, given the limitations and ambiguities of the format (which is why I will never support generating them, while I intend to make a "dumb" vcdiff generator once I am done with the vcdiff patch application code)
« Last Edit: October 26, 2015, 07:39:32 pm by ZPedro »
Tired of IPS patching with a desktop app? Try JPS!

Disch

  • Hero Member
  • *****
  • Posts: 2730
  • NES Junkie
    • View Profile
Re: Developed new IPS patcher, want to test it
« Reply #6 on: October 27, 2015, 04:19:43 pm »
Sounds like you could stand to do some automated testing.

- make a dummy source file
- make a bunch of patches, each exercising a specific area of the patch format
- make "golden files" which are what the source file should look like after each of those patches is applied.

Then...
- Write a program to iterate over each of those patches, applying each to the source file.  Compare the created file against the golden file to make sure it matches.  If it doesn't, your patcher is bugged, and you can use the failed patch as an example of how to reproduce the bug.
- Iterate over the golden files... and generate a patch for each of them using the dummy source file.  Compare the generated patch to the patches you already have and make sure they match.  If they don't, your patch generator is bugged and you can use the golden file as an example of how to reproduce.

tvtoon

  • Sr. Member
  • ****
  • Posts: 360
    • View Profile
Re: Developed new IPS patcher, want to test it
« Reply #7 on: November 01, 2015, 08:28:38 pm »
The only thing I think that I can help is "the patch has sections that are out of sequence": build a simple IPS, two mods with two different addresses, the first after the second one, 20 bytes, test it on a blank file, simple stuff...

As it has been told, better to develop new stuff than to follow standards like IPS. Also there are lots of "extra" things I would like to add to my project, like patches fixer.

ZPedro

  • Jr. Member
  • **
  • Posts: 22
    • View Profile
Re: Developed new IPS patcher, want to test it
« Reply #8 on: November 02, 2015, 04:55:52 pm »
Thanks for your suggestions; I ended up defining my test base with about 100 patches downloaded from the ROM hacks section (taken at random in a few different games), and manually crafted the test cases I described in my OP, and for both compared the behavior between Lunar IPS and mine: I consider whatever Lunar IPS does to be the standard, even and especially for these difficult cases.

The tests went well, even if there are a few issues I feel it is ready for a beta.
Tired of IPS patching with a desktop app? Try JPS!

obscurumlux01

  • Full Member
  • ***
  • Posts: 168
    • View Profile
Re: Developed new IPS patcher, want to test it
« Reply #9 on: November 02, 2015, 06:24:18 pm »
Lunar IPS may be the 'standard' but the gold star award goes to Floating IPS when it comes to patching.  It supports both IPS and BPS formats; the latter is the superior 'beat' patching format that byuu created and released under GPL that supercedes the need for all other patching formats.

Based on my personal use of BPS versus other stuff like PPF and so on, BPS is significantly easier to use and has better error correction and detection than most other formats.  It also produces smaller patches and works well to minimize/eliminate any original-rom content from the patch itself when stuff is moved around for translations and certain hacks.

I'm curious what your IPS patcher will do better than FloatingIPS.  ;)

Fellowzdoomer

  • Jr. Member
  • **
  • Posts: 21
    • View Profile
Re: Developed new IPS patcher, want to test it
« Reply #10 on: November 03, 2015, 05:10:26 pm »
This is gonna sound dumb, but for a READABLE output, start a blank text file and put some text, I dunno, asdfghjkl works :-D

Then, make another text file with the same length as "asdfghjkl", like " qwertyuio". Make an ips patch of one text and apply it tto the other and see the results. Not entirely the best idea but its readable. :-)

Disch

  • Hero Member
  • *****
  • Posts: 2730
  • NES Junkie
    • View Profile
Re: Developed new IPS patcher, want to test it
« Reply #11 on: November 03, 2015, 05:51:34 pm »
I have to reiterate my previous statement.

automate your testing

You developed your program, so you should know where the "iffy" spots of it are, where edge cases are most likely to screw up.  Manually create very small and specific patches which exercise these areas, and run them through an automated test suite which applies the patch, compares it to the desired result, and reports failures if they don't match.

1 patch = tests 1 very small and specific thing.  Maybe you'd want to have a small handful of "complex" patches, but you should focus on the small patches first.


Using exiting ROM hacks for test cases will work, but will not make it obvious as to which part of your program is broken when the patch fails.  If you have a patch that does only 1 thing, and that patch fails, then you have a pretty good idea where the bug in your program is.

ZPedro

  • Jr. Member
  • **
  • Posts: 22
    • View Profile
Re: Developed new IPS patcher, want to test it
« Reply #12 on: November 16, 2015, 09:22:49 pm »
Thanks everyone, The patcher has now been unveiled at http://www.romhacking.net/forum/index.php/topic,20730.0.html and is in open beta. For the anecdote, I did indeed automate testing (at least for the unit test cases), mostly because I needed to rework part of the engine code (and that itself was needed in order to avoid crashing Firefox when manipulating particularly complex patches found in the wild), and automated testing allowed me the assurance that there would be no regression when doing so.
Tired of IPS patching with a desktop app? Try JPS!