Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract the fonts to separate BMP files rather than combined BIN files #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xcompiler
Copy link

These changes extract the fonts in the assets/font folder to separate BMP files rather than combined BIN files. The BMP files can then be individually viewed in a standard image viewing program, such as GIMP.

The raw 8-bit image data is extracted from the baserom.u.z64 file by the extract_baserom.u.sh file, using the offsets inserted into the filelist.u.csv file.

The extract_baserom.u.sh file then inserts a generic 8-bit greyscale BMP header file (font_bmp_header.bin) to the beginning of each image file using the 'sed' command, and then updates the image width and height values in the BMP header according to the values at the end of each filename.

The height is adjusted to a negative value, so that the bitmap will be displayed the correct way up. The filesize and imagesize fields of the BMP header are not modified (for simplicity) as GIMP seems to be able to open the images without them.

The BMP header data is ignored when assembling the image data, as the assets/font/font.s file contains instructions to ignore the first 1146 bytes of each BMP file.

The assets/font/font.s file also ensures that the 8 bytes of 'padding' data are added to the end of each 16-pixel-wide font. The padding data is only extracted once by the extract_baserom.u.sh file (instead of after each 16-pixel-wide image), as it appears to be identical in each subsequent 16-pixel-wide image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant