rework console & logfile relationship
This commit is contained in:
parent
5671ce77f0
commit
f6321f8e54
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "console.hpp"
|
#include "console.hpp"
|
||||||
#include "scheduler.hpp"
|
#include "scheduler.hpp"
|
||||||
|
#include "log_file.hpp"
|
||||||
|
|
||||||
#include <utils/concurrency.hpp>
|
#include <utils/concurrency.hpp>
|
||||||
|
|
||||||
@ -101,6 +101,7 @@ void console::log_message(const std::string& message)
|
|||||||
|
|
||||||
void console::dispatch_message([[maybe_unused]] const int type, const std::string& message)
|
void console::dispatch_message([[maybe_unused]] const int type, const std::string& message)
|
||||||
{
|
{
|
||||||
|
log_file::info(message);
|
||||||
message_queue_.access([&message](message_queue& queue)
|
message_queue_.access([&message](message_queue& queue)
|
||||||
{
|
{
|
||||||
queue.emplace(message);
|
queue.emplace(message);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
|
|
||||||
#include "scheduler.hpp"
|
#include "scheduler.hpp"
|
||||||
#include "log_file.hpp"
|
#include "console.hpp"
|
||||||
|
|
||||||
#include <discord_rpc.h>
|
#include <discord_rpc.h>
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ private:
|
|||||||
|
|
||||||
static void errored(const int error_code, const char* message)
|
static void errored(const int error_code, const char* message)
|
||||||
{
|
{
|
||||||
log_file::info("Discord: (%i) %s", error_code, message);
|
console::error("Discord: (%i) %s", error_code, message);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
|
|
||||||
#include "command.hpp"
|
#include "command.hpp"
|
||||||
|
#include "console.hpp"
|
||||||
#include "log_file.hpp"
|
#include "log_file.hpp"
|
||||||
#include "dvar.hpp"
|
#include "dvar.hpp"
|
||||||
|
|
||||||
@ -52,68 +53,68 @@ void dvar::list_single(const game::native::dvar_t* dvar, void* user_data)
|
|||||||
|
|
||||||
if (dvar->flags & game::native::DVAR_SERVERINFO)
|
if (dvar->flags & game::native::DVAR_SERVERINFO)
|
||||||
{
|
{
|
||||||
log_file::info("S");
|
console::info("S");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log_file::info(" ");
|
console::info(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dvar->flags & game::native::DVAR_USERINFO)
|
if (dvar->flags & game::native::DVAR_USERINFO)
|
||||||
{
|
{
|
||||||
log_file::info("U");
|
console::info("U");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log_file::info(" ");
|
console::info(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dvar->flags & game::native::DVAR_ROM)
|
if (dvar->flags & game::native::DVAR_ROM)
|
||||||
{
|
{
|
||||||
log_file::info("R");
|
console::info("R");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log_file::info(" ");
|
console::info(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dvar->flags & game::native::DVAR_INIT)
|
if (dvar->flags & game::native::DVAR_INIT)
|
||||||
{
|
{
|
||||||
log_file::info("I");
|
console::info("I");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log_file::info(" ");
|
console::info(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dvar->flags & game::native::DVAR_ARCHIVE)
|
if (dvar->flags & game::native::DVAR_ARCHIVE)
|
||||||
{
|
{
|
||||||
log_file::info("A");
|
console::info("A");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log_file::info(" ");
|
console::info(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dvar->flags & game::native::DVAR_LATCH)
|
if (dvar->flags & game::native::DVAR_LATCH)
|
||||||
{
|
{
|
||||||
log_file::info("L");
|
console::info("L");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log_file::info(" ");
|
console::info(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dvar->flags & game::native::DVAR_CHEAT)
|
if (dvar->flags & game::native::DVAR_CHEAT)
|
||||||
{
|
{
|
||||||
log_file::info("C");
|
console::info("C");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log_file::info(" ");
|
console::info(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
log_file::info(" %s \"%s\"\n", dvar->name, game::native::Dvar_DisplayableValue(dvar));
|
console::info(" %s \"%s\"\n", dvar->name, game::native::Dvar_DisplayableValue(dvar));
|
||||||
}
|
}
|
||||||
|
|
||||||
void dvar::com_dvar_dump_single(const game::native::dvar_t* dvar, void* user_data)
|
void dvar::com_dvar_dump_single(const game::native::dvar_t* dvar, void* user_data)
|
||||||
@ -137,7 +138,7 @@ void dvar::com_dvar_dump_single(const game::native::dvar_t* dvar, void* user_dat
|
|||||||
sprintf_s(message, " %s \"%s\"\n", dvar->name, game::native::Dvar_DisplayableValue(dvar));
|
sprintf_s(message, " %s \"%s\"\n", dvar->name, game::native::Dvar_DisplayableValue(dvar));
|
||||||
}
|
}
|
||||||
|
|
||||||
log_file::info("%s", message);
|
console::info("%s", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dvar::com_dvar_dump(int channel, const char* match)
|
void dvar::com_dvar_dump(int channel, const char* match)
|
||||||
@ -150,14 +151,14 @@ void dvar::com_dvar_dump(int channel, const char* match)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_file::info("=============================== DVAR DUMP ========================================\n");
|
console::info("=============================== DVAR DUMP ========================================\n");
|
||||||
dump_info.count = 0;
|
dump_info.count = 0;
|
||||||
dump_info.channel = channel;
|
dump_info.channel = channel;
|
||||||
dump_info.match = match;
|
dump_info.match = match;
|
||||||
game::native::Dvar_ForEach(com_dvar_dump_single, &dump_info);
|
game::native::Dvar_ForEach(com_dvar_dump_single, &dump_info);
|
||||||
sprintf_s(summary, "\n%i total dvars\n%i dvar indexes\n", dump_info.count, *game::native::dvarCount);
|
sprintf_s(summary, "\n%i total dvars\n%i dvar indexes\n", dump_info.count, *game::native::dvarCount);
|
||||||
log_file::info("%s", summary);
|
console::info("%s", summary);
|
||||||
log_file::info("=============================== END DVAR DUMP =====================================\n");
|
console::info("=============================== END DVAR DUMP =====================================\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void dvar::dump_f(const command::params& params)
|
void dvar::dump_f(const command::params& params)
|
||||||
@ -188,7 +189,7 @@ void dvar::list_f(const command::params& params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
game::native::Dvar_ForEach(list_single, (void*)match);
|
game::native::Dvar_ForEach(list_single, (void*)match);
|
||||||
log_file::info("\n%i total dvars\n", *game::native::dvarCount);
|
console::info("\n%i total dvars\n", *game::native::dvarCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dvar::post_load()
|
void dvar::post_load()
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
#include <utils/hook.hpp>
|
#include <utils/hook.hpp>
|
||||||
|
|
||||||
#include "command.hpp"
|
#include "command.hpp"
|
||||||
|
#include "console.hpp"
|
||||||
#include "file_system.hpp"
|
#include "file_system.hpp"
|
||||||
#include "log_file.hpp"
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@ -38,7 +38,7 @@ namespace
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_file::info("Couldn't open file: %s %s\n", filename, std::strerror(errno));
|
console::error("Couldn't open file: %s %s\n", filename, std::strerror(errno));
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ namespace
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_file::info("Couldn't open file: %s %s\n", filename, std::strerror(errno));
|
console::error("Couldn't open file: %s %s\n", filename, std::strerror(errno));
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ namespace
|
|||||||
build_os_path_for_thread(basepath, game::native::fs_gamedir, filename, ospath, game::native::FS_THREAD_MAIN);
|
build_os_path_for_thread(basepath, game::native::fs_gamedir, filename, ospath, game::native::FS_THREAD_MAIN);
|
||||||
if ((*fs_debug)->current.integer)
|
if ((*fs_debug)->current.integer)
|
||||||
{
|
{
|
||||||
log_file::info("FS_FOpenFileAppend: %s\n", ospath);
|
console::info("FS_FOpenFileAppend: %s\n", ospath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (game::native::FS_CreatePath(ospath))
|
if (game::native::FS_CreatePath(ospath))
|
||||||
@ -216,7 +216,7 @@ namespace
|
|||||||
|
|
||||||
if ((*fs_debug)->current.integer)
|
if ((*fs_debug)->current.integer)
|
||||||
{
|
{
|
||||||
log_file::info("FS_FOpenFileWriteToDirForThread: %s\n", ospath);
|
console::info("FS_FOpenFileWriteToDirForThread: %s\n", ospath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (game::native::FS_CreatePath(ospath))
|
if (game::native::FS_CreatePath(ospath))
|
||||||
@ -355,13 +355,13 @@ namespace
|
|||||||
{
|
{
|
||||||
auto i_language = game::native::SEH_GetCurrentLanguage();
|
auto i_language = game::native::SEH_GetCurrentLanguage();
|
||||||
const auto* psz_language_name = game::native::SEH_GetLanguageName(i_language);
|
const auto* psz_language_name = game::native::SEH_GetLanguageName(i_language);
|
||||||
log_file::info("Current language: %s\n", psz_language_name);
|
console::info("Current language: %s\n", psz_language_name);
|
||||||
if ((*fs_ignoreLocalized)->current.enabled)
|
if ((*fs_ignoreLocalized)->current.enabled)
|
||||||
{
|
{
|
||||||
log_file::info(" localized assets are being ignored\n");
|
console::info(" localized assets are being ignored\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
log_file::info("Current search path:\n");
|
console::info("Current search path:\n");
|
||||||
for (auto* s = *game::native::fs_searchpaths; s; s = s->next)
|
for (auto* s = *game::native::fs_searchpaths; s; s = s->next)
|
||||||
{
|
{
|
||||||
if (b_language_cull && !use_search_path(s))
|
if (b_language_cull && !use_search_path(s))
|
||||||
@ -371,40 +371,40 @@ namespace
|
|||||||
|
|
||||||
if (s->iwd)
|
if (s->iwd)
|
||||||
{
|
{
|
||||||
log_file::info("%s (%i files)\n", s->iwd->iwdFilename, s->iwd->numfiles);
|
console::info("%s (%i files)\n", s->iwd->iwdFilename, s->iwd->numfiles);
|
||||||
if (s->bLocalized)
|
if (s->bLocalized)
|
||||||
{
|
{
|
||||||
log_file::info(" localized assets iwd file for %s\n", game::native::SEH_GetLanguageName(s->language));
|
console::info(" localized assets iwd file for %s\n", game::native::SEH_GetLanguageName(s->language));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*game::native::fs_numServerIwds)
|
if (*game::native::fs_numServerIwds)
|
||||||
{
|
{
|
||||||
if (iwd_is_pure(s->iwd))
|
if (iwd_is_pure(s->iwd))
|
||||||
{
|
{
|
||||||
log_file::info(" on the pure list\n");
|
console::info(" on the pure list\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log_file::info(" not on the pure list\n");
|
console::info(" not on the pure list\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log_file::info("%s/%s\n", s->dir->path, s->dir->gamedir);
|
console::info("%s/%s\n", s->dir->path, s->dir->gamedir);
|
||||||
if (s->bLocalized)
|
if (s->bLocalized)
|
||||||
{
|
{
|
||||||
log_file::info(" localized assets game folder for %s\n", game::native::SEH_GetLanguageName(s->language));
|
console::info(" localized assets game folder for %s\n", game::native::SEH_GetLanguageName(s->language));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log_file::info("\nFile Handles:\n");
|
console::info("\nFile Handles:\n");
|
||||||
for (int i = 1; i < 64; ++i)
|
for (int i = 1; i < 64; ++i)
|
||||||
{
|
{
|
||||||
if (game::native::fsh[i].handleFiles.file.o)
|
if (game::native::fsh[i].handleFiles.file.o)
|
||||||
{
|
{
|
||||||
log_file::info("handle %i: %s\n", i, game::native::fsh[i].name);
|
console::info("handle %i: %s\n", i, game::native::fsh[i].name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -434,7 +434,7 @@ namespace
|
|||||||
|
|
||||||
if (game::native::Cmd_Argc() < 2 || game::native::Cmd_Argc() > 3)
|
if (game::native::Cmd_Argc() < 2 || game::native::Cmd_Argc() > 3)
|
||||||
{
|
{
|
||||||
log_file::info("usage: dir <directory> [extension]\n");
|
console::info("usage: dir <directory> [extension]\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,14 +449,14 @@ namespace
|
|||||||
extension = game::native::Cmd_Argv(2);
|
extension = game::native::Cmd_Argv(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_file::info("Directory of %s %s\n", path, extension);
|
console::info("Directory of %s %s\n", path, extension);
|
||||||
log_file::info("---------------\n");
|
console::info("---------------\n");
|
||||||
|
|
||||||
auto** dirnames = list_files(path, extension, game::native::FS_LIST_PURE_ONLY, &ndirs, 3);
|
auto** dirnames = list_files(path, extension, game::native::FS_LIST_PURE_ONLY, &ndirs, 3);
|
||||||
|
|
||||||
for (int i = 0; i < ndirs; ++i)
|
for (int i = 0; i < ndirs; ++i)
|
||||||
{
|
{
|
||||||
log_file::info("%s\n", dirnames[i]);
|
console::info("%s\n", dirnames[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
game::native::Sys_FreeFileList(dirnames);
|
game::native::Sys_FreeFileList(dirnames);
|
||||||
@ -468,14 +468,14 @@ namespace
|
|||||||
|
|
||||||
if (game::native::Cmd_Argc() < 2)
|
if (game::native::Cmd_Argc() < 2)
|
||||||
{
|
{
|
||||||
log_file::info("usage: fdir <filter>\n");
|
console::info("usage: fdir <filter>\n");
|
||||||
log_file::info("example: fdir *q3dm*.bsp\n");
|
console::info("example: fdir *q3dm*.bsp\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto* filter = game::native::Cmd_Argv(1);
|
const auto* filter = game::native::Cmd_Argv(1);
|
||||||
|
|
||||||
log_file::info("---------------\n");
|
console::info("---------------\n");
|
||||||
|
|
||||||
auto** dirnames = game::native::FS_ListFilteredFiles(*game::native::fs_searchpaths, "", "", filter, game::native::FS_LIST_PURE_ONLY, &ndirs, 3);
|
auto** dirnames = game::native::FS_ListFilteredFiles(*game::native::fs_searchpaths, "", "", filter, game::native::FS_LIST_PURE_ONLY, &ndirs, 3);
|
||||||
sort_file_list(dirnames, ndirs);
|
sort_file_list(dirnames, ndirs);
|
||||||
@ -483,9 +483,10 @@ namespace
|
|||||||
for (auto i = 0; i < ndirs; ++i)
|
for (auto i = 0; i < ndirs; ++i)
|
||||||
{
|
{
|
||||||
convert_path(dirnames[i]);
|
convert_path(dirnames[i]);
|
||||||
log_file::info("%s\n", dirnames[i]);
|
console::info("%s\n", dirnames[i]);
|
||||||
}
|
}
|
||||||
log_file::info("%d files listed\n", ndirs);
|
|
||||||
|
console::info("%d files listed\n", ndirs);
|
||||||
game::native::Sys_FreeFileList(dirnames);
|
game::native::Sys_FreeFileList(dirnames);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,7 +494,7 @@ namespace
|
|||||||
{
|
{
|
||||||
if (game::native::Cmd_Argc() != 2)
|
if (game::native::Cmd_Argc() != 2)
|
||||||
{
|
{
|
||||||
log_file::info("Usage: touchFile <file>\n");
|
console::info("Usage: touchFile <file>\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -511,15 +512,15 @@ namespace
|
|||||||
|
|
||||||
void fs_startup_stub(char* game_name)
|
void fs_startup_stub(char* game_name)
|
||||||
{
|
{
|
||||||
log_file::info("----- FS_Startup -----\n");
|
console::info("----- FS_Startup -----\n");
|
||||||
|
|
||||||
utils::hook::invoke<void>(0x5B1070, game_name);
|
utils::hook::invoke<void>(0x5B1070, game_name);
|
||||||
|
|
||||||
add_commands();
|
add_commands();
|
||||||
display_path(true);
|
display_path(true);
|
||||||
|
|
||||||
log_file::info("----------------------\n");
|
console::info("----------------------\n");
|
||||||
log_file::info("%d files in iwd files\n", *game::native::fs_iwdFileCount);
|
console::info("%d files in iwd files\n", *game::native::fs_iwdFileCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fs_shutdown_stub(int closemfp)
|
void fs_shutdown_stub(int closemfp)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <loader/module_loader.hpp>
|
#include <loader/module_loader.hpp>
|
||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
|
|
||||||
#include "log_file.hpp"
|
#include "console.hpp"
|
||||||
|
|
||||||
#include <utils/hook.hpp>
|
#include <utils/hook.hpp>
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ private:
|
|||||||
const auto* dvar = game::native::Dvar_FindVar(dvar_name);
|
const auto* dvar = game::native::Dvar_FindVar(dvar_name);
|
||||||
if (dvar != nullptr && ((dvar->flags & game::native::DVAR_ARCHIVE) != 0))
|
if (dvar != nullptr && ((dvar->flags & game::native::DVAR_ARCHIVE) != 0))
|
||||||
{
|
{
|
||||||
log_file::info("Not allowing server to override archive dvar '%s'\n", dvar_name);
|
console::info("Not allowing server to override archive dvar '%s'\n", dvar_name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "script_error.hpp"
|
#include "script_error.hpp"
|
||||||
#include "script_loading.hpp"
|
#include "script_loading.hpp"
|
||||||
|
|
||||||
#include "module/log_file.hpp"
|
#include "module/console.hpp"
|
||||||
#include "module/scripting.hpp"
|
#include "module/scripting.hpp"
|
||||||
|
|
||||||
#include <utils/hook.hpp>
|
#include <utils/hook.hpp>
|
||||||
@ -140,17 +140,17 @@ namespace gsc
|
|||||||
|
|
||||||
if (function_id > (scr_func_max_id - 1))
|
if (function_id > (scr_func_max_id - 1))
|
||||||
{
|
{
|
||||||
log_file::info("in call to builtin method \"%s\"%s\n", xsk::gsc::iw5::resolver::method_name(function_id).data(), error.data());
|
console::error("in call to builtin method \"%s\"%s\n", xsk::gsc::iw5::resolver::method_name(function_id).data(), error.data());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log_file::info("in call to builtin function \"%s\"%s\n", xsk::gsc::iw5::resolver::function_name(function_id).data(), error.data());
|
console::error("in call to builtin function \"%s\"%s\n", xsk::gsc::iw5::resolver::function_name(function_id).data(), error.data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void vm_error_stub(int mark_pos)
|
void vm_error_stub(int mark_pos)
|
||||||
{
|
{
|
||||||
log_file::info("******* script runtime error ********\n");
|
console::error("******* script runtime error ********\n");
|
||||||
|
|
||||||
const auto opcode_id = *reinterpret_cast<std::uint8_t*>(SELECT_VALUE(0x1BF6928, 0x20B8E28));
|
const auto opcode_id = *reinterpret_cast<std::uint8_t*>(SELECT_VALUE(0x1BF6928, 0x20B8E28));
|
||||||
const auto error = (*gsc_error_msg) ? std::format(": {}\n", gsc_error_msg) : std::string();
|
const auto error = (*gsc_error_msg) ? std::format(": {}\n", gsc_error_msg) : std::string();
|
||||||
@ -164,17 +164,17 @@ namespace gsc
|
|||||||
const auto opcode = get_opcode_name(opcode_id);
|
const auto opcode = get_opcode_name(opcode_id);
|
||||||
if (opcode.has_value())
|
if (opcode.has_value())
|
||||||
{
|
{
|
||||||
log_file::info("while processing instruction %s%s\n", opcode.value().data(), error.data());
|
console::error("while processing instruction %s%s\n", opcode.value().data(), error.data());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log_file::info("while processing instruction 0x%X%s\n", opcode_id, error.data());
|
console::error("while processing instruction 0x%X%s\n", opcode_id, error.data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroMemory(gsc_error_msg, sizeof(gsc_error_msg));
|
ZeroMemory(gsc_error_msg, sizeof(gsc_error_msg));
|
||||||
|
|
||||||
log_file::info("************************************\n");
|
console::error("************************************\n");
|
||||||
|
|
||||||
game::native::LargeLocalResetToMark(mark_pos);
|
game::native::LargeLocalResetToMark(mark_pos);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "script_loading.hpp"
|
#include "script_loading.hpp"
|
||||||
|
|
||||||
#include "module/log_file.hpp"
|
#include "module/console.hpp"
|
||||||
#include "module/scripting.hpp"
|
#include "module/scripting.hpp"
|
||||||
|
|
||||||
#include <utils/hook.hpp>
|
#include <utils/hook.hpp>
|
||||||
@ -72,9 +72,9 @@ namespace gsc
|
|||||||
}
|
}
|
||||||
catch (const std::exception& ex)
|
catch (const std::exception& ex)
|
||||||
{
|
{
|
||||||
log_file::info("*********** script compile error *************\n");
|
console::error("*********** script compile error *************\n");
|
||||||
log_file::info("failed to compile '%s':\n%s", real_name.data(), ex.what());
|
console::error("failed to compile '%s':\n%s", real_name.data(), ex.what());
|
||||||
log_file::info("**********************************************\n");
|
console::error("**********************************************\n");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,9 +86,9 @@ namespace gsc
|
|||||||
}
|
}
|
||||||
catch (const std::exception& ex)
|
catch (const std::exception& ex)
|
||||||
{
|
{
|
||||||
log_file::info("*********** script compile error *************\n");
|
console::error("*********** script compile error *************\n");
|
||||||
log_file::info("failed to assemble '%s':\n%s", real_name.data(), ex.what());
|
console::error("failed to assemble '%s':\n%s", real_name.data(), ex.what());
|
||||||
log_file::info("**********************************************\n");
|
console::error("**********************************************\n");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ void log_file::com_open_log_file()
|
|||||||
file_system::open_file_by_mode(log_file_name, game::native::logfile, game::native::FS_APPEND_SYNC);
|
file_system::open_file_by_mode(log_file_name, game::native::logfile, game::native::FS_APPEND_SYNC);
|
||||||
|
|
||||||
asctime_s(time_buffer, sizeof(time_buffer), &new_time);
|
asctime_s(time_buffer, sizeof(time_buffer), &new_time);
|
||||||
info("logfile opened on %s\n", time_buffer);
|
info(std::format("logfile opened on {}\n", time_buffer));
|
||||||
opening_qconsole = 0;
|
opening_qconsole = 0;
|
||||||
com_console_log_open_failed = *game::native::logfile == 0;
|
com_console_log_open_failed = *game::native::logfile == 0;
|
||||||
}
|
}
|
||||||
@ -66,21 +66,12 @@ void log_file::com_log_print_message(const std::string& msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_file::info(const char* fmt, ...)
|
void log_file::info(const std::string& msg)
|
||||||
{
|
{
|
||||||
char msg[0x1000]{};
|
|
||||||
va_list argptr;
|
|
||||||
|
|
||||||
va_start(argptr, fmt);
|
|
||||||
vsnprintf_s(msg, _TRUNCATE, fmt, argptr);
|
|
||||||
va_end(argptr);
|
|
||||||
|
|
||||||
if (com_logfile && com_logfile->current.integer)
|
if (com_logfile && com_logfile->current.integer)
|
||||||
{
|
{
|
||||||
com_log_print_message(msg);
|
com_log_print_message(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
console::info("%s", msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_file::post_load()
|
void log_file::post_load()
|
||||||
|
@ -6,7 +6,8 @@ public:
|
|||||||
void post_load() override;
|
void post_load() override;
|
||||||
|
|
||||||
static void com_log_print_message(const std::string& msg);
|
static void com_log_print_message(const std::string& msg);
|
||||||
static void info(const char* fmt, ...);
|
|
||||||
|
static void info(const std::string& msg);
|
||||||
|
|
||||||
static const game::native::dvar_t* com_logfile;
|
static const game::native::dvar_t* com_logfile;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "test_clients.hpp"
|
#include "test_clients.hpp"
|
||||||
#include "command.hpp"
|
#include "command.hpp"
|
||||||
#include "scheduler.hpp"
|
#include "scheduler.hpp"
|
||||||
#include "log_file.hpp"
|
#include "console.hpp"
|
||||||
|
|
||||||
bool test_clients::can_add()
|
bool test_clients::can_add()
|
||||||
{
|
{
|
||||||
@ -205,7 +205,7 @@ void test_clients::post_load()
|
|||||||
const auto count = std::strtol(input, &end, 10);
|
const auto count = std::strtol(input, &end, 10);
|
||||||
if (input == end)
|
if (input == end)
|
||||||
{
|
{
|
||||||
log_file::info("%s is not a valid input\nUsage: %s <number of bots>\n", input, params.get(0));
|
console::info("%s is not a valid input\nUsage: %s <number of bots>\n", input, params.get(0));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user