Skip to content

Instantly share code, notes, and snippets.

@thrimbor
thrimbor / insignia.py
Last active January 3, 2021 19:54
XBL infodump GDB script
# XBL function call info dump script for usage with xemu and gdb
#
# Usage:
# 1. Generate symbol list like this: XbSymbolDatabaseCLI default.xbe >symbols.txt
# 2. Start xemu with the "-s" parameter
# 3. Run gdb from the folder where your symbols.txt resides
# 4. Run "source insignia.py" in gdb
# 5. Done. Calls to XOnlineMatchSearchResultsLen, XOnlineMatchSearch and XOnlineMatchSessionCreate will now be logged in the gdb window.
import gdb
#include <hal/debug.h>
#include <hal/video.h>
#include <windows.h>
// The nullpointer deref is in its own function, because LLVM can't catch
// asynchronous exceptions in the same frame that they're thrown in. This is a
// documented MSVC-incompatibility in LLVM, see:
// https://clang.llvm.org/docs/MSVCCompatibility.html#abi-features
static void nullptr_deref (void)
{
#include <hal/debug.h>
#include <hal/video.h>
#include <string>
#include <vector>
#include <windows.h>
#include <stdlib.h>
#include <threads.h>
extern "C" {
int wombat () {
#include <hal/debug.h>
#include <hal/xbox.h>
#include <hal/video.h>
#include <windows.h>
#include "stdio.h"
#include "string.h"
#include <SDL.h>
int main(void)
{
@thrimbor
thrimbor / gist:0b7990d9d50ce8f5f9306d4cb1f53e8f
Created January 16, 2020 17:13
nxdk winapi file attribute tests
#include <hal/debug.h>
#include <hal/video.h>
#include <windows.h>
#include <assert.h>
#include <nxdk/mount.h>
// WARNING: MODIFIES HDD CONTENT!
// Requires stock dash files for testing
int main(void)
#include <hal/debug.h>
#include <hal/video.h>
#include <windows.h>
#include <malloc.h>
#include <string.h>
// tests whether alloca overlaps other parts of the stack
// by writing into an alloca allocated buffer and then
// checking other variables on the stack. Also tests
// whether we can return properly afterwards
#include <hal/debug.h>
#include <hal/video.h>
#include <windows.h>
// expected behavior:
// threads 1, 3, 4, 5 lock, threads 3, 4, 5 unlock (in any order)
// 5 second pause
// thread 1 unlocks
// thread 2 locks
// 5 second pause
@thrimbor
thrimbor / gist:7d8515ad443edafc400fc046e414329e
Created January 6, 2020 01:43
Tests for nxdk InitOnce* API
#include <assert.h>
#include <hal/debug.h>
#include <hal/video.h>
#include <windows.h>
// expected output:
// > failing function running
// > failing function running
// > succeeding function running
// > tests done
@thrimbor
thrimbor / ac_proton.sh
Created July 25, 2019 19:29
Assetto Corsa on Proton
# Based on https://pastebin.com/f5eUDcr0, but fixed
export WINEPREFIX=~/SteamLibrary/steamapps/compatdata/244210/pfx # change if your steam library is somewhere else
winecfg #change to windows XP -> OK
wine uninstaller # uninstall all stuff related to .NET or Mono
wget 'http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe'
wine ~/dotNetFx40_Full_x86_x64.exe /q
winecfg # change to Windows 7, libraries -> add "mscoree" -> pick "mscoree" from list -> clicke edit -> set to "Native (Windows)" -> click OK and OK
wget 'http://download.microsoft.com/download/9/E/6/9E63300C-0941-4B45-A0EC-0008F96DD480/NDP471-KB4033342-x86-x64-AllOS-ENU.exe'
@thrimbor
thrimbor / main.c
Created May 21, 2019 10:03
WinAPI file finding test code
#include <stdio.h>
#include <fileapi.h>
#include <hal/winerror.h>
#include <xboxrt/debug.h>
#include <pbkit/pbkit.h>
#include <hal/xbox.h>
void listAll(const char * path)
{
WIN32_FIND_DATA findFileData;