Skip to content

Instantly share code, notes, and snippets.

View leiradel's full-sized avatar

Andre Leiradella leiradel

View GitHub Profile
@leiradel
leiradel / retromods.md
Last active June 29, 2023 05:20
Retromods spec brain dump. *Highly volatile!*

Retromods

What is a mod?

A mod is a set of code and assets that changes or augments the way a game is run. Examples of mods are:

  • Music and sound packs that replace the original game music and sound.
  • Graphics packs that replace the original game graphics.
  • Level packs that change or replace the original game levels.
  • Achievements that are awarded to the players when they complete tasks in the game.
@leiradel
leiradel / gist:9b22e1bc9484b56add8dd5563ad8f1fa
Last active July 1, 2018 22:08
(Sort of) BNF of the Retro Achievements memaddr field
memaddr = achievement | leaderboard .
memory_size = ( 'm' | 'M' ) // bit 0
| ( 'n' | 'N' ) // bit 1
| ( 'o' | 'O' ) // bit 2
| ( 'p' | 'P' ) // bit 3
| ( 'q' | 'Q' ) // bit 4
| ( 'r' | 'R' ) // bit 5
| ( 's' | 'S' ) // bit 6
| ( 't' | 'T' ) // bit 7
@leiradel
leiradel / README.md
Created July 22, 2018 01:36
rcheevos readme

rcheevos

rcheevos is a set of C code, or a library if you will, that tries to make it easier for emulators to interface with the RetroAchievements website services and provide achievements and leaderboards for their players.

rcheevos is not a complete solution in that it doesn't provide HTTP network connections or JSON parsing. The emulator has to implement that by itself, and pass the results down to rcheevos for processing.

Not all structures defined by rcheevos can be created via the public API, but are exposed to allow iteractions beyond just cretion, destruction, and testing, such as the ones required by UI code that helps creating them.

Finally, rcheevos does not allocate any memory or manage memory by itself. All structures that can be returned by it have a function that will determine the number of bytes needed to hold the structure, and another that will actually build the structure and that takes a caller-provided buffer to bake the structure. However, calls to **rc

#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <stdlib.h>
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#ifdef __APPLE__
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <stdlib.h>
#include <wren.h>
#ifdef __APPLE__
#include <mach/mach_time.h>
#else
set title 'Graph Title'
set xlabel 'ms'
set ylabel 'Mb'
set terminal svg
set output 'graph.svg'
plot 'lua.log' title 'Lua' with lines, 'wren.log' title 'Wren' with lines
@leiradel
leiradel / bmpenc.cpp
Created September 15, 2018 20:09
An image encoder for Gamebuino Classic bitmaps
#include <stdio.h>
#include <stdint.h>
/*---------------------------------------------------------------------------*/
/* stb_image config and inclusion */
#define STBI_ASSERT( x )
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
@leiradel
leiradel / roomenc.cpp
Created September 26, 2018 21:29
Generates code that fills the entire screen, with gray support
#include <stdio.h>
#include <stdint.h>
/*---------------------------------------------------------------------------*/
/* stb_image config and inclusion */
#define STBI_ASSERT( x )
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
/*
The MIT License (MIT)
Copyright (c) 2016 Andre Leiradella
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@leiradel
leiradel / memory_layout.md
Last active March 30, 2019 15:01
Memory Layout for Raspberry Pi
  • User/Kernel split
    • 3 GB user, 1 GB kernel
  • User split
    • 1 MB unmapped for illegal access exceptions
    • .text, .rodata, .data, heap and stack
    • Heap is right after .data
    • Stack is at the end of the available user RAM
    • Heap and stack grow towards each other
  • Kernel split
  • 512 MB VideoCore RAM (reserved address space, actual RAM may be less)