Skip to content

Instantly share code, notes, and snippets.

View jaames's full-sized avatar
🐳
~

James Daniel jaames

🐳
~
View GitHub Profile
@jaames
jaames / jaames-shiki-theme.json
Created June 2, 2025 18:53
Custom Shiki.js theme that uses CSS variables for highlighting - used for my personal site (https://jaames.co.uk)
{
"colors": {},
"displayName": "jaames.co.uk",
"name": "",
"semanticHighlighting": true,
"tokenColors": [
{
"settings": {
"background": "var(--syntax-bg)",
"foreground": "var(--syntax-text)"
@jaames
jaames / totk-schema-qr-notes.md
Created April 5, 2025 20:22
Tears of the Kingdom Autobuild QR Code Reverse Engineering

The upcoming "Nintendo Switch 2 Edition" version of Tears of the Kingdom introduces - among other things - a new feature that lets users share their Autobuild creations as QR codes.

QR coodes are used with the Nintendo Online mobile app.

During a Treehouse Live livestream, one of these QR codes was shown. This could be decoded to the URL https://s.nintendo.com/dd1/znca/game/5080866659500032?path=%2Ftotk%2Fschema-stones%2Ff17f67a7-31b2-428f-bac1-13d3a1641125%2Fadd.

The dd1 here indicates that this is on Nintendo's development/staging environment, so presubably this is the reason why the link 404's if you don't have access to this.

Unclear at this stage as to whether more information can be gleaned about Autobuild schema without requiring the app. Just wanted to document this for now so I can return to it.

@jaames
jaames / shiki-playdate-lua.json
Created October 20, 2024 20:40
Shiki syntax highlighter language definition for Playdate-flavoured Lua.
{
"information_for_contributors": [
"This file is based on https://github.com/shikijs/textmate-grammars-themes/blob/main/packages/tm-grammars/grammars/lua.json",
"With changes made to support Playdate-specific Lua additions such as extra table methods and assignment operators"
],
"version": "1",
"name": "Lua",
"scopeName": "source.lua",
"patterns": [
{
@jaames
jaames / anishare-file-format.md
Last active October 19, 2024 19:42
Anishare (https://anishare.co/) animation file format spec (reverse engineered)

⚠️ This spec is not official, and was reverse engineered on 19th October 2024. It may become out of date in the future as Anishare develops.

Header

Files always begin with a 50-byte header.

Offset Type Details
0 char[8] Magic ident "ANISHARE"
8 uint8 Version number (currently 0)
@jaames
jaames / shapeTool.ts
Created November 27, 2022 19:49
projective shape tool demo
export const dist = (x1: number, y1: number, x2: number, y2: number) => Math.sqrt(Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2));
export class LineSegment {
x0: number = 0;
y0: number = 0;
x1: number = 0;
y1: number = 0;
constructor (x0: number, y0: number, x1: number, y1: number) {
this.x0 = x0;
@jaames
jaames / crc32.lua
Last active September 17, 2022 14:32
crc32 function for playdate lua. only works on strings.
local CRC32_LUT = nil
local function crc32_init()
if not CRC32_LUT then
CRC32_LUT = table.create(255, 0)
local rem
for i = 0, 255 do
rem = i
for j = 1, 8 do
if (rem & 1 == 1) then
@jaames
jaames / playdate-prism-highlight.js
Created August 5, 2022 20:15
Prism.js syntax highlighting settings for Playdate-flavour Lua
Prism.languages.lua = {
'comment': /^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,
// \z may be used to skip the following space
'string': {
pattern: /(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[^z]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,
greedy: true
},
'number': /\b0x[a-f\d]+(?:\.[a-f\d]*)?(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|(?:\.\d*)?(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,
'keyword': /\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,
'function': /(?!\d)\w+(?=\s*(?:[({]))/,
@jaames
jaames / PdvParser.ts
Last active July 6, 2022 20:33
Basic Playdate .PDV video format parser in Typescript (doesn't handle frame type 3 yet)
import { unzlibSync } from 'fflate';
function assert(condition: boolean, errMsg: string = 'Assert failed'): asserts condition {
if (!condition) {
console.trace(errMsg);
throw new Error(errMsg);
}
}
function readChars(data: DataView, ptr: number, size?: number) {
// run in node.js, version 16.0 or later
// assumes sound effects will be in a folder called 'pda', located next to the script (replace all instances of './pda' to change this)
const fs = require('fs');
function assert(condition, errMsg = 'Assert failed') {
if (!condition) {
console.trace(errMsg);
throw new Error(errMsg);
}
@jaames
jaames / playdate_season_1.md
Created May 23, 2022 18:11
Playdate Season 1 game bundle IDs. Enjoy :)
com.panic.b360
com.tpmcosoft.battleship
com.a-m.beats-bleeps-boogie
com.radstronomical.CasualBirder
com.uvula.crankin
com.crookedpark.demonquest85
com.samanthazero.echoicmemory
com.davemakes.execgolf
com.serenityforge.elevator