Packrom icon patch

Discuss general Uzebox topics here: features, wish list. nice to have, etc.
Post Reply
rv6502
Posts: 80
Joined: Mon Feb 11, 2019 4:27 am

Packrom icon patch

Post by rv6502 »

I did a quick dirty hack to packrom.cpp

I know nothing displays the game icons for now :lol: but wanted to fill it in anyway.
Screenshot_2022-08-02_21-14-36.png
Screenshot_2022-08-02_21-14-36.png (35.92 KiB) Viewed 3524 times
With a quick ANSI escape code hack to display the icon in an ANSI terminal.

Export a 16x16 24bpp or 32bpp raw image from gimp, RGB/RGBA byte order, add an "icon=iconfile.raw" entry.
I didn't make the line array longer so filename has to be short and characters 32 to 127, or 255, depending if char is signed or not :lol:

It's not glorious nor pretty code at all but, here :P
Attachments
packrom.cpp
(9.62 KiB) Downloaded 119 times
CunningFellow
Posts: 1445
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: Packrom icon patch

Post by CunningFellow »

I still have a dream of the bootloader showing the game icons.
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Packrom icon patch

Post by uze6666 »

CunningFellow wrote: Wed Aug 03, 2022 8:52 pm I still have a dream of the bootloader showing the game icons.
And so do I. Always wishing we missed some sort of miracle hack that could free up enough flash or ram to implement something like that.
CunningFellow
Posts: 1445
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: Packrom icon patch

Post by CunningFellow »

Am 100% sure that miracle is within my powers.

I think I can make the bootloader stay under 4K. Keep Jubatians SDHC/Fat BIOS functionality. Make the UI a lot prettier. Have default game icons per genre if no icon is present in the UZE file. Show custom icon (even animated icon) from the UZE file if present. Include the Uze logo/sound at startup.

All with only one reduction in functionality. Having less friendly error reporting in the case something goes wrong.

Kind of a hybrid of a PC BIOS error and an old school Macintosh not working. If there is an error it will just show a frowning face (like a Mac). To know what the error is you have to look up a table. Like
  • 1 Frowny face = SD card missing
  • 2 Frowny face = SD card failed init
  • 3 Frowny face = SD card not formatted
and so on.
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Packrom icon patch

Post by D3thAdd3r »

Researching ahead and header fixing a bit for a very minimal GUI on CUzeBox..which got me interested in this 256 bytes reserved for a game icon.

The code by @rv6502 seems an ideal compact solution. It would be very cool to have a library of icons for the games, and they might be leveraged to also provide the assets for Emuze later. I added this in, tested, and will make a pull request in a bit if someone wants to review it(please see question below, looking for feedback).

Also added the ability to create a patched version of an existing .uze file. If you specify a .uze file instead of .hex as the input, it doesn't run the normal hex parser. Essentially it lets you take an existing .uze file and run a new gameinfo file on it replacing the header. Source file is unmodified, this could be useful for adding icons and peripheral/JAMMA flags to ROMs which aren't easy to get a .hex for. I intend to make as many placeholder icons as I can to support the upcoming CUzeBox feature.

Question: I have been specifying "genre=..." for years and never thought about it. This flag is ignored by Packrom(added notices for all unknown flags). By Megatris it seems this may have been meant to be a number at some point. But other examples seem to indicate it as a string? Any opinions on this? There are 112 bytes left in the header, should we use 1 and keep a list of Genres? Or is it more useful for it to be a string so the Bootloader wouldn't have to contain such a big table to support it? Perhaps it's completely unnecessary?
User avatar
danboid
Posts: 1929
Joined: Sun Jun 14, 2020 12:14 am

Re: Packrom icon patch

Post by danboid »

I'm not bothered about the genre tag personally, I think we can get by without it.

Icons in the bootloader would be cool so if those bits are needed,I wouldn't miss the genre tag.
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Packrom icon patch

Post by D3thAdd3r »

I have the initial structure for loading and displaying the icon in CUzeBox:
icon-test.jpg
icon-test.jpg (248.52 KiB) Viewed 1943 times
ikd-icon-test.jpg
ikd-icon-test.jpg (95.08 KiB) Viewed 1942 times
Set some flags to where things that don't have to get redrawn don't, which should speed up CUzeBox a bit(in particular a buffer clear that needn't happen unless window changes size?). Will fix author name and stuff and post that in the ESP8266 branch.

Also added the 'Z' task icon for the program bar. Right now it's just a direct copy from Uzem but is better than a generic blank icon IMO.
User avatar
danboid
Posts: 1929
Joined: Sun Jun 14, 2020 12:14 am

Re: Packrom icon patch

Post by danboid »

Veeeery nice!

I like that icon you've done for IKD!

Are you going to tackle bootloader icon support too DA or is that a job for CF?

How many frames will we get for the icon anims? 2? More?
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Packrom icon patch

Post by D3thAdd3r »

Unfortunately there is just 112 bytes free, where each icon frame would take an additional 256 bytes. It would be possible to make an extended format which was backwards compatible probably, if the demand was ever there.

I mean to make an attempt at creating a decent icon for all games. Then anyone who takes the time to do a better one we go with that, but at least we have universal icon support.
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Packrom icon patch

Post by D3thAdd3r »

I merged the packrom additions and fixed a bug I must have introduced in cleanup. You can now create .uze files as normal, or patch existing .uze ROMs with new property files(which might contain a new icon file path, etc.)

Example of patching an existing ROM:

Code: Select all

./packrom existing.uze existing.uze newproperties.properties
Added an icon for Megatris, made a pull request for IKD icon. I temporarily disabled icon display in my latest dev version of CUzeBox until I get things a bit more ironed out. Not sure if/how this can be added to the bootloader.
Post Reply