Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan C. Gordon icculus

View GitHub Profile
@icculus
icculus / obviously-not-valid-c-code.c
Created Jun 6, 2022
A pretty intense preprocessor input generated by American Fuzzy Lop
View obviously-not-valid-c-code.c
// 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 Jan 26, 2022
Management of the power button on the PlayStation 1 playing card tin. https://twitter.com/icculus/status/1484628302853726208
View pacmac-power-gpio.c
// 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 Jun 10, 2022
This is the Epic MegaGrant pitch I wrote for the SDL GPU API, in case anyone is interested.
View sdl-gpu-pitch.md

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 Oct 26, 2021
SDL/build-scripts/fnsince.pl output on Oct 26 2021...
View fnsince.txt
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
@icculus
icculus / main.rb
Created Mar 24, 2020
Tetris in DragonRuby, code at the end of Part 2
View main.rb
$gtk.reset
class TetrisGame
def initialize args
@args = args
@next_piece = nil
@next_move = 30
@score = 0
@gameover = false
@grid_w = 10
@icculus
icculus / main.rb
Created Mar 23, 2020
Tetris in DragonRuby, code at the end of Part 1
View main.rb
# This is the code as it stands at the end of
# "Let's make Tetris with DragonRuby Game Toolkit!" Part 1:
# https://www.youtube.com/watch?v=xZMwRSbC4rY
$gtk.reset
class TetrisGame
def initialize args
@args = args
@next_move = 30
View dragontris.rb
$gtk.reset
class TetrisGame
# This is just to get GTK to not complain in the console for now.
def serialize ; { args: '' } ; end
def inspect ; serialize.to_s ; end
def to_s ; serialize.to_s ; end
def render_cube_pixelpos x, y, r, g, b, a=255
@args.outputs.solids << [ x, y, @boxsize, @boxsize, r, g, b, a ]
@icculus
icculus / dragonruby-html5-loader-little-piece.js
Created May 20, 2019
Choose WebAssembly or asm.js at runtime
View dragonruby-html5-loader-little-piece.js
var hasWebAssembly = false;
if (typeof WebAssembly==="object" && typeof WebAssembly.Memory==="function") {
hasWebAssembly = true;
}
//console.log("Do we have WebAssembly? " + ((hasWebAssembly) ? "YES" : "NO"));
var buildtype = hasWebAssembly ? "wasm" : "asmjs";
var module = "dragonruby-" + buildtype + ".js";
@icculus
icculus / basicgorillas.rb
Last active Feb 13, 2022
DragonRuby Basic Gorillas
View basicgorillas.rb
# This is the complete source code to Basic Gorillas:
# https://dragonruby.itch.io/basicgorillas
#
# You can tinker with this by getting a copy of DragonRuby Game Toolkit:
# https://dragonruby.org/
#
# Amir Rajan wrote this game, catch him at https://twitter.com/amirrajan !
class YouSoBasicGorillas
attr_accessor :outputs, :grid, :game, :inputs
View flappydragon.rb
# This is the complete source code to Flappy Dragon:
# https://dragonruby.itch.io/flappydragon
#
# You can tinker with this by getting a copy of DragonRuby Game Toolkit:
# https://dragonruby.org/
#
# Amir Rajan wrote this game, catch him at https://twitter.com/amirrajan !
class FlappyDragon
attr_accessor :grid, :inputs, :game, :outputs