+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  A bit of help with FEIDIAN
Pages: [1] 2
Author Topic: A bit of help with FEIDIAN  (Read 1160 times)
Spikeman
Guest
« on: February 13, 2007, 04:25:59 am »

I'm having a bit of trouble dumping a font in kind of a strange format. Here's what it looks like.



Now I'm fairly sure the font is 8x12 and 2bpp (the image is in 4bpp, it looks very garbled in 2bpp), but don't see anything in the FEIDIAN readme explaining how to dump anything other than 1bpp formats..

I know the graphics go something like this:

AABBAABB

Where AA is a pixel in the first tile and BB is a pixel in the second tile. But I'm not quite sure how to make this into a tile definition. The main thing that's confusing me is that it's asking for two plane definitions (for 2bpp). Is there a way to completely skip bits in one plane? For example: here's what I think the two definitions might look like:

A*C*A*C*

*B*D*B*D

Where A and B make up the first tile and C and D make up the second.. please help me?
KaioShin
Guest
« Reply #1 on: February 13, 2007, 04:33:54 am »

The 8x16 GBA tile definition (which is 4bpp):

Code:
<?

//-----------------------------------------------------------------------------
// Generic Game Boy Advance Tile Definition
// Written by D-xiansheng based on information by Kojiro Sasaki
//
// Byte Count: 4
// Dimensions: 8x16 (interleaved)
// Structure :
//     Plane1: AABBCCDD   Plane2: AABBCCDD
//             (etc...)           (etc...)
//     Plane3: AABBCCDD   Plane4: AABBCCDD
//             (etc...)           (etc...)
//
// Note: This tile definition interleaves all bytes
//-----------------------------------------------------------------------------

if(!defined('COLOR_DEPTH')) {
// Define what tile definition format this is
//define("COLOR_DEPTH", "2"); // Monochrome    (Single Plane)
//define("COLOR_DEPTH", "4"); // Four Color    (Two Plane)
//define("COLOR_DEPTH", "8"); // Eight Color   (Three Plane)
  define("COLOR_DEPTH","16"); // Sixteen Color (Four Plane)
}

// Tiles width and height in pixels (bits)
$tile_width  = 8;
$tile_height = 16;

// How many bytes are in the pattern?
$pat_size    = 4;

// What kind of byte ordering?
//$order = "planar""";
  $order = "linear""";

// Do pixels need to be interleaved?
$interleave  = 1;

// You only need to define the pattern up till where it repeats. You may use
// whitespaces to help you align everything (they will be stripped when your
// string is used). 64 bytes is the limit.
//
// The hirearchy of letters is [A-Z] [a-z] [2-9] [!?@*]
//
// Basically, each unique letter is a byte, and the repeats of that letter are
// bits within that byte.

$plane1 = "AABBCCDD""";
           
$plane2 = "AABBCCDD""";

$plane3 = "AABBCCDD""";

$plane4 = "AABBCCDD""";

// Pallette: 2bpp supports four color graphics. Please define the four colors
//           to use here. Hex numbers can be done by prefixing with 0x[hex]
//           The format is R, G, B

// Color 0 [binary 0 0]
$color0 = array(0x00, 0x00, 0x00);

// Color 1 [binary 0 1]
$color1 = array(0x00, 0x00, 0xa8);

// Color 2 [binary 1 0]
$color2 = array(0x00, 0xa8, 0x00);

// Color 3 [binary 1 1]
$color3 = array(0x00, 0xa8, 0xa8);

// Color 4 [binary 0 0]
$color4 = array(0xa8, 0x00, 0x00);

// Color 5 [binary 0 1]
$color5 = array(0xa8, 0x00, 0xa8);

// Color 6 [binary 1 0]
$color6 = array(0xa8, 0x84, 0x00);

// Color 7 [binary 1 1]
$color7 = array(0xa8, 0xa8, 0xa8);

// Color 8 [binary 0 0]
$color8 = array(0x54, 0x54, 0x54);

// Color 9 [binary 0 1]
$color9 = array(0x54, 0x54, 0xfc);

// Color 10 [binary 1 0]
$colorA = array(0x54, 0xfc, 0x54);

// Color 11 [binary 1 1]
$colorB = array(0x54, 0xfc, 0xfc);

// Color 12 [binary 0 0]
$colorC = array(0xfc, 0x54, 0x54);

// Color 13 [binary 0 1]
$colorD = array(0xfc, 0x54, 0xfc);

// Color 14 [binary 1 0]
$colorE = array(0xfc, 0xfc, 0x54);

// Color 15 [binary 1 1]
$colorF = array(0xfc, 0xfc, 0xfc);

?>

You just have to change the size to 8x12.
Tauwasser
Guest
« Reply #2 on: February 13, 2007, 05:34:03 pm »

1bpp 8x12 should fit it as KaioShin says. I don't know if you have the 1bpp part yet, so I reposted Tongue

cYa,

Tauwasser
Spikeman
Guest
« Reply #3 on: February 15, 2007, 03:43:12 am »

Umm.. I'm pretty sure the font is 2bpp. It has four colors. Whatever, I'll try the thing KaioShin posted.

Edit: I'm having trouble getting FEIDIAN to run. I type this:

Code:
php feidian.php -cr gba,16,16,0x72B604,tsukuru.gba output

And all it does is output the contents of feidian.php. I have PHP installed and in my path. Any reason it would be doing this?
« Last Edit: February 15, 2007, 04:00:23 am by Spikeman »
KaioShin
Guest
« Reply #4 on: February 15, 2007, 04:41:10 am »

In my batch file I use "php.exe"...

That's propably it, you show the code instead of executing it.

edit... then again I actually have a php.exe in the folder. Do you have that too? It's some kind of php stand alone executable so you don't have to mess with installing the system variables and stuff.
Spikeman
Guest
« Reply #5 on: February 15, 2007, 04:51:10 am »

Ahh no, but I'll try that.
KingMike
Guest
« Reply #6 on: February 15, 2007, 09:00:19 am »

Maybe remove the comma before the ROM name, and replace it with a space?
Nightcrawler
Guest
« Reply #7 on: February 15, 2007, 10:11:12 am »

Some ambitious individual should port FEIDIAN to another language. It's a useful utility, but you know, the whole PHP thing sets it back. I don't think PHP is ever going to catch on as big language for local utilities. Too hard for the masses.

A nice GUI would also be appealing. Easily set the parameters, have a preview of the output in real time? That would rock.
Spikeman
Guest
« Reply #8 on: February 16, 2007, 02:06:35 am »

I guess I would be interested in trying that.. but the real question is: Would D be okay with that? I mean, it is open source and all. I guess we would have to check out the license.

And KingMike: No such luck. Embarrassed
« Last Edit: February 16, 2007, 03:57:31 am by Spikeman »
Nightcrawler
Guest
« Reply #9 on: February 16, 2007, 08:57:44 am »

The license is GNU General Public License. I'm not license expert, but it is probably fine from what I gather. Also, this wouldn't really be a modification of that source. It's basically a port of the ideas represented. You won't be able to go line for line from PHP anyway.
Aerdan
Guest
« Reply #10 on: February 16, 2007, 12:42:33 pm »

GPL is [essentially] "do what you want with the code, but you have to use the GPL too or you're breaking the law", which pretty much means D can't really complain if someone takes it and runs with it...as long as they don't go claiming they made it or anything.

Of course, knowing D... >.>
Spikeman
Guest
« Reply #11 on: February 17, 2007, 06:00:47 pm »

All right, I guess I might give this a shot, although.. it probably would be helpful if I could get FEIDIAN to run in the first place..
Spikeman
Guest
« Reply #12 on: February 23, 2007, 06:28:06 pm »

Alright I finally got FEIDIAN running, but I don't really understand how anything other than monochrome graphics work.. specifically, how exactly I should go about defining custom definitions for plane1, plane2, etc.

Is there a document on this? Or can someone post something that will enlighten me? Thanks in advance. Smiley

Edit: I really don't want to triple post, but since nobody is noticing this hopefully this will bump it. If not I may just make a new topic. Angry
« Last Edit: February 24, 2007, 07:45:35 am by Spikeman »
Nightcrawler
Guest
« Reply #13 on: February 24, 2007, 11:24:34 am »

http://www.romhacking.net/docs/consolegfx.txt

There you go. That's a good explanation of most common formats.

If you already understand how one bitplane graphics work, it's easy to understand the rest. You're just sticking more layers on top of that.

In monochrome, each line is one byte. Each bit is a pixel. Well if you add another layer on top of that(2bpp), now each line in the tile has TWO bytes and each pixel has TWO bits. So you have total of 4 selectable colors based on those two bits.

Add another layer for 3bpp and now each line consists of THREE bytes which means each pixel gets 3 bits for a total of 8 possible colors per pixel.

The only differences are HOW the 'layers' are ordered and stored. That's what klarth's document explains.
creaothceann
Guest
« Reply #14 on: February 24, 2007, 01:50:59 pm »

http://www.romhacking.net/docs/snesgfx.txt - more verbose, but it's not for all consoles.
Pages: [1] 2  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC