void Netplay_GT_CheckPendingLine(void) { size_t c = LineFIFO.CanRead(); while(c--) { char* str = LineFIFO.Read(); bool inputable_tmp = false, viewable_tmp = false; MDFNI_NetplayLine(str, inputable_tmp, viewable_tmp); free(str); SendCEvent(CEVT_NP_LINE_RESPONSE, (void*)inputable_tmp, (void*)viewable_tmp); } }
// Called from the game thread void MDFND_NetplayText(const uint8 *text, bool NetEcho) { uint8 *tot = (uint8 *)strdup((char *)text); uint8 *tmp; tmp = tot; while(*tmp) { if((uint8)*tmp < 0x20) *tmp = ' '; tmp++; } SendCEvent(CEVT_NP_DISPLAY_TEXT, tot, (void*)NetEcho); }
// Called from the game thread void Mednafen::MDFND_NetplayText(const char* text, bool NetEcho) { char *tot = strdup(text); char *tmp; tmp = tot; while(*tmp) { if((uint8)*tmp < 0x20) *tmp = ' '; tmp++; } SendCEvent(CEVT_NP_DISPLAY_TEXT, tot, (void*)NetEcho); }
// Called from game thread int NetplayEventHook_GT(const SDL_Event *event) { if(event->type == SDL_USEREVENT) { switch(event->user.code) { case CEVT_NP_LINE: { bool inputable_tmp = false, viewable_tmp = false; MDFNI_NetplayLine((const char*)event->user.data1, inputable_tmp, viewable_tmp); free(event->user.data1); SendCEvent(CEVT_NP_LINE_RESPONSE, (void*)inputable_tmp, (void*)viewable_tmp); } break; } } return(1); }
// Called from the game thread void Netplay_ToggleTextView(void) { SendCEvent(CEVT_NP_TOGGLE_TT, NULL, NULL); }
// Called from main thread bool NetplayConsole::TextHook(UTF8 *text) { LastTextTime = SDL_GetTicks(); SendCEvent(CEVT_NP_LINE, text, NULL); return(1); }