void DrawStateMovieRow(SDL_Surface *surface, int *nstatus, int cur, int recently_saved, uint8 *text) { uint32 *XBuf = (uint32 *)surface->pixels; uint32 pitch32 = surface->pitch >> 2; int x, y; for(y=0; y<40; y++) for(x=0;x<230;x++) XBuf[x + y * pitch32] = MK_COLOR_A(surface, 0x00, 0x00, 0x00, 170); // nstatus for(int i = 1; i < 11; i++) { char stringie[2]; uint32 bordercol; if(cur == (i % 10)) bordercol = MK_COLOR_A(surface, 0x60, 0x20, 0xb0, 0xFF); else bordercol = MK_COLOR_A(surface, 0, 0, 0, 0xFF); stringie[0] = '0' + (i % 10); stringie[1] = 0; //if(nstatus[i % 10]) { uint32 rect_bg_color = MK_COLOR_A(surface, 0x00, 0x00, 0x00, 0xFF); if(nstatus[i % 10]) { rect_bg_color = MK_COLOR_A(surface, 0x00, 0x38, 0x28, 0xFF); if(recently_saved == (i % 10)) rect_bg_color = MK_COLOR_A(surface, 0x48, 0x00, 0x34, 0xFF); } MDFN_DrawRectangleFill(XBuf, pitch32, (i - 1) * 23, 0, bordercol, rect_bg_color, 23, 18 + 1); } //else // MDFN_DrawRectangle(XBuf, pitch32, (i - 1) * 23, 0, bordercol, 23, 18 + 1); DrawTextTransShadow(XBuf + (i - 1) * 23 + 7, pitch32 << 2, 230, (UTF8*)stringie, MK_COLOR_A(surface, 0xE0, 0xFF, 0xE0, 0xFF), MK_COLOR_A(surface, 0x00, 0x00, 0x00, 0xFF), FALSE); } DrawTextTransShadow(XBuf + 20 * pitch32, pitch32 << 2, 230, text, MK_COLOR_A(surface, 0xE0, 0xFF, 0xE0, 0xFF), MK_COLOR_A(surface, 0x00, 0x00, 0x00, 0xFF), TRUE); }
// Call this function from the main thread void GfxDebugger_Draw(MDFN_Surface *surface, const MDFN_Rect *rect, const MDFN_Rect *screen_rect) { if(!IsActive) return; const MDFN_PixelFormat pf_cache = surface->format; uint32 *src_pixels; uint32 * pixels = surface->pixels; uint32 pitch32 = surface->pitchinpix; bool ism; LockGameMutex(1); ism = InSteppingMode; if(ism) { RedoSGD(TRUE); } if(gd_surface->format.Rshift != surface->format.Rshift || gd_surface->format.Gshift != surface->format.Gshift || gd_surface->format.Bshift != surface->format.Bshift || gd_surface->format.Ashift != surface->format.Ashift || gd_surface->format.colorspace != surface->format.colorspace) { //puts("Convert Meow"); gd_surface->SetFormat(surface->format, TRUE); } src_pixels = gd_surface->pixels; if(!src_pixels) { LockGameMutex(0); return; } for(unsigned int y = 0; y < 128; y++) { uint32 *row = pixels + ((rect->w - 256) / 2) + y * pitch32 * 2; for(unsigned int x = 0; x < 128; x++) { //printf("%d %d %d\n", y, x, pixels); row[x*2] = row[x*2 + 1] = row[pitch32 + x*2] = row[pitch32 + x*2 + 1] = src_pixels[x + y * 128 * 3]; //row[x] = MK_COLOR_A(0, 0, 0, 0xc0); //row[x] = MK_COLOR_A(0x00, 0x00, 0x00, 0x7F); } } // Draw layer name { for(unsigned int y = 256; y < 256 + 18; y++) for(unsigned int x = 0; x < rect->w; x++) { pixels[y * pitch32 + x] = MK_COLOR_A(0x00, 0x00, 0x00, 0xC0); } char buf[256]; if(ism) trio_snprintf(buf, 256, "%s, PBN: %d, Scroll: %d, Instant", LayerNames[CurLayer], LayerPBN[CurLayer], LayerScroll[CurLayer]); else trio_snprintf(buf, 256, "%s, PBN: %d, Scroll: %d, Line: %d", LayerNames[CurLayer], LayerPBN[CurLayer], LayerScroll[CurLayer], LayerScanline[CurLayer]); DrawTextTransShadow(pixels + 256 * pitch32, surface->pitchinpix << 2, rect->w, (UTF8*)buf, MK_COLOR_A(0xF0, 0xF0, 0xF0, 0xFF), MK_COLOR_A(0, 0, 0, 0xFF), 1, FALSE); } int mousex, mousey; SDL_GetMouseState(&mousex, &mousey); int vx, vy; vx = (mousex - screen_rect->x) * rect->w / screen_rect->w - ((rect->w - 256) / 2); vy = (mousey - screen_rect->y) * rect->h / screen_rect->h; vx /= 2; vy /= 2; if(vx < 128 && vy < 128 && vx >= 0 && vy >= 0) { if(src_pixels[vx + vy * 128 * 3] & (0xFF << surface->format.Ashift)) { for(unsigned int y = 278; y < 278 + 18; y++) for(unsigned int x = 0; x < rect->w; x++) { pixels[y * pitch32 + x] = MK_COLOR_A(0x00, 0x00, 0x00, 0xC0); } char buf[256]; trio_snprintf(buf, 256, "Tile: %08x, Address: %08x", src_pixels[128 + vx + vy * 128 * 3], src_pixels[256 + vx + vy * 128 * 3]); DrawTextTransShadow(pixels + 278 * pitch32, surface->pitchinpix << 2, rect->w, (UTF8*)buf, MK_COLOR_A(0xF0, 0xF0, 0xF0, 0xFF), MK_COLOR_A(0, 0, 0, 0xFF), 1, FALSE); } } LockGameMutex(0); }