Skip to content

Instantly share code, notes, and snippets.

View bryantdrewjones's full-sized avatar
💭
☕️☺️

Bryant Drew Jones bryantdrewjones

💭
☕️☺️
View GitHub Profile
@bryantdrewjones
bryantdrewjones / arm64_assembly.s
Last active May 15, 2024 21:23
Computer Enhance Part 3.8 Homework -- Linking Directly to ASM (on macOS/arm64)
// @NOTE(BDJ): Resources:
// - ARM ABI: https://github.com/ARM-software/abi-aa (see "Procedure Call Standard for the Arm 64-bit Architecture")
// - Apple's ARM64 ABI: https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms
// - ARM instruction reference: https://developer.arm.com/documentation/dui0802/b/A64-General-Instructions
// - clang/GNU assembler syntax reference: https://developer.arm.com/documentation/100068/0622/Migrating-from-armasm-to-the-armclang-Integrated-Assembler/Overview-of-differences-between-armasm-and-GNU-syntax-assembly-code
//
// There are a few minor assembler syntax differences compared to NASM:
//
// - all label names have to be unique--including loop labels
// - no leading `.` in front of labels
@bryantdrewjones
bryantdrewjones / bake.json
Created May 22, 2020 00:05
Cross-Compiling for iOS with Bake
{
// Set `BAKE_OS` to the lowercase, shorthand OS name that matches what
// clang expects for the `sys` portion of the "target triple." See
// clang's cross-compilation docs for more info:
// https://clang.llvm.org/docs/CrossCompilation.html
// Set `BAKE_ARCHITECTURE` to the target architecture (the `arch` portion
// of clang's target triple). To compile for multiple architectures, build
// them one by one and use the `lipo` tool to merge them together.
@bryantdrewjones
bryantdrewjones / Bake.sublime-build
Created May 13, 2020 18:10
A basic build system for Bake in Sublime Text 3
{
"shell_cmd": "bake", // https://github.com/SanderMertens/bake
"keyfiles": [ "project.json" ],
"working_dir": "${project_path:${folder}}",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
// The ANSIescape package (installed via Package Control) is
// required to support the ANSI escape colour codes used by
// the Bake build system. Without it, Sublime's console is
// littered with visible escape codes like "<0x1b>".
@bryantdrewjones
bryantdrewjones / SetConstantTangents.cs
Created October 1, 2017 22:33
Set constant tangets on a Unity animation clip
// This script is published under the CC0 1.0 Universal License
// https://creativecommons.org/publicdomain/zero/1.0/
// To the extent possible under law, Spryly® Ltd. has waived all copyright
// and related or neighboring rights to this script. This work is published from: Canada.
using UnityEngine;
using UnityEditor;
using System.Collections;
public static class SetConstantTangents {
@bryantdrewjones
bryantdrewjones / TakeScreenshot.cs
Created March 17, 2016 15:21
Captures a screenshot of the game while in Play mode
using UnityEngine;
using UnityEditor;
using System.Collections;
public class TakeScreenshot : ScriptableObject {
[MenuItem ("Assets/Screenshot/Capture 1X")]
static public void CaptureScreenshot1X() {
Application.CaptureScreenshot( "Screenshot1X.png" );
}
public void ForcedFullGarbageCollection() {
var size = GC.GetTotalMemory(false);
for (var i = 0; i < 100; ++i) {
GC.Collect();
GC.WaitForFullGCComplete();
GC.WaitForPendingFinalizers();
var newSize = GC.GetTotalMemory(false);
var delta = (size - newSize) / (double)size;
if (delta < 0.01)
break;