comparison cd_graphics.c @ 2685:da2e06c42d16

Add a compile-time flag to use RGB565 instead of ABGR/ARGB
author Michael Pavone <pavone@retrodev.com>
date Sun, 30 Mar 2025 00:06:53 -0700
parents a1afe26a8ef0
children
comparison
equal deleted inserted replaced
2684:c649bcc18487 2685:da2e06c42d16
261 } 261 }
262 262
263 static void render_graphics_debug(segacd_context *cd) 263 static void render_graphics_debug(segacd_context *cd)
264 { 264 {
265 int pitch; 265 int pitch;
266 uint32_t *fb = render_get_framebuffer(cd->graphics_debug_window, &pitch); 266 pixel_t *fb = render_get_framebuffer(cd->graphics_debug_window, &pitch);
267 uint32_t pixels = (cd->gate_array[GA_STAMP_SIZE] & BIT_SMS) ? 4096 : 256; 267 uint32_t pixels = (cd->gate_array[GA_STAMP_SIZE] & BIT_SMS) ? 4096 : 256;
268 uint32_t stamp_size = (cd->gate_array[GA_STAMP_SIZE] & BIT_STS) ? 32 : 16; 268 uint32_t stamp_size = (cd->gate_array[GA_STAMP_SIZE] & BIT_STS) ? 32 : 16;
269 uint32_t num_stamps = pixels / stamp_size; 269 uint32_t num_stamps = pixels / stamp_size;
270 //TODO: fix mask based on SMS and STS 270 //TODO: fix mask based on SMS and STS
271 uint32_t address = (cd->gate_array[GA_STAMP_MAP_BASE] & 0xFFE0) << 1; 271 uint32_t address = (cd->gate_array[GA_STAMP_MAP_BASE] & 0xFFE0) << 1;
282 if (start_x < 1024 && start_y < 1024) { 282 if (start_x < 1024 && start_y < 1024) {
283 for (uint32_t tile_x = start_x; tile_x < start_x + stamp_size; tile_x+=8) 283 for (uint32_t tile_x = start_x; tile_x < start_x + stamp_size; tile_x+=8)
284 { 284 {
285 for (uint32_t y = start_y; y < start_y + stamp_size; y++) 285 for (uint32_t y = start_y; y < start_y + stamp_size; y++)
286 { 286 {
287 uint32_t *line = fb + y * pitch / sizeof(uint32_t); 287 pixel_t *line = fb + y * pitch / sizeof(uint32_t);
288 for (uint32_t x = tile_x; x < tile_x + 8; x += 4) 288 for (uint32_t x = tile_x; x < tile_x + 8; x += 4)
289 { 289 {
290 290
291 uint16_t word = cd->word_ram[tile_address++]; 291 uint16_t word = cd->word_ram[tile_address++];
292 uint16_t pixels[4] = { 292 uint16_t pixels[4] = {