Skip to content

Instantly share code, notes, and snippets.

View McZonk's full-sized avatar

Max McZonk

  • Germany
View GitHub Profile
@McZonk
McZonk / raven-freeplay.bsdiff
Last active May 16, 2025 12:13
Support for free play in Raven pinball
42534449 46463430 46000000 00000000 62000000 00000000 00200000 00000000 425A6839 31415926 535909D0 61FC0000 186F6078 1A0800C0 00008008 00010040 02000820 0022BCA0 687A8DA8 530004D2 345424A0 00387CDB 9C932EBF 17724538 509009D0 61FC425A 68393141 59265359 704D8022 000010F5 CFC40000 02102222 00820000 8C00E021 16811210 00820000 08200040 C9434000 0F14F285 00034000 0D54800A A1102809 00E6928B 01D9F6D7 B89BD61D 7569677F A96C24A1 04FE2EE4 8A70A120 E09B0044 425A6839 31415926 53596E35 6D570000 107F7BA8 88400344 A8800081 04408048 00430020 000A2000 03401088 004100A0 00488934 00680D31 0789A9EA 18609813 010D1934 C3016267 1019040D 0BC237EA D87DD04E 98FA4B21 23315464 D2A192BC 1AB88462 D79C8BB9 229C2848 371AB6AB 80
import os
import sys
romName = sys.argv[1]
checksum = 0
with open(romName, 'rb') as rom:
while True:
byte = rom.read(1)
@McZonk
McZonk / DisplayCode.csv
Last active May 9, 2025 19:21
Street Fighter 2 pinball DMD messages
name hexadecimal comment
NewSequence bb Starts a new sequence (with parameters)
Checksum 01 `0xCC, 0x21, 0xBB, 0x01, checksum, checksum`
SwitchShort 02 `0xBB, 0x02, index`
Highscore 03 `0xBB, 0x03, number, name, name, name, score, score, score, score, score`
SendCredits 04 `0xBB, 0x04, credits`
Continue 05 `0xCC, 0x08, 0xBB, 0x05, time`
TextCursor 06 `0xCC, 0x06, cursor index, character at cursor`. Can be send after `TextMessage`
ErrorJumper 07 `0xBB, 0x07, language`
NewHighscore 08 `0xBB, 0x08, player`
@McZonk
McZonk / ExtractStrings.py
Created April 3, 2025 06:06
Localization strings for Street Fighter 2 pinball from the display rom.
#!/usr/bin/python3
import os
import csv
romPath = 'ROMs/dsprom.rom'
csvPath = 'dsprom.csv'
with open(romPath, 'rb') as file:
output = open(csvPath, 'w')
__attribute__((objc_root_class)) @interface BaseClass
- (id)propertyListRepresentation __attribute__((objc_requires_super));
@end
@implementation BaseClass
- (id)propertyListRepresentation
{
return 0;
}
@McZonk
McZonk / AVCaptureMovieFileOutput.m
Created December 1, 2014 23:08
[AVCaptureMovieFileOutput recordedFileSize]
long long -[AVCaptureMovieFileOutput recordedFileSize](void * self, void * _cmd) {
r14 = *_OBJC_IVAR_$_AVCaptureMovieFileOutput._internal;
OSSpinLockLock(*(self + r14) + *_OBJC_IVAR_$_AVCaptureMovieFileOutputInternal.statsLock);
rdi = *(self + r14);
rbx = rdi->sizeWritten;
OSSpinLockUnlock(rdi + *_OBJC_IVAR_$_AVCaptureMovieFileOutputInternal.statsLock);
rax = rbx;
return rax;
}
@McZonk
McZonk / main.c
Created September 21, 2014 21:07
#ifdef __OBJC__
// clang -framework Foundation -o ObjC -ObjC main.c
#import <Foundation/Foundation.h>
int main(int argc, const char **argv)
{
NSString *string = [[NSString alloc] initWithUTF8String:"Objective-C"];
#import <Foundation/Foundation.h>
@protocol SomeProtocol <NSObject>
- (void)someMethod;
@end
@protocol MyProtocol <SomeProtocol>
- (void)myMethod;
+ (NSCharacterSet *)ignoredCharactersBeforeSmartInserts
{
static NSCharacterSet *characterSet;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
/*
Character set taken from AppKit's __getPreSmartSet
*/
NSMutableCharacterSet *mutableSet = [NSMutableCharacterSet characterSetWithCharactersInString:@"([\\\"'#$/-`{<"];
@McZonk
McZonk / GKLeaderboardIdentifier.m
Created February 12, 2014 21:41
Fix the missing declaration of the GKLeaderboard identifier on OS X 10.9.
#import <Foundation/Foundation.h>
#import <GameKit/GameKit.h>
@interface GKLeaderboard (IdentifierSupport)
@property (copy, readonly) NSString *identifier;
@end