Skip to content

Instantly share code, notes, and snippets.

@aixxe
aixxe / virtuals.h
Created February 7, 2017 11:43
Various virtual method table helper functions.
inline void**& GetVirtualTable(void* baseclass) {
return *reinterpret_cast<void***>(baseclass);
}
inline void* GetVirtualFunction(void* vftable, size_t index) {
return reinterpret_cast<void*>(GetVirtualTable(vftable)[index]);
}
template <typename Fn> inline Fn GetVirtualFunction(void* vftable, size_t index) {
return reinterpret_cast<Fn>(GetVirtualTable(vftable)[index]);
@aixxe
aixxe / autosplitter.js
Last active February 6, 2017 15:52
Hastily written video splitter thing I previously used for lody's past broadcasts.
#!/bin/node
const fs = require("fs");
const path = require("path");
const async = require("async");
const mkdirp = require("mkdirp");
const minimist = require("minimist");
const child_process = require("child_process");
var argv = minimist(process.argv.slice(2));

Keybase proof

I hereby claim:

  • I am aixxe on github.
  • I am aixxe (https://keybase.io/aixxe) on keybase.
  • I have a public key whose fingerprint is 7BFF 6C9A CFCE 946D 37AB D883 B573 FC59 76EE A726

To claim this, I am signing this object:

@aixxe
aixxe / InterfaceReg.cpp
Created December 18, 2016 03:26
Get interface pointers without using the exported CreateInterface function.
// Find the pointer to 'InterfaceReg::s_pInterfaceRegs' - works on Valve game libraries. (32-bit)
uintptr_t interface_list_addr = FindPattern("bin/client.so", "89 10 8B 15 ? ? ? ? A3") + 4;
InterfaceReg* interface_list = **reinterpret_cast<InterfaceReg***>(interface_list_addr);
for (InterfaceReg* current = interface_list; current; current = current->m_pNext) {
printf("* %s => 0x%x\n", current->m_pName, current->m_CreateFn());
}
@aixxe
aixxe / GetAbsoluteAddress.cc
Last active February 24, 2022 11:03
Helper function to resolve RIP relative addresses.
inline uintptr_t GetAbsoluteAddress(uintptr_t instruction_ptr, int offset, int size) {
return instruction_ptr + *reinterpret_cast<int32_t*>(instruction_ptr + offset) + size;
};