Resolve contents not being fully updated

For whatever reason, this allows the patcher to use the correct hashes upon initial download via GoNUSD. This should probably be looked into eventually...
This commit is contained in:
Spotlight 2022-08-19 17:21:56 -05:00
parent 7959792059
commit 8f0a067af7
No known key found for this signature in database
GPG Key ID: 874AA355B3209BDC

15
main.go
View File

@ -61,25 +61,27 @@ func main() {
createDir("./output") createDir("./output")
createDir("./cache") createDir("./cache")
var originalWad *wadlib.WAD
var err error var err error
// Determine whether the Wii Shop Channel is cached. // Determine whether the Wii Shop Channel is cached.
if !filePresent("./cache/original.wad") { if !filePresent("./cache/original.wad") {
log.Println("Downloading a copy of the original Wii Shop Channel, please wait...") log.Println("Downloading a copy of the original Wii Shop Channel, please wait...")
originalWad, err = GoNUSD.Download(0x00010002_48414241, 21, true) var downloadedShop *wadlib.WAD
downloadedShop, err = GoNUSD.Download(0x00010002_48414241, 21, true)
check(err) check(err)
// Cache this downloaded WAD to disk. // Cache this downloaded WAD to disk.
contents, err := originalWad.GetWAD(wadlib.WADTypeCommon) var contents []byte
contents, err = downloadedShop.GetWAD(wadlib.WADTypeCommon)
check(err) check(err)
os.WriteFile("./cache/original.wad", contents, 0755) os.WriteFile("./cache/original.wad", contents, 0755)
} else {
originalWad, err = wadlib.LoadWADFromFile("./cache/original.wad")
check(err)
} }
var originalWad *wadlib.WAD
originalWad, err = wadlib.LoadWADFromFile("./cache/original.wad")
check(err)
// Determine whether a certificate authority was provided, or generated previously. // Determine whether a certificate authority was provided, or generated previously.
if !filePresent("./output/root.cer") { if !filePresent("./output/root.cer") {
fmt.Println(aurora.Green("Generating root certificates...")) fmt.Println(aurora.Green("Generating root certificates..."))
@ -104,7 +106,6 @@ func main() {
// Permit r/w access to MEM2_PROT via the TMD. // Permit r/w access to MEM2_PROT via the TMD.
// See docs/patch_overwrite_ios.md for more information! // See docs/patch_overwrite_ios.md for more information!
originalWad.TMD.AccessRightsFlags = 0x3 originalWad.TMD.AccessRightsFlags = 0x3
// Apply all DOL patches // Apply all DOL patches
fmt.Println(aurora.Green("Applying DOL patches...")) fmt.Println(aurora.Green("Applying DOL patches..."))
applyDefaultPatches() applyDefaultPatches()