Skip to content

Instantly share code, notes, and snippets.

@JohnnyonFlame
JohnnyonFlame / EiffelExtractor.cs
Last active June 17, 2022 01:31
EiffelExtractor - Extract ParisEngine assets.
// File Extractor for games using the ParisEngine (e.g. Panzer Paladin, TMNT: Shredder's Revenge)
// To compile this: mcs EiffelExtractor.cs /r:DotNetZip.dll
// This is free software, licensed under BSD-0, by Johnny on Flame, 2022.
using System;
using System.Text;
using System.IO;
using System.Collections.Generic;
using Ionic.Zlib;
@JohnnyonFlame
JohnnyonFlame / thunk_list.cpp
Last active June 17, 2022 20:19
Compile time automatic generation of softfp to hardfp thunks using templated specialization
// Compile time code-generation for conditional softfp->hardfp thunks using template specialization.
// As of June 2022 clang still doesn't generate correct code for this mixed ABI situation, use gcc.
// Special Thanks for the folks at FEX-Emu's discord for inspiration/help with this.
// Free software, Licensed under BSD-0.
#include <stdint.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdint.h>
@JohnnyonFlame
JohnnyonFlame / ExternalizeAllTextures.csx
Last active May 21, 2022 19:42
Texture Externalizer and Compressor for UndertaleModTool
// Texture Externalizer and Compressor by JohnnyonFlame
// Licensed under GPLv3 for UndertaleModTool
// Adapted from ExportAllEmbeddedTextures.csx
// By externalizing textures from the data file, we can lower the amount of data
// the runner is forced to preload on boot, and also gain the ability to load arbitrary
// data formats, such as loading PVR or DXTx compressed data, this allows for massive
// memory usage gains on embedded platforms such as the PSVita, and also significantly
// lower the Memory Bandwidth when heavy textures are in usage.
@JohnnyonFlame
JohnnyonFlame / UTMTGetVersionGuesstimate.csx
Last active August 9, 2022 21:55
Console snippet to check which runner version a gamemaker studio game might be exported to using UTMT.
using System.Reflection;
FieldInfo ver = null;
foreach (var t in typeof(UndertaleData).GetFields())
{
if (t.Name.StartsWith("GM") && (t.FieldType == typeof(bool)) && (bool)t.GetValue(Data))
{
ver = t;
}
}
@JohnnyonFlame
JohnnyonFlame / Compiler.cs
Last active May 25, 2022 03:29
Visibility-free Patch Compiler for .NET hacking with Harmony
// Visibility-free Patch Compiler
// Based off of the work presented in https://www.strathweb.com/2018/10/no-internalvisibleto-no-problem-bypassing-c-visibility-rules-with-roslyn/
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
@JohnnyonFlame
JohnnyonFlame / changes.md
Last active March 7, 2022 03:40
TresBashers perf fix

Known Issues:

  • Hell Well still falls a bit under 60fps on RK3326, investigate how to improve enemy logic performance.

Changes to code:

  • Added disabling/enabling bg instances only when necessary
  • Added logic when obj_weathervane gets in and out of screen:
    • Activate/Deactivate obj_relic_ring instances when offscreen state flips.
    • Don't the rotation math and set visible to false.
  • Modified behavior of obj_camera object culling:
  • Allow a single frame before start culling for initialization of different elements.
@JohnnyonFlame
JohnnyonFlame / Makefile.optm
Last active April 20, 2023 12:16
Configuring a cross-build chroot, building and Installing SDL2 for Rockchips (As seen on 351ELEC!)
DLLS=$(wildcard lib/mono/gac/*/*/*.dll) lib/mono/4.5/mscorlib.dll
SO=$(patsubst %.dll,%.so,$(DLLS))
FLAGS=--aot=llvm -O=all
VERSION=6.12.0.122
ARCH=aarch64
%.so: %.dll
mono ${FLAGS} $<
all: $(SO)
@JohnnyonFlame
JohnnyonFlame / aarch64.meson
Last active February 16, 2022 03:35
Simple meson cross-build file for aarch64
[binaries]
c = 'aarch64-linux-gnu-gcc'
cpp = 'aarch64-linux-gnu-g++'
ld = 'aarch64-linux-gnu-ld'
ar = 'aarch64-linux-gnu-ar'
as = 'aarch64-linux-gnu-as'
size = 'aarch64-linux-gnu-size'
objdump = 'aarch64-linux-gnu-objdump'
objcopy = 'aarch64-linux-gnu-objcopy'
strip = 'aarch64-linux-gnu-strip'
@JohnnyonFlame
JohnnyonFlame / aarch64.cmake
Last active February 16, 2022 16:57
CMAKE TOOLCHAIN FILES
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(TARGET_ABI "linux-gnu")
SET(CMAKE_C_COMPILER ${CMAKE_SYSTEM_PROCESSOR}-${TARGET_ABI}-gcc)
SET(CMAKE_CXX_COMPILER ${CMAKE_SYSTEM_PROCESSOR}-${TARGET_ABI}-g++)
SET(CMAKE_FIND_ROOT_PATH "/usr/${CMAKE_SYSTEM_PROCESSOR}-${TARGET_ABI}")
# SET(CMAKE_PREFIX_PATH "/usr/${CMAKE_SYSTEM_PROCESSOR}-${TARGET_ABI}")
SET(CMAKE_INSTALL_PREFIX "${CMAKE_PREFIX_PATH}")
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
@JohnnyonFlame
JohnnyonFlame / SteamStubs.c
Created January 26, 2022 18:54
Steam stubs for FNA games.
#include <stdint.h>
typedef struct ControllerState
{
unsigned int PacketNum;
unsigned long Buttons;
short LeftPadX;
short LeftPadY;
short RightPadX;
short RightPadY;