Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
1 user currently in Rom Hacking: hukka | 2 guests
Acmlm's Board - I2 Archive - Rom Hacking - Mario 64 - Amazing Stuff | |
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
BGNG

Snifit
Level: 22

Posts: 53/276
EXP: 56579
For next: 1771

Since: 06-03-05

Since last post: 8 days
Last activity: 3 hours
Posted on 06-20-05 08:12 AM Link | Quote
You can calculate the size of the compressed MIO0 file. It just takes a little work.

The MIO0 header includes an offset for raw data bytes; bytes which are uncompressed. All other data in the file comes before the raw data, so if you can find out the number of uncompressed data bytes, you can easily find the packaged length of the file.

Fortunately, the number of raw bytes IS included in the file, just not directly. You'll have to scan through all the "data map prefixes" and tally up the total number of 1's. The number you'll have at the end of all accumulation will be the total number of raw data bytes.

Just add the calculated value to the raw data offset and subtract one, and presto: compressed file length.
__________

EDIT:
My VB instincts are kicking in. In C++, where the first byte of a file is indexed at 0, you won't need to subtract one to find the total length... but you already knew that.


(edited by BGNG on 06-19-05 11:14 PM)
VL-Tone

Red Cheep-cheep
Level: 23

Posts: 52/200
EXP: 64158
For next: 3565

Since: 06-06-04
From: In the Moon!

Since last post: 5 days
Last activity: 2 hours
Posted on 06-20-05 08:22 AM Link | Quote
Wow I forgot how this was to be seen as a milestone in M64 hacking Thanks for all the positive comments

I thought about doing a separate thread at first because of the other title, but found that it was better to keep all info in one thread...

Ok I just came back from work, I'm gonna cook myself a dinner, then I'll post a little description of the vertex and triangle list format, hopefully someone will be able to build something from it and find the use of the unknown parts.

BGNG, I would guess that the reason HyperHacker was crashing the game is because he didn't know what he was doing Seriously I just mean that changing polygon data to random numbers will likely crash the game. Once I post the details of it, you'll be able to know more about it and do more controlled editing. Maybe after-all there is no checksum or size issue involved.

Also it took me (only) two nights to crack the format, and hacking StarFox certainly heIped. I had the whole castle displayed only this morning so I didn't have time to do further exploration. Ok now I'm hungry, I have to go

Don't be too impatient, but I'll try to post the info in 1 or 2 hours from now.
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 5110/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 06-20-05 09:10 AM Link | Quote
No, it was because I didn't know the game needed the bitmap to be padded to a multiple of 4 bytes. Once I do that I can edit the data just fine... the problem is getting the compressor to do that right. You're right, though, to assume I don't know much about 3D graphics.
BGNG

Snifit
Level: 22

Posts: 54/276
EXP: 56579
For next: 1771

Since: 06-03-05

Since last post: 8 days
Last activity: 3 hours
Posted on 06-20-05 09:20 AM Link | Quote
But one thing is certain, HyperHacker: Your MIO0 compressor works.
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 5114/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 06-20-05 09:29 AM Link | Quote
Almost. The new version has that damn padding bug that's driving me nuts but otherwise, yeah, it's working. Still not as well as Nintendo's though.
BGNG

Snifit
Level: 22

Posts: 55/276
EXP: 56579
For next: 1771

Since: 06-03-05

Since last post: 8 days
Last activity: 3 hours
Posted on 06-20-05 09:56 AM Link | Quote
That's kind of ironic... You made a compressor for an all-but-undocumented MIO0 algorithm, but you can't add FileLength % 4 bytes to the end of a file before compressing? I'm not being mean; it's just kinda weird.
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 5115/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 06-20-05 10:06 AM Link | Quote
Yeah, bugs the hell out of me. It seems like it's writing one too many bytes in the bitmap, but if I take the last byte out it doesn't work right. It's always the simple things that get you.
VL-Tone

Red Cheep-cheep
Level: 23

Posts: 53/200
EXP: 64158
For next: 3565

Since: 06-06-04
From: In the Moon!

Since last post: 5 days
Last activity: 2 hours
Posted on 06-20-05 10:37 AM Link | Quote
HyperHacker, I really didn't want to imply anything negative in my comment

What I meant is that you simply didn't know the particular mesh format for M64 at the time (and I didn't know either) and it sure didn't help you to know what you did that crashed the game. I'm sure (I hope) you won't have problems understanding the 3d graphic aspect when I post the info. You did a great job on Mario 64, and I expect it to continue like that in the future

Ok here is the basic mesh definition info.

Let's look at a simple object in the castle playfield, which is the canon box.

This is the triangle data list (which may include other things than triangles)


FD 10 00 00 09 00 48 00
E6 00 00 00 00 00 00 00
F3 00 00 00 07 7F F1 00

03 86 00 10 07 00 BC E0
03 88 00 10 07 00 BC D8

04 B0 00 C0 07 00 BD 50

BF 00 00 00 00 00 0A 14
BF 00 00 00 00 00 14 1E
BF 00 00 00 00 28 32 3C
BF 00 00 00 00 28 46 32
BF 00 00 00 00 50 5A 64
BF 00 00 00 00 50 6E 5A

03 86 00 10 07 00 BC F8
03 88 00 10 07 00 BC F0

04 70 00 80 07 00 BE 10
BF 00 00 00 00 00 0A 14
BF 00 00 00 00 00 1E 0A
BF 00 00 00 00 28 32 3C
BF 00 00 00 00 28 46 32
.... (other data follows)



I only know about the use of chunk type "04" and "BF"

04 B0 00 C0 07 00 BD 50 ----> seems to be the start of a triangle group.
The important (known) bytes are the last three: "00 BD 50"
00BD50 will be used as a base address for this triangle group.

It points to an address in the current MIO0 file. As you can see in this address table I made, 00BD50 is also the start of the vertex position list.


Castle Field Tower Canon
Vertex Lists: 3000 6F98 96F8 A328 A8D0 B240 BD50 C2A0

Triangle Lists: 5F60 89F8 9FD8 A728 AFD0 B820 C070 C3A0


Each entry in the vertex data list is 16 bytes long.
This is the first entry at BD50:

08 EB FE 5A 08 18 00 00 00 06 07 20 00 7F 00 FF

To get the 3d space coordinated it's very simple: X=$08EB Y=$FE5A and Z=$0818

These are 16-bits signed integers so for example $FFFF= -1 , $0001=1 and $FE5A=-422

The 7th and 8th bytes are always 0000 it seems.
I don't know yet the meaning of the other 8 bytes, I would guess this is the color and/or UV texture coordinates. (color on my rendering were added by me)
The last byte is usually either 00 or FF or B4, I used that to find the end of the vertex data.


But let's get back to the triangle data...

The BF chunk type are triangles defined with 3 bytes, each one pointing to a vertex position.

BF 00 00 00 00 28 32 3C is the third triangle in the data.

The last three bytes are the important ones here.

First take $28 divide by ten, and multiply by 16 (in hex $10). Add the result to the current base address (00BD50) and you get 00BD90 which is the address where you can find this particular vertex position.

As far as the other types go, I skipped them when decoding the data.

Note that once you get to the second group of triangles starting with a 04 chunk type, the new "base address" will be set to 00BE10.

Ok so let's do a round-up as a step-by-step guide to decode the basic mesh data.

1-Read the triangle list data, 8 bytes at a time, skipping any 8 bytes chunk not starting with "04" or "BF"
2-When you find a "04" chunk, read it's last 3 bytes and set the "base address" to this number.
3-When you find a "BF" chunk, start reading it's last 3 bytes.
4-Read the first out of the three last bytes in the BF chunk divide by 10 (dec) and multiply by 16 (dec).
5-Add the current base address to the result and go read 6 bytes at this address.
6-Store/convert the 6 bytes to X,Y,Z coordinates for a point in space.
7-Repeat from step 4 for the last 2 bytes of the current BF data chunk.
8-Store the results as 3 points in space defining a triangle.
9-Repeat the whole sequence from step 1 until you run out of triangle (BF) data

The rule I defined to find the end of the triangle data made my routine stop when the chunk type is -not- FD,E6,F3,B8,03,04 or BF.
But we need a better way to find the end of the two data lists. Also I had to manually find each entry in this list of addresses for the 44ABC0 MIO0:

There is no header or way to find the start of the vertex and triangle lists. So for other MIO0 files we'll have to find them by hand in a hex-editor. There must be an offset table somewhere pointing at those, but I cannot find it.

There is still a lot of things missing, but there are allot of people ready to help for this game it seems!

So people, remember that we are still a few hundred kilometers before a Mario 64 level editor, but obviously this is a step in the right direction

(Edit: Too many edits)


(edited by VL-Tone on 06-20-05 02:01 AM)
(edited by VL-Tone on 06-20-05 02:05 AM)
(edited by VL-Tone on 06-20-05 02:09 AM)
(edited by VL-Tone on 06-20-05 02:16 AM)
(edited by VL-Tone on 06-20-05 02:40 AM)
Shyguy
The Original Femme Fatale!
Level: 57

Posts: 1228/1998
EXP: 1443008
For next: 42920

Since: 02-14-05

Since last post: 2 hours
Last activity: 1 hour
Posted on 06-20-05 06:39 PM Link | Quote
Yes, the n00b talks. And he says: WOW!
Just wow. I don't even know where I am anymore! This is something we call a breakthrough. It's Super freakin' Mario blasted 64 you're editing! I wish I knew as much as you all. I am definately a n00b.
Knuckles T15X

Keese
Level: 20

Posts: 131/134
EXP: 37896
For next: 4543

Since: 03-15-04
From: ROM Hackville, SMASHachussetts

Since last post: 109 days
Last activity: 11 days
Posted on 06-20-05 09:03 PM Link | Quote
Originally posted by BGNG
It's in the ROM, bub. Get on the ball and you'll have it at your disposal.
Yes, I have the bloody ROM. No, I don't really understand how to extract it from the ROM without access to an emulator since no N64 emulators will work for me.
BGNG

Snifit
Level: 22

Posts: 56/276
EXP: 56579
For next: 1771

Since: 06-03-05

Since last post: 8 days
Last activity: 3 hours
Posted on 06-20-05 09:30 PM Link | Quote
Shyguy:

I guess some games are more noteworthy than others, eh? I've hacked F- freakin' Zero blasted X, but only people who have been dying for the Expansion Kit have given it much praise.
__________

Knuckles T15X:

I recommend Project64 v1.6 if you haven't already tried it. It has high compatibility for both target system and ROM support, so it might do the job for you.
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 5123/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 06-20-05 10:36 PM Link | Quote
Yeah, I thought it was pretty amazing that you were able to do that, but I hadn't really played the game much before then. (It'd help if I didn't have to close everything to get it running full speed either. ) Mario 64 is a lot more well-known though, despite how much ass F-Zero kicks.
NEONswift

Rope
Level: 19

Posts: 55/117
EXP: 30883
For next: 4894

Since: 03-17-04
From: England

Since last post: 24 days
Last activity: 1 day
Posted on 06-20-05 11:33 PM Link | Quote
Originally posted by BGNG
Shyguy:

I guess some games are more noteworthy than others, eh? I've hacked F- freakin' Zero blasted X, but only people who have been dying for the Expansion Kit have given it much praise.
Dude youre a fuckin god for doing F-Zero X. I dont really need the editor myself seeing as my best mate has the 64DD and the expansion kit. People who arent as lucky though to have an obscure piece of Crazy Jap kit will definately need to take a look at your work. If they havent already they don't know what theyre missing.

Like a year ago people said it was gonna be years before anyone hacks a 64 game and noobs asking this in threads were laughed at and told to bugger off. How times change.
Kyoufu Kawa
I'm not bad. I'm just drawn that way.
Level: 70

Posts: 1675/2481
EXP: 3008456
For next: 7355

Since: 03-19-04
From: Catgirl Central

Since last post: 14 hours
Last activity: 13 hours
Posted on 06-21-05 12:07 AM Link | Quote
Here's my three cents:

Cent 1: Mario's screenwipe
Cent 2: Level data for Peach's Castle (main garden)
Cent 1: Full script + table

All three are from the DS version cos I don't have the 64 version. Cent 2 includes pre-unpacked files for comparison with 64
BGNG

Snifit
Level: 22

Posts: 58/276
EXP: 56579
For next: 1771

Since: 06-03-05

Since last post: 8 days
Last activity: 3 hours
Posted on 06-21-05 12:25 AM Link | Quote
That's great and all, but there are two Cent 1's and zero Cent 3's.
Kyoufu Kawa
I'm not bad. I'm just drawn that way.
Level: 70

Posts: 1678/2481
EXP: 3008456
For next: 7355

Since: 03-19-04
From: Catgirl Central

Since last post: 14 hours
Last activity: 13 hours
Posted on 06-21-05 12:31 AM Link | Quote
Don't you know the old acmlmboard saying "there is no three"?
BGNG

Snifit
Level: 22

Posts: 59/276
EXP: 56579
For next: 1771

Since: 06-03-05

Since last post: 8 days
Last activity: 3 hours
Posted on 06-21-05 01:27 AM Link | Quote
No. There is no "there is no three"
Kario

In Possession of a Stolen Shovel

Level: 65

Posts: 1822/2082
EXP: 2321379
For next: 14249

Since: 03-15-04
From: Texas... Yeehaw!

Since last post: 2 days
Last activity: 17 hours
Posted on 06-21-05 01:58 AM Link | Quote
Originally posted by Smallhacker
Ho... Ly... Crap... What's next? A complete 3D rendering of the infinite stairs BEFORE you get enough stars?


Just thought I would point out something in case you didnt know. The infinite stairs dont go on forever. There is just a point that it resets you closer to the bottom, but it is set up so it doesnt look obvious. If you walk up it backwards you will see what i mean.
NEONswift

Rope
Level: 19

Posts: 56/117
EXP: 30883
For next: 4894

Since: 03-17-04
From: England

Since last post: 24 days
Last activity: 1 day
Posted on 06-21-05 02:19 AM Link | Quote
Originally posted by Sawnec
Originally posted by Smallhacker
Ho... Ly... Crap... What's next? A complete 3D rendering of the infinite stairs BEFORE you get enough stars?


Just thought I would point out something in case you didnt know. The infinite stairs dont go on forever. There is just a point that it resets you closer to the bottom, but it is set up so it doesnt look obvious. If you walk up it backwards you will see what i mean.
Dude if you noticed the post that said about a 3d render of the inifinate stairs how the hell did you miss the post that came right after saying "DS version shows that the instant you reach a specific step, you're pushed back."?!?


(edited by NEONswift on 06-20-05 05:21 PM)
Knuckles T15X

Keese
Level: 20

Posts: 132/134
EXP: 37896
For next: 4543

Since: 03-15-04
From: ROM Hackville, SMASHachussetts

Since last post: 109 days
Last activity: 11 days
Posted on 06-21-05 03:38 AM Link | Quote
Originally posted by BGNG
Knuckles T15X:

I recommend Project64 v1.6 if you haven't already tried it. It has high compatibility for both target system and ROM support, so it might do the job for you.
Yeah-huh. That's the first one I tried. My GFX card apparently isn't good enough for it.
So, is there a method to get the geometry without using an emulator?
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Rom Hacking - Mario 64 - Amazing Stuff | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.021 seconds.