Skip to content

Instantly share code, notes, and snippets.

@Myriachan
Myriachan / FF6ItemCheckAll.py
Created May 8, 2024 04:20
Script to see whether a Beyond Chaos seed allows getting every item
import sys
import re
# Flags for the item map
FLAG_SAFE = 1 << 0
FLAG_STEAL = 1 << 1
FLAG_DROP = 1 << 2
FLAG_MORPH = 1 << 3
FLAG_TREASURE = 1 << 4
@Myriachan
Myriachan / AFUnixIoctlIssue.cpp
Created November 14, 2019 00:20
AFUnixIoctlIssue.cpp - demo of SIO_AF_UNIX_GETPEERPID bug
#define _WIN32_WINNT 0x0A00
#include <WinSock2.h>
#include <Windows.h>
#include <afunix.h>
#include <cstdio>
#include <cstddef>
#include <cstring>
#include <cwchar>
#pragma comment(lib, "ws2_32.lib")
@Myriachan
Myriachan / rudinnhathycrashfix.txt
Last active November 12, 2018 18:24
Fix for Deltarune crash bug in Rudinn + Hathy battle
In Deltarune, the following steps crash the game. I didn't find this bug, but I know how to fix it.
1. Recruit Susie permanently.
2. Go to the location of the save point that is called "Field - Maze of Death".
3. Walk left to the next screen.
4. Walk past the puzzle and start an encounter with the Rudinn walking around. This starts a battle with the Rudinn and a Hathy.
5. Highlight Act and press Z.
6. Highlight Hathy and press Z.
7. Highlight S-Flatter and press X to cancel.
8. Highlight Act and press Z again.
@Myriachan
Myriachan / sighax-optimization.txt
Created January 1, 2017 06:52
Ideas for further optimization of sighax bruteforcing
Myria 2016-12-31
I have some ideas for improving the sighax brute-force algorithm, but I have not yet implemented them to measure the difference in performance.
The first optimization relates to the "mod" operation. We are always mod-ing by the same number, the modulus. We might be able to take advantage of this by using Barrett reduction to turn the mod into a multiplication, shift right, and subtract. I don't know whether this would improve performance over GMP's mpz_mod.
The second and third optimizations are mutually-exclusive.
The second optimization is instead of multiplying by random values to the 65537th power, square the current number. Squaring a number is faster than multiplying two different numbers. (((x^2)^2)^2...)^65537 = (((x^65537)^2)^2)^2..., so this works. To get the base value, count how many squares have been done and apply them to x. Reset this procedure every million attempts or so, so that recovering x once a possibility is found doesn't take just as long as finding it. Neg
@Myriachan
Myriachan / ARMCodeTest.c
Created March 4, 2016 07:12
ARM code support on Windows RT/IoT detection and example.
// ARM code support on Windows RT/IoT detection and example.
// By Myria, 2016/03/03.
#ifndef _M_ARM_NT
#error "This code is for ARMv7-Thumb2 only."
#endif
#define _WIN32_WINNT 0x0602
#include <errno.h>