Skip to content

Instantly share code, notes, and snippets.

View leiradel's full-sized avatar

Andre Leiradella leiradel

View GitHub Profile
-- Based off https://github.com/EmmanuelOga/easing
-- For all easing functions:
-- t = elapsed time between 0 and 1
-- b = begin
-- c = end
local pow = math.pow
local sin = math.sin
local cos = math.cos
@leiradel
leiradel / main.cpp
Created August 7, 2019 21:22
Dear ImGui docking bug
#include <imgui.h>
#include <imgui_impl_sdl.h>
#include <imgui_impl_opengl2.h>
#include <SDL.h>
#include <SDL_opengl.h>
#include <string>
class Application
@leiradel
leiradel / memory_layout.md
Last active November 4, 2024 16:31
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)
/*
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 / 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"
@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"
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
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <stdlib.h>
#include <wren.h>
#ifdef __APPLE__
#include <mach/mach_time.h>
#else
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <stdlib.h>
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#ifdef __APPLE__
@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