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); }
void FPS_DrawToScreen(SDL_Surface *screen, int rs, int gs, int bs, int as) { if(!isactive) { if(FPSSurface) { SDL_FreeSurface(FPSSurface); FPSSurface = NULL; } return; } if(!FPSSurface) { FPSSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, box_width, box_height, 32, 0xFF << rs, 0xFF << gs, 0xFF << bs, 0xFF << as); FPSRect.w = box_width; FPSRect.h = box_height; FPSRect.x = FPSRect.y = 0; } char virtfps[64], drawnfps[64], blitfps[64]; CalcFramerates(virtfps, drawnfps, blitfps, 64); SDL_FillRect(FPSSurface, NULL, MK_COLOR_A(FPSSurface, 0, 0, 0, 0x80)); DrawTextTrans((uint32 *)FPSSurface->pixels, FPSSurface->pitch, FPSSurface->w, (UTF8*)virtfps, MK_COLOR_A(FPSSurface, 0xFF, 0xFF, 0xFF, 0xFF), FALSE, TRUE); DrawTextTrans((uint32 *)FPSSurface->pixels + 7 * (FPSSurface->pitch >> 2), FPSSurface->pitch, FPSSurface->w, (UTF8*)drawnfps, MK_COLOR_A(FPSSurface, 0xFF, 0xFF, 0xFF, 0xFF), FALSE, TRUE); DrawTextTrans((uint32 *)FPSSurface->pixels + 7 * 2 * (FPSSurface->pitch >> 2), FPSSurface->pitch, FPSSurface->w, (UTF8*)blitfps, MK_COLOR_A(FPSSurface, 0xFF, 0xFF, 0xFF, 0xFF), FALSE, TRUE); SDL_Rect drect; drect.x = 0; drect.y = 0; drect.w = FPSRect.w; drect.h = FPSRect.h; BlitRaw(FPSSurface, &FPSRect, &drect); }
void DrawSaveStates(SDL_Surface *screen, double exs, double eys, int rs, int gs, int bs, int as) { if(StateShow < MDFND_GetTime()) { SSCleanup(); } if(StateStatus) { if(!PreviewSurface) { PreviewSurface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA, StateStatus->w + 2, StateStatus->h + 2, 32, 0xFF << rs, 0xFF << gs, 0xFF << bs, 0xFF << as); if(!PreviewSurface) { printf("Iyee: %d %d\n", StateStatus->w, StateStatus->h); return; } PreviewRect.x = PreviewRect.y = 0; PreviewRect.w = StateStatus->w + 2; PreviewRect.h = StateStatus->h + 2; MDFN_DrawRectangleAlpha((uint32*)PreviewSurface->pixels, PreviewSurface->pitch >> 2, 0, 0, MK_COLOR_A(PreviewSurface, 0x00, 0x00, 0x9F, 0xFF), MK_COLOR_A(PreviewSurface, 0x00, 0x00, 0x00, 0x80), StateStatus->w + 2, StateStatus->h + 2); uint32 *psp = (uint32*)PreviewSurface->pixels; psp += PreviewSurface->pitch >> 2; psp++; if(StateStatus->gfx) { for(uint32 y = 0; y < StateStatus->h; y++) { uint8 *src_row = StateStatus->gfx + y * StateStatus->w * 3; for(uint32 x = 0; x < StateStatus->w; x++) { psp[x] = MK_COLOR_A(PreviewSurface, src_row[0], src_row[1], src_row[2], 0xFF); src_row += 3; } psp += PreviewSurface->pitch >> 2; } } if(!TextSurface) { TextSurface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA, 230, 40, 32, 0xFF << rs, 0xFF << gs, 0xFF << bs, 0xFF << as); SDL_SetColorKey(TextSurface, SDL_SRCCOLORKEY, 0); SDL_SetAlpha(TextSurface, SDL_SRCALPHA, 0); TextRect.x = TextRect.y = 0; TextRect.w = 230; TextRect.h = 40; } if(IsMovie) { UTF8 text[256]; if(StateStatus->current_movie > 0) trio_snprintf((char *)text, 256, _("-recording movie %d-"), StateStatus->current_movie-1); else if (StateStatus->current_movie < 0) trio_snprintf((char *)text, 256, _("-playing movie %d-"),-1 - StateStatus->current_movie); else trio_snprintf((char *)text, 256, _("-select movie-")); DrawStateMovieRow(TextSurface, StateStatus->status, StateStatus->current, StateStatus->recently_saved, text); } else DrawStateMovieRow(TextSurface, StateStatus->status, StateStatus->current, StateStatus->recently_saved, (UTF8 *)_("-select state-")); } } // end if(StateStatus)
void DrawSaveStates(SDL_Surface *screen, double exs, double eys, int rs, int gs, int bs, int as) { StateStatusStruct *tmps; if(StateShow < MDFND_GetTime()) { if(PreviewSurface) { SDL_FreeSurface(PreviewSurface); PreviewSurface = NULL; } if(StateStatus) { if(StateStatus->gfx) free(StateStatus->gfx); free(StateStatus); StateStatus = NULL; } } if(MovieShow < MDFND_GetTime()) { if(PreviewSurface) { SDL_FreeSurface(PreviewSurface); PreviewSurface = NULL; } if(MovieStatus) { if(MovieStatus->gfx) free(MovieStatus->gfx); free(MovieStatus); MovieStatus = NULL; } } tmps = MovieStatus; if(StateStatus) tmps = StateStatus; if(tmps) { if(PreviewSurface) { SDL_FreeSurface(PreviewSurface); PreviewSurface = NULL; } PreviewSurface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA, tmps->w + 2, tmps->h + 2, 32, 0xFF << rs, 0xFF << gs, 0xFF << bs, 0xFF << as); PreviewRect.x = PreviewRect.y = 0; PreviewRect.w = tmps->w + 2; PreviewRect.h = tmps->h + 2; MDFN_DrawRectangleAlpha((uint32*)PreviewSurface->pixels, PreviewSurface->pitch >> 2, 0, 0, MK_COLOR_A(PreviewSurface, 0x00, 0x00, 0x9F, 0xFF), tmps->w + 2, tmps->h + 2); uint32 *psp = (uint32*)PreviewSurface->pixels; psp += PreviewSurface->pitch >> 2; psp++; if(tmps->gfx) for(int y = 0; y < tmps->h; y++) { memcpy(psp, tmps->gfx + y * tmps->pitch, tmps->w * sizeof(uint32)); psp += PreviewSurface->pitch >> 2; } if(!TextSurface) { TextSurface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA, 230, 40, 32, 0xFF << rs, 0xFF << gs, 0xFF << bs, 0xFF << as); SDL_SetColorKey(TextSurface, SDL_SRCCOLORKEY, 0); SDL_SetAlpha(TextSurface, SDL_SRCALPHA, 0); TextRect.x = TextRect.y = 0; TextRect.w = 230; TextRect.h = 40; } if(tmps == MovieStatus) { UTF8 text[256]; if(tmps->current_movie > 0) trio_snprintf((char *)text, 256, _("-recording movie %d-"), tmps->current_movie-1); else if (tmps->current_movie < 0) trio_snprintf((char *)text, 256, _("-playing movie %d-"),-1 - tmps->current_movie); else trio_snprintf((char *)text, 256, _("-select movie-")); DrawStateMovieRow(TextSurface, tmps->status, tmps->current, tmps->recently_saved, text); } else DrawStateMovieRow(TextSurface, tmps->status, tmps->current, tmps->recently_saved, (UTF8 *)_("-select state-")); } if(PreviewSurface) { SDL_Rect tdrect, drect; int meow = ((screen->w / CurGame->width) + 1) / 2; if(!meow) meow = 1; tdrect.w = TextRect.w * meow; tdrect.h = TextRect.h * meow; tdrect.x = (screen->w - tdrect.w) / 2; tdrect.y = screen->h - tdrect.h; BlitRaw(TextSurface, &TextRect, &tdrect); drect.w = PreviewRect.w * meow; drect.h = PreviewRect.h * meow; drect.x = (screen->w - drect.w) / 2; drect.y = screen->h - drect.h - tdrect.h - 4; BlitRaw(PreviewSurface, &PreviewRect, &drect); } }
// 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); }
// Call this function from the main thread void MemDebugger_Draw(MDFN_Surface *surface, const MDFN_Rect *rect, const MDFN_Rect *screen_rect) { if(!IsActive) return; const MDFN_PixelFormat pf_cache = surface->format; uint32 *pixels = surface->pixels; uint32 pitch32 = surface->pitchinpix; const uint64 zemod = SizeCache[CurASpace]; LockGameMutex(1); DrawTextTrans(pixels, surface->pitchinpix << 2, rect->w, (UTF8*)ASpace->long_name, MK_COLOR_A(0x20, 0xFF, 0x20, 0xFF), 1, 1); pixels += 10 * pitch32; uint32 A; uint32 Ameow; // A meow for a cat if(ASpacePos[CurASpace] < 128) A = (SizeCache[CurASpace] - 128 + ASpacePos[CurASpace]) % SizeCache[CurASpace]; else A = ASpacePos[CurASpace] - 128; Ameow = A &~ 0xF; int numrows = zemod / 16; if(numrows > 16) numrows = 16; else if(numrows < 4) numrows = 4; for(int y = 0; y < numrows; y++) { uint8 byte_buffer[16]; char abuf[32]; Ameow %= zemod; ASpace->GetAddressSpaceBytes(ASpace->name, Ameow, 16, byte_buffer); if(zemod <= (1 << 16)) trio_snprintf(abuf, 32, "%04X:", Ameow); else if(zemod <= (1 << 24)) trio_snprintf(abuf, 32, "%06X:", Ameow); else trio_snprintf(abuf, 32, "%08X:", Ameow); uint32 alen; uint32 addr_color = MK_COLOR_A(0xA0, 0xA0, 0xFF, 0xFF); if(Ameow == (ASpacePos[CurASpace] & ~0xF)) addr_color = MK_COLOR_A(0x80, 0xB0, 0xFF, 0xFF); alen = DrawTextTrans(pixels, surface->pitchinpix << 2, rect->w, (UTF8*)abuf, addr_color, 0, 1); alen += 3; for(int x = 0; x < 16; x++) { uint32 bcolor = MK_COLOR_A(0xFF, 0xFF, 0xFF, 0xFF); uint32 acolor = MK_COLOR_A(0xA0, 0xA0, 0xA0, 0xFF); char quickbuf[16]; uint32 test_match_pos; uint8 ascii_str[2]; ascii_str[1] = 0; ascii_str[0] = byte_buffer[x]; if(ascii_str[0] < 0x20 || ascii_str[0] >= 128) ascii_str[0] = '.'; trio_snprintf(quickbuf, 16, "%02X", byte_buffer[x]); test_match_pos = ASpacePos[CurASpace] % zemod; if(InMarkMode) { if(MarkModeBegin < test_match_pos && Ameow < test_match_pos && Ameow >= MarkModeBegin) { if(InTextArea) { acolor = MK_COLOR_A(0xFF, 0x00, 0x00, 0xFF); bcolor = MK_COLOR_A(0xFF, 0x80, 0x80, 0xFF); } else { acolor = MK_COLOR_A(0xFF, 0x80, 0x80, 0xFF); bcolor = MK_COLOR_A(0xFF, 0x00, 0x00, 0xFF); } } } if(Ameow == test_match_pos) { if(InEditMode) if(SDL_GetTicks() & 0x80) { int pix_offset = alen; if(InTextArea) pix_offset += 16 * 12 + x * 5; else pix_offset += (LowNib ? 5 : 0) + x * 12; DrawTextTrans(pixels + pix_offset, surface->pitchinpix << 2, rect->w, (UTF8*)"▉", MK_COLOR_A(0xFF, 0xFF, 0xFF, 0xFF), 0, 1); } if(InTextArea) { acolor = MK_COLOR_A(0xFF, 0x00, 0x00, 0xFF); bcolor = MK_COLOR_A(0xFF, 0x80, 0x80, 0xFF); } else { acolor = MK_COLOR_A(0xFF, 0x80, 0x80, 0xFF); bcolor = MK_COLOR_A(0xFF, 0x00, 0x00, 0xFF); } } // hex display DrawTextTrans(pixels + alen + x * 12, surface->pitchinpix << 2, rect->w, (UTF8*)quickbuf, bcolor, 0, 1); // ASCII display DrawTextTrans(pixels + alen + 16 * 12 + x * 5, surface->pitchinpix << 2, rect->w, (UTF8 *)ascii_str, acolor, 0, 1); Ameow++; } pixels += 9 * pitch32; } { char cpstr[32]; uint32 curpos = ASpacePos[CurASpace]; uint8 zebytes[4]; uint32 tmpval; curpos %= zemod; ASpace->GetAddressSpaceBytes(ASpace->name, curpos, 4, zebytes); pixels += 8 + 5 * pitch32; if(zemod <= (1 << 16)) trio_snprintf(cpstr, 32, "%04X", curpos); else if(zemod <= (1 << 24)) trio_snprintf(cpstr, 32, "%06X", curpos); else trio_snprintf(cpstr, 32, "%08X", curpos); uint32 cpplen; uint32 cplen; cpplen = DrawTextTrans(pixels, surface->pitchinpix << 2, rect->w, (UTF8*)"Cursor position: ", MK_COLOR_A(0xa0, 0xa0, 0xFF, 0xFF), 0, 1); cplen = DrawTextTrans(pixels + cpplen, surface->pitchinpix << 2, rect->w, (UTF8*)cpstr , MK_COLOR_A(0xFF, 0xFF, 0xFF, 0xFF), 0, 1); if(GoGoPowerDD[CurASpace]) { char ggddstr[32]; if(zemod <= (1 << 16)) trio_snprintf(ggddstr, 32, "%04X", curpos - GoGoPowerDD[CurASpace]); else if(zemod <= (1 << 24)) trio_snprintf(ggddstr, 32, "%06X", curpos - GoGoPowerDD[CurASpace]); else trio_snprintf(ggddstr, 32, "%08X", curpos - GoGoPowerDD[CurASpace]); DrawTextTrans(pixels + cpplen + cplen + 8, surface->pitchinpix << 2, rect->w, (UTF8*)ggddstr, MK_COLOR_A(0xFF, 0x80, 0x80, 0xFF), 0, 1); } pixels += 5 + 10 * pitch32; tmpval = zebytes[0]; trio_snprintf(cpstr, 32, "%02x(%u, %d)", tmpval, (uint8)tmpval, (int8)tmpval); cpplen = DrawTextTrans(pixels, surface->pitchinpix << 2, rect->w, (UTF8*)"1-byte value: ", MK_COLOR_A(0xA0, 0xA0, 0xFF, 0xFF), 0, 1); DrawTextTrans(pixels + cpplen, surface->pitchinpix << 2, rect->w, (UTF8*)cpstr , MK_COLOR_A(0xFF, 0xFF, 0xFF, 0xFF), 0, 1); pixels += 10 * pitch32; if(ASpace->IsWave && SizeCache[CurASpace] <= 128 && ASpace->WaveBits <= 6) { const int32 wf_size = SizeCache[CurASpace]; uint8 waveform[wf_size]; const int32 pcm_max = (1 << ASpace->WaveBits) - 1; DrawTextTrans(pixels - 5, surface->pitchinpix << 2, rect->w, (UTF8 *)"Full waveform:", MK_COLOR_A(0xA0, 0xA0, 0xFF, 0xFF), 0, 1); pixels += 9 * pitch32; MDFN_DrawRectangleFill(pixels, surface->pitchinpix, 0, 0, MK_COLOR_A(0xA0,0xA0,0xA0,0xFF), MK_COLOR_A(0,0,0,0xFF), 2 + wf_size * 2 + 2, 2 + (pcm_max + 1) + 2); ASpace->GetAddressSpaceBytes(ASpace->name, 0, wf_size, waveform); for(int i = 0; i < wf_size; i++) { int32 delta; int32 current; int32 previous; current = waveform[i]; previous = waveform[(i + wf_size - 1) % wf_size]; delta = current - previous; for(int y = previous; y != current; y += delta / abs(delta)) pixels[2 + i * 2 + 0 + (2 + (pcm_max - y)) * surface->pitchinpix] = MK_COLOR_A(0x00,0xA0,0x00,0xFF); pixels[2 + i * 2 + 0 + (2 + (pcm_max - current)) * surface->pitchinpix] = MK_COLOR_A(0x00,0xA0,0x00,0xFF); pixels[2 + i * 2 + 1 + (2 + (pcm_max - current)) * surface->pitchinpix] = MK_COLOR_A(0x00,0xA0,0x00,0xFF); } } else { tmpval = zebytes[0] | (zebytes[1] << 8); trio_snprintf(cpstr, 32, "%04x(%u, %d)", tmpval, (uint16)tmpval, (int16)tmpval); cpplen = DrawTextTrans(pixels, surface->pitchinpix << 2, rect->w, (UTF8*)"2-byte value(LSB): ", MK_COLOR_A(0xA0, 0xA0, 0xFF, 0xFF), 0, 1); DrawTextTrans(pixels + cpplen, surface->pitchinpix << 2, rect->w, (UTF8*)cpstr , MK_COLOR_A(0xFF, 0xFF, 0xFF, 0xFF), 0, 1); pixels += 10 * pitch32; tmpval = zebytes[0] | (zebytes[1] << 8) | (zebytes[2] << 16) | (zebytes[3] << 24); trio_snprintf(cpstr, 32, "%08x(%u, %d)", tmpval, (uint32)tmpval, (int32)tmpval); cpplen = DrawTextTrans(pixels, surface->pitchinpix << 2, rect->w, (UTF8*)"4-byte value(LSB): ", MK_COLOR_A(0xA0, 0xA0, 0xFF, 0xFF), 0, 1); DrawTextTrans(pixels + cpplen, surface->pitchinpix << 2, rect->w, (UTF8*)cpstr , MK_COLOR_A(0xFF, 0xFF, 0xFF, 0xFF), 0, 1); pixels += 10 * pitch32; tmpval = zebytes[1] | (zebytes[0] << 8); trio_snprintf(cpstr, 32, "%04x(%u, %d)", tmpval, (uint16)tmpval, (int16)tmpval); cpplen = DrawTextTrans(pixels, surface->pitchinpix << 2, rect->w, (UTF8*)"2-byte value(MSB): ", MK_COLOR_A(0xA0, 0xA0, 0xFF, 0xFF), 0, 1); DrawTextTrans(pixels + cpplen, surface->pitchinpix << 2, rect->w, (UTF8*)cpstr , MK_COLOR_A(0xFF, 0xFF, 0xFF, 0xFF), 0, 1); pixels += 10 * pitch32; tmpval = zebytes[3] | (zebytes[2] << 8) | (zebytes[1] << 16) | (zebytes[0] << 24); trio_snprintf(cpstr, 32, "%08x(%u, %d)", tmpval, (uint32)tmpval, (int32)tmpval); cpplen = DrawTextTrans(pixels, surface->pitchinpix << 2, rect->w, (UTF8*)"4-byte value(MSB): ", MK_COLOR_A(0xA0, 0xA0, 0xFF, 0xFF), 0, 1); DrawTextTrans(pixels + cpplen, surface->pitchinpix << 2, rect->w, (UTF8*)cpstr , MK_COLOR_A(0xFF, 0xFF, 0xFF, 0xFF), 0, 1); trio_snprintf(cpstr, 32, "%s text: ", GameCode); cpplen = DrawTextTrans(pixels + 10 * pitch32, surface->pitchinpix << 2, rect->w, (UTF8*)cpstr, MK_COLOR_A(0xA0, 0xA0, 0xFF, 0xFF), 0, MDFN_FONT_5x7); { char rawbuf[64]; char textbuf[256]; ASpace->GetAddressSpaceBytes(ASpace->name, curpos, 64, (uint8*)rawbuf); size_t ibl, obl, obl_start; char *inbuf, *outbuf; ibl = 64; obl_start = obl = 255; // Hehe, ugly maximum estimation! inbuf = rawbuf; outbuf = textbuf; iconv(ict_to_utf8, (ICONV_CONST char **)&inbuf, &ibl, &outbuf, &obl); textbuf[obl_start - obl] = 0; DrawTextTrans(pixels + 8 * pitch32 + cpplen, surface->pitchinpix << 2, rect->w - cpplen - 13, (UTF8*)textbuf, MK_COLOR_A(0xFF, 0xFF, 0xFF, 0xFF), 0, MDFN_FONT_9x18_18x18); } } } LockGameMutex(0); if(InPrompt) myprompt->Draw(surface, rect); else if(myprompt) { delete myprompt; myprompt = NULL; } if(error_string) { if(SDL_GetTicks() >= (error_time + 4000)) { free(error_string); error_string = NULL; } else { DrawTextTrans((uint32*)surface->pixels + (rect->h - 7) * pitch32, surface->pitchinpix << 2, rect->w, (UTF8*)error_string, MK_COLOR_A(0xFF, 0x00, 0x00, 0xFF), 1, 1); } } }