Skip to content

Instantly share code, notes, and snippets.

View andsve's full-sized avatar
🍎
Coding

Sven Andersson andsve

🍎
Coding
View GitHub Profile
@andsve
andsve / app_delegate.c
Created January 17, 2019 13:36
A simple implementation of a NSApplicationDelegate and two methods (openFile:, openFiles:) in pure C.
/*
app_delegate.c
1. Compile and link with:
$ clang -g -o AppInC app_delegate.c -lobjc -framework Foundation -framework AppKit -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
2. Create a Info.plist with:
[[
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
g++ -MMD -MP -MP -DDEBUG -DSOKOL_GLCORE33 -I"/usr/include/gtk-3.0" -I"/usr/include/cairo" -I"/usr/include/pango-1.0" -I"/usr/include/harfbuzz" -I"/usr/include/atk-1.0" -I"/usr/include/gdk-pixbuf-2.0" -I"/usr/include/glib-2.0" -I"/usr/lib/x86_64-linux-gnu/glib-2.0/include" -g -m64 -fno-exceptions -fno-rtti -Wall -Werror -Wno-deprecated-declarations -m64 -lstdc++ -Wl,--no-as-needed -ldl -lXi -lXrandr -lXxf86vm -lXinerama -lXcursor -lrt -rdynamic -lpthread -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lGL -lX11 -lm sokol_gtk.cpp -o "sokol_gtk.out"
g++ -MMD -MP -MP -DDEBUG -DSOKOL_GLCORE33 -I"/usr/include/gtk-3.0" -I"/usr/include/cairo" -I"/usr/include/pango-1.0" -I"/usr/include/harfbuzz" -I"/usr/include/atk-1.0" -I"/usr/include/gdk-pixbuf-2.0" -I"/usr/include/glib-2.0" -I"/usr/lib/x86_64-linux-gnu/glib-2.0/include" -g -m64 -fno-exceptions -fno-rtti -Wall -Werror -Wno-deprecated-declarations -m64 -lstdc++ -Wl,--no-as
@andsve
andsve / neeze.h
Created January 16, 2021 14:32
snippets for reading nes controller 1 input (using minifb)
// ...
enum GAMEPAD_ID
{
GAMEPAD_1 = 0,
GAMEPAD_2 = 1,
GAMEPAD_MAX = GAMEPAD_2,
};
enum GAMEPAD_BUTTON
@andsve
andsve / thrustmasters_t150_pro_USB_report_data.txt
Last active March 27, 2021 14:19
Thrustmasters T150 Pro USB, Mac data report
Investigating values in the report data for Thrustmasters T150 Pro (including and connected pedals) when connected to a MacBook Pro.
The wheel is set in the PS4 mode, NOT the "recommended" PC mode "PS3".
The values were snooped up using Wireshark, listening to the USB.
Vendor: 0x44F (1103)
Product: 0xB66D (46701)
(Note: The values were recorded while the "switch clutch and acc" mode was enabled, sadly... But hopefully it should only be those two "axis" being swapped.)
Example of report data (in idle):