Introducing the Telefang Map Dumper

Discuss anything related to hacking ROMs of the Telefang games here.
Post Reply
Blaziken257
Posts: 983
Joined: Fri Dec 22, 2006 11:52 am

Re: Introducing the Telefang Map Dumper

Post by Blaziken257 »

So, for the forum's fourth anniversary, I made a tool, Telefang Map Dumper, which is capable of ripping all the maps in Telefang Power and Speed. It has partial support for hacked ROMs as well, depending on how extensive the hack is. It's a Python program, so you will need Python 2.7 installed to use it (find it here: http://www.python.org/getit/releases/2.7/). It will not work in Python 3! You will also need a Telefang ROM to use this. (Don't ask where to get one!) Once that is taken care of, you can rip maps from the game.

To use it, just double-click on "mapdump.py" and a window will open. It will ask you to enter the filename of the Telefang ROM. It has to be a .gbc file and it has to be a Telefang ROM, not any other game (not even Telefang 2). At this point, you can choose which map to dump by entering in a number (if you do not know the index numbers of the locations, you can type "l" or "L" to see a list, or you can read the README file). After that, you can choose to rip the maps in color or grayscale (the color maps take more time to generate and result in larger file sizes, but they are prettier). (If you chose an overworld map, the palette that is used depends on the hour of your computer's clock; this may be changed in a future release.)

At this point, the Telefang Map Dumper will read data from the ROM, and it will state what it is trying to do (in case anybody is curious to how the whole process works). After it reads data from the ROM, it will close it, and start creating an output file and write one pixel at a time. It will be "outputmap.pgm" for grayscale and "outputmap.ppm" for color. I chose PGM and PPM because they were quite easy to work with. If you do not have any way to view these files, you can use GIMP (it's free!) to convert them to GIF/PNG/whatever other format you want, or you can find online image converters by using Google.

I know that some people may not like these weird formats, especially when they're less efficient (the grayscale images take up 1.25MB and the color ones take up 3.75MB). Maybe I'll find a way to output GIF or PNG files in a future release, though.

The tool can support hacked ROMs to an extent. In general, it reads pointers from ROM, so you can repoint data and the map dumper tool will still work correctly. However, pointer tables are hardcoded into the program, so don't move them to different banks. Also, the graphics are read from PGM image files, not from ROM, since the program would need to decompress them. (In addition, the way it reads the PGM files is kinda buggy -- it only recognizes \x0A delimiters and doesn't recognize "#" characters, which it should because that denotes a comment. Just don't modify any of the PGM files in the images directory and you'll be OK. Yes, I definitely need to fix this later on.)

Another feature is that the program shades glitchy acres so that the map is easier to view. Most acres with value 00 are glitchy, although a few aren't, which the program takes into account.

One issue is that since the regular overworld maps and antenna trees use different tilesets, the program is a bit weird when handling this. Basically, you'll have to dump two maps (a regular overworld map and an antenna tree map), copy the antenna tree acres, and paste them to the overworld map acres. This will be improved in a later version. Also, the overworld maps (including the antenna tree ones) can only be dumped in quadrants, since that's how the game internally stores them. You can always dump four maps and stitch them together for now.

Also, the program does not handle sprites, warps, or items in treasure chests at all. I haven't really figured out a way to label these on the screen well, and I don't even know how the game stores sprites anyway. Treasure chests would probably be the easiest to deal with, though. Oh well.

I haven't tested this on Mac, either, since I have no way of doing that. I tested this on Windows 7 and Ubuntu 11.10 only. Hopefully, though, it works for everyone.

Well... that's the Telefang Map Dumper for you. This was fun for me to program, and I can certainly improve upon it later on! And since this is open source, anybody can improve upon it, not just me. Or if you think you can program a better one, be my guest. I also hope this will pave the way to a Telefang Map Editor one day. (Is it possible to write a GUI program in Python? Hmmm.)

So, without further ado... here it is! If you ever get stuck, you can read the README.txt file. Oh, and feel free to report bugs here.

Version 2.0 (8/19/12, most recent): http://www.mediafire.com/?pqvoq7cfloiecga

Outdated versions:

Version 1.0 (11/21/11): http://www.mediafire.com/?ccpeijc5ai4fwrp


Happy map dumping!
Kimbles(imported)
Posts: 470
Joined: Mon Dec 24, 2007 3:17 am

Re: Introducing the Telefang Map Dumper

Post by Kimbles(imported) »

Very nice! XD I haven't tested it since I can't be arsed to install anything right now (python), but it sounds like a nice tool. Personally I think outputting it in gif or png is pretty necessary though. I'd even be fine with bmp's instead, even though they're a lot larger. (Maybe make it an option?)

It would be really cool if we could get a program to edit maps too, but I can see how that would take a whole lot of work. XD Though, I wouldn't mind seeing a program that could just display the sprite/warp/map data that we've figured out in a easy-to-read way. Just some ideas. XD
Blaziken257
Posts: 983
Joined: Fri Dec 22, 2006 11:52 am

Re: Introducing the Telefang Map Dumper

Post by Blaziken257 »

I decided to update this tool a bit. The main change here is that instead of outputting PGM or PPM files, it now outputs PNG files! So viewing the images is easier now. Not to mention, the file sizes are smaller and now there is transparency to indicate out-of-bounds map acres. I honestly didn't think I'd ever be able to do this, either... but with PyPNG, it became possible! It's included with the download, so you don't have to download anything extra, but you can always download PyPNG separately on your computer so that you can use it yourself if you make your own Python programs.

I also updated the README to reflect this.

So here is version 2.0!!

http://www.mediafire.com/?pqvoq7cfloiecga

This isn't the only tool that I have planned that uses PyPNG, by the way... well, I can't reveal much now.

However, even with this change, there are other features that I may add in the distant future, in no particular order:
- Sprites
- Treasure chest labeling
- Shop labeling (for items)
- Decompressing tiles (this would replace the PGM images in the ./images folder)
- Option to choose hour for overworld maps
- Name the files based on the location

And after I do that, I may create a Telefang Map Editor one day. I'd have to make a GUI application for that... but wxPython looks promising, so I'll look into that.
RacieB
Posts: 871
Joined: Thu Dec 28, 2006 4:27 am

Re: Introducing the Telefang Map Dumper

Post by RacieB »

Awesome! =)

More PyPNG huh, I'm intrigued...
Post Reply