use userraw instead of main

This commit is contained in:
Diavolo 2022-08-07 12:02:26 +02:00
parent b706e21381
commit b18445d2e8
No known key found for this signature in database
GPG Key ID: FA77F074E98D98A5
4 changed files with 8 additions and 6 deletions

View File

@ -91,7 +91,7 @@ private:
static void log_message(const std::string& message) static void log_message(const std::string& message)
{ {
OutputDebugStringA(message.data()); OutputDebugStringA(message.data());
log_file::info("%s", message.data()); log_file::com_log_print_message(message);
game::native::Conbuf_AppendText(message.data()); game::native::Conbuf_AppendText(message.data());
} }

View File

@ -268,6 +268,9 @@ void file_system::post_load()
// Make open-iw5 work outside of the game directory // Make open-iw5 work outside of the game directory
sys_default_install_path_hook.create(SELECT_VALUE(0x487E50, 0x5C4A80, 0x535F80), &sys_default_install_path_stub); sys_default_install_path_hook.create(SELECT_VALUE(0x487E50, 0x5C4A80, 0x535F80), &sys_default_install_path_stub);
// fs_basegame
utils::hook::set<const char*>(SELECT_VALUE(0x629031, 0x5B0FD1, 0x526F5C), "userraw");
} }
REGISTER_MODULE(file_system) REGISTER_MODULE(file_system)

View File

@ -36,7 +36,7 @@ void log_file::com_open_log_file()
} }
} }
void log_file::com_log_print_message(const char* msg) void log_file::com_log_print_message(const std::string& msg)
{ {
char print_buffer[0x40]{}; char print_buffer[0x40]{};
@ -61,8 +61,8 @@ void log_file::com_log_print_message(const char* msg)
file_system::write(print_buffer, len, *game::native::logfile); file_system::write(print_buffer, len, *game::native::logfile);
} }
log_next_time_stamp = std::strchr(msg, 10) != nullptr; log_next_time_stamp = (msg.find('\n') != std::string::npos);
file_system::write(msg, static_cast<int>(std::strlen(msg)), *game::native::logfile); file_system::write(msg.data(), static_cast<int>(msg.size()), *game::native::logfile);
} }
} }

View File

@ -5,6 +5,7 @@ class log_file final : public module
public: public:
void post_load() override; void post_load() override;
static void com_log_print_message(const std::string& msg);
static void info(const char* fmt, ...); static void info(const char* fmt, ...);
private: private:
@ -16,6 +17,4 @@ private:
static const game::native::dvar_t* com_logfile; static const game::native::dvar_t* com_logfile;
static void com_open_log_file(); static void com_open_log_file();
static void com_log_print_message(const char* msg);
}; };