News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

### Author Topic: A stupid question about calculating length of mio0 data  (Read 1357 times)

#### SleepyFist

• Hero Member
• Posts: 856
##### A stupid question about calculating length of mio0 data
« on: October 29, 2016, 10:26:51 am »
Im trying to make a rom map for Shindou Mario 64, Ive Identified the location of the mio0 blocks(wasn't hard with a non-byteswapped rom).

The problem is I've got the hex
00 01 5B AE (decompressed length)
00 00 0F 60 (compressed offset)
00 00 64 AC (uncompressed offset)

but I don't know how to calculate the actual len as it is in the rom,
again it might be basic math, probably something I should know already, I'm not sure, but if someone can teach me how to get a proper len out of these values I would appreciate it.

the map I'm working on is based on these
https://www.smwcentral.net/?p=nmap&m=sm64rom
Sleepy's Album of the week|| Chicken Wings - Monikaze || https://youtu.be/11IKI36yDoo

#### Zoinkity

• Hero Member
• Posts: 562
##### Re: A stupid question about calculating length of mio0 data
« Reply #1 on: October 29, 2016, 09:18:25 pm »
The only way to determine the length of a MIO, Yaz, or Yay archive is to walk through the compression to find data consumed.

For an example, look at sizeof() in this implementation here:
http://pastebin.com/GUHMwpjT

#### SleepyFist

• Hero Member
• Posts: 856
##### Re: A stupid question about calculating length of mio0 data
« Reply #2 on: October 30, 2016, 10:27:49 am »
I'm looking at it, but I don't completely understand what I'm looking at,
not versed in programming language, sorry.
Sleepy's Album of the week|| Chicken Wings - Monikaze || https://youtu.be/11IKI36yDoo

#### Zoinkity

• Hero Member
• Posts: 562
##### Re: A stupid question about calculating length of mio0 data
« Reply #3 on: October 30, 2016, 10:14:48 pm »
The thing about these is they don't define a filesize.  So, the only way to know its actual size (before padding) is to either log it when decompressing or walk through the file as if you were decompressing it.  You could fudge it though in this case, and the padding really doesn't matter.

This being the game it is, there's these helpful little tables that are used to load resources.  They give the start and endpoint in ROM for the file they load, MIO files included.  You can search for just the ROM address of a file, then copy out its endpoint.  It doesn't help for all of them (the first you can find via ASM reference) but does most of them.

Here's a good chunk of them to get started:
Code: [Select]
`0xE42C0 bin0xE42F0 MIO0xEF770 MIO0x1029D0 bin0x105800 MIO0x10D870 bin0x10DC80 MIO0x10FA90 bin0x10FD40 MIO0x1165F0 bin0x116930 MIO0x120C30 bin0x120EB0 MIO0x12CB90 bin0x12D1F0 MIO0x13B300 bin0x13B690 MIO0x140700 bin0x140A70 MIO0x141BF0 bin0x141C80 MIO0x1485E0 bin0x148890 MIO0x15B560 bin0x15BBD0 MIO0x162FC0 bin0x163460 MIO0x194090 bin0x194CE0 MIO0x19EDD0 bin0x19F250 MIO0x1B2CB0 bin0x1B3330 MIO0x1BFC10 bin0x1C0210 MIO0x1C2DB0 bin0x1C2F00 MIO0x1CCB50 bin0x1CD220 MIO0x1DB8F0 bin0x1DC430 MIO0x1F3DC0 bin0x1F4E20 bin0x1FA4E0 bin0x244360 bin0x2448A0 MIO0x249800 MIO0x24ACA0 MIO0x24E3A0 bin0x280B20 bin0x280FB0 MIO0x286AC0 bin0x2874D0 MIO0x293D30 MIO0x2A21F0 MIO0x2AAE60 MIO0x2B1310 MIO0x2C26A0 MIO0x2CC300 MIO0x2D5FD0 MIO0x2DCAF0 MIO0x2E7CE0 MIO0x2F8FF0 MIO0x301C60 MIO0x307E90 MIO0x30F950 MIO0x318530 MIO0x31BF60 MIO0x322870 MIO0x329580 MIO0x32C780 MIO0x332170 MIO0x339B30 MIO0x3407A0 MIO0x34A350 MIO0x34CA60 MIO0x35D6E0 bin0x35E770 MIO0x370AB0 bin0x371160 MIO0x3A9EF0 bin0x3ABBE0 MIO0x3C1820 bin0x3C24D0 MIO0x3D67B0 bin0x3D70D0 MIO0x3E0880 bin0x3E0DD0 MIO0x3E9660 bin0x3E9B90 MIO0x3F4DB0 bin0x3F5580 MIO0x3FE940 bin0x3FF4F0 MIO0x407500 bin0x407D40 MIO0x412220 bin0x412690 MIO0x424F60 bin0x4259E0 MIO0x42F400 bin0x42FC20 MIO0x436D80 bin0x437420 MIO0x43C040 bin0x43C2F0 MIO0x445660 bin0x445EB0 MIO0x446FC0 bin0x4471C0 MIO0x452B20 bin0x4532C0 MIO0x4677D0 bin0x468750 MIO0x470880 bin0x470EB0 MIO0x478870 bin0x479530 MIO0x4872D0 bin0x487390 MIO0x48A490 bin0x48A750 MIO0x492D30 bin0x492EF0 MIO0x499800 bin0x499A50 MIO0x49D520 bin0x49D740 MIO0x49EFE0 bin0x49F140 MIO0x4A8750 bin0x4A89F0 MIO0x4A9810 bin0x4A9A20 MIO0x4AC310 bin0x4AC730 MIO0x4C6010 bin0x4C6E20 bin`