-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleaning up the repo, for anyone who stumbles upon this in the future, have fun :)
- Loading branch information
NWPlayer123
committed
May 8, 2015
1 parent
09f47ab
commit a2eb99d
Showing
8 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
'''Copyright (C) 2015, NWPlayer123 | ||
Permission is hereby granted, free of charge, to any person obtaining a | ||
copy of this software and associated documentation files (the "Software"), | ||
to deal in the Software without restriction, including without limitation | ||
the rights to use, copy, modify, merge, publish, pulverize, distribute, | ||
synergize, compost, defenestrate, sublicense, and/or sell copies of the | ||
Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included | ||
in all copies or substantial portions of the Software. | ||
If the Author of the Software (the "Author") needs a place to crash and | ||
you have a sofa available, you should maybe give the Author a break and | ||
let them sleep on your couch. | ||
If you are caught in a dire situation wherein you only have enough time | ||
to save one person out of a group, and the Author is a member of that | ||
group, you must save the Author. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO BLAH BLAH BLAH ISN"T IT FUNNY | ||
HOW UPPER-CASE MAKES IT SOUND LIKE THE LICENSE IS ANGRY AND SHOUTING AT YOU.''' | ||
import os, sys, struct | ||
|
||
def hexstr(data, length): #Convert input into hex string | ||
return hex(data).lstrip("0x").rstrip("L").zfill(length).upper() | ||
def binr(byte): | ||
return bin(byte).lstrip("0b").zfill(8) | ||
def uint8(data, pos): | ||
return struct.unpack(">B", data[pos:pos + 1])[0] | ||
def uint16(data, pos): | ||
return struct.unpack(">H", data[pos:pos + 2])[0] | ||
def uint24(data, pos): | ||
return struct.unpack(">I", "\00" + data[pos:pos + 3])[0] #HAX | ||
def uint32(data, pos): | ||
return struct.unpack(">I", data[pos:pos + 4])[0] | ||
|
||
def main(): | ||
print("IPK Extract by NWPlayer123") | ||
if len(sys.argv) != 2: #Only want script + file | ||
print("Usage: %s file.ipk" % sys.argv[0].split("\\")[-1]) | ||
|
||
f = open(sys.argv[1], "rb") | ||
data = f.read() | ||
f.close() | ||
|
||
folder = sys.argv[1][:-4] #minus .ipk, very hacky but I'm lazy | ||
pos = 0 | ||
magic = uint32(data, pos);pos += 12 | ||
assert magic == 1357648570 #50EC12BA | ||
data_offset = uint32(data, pos);pos += 4 | ||
num_files = uint32(data, pos) | ||
pos = 48 #Skip to file entries | ||
files = [] | ||
filepos = 0 | ||
for x in xrange(num_files): | ||
'''Getting data''' | ||
pos += 4 | ||
filesize = uint32(data, pos);pos += 20 | ||
filedata = uint32(data, pos);pos += 4 #Size of data in file | ||
filepos += filesize #Counter for debug | ||
folder_length = uint32(data, pos);pos += 4 | ||
foldername = data[pos:pos + folder_length];pos += folder_length | ||
file_length = uint32(data, pos);pos += 4 #of the name | ||
filename = data[pos:pos + file_length];pos += file_length + 8 | ||
print(foldername + filename) #name for debug | ||
print("Filesize: " + hexstr(filesize, 8)) #debug | ||
print("File Pos: " + hexstr(filepos + data_offset, 8)) #debug | ||
print #prettyprint | ||
'''File writing''' | ||
try: os.makedirs(folder + "/" + foldername) | ||
except: pass #Need to do this because os is picky | ||
f = open(folder + "/" + foldername + filename, "wb") | ||
datapos = data_offset + filedata #Need to create file data offset | ||
f.write(data[datapos:datapos + filesize]) #then add size of file | ||
f.close() | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Made this to extract files from Rayman Origins' IPK files. Too much work to do repacking, but should help whoever figure it out. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Made this to make it easier to get symbols from RPX/RPL files for reverse engineering/searching. Makes it super easy :) uses standard output, use "> file.txt" with 1 to store all names. Also look into https://github.com/Chadderz121/ghs-demangle for demangling symbol names (if you run into errors it's probably a cut off symbol name, can only go to 256 characters). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Made these for extracting and packing SARC files. If you run into SZS files, that's Yaz0 compressed SARC, this should extract them too. You'll need to use yaz0enc to repack (which you can find here: http://www.amnoid.de/gc/yaz0enc.zip), and keep in mind padding. If you encounter SZS files, chances are that it uses a specific padding value (usually like 0x2000 or 8192), and the compressed SARC also has that value at 0x8 in the Yaz0. Be sure to add it or else bad things. You can specify a (decimal) padding value as a third value in SARCPack. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Exported GTX textures are extracted here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Should probably use OutDDS_Lossless for texture hacking, some textures usually don't convert right here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Should only really be using DDS's from here for texture hacking, OutDDS stuff usually doesn't convert everything |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Made for texture hacking. | ||
It's a combination of IEA's stuff with a few scripts I made to automate the process even more. Double click extract.bat which asks you for the BFRES name, and it'll auto extract textures. then run convertGTX.bat to convert them all to DDS (you should only use the lossless versions). You can open the DDS files in paint.net and save as PNG to edit in Photoshop, then convert the new PNG back to DDS. Then using hax.py (syntax auto prints every time) to list all texture positions in the bfres, and then use it to splice in the dds texture after it auto converts to the right format. You'll need to make sure mipmap sizes match, otherwise weird things will probably happen. Thankfully TexConv2 handles mipmaps so you just need to guess the right minmip number (for Nintendo Land it's usually 1 for a 1x1 mipmap). You might also need to adjust the delay loops in the python script if texconv2 is super slow. |