GB Video: Fix SGB PAL commands

This commit is contained in:
Vicki Pfau 2018-01-08 23:34:24 -08:00
parent 3723ebea20
commit 65207f5c0f
1 changed files with 48 additions and 48 deletions

View File

@ -594,39 +594,39 @@ void GBVideoWriteSGBPacket(struct GBVideo* video, uint8_t* data) {
video->palette[2] = data[5] | (data[6] << 8);
video->palette[3] = data[7] | (data[8] << 8);
video->palette[16] = data[1] | (data[2] << 8);
video->palette[17] = data[9] | (data[10] << 8);
video->palette[18] = data[11] | (data[12] << 8);
video->palette[19] = data[13] | (data[14] << 8);
video->palette[4] = data[1] | (data[2] << 8);
video->palette[5] = data[9] | (data[10] << 8);
video->palette[6] = data[11] | (data[12] << 8);
video->palette[7] = data[13] | (data[14] << 8);
video->palette[32] = data[1] | (data[2] << 8);
video->palette[48] = data[1] | (data[2] << 8);
video->palette[8] = data[1] | (data[2] << 8);
video->palette[12] = data[1] | (data[2] << 8);
video->renderer->writePalette(video->renderer, 0, video->palette[0]);
video->renderer->writePalette(video->renderer, 1, video->palette[1]);
video->renderer->writePalette(video->renderer, 2, video->palette[2]);
video->renderer->writePalette(video->renderer, 3, video->palette[3]);
video->renderer->writePalette(video->renderer, 16, video->palette[0]);
video->renderer->writePalette(video->renderer, 17, video->palette[17]);
video->renderer->writePalette(video->renderer, 18, video->palette[18]);
video->renderer->writePalette(video->renderer, 19, video->palette[19]);
video->renderer->writePalette(video->renderer, 32, video->palette[0]);
video->renderer->writePalette(video->renderer, 48, video->palette[0]);
video->renderer->writePalette(video->renderer, 4, video->palette[0]);
video->renderer->writePalette(video->renderer, 5, video->palette[5]);
video->renderer->writePalette(video->renderer, 6, video->palette[6]);
video->renderer->writePalette(video->renderer, 7, video->palette[7]);
video->renderer->writePalette(video->renderer, 8, video->palette[0]);
video->renderer->writePalette(video->renderer, 12, video->palette[0]);
break;
case SGB_PAL23:
video->palette[33] = data[3] | (data[4] << 8);
video->palette[34] = data[5] | (data[6] << 8);
video->palette[35] = data[7] | (data[8] << 8);
video->palette[9] = data[3] | (data[4] << 8);
video->palette[10] = data[5] | (data[6] << 8);
video->palette[11] = data[7] | (data[8] << 8);
video->palette[49] = data[9] | (data[10] << 8);
video->palette[50] = data[11] | (data[12] << 8);
video->palette[51] = data[13] | (data[14] << 8);
video->renderer->writePalette(video->renderer, 33, video->palette[33]);
video->renderer->writePalette(video->renderer, 34, video->palette[34]);
video->renderer->writePalette(video->renderer, 35, video->palette[35]);
video->renderer->writePalette(video->renderer, 49, video->palette[49]);
video->renderer->writePalette(video->renderer, 50, video->palette[50]);
video->renderer->writePalette(video->renderer, 51, video->palette[51]);
video->palette[13] = data[9] | (data[10] << 8);
video->palette[14] = data[11] | (data[12] << 8);
video->palette[15] = data[13] | (data[14] << 8);
video->renderer->writePalette(video->renderer, 9, video->palette[9]);
video->renderer->writePalette(video->renderer, 10, video->palette[10]);
video->renderer->writePalette(video->renderer, 11, video->palette[11]);
video->renderer->writePalette(video->renderer, 13, video->palette[13]);
video->renderer->writePalette(video->renderer, 14, video->palette[14]);
video->renderer->writePalette(video->renderer, 15, video->palette[15]);
break;
case SGB_PAL03:
video->palette[0] = data[1] | (data[2] << 8);
@ -634,38 +634,38 @@ void GBVideoWriteSGBPacket(struct GBVideo* video, uint8_t* data) {
video->palette[2] = data[5] | (data[6] << 8);
video->palette[3] = data[7] | (data[8] << 8);
video->palette[16] = data[1] | (data[2] << 8);
video->palette[32] = data[1] | (data[2] << 8);
video->palette[4] = data[1] | (data[2] << 8);
video->palette[8] = data[1] | (data[2] << 8);
video->palette[48] = data[1] | (data[2] << 8);
video->palette[49] = data[9] | (data[10] << 8);
video->palette[50] = data[11] | (data[12] << 8);
video->palette[51] = data[13] | (data[14] << 8);
video->palette[12] = data[1] | (data[2] << 8);
video->palette[13] = data[9] | (data[10] << 8);
video->palette[14] = data[11] | (data[12] << 8);
video->palette[15] = data[13] | (data[14] << 8);
video->renderer->writePalette(video->renderer, 0, video->palette[0]);
video->renderer->writePalette(video->renderer, 1, video->palette[1]);
video->renderer->writePalette(video->renderer, 2, video->palette[2]);
video->renderer->writePalette(video->renderer, 3, video->palette[3]);
video->renderer->writePalette(video->renderer, 16, video->palette[0]);
video->renderer->writePalette(video->renderer, 32, video->palette[0]);
video->renderer->writePalette(video->renderer, 48, video->palette[0]);
video->renderer->writePalette(video->renderer, 49, video->palette[49]);
video->renderer->writePalette(video->renderer, 50, video->palette[50]);
video->renderer->writePalette(video->renderer, 51, video->palette[51]);
video->renderer->writePalette(video->renderer, 4, video->palette[0]);
video->renderer->writePalette(video->renderer, 8, video->palette[0]);
video->renderer->writePalette(video->renderer, 12, video->palette[0]);
video->renderer->writePalette(video->renderer, 13, video->palette[13]);
video->renderer->writePalette(video->renderer, 14, video->palette[14]);
video->renderer->writePalette(video->renderer, 15, video->palette[15]);
break;
case SGB_PAL12:
video->palette[17] = data[3] | (data[4] << 8);
video->palette[18] = data[5] | (data[6] << 8);
video->palette[19] = data[7] | (data[8] << 8);
video->palette[5] = data[3] | (data[4] << 8);
video->palette[6] = data[5] | (data[6] << 8);
video->palette[7] = data[7] | (data[8] << 8);
video->palette[33] = data[9] | (data[10] << 8);
video->palette[34] = data[11] | (data[12] << 8);
video->palette[35] = data[13] | (data[14] << 8);
video->renderer->writePalette(video->renderer, 17, video->palette[17]);
video->renderer->writePalette(video->renderer, 18, video->palette[18]);
video->renderer->writePalette(video->renderer, 19, video->palette[19]);
video->renderer->writePalette(video->renderer, 33, video->palette[33]);
video->renderer->writePalette(video->renderer, 34, video->palette[34]);
video->renderer->writePalette(video->renderer, 35, video->palette[35]);
video->palette[9] = data[9] | (data[10] << 8);
video->palette[10] = data[11] | (data[12] << 8);
video->palette[11] = data[13] | (data[14] << 8);
video->renderer->writePalette(video->renderer, 5, video->palette[5]);
video->renderer->writePalette(video->renderer, 6, video->palette[6]);
video->renderer->writePalette(video->renderer, 7, video->palette[7]);
video->renderer->writePalette(video->renderer, 9, video->palette[9]);
video->renderer->writePalette(video->renderer, 10, video->palette[10]);
video->renderer->writePalette(video->renderer, 11, video->palette[11]);
break;
case SGB_PAL_SET:
for (i = 0; i < 4; ++i) {