Skip to content

Instantly share code, notes, and snippets.

#!/bin/perl
#
# Converts REG_BGnCNT values to the appropriate flag constants
#
use strict;
use warnings;
my %screenSizes = (
'text' => ['BGCNT_TXT256x256', 'BGCNT_TXT512x256', 'BGCNT_TXT256x512', 'BGCNT_TXT512x512'],
#!/bin/perl
#
# Converts REG_DISPCNT values to the appropriate flag constants
#
use strict;
use warnings;
sub usage {
print "Usage: $0 [dispcnt value]\n";
@camthesaxman
camthesaxman / DrawRLESprite2.cpp
Last active April 20, 2017 16:25
broken refactored version of DrawRLESprite2 in OpenRCT2
template<sint32 image_type, sint32 zoom_level>
static void FASTCALL DrawRLESprite2(const uint8* RESTRICT source_bits_pointer,
uint8* RESTRICT dest_bits_pointer,
const uint8* RESTRICT palette_pointer,
const rct_drawpixelinfo *RESTRICT dpi,
sint32 source_y_start,
sint32 height,
sint32 source_x_start,
sint32 width)
{
#!/bin/bash
OBJDUMP="$DEVKITARM/bin/arm-none-eabi-objdump -D -bbinary -marmv4t -Mforce-thumb"
OPTIONS="--start-address=$(($1)) --stop-address=$(($1 + $2))"
$OBJDUMP $OPTIONS baserom.gba > baserom.dump
$OBJDUMP $OPTIONS pokeruby.gba > pokeruby.dump
diff baserom.dump pokeruby.dump
#!/bin/bash
if [ "$#" -ne "2" ];
then
echo "usage: $0 old_name new_name"
exit 1
fi
grep -rl "$1" asm/*.s src/*.c include/*.h sym_*.txt data/*.s data/*.inc | xargs sed -i "s/\b$1\b/$2/g"
#!/bin/perl
# This script converts pokeruby data from assembly to C
# Usage: ./pokeruby-data.pl [file] [type] [line]
use strict;
use warnings;
use Switch;
@camthesaxman
camthesaxman / smbview.c
Created November 4, 2017 17:15
Super Monkey Ball Level viewer
#include <assert.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#define FREEGLUT_STATIC
#include <GL/freeglut.h>
struct Vec3f
{
float x;
#ifndef GUARD_TRAINERS_H
#define GUARD_TRAINERS_H
#define TRAINER_NONE 0
#define TRAINER_SAWYER_1 1
#define TRAINER_GRUNT_1 2
#define TRAINER_GRUNT_2 3
#define TRAINER_GRUNT_3 4
#define TRAINER_GRUNT_4 5
#define TRAINER_GRUNT_5 6
#!/usr/bin/perl
#
# Created by Cameron Hall (camthesaxman) on July 9, 2017
#
# This script calculates the decompilation progress of pokeruby by using the
# pokeruby.map file.
#
(@ARGV == 1)
or die "ERROR: no map file specified.\n";
/*
* tilesplit
* Simple tool to split a PNG into a tileset + tilemap.
*/
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>