Update tools (#16)

* Clean up .gitignore

* Set exec bit on all python and shell scripts

* Delete unused files

* Add decomp-permuter repo

* Update submodules
This commit is contained in:
Rozelette
2020-09-13 21:09:13 -04:00
committed by GitHub
parent 189d0d6c30
commit ec912054da
30 changed files with 49 additions and 6124 deletions
+38 -18
View File
@@ -1,22 +1,42 @@
# Cache files
__pycache__/
.pyc
.DS_Store
# Text editor remnants
.vscode/
.vs/
.idea/
CMakeLists.txt
cmake-build-debug
venv/
# Project-specific ignores
*.z64
*.bin
*.elf
doc/*
archive/*
build/*
baserom/*
decomp/*
S/*
asm/*
font_test/*
ido/*
__pychahe__/*
*.pyc
test.txt
*.xlsx
src/test.c
*.dump
tools/ido5.3_compiler/*
tools/ido7.1_compiler/*
expected/*
archive/
build/
baserom/
decomp/
asm/
expected/
nonmatchings/
# Tool artifacts
tools/ido5.3_compiler/
tools/ido7.1_compiler/
tools/qemu-mips
# Assets
*.rgba32.png
*.rgb5a1.png
*.i4.png
*.i8.png
*.ia4.png
*.ia8.png
*.ci4.png
*.ci8.png
# Per-user configuration
.python-version
+3
View File
@@ -7,3 +7,6 @@
[submodule "tools/ZAP2"]
path = tools/ZAP2
url = https://github.com/NEstelami/ZAP2.git
[submodule "tools/decomp-permuter"]
path = tools/decomp-permuter
url = https://github.com/simonlindholm/decomp-permuter
-10
View File
@@ -1,10 +0,0 @@
#!/bin/bash
OBJDUMP="${MIPS_BINUTILS_PREFIX}objdump -D -z -mmips -EB -j .text -j .data -j .rodata"
FORMATTER="sed '/^0/!s/.*://'"
$OBJDUMP build/src/test.o | sed '1,6d; /^0/!s/.*://' > test.dump
$OBJDUMP $1 | sed '1,6d; /^0/!s/.*://' > comp.dump
diff -y test.dump comp.dump > diff.dump
rm test.dump comp.dump
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
-3975
View File
File diff suppressed because it is too large Load Diff
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
-178
View File
@@ -1,178 +0,0 @@
#!/usr/bin/env python3
import struct;
from tkinter import *;
from tkinter.ttk import *
from PIL import Image, ImageTk, ImageDraw
import png;
#FILE_NAME = 'baserom/jpn_font_static'
FILE_NAME = 'decomp/object_boss03'
data = []
image_data = [];
try:
with open(FILE_NAME, 'rb') as f:
data = f.read()
except IOError:
print('failed to read file ' + FILE_NAME)
sys.exit(1)
#size = 0x80
height = 32
width = 32
pixel_width = 2
size = height*width*pixel_width
scale = 4
window = Tk()
window.title("MM Texture viewer")
window.geometry('500x500')
def load_file():
print('load')
update_image()
def read_i4_image(data, image_data):
for i in range(0, len(data)):
byte = data[i]
color1 = ((byte >> 4) & 0xF) * 17
color2 = (byte & 0xF) * 17
image_data.append(color1)
image_data.append(color1)
image_data.append(color1)
image_data.append(255)
image_data.append(color2)
image_data.append(color2)
image_data.append(color2)
image_data.append(255)
def read_i8_image(data, image_data):
for i in range(0, len(data)):
byte = data[i]
image_data.append(byte)
image_data.append(byte)
image_data.append(byte)
image_data.append(255)
def read_ia4_image(data, image_data):
None
def read_ia8_image(data, image_data):
None
def read_ia16_image(data, image_data):
None
def read_rbg5a1_image(data, image_data):
for i in range(0, len(data) // 2):
byte1 = data[i*2]
byte2 = data[i*2 + 1]
red = (byte1 >> 3)*8
green = (((byte1&0x7)<<2) | ((byte2>>6)&0x3))*8
blue = ((byte2 >> 1) & 0x1F)*8
alpha = (byte2&0x1)*0xFF
image_data.append(red)
image_data.append(green)
image_data.append(blue)
image_data.append(alpha)
def read_rbga32_image(data, image_data):
for i in range(0, len(data)):
byte = data[i]
image_data.append(byte)
def read_ci4_image(data, image_data):
None
def read_ci8_image(data, image_data):
None
def update_image(*args):
global image_label
global image_data
global data
image_data = []
texture_type = texture_type_combo.get()
if texture_type == 'i4':
read_i4_image(data, image_data)
elif texture_type == 'i8':
read_i8_image(data, image_data)
elif texture_type == 'ia4':
read_ia4_image(data, image_data)
elif texture_type == 'ia8':
read_ia8_image(data, image_data)
elif texture_type == 'ia16':
read_ia16_image(data, image_data)
elif texture_type == 'rbg5a1':
read_rbg5a1_image(data, image_data)
elif texture_type == 'rbga32':
read_rbga32_image(data, image_data)
elif texture_type == 'ci4':
read_ci4_image(data, image_data)
elif texture_type == 'ci8':
read_ci8_image(data, image_data)
else:
print('other type')
offset = int(offset_spinbox.get())
image = Image.frombytes("RGBA", (width, height), bytes(image_data[offset*4:])).resize((width*scale, height*scale))
image_tk = ImageTk.PhotoImage(image=image)
image_label.configure(image=image_tk)
image_label.image = image_tk # prevent GC?
load_button = Button(window, text='Load File', command=load_file)
load_button.pack()
texture_type_combo = Combobox(window)
texture_type_combo['values'] = ('i4', 'i8', 'ia4', 'ia8', 'ia16', 'rbg5a1', 'rbga32', 'ci4', 'ci8')
texture_type_combo.current(5)
texture_type_combo.bind("<<ComboboxSelected>>", update_image)
texture_type_combo.pack()
# TODO textures should be able to only take a few discret values, find them
width_default = StringVar(window)
width_default.set("32")
width_spinbox = Spinbox(window, from_=1, to=48, textvariable=width_default, command=update_image)
width_spinbox.pack();
offset_default = StringVar(window)
offset_default.set("0")
offset_spinbox = Spinbox(window, from_=0, to=len(data), textvariable=offset_default, command=update_image)
offset_spinbox.pack();
image_label = Label(window)
image_label.pack()
update_image()
window.mainloop()
#for i in range(0, len(data) // size):
# texture_data = data[(i * size):((i + 1) * size)]
#
# with open('font_test2/' + str(i) + '.png', 'wb') as f:
# w = png.Writer(width, height, alpha=True)#, greyscale=True)#
# png_data = [];
# for y in range(0, height):
# row = []
# '''
# for x in range(0, 16//2):
# byte = texture_data[8*y + x]
# row.append(((byte >> 4) & 0xF) * 17)
# row.append((byte & 0xF) * 17)
# '''
# '''
# for x in range(0, width*pixel_width):
# byte = texture_data[width*pixel_width*y + x]
# row.append(byte)
# '''
# png_data.append(row)
# w.write(f, png_data)
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File

Some files were not shown because too many files have changed in this diff Show More