Skip to content

Instantly share code, notes, and snippets.

@CryZe
CryZe / day01.rs
Last active December 1, 2020 14:43
Advent of Code 2020 - Day 1
use std::cmp::Ordering;
use anyhow::{bail, Context, Result};
use arrayvec::ArrayVec;
pub fn parse(input: &str) -> impl Iterator<Item = Result<usize>> + '_ {
input
.lines()
.map(|l| l.parse().context("Failed parsing one of the numbers."))
}
@CryZe
CryZe / paper_mario_damage.md
Last active June 14, 2023 08:42
Paper Mario Damage

Paper Mario Damage

Mario

Mario Damage
Base Damage 50 HP = 5
70 HP = 7
75 HP = 7
80 HP = 8
100 HP = 10
105 HP = 10
125 HP = 11
135 HP = 11
140 HP = 13
150 HP = 13
170 HP = 14
175 HP = 14
180 HP = 16
190 HP = 16
200 HP = 17
Hammer +5
Shiny Hammer +11
Golden Hammer +14
undefined4 dSeaFightGame_info_c_init(int this,int param_2,int param_3)
{
int y;
undefined *puVar1;
int x;
int iVar2;
x = 0;
y = 0;
11 I
146 was
15 not
62 alone
87 others
14 are
106 outside
2 the
150 Loop
@CryZe
CryZe / controller.rs
Last active August 5, 2019 00:37
Wind Waker - LiveSplit One Rom Hack
use libtww::game::gamepad;
use libtww::system;
pub const DPAD_LEFT: Button = Button(0);
pub const DPAD_RIGHT: Button = Button(1);
pub const DPAD_DOWN: Button = Button(2);
pub const DPAD_UP: Button = Button(3);
pub const Z: Button = Button(4);
pub const R: Button = Button(5);
pub const L: Button = Button(6);

Auto Splitter Runtime - Language Support

Language Compiler Setup / Limitations Standard Library
TypeScript duktape Needs Web IDE Setup Everything but OS operations
JavaScript duktape Needs Web IDE Setup Everything but OS operations
Rust Rust wasm32-unknown-unknown or -wasi target Everything works with -wasi target
AssemblyScript AssemblyScript No builtin UTF-8 support Has optional WASI library for OS operations
Go tinygo Needs some flags, annotations and wasm-snip of at least io_get_stdout. Everything but OS operations
Python RustPython Needs Web IDE Setup and is slow
@CryZe
CryZe / ComponentSpaceDiagram.txt
Last active June 14, 2023 08:43
livesplit-core Component Space Diagram
^ ╔═══════════════════════════════════════════════════════════════════════════════════════════════╗
| ║ ^ ^ ║
| ║ | min(0.1 * H, 0.35) | 0.1 ║
| ║ v v ║
| ║ ╔════════════════╗ ^ ^ ╔═════════════════════════════╗ ^ ║
| ║ ║ ║ | | ║ ║ | ║
| ║ ║ ║ | | ║ ║ | Ascent ║
| ║ 0.35 ║ ║ | | ║ ║ | ║
H | ║ <----> ║ IMAGE ║ | dynamic
@CryZe
CryZe / component_coordinates.md
Last active June 14, 2023 08:43
Component Coordinates

Coordinate spaces used in livesplit-core

Backend Coordinate Space

The backend has its own coordinate space that ranges from 0 to 1 across both dimensions. (0, 0) is the top left corner of the rendered layout and (1, 1) is the bottom right corner. Since the coordinate space forms a square, the aspect ratio of the layout is not respected.

Renderer Coordinate Space

use {
derive_more::{Add, Mul},
euc::{buffer::Buffer2d, rasterizer, Pipeline, Target},
image::RgbaImage,
livesplit_core::{
self as livesplit_core,
layout::{Layout, LayoutSettings, LayoutState},
rendering::{Backend, Mesh, Renderer, Rgba as LSColor, Transform},
run::parser::composite,
Run, Segment, TimeSpan, Timer, TimingMethod,
@CryZe
CryZe / AHatInTimeAutoSplitter.ts
Last active February 26, 2019 12:41
Fully working A Hat in Time Auto Splitter written in TypeScript
setProcessName('HatinTimeGame.exe')
interface State {
baseAddress: Address | null,
current: GameState | null,
old: GameState | null,
}
interface GameState {
timerState: i32, // +0