cls.capturevideo.videoframes(newframestepframenum - cls.capturevideo.framestepframe);
cls.capturevideo.framestepframe = newframestepframenum;
- if(cl_capturevideo_printfps.integer)
+ if(cl_capturevideo_printfps.integer && host.realtime > cls.capturevideo.lastfpstime + 1)
{
- char buf[80];
- double t = host.realtime;
- if(t > cls.capturevideo.lastfpstime + 1)
- {
- double fps1 = (cls.capturevideo.frame - cls.capturevideo.lastfpsframe) / (t - cls.capturevideo.lastfpstime + 0.0000001);
- double fps = (cls.capturevideo.frame ) / (t - cls.capturevideo.starttime + 0.0000001);
- dpsnprintf(buf, sizeof(buf), "capturevideo: (%.1fs) last second %.3ffps, total %.3ffps\n", cls.capturevideo.frame / cls.capturevideo.framerate, fps1, fps);
- Sys_Print(buf);
- cls.capturevideo.lastfpstime = t;
- cls.capturevideo.lastfpsframe = cls.capturevideo.frame;
- }
+ double fps1 = (cls.capturevideo.frame - cls.capturevideo.lastfpsframe) / (host.realtime - cls.capturevideo.lastfpstime + 0.0000001);
+ double fps = (cls.capturevideo.frame ) / (host.realtime - cls.capturevideo.starttime + 0.0000001);
+ Sys_Printf("capturevideo: (%.1fs) last second %.3ffps, total %.3ffps\n", cls.capturevideo.frame / cls.capturevideo.framerate, fps1, fps);
+ cls.capturevideo.lastfpstime = host.realtime;
+ cls.capturevideo.lastfpsframe = cls.capturevideo.frame;
}
}
*out++ = '[';
*out++ = 'm';
}
- *out++ = 0;
- Sys_Print(printline);
+ *out = '\0';
+ Sys_Print(printline, out - printline);
}
else if(sys_colortranslation.integer == 2) // Quake
{
- Sys_Print(line);
+ Sys_Print(line, index);
}
else // strip
{
break;
}
}
- *out++ = 0;
- Sys_Print(printline);
+ *out = '\0';
+ Sys_Print(printline, out - printline);
}
}
// empty the line buffer
void Con_DrawConsole (int lines);
/// Prints to a chosen console target
-void Con_MaskPrint(int mask, const char *msg);
+void Con_MaskPrint(int additionalmask, const char *msg);
// Prints to a chosen console target
void Con_MaskPrintf(int mask, const char *fmt, ...) DP_FUNC_PRINTF(2);
void Sys_Error (const char *error, ...) DP_FUNC_PRINTF(1) DP_FUNC_NORETURN;
/// (may) output text to terminal which launched program
-void Sys_Print(const char *text);
-/// for the console to report failures inside Con_Printf()
+/// textlen excludes any (optional) \0 terminator
+void Sys_Print(const char *text, size_t textlen);
+/// used to report failures inside Con_Printf()
void Sys_Printf(const char *fmt, ...);
/// INFO: This is only called by Host_Shutdown so we dont need testing for recursion
===============================================================================
*/
-void Sys_Print(const char *text)
+void Sys_Print(const char *text, size_t textlen)
{
#ifdef __ANDROID__
if (developer.integer > 0)
#endif
while(*text)
{
- fs_offset_t written = (fs_offset_t)write(sys.outfd, text, (int)strlen(text));
+ fs_offset_t written = (fs_offset_t)write(sys.outfd, text, textlen);
if(written <= 0)
break; // sorry, I cannot do anything about this error - without an output
text += written;
#endif
}
-/// for the console to report failures inside Con_Printf()
void Sys_Printf(const char *fmt, ...)
{
va_list argptr;
char msg[MAX_INPUTLINE];
+ int msglen;
va_start(argptr,fmt);
- dpvsnprintf(msg,sizeof(msg),fmt,argptr);
+ msglen = dpvsnprintf(msg, sizeof(msg), fmt, argptr);
va_end(argptr);
- Sys_Print(msg);
+ if (msglen >= 0)
+ Sys_Print(msg, msglen);
}
/// Reads a line from POSIX stdin or the Windows console