Skip to content

Instantly share code, notes, and snippets.

View BenjaminUrquhart's full-sized avatar
💭
I'm always busy :)

Benjamin Urquhart BenjaminUrquhart

💭
I'm always busy :)
View GitHub Profile
@BenjaminUrquhart
BenjaminUrquhart / ObjectEventProbing.gml
Created December 20, 2024 09:38
I will not elaborate. Requires Gamemaker 2022.5 or later as-is.
__get_default_datafile = function() {
switch(os_type) {
case os_windows: return "data.win";
case os_linux: return "game.unx";
default: throw $"Unsupported OS {os_type}";
}
}
__get_event_table = function() {
static event_table = undefined;
@BenjaminUrquhart
BenjaminUrquhart / BU_FixOliviaAnimatedPictures.js
Last active December 2, 2024 06:02
Plugin to fix the dreaded "Cannot read property 'width' of null." crash for "In Stars And Time"
/*:
@plugindesc Fix 'cannot read property "width" of null' crash in Olivia_AnimatedPictures.
@author Benjamin Urquhart
*/
{
// Add functions that causes the crash here.
let functions = ["resetFrame", "updateAnimatedPictureFrame"]
@BenjaminUrquhart
BenjaminUrquhart / revive.js
Created October 20, 2024 09:49
Very dirty JS portion of an In Stars and Time mod that makes the Memory of Emptiness function in every act.
// Helper stuff
// Learning Javascript using Notepad++ is not ideal but it works I guess.
// Could be worse.
clone = function(obj) {
return JSON.parse(JSON.stringify(obj))
}
var ReviveMod = {}
@BenjaminUrquhart
BenjaminUrquhart / JsonEx.java
Last active October 17, 2024 06:41
Java utility class to properly read/write decompressed RPGMaker MV/MZ save files.
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import org.json.JSONArray;
import org.json.JSONObject;
public class JsonEx {
@BenjaminUrquhart
BenjaminUrquhart / Always Maraca.user.js
Last active September 15, 2022 08:29
Always Maraca
// ==UserScript==
// @name Always Maraca
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Always get the maraca dog on Deltarune's 404 page
// @author Benjamin Urquhart
// @match *://deltarune.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=deltarune.com
// @grant none
// ==/UserScript==
@BenjaminUrquhart
BenjaminUrquhart / GMInvoke.cpp
Created January 27, 2022 03:24
Source to the GMInvoke GMS extension to comply with GPL3
#include <Windows.h>
#include <iostream>
#include <string>
#define func extern "C" __declspec(dllexport)
// Some boilerplate code
// Taken from https://github.com/Archie-osu/YYToolkit
#define TRoutine void*
@BenjaminUrquhart
BenjaminUrquhart / RPGDump.java
Created March 3, 2021 04:21
Small program to deobfuscate assets from RPG Maker games. Requires org.json.
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
# Usage: python add.py
# Enter a positive number via standard input
# It will print the number plus one
class Incrementer:
n = 0
def __init__(self, n =0):
self.n = n
@BenjaminUrquhart
BenjaminUrquhart / BadJSON.java
Last active February 13, 2019 22:46
JSON parser for r/badcode
import java.util.HashMap;
import java.util.Arrays;
public class BadJSON {
public static HashMap<String, Object> parseJSON(String s) {
String toParse = new String();
for(char character : s.toCharArray()) toParse = toParse + (character == 10 ? new String() : new String(new char[]{character}));
HashMap<String, Object> out = new HashMap<String, Object>();
if(toParse.charAt(0) != '{' || toParse.charAt(toParse.length() - 1) != '}') return out;
@BenjaminUrquhart
BenjaminUrquhart / BFJ.java
Last active February 15, 2019 02:31
BrainF interpreter in Java
package net.benjaminurquhart.bfj;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import javax.script.ScriptException;
public class BFJ {