øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1015.msg25578e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index7cbd-2.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&action=profile;area=showposts;sa=attach;u=390e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index7cbd-2.html.zx€üg^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ ­¶OKtext/htmlISO-8859-1gzip(¾Ö¶ÿÿÿÿÿÿÿÿTue, 10 Mar 2020 21:02:15 GMT0ó°° ®0®P®€§²ð®üg^ÿÿÿÿÿÿÿÿ6,¶ Jobs palette

Author Topic: Jobs palette  (Read 3946 times)

samurai goroh

  • FF5 Hacker
  • *
  • Posts: 221
  • Gender: Male
    • View Profile
    • My page
Jobs palette
« on: May 01, 2009, 12:31:55 AM »
Since there's no much info regarding the palette, I decided to create a post here.

First of all, the colors are stored in BGR (blue, green, red) using 2 bytes (16 bits), in which 5 bits is used per color and 1 extra which I don't know if it does something. The range for the color goes from 0 to 31, then you'll need to multiply that number by 8 to obtain the value in 256 colors.

Let's put an example: The palette for Butz' jobs starts at D4/A3C0 (no header). You'll see the numbers 06 22 (2206 hex) which can be converted to 0010001000000110 bin, then you separate it in 4 parts, as mentioned above:

msb: 0
b: 01000
g: 10000
r: 00110


You convert this number back to decimal, ignoring the first digit.

b: 8
g: 16
r: 6


Now, you multiply the result by 8, to get a 256 colors range:

b: 64
g: 128
r: 48


Using Tile Layer Pro, use this numbers as the first color of the palette & repeat the process 16 times to obtain & watch the palette in action ;)

Note: The offset of Butz' Job sprites starts at D2/0000 (no header)


Edit: Fixed the errors mentioned below :P
« Last Edit: May 01, 2009, 10:56:21 PM by samurai goroh »
I'm the best in the universe! Just remember! [F-zero X]

Phoenix

  • FF4 Hacker
  • *
  • Posts: 456
    • View Profile
    • Phoenix Hacks
Jobs palette
« Reply #1 on: May 01, 2009, 04:40:30 PM »
I think you mean multiply by 8 instead of multiply by 4. (32 x 8 = 256)

I have a document on hacking palettes I found a while back, which I've attached. It explains it a bit more in depth, and I thought you might find it useful.

samurai goroh

  • FF5 Hacker
  • *
  • Posts: 221
  • Gender: Male
    • View Profile
    • My page
Jobs palette
« Reply #2 on: May 01, 2009, 10:32:17 PM »
Right, it's x8 and seems the palette it's not in RGB but BGR.

I think I came across that file when I was looking for information regarding the palette of SNES, but that was some time ago, that I forgot how it worked :P. Thanks for the file though :)

I'm finally looking at this because I want to try to implement to my editor, cross fingers :D
I'm the best in the universe! Just remember! [F-zero X]

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: Jobs palette
« Reply #3 on: June 16, 2016, 09:28:31 AM »
Hey samurai goroh, could you make a systematic doc on the topic and add it in the wiki?

The things that I would like to see are:
- how many entries are in the pallete
- what is the dimension and BPP for Job's sprites?
- Since sprites use an weird tile system, how somebody may visualize a Job sprite reading from the ROM?
- Since all of above is for SNES, is it the same for GBA?

samurai goroh

  • FF5 Hacker
  • *
  • Posts: 221
  • Gender: Male
    • View Profile
    • My page
Re: Jobs palette
« Reply #4 on: June 16, 2016, 11:13:04 PM »
I think is kinda already covered in the wiki, but hope I can explain it.

- how many entries are in the palette
You mean as colors you can use? The SNES normally uses 4BPP for the graphics, which translates to 16 different colors for a sprite (2^4). Normally the first entry is used as transparent, so in reality you will have 15. Some other times it can use 3BPP (2^3=8 colors), but so it does for 2BPP (2^2=4) and 1BPP (2^1=2). When you are working with palettes you have to be careful to know if they are shared or not. For example the jobs have entries for each one of them so there's no problem to customize, but other stuff like monsters may share palettes (can't remember if it does here, just putting an example).

As mentioned on the other thread, this document will help you out to know more about how the BPP works:
http://mrclick.zophar.net/TilEd/download/consolegfx.txt

- what is the dimension and BPP for Job's sprites?
There was a section on my editor with the palettes of the jobs if you want to see it in action. Mmm, thought it was mentioned in the wiki but it seems not. Jobs use 4BPP. Graphics are not compressed, so they are easy to view in say Tile Molester, Tile Layer Pro & yychr. The dimension is a 2x3 block of 8x8 sprites (or 16x24 pixels)

- Since sprites use an weird tile system, how somebody may visualize a Job sprite reading from the ROM?
I'm not sure how/where the game identifies the order on how they should be assembled in order to form the correct picture. In my editor I manually told it to place them in certain order. Just remember that many times sprites are reused in order to save space...

- Since all of above is for SNES, is it the same for GBA?
Is kind of the same for the GBA, at least when graphics are uncompressed they will behave the same (they will also mostly use 4BPP). Compression methods will be really different from the SNES to the GBA though. So if you're going to work with sprites that have compression, you'll have to create different methods. IIRC, the GBA uses the LZ77 compression method, but think it was a bit modified. I believe there was a topic here that discussed this.
I'm the best in the universe! Just remember! [F-zero X]

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: Jobs palette
« Reply #5 on: June 17, 2016, 02:03:22 AM »
Thank you very much! That really cleared lots of things in my mind.
I was reading the doc that you mention along with couple similar ones, but they are all in general, not FFV specific.
Now using the pallete colors from your application I was able to correctly display Knight Job - see attachment, I dont know how to put it as a picture here :)

Attachment 2:
Looking in the picture I could see how first image is assembled from 2x3 tiles. Same goes for 2nd, but 3rd has only legs (row 3). My guess is that to make the 3rd image I need to take 2x2 from 1st and the legs. That mean that somewhere in the ROM there should be a table that describe which tiles assemble 1 job image (I guess that would be 1 sprite in the VRAM).

Do you know where that info in the ROM is?
« Last Edit: June 17, 2016, 02:27:49 AM by Squall »

samurai goroh

  • FF5 Hacker
  • *
  • Posts: 221
  • Gender: Male
    • View Profile
    • My page
Re: Jobs palette
« Reply #6 on: June 17, 2016, 05:20:14 PM »
Unfortunately, I don't know where this information is, sorry.

BTW, the GBA editor does extract monsters sprites from within the game (and so does for backgrounds). Maybe the creator of that program can help you out more.
http://www.romhacking.net/utilities/898/

There's a topic of that program here too:
http://slickproductions.org/forum/index.php?topic=1820.0
http://slickproductions.org/forum/index.php?topic=1763.0

Edit: This topic is relevant to the Portrait graphics for the GBA
http://slickproductions.org/forum/index.php?topic=1657.0
I'm the best in the universe! Just remember! [F-zero X]

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: Jobs palette
« Reply #7 on: June 18, 2016, 08:46:40 AM »
So Zanerus is one of the creator of the GBA editor? Ahh I wish he is active and talk with him ... Btw in the discussion there was talk about editing of AI script ... was that implemented?

As I said in the other thread, there is so much knowledge hidden in the forum, it just need to be put together in a systematic way in the wiki ..
samurai goroh  your explanation of Bit planes is the best that I have seen, and believe me I have read quite many thing on the topic for SNES/GBA. If I had seen your first I would understand it in no time :)
I think you have accumulated quite a bunch knowledge about FFV SNES/GBA, why dont you try to put it all in the Wiki? At first just pile random facts, then try to systematize and categorize.

LightPhoenix I stumbled accross your tutorial   by chance and I was wooah ( I wish I knew about it earlier, when i was parsing Actions). The things is that if you dont put it in the Wiki, most likely people will not see it. Same goes with your current research on timers - even if its not finished just put it there, make a thread that discuss details about it.

Sorry if I got excited, but in just 1 post I found (by chance) soo many things, things that i needed days to read and comprehend (documents from different cites, asm code, examination on the ROM,...). If I had started with your findings I will just build upon, extend, expand. The purpose of the wiki is to store the knowledge in an orderly, systematic way, while forums is a great way to accumulate it. Otherwise everyone will have to start from the scratch (inventing the wheel)

samurai goroh

  • FF5 Hacker
  • *
  • Posts: 221
  • Gender: Male
    • View Profile
    • My page
Re: Jobs palette
« Reply #8 on: June 18, 2016, 09:31:52 AM »
No, Zanerus came with the idea but he's not the programmer, his friend is. Since he has an account here, I suppose he can direct you to the other guy.

And yes, there is quite a bit of "new" information in the forums that is not elsewhere. I haven't been active lately in the modding area, but maybe some day when I have free time, I'll gather that info and add it to the wiki, is just that I prefer to make it as clear as possible that I don't like just to do a simple copy+paste.

On other news, I just received a link to a page that also wants to reverse engineer the SNES version. Haven't look at it yet, but it might have some useful stuff. I'll mention to the guy about this site too:
https://github.com/ogamespec/ffv
I'm the best in the universe! Just remember! [F-zero X]

LightPhoenix

  • FF5 Hacker
  • *
  • Posts: 130
    • View Profile
Re: Jobs palette
« Reply #9 on: June 18, 2016, 04:00:12 PM »
Have you tried searching the ROM for tile indices?  You might be able to find where it is that way.  Another option would be to search the code for references to where the sprites start - I would focus on C1 since that's where almost all animation stuff is.

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: Jobs palette
« Reply #10 on: June 20, 2016, 06:53:12 AM »
Unfortunately I know nothing but C2. I'm focused there, because the battle mechanics is there and that's what I was looking for. The other things like Fx, Spc, DMA,... are hardware dependent (SNES) so I try to avoid on purpose.

My interest in Image planes was mainly because for Windows when you crate a bitmap you can define planes, but as far as I know its never used (pretty much old-hardware legacy) and because of Jorgur's request :)

Speaking of which one question was always in my mind while reading technical documentation about graphics: FFV (most likely) works in a video mode (which one?) that is 256 colors. If the screen is limited to 256 colors, but we have many palettes (for sprites, backgrounds,..) so what happens when the total number of different colors in all palettes exceed 256?

 :edit: samurai goroh, how did you make this:
« Last Edit: June 20, 2016, 11:19:15 AM by Squall »

samurai goroh

  • FF5 Hacker
  • *
  • Posts: 221
  • Gender: Male
    • View Profile
    • My page
Re: Jobs palette
« Reply #11 on: June 20, 2016, 05:52:31 PM »
This video focus on older systems, but it explains how colors are stored, so is worth to watch (same for part 2 & how music/sound works):


I'm unsure about that would happen, but making a quick search seems that there are games that handle more than 256 colors in a screen, though it seems this is the reason why enhancement chips existed (like the Super FX, Cx4, SA1, etc.).


As for the image, I would normally had taken screenshots of every part and join them together. Fortunately, looking around for that image (well, the full map) I think in a Japanese site. That screen represent which area in World 2 where no battles can be encounter (excluding desert/swamp).
« Last Edit: June 20, 2016, 09:21:02 PM by samurai goroh »
I'm the best in the universe! Just remember! [F-zero X]

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: Jobs palette
« Reply #12 on: June 21, 2016, 04:56:43 AM »
Quote
As for the image, I would normally had taken screenshots of every part and join them together. Fortunately, looking around for that image (well, the full map) I think in a Japanese site. That screen represent which area in World 2 where no battles can be encounter (excluding desert/swamp).
Ahh too bad, I hoped you have chop up info from the ROM :D

 :edit: If that guy from Github has done all the things by himself (no external sources for de-compiling) - WHOOA! I think it will be great if we have him here. Looking in some of his initial C reverse-engineering files I could grasp more of the internal logic, like I knew that C2 is pretty much about the battle system, but I expected that the loop is from other places, now I now C2:0000 is where the battle starts :D
« Last Edit: June 21, 2016, 05:05:24 AM by Squall »