Skip to content

Instantly share code, notes, and snippets.

View nkrapivin's full-sized avatar
🐱
exactly.

Nikita Krapivin nkrapivin

🐱
exactly.
View GitHub Profile
@nkrapivin
nkrapivin / gist:f3118d1396000979db1f2c2eaf43309e
Last active November 26, 2021 18:33
undocumented debug_event stuff
some may only work on Linux, or only on consoles...
usage: debug_event("thing here");
DumpMemory - prints the amount of allocated memory to console (Total memory used 0xblabla bytes)
CheckGLError - I assume it's supposed to ignore OpenGL errors? But it seems to be unused lol.
VMTraceOn - sets g_fVMDebug to true
VMTraceOff - sets that variable to false
@nkrapivin
nkrapivin / GMHandshake.cs
Created May 31, 2021 15:53
GameMaker network handshake implementation.
#nullable enable
using System;
using System.Net.Sockets;
using System.Runtime.Serialization;
using System.Text;
namespace nkrapivindev
{
/// <summary>
@nkrapivin
nkrapivin / Program.cs
Last active July 19, 2021 16:58
Zeus Linux IDE patcher
/*! how to compile: `csc Program.cs -r:Mono.Cecil.dll`
* how to use: `mono Program.exe /opt/GameMakerStudio2/IDE.dll`
* OR, FOR RED: `mono Program.exe /opt/GameMakerStudio2-Dev/IDE.dll`
*
* the Cecil dll can be obtained manually from NuGet. (which is what I did)
* thanks to YoYo not obfuscating Linux builds, we can easily do our funky stuff.
*
* also hi to all YoYo employees reading this, please take care of yourself, hydrate,
* go outside (in a mask), take breaks from work, and don't patch this program, or I will become vewy sad :<
*/
@nkrapivin
nkrapivin / cursed.cs
Created September 26, 2021 15:40
fnames to pascal case thing
// See https://aka.ms/new-console-template for more information
var namespath = @"C:\ProgramData\GameMakerStudio2-Dev\Cache\runtimes\runtime-9.9.1.2226\fnames";
var lines = File.ReadAllLines(namespath);
var specchars = new[] { '#', '*', '@', '&', '$', '£', '!', '%', '?', '[', '(' };
Console.WriteLine("// copy and paste me into your game:");
foreach (var sline in lines)
{
@nkrapivin
nkrapivin / Rutranslit.gml
Last active November 26, 2021 13:50
Rutranslit GML library
/// @function Rutranslit([useSoftSigns])
/// @param {bool} [useSoftSigns] (optional) true - Translit soft signs, false - ignore them.
/// @description This class allows you to convert Russian strings to English translit.
/// @returns {Rutranslit} self
function Rutranslit(useSoftSigns) constructor {
// private:
m_lookup = undefined;
/// @description (private) Initializes the lookup table.
@nkrapivin
nkrapivin / TGINParse.gml
Last active December 22, 2021 12:26
coded quickly in a few hours
/// @function TGINAssert(assertExpr, assertMsg)
/// @description assert() like function, do not use in your game code.
/// @param {bool} assertExpr boolean-ish exception
/// @param {string} assertMsg string that will be used if an assertion had failed.
/// @returns nothing, throws on error
function TGINAssert(assertExpr, assertMsg) {
if (!assertExpr)
throw string_replace("TGINParse: Assertion Failed: %s", "%s", string(assertMsg));
}
@nkrapivin
nkrapivin / runshi.sh
Last active March 7, 2022 10:01
Runshi (Ранши) - RUN.SH IMproved
#!/bin/bash
# lo and behold, runshi 2, aka the worst piece of bash ever written!
# -- PLEASE CHANGE THIS ONE, IT'S A RELATIVE PATH TO YOUR GAME EXECUTABLE --
NIK_MYCMD="./Mondealy_Full"
# in seconds, if your computer is extremely slow you may want to use higher amounts.
NIK_DELAY=1
# You usually do not need to touch the rest...
NIK_OLDIFS="$IFS"
@nkrapivin
nkrapivin / nikXfix.c
Last active March 10, 2022 08:44
libnikXfix - a small hack to fix keyboard input in Linux GameMaker games.
/*
Compile me as:
Release version - `gcc -fPIC -ldl -shared nikXfix.c -o libnikXfix.so`
Debug version - `gcc -fPIC -g -O0 -DDEBUG -ldl -shared nikXfix.c -o libnikXfix.so`
Then load with LD_PRELOAD="./assets/libnikXfix.so" (.so is to be placed in Included Files)
Enjoy!
*/
#define _GNU_SOURCE 1
#include <stdlib.h>
#include <stdio.h>
@nkrapivin
nkrapivin / notarize.sh
Created March 12, 2022 13:08
Proper notarization of macOS apps since Xcode 13+
#!/bin/sh
# this script must be ran in the same directory as the .app file!
# change this
APP_NAME="Sonic Time Twisted.app"
# must be a 'Developer ID: ' cert, not Mac Distribution etc...
CERT_NAME="Developer ID: kekeke@lololo.com (AAAABBBB)"
MAC_USER_PASS="1234"
PRODUCT_NAME="myproduct"
# this is the name of a notarytool profile, you have to make it ONCE with this command:
# xcrun notarytool store-credentials "Profile_Name" --apple-id "your apple id email here" --team-id YourTeamIDHere --password PasswordOrAppPassword
@nkrapivin
nkrapivin / input_switch_invoke.gml
Created April 16, 2022 12:54
Input Switch applet bindings
/// @description A little wrapper around Input and the Switch controllers applet. To be used instead of hot swapping.
/// @param {Real} minPlayersReal Minimum amount of players
/// @param {Real} maxPlayersReal Maximum amount of players
/// @param {Bool} maintainConnectionBool Whether to NOT disconnect controllers during the applet
/// @param {Bool} permitJoyConDualBool Whether to allow dual Joy-Cons in the applet
function input_switch_invoke(minPlayersReal, maxPlayersReal, maintainConnectionBool, permitJoyConDualBool) {
var _spBool = minPlayersReal <= 1 && maxPlayersReal <= 1;
// input_switch_invoke(1, 1, true); // will invoke the singleplayer applet
// input_switch_invoke(1, 2, true); // will invoke the co-op applet