ROM Hack How do I Patch AND trim a NDS rom?

Auryn

Well-Known Member
Member
Joined
Jul 21, 2011
Messages
559
Trophies
1
Age
52
XP
717
Country
Swaziland
3161447_m.jpg



OR
if you have to ask how to patch the rom, you don't have the rights to play it.
 

basher11

Well-Known Member
Member
Joined
Jun 29, 2009
Messages
4,385
Trophies
1
XP
581
Country
United States
usually patches trim the rom for you.
but as ivobhz said, trim after patching if it doesn't trim for you.
 

Hebon

Dabbling in the videogamagical
OP
Member
Joined
Mar 10, 2011
Messages
146
Trophies
0
XP
192
Country
United States
The problem with trimming after I patch is that the trimmer seems to think that the size of the patch itself is how big the rom can be trimmed down to. For example; if I have a 64MB game and it can normally be trimmed down to 52, but I had applied a 1MB patch, the trimmer says it can be trimmed down to 1MB.
 

shadowmanwkp

Your roms are on another rom site
Member
Joined
Apr 17, 2008
Messages
486
Trophies
1
Age
33
Location
Vleuten, The Netherlands
XP
266
Country
Netherlands
If you patch a game, usually the patch maker has used junk bytes in the rom to make the patch. Because trimming removes those junk bytes, applying a patch afterwards will always fail, unless the patch maker has taken this into account. By modifying the rom, the header and other data will also be altered, thus if you trim afterwards, the trimming utility doesn't recognize the rom properly and it will result in a broken rom. Patch makers will usually trim the rom to the right size after making a patch, so you don't need to. If you really want to be certain that the game is trimmed, even though you've patched, you can open the rom up in a hex editor and remove all 00 or FF bytes at the end (do this at own risk though)
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,795
Trophies
5
XP
28,569
Country
United Kingdom
That might be true on the GBA shadowmanwkp and I can not speak for pokemon (of which most of the hacking work is done with premade tools) and some of the tool driven hacks (thinking the likes of the mario level editors) but most full blown hack projects will either inject files back into the rom in place (quite OK to trim), properly repoint the modded files (should still be OK), rebuild the rom (most rebuild tools tend not to add the stuff that is trimmed back in) and generate a patch for it or rebuild the rom as part of the patching process (again will likely not have anything worth trimming).

On the flip side some patching methods will add in any extra space if they need but it can also trouble some patching methods (no real idea why but it does) so theoretically you could come at it the other way and trim then patch. At all times you should be prepared to force the patching method to ignore and initial file difference (xdelta and bsdiff are pretty keen on this).
 

Hebon

Dabbling in the videogamagical
OP
Member
Joined
Mar 10, 2011
Messages
146
Trophies
0
XP
192
Country
United States
If certain patchers also trim, does the xdelta patcher fall into that category?
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,795
Trophies
5
XP
28,569
Country
United Kingdom
Most hackers will find the files they want to edit, edit them accordingly and repack the rom before generating a patch to turn the original rom into the repacked rom (occasionally you get roms that do not like this and hacks that are just a few bytes being changed rather than added so the rebuilding part might change a bit but that does not really concern you as the end user unless you have a bad flash cart). This repacking stage is what does the trimming side of things if any is to be done.

xdelta and bsdiff are the two main methods to build patches for end user distribution with and they come from the general file patching world and as such they know nothing of DS roms (certain hacks like the Jump Ultimate Stars translation can work with the DS file system but again we are drifting back into actual hacking related issues)- they replace bytes that have changed and if you have shifted a part of the file around (as rom rebuilding tools are wont to do) they will try to match it up with the new location as well (one of the reasons we no longer use IPS for rom patching is that it can not do this) as well as remove anything from the file if it is not there any more. Naturally all this requires fairly extensive computing ability (somewhat analogous to compression) which is one of the reasons for having so many formats and why patches can end up quite large (they might fail to see a swap/shift and assume it is just a change and pack in the "change" accordingly) but this is getting off topic once more. The check thing stems from the general patching world so as to prevent people from applying the patch to the wrong backup or version of the file (rather than back everything up all the time most of these sorts of things were built to allow just the changes to be stored).
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Veho @ Veho:
    Your account can drink and smoke and do porn.
  • Sicklyboy @ Sicklyboy:
    Not in the bastion of freedom known as the US of A it can't :P
  • Sicklyboy @ Sicklyboy:
    Well it could do porn, but it can't drink or have a smoke after
  • Veho @ Veho:
    Bummer.
  • Veho @ Veho:
    (Barely even know 'er)
    +1
  • Sicklyboy @ Sicklyboy:
    Freedom :D
  • realtimesave @ realtimesave:
    @Sicklyboy I happened to have ubisoft app already installed, so I just logged in and got the game and played with @Skv0ra
  • Veho @ Veho:
    But it could drink and smoke in the homeland of Ubisoft, that counts.
  • Sicklyboy @ Sicklyboy:
    @realtimesave, uuugggghhhhhhh sounds like multiplayer doesn't work on Linux
  • Sicklyboy @ Sicklyboy:
    Because of the anticheat
  • Plazorn @ Plazorn:
    That's been a constant issue on linux
  • Sicklyboy @ Sicklyboy:
    Yep :/
  • Veho @ Veho:
    They know Linux users are filthy cheaters.
    +2
  • Sicklyboy @ Sicklyboy:
    Shouldn't be, because these anti cheat suites pretty much all natively support linux if I'm not mistaken, and it's down to a literal checkbox that they're not ticking.
  • Plazorn @ Plazorn:
    Would you really install a kernel level anticheat program if it existed though? I sure wouldn't.
  • Sicklyboy @ Sicklyboy:
    And yet, here we are
  • Plazorn @ Plazorn:
    It's a dilemma
    +1
  • realtimesave @ realtimesave:
    @Sicklyboy oh yea that anti cheat stuff doesn't like certain things :|
  • ZucchiniMaiden @ ZucchiniMaiden:
    I was sick for a week, thought I had kicked it and then it came back a few days later and I feel worse. What the hell.
  • Skelletonike @ Skelletonike:
    covid?
  • ZucchiniMaiden @ ZucchiniMaiden:
    I'm not sure, I don't think I've ever had covid. The symptoms don't seem to line up that well.
  • ZucchiniMaiden @ ZucchiniMaiden:
    I'm also dealing with toothache from a cavity so that sucks.
  • DinohScene @ DinohScene:
    use pliers
    +1
  • linuxares @ linuxares:
    pliers? why are you so mean... Tongue-and-groove pliers are obviously what you should use. Even got the name tongue
    SylverReZ @ SylverReZ: https://www.youtube.com/watch?v=7oXx0qwe0wc