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

Fix memory allocation issue for ci textures #18

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

MegaMech
Copy link

@MegaMech MegaMech commented Jan 29, 2023

When using

./n64graphics -i tex.rgba.ci4.inc16.c -g tex.rgba16.ci4.png -f ci4 -s u8 -c rgba16 -p tex_gen.rgba16.ci4.inc.c -v

This results in a memory next error. Due to this line:

raw16_size = config.width * config.height * config.pal_format.depth / 8;

It's still using the default of 32x32 to allocate memory. However, this texture is 128x32. Therefore, we need to read the .png's dimension metadata earlier to allocate memory based on that.

Adds -m argument (stands for magic number or magic filler) to specify what value to fill palettes with. This way the tail end of the palette will match.

@MegaMech
Copy link
Author

MegaMech commented Feb 3, 2023

CI4 likely needs a bit of testing. However, CI8s should be working properly now.

@MegaMech
Copy link
Author

MegaMech commented Feb 6, 2023

I think I just need to modify the documentation a bit and then this PR is good to go.

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