GBA: Export to ACT
Jeffrey Pfau jeffrey@endrift.com
Sat, 30 May 2015 17:42:18 -0700
2 files changed,
25 insertions(+),
0 deletions(-)
M
src/gba/supervisor/export.c
→
src/gba/supervisor/export.c
@@ -55,3 +55,27 @@ }
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; +}
M
src/gba/supervisor/export.h
→
src/gba/supervisor/export.h
@@ -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