Skip to content

Instantly share code, notes, and snippets.

View TakuikaNinja's full-sized avatar

Takumi Grainger TakuikaNinja

View GitHub Profile
@TakuikaNinja
TakuikaNinja / battlebox_lister.py
Created May 29, 2026 10:11
Python script to list files in FC Battle Box save data
#!/usr/bin/env python3
"""
File lister for the IGS Battle Box (FC)
"""
def reverse_bits(x):
y = 0
for i in range(8):
y = (y << 1) | (x & 1)
x >>= 1
@TakuikaNinja
TakuikaNinja / turbofile_stf_lister.py
Last active May 28, 2026 08:12
Python script to list files in SFC Turbo File Twin (STF) save data
#!/usr/bin/env python3
"""
File lister for SFC Turbo File Twin (STF)
"""
class STF:
FAT_SIZE = 0x1000
BLOCK_SIZE = 0x0400
file_allocation_table = bytearray()
blocks = []
@TakuikaNinja
TakuikaNinja / turbofile_lister.py
Created May 27, 2026 05:44
Python script to list files in FC Turbo File & SFC Turbo File Twin (TFII) save data
#!/usr/bin/env python3
"""
File lister for FC Turbo File & SFC Turbo File Twin (TFII)
"""
def reverse_bits(x):
y = 0
for i in range(8):
y = (y << 1) | (x & 1)
x >>= 1
@TakuikaNinja
TakuikaNinja / FDSWaveSnooper.lua
Created May 15, 2026 11:45
Mesen2/MesenCE Lua Script: FDS Wavetable Snooper
-----------------------
-- Name: FDS Wavetable Snooper
-- Author: TakuikaNinja
-----------------------
-- Snoops FDS wavetable RAM writes for ripping purposes.
-- Right mouse click toggles linear interpolation between points.
-- Log format is compatible with FamiTracker (0-63, space separator).
-----------------------
local consoleType = emu.getState()["consoleType"]
@TakuikaNinja
TakuikaNinja / VsDIPSwitch.lua
Created March 1, 2026 03:20
Vs. System DIP Switch Setter for Mesen2
----------------------------------------------------------------------------------------------
-- Name: Vs. System DIP Switch Setter
-- Author: TakuikaNinja
----------------------------------------------------------------------------------------------
-- Simulates the Vs. System's DIP switch settings, for games not tracked in Mesen2's database.
----------------------------------------------------------------------------------------------
-- DIP switch setting (8 bits)
-- this is reversed from typical DIP switch ordering
-- rightmost bit is switch 1, leftmost bit is switch 8
@TakuikaNinja
TakuikaNinja / NamcoSerial_SRAM.lua
Created November 1, 2025 08:08
Mesen2 Lua Script: Namco Serial Checker Interface (SRAM)
-----------------------
-- Name: Namco Serial Checker Interface (SRAM)
-- Author: TakuikaNinja
-----------------------
-- Simulates a serial interface used by a few of Namco's FC/NES games which use battery-backed SRAM.
-- It attempts to receive/send data and verify it.
-- If successful, SRAM contents are then verified.
-- The screen colour is set to blue if successful, otherwise it attempts to reinitialise SRAM.
-- The screen colour is set to yellow if the reinitialisation succeeds, otherwise it is set to red.
--
@TakuikaNinja
TakuikaNinja / NamcoSerial.lua
Last active August 17, 2025 20:27
Mesen2 Lua Script: Namco Serial Checker Interface
-----------------------
-- Name: Namco Serial Checker Interface
-- Author: TakuikaNinja
-----------------------
-- Simulates a serial interface used by some of Namco's FC/NES games.
-- Games attempt to receive/send data and verify it.
-- If successful, partial PRG/CHR checksums are calculated and verified.
-- The screen colour is set to magenta/green during this process.
-- This interface predates the IPL interface used by their FDS games. (1986~1987)
--