all repos — mgba @ 632316eef0b5c82598c8f7ad1685720570eebcd6

mGBA Game Boy Advance Emulator

GBA: Export to ACT
Jeffrey Pfau jeffrey@endrift.com
Sat, 30 May 2015 17:42:18 -0700
commit

632316eef0b5c82598c8f7ad1685720570eebcd6

parent

bbac206364c20d7ddffc2a1472eef0d5f514c2d2

2 files changed, 25 insertions(+), 0 deletions(-)

jump to
M src/gba/supervisor/export.csrc/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.hsrc/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