Skip to content

Instantly share code, notes, and snippets.

@mrwonko
mrwonko / thiscall_test.c
Created March 16, 2013 20:14
Testing calling __thiscall functions (member functions) from (inline) asm (MSVC)
#include "stdafx.h"
#include <stdio.h> //printf
#include <stdlib.h>//system
class OpaqueClass
{
public:
OpaqueClass(const char* name) : mName(name) {}
@mrwonko
mrwonko / snapvector.c
Created March 15, 2013 23:37
iojamp wip stuff
/*
===========================================================================
Copyright (C) 2011 Thilo Schulz <thilo@tjps.eu>
This file is part of Quake III Arena source code.
Quake III Arena source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
@mrwonko
mrwonko / CMakeLists.txt
Created March 15, 2013 23:33
iojamp cmake file (WIP)
cmake_minimum_required(VERSION 2.8)
project("iojamp")
option(InstallDir "Where to install the binaries to" "install")
option(UseOpenAL "Whether to use OpenAL" ON)
option(UseOpenALDlopen "When using OpenAL, whether to open via dlopen at runtime to be able to abort in case of absence" ON)
option(UseCURL "Whether to use curl" ON)
option(UseCURLDlopen "When using CURL, whether to open via dlopen at runtime to be able to abort in case of absence" ON)
option(UseCodecVorbis "Whether to use the Vorbis codec" OFF)
@mrwonko
mrwonko / Makefile
Created December 1, 2012 21:01
uni: ueb04test
# --------------------------------------------- #
# Fachhochschule Wedel, Wintersemester 2012 #
# C-Uebung 04 - ALU #
# Hanno Sternberg #
# #
# Makefile #
# --------------------------------------------- #
# Compiler
CC = gcc
@mrwonko
mrwonko / main.lua
Created August 26, 2012 11:46
Quick test of how multithreaded lua works
for i = 1, 20 do
print("Hello main thread world! " .. counter)
counter = counter + 1;
end
@mrwonko
mrwonko / luaCountHook.lua
Created July 31, 2012 13:23
a lua hook that's called every 1000 instructions
local function hook(event)
assert(event == "count")
local info = debug.getinfo(2, "Sl") -- get source file related info (S) and current line (l)
error("Code took to long (over 1000 instructions), aborted at file \"" .. info.short_src .. "\" line " .. info.currentline)
end
debug.sethook(hook, "", 1000) -- "" = when to call this hook, if any of "every line", "every function call" or "every function return", 1000 = call every 1000 instructions
local i = 0
while true do
print(i)
@mrwonko
mrwonko / errorhandling.lua
Created July 31, 2012 13:07
some lua error catching examples
local success, message = pcall(error, "this is an error")
if not success then
print("Caught error:", message)
end
local success, message = xpcall(
error,
function(err)
return debug.traceback(err, 3)
end,
@mrwonko
mrwonko / gla_convert.py
Created July 12, 2012 22:53
Raven Software Ghoul 2 Animation retargetting script
#! /usr/bin/python
import struct
####
#### Matrix Math
####
# N-Dimensional vector with operators == and * (dot product)
class Vector:
@mrwonko
mrwonko / gla_range.py
Last active January 29, 2025 12:41
Jedi Knight 2/3 .gla animation subrange extractor
#! /usr/bin/python
GLA_IDENT = b"2LGA"
GLA_VERSION = 6
import struct
class MdxaHeader:
def __init__( self ):
@mrwonko
mrwonko / wizualize.cpp
Created June 27, 2012 14:44
FH-Wedel Programmierwettbewerb 2012 - creating TGAs based on program output
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <vector>
void printUsage()
{
std::cout<<"Usage: echo [data] | yourProgram | wizualize <width (= height)> <output directory>"<<std::endl;
}