if (ctx->paletted) {
int i;
- uint8_t *p = frame->data[1];
+ uint32_t *p = (uint32_t*) frame->data[1];
/* Use the first 1024 bytes as palette, then copy the rest. */
for (i = 0; i < 256; i++) {
- p[i * 4 + 2] = bytestream2_get_byte(gbc);
- p[i * 4 + 1] = bytestream2_get_byte(gbc);
- p[i * 4 + 0] = bytestream2_get_byte(gbc);
- p[i * 4 + 3] = bytestream2_get_byte(gbc);
+ uint32_t rgba = 0;
+ rgba |= bytestream2_get_byte(gbc) << 16;
+ rgba |= bytestream2_get_byte(gbc) << 8;
+ rgba |= bytestream2_get_byte(gbc) << 0;
+ rgba |= bytestream2_get_byte(gbc) << 24;
+ p[i] = rgba;
}
frame->palette_has_changed = 1;