108
#define MK_COLOR_A(r,g,b,a) ( ((a)<<surface->format->Ashift) | ((r)<<surface->format->Rshift) | ((g) << surface->format->Gshift) | ((b) << surface->format->Bshift))
108
#define MK_COLOR_A(r,g,b,a) ( pf_cache.MakeColor(r, g, b, a) )
110
110
// Call this function from the main thread
111
void LogDebugger_Draw(SDL_Surface *surface, const SDL_Rect *rect, const SDL_Rect *screen_rect)
111
void LogDebugger_Draw(MDFN_Surface *surface, const MDFN_Rect *rect, const MDFN_Rect *screen_rect)
113
113
if(!IsActive) return;
115
115
LockGameMutex(1);
117
uint32 * pixels = (uint32 *)surface->pixels;
118
uint32 pitch32 = surface->pitch >> 2;
117
const MDFN_PixelFormat pf_cache = surface->format;
118
uint32 * pixels = surface->pixels;
119
uint32 pitch32 = surface->pitchinpix;
119
120
char logmessage[256];
121
122
trio_snprintf(logmessage, 256, "%s (%d messages)", LoggingActive ? (UTF8*)"Logging Enabled" : (UTF8*)"Logging Disabled", (int)WhichLog->entries.size());
122
DrawTextTrans(pixels, surface->pitch, rect->w, (UTF8*)logmessage, MK_COLOR_A(0x20, 0xFF, 0x20, 0xFF), 1, MDFN_FONT_6x13_12x13);
123
DrawTextTrans(pixels, surface->pitchinpix << 2, rect->w, (UTF8*)logmessage, MK_COLOR_A(0x20, 0xFF, 0x20, 0xFF), 1, MDFN_FONT_6x13_12x13);
123
124
pixels += 13 * pitch32;
125
126
std::map<std::string, LogInstance>::iterator dl_iter;
135
136
if(&dl_iter->second == WhichLog)
136
137
group_color = MK_COLOR_A(0xFF, 0x80, 0x80, 0xFF);
138
groups_line += 6 + DrawTextTrans(groups_line, surface->pitch, rect->w, (UTF8*)group_string, group_color, 0, MDFN_FONT_6x13_12x13);
139
groups_line += 6 + DrawTextTrans(groups_line, surface->pitchinpix << 2, rect->w, (UTF8*)group_string, group_color, 0, MDFN_FONT_6x13_12x13);
140
141
// printf("%s\n", dl_iter->first.c_str());
155
156
trio_snprintf(tmpbuf, 64, "%d", i);
156
typelen = DrawTextTrans(pixels, surface->pitch, rect->w, (UTF8*)tmpbuf, MK_COLOR_A(0x80, 0x80, 0xD0, 0xFF), FALSE, MDFN_FONT_5x7);
157
typelen = DrawTextTrans(pixels, surface->pitchinpix << 2, rect->w, (UTF8*)tmpbuf, MK_COLOR_A(0x80, 0x80, 0xD0, 0xFF), FALSE, MDFN_FONT_5x7);
159
typelen += DrawTextTrans(pixels + typelen, surface->pitch, rect->w - typelen, (UTF8*)WhichLog->entries[i].type, MK_COLOR_A(0xFF, 0x40, 0x40, 0xFF), FALSE, MDFN_FONT_6x13_12x13);
160
typelen += DrawTextTrans(pixels + typelen, surface->pitchinpix << 2, rect->w - typelen, (UTF8*)WhichLog->entries[i].type, MK_COLOR_A(0xFF, 0x40, 0x40, 0xFF), FALSE, MDFN_FONT_6x13_12x13);
161
DrawTextTrans(pixels + typelen, surface->pitch, rect->w - typelen, (UTF8*)WhichLog->entries[i].text, lifecolors[i & 3], FALSE, MDFN_FONT_6x13_12x13);
162
DrawTextTrans(pixels + typelen, surface->pitchinpix << 2, rect->w - typelen, (UTF8*)WhichLog->entries[i].text, lifecolors[i & 3], FALSE, MDFN_FONT_6x13_12x13);
162
163
pixels += pitch32 * 13;
164
165
LockGameMutex(0);