GBA: Export to ACT

This commit is contained in:
Jeffrey Pfau 2015-05-30 17:42:18 -07:00
parent bbac206364
commit 632316eef0
2 changed files with 25 additions and 0 deletions

View File

@ -55,3 +55,27 @@ bool GBAExportPaletteRIFF(struct VFile* vf, size_t entries, const uint16_t* colo
return true;
}
bool GBAExportPaletteACT(struct VFile* vf, size_t entries, const uint16_t* colors) {
if (entries > 256) {
return false;
}
size_t i;
for (i = 0; i < entries; ++i) {
uint8_t block[3] = {
GBA_R8(colors[i]),
GBA_G8(colors[i]),
GBA_B8(colors[i]),
};
if (vf->write(vf, block, 3) < 3) {
return false;
}
}
for (; i < 256; ++i) {
uint8_t block[3] = { 0, 0, 0 };
if (vf->write(vf, block, 3) < 3) {
return false;
}
}
return true;
}

View File

@ -11,5 +11,6 @@
struct VFile;
bool GBAExportPaletteRIFF(struct VFile* vf, size_t entries, const uint16_t* colors);
bool GBAExportPaletteACT(struct VFile* vf, size_t entries, const uint16_t* colors);
#endif