Skip to content

Commit fa72903

Browse files
committed
identify a few asset bins
1 parent 4ce95f9 commit fa72903

File tree

9 files changed

+88
-12
lines changed

9 files changed

+88
-12
lines changed

include/sections.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -434,10 +434,10 @@ extern u8 fragment77_ROM_END[];
434434

435435
// Asset externs
436436

437-
extern u8 _3B96B0_ROM_START[];
438-
extern u8 _3B96B0_ROM_END[];
439-
extern u8 _3BA190_ROM_START[];
440-
extern u8 _3BA190_ROM_END[];
437+
extern u8 n64_logo_texture_ROM_START[]; // 3B96B0
438+
extern u8 n64_logo_texture_ROM_END[]; // 3B96B0
439+
extern u8 fonts_ROM_START[]; // 3BA190
440+
extern u8 fonts_ROM_END[]; // 3BA190
441441
extern u8 _3CB130_ROM_START[];
442442
extern u8 _3CB130_ROM_END[];
443443
extern u8 _45B580_ROM_START[];

linker_scripts/us/symbol_addrs.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ fragment74_ROM_START = 0x3B88D0; // defined:true
182182
fragment75_ROM_START = 0x3B8960; // defined:true
183183
fragment76_ROM_START = 0x3B9590; // defined:true
184184
fragment77_ROM_START = 0x3B9620; // defined:true
185-
_3B96B0_ROM_START = 0x3B96B0; // defined:true
186-
_3BA190_ROM_START = 0x3BA190; // defined:true
185+
n64_logo_texture_ROM_START = 0x3B96B0; // defined:true
186+
fonts_ROM_START = 0x3BA190; // defined:true
187187
_3CB130_ROM_START = 0x3CB130; // defined:true
188188
_45B580_ROM_START = 0x45B580; // defined:true
189189
_4A21C0_ROM_START = 0x4A21C0; // defined:true

src/1CF30.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ void func_8001E884(s32 arg0, s32 arg1, s32 arg2) {
379379
unk_D_800AC870* func_8001E94C(s32 arg0, s32 arg1) {
380380
D_800AC870 = main_pool_alloc_with_func(sizeof(*D_800AC870), arg1, 'PRNT', func_8001E7C0);
381381
bzero(D_800AC870, sizeof(*D_800AC870));
382-
D_800AC870->unk_48 = ASSET_LOAD2(func_800044F4, _3BA190, 1, 1);
382+
D_800AC870->unk_48 = ASSET_LOAD2(func_800044F4, fonts, 1, 1);
383383
func_8001E9F0(arg0);
384384

385385
return D_800AC870;

src/E1C0.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void func_8000D738(UnkInputStruct8000D738* arg0) {
6464
D_800AA664 = main_pool_alloc(0x21E0, 0);
6565

6666
func_80004454(FRAGMENT_ID(fragment1), fragment1_ROM_START, fragment1_relocs_ROM_END);
67-
temp_v0 = ASSET_LOAD2(func_800044F4, _3BA190, 1, 1);
67+
temp_v0 = ASSET_LOAD2(func_800044F4, fonts, 1, 1);
6868

6969
D_800AA660->unk_21FC = func_8000484C(temp_v0, 0);
7070
D_800AA660->unk_2200 = func_8000484C(temp_v0, 1);

src/fragments/35/fragment35.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ s32 func_820003A4(UNUSED s32 arg0, UNUSED s32 arg1) {
7171
sp2C = func_80007444(0, 1, 2, 0, 2, 1);
7272

7373
ASSET_LOAD(D_1000000, _4BD6B0, 0);
74-
ASSET_LOAD(D_2000000, _3B96B0, 0);
74+
ASSET_LOAD(D_2000000, n64_logo_texture, 0);
7575

7676
func_80028AFC(2);
7777
func_80007678(sp2C);

tools/compress_yay0.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env python3
2+
3+
import sys
4+
import re
5+
import os
6+
from pathlib import Path
7+
import crunch64
8+
9+
# This will only compress an asset that has a single Yay0!
10+
# usage: compress_yay0.py [in file] [out file]
11+
12+
filepath = Path(sys.argv[1])
13+
filebytes = filepath.read_bytes()
14+
15+
compressed = crunch64.yay0.compress(filebytes)
16+
17+
fileout = Path(sys.argv[2])
18+
fileout.write_bytes(compressed)
19+
20+
print("Yay0 compressed")

tools/decompress_yay0.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env python3
2+
3+
import sys
4+
import re
5+
import os
6+
from pathlib import Path
7+
import crunch64
8+
9+
# This will only decompress an asset that has a single Yay0!
10+
# usage: decompress_yay0.py [in file] [out file]
11+
12+
filepath = Path(sys.argv[1])
13+
filebytes = filepath.read_bytes()
14+
15+
decompressed = crunch64.yay0.decompress(filebytes)
16+
17+
fileout = Path(sys.argv[2])
18+
fileout.write_bytes(decompressed)
19+
20+
print("Yay0 decompressed")

tools/validate_assets.py

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env python3
2+
3+
import sys
4+
import re
5+
import os
6+
7+
# asset validator v0.1
8+
# not used for anything but manual validation checks. Please dont use this for anything.
9+
10+
# Defines
11+
# ------------------------
12+
13+
asset_dir = '../assets/us'
14+
15+
# Functions
16+
# ------------------------
17+
18+
# Return the number of times the string "Yay0" appears in a given file.
19+
def get_yay0_count(file):
20+
count = file.read().count(b'\x59\x61\x79\x30') # check for yay0
21+
return count
22+
23+
# Main program
24+
# ------------------------
25+
26+
print("Yay0 instances per asset bin: ")
27+
print("----------------------------------")
28+
29+
for filename in os.listdir(asset_dir):
30+
if ".bin" in filename and "bootcode_font.bin" not in filename and "7C0000.bin" not in filename:
31+
filepath = asset_dir + '/' + filename
32+
file = open(filepath, 'rb')
33+
yay0_count = get_yay0_count(file)
34+
file.close()
35+
print(filename, ":", yay0_count)

yamls/us/rom.yaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -2423,12 +2423,13 @@
24232423
subsegments:
24242424
- [0x3B96A0, rodatabin, fragments/77/fragment77_reloc]
24252425

2426-
- [0x3B96B0, bin]
2427-
- [0x3BA190, bin]
2426+
# assets
2427+
- [0x3B96B0, bin, n64_logo_texture]
2428+
- [0x3BA190, bin, fonts]
24282429
- [0x3CB130, bin]
24292430
- [0x45B580, bin]
24302431
- [0x4A21C0, bin]
2431-
- [0x4BD6B0, bin]
2432+
- [0x4BD6B0, bin] # like a common assets bin?
24322433
- [0x4BE810, bin]
24332434
- [0x4D1330, bin]
24342435
- [0x4EB0C0, bin]

0 commit comments

Comments
 (0)