Skip to content

Instantly share code, notes, and snippets.

@TellowKrinkle
TellowKrinkle / IntelForceHighPower.cpp
Created September 21, 2022 04:27
Intel Force High Power
// Force Intel GPUs into max power state on macOS
// Based off decompilation of Apple's MTLReplayer GTPMService.xpc
// clang++ -std=c++17 -O3 -framework IOKit IntelForceHighPower.cpp -o IntelForceHighPower
#include <cstdio>
#include <optional>
#include <IOKit/IOKitLib.h>
enum AGPMType {
AGPMTypeIG = 2,
#include <stdio.h>
#include <vector>
#include <string>
#include <iconv.h>
#include <filesystem>
static const iconv_t iconv_toutf = iconv_open("UTF-8", "CP932");
static std::string iconv_convert(const char* src, size_t len, iconv_t conv) {
std::string out;
char buffer[512];
@TellowKrinkle
TellowKrinkle / absolute-importer.rb
Last active May 14, 2021 04:57
Converts relative C/C++ imports that reference parent folders to absolute imports
#!/usr/bin/env ruby
require "pathname"
$cwd = Pathname::new(".").expand_path
ARGV.each do |fname|
begin
path = Pathname::new(fname).expand_path
parent = path.parent
@TellowKrinkle
TellowKrinkle / vcxproj_filters_renamer.rb
Last active May 10, 2021 02:36
Script for PCSX2 to rename files to match a `.vcxproj.filters` file and update includes
#!/usr/bin/env ruby
require "fileutils"
require "nokogiri"
require "optparse"
require "pathname"
$absolutes = []
parser = OptionParser.new do |opts|
@TellowKrinkle
TellowKrinkle / CPUWakeupSpeedTester.cpp
Created May 9, 2021 04:47
CPU Wakeup Speed Tester
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
extern "C" size_t test(size_t amt);
template <size_t Len, size_t Iters>
struct Tester {
@TellowKrinkle
TellowKrinkle / GSdxShufflePlanner.html
Last active April 5, 2021 22:40
Swizzle emulation planning tool for GSdx
<!DOCTYPE html>
<html>
<head>
<title>GSdx Shuffle Planner</title>
</head>
<body>
<textarea id="input" oninput="refresh()"></textarea>
<table id="SrcID"></table>
<table id="DstID"></table>
<p>
@TellowKrinkle
TellowKrinkle / GSSwizzleVisualizer.html
Last active February 7, 2021 02:02
PS2 GS Memory Swizzle Visualizer
<!DOCTYPE html>
<html>
<head>
<title>GS Memory Swizzle Visualizer</title>
<style>
.label {
text-align: center;
font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;
}
.pixel {
@TellowKrinkle
TellowKrinkle / NXAEnc.c
Last active October 9, 2022 18:13
NXA encoder (compile with -lopus)
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <getopt.h>
#include <opus/opus.h>
struct NXAHeader {
uint8_t magic[4];
uint32_t version;
@TellowKrinkle
TellowKrinkle / HiguMeiExtractor.py
Created November 28, 2020 04:26
Extractor for unity3d files from Higurashi Mei
import unitypack
import unitypack.utils
import collections
import sys
import os
from unitypack.engine.texture import TextureFormat
from PIL import ImageOps
ASTC_MAP = {
TextureFormat.ASTC_RGB_4x4: (0x93B0, 0x1907),
@TellowKrinkle
TellowKrinkle / PSPSCEDecoder.java
Created April 10, 2020 02:56
Ghidra PSP SCE Decoder
// Reads the list of syscall functions from a PSP rom and marks them in Ghidra
//@author TellowKrinkle
//@category PSP
import java.util.Map;
import java.util.HashMap;
import ghidra.app.script.GhidraScript;
import ghidra.program.model.util.*;
import ghidra.util.exception.InvalidInputException;
import ghidra.program.model.reloc.*;