Skip to content

Instantly share code, notes, and snippets.

View jam1garner's full-sized avatar
🦀

jam1garner

🦀
View GitHub Profile
This file has been truncated, but you can view the full file.
int global0;
float global1;
int global2;
float global3;
float global4;
float global5;
float global6;
float global7;
int global8;
float global9;
@jam1garner
jam1garner / findAllSyscalls.py
Created August 3, 2018 03:42
Script to find all msc syscalls using an extracted Sm4shExplorer instance
import glob
from msc import *
usedSyscalls = []
files = glob.iglob("D:\\Smash\\Sm4shExplorer\\extract\\data\\fighter\\**\\*.mscsb", recursive=True)
for filePath in files:
msc = MscFile()
with open(filePath, 'rb') as f:
msc.readFromFile(f)
for script in msc:
for cmd in script:
//------------------------------------------------
//--- 010 Editor v7.0.2 Binary Template
//
// File: GameMaker 2 AudioGroup File
// Authors: jam1garner (w/ help from FruitMage)
// Version: 1
// ID Bytes: FORM
//------------------------------------------------
LittleEndian();
@jam1garner
jam1garner / data.win.bt
Created September 15, 2018 15:21
Binary Template for GameMaker 2 data files
//------------------------------------------------
//--- 010 Editor v7.0.2 Binary Template
//
// File: Gamemaker 2 Data File
// Authors:
// Version:
// Purpose:
// Category:
// File Mask:
// ID Bytes:
// Here's an example function we'll use to replace _ZN3app11peachdaikon32PEACH_PEACHDAIKON_DAIKON_1_POWEREv
// The return type and arguments should match that of the function we are replacing
// but the contents can be any valid C
float _ZN3app11peachdaikon32PEACH_PEACHDAIKON_DAIKON_1_POWEREv_replace() {
return 80.0;
}
// Function to replace a function with the name [function_sym] with a function pointed at by [new_func]
// param | char* function_sym - name of the function to search for
// param | u64 new_func - a pointer to the function you want to replace it with
@jam1garner
jam1garner / consts_no_categories.csv
Last active May 10, 2019 20:09
Output of emulation of ultimate's constant registration function
type hash name value
CONST 0xE90AD35AAF0828BC FIGHTER_PAD_ATTACK_TRIGGER 0x0
CONST 0x2DBCF4F8527B6075 FIGHTER_PAD_ATTACK_RELEASE 0x1
CONST 0xAF584050C0149AE7 FIGHTER_PAD_SPECIAL_TRIGGER 0x2
CONST 0x1FAC7A3FEC45ACC7 FIGHTER_PAD_SPECIAL_RELEASE 0x3
CONST 0x39861B1EF6E67D84 FIGHTER_PAD_JUMP_TRIGGER 0x4
CONST 0xC9B484F70E7A80AB FIGHTER_PAD_JUMP_RELEASE 0x5
CONST 0xC5588B41FEC4F32D FIGHTER_PAD_GUARD_TRIGGER 0x6
CONST 0x4141CED1E0526C8B FIGHTER_PAD_GUARD_RELEASE 0x7
CONST 0xD5A66039CE86F4E4 FIGHTER_PAD_MAX 0x8
@jam1garner
jam1garner / string_hashes.csv
Last active May 11, 2019 14:31
All the strings run through some magic hash function in smash ultimate
We can't make this file beautiful and searchable because it's too large.
0x5E6FD9587B680105,"target_id"
0x1AA92AD4AEF106FA,"is_valid_target"
0x3C7C0E277793F867,"fighter_kind"
0x99E8C7990FA56DC7,"copy_fighter_kind"
0x8F3714F03045C5C0,"rank"
0x55E070DE6113EDBA,"cp_type"
0xFCB9F7CD33C4103B,"cp_flag"
0x94E81E5D4720F0C9,"cp_slide_type"
0x12E6DE382C551019,"act_id"
0x13453D9FB37D58CA,"prev_act_id"
@jam1garner
jam1garner / uart.rs
Created December 1, 2019 05:06
An example of using ZSTs, Deref/DerefMut, const generics, const fns, and singletons for safe embedded programming in Rust. See thread: https://twitter.com/jam1garner/status/1200946682902589441
#![feature(const_generics)]
#![feature(const_fn)]
use std::marker::PhantomData;
use std::ops::{Deref, DerefMut};
struct MmioRegister<T: Copy + Sized, const ADDR: usize>(PhantomData<T>);
impl<T: Copy + Sized, const ADDR: usize> MmioRegister<T, ADDR> {
pub const fn new() -> Self {
@jam1garner
jam1garner / 0.glsl
Created December 31, 2019 15:43
Rivals of Aether shColorReplaceBlendExt shader
#define LOWPREC lowp
#define MATRIX_VIEW 0
#define MATRIX_PROJECTION 1
#define MATRIX_WORLD 2
#define MATRIX_WORLD_VIEW 3
#define MATRIX_WORLD_VIEW_PROJECTION 4
#define MATRICES_MAX 5
uniform mat4 gm_Matrices[MATRICES_MAX];
@jam1garner
jam1garner / hex_dump.rs
Created April 25, 2020 17:31
Rust hex dumping
const CHUNK_SIZE: usize = 0x10;
const NUMBERING_HEX: &str = "00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F ";
const NUMBERING_SEP: &str = "│";
const NUMBERING_ASCII: &str = " 0123456789ABCDEF";
fn hex_num_len(val: usize) -> usize {
((val as f64).log2() / (0x10 as f64).log2()) as usize + 1
}
fn to_ascii_dots(x: u8) -> char {