Skip to content

Instantly share code, notes, and snippets.

View lardratboy's full-sized avatar

Brad P. Taylor lardratboy

View GitHub Profile
@lardratboy
lardratboy / B2Pv0.html
Created February 2, 2025 22:02
Tool to view bytes as points supports images and binary data
<head>
<title>B2P - Bytes To Points</title>
<style>
body {
margin: 0;
}
canvas {
width: 100%;
height: 100%;
@lardratboy
lardratboy / repack.js
Created January 31, 2025 05:35
quick and dirty python->javascript version of repack.py
class Rect {
constructor(left, top, right, bottom) {
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
}
width() { return this.right - this.left; }
height() { return this.bottom - this.top; }
}
import io, struct, argparse
class Chunk:
def __init__(self, id):
self.id = id
self.children = []
def process_chunk( input, parent_chunk, remaining_data, depth = 0 ):
if None != parent_chunk.id and not parent_chunk.id in [ 'MULT', 'WRAP', 'TALK', 'TLKB', 'LECF', 'LFLF', 'SONG', 'NEST', 'SOUN', 'DIGI', 'AKOS', 'AWIZ' ]:
input.seek( input.tell() + remaining_data )
@lardratboy
lardratboy / DataViewAs.js
Last active November 11, 2024 23:55
Asked claude.ai for a wrapper around the DataView class - results were interesting
// Data type ranges and normalization functions
const DATA_RANGES = {
'int8': [-128, 127],
'uint8': [0, 255],
'int16': [-32768, 32767],
'uint16': [0, 65535],
'int32': [-2147483648, 2147483647],
'uint32': [0, 4294967295],
};
@lardratboy
lardratboy / puke_bpt.py
Last active May 29, 2024 20:32
quick and dirty tool to display the chunk structure of a .bpt file
import io, struct, argparse
class Chunk:
def __init__(self, id):
self.id = id
self.children = []
def process_chunk( input, size_encoding, parent_chunk, remaining_data, depth = 0 ):
if None != parent_chunk.id and not parent_chunk.id in [ 'aBPT', 'aLII', 'aFRM', 'aLYR', 'aVEL', 'nPAL', 'nAMS', 'aANM', 'nFMS', 'nVLS', 'nLIS', 'nLRS' ]:
input.seek( input.tell() + remaining_data )
@lardratboy
lardratboy / repack.py
Last active May 31, 2024 17:50
quick and dirty 2D rectangle packer, for best results insert items in sorted order largest to smallest
class Rect:
def __init__(self, left, top, right, bottom):
self.left = left
self.top = top
self.right = right
self.bottom = bottom
def width(self):
@lardratboy
lardratboy / BPTRenderMaterialAs.cs
Last active November 23, 2015 23:28
Unity3d Utility Extension to render a Material to a .PNG (or JPG)
using UnityEngine;
#if UNITY_EDITOR
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
#endif
@lardratboy
lardratboy / Test
Created February 4, 2015 23:11
Test
package test;
public class Test {
static int[][] MAP_A = {
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,1,1,0},
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ironictest
{
class Program
{
@lardratboy
lardratboy / PSD.h
Created December 11, 2014 02:26
This is an expanded version of the my PSD reader - handles layers, named alphas it is a bit messy but what living code isn't...
// Adobe Photoshop .PSD bitmap file loader
//
// Copyright (c) 2002, Brad P. Taylor, LLC
//
// All rights reserved, unauthorized reproduction prohibited
//
// -- FILE NOTES --
//
//////////////////////////////////////////////////////////////////////