identify a few asset bins

This commit is contained in:
ProjectRevoTPP
2024-09-22 20:49:08 -04:00
parent e817b052b0
commit 96006bf4ab
9 changed files with 88 additions and 12 deletions

View File

@@ -434,10 +434,10 @@ extern u8 fragment77_ROM_END[];
// Asset externs
extern u8 _3B96B0_ROM_START[];
extern u8 _3B96B0_ROM_END[];
extern u8 _3BA190_ROM_START[];
extern u8 _3BA190_ROM_END[];
extern u8 n64_logo_texture_ROM_START[]; // 3B96B0
extern u8 n64_logo_texture_ROM_END[]; // 3B96B0
extern u8 fonts_ROM_START[]; // 3BA190
extern u8 fonts_ROM_END[]; // 3BA190
extern u8 _3CB130_ROM_START[];
extern u8 _3CB130_ROM_END[];
extern u8 _45B580_ROM_START[];

View File

@@ -182,8 +182,8 @@ fragment74_ROM_START = 0x3B88D0; // defined:true
fragment75_ROM_START = 0x3B8960; // defined:true
fragment76_ROM_START = 0x3B9590; // defined:true
fragment77_ROM_START = 0x3B9620; // defined:true
_3B96B0_ROM_START = 0x3B96B0; // defined:true
_3BA190_ROM_START = 0x3BA190; // defined:true
n64_logo_texture_ROM_START = 0x3B96B0; // defined:true
fonts_ROM_START = 0x3BA190; // defined:true
_3CB130_ROM_START = 0x3CB130; // defined:true
_45B580_ROM_START = 0x45B580; // defined:true
_4A21C0_ROM_START = 0x4A21C0; // defined:true

View File

@@ -379,7 +379,7 @@ void func_8001E884(s32 arg0, s32 arg1, s32 arg2) {
unk_D_800AC870* func_8001E94C(s32 arg0, s32 arg1) {
D_800AC870 = main_pool_alloc_with_func(sizeof(*D_800AC870), arg1, 'PRNT', func_8001E7C0);
bzero(D_800AC870, sizeof(*D_800AC870));
D_800AC870->unk_48 = ASSET_LOAD2(func_800044F4, _3BA190, 1, 1);
D_800AC870->unk_48 = ASSET_LOAD2(func_800044F4, fonts, 1, 1);
func_8001E9F0(arg0);
return D_800AC870;

View File

@@ -64,7 +64,7 @@ void func_8000D738(UnkInputStruct8000D738* arg0) {
D_800AA664 = main_pool_alloc(0x21E0, 0);
func_80004454(FRAGMENT_ID(fragment1), fragment1_ROM_START, fragment1_relocs_ROM_END);
temp_v0 = ASSET_LOAD2(func_800044F4, _3BA190, 1, 1);
temp_v0 = ASSET_LOAD2(func_800044F4, fonts, 1, 1);
D_800AA660->unk_21FC = func_8000484C(temp_v0, 0);
D_800AA660->unk_2200 = func_8000484C(temp_v0, 1);

View File

@@ -71,7 +71,7 @@ s32 func_820003A4(UNUSED s32 arg0, UNUSED s32 arg1) {
sp2C = func_80007444(0, 1, 2, 0, 2, 1);
ASSET_LOAD(D_1000000, _4BD6B0, 0);
ASSET_LOAD(D_2000000, _3B96B0, 0);
ASSET_LOAD(D_2000000, n64_logo_texture, 0);
func_80028AFC(2);
func_80007678(sp2C);

20
tools/compress_yay0.py Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env python3
import sys
import re
import os
from pathlib import Path
import crunch64
# This will only compress an asset that has a single Yay0!
# usage: compress_yay0.py [in file] [out file]
filepath = Path(sys.argv[1])
filebytes = filepath.read_bytes()
compressed = crunch64.yay0.compress(filebytes)
fileout = Path(sys.argv[2])
fileout.write_bytes(compressed)
print("Yay0 compressed")

20
tools/decompress_yay0.py Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env python3
import sys
import re
import os
from pathlib import Path
import crunch64
# This will only decompress an asset that has a single Yay0!
# usage: decompress_yay0.py [in file] [out file]
filepath = Path(sys.argv[1])
filebytes = filepath.read_bytes()
decompressed = crunch64.yay0.decompress(filebytes)
fileout = Path(sys.argv[2])
fileout.write_bytes(decompressed)
print("Yay0 decompressed")

35
tools/validate_assets.py Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env python3
import sys
import re
import os
# asset validator v0.1
# not used for anything but manual validation checks. Please dont use this for anything.
# Defines
# ------------------------
asset_dir = '../assets/us'
# Functions
# ------------------------
# Return the number of times the string "Yay0" appears in a given file.
def get_yay0_count(file):
count = file.read().count(b'\x59\x61\x79\x30') # check for yay0
return count
# Main program
# ------------------------
print("Yay0 instances per asset bin: ")
print("----------------------------------")
for filename in os.listdir(asset_dir):
if ".bin" in filename and "bootcode_font.bin" not in filename and "7C0000.bin" not in filename:
filepath = asset_dir + '/' + filename
file = open(filepath, 'rb')
yay0_count = get_yay0_count(file)
file.close()
print(filename, ":", yay0_count)

View File

@@ -2423,12 +2423,13 @@
subsegments:
- [0x3B96A0, rodatabin, fragments/77/fragment77_reloc]
- [0x3B96B0, bin]
- [0x3BA190, bin]
# assets
- [0x3B96B0, bin, n64_logo_texture]
- [0x3BA190, bin, fonts]
- [0x3CB130, bin]
- [0x45B580, bin]
- [0x4A21C0, bin]
- [0x4BD6B0, bin]
- [0x4BD6B0, bin] # like a common assets bin?
- [0x4BE810, bin]
- [0x4D1330, bin]
- [0x4EB0C0, bin]