Skip to content

Instantly share code, notes, and snippets.

@dvessel
dvessel / link-loaded-textures
Last active November 23, 2022 21:30
Throw it into a bin path, cd into it and `chmod +x link-loaded-textures`.

Tested Settings

hacks tab advanced tab
Graphic options, hacks tab. Displayed with default settings for both tabs. Graphic options, advanced tab.

Recommended settings

Tested on a 2021 16" MacBook Pro M1 Max. These settings should apply to other M1 Mac's, relatively speaking.

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}

Supported compression types in Dolphin

Taken from S3_Texture_Compression (Wikipedia) and condensed to what's relevant to Dolphin's texture support.

Codecs

There are five three variations of the S3TC algorithm (named DXT1 through DXT5, referring to the FourCC code assigned by Microsoft to each format), each designed for specific types of image data. All convert a 4×4 block of pixels to a 64-bit or 128-bit quantity, resulting in compression ratios of 6:1 with 24-bit RGB input data or 4:1 with 32-bit RGBA input data. S3TC is a lossy compression algorithm, resulting in image quality degradation, an effect which is minimized by the ability to increase texture resolutions while maintaining the same memory requirements. Hand-drawn cartoon-like images do not compress well which usually generate artifacts.

Like many modern image compression algorithms, S3TC only specifies the method used to decompress images, allowing implementers to design the compre

@dvessel
dvessel / fbrew
Last active September 6, 2023 19:00
search through 🍺 formulae/casks with fzf. `brew install fzf jq` first. Requires tapped install.
#!/usr/bin/env zsh
set -e
# Set up possible first parameter commands.
cmds_any=(
install info abv edit uses deps desc fetch cleanup options home homepage log
audit cat formula livecheck style unbottled unpack
)
cmds_installed=(
@dvessel
dvessel / chd-helpers.sh
Last active July 18, 2023 07:22
Helper functions to bulk convert bin/cue or gdi files to chd's and back.
#!/bin/zsh
# - Requires homebrew. https://brew.sh
# - Converted files will be moved to the current working directory in all cases.
# - You can pass the starting directory for fzf search functions.
# - Pass in glob patterns for the standalone function to convert in bulk.
# For example, to convert gdi's in a sub-directory: chd.create */*.gdi
alias chd.fzf.create='_fzf-paths-to chd.create f ".(gdi|cue)$"'
alias chd.fzf.extract-to-cue='_fzf-paths-to chd.extract-to-cue f .chd$'
@dvessel
dvessel / oeadvscan
Last active January 12, 2021 17:49
Manage MAME files for OpenEmu Arcade core. Make it executable and unquarantine: `chmod +x oeadvscan && xattr -d com.apple.quarantine oeadvscan`
#!/bin/zsh
#
# For use on MAME files managed by OpenEmu.
# advscan roms/disks/samples verifies and repairs.
#
# All options apply to roms, disks (chd) and samples.
# Options:
#
# scan : Generates a report specific to your collection. (default)
@dvessel
dvessel / oemame.sh
Last active January 5, 2021 01:41
Shell functions for scanning/repairing MAME ROMs for OpenEmu on a Mac. Copy into your .zshrc file. Not tested on bash.
# advscan MAME roms/disks/samples scans and repairs.
function oemame.scan {
local command=${@:-scan}
local base_dir=$HOME/Library/Application\ Support/OpenEmu
local version=${${${:-`defaults read \
$base_dir/Cores/MAME.oecoreplugin/Contents/Info.plist CFBundleVersion`
}/./}%%.*}
# Go back to current directory when done.
# advscan can't resolve paths when run outside advscan.rc.
@dvessel
dvessel / oeshader.sh
Created January 1, 2021 18:27
Shell functions to manage OpenEmu shaders. Copy into your .zshrc file. Requires fzf. Not tested in bash.
# OpenEmu shader functions. Requires fzf.
function oeshader.search {
defaults find videoShader.openemu | grep $@
}
function oeshader.copy {
local source=`oeshader.ls ${@:-1} | fzf --header="Select source:"`
if [[ -n $source ]]; then
oeshader.search -oE "system\.[a-z0-9]*" | sort -u |
fzf -m --header="Apply settings from \"${source##*.}\"." |
@dvessel
dvessel / Share Screen Shot.scpt
Last active August 29, 2015 13:59
AppleScript to capture screen shots and upload them with SCP.
-- Requires public key encryption setup for the remote server.
-- This also assumes LaunchBar is installed.
property the_url : "http://example.com/path/"
property save_folder : "/Users/bob/Sites/example.com/path/"
property scp_remote : "bob@example.com:/www/example.com/path/"
on run
set tmp_name to do shell script "date +'%Y-%m%d-%H%M%S'" & ".png"