Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2011-02-19 07:18:29

159/703

redrle, for maps

I’ve written a command‐line program that compresses the Town Map format in RBY; see this thread for details.

Decompressing

To decompress, open your terminal or command prompt, then type:

redrle.exe -d map.rle map.bin

where “map.rle” is the name of a compressed map file, and “map.bin” will be the filename of the new decompressed file. (You might have to give the full pathname of redrle.exe; you can do this in Windows by dragging the executable onto the Command Prompt window.)

Say you have the original RBY map in “map.rle”, which looks like this:

00000000  7f 75 6c 73 81 44 6c 71  64 81 42 62 51 64 71 c1  |.uls.Dlqd.BbQdqÁ|
00000010  73 51 74 62 41 62 71 61  51 73 64 71 63 c1 61 b1  |sQtbAbqaQsdqcÁa±|
00000020  41 62 c1 61 c1 67 71 63  71 b1 42 62 71 61 71 61  |AbÁaÁgqcq±Bbqaqa|
00000030  73 51 72 51 73 51 43 62  71 61 71 61 71 65 71 63  |sQrQsQCbqaqaqeqc|
00000040  71 43 62 71 61 71 61 71  b1 a1 63 71 63 71 43 62  |qCbqaqaq±¡cqcqCb|
00000050  72 51 61 71 43 a1 61 71  63 71 43 61 b1 a1 61 71  |rQaqC¡aqcqCa±¡aq|
00000060  61 71 61 43 61 51 74 91  42 b1 42 61 71 61 71 b1  |aqaCaQt.B±Baqaq±|
00000070  43 a1 64 71 b1 42 43 61  51 b1 f1 45 61 74 43 43  |C¡dq±BCaQ±ñEatCC|
00000080  a1 71 41 f1 42 91 63 71  62 44 44 f1 41 d1 e1 72  |¡qAñB.cqbDDñAÑár|
00000090  51 73 61 b1 44 43 91 71  81 42 a1 61 71 b1 48 43  |Qsa±DC.q.B¡aq±HC|
000000a0  61 51 71 e1 c1 e2 d1 49  4f 45 00                 |aQqáÁâÑIOE.|

This will give you an uncompressed map in “map.bin”, which looks like this:

00000000  07 07 07 07 07 07 07 07  07 07 07 07 07 07 07 07  |................|
00000010  07 07 07 07 06 06 06 06  06 06 06 06 06 06 06 06  |................|
00000020  07 07 07 08 04 04 04 04  06 06 06 06 06 06 06 06  |................|
00000030  06 06 06 06 07 06 06 06  06 08 04 04 06 06 05 06  |................|
00000040  06 06 06 07 0c 07 07 07  05 07 07 07 07 06 06 04  |................|
00000050  06 06 07 06 05 07 07 07  06 06 06 06 07 06 06 06  |................|
00000060  0c 06 0b 04 06 06 0c 06  0c 06 06 06 06 06 06 06  |................|
00000070  07 06 06 06 07 0b 04 04  06 06 07 06 07 06 07 07  |................|
00000080  07 05 07 07 05 07 07 07  05 04 04 04 06 06 07 06  |................|
00000090  07 06 07 06 06 06 06 06  07 06 06 06 07 04 04 04  |................|
000000a0  06 06 07 06 07 06 07 0b  0a 06 06 06 07 06 06 06  |................|
000000b0  07 04 04 04 06 06 07 07  05 06 07 04 04 04 0a 06  |................|
000000c0  07 06 06 06 07 04 04 04  06 0b 0a 06 07 06 07 06  |................|
000000d0  04 04 04 06 05 07 07 07  07 09 04 04 0b 04 04 06  |................|
000000e0  07 06 07 0b 04 04 04 0a  06 06 06 06 07 0b 04 04  |................|
000000f0  04 04 04 06 05 0b 0f 04  04 04 04 04 06 07 07 07  |................|
00000100  07 04 04 04 04 04 04 0a  07 04 0f 04 04 09 06 06  |................|
00000110  06 07 06 06 04 04 04 04  04 04 04 04 0f 04 0d 0e  |................|
00000120  07 07 05 07 07 07 06 0b  04 04 04 04 04 04 04 09  |................|
00000130  07 08 04 04 0a 06 07 0b  04 04 04 04 04 04 04 04  |................|
00000140  04 04 04 06 05 07 0e 0c  0e 0e 0d 04 04 04 04 04  |................|
00000150  04 04 04 04 04 04 04 04  04 04 04 04 04 04 04 04  |................|
00000160  04 04 04 04 04 04 04 04                           |........|

This file is much easier to edit, especially if you change your hex editor’s width to 20 bytes.

Compressing

Very similar:

redrle.exe map.bin newmap.rle

will compress map.bin and write the result in newmap.rle. In this case the recompressed map will be a bit smaller, because the one in the ROM isn’t perfectly compressed:

00000000  7f 75 6c 73 81 44 6c 71  64 81 42 62 51 64 71 c1  |.uls.Dlqd.BbQdqÁ|
00000010  73 51 74 62 41 62 71 61  51 73 64 71 63 c1 61 b1  |sQtbAbqaQsdqcÁa±|
00000020  41 62 c1 61 c1 67 71 63  71 b1 42 62 71 61 71 61  |AbÁaÁgqcq±Bbqaqa|
00000030  73 51 72 51 73 51 43 62  71 61 71 61 71 65 71 63  |sQrQsQCbqaqaqeqc|
00000040  71 43 62 71 61 71 61 71  b1 a1 63 71 63 71 43 62  |qCbqaqaq±¡cqcqCb|
00000050  72 51 61 71 43 a1 61 71  63 71 43 61 b1 a1 61 71  |rQaqC¡aqcqCa±¡aq|
00000060  61 71 61 43 61 51 74 91  42 b1 42 61 71 61 71 b1  |aqaCaQt.B±Baqaq±|
00000070  43 a1 64 71 b1 45 61 51  b1 f1 45 61 74 46 a1 71  |C¡dq±EaQ±ñEatF¡q|
00000080  41 f1 42 91 63 71 62 48  f1 41 d1 e1 72 51 73 61  |AñB.cqbHñAÑárQsa|
00000090  b1 47 91 71 81 42 a1 61  71 b1 4b 61 51 71 e1 c1  |±G.q.B¡aq±KaQqáÁ|
000000a0  e2 d1 4f 4e 00                                    |âÑON.|
Download

Written in C. Should compile anywhere. Source code is here.

Windows executable is here, compiled and tested by Sawakita.

Last edited by IIMarckus (2011-03-18 01:36:23)

#2 2011-02-19 09:23:12

Miksy91
Member
Registered: 2010-10-16
Post 285/2,339

Re: redrle, for maps

Just by interest, I checked that there is blank space in the end of that bank which should be enough for putting a lot "bigger" town map there.
Is it possible to just repoint the town map data in there and use more space than originally or do you also have to tell the game to load more bytes for the town map data ? It seems possible to me because 00 seems to be there only for ending the town map data.

Anyways, I nice tool you made.
Should simplify town map editing a lot !

Last edited by Miksy91 (2011-02-19 09:25:25)

Offline

#3 2011-02-19 10:34:33

Tauwasser
Member
Registered: 2010-10-16
Post 111/452

Re: redrle, for maps

You might want to check out what happened to Pokanalysis. Basically, the author tried for a one-stop solution for hacking first-gen Pokémon.

As you see, it displayed connection data and wild Pokémon just fine back then even.

cYa,

Tauwasser

Offline

#4 2011-02-20 01:12:23

160/703

Re: redrle, for maps

Miksy91 wrote:

Is it possible to just repoint the town map data in there and use more space than originally

Yes.

Miksy91 wrote:

It seems possible to me because 00 seems to be there only for ending the town map data.

Yes.

#5 2011-02-27 18:41:42

Sawakita
Administrator
Registered: 2010-10-16
Post 88/365

Re: redrle, for maps

Very useful program, IIMarckus. If I am allowed to say something, anyway, I noticed you put a safety control when the program finds that tile $0 is used (which causes the program to refuse to go on with compression): actually using tile $0 doesn't create any problem, so you might want to fix it.
In fact, it's true that $00 ends the map-reading (by the in-game program), but when compressed, tile $0 becomes a value between $01 and $0F, so it doesn't create any problem.

Offline

#6 2011-03-17 03:49:01

166/703

Re: redrle, for maps

Sawakita wrote:

Very useful program, IIMarckus. If I am allowed to say something, anyway, I noticed you put a safety control when the program finds that tile $0 is used (which causes the program to refuse to go on with compression): actually using tile $0 doesn't create any problem, so you might want to fix it.
In fact, it's true that $00 ends the map-reading (by the in-game program), but when compressed, tile $0 becomes a value between $01 and $0F, so it doesn't create any problem.

Fixed. Sorry, no Windows executable yet, it’s hard for me to compile for Windows.

#7 2011-03-17 20:22:40

Sawakita
Administrator
Registered: 2010-10-16
Post 93/365

Re: redrle, for maps

I've compiled an executable for Windows, here.

Offline

#8 2011-03-18 01:35:33

168/703

Re: redrle, for maps

Thanks, mirrored.

Board footer

Powered by FluxBB