Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <stdlib.h>
#include "rg_etc1.h"
//requires rg_etc1.cpp and rg_etc1.h from https://code.google.com/p/rg-etc1/source/browse/#svn%2Ftrunk
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
typedef unsigned long long u64;
@smealum
smealum / gist:9570204
Created March 15, 2014 16:43
texconv.py
import struct
import math
import os
import sys
from PIL import Image
tileOrder=[0,1,8,9,2,3,10,11,16,17,24,25,18,19,26,27,4,5,12,13,6,7,14,15,20,21,28,29,22,23,30,31,32,33,40,41,34,35,42,43,48,49,56,57,50,51,58,59,36,37,44,45,38,39,46,47,52,53,60,61,54,55,62,63]
def parseTile(im, l, x, y):
global tileOrder
for k in range(8*8):
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <ctr/types.h>
#include <ctr/srv.h>
#include <ctr/APT.h>
#include <ctr/GSP.h>
#include <ctr/GX.h>
#include <ctr/GPU.h>
@smealum
smealum / gist:5f2fc1189ba1132e625c
Last active August 29, 2015 14:00
gpudev crappy shader
; make sure you update aemstro_as for this (27/05/14)
; setup constants
.const 5, 0.0, 0.0, -0.99, 1.0
; setup outmap
.out o0, result.position
.out o1, result.color
.out o2, result.texcoord0
.out o3, result.texcoord1
@smealum
smealum / gist:b7b1195924e35e94ba41
Last active August 29, 2015 14:11
custom geoshader
; make sure you update aemstro_as for this (12/13/14)
; setup constants
.const c20, 1.0, 0.0, 0.5, 1.0
.const c21, 0.25, 0.0, 0.5, 1.0
.const c22, 0.0, 0.0, -0.5, 1.0
.const c23, 0.5, 0.0, -0.5, 1.0
.const c24, 0.0, 0.5, -0.5, 1.0
.const c25, 0.5, 0.5, -0.5, 1.0
void _aptExit()
{
Handle _srvHandle;
Handle* srvHandle = &_srvHandle;
Handle aptLockHandle = 0;
Handle aptuHandle=0x00;
_initSrv(srvHandle);
_aptSessionInit();
#(´◉◞౪◟◉)
@smealum
smealum / qr.py
Created January 11, 2015 22:51
ninjhax stuff
import os
import sys
import struct
import ctypes
import compress
#compress.py from https://github.com/magical/nlzss/blob/master/compress.py
#slightly modified padding
def getWord(b, k, n=4):
return sum(list(map(lambda c: b[k+c]<<(c*8),range(n))))
@smealum
smealum / bin2wav.py
Last active May 25, 2020 22:34
bangai-o soundhax
import sys
import wave
import struct
# bit0 is a single period sine wave at 1024Hz with a given amplitude
# bit1 is the same but with ~2.7 times the amplitude
bits = [[0x00, 0x09, 0x12, 0x1A, 0x21, 0x27, 0x2C, 0x2F, 0x30, 0x2F, 0x2C, 0x27, 0x21, 0x1A, 0x12, 0x09, 0x00, 0xF6, 0xED, 0xE5, 0xDE, 0xD8, 0xD3, 0xD0, 0xD0, 0xD0, 0xD3, 0xD8, 0xDE, 0xE5, 0xED, 0xF6], [0x00, 0x18, 0x30, 0x46, 0x59, 0x69, 0x75, 0x7C, 0x7F, 0x7C, 0x75, 0x69, 0x59, 0x46, 0x30, 0x18, 0x00, 0xE7, 0xCF, 0xB9, 0xA6, 0x96, 0x8A, 0x83, 0x81, 0x83, 0x8A, 0x96, 0xA6, 0xB9, 0xCF, 0xE7]]
bits[0] = [b^0x80 for b in bits[0]]
bits[1] = [b^0x80 for b in bits[1]]
bits[0] = struct.pack('%sB' % len(bits[0]), *bits[0])
@smealum
smealum / bch2obj.py
Created March 6, 2014 16:51
pokemon X/Y simple model/texture parser
import struct
import math
import os
import sys
if sys.version > '3':
buffer = memoryview
def getWord(b, k, n=4):
return sum(list(map(lambda c: b[k+c]<<(c*8),range(n))))