(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
04-19-24 10:00 PM
0 users currently in ROM Hacking.
Acmlm's Board - I3 Archive - ROM Hacking - RLE compression for SMK New poll | |
Pages: 1 2 3Add to favorites | Next newer thread | Next older thread
User Post
Stifu









Since: 11-18-05
From: Your mom's bed

Last post: 6271 days
Last view: 6269 days
Posted on 01-28-07 11:35 AM Link | Quote
I read that the tracks in Super Mario Kart are in RLE format...
I take it you can decompress them using Lunar Compress, considering both Track Designer and mKedit rely on the Lunar Compress DLL...
Anybody know the settings needed to decompress RLE data for SMK ? Format1, format2 ?

Any other related info is welcome too...

Thanks.
Dirtbag

Koopa








Since: 09-20-06
From: UK

Last post: 6273 days
Last view: 6269 days
Posted on 01-28-07 07:42 PM Link | Quote
Looking at the source for mKedit it looks as if it's the same as everything else found so far..

RunRecomp = recompPath + " " + trackname + " " + mKeditROM + " " + Left(CourseList.Text, 5) + " 4 0"

so 4 to 0.

Best of luck mate!
Stifu









Since: 11-18-05
From: Your mom's bed

Last post: 6271 days
Last view: 6269 days
Posted on 01-28-07 07:53 PM Link | Quote
Thanks for the help.

I had already tried that, but couldn't manage to do anything... I'll try again then.

Lunar Compress can't really recompress tracks any better than the original, considering how simple RLE is, so I guess I'll do it the way Bouche did: expand the ROM size, duplicate the track data at the bottom of the ROM, and remap the pointers accordingly...

Edit: while I'm here, any idea whether musics are compressed or not ?


(edited by Stifu on 01-28-07 01:53 PM)
(edited by Stifu on 01-28-07 02:11 PM)
Yoronosuku

Toss Tortoise


 





Since: 11-17-05
From: Massachusetts is my new home..

Last post: 6269 days
Last view: 6269 days
Skype
Posted on 01-28-07 08:27 PM Link | Quote
Music uses the common N-SPC format used by many games. Music is never compressed the SPC7000 can't handle that.
Stifu









Since: 11-18-05
From: Your mom's bed

Last post: 6271 days
Last view: 6269 days
Posted on 01-28-07 08:39 PM Link | Quote
Alright, thanks...

By the way, about tracks... I supposed all decompressed tracks should have the same size (for having the exact same amount of tiles), but that's not the case... Weird stuff. Maybe they just end some tracks sooner when all the last tiles are 00 ones...
Dirtbag

Koopa








Since: 09-20-06
From: UK

Last post: 6273 days
Last view: 6269 days
Posted on 01-28-07 08:39 PM Link | Quote
Originally posted by Yoronosuku
Music uses the common N-SPC format used by many games. Music is never compressed the SPC7000 can't handle that.


I'm sure you are right. However D4s' SMK doc states that the beginning of the music normal and the rest is compressed? I don’t know about Stifu but I can’t edit the music for love nor money
Stifu









Since: 11-18-05
From: Your mom's bed

Last post: 6271 days
Last view: 6269 days
Posted on 01-28-07 08:47 PM Link | Quote
All I did was butcher each music to confirm their location in the ROM.
But I don't know shit about music anyway... I guess we gotta wait for Solar Soundtrack, provided we don't die before it's out.

Oh and about tracks, I thought of something else... Maybe they're in RLE format after having decompressed them the usual way ?


(edited by Stifu on 01-28-07 02:48 PM)
Dirtbag

Koopa








Since: 09-20-06
From: UK

Last post: 6273 days
Last view: 6269 days
Posted on 01-28-07 11:21 PM Link | Quote
Have you seen this document?:

Mario Kart Tile Placement Values
By: DeaDb0Lt - deadb0lt@twcny.rr.com - AIM: SkunkHuffer

----------------------
0n: Lay down 1 tile of the next n number of texture values.
Example: 02FE0001 would lay down 1 FE(Coin) tile, 1 00(Grass) tile,
and 1 01(Pavement) tile contiguously.

1n: NOT TESTED

2n: Lay down n tiles of the next texture value.
Example: 2AF0 would lay down 10 F0(Red Brick) tiles contiguously.

3n: Lay down 16+n tiles of the next texture value.
Example: 32FE would contiguously lay down 19 Coin Tiles. (19 Coming from 16+3)

4n: Not tested
5n: Not tested
6n: Not tested
7n: Not tested
8n: Not tested
9n: Not tested
An: Not tested
Bn: Not tested
Cn: Not tested
Dn: Not tested
En: Not tested
Fn: Not tested
----------------------
FF: Signals track end.
----------------------

NOTE: Tracks are in RLE format. They are 128x128 tiles. As of now, I do not know if it is possible
to make a track larger or smaller. So, when designing a track, it auto-wraps
itself after increments of 128.

Thanks to all who've given me any info reguarding this project.
- DeaDb0Lt
Stifu









Since: 11-18-05
From: Your mom's bed

Last post: 6271 days
Last view: 6269 days
Posted on 01-28-07 11:39 PM Link | Quote
Yep, that's actually thanks to it that I know tracks are in RLE format...

By the way, I'm working on it with a pal, and we're doing some progress... We have to figure out all those "Not tested" things though. That's the thing about mKedit, it compresses thing into the ROM, but can't decompress anything...
Yoronosuku

Toss Tortoise


 





Since: 11-17-05
From: Massachusetts is my new home..

Last post: 6269 days
Last view: 6269 days
Skype
Posted on 01-29-07 01:56 AM Link | Quote
Originally posted by Dirtbag
Originally posted by Yoronosuku
Music uses the common N-SPC format used by many games. Music is never compressed the SPC7000 can't handle that.


I'm sure you are right. However D4s' SMK doc states that the beginning of the music normal and the rest is compressed? I don’t know about Stifu but I can’t edit the music for love nor money

That's impossible. You can't have half an SPC program compressed what many don't know is that music data is essentially a seperate program uploaded in to the memory of the SPC. That would make absolutely no sense and since the co-processor supports no compression on its own...yeah.

The music data is not compressed
GlitchCog

Goomba


 





Since: 01-31-06

Last post: 6281 days
Last view: 6281 days
Posted on 01-30-07 03:35 PM Link | Quote
The purpose of the 6n in SMK's RLE compression format is to count up through the tiles. For example, "6423" would lay down tiles: 23 24 25 26 27

There's probably one for going down the tile order too.
Edit: On second thought, there probably isn't a count down order flag, because switching the order of the tiles wouldn't make a downward sloped curve curve upwards, it'd just turn it into a jagged mess.

Also, E4 seems to repeat n tiles where n is the next value. Then the tile is stored in the value after that. For example, E40A16 would lay down: 16 16 16 16 16 16 16 16 16 16


(edited by GlitchCog on 01-30-07 10:25 AM)
Stifu









Since: 11-18-05
From: Your mom's bed

Last post: 6271 days
Last view: 6269 days
Posted on 01-30-07 09:08 PM Link | Quote
Thanks, GC.
We already figured those out, but that's cool...

And unless I'm mistaken, E40A16 would lay down 11 "16", not 10, as the "00" counts... Therefore you have to add "+1" each time.

I'll spend more time on all that later, but we made a fair load of progress already, which is quite cool. We managed to generate track files that are very close to the TrackDes mkt files, so we are almost there...


(edited by Stifu on 01-30-07 03:12 PM)
(edited by Stifu on 01-30-07 06:14 PM)
GlitchCog

Goomba


 





Since: 01-31-06

Last post: 6281 days
Last view: 6281 days
Posted on 01-31-07 08:06 AM Link | Quote
Oops, yeah, I forgot to count the zero in that.

I started working on an online SMK map viewer, mostly just to help me understand how the RLE compression works, although eventually I'd like for it to be genuinely useful, and maybe turn it into an editor if I can. Here's what I've got so far:

http://matt.yanos.com/smktrk (Give it a second to load)

That's based only on 0n, 2n, 3n, 6n, and E4. I haven't figured out Cn yet, but I've only looked at one instance of it which appeared very confusing.
HyperHacker

Star Mario
Finally being paid to code in VB! If only I still enjoyed that. <_<
Wii #7182 6487 4198 1828


 





Since: 11-18-05
From: Canada, w00t!
My computer's specs, if anyone gives a damn.
STOP TRUNCATING THIS >8^(

Last post: 6270 days
Last view: 6270 days
Posted on 01-31-07 08:45 AM Link | Quote
Originally posted by Dirtbag
3n: Lay down 16+n tiles of the next texture value.
Example: 32FE would contiguously lay down 19 Coin Tiles. (19 Coming from 16+3)

So is it 18 or 19? I don't see where they're getting the 3 from in 16+3, when n=2.
GlitchCog

Goomba


 





Since: 01-31-06

Last post: 6281 days
Last view: 6281 days
Posted on 01-31-07 02:06 PM Link | Quote
It's 19. It's the same zero that I missed. It's misleading to use 32 as an example, because you might think the three flag has something to do with the number of tiles it lays down, but the "2" plus the 16 is what gives 19 because the 2's zero is counted.

2 => 0, 1, 2 = 3
Stifu









Since: 11-18-05
From: Your mom's bed

Last post: 6271 days
Last view: 6269 days
Posted on 01-31-07 05:20 PM Link | Quote
I can't look at it right now, but that's cool, GC... Nice to see someone else is working on that. I'm also planning to make a complete track editor, and I'll share my RLE notes with you once I've managed to fully decompress tracks properly...

I'm hoping my C++ teacher will accept my upcoming track editor as the big university project he wants us to make... That way I'd kill 2 birds with 1 stone, and progress would be fast... I'm waiting for his answer.
Dirtbag

Koopa








Since: 09-20-06
From: UK

Last post: 6273 days
Last view: 6269 days
Posted on 01-31-07 07:40 PM Link | Quote
Originally posted by Stifu
I can't look at it right now, but that's cool, GC... Nice to see someone else is working on that. I'm also planning to make a complete track editor, and I'll share my RLE notes with you once I've managed to fully decompress tracks properly...

I'm hoping my C++ teacher will accept my upcoming track editor as the big university project he wants us to make... That way I'd kill 2 birds with 1 stone, and progress would be fast... I'm waiting for his answer.


That's awesome I hope you are allowed, funny I was thinking today I wish I'd done something like this as my final uni project. I did some FTP app.

Just a thought, and I understand the primary aim is a track editor, and that will take some time but.. with all the notes you have accumulated you could build on this as a base to change all sorts – more than setting the start finish line for TT’s like, drive attributes etc. If you do an open source project I'd be more than willing to try and write a few functions for it.
Stifu









Since: 11-18-05
From: Your mom's bed

Last post: 6271 days
Last view: 6269 days
Posted on 01-31-07 09:55 PM Link | Quote
First things first, let's wait for my track editor to work and to be pretty much complete before thinking of expanding it to other things... but your help will be welcome.

Our decompressor now works perfectly apart from one little bug when the RLE track has "00 0A" in it... Weirdly, our decompressor generates "0D 0A" rather than just "0A"...
Anyway, here are our current raw notes for GC:


0x0n : the next n data stored are not compressed.
02 F0 F4 63 produce F0 F4 63

0x1n : ???????????

0x2n : repeats n data.
22 F0 produce F0 F0 F0

0x3n : repeats 16+n data
32 F0 produce ????????

0x4n : ???????????
0x5n : ???????????

0x6n : 2 bytes, 0x6n data. Data is incremented each time
62 03 produce 03 04 05

0x7n : ???????????

0x8n : 3 bytes 0x8n XX YY => "Block copy" : copy n byte(s) from YYXX location of decompressed track

0x9n : ???????????
0xAn : ???????????
0xBn : ???????????

0xCn : 2 bytes 0xCn XX => "Block copy" : copy n byte(s) from (currentLocation-XX) of decompressed track

0xDn : ???????????

0xE4 : 3 bytes, 0xE4 large repeats data.
E4 02 88 produce 88 88 88

0xFn : ???????????
GlitchCog

Goomba


 





Since: 01-31-06

Last post: 6281 days
Last view: 6281 days
Posted on 01-31-07 10:14 PM Link | Quote
Awesome. Thanks, Stifu. I was stuck trying to relate the 8n and Cn bits to the map of available tiles, obviously without much success.
HyperHacker

Star Mario
Finally being paid to code in VB! If only I still enjoyed that. <_<
Wii #7182 6487 4198 1828


 





Since: 11-18-05
From: Canada, w00t!
My computer's specs, if anyone gives a damn.
STOP TRUNCATING THIS >8^(

Last post: 6270 days
Last view: 6270 days
Posted on 02-01-07 09:13 AM Link | Quote
Originally posted by GlitchCog
It's 19. It's the same zero that I missed. It's misleading to use 32 as an example, because you might think the three flag has something to do with the number of tiles it lays down, but the "2" plus the 16 is what gives 19 because the 2's zero is counted.

2 => 0, 1, 2 = 3

So in other words:
3n: Lay down 17+n tiles of the next texture value.

Originally posted by Stifu
Our decompressor now works perfectly apart from one little bug when the RLE track has "00 0A" in it... Weirdly, our decompressor generates "0D 0A" rather than just "0A"...

Check you've opened the file in binary mode (fopen(blah, "rb")).

BTW, by the sounds of it, 0x2 and 0x3 are RLE, 0x6 is incrementing RLE, 0x8, 0xC and 0xE4 are LZ77.


(edited by Alice on 02-01-07 03:16 AM)
Pages: 1 2 3Add to favorites | Next newer thread | Next older thread
Acmlm's Board - I3 Archive - ROM Hacking - RLE compression for SMK |


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.040 seconds; used 447.53 kB (max 582.44 kB)