Dedi progress
This commit is contained in:
parent
fb2efeb089
commit
34d5a880e0
@ -21,6 +21,12 @@ namespace console
|
|||||||
using message_queue = std::queue<std::string>;
|
using message_queue = std::queue<std::string>;
|
||||||
utils::concurrency::container<message_queue> messages;
|
utils::concurrency::container<message_queue> messages;
|
||||||
|
|
||||||
|
bool native_console()
|
||||||
|
{
|
||||||
|
static const auto flag = utils::flags::has_flag("nativeconsole");
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
void hide_console()
|
void hide_console()
|
||||||
{
|
{
|
||||||
auto* const con_window = GetConsoleWindow();
|
auto* const con_window = GetConsoleWindow();
|
||||||
@ -28,11 +34,9 @@ namespace console
|
|||||||
DWORD process;
|
DWORD process;
|
||||||
GetWindowThreadProcessId(con_window, &process);
|
GetWindowThreadProcessId(con_window, &process);
|
||||||
|
|
||||||
if (process == GetCurrentProcessId() || IsDebuggerPresent())
|
if (!native_console() && (process == GetCurrentProcessId() || IsDebuggerPresent()))
|
||||||
{
|
{
|
||||||
#ifndef NATIVE_CONSOLE
|
|
||||||
ShowWindow(con_window, SW_HIDE);
|
ShowWindow(con_window, SW_HIDE);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,6 +52,12 @@ namespace console
|
|||||||
|
|
||||||
void dispatch_message(const int type, const std::string& message)
|
void dispatch_message(const int type, const std::string& message)
|
||||||
{
|
{
|
||||||
|
if (native_console())
|
||||||
|
{
|
||||||
|
printf("%s\n", message.data());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
game_console::print(type, message);
|
game_console::print(type, message);
|
||||||
messages.access([&message](message_queue& msgs)
|
messages.access([&message](message_queue& msgs)
|
||||||
{
|
{
|
||||||
@ -68,14 +78,17 @@ namespace console
|
|||||||
{
|
{
|
||||||
hide_console();
|
hide_console();
|
||||||
|
|
||||||
#ifdef NATIVE_CONSOLE
|
if (native_console())
|
||||||
setvbuf(stdout, nullptr, _IONBF, 0);
|
{
|
||||||
setvbuf(stderr, nullptr, _IONBF, 0);
|
setvbuf(stdout, nullptr, _IONBF, 0);
|
||||||
#else
|
setvbuf(stderr, nullptr, _IONBF, 0);
|
||||||
(void)_pipe(this->handles_, 1024, _O_TEXT);
|
}
|
||||||
(void)_dup2(this->handles_[1], 1);
|
else
|
||||||
(void)_dup2(this->handles_[1], 2);
|
{
|
||||||
#endif
|
(void)_pipe(this->handles_, 1024, _O_TEXT);
|
||||||
|
(void)_dup2(this->handles_[1], 1);
|
||||||
|
(void)_dup2(this->handles_[1], 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void post_start() override
|
void post_start() override
|
||||||
@ -84,7 +97,14 @@ namespace console
|
|||||||
|
|
||||||
this->console_runner_ = utils::thread::create_named_thread("Console IO", [this]
|
this->console_runner_ = utils::thread::create_named_thread("Console IO", [this]
|
||||||
{
|
{
|
||||||
this->runner();
|
if (native_console())
|
||||||
|
{
|
||||||
|
this->native_input();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->runner();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,11 +155,9 @@ namespace console
|
|||||||
{
|
{
|
||||||
this->console_thread_ = utils::thread::create_named_thread("Console", [this]()
|
this->console_thread_ = utils::thread::create_named_thread("Console", [this]()
|
||||||
{
|
{
|
||||||
if (game::environment::is_dedi() || !utils::flags::has_flag("noconsole"))
|
if (!native_console() && (game::environment::is_dedi() || !utils::flags::has_flag("noconsole")))
|
||||||
{
|
{
|
||||||
#ifndef NATIVE_CONSOLE
|
|
||||||
game::Sys_ShowConsole();
|
game::Sys_ShowConsole();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!game::environment::is_dedi())
|
if (!game::environment::is_dedi())
|
||||||
@ -229,6 +247,19 @@ namespace console
|
|||||||
|
|
||||||
std::this_thread::yield();
|
std::this_thread::yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void native_input()
|
||||||
|
{
|
||||||
|
std::string cmd;
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
std::getline(std::cin, cmd);
|
||||||
|
command::execute(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::this_thread::yield();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
HWND get_window()
|
HWND get_window()
|
||||||
|
@ -226,13 +226,12 @@ namespace dedicated
|
|||||||
utils::hook::set<uint8_t>(0x140620D10, 0xC3); // render thread
|
utils::hook::set<uint8_t>(0x140620D10, 0xC3); // render thread
|
||||||
utils::hook::set<uint8_t>(0x14025B850, 0xC3); // called from Com_Frame, seems to do renderer stuff
|
utils::hook::set<uint8_t>(0x14025B850, 0xC3); // called from Com_Frame, seems to do renderer stuff
|
||||||
utils::hook::set<uint8_t>(0x1402507B0, 0xC3); // CL_CheckForResend, which tries to connect to the local server constantly
|
utils::hook::set<uint8_t>(0x1402507B0, 0xC3); // CL_CheckForResend, which tries to connect to the local server constantly
|
||||||
utils::hook::set<uint8_t>(0x1405D5176, 0); // r_loadForRenderer default to 0
|
utils::hook::set<uint8_t>(0x1405D5178, 0x00); // r_loadForRenderer default to 0
|
||||||
utils::hook::set<uint8_t>(0x14050C2D0, 0xC3); // recommended settings check - TODO: Check hook
|
utils::hook::set<uint8_t>(0x14050C2D0, 0xC3); // recommended settings check - TODO: Check hook
|
||||||
utils::hook::set<uint8_t>(0x140514C00, 0xC3); // some mixer-related function called on shutdown
|
utils::hook::set<uint8_t>(0x140514C00, 0xC3); // some mixer-related function called on shutdown
|
||||||
utils::hook::set<uint8_t>(0x140409830, 0xC3); // dont load ui gametype stuff
|
utils::hook::set<uint8_t>(0x140409830, 0xC3); // dont load ui gametype stuff
|
||||||
|
|
||||||
// (COULD NOT FIND IN H1)
|
utils::hook::nop(0x140481B06, 6); // unknown check in SV_ExecuteClientMessage
|
||||||
// utils::hook::nop(0x14043ABB8, 6); // unknown check in SV_ExecuteClientMessage // ??
|
|
||||||
utils::hook::nop(0x140480FAC, 4); // allow first slot to be occupied
|
utils::hook::nop(0x140480FAC, 4); // allow first slot to be occupied
|
||||||
utils::hook::nop(0x14025619B, 2); // properly shut down dedicated servers
|
utils::hook::nop(0x14025619B, 2); // properly shut down dedicated servers
|
||||||
utils::hook::nop(0x14025615E, 2); // ^
|
utils::hook::nop(0x14025615E, 2); // ^
|
||||||
@ -273,22 +272,24 @@ namespace dedicated
|
|||||||
utils::hook::set<uint8_t>(0x1405E0C00, 0xC3); // ^
|
utils::hook::set<uint8_t>(0x1405E0C00, 0xC3); // ^
|
||||||
utils::hook::set<uint8_t>(0x1405DFE50, 0xC3); // ^
|
utils::hook::set<uint8_t>(0x1405DFE50, 0xC3); // ^
|
||||||
|
|
||||||
utils::hook::set<uint8_t>(0x1404B67E0, 0xC3); // sound crashes (H1 - questionable, function looks way different)
|
// utils::hook::set<uint8_t>(0x1404B67E0, 0xC3); // sound crashes (H1 - questionable, function looks way different)
|
||||||
|
|
||||||
utils::hook::set<uint8_t>(0x14048B660, 0xC3); // disable host migration
|
utils::hook::set<uint8_t>(0x14048B660, 0xC3); // disable host migration
|
||||||
|
|
||||||
utils::hook::set<uint8_t>(0x14042B2E0, 0xC3); // render synchronization lock
|
utils::hook::set<uint8_t>(0x14042B2E0, 0xC3); // render synchronization lock
|
||||||
utils::hook::set<uint8_t>(0x14042B210, 0xC3); // render synchronization unlock
|
utils::hook::set<uint8_t>(0x14042B210, 0xC3); // render synchronization unlock
|
||||||
|
|
||||||
utils::hook::set<uint8_t>(0x140176D2D, 0xEB);
|
utils::hook::set<uint8_t>(0x140176D2D, 0xEB); // LUI: Unable to start the LUI system due to errors in main.lua
|
||||||
// LUI: Unable to start the LUI system due to errors in main.lua
|
|
||||||
|
|
||||||
utils::hook::nop(0x140506ECE, 5); // Disable sound pak file loading
|
utils::hook::nop(0x140506ECE, 5); // Disable sound pak file loading
|
||||||
utils::hook::nop(0x140506ED6, 2); // ^
|
utils::hook::nop(0x140506ED6, 2); // ^
|
||||||
utils::hook::set<uint8_t>(0x1402C5910, 0xC3); // Disable image pak file loading
|
utils::hook::set<uint8_t>(0x1402C5910, 0xC3); // Disable image pak file loading
|
||||||
|
|
||||||
// Reduce min required memory
|
// Reduce min required memory
|
||||||
utils::hook::set<uint64_t>(0x14050C715, 0x80000000);
|
utils::hook::set<uint64_t>(0x14050C717, 0x80000000);
|
||||||
|
|
||||||
|
utils::hook::set(0x1402BF7F0, 0xC3); // some loop
|
||||||
|
utils::hook::set(0x14007E150, 0xC3); // related to shader caching / techsets / fastfiles
|
||||||
|
|
||||||
// initialize the game after onlinedataflags is 32 (workaround)
|
// initialize the game after onlinedataflags is 32 (workaround)
|
||||||
scheduler::schedule([=]()
|
scheduler::schedule([=]()
|
||||||
@ -315,7 +316,7 @@ namespace dedicated
|
|||||||
console::info("==================================\n");
|
console::info("==================================\n");
|
||||||
|
|
||||||
// remove disconnect command
|
// remove disconnect command
|
||||||
game::Cmd_RemoveCommand(reinterpret_cast<const char*>(751));
|
game::Cmd_RemoveCommand("disconnect");
|
||||||
|
|
||||||
execute_startup_command_queue();
|
execute_startup_command_queue();
|
||||||
execute_console_command_queue();
|
execute_console_command_queue();
|
||||||
|
@ -14,7 +14,7 @@ namespace game
|
|||||||
WEAK symbol<void(const char* message)> Conbuf_AppendText{0x1403E3300, 0x140513FF0};
|
WEAK symbol<void(const char* message)> Conbuf_AppendText{0x1403E3300, 0x140513FF0};
|
||||||
WEAK symbol<void(int localClientNum, int controllerIndex, const char* text)> Cmd_ExecuteSingleCommand{0x140343980, 0x140403F60};
|
WEAK symbol<void(int localClientNum, int controllerIndex, const char* text)> Cmd_ExecuteSingleCommand{0x140343980, 0x140403F60};
|
||||||
WEAK symbol<void(const char* cmdName, void(), cmd_function_s* allocedCmd)> Cmd_AddCommandInternal{0x1403433E0, 0x140403950};
|
WEAK symbol<void(const char* cmdName, void(), cmd_function_s* allocedCmd)> Cmd_AddCommandInternal{0x1403433E0, 0x140403950};
|
||||||
WEAK symbol<void(const char*)> Cmd_RemoveCommand{0x140343FF0, 0x1403AFEF0};
|
WEAK symbol<void(const char*)> Cmd_RemoveCommand{0x140343FF0, 0x1404045D0};
|
||||||
WEAK symbol<void(const char* text_in)> Cmd_TokenizeString{0x140344110, 0x1404046F0};
|
WEAK symbol<void(const char* text_in)> Cmd_TokenizeString{0x140344110, 0x1404046F0};
|
||||||
WEAK symbol<void()> Cmd_EndTokenizeString{0x140343630, 0x140403C20};
|
WEAK symbol<void()> Cmd_EndTokenizeString{0x140343630, 0x140403C20};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user