Skip to content

Instantly share code, notes, and snippets.

View NWPlayer123's full-sized avatar

NWPlayer123 NWPlayer123

View GitHub Profile
Restore Health (Down + B) [NWPlayer123]
04004BF0 7C7F1B78
04004BF4 7C9E2378
04004BF8 3C60804D
04004BFC 3863AFD0
04004C00 A0630000
04004C04 28030204
04004C08 40820008
04004C0C 3BC00064
04004C10 7FE3FB78
'''
GameCube .map goes like this
.init section layout, symbol section header w/e
list all symbols
\r\n\r\n
x12 w/e
then memory map, then linker symbols
so we need to extract all symbols and their section, and then print it out as specified
@NWPlayer123
NWPlayer123 / decrypt_bullllllllshit.py
Last active September 30, 2019 07:49
Riivolution (and Devolution?) payload decryption algo
#Python doesn't support do while, so I do "while True" -> inverse check (if var1 == 1: break)
from struct import unpack, pack
import sys
bits_left = 0 #0x816107EC
decrypt_byte = 0
bytes_read = 0
DAT_816107F8 = 0
write_addr = 0
read_addr = 0
from struct import unpack
from extract_nut import *
def full(f):
return unpack(">I", f.read(4))[0]
with open("Banner.US.bin", "rb") as f:
assert f.read(4) == b"WIBN"
f.seek(0, 2)
if f.tell() == 0xF0A0: #0xF0C0?
@NWPlayer123
NWPlayer123 / hyrule_convert.py
Created September 15, 2019 01:29
*.bin.gz converter script for Hyrule Warriors (Wii U only prob bc big endian)
'''
word 0 = chunk_size (read 0x10000 bytes, compress, store)
word 1 = num_chunks
word 2 = dec_size
table, compressed chunk size + 4 (there's a size word at the start of the section)
align to 0x80
(write enc_chunk_size, enc_chunk, align to 0x80) * num_chunks
'''
from struct import unpack, pack
@NWPlayer123
NWPlayer123 / extract_ptd.py
Created September 9, 2019 05:02
Astral Chain PTD text
#thanks Simon for being a smartie
#unfinished, need to parse all the tables
#string_offset starts at +0x20 (header)
from struct import unpack
import sys
sys.argv.append("files/TalkSubtitleMessage_USen.bin")
def read16(f):
return unpack("<H", f.read(2))[0]
@NWPlayer123
NWPlayer123 / extract_dat1.py
Created September 9, 2019 05:00
Astral Chain dat(/dtt?)
#too lazy to finish this, throwing it here
from struct import unpack
def full(f):
return unpack("<I", f.read(4))[0]
def getstr(f):
ret = b"";char = f.read(1)
while char != b"\x00":
ret += char
@NWPlayer123
NWPlayer123 / extract_pkz.py
Last active September 3, 2019 20:43
Astral Chain pkz
#"pkzl", 0x10000, full_size, ???
#4 vars in each entry, count, decsize, offset, encsize?
#!! pip install zstd !!
from struct import unpack
from zstd import decompress
from os.path import exists, splitext
from os import makedirs
import sys
@NWPlayer123
NWPlayer123 / PSPGO_extract.py
Last active June 22, 2019 21:33
for PSPGO firmwares, only based on 5.70
from zlib import decompress
from struct import unpack
from os.path import exists
from os import makedirs
import sys
with open(sys.argv[1], "rb") as f:
inputname = ".".join(sys.argv[1].split(".")[:-1])
assert f.read(4) == b"PSAR"
assert unpack("<I", f.read(4))[0] == 2 #version?
@NWPlayer123
NWPlayer123 / nv2gc.py
Created May 7, 2019 07:59
I made this for NVIDIA Shield but it might just be twipri
import sys
def sanitize(line):
line = line.strip()
line = line.replace("\t", " ")
for i in range(5):
line = line.replace(" ", " ")
return line.split(" ")
name = ".".join(sys.argv[1].split(".")[:-1])