Skip to content

Instantly share code, notes, and snippets.

Christopher Serr CryZe

View GitHub Profile
@CryZe
CryZe / component_coordinates.md
Last active Mar 18, 2019
Component Coordinates
View component_coordinates.md

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

View livesplit_core_software_renderer.rs
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 Feb 26, 2019
Fully working A Hat in Time Auto Splitter written in TypeScript
View AHatInTimeAutoSplitter.ts
setProcessName('HatinTimeGame.exe')
interface State {
baseAddress: Address | null,
current: GameState | null,
old: GameState | null,
}
interface GameState {
timerState: i32, // +0
@CryZe
CryZe / a_hat_in_time.rs
Created Jan 16, 2019
WebAssembly based Auto Splitter for A Hat in Time written in Rust.
View a_hat_in_time.rs
use asl::{ASLState, Address};
use parking_lot::Mutex;
use scroll::{Pread, LE};
#[derive(ASLState)]
#[Process = "HatinTimeGame.exe"]
#[allow(dead_code)]
struct EmptyState {}
#[derive(Debug, Default)]
View day-18.rs
use hashbrown::hash_map::{Entry, HashMap};
use packed_simd::{m8x64, shuffle, u8x64};
use std::{
cmp::{Eq, PartialEq},
hash::{Hash, Hasher},
mem,
rc::Rc,
};
fn shuffle_right(v: u8x64) -> u8x64 {
View day-09.rs
use std::collections::VecDeque;
struct Circle {
deque: VecDeque<u32>,
}
impl Circle {
fn with_marbles(last_marble: u32) -> Self {
let mut deque =
VecDeque::with_capacity((last_marble + 1 - (last_marble / 23) * 2) as usize);
View day-09-slab.rs
use slab::Slab;
struct Marble {
value: u32,
before: u32,
after: u32,
}
struct Circle {
storage: Slab<Marble>,
View day-05.rs
use arrayvec::ArrayVec;
use rayon::prelude::*;
fn collapse(input: impl IntoIterator<Item = u8>, buf: &mut ArrayVec<[u8; 16384]>) {
let mut top_byte = b'\0';
for byte in input {
if top_byte ^ 0x20 == byte {
buf.pop();
top_byte = buf.last().cloned().unwrap_or_default();
} else {
View day-05-part1.asm
day_05::part1:
push rsi
mov eax, 16392
call __chkstk
sub rsp, rax
mov byte, ptr, [rsp, +, 2], 0
mov word, ptr, [rsp], 0
xor eax, eax
test rcx, rcx
je .LBB4_15
View day-04.rs
use chrono::{offset::TimeZone, DateTime, Duration, Timelike, Utc};
use hashbrown::HashMap;
use logos::{Lexer, Logos};
#[derive(Copy, Clone, PartialEq, Logos)]
enum Token {
#[end]
End,
#[error]
Error,
You can’t perform that action at this time.