Skip to content

Instantly share code, notes, and snippets.

View PikalaxALT's full-sized avatar
🤧
ARM assembly is nothing to sneeze at.

PikalaxALT

🤧
ARM assembly is nothing to sneeze at.
View GitHub Profile
import collections
import os
import sys
PTRTYPE_SCRIPT = 0
PTRTYPE_BYTEARRAY = 1
PTRTYPE_HWORDARRAY = 2
if len(sys.argv) > 1:
project_dir = sys.argv[1]
@PikalaxALT
PikalaxALT / get_sprite_coords.c
Created May 14, 2019 18:12
C script which prints x, y, and y_offset fields of sprite coordinates
#include <stdio.h>
#include <png.h>
#include <stdlib.h>
#define FATAL_ERROR(...) ({fprintf(stderr, __VA_ARGS__);exit(1);})
#define min(a, b) ((a) < (b) ? (a) : (b))
struct Image
{
#ifndef GUARD_TRAINERS_H
#define GUARD_TRAINERS_H
#define TRAINER_ENCOUNTER_MUSIC_MALE 0 // standard male encounter music
#define TRAINER_ENCOUNTER_MUSIC_FEMALE 1 // standard female encounter music
#define TRAINER_ENCOUNTER_MUSIC_GIRL 2 // used for male Tubers and Young Couples too
#define TRAINER_ENCOUNTER_MUSIC_SUSPICIOUS 3
#define TRAINER_ENCOUNTER_MUSIC_INTENSE 4
#define TRAINER_ENCOUNTER_MUSIC_COOL 5
#define TRAINER_ENCOUNTER_MUSIC_AQUA 6
@PikalaxALT
PikalaxALT / dump_battle_scripts.py
Created November 5, 2019 22:08
Battle script dumper
import json
import re
SONGS = [
'MUS_DUMMY',
'SE_KAIFUKU',
'SE_PC_LOGIN',
'SE_PC_OFF',
'SE_PC_ON',
'SE_SELECT',
@PikalaxALT
PikalaxALT / bin2c.c
Created November 27, 2019 15:50
Simple utility to convert flat binary files into C objects
#include <stdio.h>
#include <ctype.h>
#include <string.h>
int main(int argc, char ** argv) {
static char label[BUFSIZ];
strcpy(label, "FILE_");
if (argc < 3) {
fprintf(stderr, "usage: %s INPUT OUTPUT\n"
"ERROR: insufficient arguments\n", argv[0]);
@PikalaxALT
PikalaxALT / basic_eh.py
Created December 25, 2019 15:47
discord.py bot error handler which bugs the owner with any problems. Good for logging.
import discord
from discord.ext import commands
import aiohttp
import io
import traceback
import config # includes the token
# These exceptions are ignored.
filter_excs = (commands.CommandNotFound, commands.CheckFailure)
@PikalaxALT
PikalaxALT / dump_alph_puzzles.py
Created December 26, 2023 23:18
random heartgold dumping tools
import re
import sys
label_pat = re.compile('(?P<name>\w+):')
data_pat = re.compile('\s+\.byte (?P<data>(?:(?:0x[0-9a-fA-F]{2})(?:, )?){6})')
name = None
nrow = 0
with open('.vscode/scratch.s') as fp:
for line in fp: