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
import idaapi
import struct
import os
CRO_SIGNATURE = "CRO0"
CRO_FORMAT_NAME = "CRO (CTR relocatable object)"
def accept_file(li, n):
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
{"CalibrationInformation":{"Cameras":[{"Intrinsics":{"ModelParameterCount":15,"ModelParameters":[0.5056072473526001,0.51121383905410767,0.41733670234680176,0.55639612674713135,0.536751925945282,0.49938720464706421,0.0064958259463310242,0.79876220226287842,0.56841433048248291,0.07316143810749054,0.00090526352869346738,-0.00026460731169208884,4.882114808424376E-5,-0.00015969532250892371,2.7959318161010742],"ModelType":"CALIBRATION_LensDistortionModelRational6KT"},"Location":"CALIBRATION_CameraLocationHT0","Purpose":"CALIBRATION_CameraPurposeHeadTracking","MetricRadius":2.7959318161010742,"Rt":{"Rotation":[1,0,0,0,1,0,0,0,1],"Translation":[0,0,0]},"SensorHeight":480,"SensorWidth":640,"Shutter":"CALIBRATION_ShutterTypeUndefined","ThermalAdjustmentParams":{"Params":[0,0,0,0,0,0,0,0,0,0,0,0]}},{"Intrinsics":{"ModelParameterCount":15,"ModelParameters":[0.49853116273880005,0.49842718243598938,0.41769698262214661,0.55702918767929077,0.54305106401443481,0.81650543212890625,0.0025251691695302725,0.79530555009841919,0.92
@shinyquagsire23
shinyquagsire23 / wmr-dec.py
Last active October 28, 2018 09:29
Windows Mixed Reality Calibration Decryption
import struct
random_garbage = [0x2F, 0xC8, 0x0F, 0x38, 0xDD, 0x00, 0xF6, 0x5C, 0xA1, 0x31, 0xEF, 0xF1, 0xEA, 0x6F, 0xA0,
0xF8, 0x26, 0xB5, 0x9B, 0x39, 0xCF, 0x3A, 0x88, 0xC8, 0x2E, 0x17, 0xC0, 0x63, 0x5B, 0x46, 0x27, 0xBB, 0x98,
0x2F, 0x0E, 0x2A, 0x90, 0x4B, 0x28, 0x2D, 0x82, 0x76, 0xE5, 0x28, 0x72, 0x50, 0x8A, 0xF0, 0xBF, 0x84, 0x54,
0x3B, 0xA8, 0x77, 0x91, 0xCE, 0x87, 0x80, 0x53, 0x2F, 0x07, 0xAD, 0x1B, 0x3F, 0x8C, 0x67, 0x33, 0x2E, 0xEB,
0x6A, 0x2A, 0x52, 0x77, 0x7C, 0x1F, 0x02, 0x11, 0x9E, 0x2A, 0x59, 0x5C, 0x94, 0x0E, 0x4F, 0xF5, 0x44, 0x54,
0x01, 0xE7, 0x8F, 0x66, 0xF0, 0xAD, 0x68, 0x71, 0x3C, 0x6D, 0x2E, 0x1C, 0xE3, 0x11, 0x46, 0xF7, 0x7F, 0x02,
0x6C, 0x15, 0xA0, 0x10, 0xEE, 0x3B, 0x14, 0xAE, 0x6C, 0xA7, 0x3F, 0xAF, 0x83, 0x6A, 0xD7, 0x12, 0x88, 0x53,
0xFE, 0xEB, 0x5C, 0x78, 0x85, 0xAF, 0x1F, 0x80, 0x7F, 0xB6, 0xDA, 0x7C, 0x0E, 0x84, 0xB5, 0x02, 0x8E, 0x92,
@shinyquagsire23
shinyquagsire23 / main.c
Last active December 23, 2018 14:44
iPod 'Photo Database' extraction
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <uchar.h>
#include <png.h>
typedef struct section
{
uint32_t magic;
uint32_t size;
@shinyquagsire23
shinyquagsire23 / ida_pseudocode.txt
Created January 6, 2019 01:04
nrooooooo convergence/divergence test: multiple ifs and if..else
lib::L2CValue::L2CValue((lib::L2CValue *)&v21, 1);
lib::L2CAgent::clear_lua_stack((lib::L2CAgent *)v2);
lib::L2CAgent::push_lua_stack((lib::L2CAgent *)v2, (const lib::L2CValue *)&v21);
v4 = *(_QWORD *)(v2 + 8);
lib::L2CValue::as_number((lib::L2CValue *)&v21);
app::sv_animcmd::frame();
lib::L2CAgent::pop_lua_stack((L2CValue *)&v20, (lib::L2CAgent *)v2, 1);
lib::L2CValue::~L2CValue((lib::L2CValue *)&v20);
lib::L2CValue::~L2CValue((lib::L2CValue *)&v21);
lib::L2CAgent::clear_lua_stack((lib::L2CAgent *)v2);