Browse code

Fixed palette array

Andrew Alderwick authored on 20/09/2021 22:02:42
Showing 1 changed files
... ...
@@ -36,7 +36,7 @@ static SDL_Rect gRect;
36 36
 static Ppu ppu;
37 37
 static Apu apu[POLYPHONY];
38 38
 static Device *devsystem, *devscreen, *devmouse, *devctrl, *devaudio0, *devconsole;
39
-static Uint32 *ppu_screen, stdin_event, audio0_event, palette[4];
39
+static Uint32 *ppu_screen, stdin_event, audio0_event, palette[16];
40 40
 
41 41
 static Uint8 zoom = 1;
42 42
 static unsigned int reqdraw = 0;
... ...
@@ -300,6 +300,8 @@ update_palette(Uint8 *addr)
300 300
 			b = (*(addr + 4 + i / 2) >> (!(i % 2) << 2)) & 0x0f;
301 301
 		palette[i] = 0xff000000 | (r << 20) | (r << 16) | (g << 12) | (g << 8) | (b << 4) | b;
302 302
 	}
303
+	for(i = 4; i < 16; ++i)
304
+		palette[i] = palette[i / 4];
303 305
 	reqdraw = 1;
304 306
 }
305 307