Skip to content

Instantly share code, notes, and snippets.

@charasyn
charasyn / fix_single_2bpp_battle_bg.ccs
Created October 14, 2024 21:24
Earthbound Patch: Fix graphical corruption when only 1x 2BPP battle BG is used
// Fix graphical corruption when only 1x 2BPP battle BG is used
// cooprocks123e 2024-10-14
// public domain
// This occurs due to a coding bug - we never set the CURRENT_LAYER_CONFIG so
// it defaults to the previously used value (1). This is fine, as long as we
// ensure we're displaying reasonable data on BG4 - which the original game
// doesn't do. It's possible they never tested with only one 2BPP background.
// We can fix this by leavin CURRENT_LAYER_CONFIG at 1, and setting BG4 to
// display a blank tilemap. Luckily, we already have one in BG2, so we can
@charasyn
charasyn / IntroWithFlags.ccs
Created August 8, 2023 20:17
Earthbound Intro.ccs upgrade to support setting flags before loading the map
//The flyover sequence uses warps 150 and 151 by default
//Warp coordinates can be changed in teleport_destination_table.yml
//Flyover Text
Flyover1:
"[02 0C][01 32]The year is 199X[09][00]"
Flyover2:
"[02 0C][01 0C]Onett, a small town in Eagleland[09][00]"
@charasyn
charasyn / customwin_borderstyles.ccs
Created March 26, 2023 17:37
Earthbound custom window border style patch
// customwin_borderstyles.ccs v1
// Allows custom window border styles
// public domain, but credits are appreciated :)
// cooprocks123e 2022-03-01
import asm65816
import ccexpand
import cc_asmcall
/**********************************************************************
***** Custom Styles ***************************************************
# palettepacker.py
# Cooper Harasyn (cooprocks123e) Sept. 2022
# public domain
# References:
# https://en.wikipedia.org/wiki/Simulated_annealing
# https://www.mathworks.com/help/gads/how-simulated-annealing-works.html
from collections import defaultdict
from functools import reduce, lru_cache
#!/usr/bin/env python3
import heapq
import random
from math import ceil
from typing import List
VERBOSE = True
# generate Catador arrays for compression
class ArrayGenerator:
@charasyn
charasyn / README.md
Created March 18, 2022 17:42
PineNote boot selector Uboot patch

Hello! This gist contains a Python script for extracting and inserting default enviroments from/to a PineNote Uboot image. Hopefully this works but I provide no guarantees. Maybe give it a read-over before running it, don't run code from the internet without knowing what it does, etc...

It also contains a patch for adding a boot "menu" selector based on the contents of a file. It will read mmc0:11:/boot/which_os.txt and based on the first character in that file, boot either Android or Linux. In case of an error, it should fallback to Android. Currently, the details for booting Linux are hard-coded in there to boot from mmc0:11, and it's expecting an extlinux config file in /extlinux/extlinux.conf or /boot/extlinux/extlinux.conf.

Hope this is useful!

@charasyn
charasyn / index.html
Last active February 24, 2022 07:16
EarthBound Window Register Address Calculator
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>EarthBound Window Register Address Calculator</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
label {
@charasyn
charasyn / instructions.txt
Created December 23, 2021 02:32
Super Mario World Jailbreak - Install on Wii U / SNES Classic / Switch Virtual Console
=================
= Instructions! =
=================
Get powerup state $05
Use slow ACE to write the following ASM into $F0:
F0: A5 E6 (Obj A)
F2: 8D 69 06
F5: E6 F3
@charasyn
charasyn / Block.py
Last active December 19, 2021 14:53
# CoilSnake code :) pls don't hurt me
import array
import copy
import os
from zlib import crc32
InvalidArgumentError = ValueError
OutOfBoundsError = ValueError
def check_range_validity(range, size):
// Condense title screen letters together
// Useful if you are replacing the letters with your own graphics
// cooprocks123e, public domain
// Letter "E"
ROM[0xC422F8] = short -664 // Starting X pos
ROM[0xC422FB] = short 1187 // X velocity
ROM[0xC42301] = short 32 // Ending X pos
// Letter "A"
ROM[0xC42313] = short -504 // Starting X pos