Macro for native console window

This commit is contained in:
Federico Cecchetto 2022-02-26 21:42:44 +01:00
parent 70d2f1fa2f
commit 7cd2cfe8f3
2 changed files with 19 additions and 14 deletions

View File

@ -30,7 +30,9 @@ namespace console
if (process == GetCurrentProcessId() || IsDebuggerPresent())
{
#ifndef NATIVE_CONSOLE
ShowWindow(con_window, SW_HIDE);
#endif
}
}
@ -66,12 +68,14 @@ namespace console
{
hide_console();
#ifdef NATIVE_CONSOLE
setvbuf(stdout, nullptr, _IONBF, 0);
setvbuf(stderr, nullptr, _IONBF, 0);
#else
(void)_pipe(this->handles_, 1024, _O_TEXT);
(void)_dup2(this->handles_[1], 1);
(void)_dup2(this->handles_[1], 2);
//setvbuf(stdout, nullptr, _IONBF, 0);
//setvbuf(stderr, nullptr, _IONBF, 0);
#endif
}
void post_start() override
@ -133,7 +137,9 @@ namespace console
{
if (game::environment::is_dedi() || !utils::flags::has_flag("noconsole"))
{
#ifndef NATIVE_CONSOLE
game::Sys_ShowConsole();
#endif
}
if (!game::environment::is_dedi())

View File

@ -166,7 +166,6 @@ namespace game
* Variables
**************************************************************/
WEAK symbol<CmdArgs> sv_cmd_args{0, 0x14946BA20};
WEAK symbol<const char*> command_whitelist{0x141079A60, 0x14120C360};