This file contains hidden or 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
# Loosely based on https://gist.github.com/Experiment5X/5025310 and https://github.com/VakhtinAndrey/Dead-Space-2-PC-Save-Editor | |
# with a lot of cleanup of the decompiled code | |
import struct, sys | |
crc_table = [ | |
0x00000000, 0x04C11DB7, 0x09823B6E, 0x0D4326D9, 0x130476DC, 0x17C56B6B, 0x1A864DB2, 0x1E475005, | |
0x2608EDB8, 0x22C9F00F, 0x2F8AD6D6, 0x2B4BCB61, 0x350C9B64, 0x31CD86D3, 0x3C8EA00A, 0x384FBDBD, | |
0x4C11DB70, 0x48D0C6C7, 0x4593E01E, 0x4152FDA9, 0x5F15ADAC, 0x5BD4B01B, 0x569796C2, 0x52568B75, | |
0x6A1936C8, 0x6ED82B7F, 0x639B0DA6, 0x675A1011, 0x791D4014, 0x7DDC5DA3, 0x709F7B7A, 0x745E66CD, | |
0x9823B6E0, 0x9CE2AB57, 0x91A18D8E, 0x95609039, 0x8B27C03C, 0x8FE6DD8B, 0x82A5FB52, 0x8664E6E5, |
This file contains hidden or 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
from struct import pack, unpack | |
import sys | |
#.bss | |
left9 = [0] * 0x400 #u16 | |
right9 = [0] * 0x400 #u16 | |
left12 = [0] * 0x10000 #u16 | |
right12 = [0] * 0x10000 #u16 | |
stack = [0] * 0x100 #u32 | |
#.sbss |
This file contains hidden or 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
//.bss | |
u16 left9[0x400]; //8067E830 | |
u16 right9[0x400]; //8067F030 | |
u16 left12[0x10000]; //8067F830 | |
u16 right12[0x10000]; //8069F830 | |
u32 stack[0x100]; //806BF830 | |
//.sbss | |
s32 bitlen[2]; | |
s32 ccnt[2]; |
This file contains hidden or 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
from struct import unpack | |
from os import makedirs | |
from os.path import exists | |
sortme = [] #I don't trust that this is sorted | |
with open("0000.fpk", "rb") as f: | |
#read header, make sure it's valid | |
unknown, entry_count, header_size, total_size = unpack(">4I", f.read(0x10)) | |
f.seek(0, 2) | |
assert total_size == f.tell() |
This file contains hidden or 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
from struct import unpack | |
import sys | |
def align(value): | |
return value + (0x10 - (value % 0x10)) | |
def full(f): | |
return unpack("<I", f.read(4))[0] | |
def LBL1(f): |
This file contains hidden or 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
from struct import unpack | |
import sys | |
def align(value): | |
return value + (0x10 - (value % 0x10)) | |
def full(f): | |
return unpack("<I", f.read(4))[0] | |
def LBL1(f): |
This file contains hidden or 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
from io import BytesIO | |
from struct import unpack | |
from binascii import hexlify, unhexlify | |
from Crypto.Cipher import AES #pip install pycryptodome | |
import sys | |
def generate_key(string): | |
key_hex = int(string, 16) | |
key_add = int(b"1" * 32, 16) | |
combine = key_hex + key_add |
This file contains hidden or 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
from bcsv_reader import BCSV | |
from msbt_reader import MSBT | |
from binascii import hexlify | |
from os import listdir | |
import sys, string, codecs | |
'''reload(sys) | |
sys.setdefaultencoding('utf8')''' | |
msg_path = "../message1.1" | |
bcsv_path = "." |
This file contains hidden or 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
from struct import unpack | |
with open("enUS.dat", "rb") as f: | |
header = unpack("<5I", f.read(0x14)) | |
table1 = unpack("<%sI" % header[2], f.read(4 * header[2])) | |
table1 += tuple([header[3] - (4 * header[2])]) | |
strings1 = [] | |
for i in range(len(table1) - 1): | |
strings1.append(f.read((table1[i+1] & 0xFFFFFF) - (table1[i] & 0xFFFFFF)).rstrip("\x00")) | |
table2 = [] |
This file contains hidden or 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
#change local_ip to whatever NX-Shell/other FTP homebrew says | |
#saves_folder can be changed to whatever, this is just Pokemon Shield | |
#only recurses one directory so you gotta select a specific game's folder | |
from ftplib import FTP | |
from os.path import exists | |
from os import mkdir | |
local_ip = "192.168.0.13" | |
saves_folder = "/switch/Checkpoint/saves/0x01008DB008C2C000 0x01008DB008C2C000/" |
NewerOlder