2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 09:07:43 +00:00

Several GameCube cooking fixes

This commit is contained in:
Jack Andersen
2018-04-03 22:31:29 -10:00
parent ecaf7f313f
commit d5e471bac3
8 changed files with 108 additions and 77 deletions

View File

@@ -603,7 +603,7 @@ static uint8_t* EncodePaletteSPLT(png_structp png, png_infop info, int numEntrie
}
}
uint32_t format = 0; /* Default IA8 */
uint32_t format = 2; /* Default RGB5A3 */
for (int e=0 ; e<pngNumEntries ; ++e)
{
png_sPLT_entryp ent = &cEntries[e];
@@ -672,7 +672,7 @@ static uint8_t* EncodePaletteSPLT(png_structp png, png_infop info, int numEntrie
for (int e=0 ; e<numEntries ; ++e)
{
uint16_t texel = 0;
if (cEntries[e].alpha == 0xff)
if (cEntries && cEntries[e].alpha == 0xff)
{
texel |= 0x8000;
if (e < pngNumEntries)
@@ -1321,7 +1321,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
{
Log.report(logvisor::Error, "image must be 4x4 or larger");
fclose(inf);
png_destroy_read_struct(&pngRead, nullptr, nullptr);
png_destroy_read_struct(&pngRead, &info, nullptr);
return false;
}