Skip to content

Instantly share code, notes, and snippets.

View icculus's full-sized avatar

Ryan C. Gordon icculus

View GitHub Profile
@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
@icculus
icculus / sdl-wikiheaders-coverage-gaps.txt
Last active May 3, 2024 03:20
Output of wikiheaders.pl --report-coverage-gaps with red herrings like SDL_oldnames.h, SDL_test*, and SDL_opengl*, etc, trimmed out.
SDL_stdinc.h:75: # define SDL_SIZE_MAX SIZE_MAX
SDL_stdinc.h:77: # define SDL_SIZE_MAX ((size_t) -1)
SDL_stdinc.h:86: #define SDL_HAS_BUILTIN(x) __has_builtin(x)
SDL_stdinc.h:88: #define SDL_HAS_BUILTIN(x) 0
SDL_stdinc.h:122: #define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
SDL_stdinc.h:123: #define SDL_static_cast(type, expression) static_cast<type>(expression)
SDL_stdinc.h:124: #define SDL_const_cast(type, expression) const_cast<type>(expression)
SDL_stdinc.h:126: #define SDL_reinterpret_cast(type, expression) ((type)(expression))
SDL_stdinc.h:127: #define SDL_static_cast(type, expression) ((type)(expression))
SDL_stdinc.h:128: #define SDL_const_cast(type, expression) ((type)(expression))
commit e8744109411830081d1f4a6feaa8bbbfb2471d11
Author: Ryan C. Gordon <icculus@icculus.org>
Date: Sun Jun 9 00:24:25 2019 -0400
Huge pile of changes from long to int, for 64-bit support.
This is a hit-and-miss sort of thing, so there might be more to do, but this
(probably) won't make anything worse, as Descent 3 already expected long and
int to be the same size.
@icculus
icculus / sdl3-audiostream-format-changes.diff
Created August 30, 2023 17:26
Attempt to generalize SDL3 audio stream format management
diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c
index 5b3feb044..aac258b97 100644
--- a/src/audio/SDL_audiocvt.c
+++ b/src/audio/SDL_audiocvt.c
@@ -43,8 +43,9 @@ static Sint64 GetResampleRate(const int src_rate, const int dst_rate)
SDL_assert(src_rate > 0);
SDL_assert(dst_rate > 0);
- if (src_rate == dst_rate)
+ if (src_rate == dst_rate) {
@icculus
icculus / testdynaudiostream.c
Last active April 3, 2023 19:31
Changing audio stream samplerate on the fly with SDL3
/*
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely.
@icculus
icculus / obviously-not-valid-c-code.c
Created June 6, 2022 22:09
A pretty intense preprocessor input generated by American Fuzzy Lop
// T preprocessor.
#defin D0(5)
T
#elitA
#define y�a)oogoooooooooooooooooo ���es���������e�� x(a) y(t)n�� x(a= y(t)ne x*a) # this����\owF isn'tica����ڷ��������ŷ���������IGHU dIGHCy whaprte tPe$e\ror dssage.
t t�e s/�od� \or, w� @ns don'R togr fornincs ma ue y(a��������������������������)ooo �� st beld4i either~ ta�e>th�
#define x(z),,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
@icculus
icculus / pacmac-power-gpio.c
Created January 26, 2022 18:38
Management of the power button on the PlayStation 1 playing card tin. https://twitter.com/icculus/status/1484628302853726208
// This C code is public domain. --ryan.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <time.h>
#include <errno.h>
#include <wiringPi.h>
@icculus
icculus / sdl-gpu-pitch.md
Last active September 28, 2023 08:42
This is the Epic MegaGrant pitch I wrote for the SDL GPU API, in case anyone is interested.

Describe your project:

Simple Directmedia Layer (SDL) is the gold standard for low-level, cross-platform game development. It is an open source library that is used at the layer where one might use DirectX, so it's useful both for from-scratch development and for powering game engines. It provides abstractions for video, audio, input, and various system-provided functionality. In many cases, if you're building a cross-platform game, SDL is extremely good at helping you delete a large number of #ifdefs in your project...and entire directories full of code.

SDL is used in the Steam Client, is crucial to the Linux game development ecosystem, and has been used for various platforms in every generation of the Unreal Engine, idTech, Source Engine, etc.

A game written to use SDL might work with almost no code changes across all major desktop operating systems, mobile phones, web browsers, and even the Raspberry Pi. Nintendo shipped SDL in over 7.5 million NES and SNES Classic devices. There are SDL-based games

@icculus
icculus / fnsince.txt
Created October 26, 2021 16:15
SDL/build-scripts/fnsince.pl output on Oct 26 2021...
SDL_AddEventWatch: 2.0.0
SDL_AddHintCallback: 2.0.0
SDL_AddTimer: 2.0.0
SDL_AllocFormat: 2.0.0
SDL_AllocPalette: 2.0.0
SDL_AllocRW: 2.0.0
SDL_AndroidGetActivity: 2.0.0
SDL_AndroidGetExternalStoragePath: 2.0.0
SDL_AndroidGetExternalStorageState: 2.0.0
SDL_AndroidGetInternalStoragePath: 2.0.0