imagefont.bin tool for PS3 and Vita

sorry to jump a bit late on this topic, but is there any other decoder implementation besides @littlebalup Python's one? also, is the source available?

to explain my question: if we want to use the imagefont.bin on the fly on a homebrew app (ps3 or vita) I assume we need to parse/decode the imagefont.bin file , take the resulting .png and show it on the screen, right? on the XMB that's automatic, but on a homebrew we'll have to do it manually

I already have quite a lot of stuff, but perhaps I'll get back to this and try to make a generic decoder in C that hopefully would be cross-platform across ps3 and vita.

That would be great.
I added the "source" python script to the OP.
 
I've been busy playing with the timer, it was going ok, but unfortunately it seems we can't have animations longer than approx 6 minutes.
Its hard to know, it kind of seems like the less frames, the longer it can be. but anyway it seems to be around 2 minutes @10 frames up to 5 minutes approx with 5 frames.

I can have 5 frames in 5 minutes, so went with that for some timer tests. Its a shame its not 10 minutes as that would make a better timer.

Timer POC 1


Timer POC 2

Uptime counter

Prank POC :)

@DeViL303 do you still have the Uptime counter? i'm thinking about implementing it in the HostName's xmb info place
 
@DeViL303 do you still have the Uptime counter? i'm thinking about implementing it in the HostName's xmb info place
Only just seen this, it does not really work.

You can have one that counts up to 5 minutes but not much use. Also it gets effected by other things, stops counting when not visible etc.
 
Alright, I kept my word! ;) as I was needing some trophy icons for Apollo, I finally ported @littlebalup Python code to C :D

now we have a C parser that should work either on the PS3 and the Vita, and generates valid .png files that can be easily loaded in any homebrew. (probably I need to add a function to return a buffer instead of writing the .png to disk :oops:)
btw, I tried to keep dependencies to a minimum, so right now only a zlib decompressor is required.

I need to clean up the code and then I'll upload the source to GitHub. I should also convert it to a library so it can be included in homebrew projects.
As an example, I'm attaching a .zip with all the output PNG files generated by the C parser, from the original "imagefont.PS3_cust_v001.bin" file from littlebalup.

Code:
IMAGE_INFO; Info from index entry:
IMAGE_INFO;    entry number in the index : 332
IMAGE_INFO;    unicode code point : U+F6DF
IMAGE_INFO;    UTF-8 hex value (calculated) : EF 9B 9F
IMAGE_INFO;    image size : 27 x 23
IMAGE_INFO;    palette size : 1042
INDEX_DATA;    unknown_data_1 0xFF7F
IMAGE_INFO; Info from palette header:
IMAGE_INFO;    color count : 256
IMAGE_INFO;    color channel : 4 bytes (32 bits)
IMAGE_INFO;    frame count : 1
IMAGE_INFO;    total animation time : 0.000 second(s)
IMAGE_INFO;    frames per second (calculated) : 1.000
  Processing U+F6DF frame: 001
FRAME_001; Below value is the frame duration in hundredths of a second. Maximum is 65535 (0xFFFF).
; It has no effect if only one frame.
FRAME_001; frame_duration 60
FRAME_001; * Below value should be always 0x01. It has unknown effect though.
FRAME_001; unknown_data_2 0x01
FRAME_001; * Below value is assumed to be the color number, from the image color palette, representing the transparent color
; It should be 0 to maximum 255.
FRAME_001; alpha_color 0
FRAME_001; * Below value should be always 0x0000 (padding?). It has unknown effect though.
FRAME_001; unknown_data_3 0x0000
 

Attachments

Alright, I kept my word! ;) as I was needing some trophy icons for Apollo, I finally ported @littlebalup Python code to C :D

now we have a C parser that should work either on the PS3 and the Vita, and generates valid .png files that can be easily loaded in any homebrew. (probably I need to add a function to return a buffer instead of writing the .png to disk :oops:)
btw, I tried to keep dependencies to a minimum, so right now only a zlib decompressor is required.

I need to clean up the code and then I'll upload the source to GitHub. I should also convert it to a library so it can be included in homebrew projects.
As an example, I'm attaching a .zip with all the output PNG files generated by the C parser, from the original "imagefont.PS3_cust_v001.bin" file from littlebalup.

Code:
IMAGE_INFO; Info from index entry:
IMAGE_INFO;    entry number in the index : 332
IMAGE_INFO;    unicode code point : U+F6DF
IMAGE_INFO;    UTF-8 hex value (calculated) : EF 9B 9F
IMAGE_INFO;    image size : 27 x 23
IMAGE_INFO;    palette size : 1042
INDEX_DATA;    unknown_data_1 0xFF7F
IMAGE_INFO; Info from palette header:
IMAGE_INFO;    color count : 256
IMAGE_INFO;    color channel : 4 bytes (32 bits)
IMAGE_INFO;    frame count : 1
IMAGE_INFO;    total animation time : 0.000 second(s)
IMAGE_INFO;    frames per second (calculated) : 1.000
  Processing U+F6DF frame: 001
FRAME_001; Below value is the frame duration in hundredths of a second. Maximum is 65535 (0xFFFF).
; It has no effect if only one frame.
FRAME_001; frame_duration 60
FRAME_001; * Below value should be always 0x01. It has unknown effect though.
FRAME_001; unknown_data_2 0x01
FRAME_001; * Below value is assumed to be the color number, from the image color palette, representing the transparent color
; It should be 0 to maximum 255.
FRAME_001; alpha_color 0
FRAME_001; * Below value should be always 0x0000 (padding?). It has unknown effect though.
FRAME_001; unknown_data_3 0x0000
Nice, in C is going to be handy for sure, i think it should be added to psl1ght because is an extension of the font support
Most developers could use it to load a couple of icons, like in your case, you did it mostly for the trophy icons, but now that is working you could display some more

The first homerew (other than apollo) that comes to mind where this could be implemented is managunz, eventually you could take a look at it @Zar
The scope of managunz (as a backup manager) is related only with games features... but the scope of te filemanager inside managunz is to support most/all the fileformats used by PS3, and are a lot, this fits well with it :D
 
Alright, I kept my word! ;) as I was needing some trophy icons for Apollo, I finally ported @littlebalup Python code to C :D

now we have a C parser that should work either on the PS3 and the Vita, and generates valid .png files that can be easily loaded in any homebrew. (probably I need to add a function to return a buffer instead of writing the .png to disk :oops:)
btw, I tried to keep dependencies to a minimum, so right now only a zlib decompressor is required.

I need to clean up the code and then I'll upload the source to GitHub. I should also convert it to a library so it can be included in homebrew projects.
As an example, I'm attaching a .zip with all the output PNG files generated by the C parser, from the original "imagefont.PS3_cust_v001.bin" file from littlebalup.

Code:
IMAGE_INFO; Info from index entry:
IMAGE_INFO;    entry number in the index : 332
IMAGE_INFO;    unicode code point : U+F6DF
IMAGE_INFO;    UTF-8 hex value (calculated) : EF 9B 9F
IMAGE_INFO;    image size : 27 x 23
IMAGE_INFO;    palette size : 1042
INDEX_DATA;    unknown_data_1 0xFF7F
IMAGE_INFO; Info from palette header:
IMAGE_INFO;    color count : 256
IMAGE_INFO;    color channel : 4 bytes (32 bits)
IMAGE_INFO;    frame count : 1
IMAGE_INFO;    total animation time : 0.000 second(s)
IMAGE_INFO;    frames per second (calculated) : 1.000
  Processing U+F6DF frame: 001
FRAME_001; Below value is the frame duration in hundredths of a second. Maximum is 65535 (0xFFFF).
; It has no effect if only one frame.
FRAME_001; frame_duration 60
FRAME_001; * Below value should be always 0x01. It has unknown effect though.
FRAME_001; unknown_data_2 0x01
FRAME_001; * Below value is assumed to be the color number, from the image color palette, representing the transparent color
; It should be 0 to maximum 255.
FRAME_001; alpha_color 0
FRAME_001; * Below value should be always 0x0000 (padding?). It has unknown effect though.
FRAME_001; unknown_data_3 0x0000

Maybe this tool could help you in the development. It is a image viewer that shows the code and the hex characters.

upload_2021-2-20_9-15-45.png


It includes the latest imagefont.bin created by @DeViL303
 

Attachments

thanks a lot @aldostools ! :encouragement:

perhaps a silly question, but where's the "imagefont.bin" file located in the PS3 ? hdd? flash? I've no idea! :oops:

answering to myself: always check the psdevwiki :D https://www.psdevwiki.com/ps3/XMB_Fonts#imagefont.bin

Here's the source code for my C extractor tool:
https://github.com/bucanero/imagefont/tree/main/extract-tool

Credits to @littlebalup for the original python tool

Notes:
- no external dependencies to build the binary, just run make :)
- for simplicity, I'm only extracting the first frame of each entry. At least from what I saw in the sample .bin file, most entries use only 1 frame.
- the tool extract .png files with alpha channel
- supports little endian and big endian files
- the code can be further reduced by removing the "unicode.h" file, currently only used to display the calculated UTF-8 hex value.

From here a basic library to return a raw image buffer for a specific entry should be trivial. My code is already generating a 'rawimage' RGBA buffer. IIRC, the only adjustment for the PS3 would be to return that buffer in ARGB order. (Not sure for the Vita)
 
Last edited:
Back
Top