mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
disabled quick edit mode for the console on windows on default
This commit is contained in:
parent
7bb1fa8a19
commit
1a883a4b70
|
@ -242,6 +242,24 @@ void dbg_logger_file(const char *filename)
|
|||
dbg_msg("dbg/logger", "failed to open '%s' for logging", filename);
|
||||
|
||||
}
|
||||
|
||||
#if defined(CONF_FAMILY_WINDOWS)
|
||||
static DWORD old_console_mode;
|
||||
|
||||
void dbg_console_init()
|
||||
{
|
||||
HANDLE handle;
|
||||
|
||||
handle = GetStdHandle(STD_INPUT_HANDLE);
|
||||
GetConsoleMode(handle, &old_console_mode);
|
||||
old_console_mode &= ~ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS;
|
||||
SetConsoleMode(handle, old_console_mode);
|
||||
}
|
||||
void dbg_console_cleanup()
|
||||
{
|
||||
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), old_console_mode);
|
||||
}
|
||||
#endif
|
||||
/* */
|
||||
|
||||
typedef struct MEMHEADER
|
||||
|
|
|
@ -1249,6 +1249,11 @@ void dbg_logger_stdout();
|
|||
void dbg_logger_debugger();
|
||||
void dbg_logger_file(const char *filename);
|
||||
|
||||
#if defined(CONF_FAMILY_WINDOWS)
|
||||
void dbg_console_init();
|
||||
void dbg_console_cleanup();
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int sent_packets;
|
||||
|
|
|
@ -2449,8 +2449,13 @@ int main(int argc, const char **argv) // ignore_convention
|
|||
#else
|
||||
bool HideConsole = false;
|
||||
#endif
|
||||
bool QuickEditMode = false;
|
||||
for(int i = 1; i < argc; i++) // ignore_convention
|
||||
{
|
||||
if(str_comp("--quickeditmode", argv[i]) == 0) // ignore_convention
|
||||
{
|
||||
QuickEditMode = true;
|
||||
}
|
||||
if(str_comp("-c", argv[i]) == 0 || str_comp("--console", argv[i]) == 0) // ignore_convention
|
||||
{
|
||||
HideConsole = false;
|
||||
|
@ -2465,6 +2470,8 @@ int main(int argc, const char **argv) // ignore_convention
|
|||
|
||||
if(HideConsole)
|
||||
FreeConsole();
|
||||
else if(!QuickEditMode)
|
||||
dbg_console_init();
|
||||
#endif
|
||||
|
||||
bool UseDefaultConfig = false;
|
||||
|
@ -2579,6 +2586,10 @@ int main(int argc, const char **argv) // ignore_convention
|
|||
// write down the config and quit
|
||||
pConfig->Save();
|
||||
|
||||
#if defined(CONF_FAMILY_WINDOWS)
|
||||
if(!HideConsole && !QuickEditMode)
|
||||
dbg_console_cleanup();
|
||||
#endif
|
||||
// free components
|
||||
mem_free(pClient);
|
||||
delete pKernel;
|
||||
|
|
Loading…
Reference in a new issue