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`.
@dvessel
dvessel / G2ME01.sh
Last active November 23, 2022 21:30
Command line launcher for Dolphin emulator. (MacOS)
#!/bin/zsh
# Metroid Prime 2
ignore_dir="$dump/- ignore"
linked_dir="$dump/- linked"
review_dir="$dump/- review"
mkdir -p $ignore_dir $linked_dir $review_dir $load
ln -sf $linked_dir $load
= Resources =
* zsh - http://www.zsh.org/
* ZSH-LOVERS - http://grml.org/zsh/zsh-lovers.html
* manual - http://zsh.sourceforge.net/Doc/Release/index.html
* oh-my-zsh - https://github.com/robbyrussell/oh-my-zsh
* prezo - https://github.com/sorin-ionescu/prezto
* zsh-users - https://github.com/zsh-users
= Functions =

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.

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

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]}
@dvessel
dvessel / selectMenu.scpt
Created July 23, 2011 05:25
AppleScript for selecting menu items. Example: selectMenu({"Finder", "file", "new finder window"}) - "Enable access for assistive devices" must be checked in the Universal Access within System Preferences.
-- `selectMenu`, by Jacob Rus, September 2006 modified by Joon Park, 2011
-- Found on http://hints.macworld.com/article.php?story=20060921045743404
--
-- Accepts a list of form: `{"Finder", "View", "Arrange By", "Date"}`
-- Execute the specified menu item. In this case, assuming the Finder
-- is the active application, arranging the frontmost folder by date.
--
-- This will return true or false depending on availability and null if the menu
-- item doesn't exist at all. Use `checkMenu` to only check the state.
@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 / template.php
Last active March 11, 2021 21:43
Drupal theme registry alterations to allow theme functions, preprocess/process function to be organized like templates (.tpl.php).
<?php
/**
* Theme templates, functions and preprocess/process functions
*
* Theme templates `*.tpl.php` files are stored in the `theme` directory along
* with `*.func.php` and `*.vars.php` files. The latter two are enabled by the
* processing done below. The three types of files can be grouped into
* sub-directories. It is recommended that they are grouped by the modules
* they originate from. Theme specific hooks should be grouped into a folder
@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)