function to determine all the const arrays in a data file

Share unrelated electronics stuff, ideas, rants, etc!
User avatar
nicksen782
Posts: 714
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: function to determine all the const arrays in a data file

Post by nicksen782 »

Lee,

Proof of concept. My code works on Gconvert and Tile Studio files. I had to convert to .PNG before uploading. Hopefully there isn't quality loss.

I've re-written this thing a couple of times now. In the beginning I would read line by line but then the program would only work for Gconvert files. Now I find the beginning of the array definition then read all the values (as text) between the '{' and '}' while removing single/multi-line comments, the 0x0A line break, as well as the commas.

I have a website up that will display converted files as images. It's not my official host and the way this works right now I can't put this on my main host yet. Anyway, once the program is ready I'll just copy it over. I'm sure that you'd be more interested in the executable or source though.

*FIXED* The skew problem is gone. I wasn't telling the bmp generator the correct number of bytes to process. New picture is attached with multiple decoded tile sheets! Two of them are from Uzesweeper.

I've just started work on the Dr. Mario tile sheets. They didn't immediately work. Turns out that according to it's makefile the game uses mode 1. http://uzebox.org/wiki/index.php?title=Video_Modes says that tiles can be 6 or 8 pixels wide. I'm guessing that Dr. Mario uses 6x8px tiles. I'm pretty sure that I can just handle that with a command-line argument and a small modification to the bmp generator.

I'll need to work on them later tonight. Great progress though!
Attachments
c_inc2bmp.png
c_inc2bmp.png (16.41 KiB) Viewed 10340 times
User avatar
D3thAdd3r
Posts: 3222
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: function to determine all the const arrays in a data file

Post by D3thAdd3r »

Good work, pretty cool to see those long lost images again too. I was kind of bummed because I did intend to go back and make everything work with gconvert and build nicely like all the other games people make. Without the source images that doesn't work of course. This is a nice tool. BTW Dr. Mario definitely does use 6x8 because 8x8 has to be specified in the makefile, and at the time it was made there was no 8x8 option for Mode 1 anyway. I have thought for a while it would be nice to have graphics for that game as it could be improved pretty easily with all the techniques we use now.

I am a bit curious to see that flappy bird game now that I get an idea what the graphics look like :)
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: function to determine all the const arrays in a data file

Post by uze6666 »

Great progress! A couple parameters/options the tool could use:
  • Ability to specify the tile size
  • Ability to specify the target bitmap size in tiles (some may like 16 wide, some 8 wide or other to work in graphics tool)
User avatar
nicksen782
Posts: 714
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: function to determine all the const arrays in a data file

Post by nicksen782 »

Thanks, Uze. The program is pretty much complete now. You pass the tileset file, the tileset name, and the video mode. The video mode determines the size of the tiles. Video mode 1 only supports 6x8 for now. Right now it uses hard-coded sizes for the output .bmp file. I do intend to allow for a custom size output .bmp in the future. I would also like to add an option to allow for a 1 pixel separation between tiles as I think that would look better.

It is a C/C++ program and I am using a web interface to drive it. I'll be added it to my existing suite which needs a user-interface overhaul. I'll provide the web URL here and start a new forum thread for the web application when its ready. If you'd like a copy now, just ask.
User avatar
nicksen782
Posts: 714
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: function to determine all the const arrays in a data file

Post by nicksen782 »

I know that it has been a long time but I have posted the code for INC2IMG to github. It is up there and usable. Please keep in mind that I finished this in January of 2015 so changes to Gconvert may have an impact. This program takes a gconvert .inc file and turns it into actual graphics. This may use useful if someone was to create a tile editor that directly edited .inc files. I intended to do that but I haven't finished it.

Anyway, here is the link.

https://github.com/nicksen782/inc2img
User avatar
D3thAdd3r
Posts: 3222
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: function to determine all the const arrays in a data file

Post by D3thAdd3r »

It is a nice tool indeed and good to see the source. I actually had forgotten that I was going to attempt to retrieve the graphics from some of the games listed previously where they are lost.

Glad to see you are still kickin' and developing too. Off topic, but are you still interested in Zelda?
User avatar
nicksen782
Posts: 714
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: function to determine all the const arrays in a data file

Post by nicksen782 »

I did make a web interface for it at one point. I would like to make a better one that could act as a front-end to this. I would use PHP to invoke the C program and then return the file.

Yes, I am still interested in developing but I haven't because of work. Things are changing though and I intend to come back to Uzebox. I still want to complete my tile editor.

You may be interested in the progress on the tile editor. https://www.youtube.com/watch?v=rxXWn97x2qY . Again, because of work I haven't been able to work on it. I intend to though. I intend to redesign the look and underlying code and to make it look like a legitimate web app that people wouldn't mind using. :D

And yes, I would still like to work on Zelda.
User avatar
D3thAdd3r
Posts: 3222
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: function to determine all the const arrays in a data file

Post by D3thAdd3r »

I did check out your web stuff a while back I think we had some PM discussions on it at the time. In general the web concept you convinced me on since it is cross platform. Heavy Linux usage on these forums of course, but a lot of us are Windows users as well so maybe 50/50. Back in my Linux days I resorted to WINE a lot, but that isn't too nice for development and was kind of hit and miss. That was 10 years ago so maybe it works better now. Either way totally cross platform tools would be nice.

Good video and I can understand your direction a lot better seeing it. Even cool is the string entry which will show your unique characters used. Lots of ram tile fonts stuff I did I would manually do all that but if you were doing it all this way a lot of those things could be automated. An interesting niche that no tool does well IMO is palettes for mode 13 stuff. I don't think anyone is actually doing anything mode 13 yet specifically because of this, when in actuality, it is probably one of the biggest things ever to happen. Just hasn't been taken advantage of because it is so much easier just to do mode 3.
Post Reply