This file contains 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
# Problem: | |
# Making an NES game, want smooth motion but don't want to store sub-pixel precision. | |
# Solution: | |
# Approximate smooth motion in discrete steps. | |
# | |
# Investigate a few methods, and compare them by smoothness. | |
# Use standard deviation as a measure of smoothness. | |
# (Lower deviation total is better.) | |
# | |
# Result: |
This file contains 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
# dumps PAK files from the game Abyss Boat by Leaf | |
import os | |
import struct | |
def printable(d): | |
s = "" | |
for c in d: s += chr(c) if (c >= 0x20 and c <= 126) else '.' | |
return s |
This file contains 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 | |
# | |
# Automatic Movie Thumbnail Generator | |
# | |
# Scans a folder, and generates a thumbnail image for every movie found. | |
# Uses a grid layout that attempts to maximize utilized space while | |
# fitting under a given maximum image size, and having at least as many | |
# frames as requested. | |
# |
This file contains 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
# Action name and trigger conditions. | |
# workflow_dispatch means: this can be manually re-triggered, and not just by push/pr. | |
name: Batch File Continuous Integration | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: |
This file contains 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
# Dumps image data from Milva DOS game, | |
# as well as Desafio and Kick Boxing Street | |
# from Ediciones Manali. | |
# | |
# https://archive.org/details/msdos_Milva_1993 | |
# https://www.old-games.ru/game/4884.html (Desafio) | |
# https://www.old-games.ru/game/4532.html (Kick Boxing) | |
# | |
# If you successfully use this for their other games, | |
# send me the dump list and I can add it. |
This file contains 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 | |
# | |
# This scrips attempts to find suitable subtitles in video collections, | |
# and will copy the best candidate into the same folder as the video, | |
# with the same filename as the video with the subtitle's extension. | |
# | |
# If a video already has a subtitle file in this place, it will not overwrite it. | |
# | |
# I can also delete directories and files as automatic cleanup. |
This file contains 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 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 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 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): |
NewerOlder