Skip to content

Instantly share code, notes, and snippets.

View shinyquagsire23's full-sized avatar
💭
Fiddling with emulation/patching between schoolwork.

Max Thomas shinyquagsire23

💭
Fiddling with emulation/patching between schoolwork.
View GitHub Profile
/*
* Copyright 2011-2013 Jiří Janoušek <janousek.jiri@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
@shinyquagsire23
shinyquagsire23 / gist:89ff4ab30d7e0fc8b465d58479bcfd3a
Created October 20, 2016 16:38
Sun and Moon Demo No-Line Code
[No Outlines]
00297844 E320F000
D2000000 00000000
import idaapi
import struct
import os
CRO_SIGNATURE = "CRO0"
CRO_FORMAT_NAME = "CRO (CTR relocatable object)"
def accept_file(li, n):
@shinyquagsire23
shinyquagsire23 / gist:28f35ac6a54905cdb18802e3f9162a88
Last active September 22, 2022 07:19
Sun and Moon No-line GateShark (Original patch by TiniVi and Kazowar)
[No Outlines]
0041B748 E320F000
D2000000 00000000
.gba
.open "before.gba","patched.gba",0x08000000
.thumb
.org 0x08123456
some_imaginary_hook:
ldr r0, =addr
bx r0
Command ID 0x48, 0x01 to enable vibration (HID packet form, then UART)
----------
80 92 00 31 00 00 ae fb 01 03 00 00 00 00 00 00 00 00 48 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
19 01 03 38 00 92 00 31 00 00 ae fb 01 03 00 00 00 00 00 00 00 00 48 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Command ID 0x40, 0x01 to enable IMU data sent in input packets (HID packet form, then UART)
80 92 00 31 00 00 cb 8f 01 04 00 01 40 40 00 01 40 40 40 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
19 01 03 38 00 92 00 31 00 00 cb 8f 01 04 00 01 40 40 00 01 40 40 40 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
#!/bin/bash
cmp -l $1 $2 | gawk '{printf "%08X %02X %02X\n", $1-1, strtonum(0$2), strtonum(0$3)}'
@shinyquagsire23
shinyquagsire23 / ardsitest.cpp
Last active October 9, 2017 21:31
AR DSi Flasher
// Compile with g++ -lusb-1.0 ardsitest.cpp
#ifdef WIN32
#include <windows.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include <libusb-1.0/libusb.h>
#!/bin/bash
if [ "$1" = "" ]
then
echo "Usage: thumb <input file> {output file}"
exit
fi
if [ "$2" = "" ]
then
output=${1%.asm}.bin
@shinyquagsire23
shinyquagsire23 / rf-extract.py
Last active September 6, 2023 22:09
LEGO LOCO RFH/RFD unpacker
import struct
import os
contents = open("resource.RFH", "rb").read()
blob_f = open("resource.RFD", "rb")
def huff_decompress(data):
bits = 0
node = struct.unpack("<H", data[4:6])[0]
decomp = ""