Skip to content

Instantly share code, notes, and snippets.

View yuriks's full-sized avatar

Yuri Kunde Schlesner yuriks

View GitHub Profile
@yuriks
yuriks / eye_camera_ai.asm
Created August 16, 2023 18:50
Bank $A8 - Morph Ball eye disassembly
asar 1.90
lorom
dpbase 0
optimize dp always
optimize address ram
;;; RAM Variables
samus_collected_items = $7E09A4
@yuriks
yuriks / ips2asm.py
Created November 14, 2022 00:48
ips2asm.py
#!/usr/bin/env python3
#
# Copyright (c) 2022 Yuri Kunde Schlesner (yuriks)
#
# 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:
# Search returns false positives if A isn't actually in ptrs
def create_search(f, table, label_prefix='.l'):
search_bits = len(table).bit_length()
def pad_label(s):
return (s + ':').ljust(len(label_prefix) + search_bits + 2)
def emit_search(prefix, sub_table):
f.write(pad_label(prefix))
if len(sub_table) == 1:
@yuriks
yuriks / room-mod.rs
Last active February 19, 2020 13:15
La-Mulana MSD parser using nom
mod parser;
// Actual range: 11 bits [0, 2048)
pub type TileIndex = u16;
#[derive(Debug)]
pub struct AnimatedTileFrame {
pub frames_wait: u8,
pub tile_index: TileIndex,
}
@yuriks
yuriks / wrap.py
Created March 12, 2019 23:54
Befunge-98 wrapping
dpx = 0
dpy = 0
bx1 = 0
bx2 = 180
by1 = 0
by2 = 909
if 0:
px_s = -2
py_s = 18
dpx = -1
mod decode;
use self::decode::DecodeInstruction;
use self::decode::DecodedArmInstruction;
use scheduler::GeneratorTask;
use scheduler::Task;
use system::AccessWidth;
use system::Bus;
use system::MemoryRequest;
use system::OperationType;
@yuriks
yuriks / main.rs
Created October 7, 2018 12:09
Advance (v1)
#![feature(macro_literal_matcher, min_const_fn)]
extern crate byteorder;
extern crate num;
extern crate sdl2;
use byteorder::ByteOrder;
use byteorder::LE;
use sdl2::event::Event;
use sdl2::keyboard::Scancode;
@yuriks
yuriks / main.c
Last active May 27, 2017 07:17
Quaternion Interpolation Test
#include <3ds.h>
#include <citro3d.h>
#include <string.h>
#include "vshader_shbin.h"
#define CLEAR_COLOR 0x68B0D8FF
#define DISPLAY_TRANSFER_FLAGS \
(GX_TRANSFER_FLIP_VERT(0) | GX_TRANSFER_OUT_TILED(0) | GX_TRANSFER_RAW_COPY(0) | \
GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGBA8) | GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGB8) | \
void MapSharedPages(VMManager& address_space) {
auto cfg_mem_vma = address_space
.MapBackingMemory(Memory::CONFIG_MEMORY_VADDR,
reinterpret_cast<u8*>(&ConfigMem::config_mem),
Memory::CONFIG_MEMORY_SIZE, MemoryState::Shared)
.MoveFrom();
address_space.Reprotect(cfg_mem_vma, VMAPermission::Read);
auto shared_page_vma = address_space
.MapBackingMemory(Memory::SHARED_PAGE_VADDR,
@yuriks
yuriks / playground.rs
Created April 17, 2017 06:01 — forked from anonymous/playground.rs
Shared via Rust Playground
const TEST_DATA : &'static str = "Device: ID=1; Fw=16071801; Evt=2; Alarms: CoilRevesed=OFF; Power: Active=1753W; Reactive=279var; Appearent=403VA; Line: Current=7.35900021; Voltage=230.08V; Phase=-43,841rad; Peaks: 7.33199978;7.311999799999999;7.53000021;7.48400021;7.54300022;7.62900019;7.36499977;7.28599977;7.37200022;7.31899977; FFT Re: 9748;46;303;33;52;19;19;39;-455; FFT Img: 2712;6;-792;-59;1386;-19;963;33;462; UTC Time: 2016-10-4 16:47:50; hz: 49.87; WiFi Strength: -62; Dummy: 20";
fn partition(s: &str) -> (&str, Option<char>, &str) {
const TOKEN_SEPARATORS : &'static [char] = &[':', '=', ';'];
let idx = s.find(TOKEN_SEPARATORS).unwrap_or(s.len());
let (head, tail) = s.split_at(idx);
let mut tail_it = tail.chars();
let separator = tail_it.next();
(head, separator, tail_it.as_str())