Skip to content

Instantly share code, notes, and snippets.

View icculus's full-sized avatar

Ryan C. Gordon icculus

View GitHub Profile
@icculus
icculus / all-sdl3-documented-macros.h
Created December 9, 2024 21:10
All currently-documented SDL3 macros...
#define SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED ... // Specify the behavior of Alt+Tab while the keyboard is grabbed.
#define SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY ... // A variable to control whether the SDL activity is allowed to be re-created.
#define SDL_HINT_ANDROID_BLOCK_ON_PAUSE ... // A variable to control whether the event loop will block itself when the app is paused.
#define SDL_HINT_ANDROID_LOW_LATENCY_AUDIO ... // A variable to control whether low latency audio should be enabled.
#define SDL_HINT_ANDROID_TRAP_BACK_BUTTON ... // A variable to control whether we trap the Android back button to handle it manually.
#define SDL_HINT_APP_ID ... // A variable setting the app ID string.
#define SDL_HINT_APP
@icculus
icculus / sdl3quickref-attempt2.md
Created December 9, 2024 20:08
SDL3 Quick Reference attempt, wikified version

Based on SDL version 3.1.7

(If you'd rather have something you can copy/paste into an IDE, for searching and syntax highlighting, check out QuickReferenceC or QuickReferenceCNoUnicode instead.)

Init

@icculus
icculus / sdl3quickref.md
Created December 9, 2024 00:03
SDL3 Quick Reference test
// SDL3 API Quick Reference
//
// https://libsdl.org/
//
// The latest version of this document can be found at https://wiki.libsdl.org/SDL3/QuickReference
// When this document was written: 2024-12-09 00:00:45 GMT
// Based on SDL version 3.1.7
@icculus
icculus / sdl3-threadsafety-docs-todo.txt
Last active October 22, 2024 17:48
SDL3 functions that don't currently have `\threadsafety` tags...
SDL_AcquireGPUCommandBuffer
SDL_AcquireGPUSwapchainTexture
SDL_AddSurfaceAlternateImage
SDL_AppInit
SDL_AttachVirtualJoystick
SDL_BeginGPUComputePass
SDL_BeginGPUCopyPass
SDL_BeginGPURenderPass
SDL_BindGPUComputePipeline
SDL_BindGPUComputeSamplers
@icculus
icculus / coreaudio-replug-problem.m
Created August 5, 2024 02:50
Standalone reproduction case for CoreAudio hotplugging issue
// This is only intended for macOS; I cut out the iOS-specific pieces when pulling this code out of SDL for a reproduction case!
// clang -Wall -O0 -ggdb3 -fobjc-arc -o coreaudio-replug-problem coreaudio-replug-problem.m -framework AudioToolbox
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
#include <pthread.h>
#include <signal.h>
@icculus
icculus / SDL-whisthq.diff
Created August 1, 2024 04:27
Patch between SDL 2.0.22 and WhistHQ's fork.
diff -ruBbN '--exclude=.git' SDL-2.0.22/android-project/build.gradle SDL-whisthq/android-project/build.gradle
--- SDL-2.0.22/android-project/build.gradle 2024-08-01 00:22:36.006294486 -0400
+++ SDL-whisthq/android-project/build.gradle 2024-08-01 00:21:19.933039042 -0400
@@ -6,7 +6,7 @@
google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:7.0.3'
+ classpath 'com.android.tools.build:gradle:7.3.0'
CC=cc CFLAGS="-O0 -g" ../configure
checking build system type... x86_64-pc-solaris2.10
checking host system type... x86_64-pc-solaris2.10
checking how to print strings... printf
checking for gcc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
gmake V=1
/bin/bash ../build-scripts/updaterev.sh --vendor ""
/bin/bash ../build-scripts/mkinstalldirs build
umask 22
mkdir build
touch build/.created
/bin/bash ./libtool --tag=CC --mode=compile cc -O0 -g -DUSING_GENERATED_CONFIG_H -Iinclude -I/projects/SDL/include -idirafter /projects/SDL/src/video/khronos -DSDL_BUILD_MAJOR_VERSION=2 -DSDL_BUILD_MINOR_VERSION=31 -DSDL_BUILD_MICRO_VERSION=0 -fno-strict-aliasing -I/usr/include -DNO_SHARED_MEMORY -c /projects/SDL/src/SDL.c -o build/SDL.lo
libtool: compile: cc -O0 -g -DUSING_GENERATED_CONFIG_H -Iinclude -I/projects/SDL/include -idirafter /projects/SDL/src/video/khronos -DSDL_BUILD_MAJOR_VERSION=2 -DSDL_BUILD_MINOR_VERSION=31 -DSDL_BUILD_MICRO_VERSION=0 -fno-strict-aliasing -I/usr/include -DNO_SHARED_MEMORY -c /projects/SDL/src/SDL.c -KPIC -DPIC -o build/.libs/SDL.o
cc: Warning: Option -dirafter passed to ld, if ld is invoked, ignored otherwise
@icculus
icculus / d3-mission-sort.diff
Created May 2, 2024 15:00
From Descent 3 Steam 2020: Sort mission menu to have retail game things first.
commit 8855673c539fad6949244e3914319ebc29e6885e
Author: Ryan C. Gordon <icculus@icculus.org>
Date: Sat Jun 15 00:07:18 2019 -0400
Sort mission menu to have retail game things first.
Pilot Training, Descent 3: Retribution (the main retail game) and
Mercenary (the mission pack) come first. Third party levels come after.
diff --git a/Main/menu.cpp b/Main/menu.cpp
@icculus
icculus / d3-asan.diff
Created May 2, 2024 14:48
AddressSanitizer and valgrind fixes from Ryan's 2020 Descent 3 build...
commit ee39d8b93ac9c70f7ef11ada3f684d26c9135bd4
Author: Ryan C. Gordon <icculus@icculus.org>
Date: Sun Jun 9 00:18:36 2019 -0400
Some initial fixes from AddressSanitizer.
diff --git a/Main/ddio_lnx/lnxfile.cpp b/Main/ddio_lnx/lnxfile.cpp
index 2d9ecb0..de35fe8 100644
--- a/Main/ddio_lnx/lnxfile.cpp
+++ b/Main/ddio_lnx/lnxfile.cpp