Skip to content

Instantly share code, notes, and snippets.

@romhack
romhack / superRobinHoodCompressionHook.lua
Created March 28, 2021 18:49
fceux lua script for finding compression blocks of graphics offsets in ROM
function CompressionHook()
src = memory.readword(0x001D)
size = memory.getregister("a")
emu.print(string.format("src:0x%x; plain size:0x%x\n", src+0x10,size*0x10))
end
@romhack
romhack / show address.lua
Created March 15, 2021 19:40
lua script for bizhawk to show decompression source and size
local xreg = ''
function srcUpdate()
xreg = xreg .. string.format("\n0x%x", emu.getregister("R0"))
end
function sizeUpdate()
xreg = xreg .. string.format(" 0x%x", emu.getregister("R0"))
end
@romhack
romhack / 2463 - Battle B-Daman (U) gfx compression format.txt
Created March 4, 2021 10:32
2463 - Battle B-Daman (U) gfx compression format
1 11111 YY YYYYYYYY OOOOOOOO OOOOOOOO
| | | |
| | | 16 bit lz offset
| | lz decompress length
| signifies LZ copy
compression flag
1 YYYYY XX XXXXXXXX AAAAAAAA...
| | | |
| | | chunk to repeat
@romhack
romhack / winx.c
Last active April 15, 2018 20:06
Winx decompression routine
unsigned int __fastcall decompressGfx(int a1)
{
int v1; // r4@1
int v2; // r0@1
int v3; // r5@1
int v4; // r6@1
int v5; // r2@1
unsigned int result; // r0@1
int v7; // r9@3
int v8; // r0@3
{-# LANGUAGE ScopedTypeVariables #-}
{-# OPTIONS -O #-}
-- Example of an drawing graphics onto a canvas.
import Graphics.UI.Gtk
import Data.Array.MArray
import Data.Word
import Data.IORef
import Control.Monad ( when )