Skip to content

Instantly share code, notes, and snippets.

View deckarep's full-sized avatar
🎯
Focusing

Ralph Caraveo deckarep

🎯
Focusing
View GitHub Profile
@deckarep
deckarep / README.md
Created April 11, 2025 03:48
SCI-Tools Python Transpiler Notes

Script Transpiler (by deckarep)

First of all, the Python3 transpiler is built on top (read: kinda-hacked onto) sluicebox's huge body of work. Most of the hardwork was done by him to unleash a decompiler that as far as I can tell and tested, is damn near complete. This work wouldn't exist without his hard work and therefore most of the credit goes to him as well as those who came before him with respect to SCI reverse engineering. Please read the Tools (next section below) by sluicebox for context on his original decompiler work.

With that said, can we convert Sierra's SCI Script into something runnable and is it even remotely possible?

  • Step 1: Transpile SCI Script to Python3
@deckarep
deckarep / i16.py
Created April 11, 2025 03:31
Python3 Int16 wrapper class proposal for the SCI transpolar
class Int16:
def __init__(self, value):
self.value = value & 0xFFFF # Always keep it 16-bit
def _wrap(self, result):
return Int16(result)
def signed(self):
return self.value if self.value < 0x8000 else self.value - 0x10000
@deckarep
deckarep / ExtractWavs.py
Created June 28, 2024 17:34
Extracts all .wav audio from Leisure Suit Larry Casino - originally written by @Doomlazer
# Original credit: @doomlazer
# https://github.com/Doomlazer/TrivialQuest/blob/main/audio/jokes/ExtractWavs.py
# Extract wav files from Larry's Casino audio.vol
# Sound effects can also be dumped from resources.vol
# jokes are 71.wav - 183.wav
#
# command to convert wav to mp3:
# for f in *.wav; do ffmpeg -i "$f" "${f%.wav}.mp3"; done
import struct
@deckarep
deckarep / rmSidewalk.py
Last active January 25, 2024 19:11
WTF - SCI Script to Python3 - experiment to modernize the SCI source code...
# Hello, before anyone freaks out this is just an experiment...to see how far the rabbit hole can go.
# Original .sc file for ref: https://github.com/EricOakford/SCI-Decompilation-Archive/blob/master/lsl1/src/rmSidewalk.sc
# SCI script is really interesting to me, but largely outdated
# Based on a combination of Small-Talk and Lisp, with Prefix notation for expressions...it can get unwieldy
# to read at least for me. Boat-load of paranthesis and expressions that don't read like normal infix notation.
# But,
@deckarep
deckarep / align_asm.py
Created November 10, 2023 02:02
A quick and dirty work-in-progress script that can help align blocks of assembly language since doing it manually is tedious and boring and hurts my eyes.
#!/usr/bin/env python3
import sys
class NasmAligner:
def __init__(self, start_address=0):
self.alignments = {'DB': 1, 'DW': 2, 'DD': 4, 'DQ': 8}
self.output_lines = []
self.current_address = start_address
@deckarep
deckarep / alignof.py
Created November 9, 2023 04:57
A stupid simple Python utility to quickly print out the alignment of an integer provided on the command line.
import sys
def check_alignment(val):
alignments = {
'2-byte': val & 0x1 == 0,
'4-byte': val & 0x3 == 0,
'8-byte': val & 0x7 == 0,
'16-byte': val & 0xF == 0,
'32-byte': val & 0x1F == 0,
'64-byte': val & 0x3F == 0,
@deckarep
deckarep / main.go
Last active October 11, 2022 20:28
KQ6 - Hires Portrait Extractor
package main
import (
"encoding/binary"
"fmt"
"image"
"image/color"
"image/png"
"io/ioutil"
"log"
@deckarep
deckarep / rand.6502.asm
Created January 23, 2021 06:49
6502 assembly - simple RAND subroutine
rand equ $04
;uint8_t next_rnd(void)
;{
; static uint8_t rnd;
; rnd = rnd * 5 + 17;
; return rnd;
;}
; returns a pseudo rand store at memory location: rand
@deckarep
deckarep / main.go
Created July 2, 2020 01:23
Protobuf Talk: Populating and serializing a dog into bytes
package main
// to run: go run *.go
import (
fmt "fmt"
"log"
proto "github.com/gogo/protobuf/proto"
)
@deckarep
deckarep / dog.proto
Created July 2, 2020 01:22
Protobuf Talk: Dog schema definition
syntax = "proto2";
option go_package = "main";
message Dog {
required int32 owner_id= 1;
optional string breed = 2;
optional float height_in = 3;
optional string color = 4;
}