Skip to content

Instantly share code, notes, and snippets.

Investigating the transference glitch in Mario Maker 2

I watched the offset blocks video and got nerd-sniped by "we don't really know why this happens". So I spent some more time on my hobby of reverse engineering this game.

TL;DR

When a block is hit, its collision type is set to 0 (disabled), and an actor is created to play the block-hit animation. Also, the block's bottom-left corner is converted to an integer grid square, rounding towards zero, and that square in the visual appearance grid (which is separate from collision) is set to empty.

When the animation is finished, the actor takes the x/y coordinates corresponding to its center and converts them to an integer grid square, again rounding towards zero. Then it iterates over the collision list for that grid square, searching for a block with a collision type of 0 (which would normally be the same block it was spawned from). When it finds such a block, it sets its collision type based on the type of actor (e

# https://news.ycombinator.com/item?id=38782678
import timeit, random, string, re
def is_palindrome_chatgpt_1(s):
# [written by ChatGPT]
# Convert the string to lowercase and remove non-alphanumeric characters
cleaned_string = ''.join(char.lower() for char in s if char.isalnum())
# Compare the cleaned string with its reverse
#!/usr/bin/env python3
import sys, pty, os, time, threading, queue, argparse
ap = argparse.ArgumentParser()
parser = argparse.ArgumentParser(
description='Tests the input latency of a shell',
usage='usage: shell-latency-test-infinite.py [--sleep] [--] argv-to-execute...',
)
parser.add_argument('--sleep',
action='store_true',
# This will respond to keyboard input after either a 12ms delay (capital A) or
# no delay (lowercase a).
# For some reason this causes up to 50ms of difference in Terminal.app.
# Press Ctrl-C to stop.
import os, time, re, tty, termios
try:
old_settings = termios.tcgetattr(0)
tty.setraw(0)
@comex
comex / shell-latency-test.py
Created September 23, 2023 23:26
Tool to test a shell's input latency
import sys, pty, os, time, signal, threading, string, random
sub_argv = sys.argv[1:]
if not sub_argv:
raise Exception("usage: shell-latency-test.py shell-to-test (e.g.: shell-latency-test.py nu)")
# Spawn the shell in a pty which we own the controlling end of.
child_pid, fd = pty.fork()
if child_pid == 0:
# This is the child process. Exec the shell.
@comex
comex / test.c
Last active August 13, 2023 22:12
#pragma STDC FENV_ACCESS ON
#include <signal.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <fenv.h>
static void check(const char *where) {
printf("%-40s: fegetround() => %#x\n", where, fegetround());
}
@comex
comex / assh
Last active July 14, 2023 21:36
#!/usr/bin/env python3
# SPDX-License-Identifier: CC0-1.0
'''Wraps the ssh command, but quotes arguments so that they are passed 1:1 to
the remote command.
'''
import shlex, sys, os
args = sys.argv[1:][::-1]
out = ['ssh']
while args and args[-1].startswith('-'):
arg = args.pop()
#include <spawn.h>
#include <assert.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <stdio.h>
extern char **environ;
int main(int argc, char **argv) {
if (!argv[1]) {
fprintf(stderr, "usage: spawn-bench <command> [args...]\n");

[Generated by LLaMA 13B with prompt "In the end". I found it amusing.]

In the end, it was always going to be this way.

After 12 years and over 400 hours of TV time, The Simpsons ended with a bittersweet, emotional episode where Homer's dad dies in the most un-Homer Simpson way possible — he passed away peacefully, surrounded by family members who were holding him in his final moments.

And while Homer had always been openly hostile toward his father over the years — especially after finding out Grandpa was a Nazi — it was clear that he actually loved him. This was seen when Homer and Grandpa spent time together, and during an emotional scene where Homer read him a bedtime story.

But as we've grown up with The Simpsons, this episode felt different than any other in the show's history. As a diehard fan of the series, this was one of those episodes that I knew would be the most powerful one yet — and it lived up to my expectations.

~/src/ipsw % git describe
v3.1.277
~/src/ipsw % ./ipsw dyld extract /System/Volumes/Preboot/Cryptexes/Incoming/OS/System/Library/dyld/dyld_shared_cache_arm64e /usr/lib/libsqlite3.dylib -o /tmp/dsc-ipsw --stubs --force --objc
• parsing public symbols...
• parsing private symbols...
• cache does NOT contain local symbols
• parsing objc info...
⨯ failed to parse objc selectors: failed read selector objc_stringhash_t: unexpected EOF
~/src/ipsw % sw_vers
ProductName: macOS