mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 21:21:04 +00:00
- changed I_PrintStr so that it doesn't add everything to the RichEdit control right away.
The RichEdit control can become quite slow with large amounts of text being added constantly. Since anything that gets added while the game is running can't be seen anyway unless a fatal error is produced, it buffers the text locally now, without any processing, and only adds it to the RichEdit control in case a fatal error causes the control to be displayed again.
This commit is contained in:
parent
1e4bec25c5
commit
c677dd37f5
2 changed files with 32 additions and 3 deletions
|
@ -106,6 +106,7 @@ LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
|
|||
void CreateCrashLog (char *custominfo, DWORD customsize, HWND richedit);
|
||||
void DisplayCrashLog ();
|
||||
extern BYTE *ST_Util_BitsForBitmap (BITMAPINFO *bitmap_info);
|
||||
void I_FlushBufferedConsoleStuff();
|
||||
|
||||
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
||||
|
||||
|
@ -128,6 +129,7 @@ HANDLE MainThread;
|
|||
DWORD MainThreadID;
|
||||
HANDLE StdOut;
|
||||
bool FancyStdOut, AttachedStdOut;
|
||||
bool ConWindowHidden;
|
||||
|
||||
// The main window
|
||||
HWND Window;
|
||||
|
@ -644,6 +646,7 @@ void I_SetWndProc()
|
|||
SetWindowLongPtr (Window, GWLP_USERDATA, 1);
|
||||
SetWindowLongPtr (Window, GWLP_WNDPROC, (WLONG_PTR)WndProc);
|
||||
ShowWindow (ConWindow, SW_HIDE);
|
||||
ConWindowHidden = true;
|
||||
ShowWindow (GameTitleWindow, SW_HIDE);
|
||||
I_InitInput (Window);
|
||||
}
|
||||
|
@ -675,8 +678,10 @@ void RestoreConView()
|
|||
|
||||
SetWindowLongPtr (Window, GWLP_WNDPROC, (WLONG_PTR)LConProc);
|
||||
ShowWindow (ConWindow, SW_SHOW);
|
||||
ConWindowHidden = false;
|
||||
ShowWindow (GameTitleWindow, SW_SHOW);
|
||||
I_ShutdownInput (); // Make sure the mouse pointer is available.
|
||||
I_FlushBufferedConsoleStuff();
|
||||
// Make sure the progress bar isn't visible.
|
||||
if (StartScreen != NULL)
|
||||
{
|
||||
|
|
|
@ -132,6 +132,7 @@ extern bool FancyStdOut;
|
|||
extern HINSTANCE g_hInst;
|
||||
extern FILE *Logfile;
|
||||
extern bool NativeMouse;
|
||||
extern bool ConWindowHidden;
|
||||
|
||||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
||||
|
||||
|
@ -912,12 +913,11 @@ void ToEditControl(HWND edit, const char *buf, wchar_t *wbuf, int bpos)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void I_PrintStr(const char *cp)
|
||||
static void DoPrintStr(const char *cp, HWND edit, HANDLE StdOut)
|
||||
{
|
||||
if (ConWindow == NULL && StdOut == NULL)
|
||||
if (edit == NULL && StdOut == NULL)
|
||||
return;
|
||||
|
||||
HWND edit = ConWindow;
|
||||
char buf[256];
|
||||
wchar_t wbuf[countof(buf)];
|
||||
int bpos = 0;
|
||||
|
@ -1049,6 +1049,30 @@ void I_PrintStr(const char *cp)
|
|||
}
|
||||
}
|
||||
|
||||
static TArray<FString> bufferedConsoleStuff;
|
||||
|
||||
void I_PrintStr(const char *cp)
|
||||
{
|
||||
if (ConWindowHidden)
|
||||
{
|
||||
bufferedConsoleStuff.Push(cp);
|
||||
DoPrintStr(cp, NULL, StdOut);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoPrintStr(cp, ConWindow, StdOut);
|
||||
}
|
||||
}
|
||||
|
||||
void I_FlushBufferedConsoleStuff()
|
||||
{
|
||||
for (unsigned i = 0; i < bufferedConsoleStuff.Size(); i++)
|
||||
{
|
||||
DoPrintStr(bufferedConsoleStuff[i], ConWindow, NULL);
|
||||
}
|
||||
bufferedConsoleStuff.Clear();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// SetQueryIWAD
|
||||
|
|
Loading…
Reference in a new issue