Hacking patchimage (riivolution patcher for GNU/Linux)

Excelsiior

Well-Known Member
OP
Member
Joined
Sep 13, 2009
Messages
274
Trophies
0
Website
www.nanolx.org
XP
328
Country
Germany
Based on DMMs and Wiimms excellent work, I've created a flexible
patchscript for GNU/Linux. Additionally to riivolution patches, this
one will also allow patching ROMs using ips/ppf patches. And more...

patchimage allows choosing a custom GAMEID, aswell as downloading
riivolution-files, patches and soundtrack (if available).

NOTE: don't fiddle around with sub-folders in riivolution-files, the
script uses files as "unzip" creates them. No need to modify whatever.

... Well, you need the original game to do this legally, if you don't
own the original, you can't blame me. patchimage is 100% legal, as it
does not contain any propritary contents, nor is able to grab them.

Supported Games:
### New Super Mario Bros. Wii ###

SLF?01 NSMBW3: The Final Levels
SMN?01 Original New Super Mario Bros. Wii
SMN?03 Newer Super Mario Bros. Wii
SMN?04 Canon Super Mario Bros. Wii
SMN?05 Another Super Mario Bros. Wii
SMN?06 Newer Summer Sun
SMN?07 Newer Holiday Special
SMN?08 Epic Super Bowser World
SMN?10 Koopa Country
SMN?11 New Super Mario Bros. 4
SMN?12 Awesomer Super Luigi Mini
SMN?31 New Super Mario Bros. Wii - Other World
SMN?41 Devil Mario Winter Special
SMN?60 Remixed Super Mario Bros. Wii
SMN?65 Ghostly Super Ghost Boos. Wii
SMN?66 The Legend of Yoshi
SMN?DU DarkUmbra Super Mario Bros: Anniversary Edition
SMN?FL Newer: Falling Leaf
SMN?MI Midi's Super Mario Bros Wii - Just A Little Adventure
SMN?RV RVLution Wii (NewSMB Mod)
SMN?YL Luigi's Super Yoshi Bros.
SMN?ZA Newer Apocalypse
SMN?ZY Super Mario Skyland
SMM?02 Super Mario: Mushroom Adventure PLUS - Winter Moon
SMV?01 Super Mario Vacation
MRR?01 New Super Mario Bros. Wii Retro Remix

### Mario Kart Wii ###

RMC?01 Original Mario Kart Wii
RMC?06 Wiimms MKW Fun 2010-12
RMC?07 Wiimms MKW Retro 2011-02
RMC?08 Wiimms MKW Fun 2011-03
RMC?09 Wiimms MKW Fun 2011-06
RMC?10 Wiimms MKW Fun 2011-07
RMC?11 Wiimms MKW Fun 2011-08
RMC?12 Wiimms MKW Fun 2011-11
RMC?13 Wiimms MKW Fun 2012-01
RMC?14 Wiimms MKW Revival 2012-02
RMC?15 Wiimms MKW Boost 2012-03
RMC?16 Wiimms MKW Fun 2012-05
RMC?17 Wiimms MKW Fun 2012-09
RMC?18 Wiimms MKW N64 2012-10
RMC?19 Wiimms MKW Fun 2012-12
RMC?20 Wiimms MKW Fun 2013-04
RMC?21 Wiimms MKW Fun 2013-09
RMC?22 Wiimms MKW Fun 2013-10
RMC?23 Wiimms MKW-Fun 2014-01
RMC?24 Wiimms MKW Retro 2014-02
RMC?25 Wiimms MKW-Fun 2014-04
RMC?26 Wiimms MKW-Fun 2014-11
RMC?27 Wiimms MKW-Fun 2015-03
RMC?28 Wiimms MKW-Fun 2015-05
RMC?29 Wiimms MKW-Fun 2015-08
RMC?30 Wiimms MKW-Fun 2015-12
RMC?31 Wiimms MKW-Fun 2016-02
RMC?32 Wiimms MKW-Fun 2016-07

### Kirby's Adventure Wii ###

SUK?01 Kirby's Adventure Wii (only exchanging first player's character is supported)

### Pokemon ###

0004000000055D00 Pokemon X
0004000000055E00 Pokemon Y
000400000011C400 Pokemon Omega Ruby
000400000011C500 Pokemon Alpha Sapphire

### Toyko Mirage Sessions #FE ###

ASE?01 De-Censoring the game

Default Searchpaths:
  • ISO: BASE.iso / BASE.wbfs / GAMEID.iso / GAMEID.wbfs
  • Riivolution: Original name of the zip / unpacked folder
  • ROM: some mask matching the file (eg: "*[Ll]ink*[Pp]ast*smc" for Zelda: Parallel Worlds)
Parameters
--game={NewerSMB;NewerSummerSun;AnotherSMBW;HolidaySpecial;ParallelWorlds}
specify game to create (if none is provided, the script will ask you)

--iso/--rom=/home/test/<Image>
specify path to the original ISO/ROM

--riivolution/--patch=<Patch>
specify path to Riivolution/Patch files

--version=EURv1,EURv2,USAv1,USAv2,JPNv1
specify your game version (for Wii games, if auto-detection fails)

--customdid=SMNP02
specify a custom ID to use for the game

--sharesave
let modified game share savegame with original game

--download
download riivolution/patchfiles

--soundtrack
download soundtrack (if available) and exit

--banner=<banner>
specify a custom banner to use

--download-banner
download a custom banner (if available)

--xdelta
path to xdelta files (Tokyo Mirage Sessions #FE)

--cpk
path to cpk files (Tokyo Mirage Sessions #FE)

Examples:

NewerSMBW:
$ patchimage --game=NewerSMBW --iso=/home/test/SMNP01.iso --download​

Zelda: Parallel Worlds
$ patchimage --game=ParallelWorlds --rom=/home/test/ALTTP.smc --download​

De-Censoring Tokyo Mirage Sessions #FE:
$ patchimage --game=TMSFE--xdelta=/home/test/xdelta --cpk=/home/test/vol/Content/Pack

License: GNU GPLv3
Extra Licenses:
  • wit GNU GPL v2
  • uips GNU GPL v3
  • unp GNU GPL v2
  • applyppf3 Public Domain
  • xml-patchfiles Public Domain
Downloads:
Downloads and Debian Package
Git-Repository: https://github.com/Nanolx/patchimage

Changes:
Code:
v7.3.1:
::bug fixes
- fixed that --iso, --rom, --patch, --xdelta, --cpk and --riivolution command
  line flags failed when relative paths were given (regression from 7.2.2)
- fixed that temporary files were kept when downloads failed, causing required
  user-input for wget when trying again
- fixed that --cpk and --xdelta command line flags never actually checked wether
  the given directory does exist, before trying to patch the game [the game
  patcher does, too, but it should fail immediately upon wrong user-input]
- remove build directory before trying to build a game, not afterwards, so that
  in case a build failed in batch-mode, the next one can be tried without issues
- fixed that character mods were not applicable to Cliff Super Mario Bros. Wii

::misc. changes:
- drop support for Awesomer Super Luigi Mini (broken and offline)
- update Cliff Super Mario Bros. to version 1.1
 
Last edited by Excelsiior, , Reason: 7.3.1

Excelsiior

Well-Known Member
OP
Member
Joined
Sep 13, 2009
Messages
274
Trophies
0
Website
www.nanolx.org
XP
328
Country
Germany
v2.1 is now available, see first post. I finally got my hands on the Cannon SMBW files, so I mirrored them and fixed support for it. Also improved the way the build-directory is cleaned up.
 
  • Like
Reactions: Slimmmmmm

PureMagic

Well-Known Member
Newcomer
Joined
Dec 19, 2010
Messages
45
Trophies
0
XP
83
Country
Brazil
Looks interesting, thanks Excelsiior, I'll try it later.
Could the patcher in the future be able to patch any(or most) riivolution patches, besides the hardcoded ones?
 

Excelsiior

Well-Known Member
OP
Member
Joined
Sep 13, 2009
Messages
274
Trophies
0
Website
www.nanolx.org
XP
328
Country
Germany
That's a bit difficult due to the fact that Linux filesystems are casesensitive, while Windows' are not. So there are actually several typos in the XML files of riivolution patches. Though it's not impossible, if the game does not patch the loader.

But you'd miss comfortfeatures Ehen using a fully automated patcher.
 

Wiimm

Developer
Member
Joined
Aug 11, 2009
Messages
2,291
Trophies
0
Location
Germany
Website
wiimmfi.de
XP
1,451
Country
Germany
Only an idea for case sensitivity:
* Create a 12 GB sparse file (double layer must have place)
* format it as fat32
* mount it as loop back device and use it as working directory.
 

GreyRogue

Well-Known Member
Member
Joined
Jun 21, 2013
Messages
213
Trophies
0
Age
44
XP
562
Country
United States
Supported Games:
* Newer SMBW (riivolution) [SMN?03]
* Cannon SMBW (riivolution) [SMN?04]
* Another SMBW (riivolution) [SMN?05]
* Newer Summer Sun (riivolution) [SMN?06]
* Newer Holiday Special (riivolution) [SMN?07]
* Epic Super Bower World (riivolution) [SMN?08]
* Koopa Country (riivolution) [SMN?09]
* The Legend of Zelda: Parallel Worlds (ips)
According to gametdb, SMNE09 is already used by Old Super Mario Bros.
You might want to use SMNE10 instead.
http://www.gametdb.com/Wii/SMNE09

gametdb also lists MRRP01 as New Super Mario Bros Retro Remix (download link in damysteryman's thread). You might want to add that one as well. I don't know if it's important to keep the SMNx## code for these or at least KMNx## for the save. I don't have the xml, but it seems to work if using Holiday Special's xml. e.g. for NTSC:
wit\wit dolpatch nsmb.d/sys/main.dol 80117F6C=38000003 802F118C=526574726F524D#7769696D6A3264

http://www.gametdb.com/Wii/MRRP01
 

Excelsiior

Well-Known Member
OP
Member
Joined
Sep 13, 2009
Messages
274
Trophies
0
Website
www.nanolx.org
XP
328
Country
Germany
I can't find a riivolution link to old super mario bros. via google, only pre-patched, crap wbfs files. Anyhow, post some links and I'll see what I can do.

Ah and there's now v2.2 with minor changes, see first post
 

Wiimm

Developer
Member
Joined
Aug 11, 2009
Messages
2,291
Trophies
0
Location
Germany
Website
wiimmfi.de
XP
1,451
Country
Germany
that would be THE overkill..
Indeed! But brainstorming.
Some ? or [Aa] might do aswell.
If you set: shopt -s nocaseglob
bash works case insensitive on file name expansion. So it is enough to enclose the very first letter of the file name with brackets.

Example:
You looking for: ./path/to/file.ext
The pattern: ./path/to/[f]ile.ext
will find all upper/lower case versions of file.ext
 

Excelsiior

Well-Known Member
OP
Member
Joined
Sep 13, 2009
Messages
274
Trophies
0
Website
www.nanolx.org
XP
328
Country
Germany
... there are even hacks, that don't actually use usable xml files, so the automatic patcher is not so easy.

For now there's v2.3, see first post, support yet another nsmb hack.
 

nl255

Well-Known Member
Member
Joined
Apr 9, 2004
Messages
2,984
Trophies
0
XP
2,521
Country
I wonder if the next version of riivolution will support encrypted files specifically to defeat software like patchimage.
 

GreyRogue

Well-Known Member
Member
Joined
Jun 21, 2013
Messages
213
Trophies
0
Age
44
XP
562
Country
United States
I can't find a riivolution link to old super mario bros. via google, only pre-patched, crap wbfs files. Anyhow, post some links and I'll see what I can do.

Ah and there's now v2.2 with minor changes, see first post

I don't have a link for Old SMBW, I just noticed the reference at gametdb. The Retro Remix one link I mentioned is here, although it isn't clear to me if it's official.
http://gbatemp.net/threads/nsmbw-mod-iso-builder-v1-00.349853/page-8#post-4694035

Also I'm not sure if I saw whether or not you added the save file mod for Epic Bowser. I have these in mine to make the save file EpicSBW, instead of the default wiimj2d (separate save files in the same save slot).
802F148C=45706963534257#7769696D6A3264
802F118C=45706963534257#7769696D6A3264
802F0F8C=45706963534257#7769696D6A3264

Similar for Retro Remix (RetroRM)
802F148C=526574726F524D#7769696D6A3264
802F118C=526574726F524D#7769696D6A3264
802F0F8C=526574726F524D#7769696D6A3264

Most of the games have this in their riivolution xml (see the Newer xml for the labels of which is E, P and J), but damasteryman did this for Holiday special in his HS.xml (Holiday), which didn't have it.

EDIT: I suppose it would be possible to take the OldSMBW wbfs, extract it, and compare files with the original to make a patch.

EDIT2: I'm sure you've seen Newer 1.0.2 is out fixing the 3-6, 3-7 issue.

EDIT3: Last one. I had to modify Epic Bowser to get to World 8. I don't know if there's an easy way to get their save onto the wii, so I just used Reggie to make the shortest levels possible to get through 1-1,1-2,1-3,1-Cannon, 5-1,5-2,5-3,5-4,5-5,5-Ghost,5-Cannon. I suppose it would be easier to just not copy the 1-1 in the pack so the default levels are there.
 

Excelsiior

Well-Known Member
OP
Member
Joined
Sep 13, 2009
Messages
274
Trophies
0
Website
www.nanolx.org
XP
328
Country
Germany
I wonder if the next version of riivolution will support encrypted files specifically to defeat software like patchimage.
Of course, because what patchimage does is 100% illegal, devilish and causes genital herpes.

I don't have a link for Old SMBW, I just noticed the reference at gametdb. The Retro Remix one link I mentioned is here, although it isn't clear to me if it's official.
http://gbatemp.net/threads/nsmbw-mod-iso-builder-v1-00.349853/page-8#post-4694035

Also I'm not sure if I saw whether or not you added the save file mod for Epic Bowser. I have these in mine to make the save file EpicSBW, instead of the default wiimj2d (separate save files in the same save slot).
802F148C=45706963534257#7769696D6A3264
802F118C=45706963534257#7769696D6A3264
802F0F8C=45706963534257#7769696D6A3264

Most of the games have this in their riivolution xml (see the Newer xml for the labels of which is E, P and J), but damasteryman did this for Holiday special in his HS.xml (Holiday), which didn't have it.

EDIT: I suppose it would be possible to take the OldSMBW wbfs, extract it, and compare files with the original to make a patch.

EDIT2: I'm sure you've seen Newer 1.0.2 is out fixing the 3-6, 3-7 issue.

EDIT3: Last one. I had to modify Epic Bowser to get to World 8. I don't know if there's an easy way to get their save onto the wii, so I just used Reggie to make the shortest levels possible to get through 1-1,1-2,1-3,1-Cannon, 5-1,5-2,5-3,5-4,5-5,5-Ghost,5-Cannon. I suppose it would be easier to just not copy the 1-1 in the pack so the default levels are there.

OK, I'm gonna check and report back.
 

Excelsiior

Well-Known Member
OP
Member
Joined
Sep 13, 2009
Messages
274
Trophies
0
Website
www.nanolx.org
XP
328
Country
Germany
So now, there's v2.4 (links in first post):

Code:
v2.4:
- fixed downloading NewerSMBW
- added support for New Super Mario Bros. Wii Retro Remix
  NOTE: on PAL/NTSC-J the game has the original opening title (there's only a opening title for NTSC-U)
- add savegame hack to Epic Super Bowser World
- add savegame hack to Newer: Holiday Special
- add savegame hack to New Super Mario Bros. 4
- leave a message where the file was created
- removed patches/03-06.arc.LH (NewerSMBW 1.02 includes it)
- moved NSMBW detection in a function (no more duplicated code)
- fixed pre-requisite checking for Koopa Country
- fixed handling .zip/.rar files with spaces in the name

GreyRogue I have not yet looked into epic bowser world, you mean if I use 1-1 from the hack you can't reach 8-*?
 

alejandroues

Well-Known Member
Newcomer
Joined
Dec 2, 2006
Messages
54
Trophies
0
XP
160
Country
Mexico
So now, there's v2.4 (links in first post):

Code:
v2.4:
- fixed downloading NewerSMBW
- added support for New Super Mario Bros. Wii Retro Remix
  NOTE: on PAL/NTSC-J the game has the original opening title (there's only a opening title for NTSC-U)

I've made them for myself but you can use them if you want:
http://www.mediafire.com/?f2ztobicg88uu70

Inside are the openingTitle.arc for Retro Mix and NSMBW 4 (the one in the distribution of NSMBW 4 is Eur only)
Both are compatible with usa and eur (I've tested them), maybe they work with the jap version but can't test
 
General chit-chat
Help Users
    linuxares @ linuxares: their discord