This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PIL.Image | |
import os | |
def decode_file(filename): | |
print(filename) | |
f = open(filename,"rb").read() | |
print("Header: %02X %02X" % (f[0],f[1])) | |
pal = f[2:2+(16*3)] | |
offset = 2 + (16*3) | |
count = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# generates SVG diagram: | |
# https://commons.wikimedia.org/wiki/File:Affine_texture_mapping_tri_vs_quad.svg | |
import math | |
GRID = 8 | |
FTW = 100 # top board width | |
FBW = 200 # bottom board width | |
FH = 156 | |
COLBG = "#B4B3D2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A recreation of: | |
# https://commons.wikimedia.org/wiki/File:Perspective_correct_texture_mapping.jpg | |
# | |
# To give a simple code demonstration of perspective correction, | |
# and simple barycentric triangle coordinates. | |
# | |
# Note that this is a "naive" implementation, | |
# and the resulting floating point errors will produce some rough edges on the checkerboard texture. | |
# It would be more efficient and more numerically stable to rasterize the triangle instead, | |
# but this demonstrates a simple way to generate coordinates without the additional complexity of rasterization. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sprite / Map dumper for Vigilance on Talos V (19960 | |
# place in "dump" folder within Talos install directory and run | |
import os | |
import struct | |
import PIL.Image | |
DEFAULT_BG = 13 # magenta | |
def filename_flatten(f): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sprite / Map dumper for Sinaria: Lost in Space (1994) | |
# place in "dump" folder within Sinaria install directory and run | |
import os | |
import struct | |
import PIL.Image | |
#DEFAULT_BG = 27 # red | |
DEFAULT_BG = 140 # magenta |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extracts sprites from the Korean DOS game Ice Kiss | |
# First run icekiss_sprite_file_extract.py to create the sprite bin files | |
# Also, take a screenshot of the gameplay with DOSBox to make a PNG with the correct palette | |
# Then run this to extract graphics from them | |
import PIL.Image | |
screenshot = PIL.Image.open("screenshot.png") # use for palette | |
def decode_file(filename): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Terranigma data compressor and decompressor | |
# Brad Smith, 2022-02-07 | |
# https://rainwarrior.ca | |
# | |
# Format reference: | |
# https://www.terranigma.be/index.php/Compression | |
import sys | |
def usage(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# | |
# Pasti .STX Atari ST image to .ST image converter. | |
# Creates an ST file using the sectors found in an STX, and reports missing/error sectors. | |
# | |
# Usage: | |
# stx_to_st("a.stx") | |
# stx_to_st("in.stx","out.st",tracks,sides,sectors) | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Files: | |
# Iga Ninden Gaiou (Japan).chd CRC32 1243A2DE | |
# | |
# Use chdman to extractcd: | |
# ing.bin CRC32 07E9BA8D | |
romin = "ing.bin" | |
romout = "inge.bin" | |
rom = open(romin,"rb").read() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# | |
# Pasti .STX Atari ST disk image merger | |
# Allows combining of tracks from separate STX files, | |
# for cases where we can only dump part of a disk at a time. | |
# | |
# Usage: | |
# stx_main("a.stx") | |
# stx_add("b.stx") |