Skip to content

Instantly share code, notes, and snippets.

View aboood40091's full-sized avatar

AboodXD aboood40091

View GitHub Profile
@aboood40091
aboood40091 / swizzle.py
Created June 3, 2018 18:32
Swizzling algorithm for Tegra X1
def DIV_ROUND_UP(n, d):
return (n + d - 1) // d
def round_up(x, y):
return ((x - 1) | (y - 1)) + 1
def pow2_round_up(x):
x -= 1
@aboood40091
aboood40091 / ptcl_extract.py
Created June 9, 2018 13:54
A script for extracting GSH files from PTCL files used in Wii U games
# Copyright (C) 2018 MasterVermilli0n / AboodXD
# This script extracts GSH files from PTCL files used in Wii U games
import struct
class PTCLHeader(struct.Struct):
def __init__(self):
super().__init__('>4s2I4x11I')
@aboood40091
aboood40091 / obj_sorter.py
Created July 4, 2018 08:12
A tool to sort NSMBU/NSLU .json objects manually
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Object Sorter
# Copyright © 2018 AboodXD
import json, os, re, sys
from PyQt5.QtCore import QSize
from PyQt5.QtGui import QIcon, QPalette, QPixmap
@aboood40091
aboood40091 / bfres_tex_replacer.py
Created July 9, 2018 12:07
A tool for replacing BNTX files inside a BFRES
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# BFRES textures replacer
# Copyright © 2018 AboodXD
import struct
import time
from tkinter import Tk, filedialog
@aboood40091
aboood40091 / bone.py
Last active February 15, 2021 09:53
Basic class for bones in native python
from math import asin, atan2, copysign, cos, fabs, pi, sin
def _matMultiply(mat1, mat2):
matW1 = len(mat1[0])
matH1 = len(mat1)
matW2 = len(mat2[0])
matH2 = len(mat2)
assert matW1 == matH2
@aboood40091
aboood40091 / sharc_read.py
Created July 8, 2019 09:01
Shader Archive (SHAA/.sharc) reader
import struct
import os
header = None
supported_versions = [0xA, 0xB]
class Header:
def __init__(self, endianness='<'):
import json
import os
import struct
import shutil
from PIL import Image
folder = input('Enter folder path:')
outFolder = os.path.join(folder, "out")
if not os.path.isdir(outFolder):
@aboood40091
aboood40091 / setup.py
Created August 25, 2019 18:08
Build all pyx files in the same directory as this script.
from distutils.core import setup
from Cython.Build import cythonize
from os import listdir
for file in listdir('.'):
if file[-4:] == '.pyx':
setup(ext_modules = cythonize(file))
root_heaps:
- heap_name: RootHeap
heap_type: ExpHeap
heap_address: 0x1061F068
heap_size: 0x3C000000
heap_direction: Forward
heap_children:
- heap_name: sead::ThreadMgr
heap_type: ExpHeap
heap_address: 0x1061F12C
@aboood40091
aboood40091 / aglResShaderArchive.cpp
Created May 5, 2021 00:48
Decompilation / Rewrite of agl::ResBinaryShaderArchive (and relevant structures) for SHARCFB parsing
#include "aglResShaderArchive.h"
#include <cstring>
namespace agl {
const char* ResBinaryShaderArchiveData::getExtension()
{
return ".sharcfb";
}