void CheatIF_MT_Draw(MDFN_Surface *surface, const MDFN_Rect *src_rect) { if(!isactive) return; if(src_rect->w < 342 || src_rect->h < 342) CheatConsole.SetFont(MDFN_FONT_5x7); else if(src_rect->w < 512 || src_rect->h < 480) CheatConsole.SetFont(MDFN_FONT_6x13_12x13); else CheatConsole.SetFont(MDFN_FONT_9x18_18x18); CheatConsole.Draw(surface, src_rect); }
static void CHEAT_gets(char *s, int size) { char* lpt = NULL; // // // MDFND_LockMutex(CheatMutex); while(!pending_text && !need_thread_exit) { MDFND_WaitCond(CheatCond, CheatMutex); } lpt = pending_text; pending_text = NULL; MDFND_UnlockMutex(CheatMutex); // // // if(lpt) { strncpy(s, lpt, size - 1); s[size - 1] = 0; free(lpt); CheatConsole.AppendLastLine(s); } if(need_thread_exit) { puts("WHEEE"); throw(0); // Sloppy laziness, but it works! SWEAT PANTS OF PRAGMATISM. } }
static void CHEAT_printf(const char *format, ...) { char temp[2048]; va_list ap; va_start(ap, format); trio_vsnprintf(temp, 2048, format, ap); va_end(ap); CheatConsole.WriteLine(temp); }
static void CHEAT_gets(char *s, int size) { SDL_mutexP(CheatMutex); while(!pending_text) { SDL_mutexV(CheatMutex); SDL_Delay(5); SDL_mutexP(CheatMutex); } strncpy(s, pending_text, size - 1); s[size - 1] = 0; free(pending_text); pending_text = NULL; CheatConsole.AppendLastLine((UTF8*)s); SDL_mutexV(CheatMutex); }
static void CHEAT_puts(const char *string) { CheatConsole.WriteLine(string); }
int CheatIF_MT_EventHook(const SDL_Event *event) { if(!isactive) return(1); return(CheatConsole.Event(event)); }
void DrawCheatConsole(SDL_Surface *surface, const SDL_Rect *src_rect) { if(!isactive) return; CheatConsole.Draw(surface, src_rect); }