diff --git a/include/sections.h b/include/sections.h index 8a73000..392a832 100644 --- a/include/sections.h +++ b/include/sections.h @@ -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[]; diff --git a/linker_scripts/us/symbol_addrs.txt b/linker_scripts/us/symbol_addrs.txt index 56adc11..0142611 100644 --- a/linker_scripts/us/symbol_addrs.txt +++ b/linker_scripts/us/symbol_addrs.txt @@ -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 diff --git a/src/1CF30.c b/src/1CF30.c index d93490e..85957b4 100644 --- a/src/1CF30.c +++ b/src/1CF30.c @@ -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; diff --git a/src/E1C0.c b/src/E1C0.c index ae02091..4380569 100644 --- a/src/E1C0.c +++ b/src/E1C0.c @@ -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); diff --git a/src/fragments/35/fragment35.c b/src/fragments/35/fragment35.c index d4f9d09..49380e3 100644 --- a/src/fragments/35/fragment35.c +++ b/src/fragments/35/fragment35.c @@ -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); diff --git a/tools/compress_yay0.py b/tools/compress_yay0.py new file mode 100755 index 0000000..2071d4c --- /dev/null +++ b/tools/compress_yay0.py @@ -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") diff --git a/tools/decompress_yay0.py b/tools/decompress_yay0.py new file mode 100755 index 0000000..4c413a5 --- /dev/null +++ b/tools/decompress_yay0.py @@ -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") diff --git a/tools/validate_assets.py b/tools/validate_assets.py new file mode 100755 index 0000000..76ecf48 --- /dev/null +++ b/tools/validate_assets.py @@ -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) diff --git a/yamls/us/rom.yaml b/yamls/us/rom.yaml index d6c2dd0..963eb03 100644 --- a/yamls/us/rom.yaml +++ b/yamls/us/rom.yaml @@ -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]