Skip to content

Instantly share code, notes, and snippets.

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

ITotalJustice

💜
Coding away...
View GitHub Profile
@ITotalJustice
ITotalJustice / xci.c
Last active November 15, 2019 21:07
Dump all .nca's inside from inside the secure, logo, normal and update from an xci
#include <stdio.h> // you already know what this is for...
#include <stdbool.h> // for bools.
#include <stdlib.h> // for malloc.
#include <stdint.h> // for u_int64_t etc etc.
#include <string.h> // for strstr.
#include <sys/stat.h> // for mkdir.
#define HFS0_MAGIC 0x30534648 // HFS0
// gcc main.c -lavformat -lavfilter -lavcodec -lavutil -lm -lpthread -lmbedtls -lswscale -lswresample -lz -lmbedx509 -lmbedcrypto -lmp3lame
/*
* To get the desired bug, compile ffmpeg with mbedtls support.
*
* This will loop until either no more fd can be opened, or an error happens when trying to open the url.
*
* Check the value fd after each time avformat_open_input is called.
* Try this with a http / local file and you will notice that fd will keep the vallue of 3 (0=stdin, 1=stout, 2=stderr)
*
@ITotalJustice
ITotalJustice / allegro_music_test.c
Last active June 7, 2020 21:12
short allegro music example.
/// gcc allegro_music_test.c -o player -Wall -lallegro -lallegro_audio -lallegro_acodec
#include <stdio.h>
#include <stdbool.h>
#include <assert.h>
#include <allegro5/allegro5.h>
#include <allegro5/allegro_audio.h>
#include <allegro5/allegro_acodec.h>
int main(int argc, char *argv[])
@ITotalJustice
ITotalJustice / sdl_mixer_test.c
Created June 7, 2020 20:31
short sdl_mixer example.
#include <stdio.h>
#include <stdbool.h>
#include <assert.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_mixer.h>
int main(int argc, char *argv[])
{
if (argc < 2)
{
@ITotalJustice
ITotalJustice / del_ext.c
Created July 27, 2020 04:25
delete files with extension
/*
* gcc del_ext.c -o del_ext -O2 -Wall -s
*/
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <ftw.h>
/*parse_ops - 0.0.1: auto generate C/C++ array from table data*/
#ifndef CYCLE_TABLE_H
#define CYCLE_TABLE_H
static const unsigned char CYCLE_TABLE[0x100] = {
4,12,8,8,4,4,8,4,20,8,8,8,4,4,8,4,4,
12,8,8,4,4,8,4,12,8,8,8,4,4,8,4,8,
12,8,8,4,4,8,4,8,8,8,8,4,4,8,4,8,
// DOWNLOAD PARSED HEADERS FROM: https://files.catbox.moe/imeaak.zip
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#define CHUNK_SIZE 10000
/*parse_log - 0.0.1: auto generate C/C++ array from nestest.log data*/
#ifndef NESTEST_LOG_H
#define NESTEST_LOG_H
static const unsigned char ARR_OPCODE[] = {
0x4C,0xA2,0x86,0x86,0x86,0x20,0xEA,0x38,0xB0,0xEA,0x18,0xB0,0x4C,0xEA,0x38,0x90,
0x4C,0xEA,0x18,0x90,0xEA,0xA9,0xF0,0xEA,0xA9,0xF0,0x4C,0xEA,0xA9,0xD0,0xEA,0xA9,
0xD0,0x4C,0xEA,0xA9,0x85,0x24,0x70,0xEA,0x24,0x50,0x4C,0xEA,0xA9,0x85,0x24,0x50,
0xEA,0x24,0x70,0x4C,0xEA,0xA9,0x10,0xEA,0xA9,0x10,0x4C,0xEA,0x60,0x20,0xEA,0xA9,
@ITotalJustice
ITotalJustice / cycle_table.h
Last active January 8, 2022 16:49
nes cycle table
/*parse_ops - 0.0.1: auto generate C/C++ array from table data*/
#ifndef CYCLE_TABLE_H
#define CYCLE_TABLE_H
static const unsigned char CYCLE_TABLE[0x100] = {
7,6,0,8,3,3,5,5,3,2,2,0,4,4,6,6,
2,5,0,8,4,4,6,6,2,4,2,7,4,4,7,7,
6,6,0,8,3,3,5,5,4,2,2,0,4,4,6,6,
2,5,0,8,4,4,6,6,2,4,2,7,4,4,7,7,
/*
Simple DirectMedia Layer
Copyright (C) 1997-2020 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