Skip to content

Instantly share code, notes, and snippets.

View ITotalJustice's full-sized avatar
💜
Coding away...

ITotalJustice

💜
Coding away...
View GitHub Profile
From 92e89e25fb077a0389e86740879bdd7bbb99a3b8 Mon Sep 17 00:00:00 2001
From: ITotalJustice <[email protected]>
Date: Mon, 25 Nov 2024 21:03:43 +0000
Subject: [PATCH] fix wps
---
source/wfc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/source/wfc.c b/source/wfc.c
struct BufferedFileData {
u8 data[1024 * 64]; // configure size here.
s64 off;
s64 size;
};
static BufferedFileData buffered;
size_t Source::ReadFile(void *_buffer, size_t read_size) {
auto dst = static_cast<u8*>(_buffer);
@ITotalJustice
ITotalJustice / Mixer.cpp
Last active July 11, 2025 02:19
dolphin mixer standalone
// Copyright 2008 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
// based on: https://github.com/dolphin-emu/dolphin/blob/8d2a15be3f8f9e3f5bc1620cf11603b2a910bd56/Source/Core/AudioCommon/Mixer.cpp
#include "Mixer.h"
#include <algorithm>
#include <array>
#include <bit>
#include <cmath>
#!/usr/bin/python
from ftplib import FTP
from io import BytesIO
# pip install python-slugify
from slugify import slugify
import argparse
import time
parser = argparse.ArgumentParser()
#include "png.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <zlib.h>
static void crc32_to_buf(uint8_t* buf, const uint8_t* in, size_t len) {
const uint32_t c = crc32(0, in, len);
@ITotalJustice
ITotalJustice / SDL_memory_map.c
Last active October 5, 2024 04:18
mmap for sdl3
#include "SDL_memory_map.h"
#include <SDL3/SDL.h>
// #include "SDL_internal.h"
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
@ITotalJustice
ITotalJustice / hideable_menubar.cpp
Created October 4, 2024 19:57
hides menu bar when the area isn't hovered / selected.
void menubar() {
static float menubar_height = 30.0;
const auto& io = ImGui::GetIO();
const auto flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize;
const auto window_pos = ImVec2(0, 0);
const auto window_size = ImVec2(io.DisplaySize.x, menubar_height);
ImGui::SetNextWindowPos(window_pos);
ImGui::SetNextWindowSize(window_size);
ImGui::SetNextWindowBgAlpha(0);
@ITotalJustice
ITotalJustice / ring_buf.c
Last active September 30, 2024 14:44
ring buffer from gba fifo
struct RingBuf
{
uint32_t buf[8];
uint32_t r_index;
uint32_t w_index;
};
static void ringbuf_reset(struct RingBuf* ring)
{
ring->r_index = ring->w_index;
@ITotalJustice
ITotalJustice / scheduler.c
Last active February 27, 2024 17:20
c99 scheduler, very fast, converted from my c++23 impl
#include "scheduler.h"
#include <stdbool.h>
#include <assert.h>
#ifndef SCHEDULER_UNUSED
#define SCHEDULER_UNUSED(x) (void)(x)
#endif // SCHEDULER_UNUSED
// this is the value that events are set to when disabled
enum { SCHEDULER_DISABLE_VALUE = INT_MAX };
@ITotalJustice
ITotalJustice / diskio.c
Last active July 25, 2025 00:01
ezflash omega+de sd card routines, can be used with fatfs directly or libfat.
/*-----------------------------------------------------------------------*/
/* Low level disk I/O module SKELETON for FatFs (C)ChaN, 2019 */
/*-----------------------------------------------------------------------*/
/* If a working storage control module is available, it should be */
/* attached to the FatFs via a glue function rather than modifying it. */
/* This is an example of glue functions to attach various exsisting */
/* storage control modules to the FatFs module with a defined API. */
/*-----------------------------------------------------------------------*/
#include "ff.h" /* Obtains integer types */