Skip to content

Instantly share code, notes, and snippets.

@MaddTheSane
MaddTheSane / bt.txt
Created February 9, 2022 09:57
MTGS backtrace
* thread #8, name = 'MTGS'
* frame #0: 0x00007ff81473dc20 Metal`-[_MTLCommandBuffer waitUntilCompleted] + 72
frame #1: 0x000000010d16dfe4 PCSX2`GSDeviceMTL::DownloadTexture(GSTexture*, GSVector4i const&, GSTexture::GSMap&) + 564
frame #2: 0x000000010d0bcd63 PCSX2`GSDevice::DownloadTextureConvert(GSTexture*, GSVector4 const&, GSVector2T<int> const&, GSTexture::Format, ShaderConvert, GSTexture::GSMap&, bool) + 163
frame #3: 0x000000010d0dbed9 PCSX2`GSTextureCache::Read(GSTextureCache::Target*, GSVector4i const&) + 313
frame #4: 0x000000010d0e2acc PCSX2`GSTextureCache::InvalidateLocalMem(GSOffset const&, GSVector4i const&) + 668
frame #5: 0x000000010d0cc3d4 PCSX2`GSRendererHW::InvalidateLocalMem(GIFRegBITBLTBUF const&, GSVector4i const&, bool) + 116
frame #6: 0x000000010d097f83 PCSX2`GSState::Move() + 179
frame #7: 0x000000010d09eef1 PCSX2`void GSState::Transfer<3>(unsigned char const*, unsigned int) + 993
@MaddTheSane
MaddTheSane / PreferencesManager.m
Last active April 15, 2019 03:32 — forked from boyvanamstel/PreferencesManager.c
Objective-C class to loop through startup items with Automatic Reference Counting (ARC) enabled
// Based on http://www.bdunagan.com/2010/09/25/cocoa-tip-enabling-launch-on-startup/
// Almost automatic convert to ARC, might need tweaking.
#import "PreferencesManager.h"
@implementation PreferencesManager
// MIT license
- (BOOL)isLaunchAtStartup {
// See if the app is currently in LoginItems.
@MaddTheSane
MaddTheSane / CGDataProvider+FILEPointer.c
Created August 1, 2016 20:09
A callback for CGDataProvider around the file pointer
#include <CoreGraphics/CoreGraphics.h>
static size_t FILEGetBytesCallback(void * __nullable info, void * buffer, size_t count)
{
if (info == NULL) {
return 0;
}
FILE *fInfo = info;
size_t retVal = fread(buffer, 1, count, fInfo);
return retVal;
@MaddTheSane
MaddTheSane / BugHunting.swift
Last active February 26, 2016 06:13
Bug hunting for Swift Reddit
// TODO: Write some awesome Swift code, or import libraries like "Foundation",
// "Dispatch", or "Glibc"
import Foundation
class ExampleClass {
var Id: Int
var Name: String
init(id: Int, name: String){
@MaddTheSane
MaddTheSane / crc32.swift
Last active April 28, 2022 06:06
crc32 implemented in Swift
//
// crc32.swift
// SuperSFV
//
// Created by C.W. Betts on 8/23/15.
//
//
/* crc32.swift -- compute the CRC-32 of a data stream
Copyright (C) 1995-1998 Mark Adler
Copyright (C) 2015 C.W. "Madd the Sane" Betts
//
// Glob.swift
//
// Created by Brad Grzesiak on 6/25/15.
// Copyright © 2015 Bendyworks Inc.
// Released under the Apache v2 License.
//
import Foundation
@MaddTheSane
MaddTheSane / ARCBridge.h
Last active July 21, 2023 13:46
A header for bridging between ARC and non-ARC code, I.E., 32- vs. 64-bit OS X.
#ifndef PPMacho_ARCBridge_h
#define PPMacho_ARCBridge_h
#include <AvailabilityMacros.h>
#if __has_feature(objc_arc)
#define SUPERDEALLOC
#define RELEASEOBJ(obj)
#define RETAINOBJ(obj) obj
#define RETAINOBJNORETURN(obj)
???:PlayerPROKit.framework User$ ls -lah
total 32
drwxr-xr-x 7 User staff 238B Nov 24 19:27 .
drwxr-xr-x 118 User staff 3.9K Nov 24 19:27 ..
lrwxr-xr-x 1 User staff 24B Nov 24 19:27 Headers -> Versions/Current/Headers
lrwxr-xr-x 1 User staff 24B Nov 24 19:27 Modules -> Versions/Current/Modules
lrwxr-xr-x 1 User staff 29B Nov 24 19:27 PlayerPROKit -> Versions/Current/PlayerPROKit
lrwxr-xr-x 1 User staff 26B Nov 24 19:27 Resources -> Versions/Current/Resources
drwxr-xr-x 4 User staff 136B Nov 24 19:27 Versions
???:PlayerPROKit.framework User$ cd Versions/
@MaddTheSane
MaddTheSane / messagebox.mm
Last active August 29, 2015 14:10
DXX-rebirth MessageBox, Cocoa version.
/*
* This file is part of the DXX-Rebirth project <http://www.dxx-rebirth.com/>.
* It is copyright by its individual contributors, as recorded in the
* project's Git history. See COPYING.txt at the top level for license
* terms and a link to the Git history.
*/
/*
* messagebox.mm
* d1x-rebirth
*
@MaddTheSane
MaddTheSane / XAttrEncoding.m
Last active August 29, 2015 14:08 — forked from mwaterfall/gist:543667
Get/set the NSString text encoding of a file using xattr.
//
// NSString+FileTextEncodingAttribute.h
// Adapted from http://github.com/scrod/nv/blob/master/NSString_NV.m
//
#import <Foundation/Foundation.h>
#include <sys/xattr.h>
@interface NSString (FileTextEncodingAttribute)