TricksterGuy / nin10kit

(Formerly brandontools) A set of tools for doing homebrew game development, includes look up table generators and and image to C exporter for Nintendo's Gameboy Advance, DS, and 3DS systems. In addition the GUI version of the program allows you to see what the image would look like on real hardware before exporting. Coming soon the ability to edit the bitmap/palette/tilemaps before exporting to the GBA.
Apache License 2.0
49 stars 3 forks source link

export_file_to has possibly unintended effect #36

Closed Ptomerty closed 4 years ago

Ptomerty commented 4 years ago

When choosing a different file name to export to, say nin10kit --mode=3 test bg.png, the name of the internal array isn't changed. As an example:

// file name is test.h
// built with target test.o

extern const unsigned short bg[74160];
// when used in mednafen, must be called with 'bg' instead of 'test', as the file name would indicate

Is this expected behavior?

TricksterGuy commented 4 years ago

Thanks for the issue; however, this is expected behavior.

Excerpt from the basic usage (from running nin10kit --help).

export_file_to is the filename to export to (can include directories) ex: my_images will create my_images.c and my_images.h in the current directory.

It does not change the names of the arrays generated, it is only the filename of the generated files.

If that parameter given was indeed used as the array then then exports like

nin10kit --mode=3 some_filename image1.png image2.png

would not compile. Because the two arrays from both image files would be named some_filename which would cause a multiple declaration error.

I hope this explains why its designed the way it is.


If you want to rename the generated array then the command would be

nin10kit --mode=3 --names=bg test bg.png

Ptomerty commented 4 years ago

Makes sense to me, thanks!