Skip to content

Instantly share code, notes, and snippets.

@ihaveamac
ihaveamac / 3ds-to-cia-quick.sh
Last active June 15, 2016 10:45
convert .3ds to .cia with just an exheader xorpad (old crappy method)
# Manual and DLPChild for some reason don't work.
# it must be a make_cia issue since I tried using makerom and hex editing and it worked fine
if [ ! -f "$1" ]; then
echo "no"
exit 1
fi
rm 0.cxi ncch.header exheader.bin exefs.bin romfs.bin logo.bcma.lz plain.bin converted.cia
EXHXOR=$(python2 get-exh-xorpad.py "$1")
3dstool -xvt012f cci orig.cxi manual.cfa dlpchild.cfa "$1"
3dstool -xvtf cxi orig.cxi --header ncch.header --exh exheader.bin --exh-xor $EXHXOR --exefs exefs.bin --romfs romfs.bin --logo logo.bcma.lz --plain plain.bin
@ihaveamac
ihaveamac / conv3ds.py
Last active March 16, 2018 15:20
convert .3ds to .cia with only an exheader xorpad ~ see https://github.com/ihaveamac/3dsconv
#!/usr/bin/env python2
import sys, os, binascii, math, subprocess, errno
def testcommand(cmd):
try:
proc = subprocess.Popen([cmd], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait()
return True
except OSError as e:
if e.errno != 2:
raise
#!/usr/bin/env python2
import sys
if len(sys.argv) != 3:
print("xor.py <file> <xorpad>")
sys.exit()
encfile = open(sys.argv[1], "rb")
xorpad = open(sys.argv[2], "rb")
outfile = open("%s.out" % sys.argv[1], "wb")
versions = [
["0004001000020000", 0xA],
["0004001000021000", 9],
["0004001000022000", 9],
["0004001000026000", 3],
["0004001000027000", 6],
["0004001000028000", 3],
["0004003000008202", 0x1B],
["0004003000008802", 9],
["0004003000008A02", 7],
#!/usr/bin/env python3
import os
import shutil
import sys
helptext = """usage: firmswap.py [options]
swap FIRM partition(s) from 11.0 to 10.4 FIRM
default behavior:
- create backup of NAND.bin named NAND.bin.bak
#!/usr/bin/env python2
# Convert 3DS errors to readable format
# plutooo // yuriks
# i added more things to it with mrrraou's help -ihaveamac
import sys
summaries = {
@ihaveamac
ihaveamac / b2bin.c
Last active July 3, 2016 00:32 — forked from SonoSooS/b2bin.c
Converts SmileBASIC .DAT files to real little-endian binary files
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
typedef unsigned long long u64;
typedef unsigned int u32;
typedef unsigned short u16;
typedef unsigned char u8;
int main(int argc, char** argv)
@ihaveamac
ihaveamac / cdndownload.py
Last active September 6, 2021 23:52
crappy cdn downloader
#!/usr/bin/env python3
# usage: cdndownload.py <titleid> [titlekey]
# if a system title is given for titleid, titlekey is not used
# system titles should be "legit CIAs" i.e. a stock system will install it
# unlike other cdn downloaders, this doesn't use make_cdn_cia or anything
# it downloads and saves directly to the cia, so it's faster
import base64
#!/usr/bin/env python2
# THIS CREATES BAD CIAS - DON'T BOTHER
import binascii
import itertools
import hashlib
import math
import os
import struct