Skip to content

Instantly share code, notes, and snippets.

@JohnnyonFlame
JohnnyonFlame / usb-audio.sh
Created September 15, 2024 15:10
Simple PipeWire AutoSwitcher
#!/bin/bash -x
# Simple PipeWire AutoSwitcher
# LICENSE: BSD-0
# Copyright (C) 2024 by JohnnyonFlame
# Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
# # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
# OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
# CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@JohnnyonFlame
JohnnyonFlame / mono-for-armhf-ewaste.md
Last active July 8, 2024 08:20
Building Mono 6.0.12.205 for ArmHF (EverSD, RG35XX)

First create an artful lxc container, it's old enough we can use it to quickly cross-build mono for the older glibc available on Evercades.

sudo lxc launch ubuntu:a/armhf armhf-artful
sudo lxc exec armhf-artful bash

Now let's fix artful's repo situation, this release is outside of the usual repositories due to being too old. We'll then install the packages.

sed -i 's$http://ports.ubuntu.com/ubuntu-ports$http://old-releases.ubuntu.com/ubuntu$' /etc/apt/sources.list
@JohnnyonFlame
JohnnyonFlame / README.md
Last active May 28, 2024 11:41
Building NativeAOT games for old ARM Devices and outdated software.

DOTNET Runtime for old GLIBC (ArmHF support included)!

Our problem here is that there are classes of devices that are stuck on very old glibc versions (e.g. 2.26) and armhf.

We're solving this by compiling the .NET 9 artifacts with an Ubuntu bionic (18.04) rootfs, this should be close enough to just work. At the time of writing this, we had only .NET 9 preview 4 with armhf support, so that's what we're using (tag: v9.0.0-preview.4.24266.19, you can change this if necessary).

@JohnnyonFlame
JohnnyonFlame / mmap-patch.diff
Created February 17, 2024 20:23
VVVVVV mmaped music.
diff --git a/desktop_version/CMakeLists.txt b/desktop_version/CMakeLists.txt
index 9e60db8b..4d522961 100644
--- a/desktop_version/CMakeLists.txt
+++ b/desktop_version/CMakeLists.txt
@@ -22,7 +22,7 @@ if(OFFICIAL_BUILD AND NOT MAKEANDPLAY)
endif()
option(REMOVE_ABSOLUTE_PATHS "If supported by the compiler, replace all absolute paths to source directories compiled into the binary (if any) with relative paths" ON)
-
+option(USE_MMAP "Use memory mapped blobs where possible, lowering physical memory requirements." OFF)
@JohnnyonFlame
JohnnyonFlame / sharp-bilinear.hlsl
Created October 29, 2023 04:06
Sharp Bilinear as an Effect Shader for XNA/FNA
#define _vs(r) : register(vs, r)
#define _ps(r) : register(ps, r)
#define _cb(r)
float4x4 MatrixTransform _vs(c0) _cb(c0);
texture s0_texture : register(t0);
sampler2D s0_sampler = sampler_state {
Texture = (s0_texture);
MagFilter = Linear;
@JohnnyonFlame
JohnnyonFlame / auto_dispatch.hpp
Last active October 7, 2023 13:20
Atuomatic dispatch from variadic/array procedures (from fake_jni).
// Automatic generator for function dispatch
template <auto F>
struct dispatch
{
// The following nested structure does two things:
// 1: Unwraps details about the function (e.g. argument type list,
// return type) with the template.
// 2: Implements the dispatcher as needed (will extract from va_list and push)
// into the function call that is being wrapped, taking care to also return
// the value if applicable.
@JohnnyonFlame
JohnnyonFlame / eglconfig.c
Last active April 21, 2023 14:09
eglconfig for owl/rg35xx
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <GLES2/gl2platform.h>
#include <sys/ioctl.h>
#include <linux/ioctl.h>
@JohnnyonFlame
JohnnyonFlame / 1.0_to_2.2.x.csx
Last active April 19, 2023 17:14
Convert older GMS games to newer runners w UTMT
using System.Windows;
using System.Reflection;
EnsureDataLoaded();
RunUMTScript(Path.Combine(ExePath, "Scripts/Technical Scripts/15_to_17_To_16.csx"));
MainWindow mainWindow = Application.Current.MainWindow as MainWindow;
Data.SetGMS2Version(2, 2, 0, 258);
foreach (var asset in Data.Backgrounds)
@JohnnyonFlame
JohnnyonFlame / Lauch.sh
Last active January 1, 2023 23:36
Jealousy for EVERSD
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2022-present JohnnyonFlame
cd /tmp
# Setup the basic overlay structure
mkdir {rootfs,enablement,overlay}
mount /mnt/sdcard/SYSTEM rootfs/
@JohnnyonFlame
JohnnyonFlame / configure_n2.sh
Last active September 1, 2022 00:05
Auto-configure fbdev-mali SDL2 backend for the Odroid N2 platform.
#!/bin/bash
# You might want to change DCMAKE_TOOLCHAIN_FILE :)
cmake -B build \
-DCMAKE_TOOLCHAIN_FILE=~/aarch64.cmake \
-DCMAKE_C_FLAGS=-I\ /home/johnny/opengl-meson/include \
-DSDL_STATIC=OFF \
-DSDL_LIBC=ON \
-DSDL_GCC_ATOMICS=ON \