Skip to content

Instantly share code, notes, and snippets.

Iris Ward adituv

Block or report user

Report or block adituv

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@adituv
adituv / unaklz.c
Last active Nov 30, 2019
Prototype of an LZSS decompressor in C for the files in Skies of Arcadia: Legends
View unaklz.c
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef DEBUG
#define DBGLOG(...) fprintf(stderr, __VA_ARGS__)
#else
#define DBGLOG(...)
#endif
@adituv
adituv / BattleData.h
Last active Oct 26, 2019
Skies of Arcadia: Legends disassembly stuff
View BattleData.h
#include <stdint.h>
// TODO - not much known yet
struct BattleDef;
struct ElemData {
uint16_t green;
uint16_t red;
uint16_t purple;
uint16_t blue;
@adituv
adituv / bizhawk-shim.lua
Last active Mar 21, 2019
Bizhawk shim for VBA-rr lua scripts
View bizhawk-shim.lua
-- VBA/Bizhawk shim, to allow lua scripts written for VBA-rr to run in BizHawk.
-- Copy and paste this script into the start of a VBA-rr script to make it run in
-- BizHawk with no further modifications.
-- Changes to BizHawk's built-in tables persist while the lua console window is open.
-- Make sure we don't copy our already-updated objects.
if type(joypad.get) == "userdata" then
bizJoypad = copytable(joypad)
end
@adituv
adituv / README.md
Last active Jan 9, 2019
Triple Triad Card Data (Patch 4.5)
View README.md
@adituv
adituv / Ratio.hs
Created Jan 26, 2018
Show ratios as a mixed fraction
View Ratio.hs
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ViewPatterns #-}
module Text.Show.Ratio(showMixed, showsMixed, showsPrecMixed) where
import Data.Ratio
-- | Convert a @'Ratio' a@ to a readable string, where the ratio is
-- expressed as a mixed fraction in its simplest form. `showsPrecMixed`
-- is designed for use as part of another show implementation, and so
@adituv
adituv / Text.hs
Created Jan 4, 2018
Text to Foundation's String
View Text.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TypeFamilies #-}
module Foundation.Interop.Text where
import Foundation
import Foundation.Array
import Foundation.Bits
import Foundation.Collection
@adituv
adituv / demoteNat.hs
Created Dec 4, 2017
No proxies thanks to -XTypeApplications!
View demoteNat.hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
@adituv
adituv / existentials.idr
Last active Oct 24, 2018
Existential types in idris
View existentials.idr
module Main
import Data.Vect
exists : {k : Type} -> (k -> Type) -> Type
exists t = (b : Type) -> ({a : _} -> t a -> b) -> b
packExists : {k : Type} -> {t : k -> Type} -> {a : k} -> t a -> exists t
packExists x = \b, f => f x
@adituv
adituv / main.cpp
Created Feb 16, 2017
SDL Gamepad Input Stuff
View main.cpp
#include <cstdio>
#include <string>
#include <vector>
#include <SDL.h>
void logJoystickEvent(SDL_Event e);
std::string showHatState(Uint8 hat);
int main(int argc, char* argv[]) {
// Detect first gamepad on which a key is pressed, then log its events.
@adituv
adituv / main.idr
Created Oct 23, 2016
Idris attempt?
View main.idr
module Main
import Data.Vect
toVect : List a -> ( n:Nat ** Vect n a )
toVect Nil = ( 0 ** Nil )
toVect (x :: xs) with (toVect xs)
| (n ** ys) = ( S n ** x :: ys )
listFromString : String -> List Int
You can’t perform that action at this time.