LIJI32 / SameBoy

Game Boy and Game Boy Color emulator written in C
https://sameboy.github.io/
Other
1.65k stars 207 forks source link

Can't use custom .png logos in bootrom #515

Closed maij closed 1 year ago

maij commented 1 year ago

Is it possible to replace the Sameboy with another logo? I have tried various 128 x 24 2-bit images, but they all result in logo corruption when I build the project.

I am using the latest rgb* libraries (built from source at the latest release). Is there a special set of rules to make this work?

Examples

Vertical stripes

1px stripes vertical_stripes Screenshot from 2022-11-22 08-23-07

2px stripes vertical_stripes_2px Screenshot from 2022-11-22 08-44-32

Gameboy text

Gameboy_logo Fails to compile with following message:

rgbgfx  -Z -u -c embedded -o build/obj/BootROMs/SameBoyLogo.2bpp BootROMs/SameBoyLogo.png
cc -std=c99 -Wall -Werror BootROMs/pb12.c -o build/pb12
~/SameBoy/build/pb12 < build/obj/BootROMs/SameBoyLogo.2bpp > build/obj/BootROMs/SameBoyLogo.pb12
pb12: BootROMs/pb12.c:90: main: Assertion `outctl != 1' failed.
Aborted (core dumped)
make: *** [Makefile:474: build/obj/BootROMs/SameBoyLogo.pb12] Error 134
LIJI32 commented 1 year ago

The SameBoy logo is compressed under a scheme that is somewhat hardcoded to the SameBoy logo itself:

  1. It requires 3 colors (not 2 and not 4) in a particular palette. Using a different palette can trigger an assertion error like the one you've posted.
  2. It assumes at specific amount of unique tiles in a specific layout (There are two duplicate tiles in SameBoy's logo, being shared between E and B). The stripe examples only have one unique tile.
  3. Boot ROM space is extremely tight, logos that are slightly less compressible than the current logo simply won't fit.
maij commented 1 year ago

Thanks for the response, may I ask what tools you used to create the SameBoy logo? I have tried toying with my own in GIMP but I haven't made any headway there.

LIJI32 commented 1 year ago

Any tool that properly supports indexed PNGs should work. I specifically use Adobe Photoshop.

maij commented 1 year ago

Thanks, I'll close this issue now. I will play around with different bootrom code.