Skip to content

Instantly share code, notes, and snippets.

@iamgreaser
iamgreaser / ztrip.py
Created February 11, 2014 00:40
ztrip.py: tool which currently strips + merges zip files
#!/usr/bin/env python2
# zip file stripper
# by Ben "GreaseMonkey" Russell, 2014
# for ALSO
# licensing stuff will need to be sorted out so don't spread this too much
SEEK_END = 2
import struct
import sys
@iamgreaser
iamgreaser / app_ezjack.c
Created March 11, 2014 04:25
sackit + ezjack
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <errno.h>
#include "sackit.h"
#include "ezjack.h"
@iamgreaser
iamgreaser / gist:11202184
Created April 23, 2014 03:48
ARM is pretty
/* uint32_t crc_asm01(void *, uint32_t); */
.global crc_asm01
crc_asm01:
push {r4}
mvn r2, #0
ldr r3, =0xEDB88320
.L1:
ldrb r4, [r0]
@iamgreaser
iamgreaser / gist:11202672
Created April 23, 2014 04:23
ARM is pretty, slightly faster edition
.global crc_asm02 /* uint32_t crc_asm02(void *buf, uint32_t len); */
.extern tab_asm02 /* uint32_t tab_asm02[256]; */
crc_asm02:
push {r4, r5, r6}
/* prepare table */
mov r4, #0x00
ldr r5, =tab_asm02
ldr r3, =0xEDB88320
.L2A:
@iamgreaser
iamgreaser / gist:11203240
Last active August 29, 2015 14:00
tiny self-CRC code in x86 asm (50 bytes, DOES NOT PRINT)
; UNTESTED.
code_start:
bits 32
crc32_self:
push esi
mov esi, code_start
mov ecx, code_end - code_start
xor edx, edx
dec edx
@iamgreaser
iamgreaser / gist:11240698
Created April 24, 2014 03:41
broken audio codec implementation (curva)
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
/*
format:
@iamgreaser
iamgreaser / gist:9677b0e7ddb768d9ce36
Last active August 29, 2015 14:02
Indie Quilt non-Unity API
You could hypothetically use this API for Unity games, as long as you can grab the commandline arguments and bail out with return codes. But of course, it's probably better to just integrate with the main launcher.
CALLING AN APPLICATION:
--------
THIS C CODE SNIPPET IS RELEASED INTO THE PUBLIC DOMAIN
NOTE THAT IT'S UNTESTED, SO BE WARY
--------
enum {
@iamgreaser
iamgreaser / gist:29b49aba794a2d6e5491
Last active August 29, 2015 14:02
Indie Quilt non-Unity Framebuffer API
Version 1ba (1 didn't provision for input, 1a didn't provision for mouse, 1b didn't actually note what direction the image went in)
For games that use some form of framebuffer, it should be possible to send extended data.
This will be denoted by the -iqframebuffer argument which follows *directly after* all the -indiequilt parameters.
Applications which support this mode will initially print the following string EXACTLY:
printf("IQFRAMEBUFFER1\n\n");
And if I'm not mistaken, from the little C++ I know this is probably how you do it in C++:
std::cout << "IQFRAMEBUFFER1" << std::endl << std::endl;
@iamgreaser
iamgreaser / gist:d22314847781681524b5
Created June 26, 2014 05:21
Indie Quilt Hacked Framebuffer API
The other framebuffer API is deprecated. Use this one instead. It's way better.
Firstly, here's iqhack.h:
--------
#define IQHACK_BUTTON_W 0x01
#define IQHACK_BUTTON_S 0x02
#define IQHACK_BUTTON_A 0x04
#define IQHACK_BUTTON_D 0x08
#define IQHACK_BUTTON_SPACE 0x10
@iamgreaser
iamgreaser / gist:e2471829f8e29cfd8c72
Created June 28, 2014 03:59
pulseaudio -> jack routing
# Make a copy of /etc/pulse/default.pa, save it to ~/.pulse/default.pa, and add these lines to the end:
load-module module-jack-sink channels=4
load-module module-jack-source channels=2
set-default-sink jack_out
set-default-source jack_in