Skip to content

Instantly share code, notes, and snippets.

@charasyn
charasyn / monitor-file-size.py
Created February 13, 2018 04:14
A script to monitor a file's size. Run with `monitor-file-size.py file-to-monitor`.
#!/usr/bin/env python3
# A script to monitor a file's size.
# Cooper Harasyn, 2018-02-12
import time
import os
import sys
def Main(args):
if len(args) != 2:
@charasyn
charasyn / pyprint.cpp
Created October 5, 2018 06:57
Python print in C++ (kinda, without named arguments)
// Written by Cooper H., released into the public domain or w/e license gist forces you to use
#include <iostream>
// thanks https://stackoverflow.com/questions/1657883/variable-number-of-arguments-in-c
template <typename T>
static void _print(const T & t) {
std::cout << t;
}
template<typename T, typename... Args>
@charasyn
charasyn / LICENSE
Last active September 24, 2020 18:15
Triangle solver given aspect ratio and hypotenuse length
MIT License
Copyright (c) 2020 Cooper Harasyn
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:
@charasyn
charasyn / MainWindow.as
Last active November 7, 2020 21:35
bsnes-as code for ALTTP USA 1.2 to enable warping in the overworld
MainWindow @mainwindow;
class MainWindow {
private GUI::Window @window;
private GUI::Button @btnSavePos;
private GUI::Button @btnWarpToPos;
MainWindow() {
@window = GUI::Window(140,32,true);
window.title = "Control Window";
@charasyn
charasyn / README.md
Last active April 23, 2021 06:49
Upgrading Debian Jessie to Unstable on iBook G4

Ok, I'm just documenting this here so that if someone has the same struggles as me, they will have a lead on what to do.

Getting packages under Debian Jessie in 2021 (or later)

This is a pain in the butt - in fact, this is the main reason why I updated to Unstable, but I might as well toss it here. Long story short, put this in your sources.list (comment everything else out):

deb http://archive.debian.org/debian jessie main contrib non-free

Additionally, add the following in a new file /etc/apt/apt.conf.d/99unauthenticated:

// This patch is public domain, "as-is" with no warranty
// See https://unlicense.org/
// Author: cooprocks123e, 2021-05-17
import asm65816
// Patch battle routine to avoid killing players
// with displayed HP of 0 when it is rolling up
ROM[0xc2bb74] = {
// fix_psi_list_shuffle.ccs
// This ensures that the cursor in the PSI list always starts at the top-left-most entry.
// This is done using `sort_menu_entries` which performs a sort of the items in the current menu.
// We call this from the `generate_psi_list` function in the original code.
// This patch is public domain, "as-is" with no warranty
// See https://unlicense.org/
// Author: cooprocks123e, 2021-05-19
import asm65816
@charasyn
charasyn / expand_flags.ccs
Last active October 18, 2021 00:39
EarthBound flag expansion standalone patch
// expand_flags.ccs - v2 (fixed battle music bug)
// developed by cooprocks123e with code from stochaztic
// bug testing by Messianic
// use it how you want. or don't, that's fine too
import asm65816
define NEW_PERSISTENT_RAM_LOCATION = 0x7EB600
define NEW_PERSISTENT_RAM_SIZE = 0x9D
@charasyn
charasyn / README.md
Created May 30, 2021 04:40
Earthbound VWF engine profiling

Summary

I took a debug trace from Earthbound of loading the status screen, and analyzed it.

The sorted-regions.txt file here is a list of routines sorted by the amount of time they took overall.

The *.log files contain the number of times each instruction was executed in the most time consuming routines, as well as the amount of time spent and the average time spent per.

This should be used to get an idea of which functions to optimize and where, in order to speed up VWF rendering.

// cooprocks123e, 2021
// 100% public domain meme
// ... well, as much as this dance is public domain
// https://www.youtube.com/watch?v=om_POD45fCs
// https://www.youtube.com/watch?v=BB2WTMpXjS4
// use the other bits of the code however you want though
// thanks to everyone on the PK Hack discord <3
import movscr_codes // Movement script code defines
import asm65816