Skip to content

Instantly share code, notes, and snippets.

@RoadrunnerWMC
RoadrunnerWMC / midi_simultaneous_note_counter.py
Created April 20, 2024 02:54
A Python script to find the maximum number of notes that ever play simultaneously in a MIDI file, across all tracks
from __future__ import annotations
import argparse
from pathlib import Path
import mido
NoteList = list[tuple[int, str, int]]
@RoadrunnerWMC
RoadrunnerWMC / spritetex.S
Created January 15, 2024 11:07
Jellybeam Spritetex (for Kamek 2.0)
#include <kamek_asm.S>
.extern sprintf
.set sp, 1
kmCallDef 0x80a2f238
lwz r5, 4(r28)
srwi r5, r5, 24
andi. r5, r5, 0xF
@RoadrunnerWMC
RoadrunnerWMC / qcolor_repr.py
Created April 5, 2023 04:56
A proof-of-concept for a __repr__ function for PyQt QColor
def QColor_repr(self) -> str:
"""
PyQt6.QtGui.QColor.__repr__
"""
PREFIX = 'PyQt6.QtGui.QColor'
spec = self.spec()
if spec == QtGui.QColor.Spec.Invalid:
return f'{PREFIX}()'
@RoadrunnerWMC
RoadrunnerWMC / tileset_edge_fixer.py
Last active September 17, 2022 20:57
A script to batch-fix tilesets with darkened edges
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@RoadrunnerWMC
RoadrunnerWMC / staffroll_master.jinja2
Created August 15, 2021 22:08
Jinja2 template that generates accurate NSMBW staff credits for all regions
:<bold>PRODUCERS</bold>
:Takashi Tezuka
:Hiroyuki Kimura
:<bold>DIRECTOR</bold>
:Shigeyuki Asuke
@RoadrunnerWMC
RoadrunnerWMC / realtime_auto_padder.py
Last active June 9, 2021 15:04
A script for automatic real-time NSMBW level padding, to make it easier to rapidly test changes in Dolphin
# 2021-05-01
# Requirements
# ============
#
# - Python 3.8+
# - Watchdog (`pip install watchdog`)
# Usage
# Exports a file with lines in the form "symbolName 0xADDRESS function_or_label" where "f" indicates a function and "l" a label
# @author RoadrunnerWMC
# @category Data
#
from ghidra.program.database.function import FunctionDB
f = askFile('Choose a file to write to', 'Go!')
COLUMN_2 = 32
@RoadrunnerWMC
RoadrunnerWMC / hylianify.py
Last active April 1, 2020 09:32
The script behind Skawo's April Fools 2020 video (https://youtu.be/XCb3-nU9KZc)
# RRWMC, Mar 31 2020
# The script behind Skawo's April Fools 2020 video
# (https://youtu.be/XCb3-nU9KZc)
#
# Download the source code for deeng from
# https://bisqwit.iki.fi/source/deeng.html
# Find the following in deeng.cc:
# else if(base == 'h' && res[a+1] == 'u')
# {
# base = 'f';
@RoadrunnerWMC
RoadrunnerWMC / fix_midi_for_seq64.py
Created September 29, 2019 10:09
Remap instruments in a MIDI, to import into Zelda Ocarina of Time using Seq64
# MIT License
#
# Copyright (c) 2019 RoadrunnerWMC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@RoadrunnerWMC
RoadrunnerWMC / build_cffi.py
Created August 11, 2019 02:26
Test case for cffi ffi.gc() callback-upon-deletion subinterpreter issue
from cffi import FFI
ffibuilder = FFI()
ffibuilder.cdef(
"""
typedef struct c_class c_class;
typedef void destroy_callback_function();
extern c_class* c_class_create(destroy_callback_function *callback);
extern void c_class_destroy(c_class *obj);