Merge pull request #312 from diamante0018/logger
[Logger] Make source location work
This commit is contained in:
commit
3bb363f4e6
@ -41,7 +41,7 @@ namespace Components
|
|||||||
Auth::TokenContainer.generating = false;
|
Auth::TokenContainer.generating = false;
|
||||||
|
|
||||||
Auth::StoreKey();
|
Auth::StoreKey();
|
||||||
Logger::DebugInfo("Security level is %d", Auth::GetSecurityLevel());
|
Logger::Debug("Security level is {}", Auth::GetSecurityLevel());
|
||||||
Command::Execute("closemenu security_increase_popmenu", false);
|
Command::Execute("closemenu security_increase_popmenu", false);
|
||||||
|
|
||||||
if (!Auth::TokenContainer.cancel)
|
if (!Auth::TokenContainer.cancel)
|
||||||
@ -233,7 +233,7 @@ namespace Components
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::DebugInfo("Verified XUID {:#X} ({}) from {}", xuid, userLevel, address.getCString());
|
Logger::Debug("Verified XUID {:#X} ({}) from {}", xuid, userLevel, address.getCString());
|
||||||
Game::SV_DirectConnect(*address.get());
|
Game::SV_DirectConnect(*address.get());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -373,7 +373,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
Toast::Show("cardicon_headshot", "^2Success", Utils::String::VA("Spawning %d %s...", count, (count == 1 ? "bot" : "bots")), 3000);
|
Toast::Show("cardicon_headshot", "^2Success", Utils::String::VA("Spawning %d %s...", count, (count == 1 ? "bot" : "bots")), 3000);
|
||||||
Logger::DebugInfo("Spawning {} {}", count, (count == 1 ? "bot" : "bots"));
|
Logger::Debug("Spawning {} {}", count, (count == 1 ? "bot" : "bots"));
|
||||||
|
|
||||||
Bots::Spawn(count);
|
Bots::Spawn(count);
|
||||||
});
|
});
|
||||||
|
@ -10,14 +10,14 @@ namespace Components
|
|||||||
|
|
||||||
if (!Dvar::Var("sv_cheats").get<bool>())
|
if (!Dvar::Var("sv_cheats").get<bool>())
|
||||||
{
|
{
|
||||||
Logger::DebugInfo("Cheats are disabled!");
|
Logger::Debug("Cheats are disabled!");
|
||||||
Game::SV_GameSendServerCommand(entNum, Game::SV_CMD_CAN_IGNORE, Utils::String::VA("%c \"GAME_CHEATSNOTENABLED\"", 0x65));
|
Game::SV_GameSendServerCommand(entNum, Game::SV_CMD_CAN_IGNORE, Utils::String::VA("%c \"GAME_CHEATSNOTENABLED\"", 0x65));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ent->health < 1)
|
if (ent->health < 1)
|
||||||
{
|
{
|
||||||
Logger::DebugInfo("Entity {} must be alive to use this command!", entNum);
|
Logger::Debug("Entity {} must be alive to use this command!", entNum);
|
||||||
Game::SV_GameSendServerCommand(entNum, Game::SV_CMD_CAN_IGNORE, Utils::String::VA("%c \"GAME_MUSTBEALIVECOMMAND\"", 0x65));
|
Game::SV_GameSendServerCommand(entNum, Game::SV_CMD_CAN_IGNORE, Utils::String::VA("%c \"GAME_MUSTBEALIVECOMMAND\"", 0x65));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ namespace Components
|
|||||||
|
|
||||||
if (ent->client == nullptr)
|
if (ent->client == nullptr)
|
||||||
{
|
{
|
||||||
Logger::DebugInfo("ClientCommand: client {} is not fully in game yet", clientNum);
|
Logger::Debug("ClientCommand: client {} is not fully in game yet", clientNum);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ namespace Components
|
|||||||
ent->client->flags ^= Game::PLAYER_FLAG_NOCLIP;
|
ent->client->flags ^= Game::PLAYER_FLAG_NOCLIP;
|
||||||
|
|
||||||
const auto entNum = ent->s.number;
|
const auto entNum = ent->s.number;
|
||||||
Logger::DebugInfo("Noclip toggled for entity {}", entNum);
|
Logger::Debug("Noclip toggled for entity {}", entNum);
|
||||||
|
|
||||||
Game::SV_GameSendServerCommand(entNum, Game::SV_CMD_CAN_IGNORE, Utils::String::VA("%c \"%s\"", 0x65,
|
Game::SV_GameSendServerCommand(entNum, Game::SV_CMD_CAN_IGNORE, Utils::String::VA("%c \"%s\"", 0x65,
|
||||||
(ent->client->flags & Game::PLAYER_FLAG_NOCLIP) ? "GAME_NOCLIPON" : "GAME_NOCLIPOFF"));
|
(ent->client->flags & Game::PLAYER_FLAG_NOCLIP) ? "GAME_NOCLIPON" : "GAME_NOCLIPOFF"));
|
||||||
@ -78,7 +78,7 @@ namespace Components
|
|||||||
ent->client->flags ^= Game::PLAYER_FLAG_UFO;
|
ent->client->flags ^= Game::PLAYER_FLAG_UFO;
|
||||||
|
|
||||||
const auto entNum = ent->s.number;
|
const auto entNum = ent->s.number;
|
||||||
Logger::DebugInfo("UFO toggled for entity {}", entNum);
|
Logger::Debug("UFO toggled for entity {}", entNum);
|
||||||
|
|
||||||
Game::SV_GameSendServerCommand(entNum, Game::SV_CMD_CAN_IGNORE, Utils::String::VA("%c \"%s\"", 0x65,
|
Game::SV_GameSendServerCommand(entNum, Game::SV_CMD_CAN_IGNORE, Utils::String::VA("%c \"%s\"", 0x65,
|
||||||
(ent->client->flags & Game::PLAYER_FLAG_UFO) ? "GAME_UFOON" : "GAME_UFOOFF"));
|
(ent->client->flags & Game::PLAYER_FLAG_UFO) ? "GAME_UFOON" : "GAME_UFOOFF"));
|
||||||
@ -92,7 +92,7 @@ namespace Components
|
|||||||
ent->flags ^= Game::FL_GODMODE;
|
ent->flags ^= Game::FL_GODMODE;
|
||||||
|
|
||||||
const auto entNum = ent->s.number;
|
const auto entNum = ent->s.number;
|
||||||
Logger::DebugInfo("God toggled for entity {}", entNum);
|
Logger::Debug("God toggled for entity {}", entNum);
|
||||||
|
|
||||||
Game::SV_GameSendServerCommand(entNum, Game::SV_CMD_CAN_IGNORE, Utils::String::VA("%c \"%s\"", 0x65,
|
Game::SV_GameSendServerCommand(entNum, Game::SV_CMD_CAN_IGNORE, Utils::String::VA("%c \"%s\"", 0x65,
|
||||||
(ent->flags & Game::FL_GODMODE) ? "GAME_GODMODE_ON" : "GAME_GODMODE_OFF"));
|
(ent->flags & Game::FL_GODMODE) ? "GAME_GODMODE_ON" : "GAME_GODMODE_OFF"));
|
||||||
@ -106,7 +106,7 @@ namespace Components
|
|||||||
ent->flags ^= Game::FL_DEMI_GODMODE;
|
ent->flags ^= Game::FL_DEMI_GODMODE;
|
||||||
|
|
||||||
const auto entNum = ent->s.number;
|
const auto entNum = ent->s.number;
|
||||||
Logger::DebugInfo("Demigod toggled for entity {}", entNum);
|
Logger::Debug("Demigod toggled for entity {}", entNum);
|
||||||
|
|
||||||
Game::SV_GameSendServerCommand(entNum, Game::SV_CMD_CAN_IGNORE, Utils::String::VA("%c \"%s\"", 0x65,
|
Game::SV_GameSendServerCommand(entNum, Game::SV_CMD_CAN_IGNORE, Utils::String::VA("%c \"%s\"", 0x65,
|
||||||
(ent->flags & Game::FL_DEMI_GODMODE) ? "GAME_DEMI_GODMODE_ON" : "GAME_DEMI_GODMODE_OFF"));
|
(ent->flags & Game::FL_DEMI_GODMODE) ? "GAME_DEMI_GODMODE_ON" : "GAME_DEMI_GODMODE_OFF"));
|
||||||
@ -120,7 +120,7 @@ namespace Components
|
|||||||
ent->flags ^= Game::FL_NOTARGET;
|
ent->flags ^= Game::FL_NOTARGET;
|
||||||
|
|
||||||
const auto entNum = ent->s.number;
|
const auto entNum = ent->s.number;
|
||||||
Logger::DebugInfo("Notarget toggled for entity {}", entNum);
|
Logger::Debug("Notarget toggled for entity {}", entNum);
|
||||||
|
|
||||||
Game::SV_GameSendServerCommand(entNum, Game::SV_CMD_CAN_IGNORE, Utils::String::VA("%c \"%s\"", 0x65,
|
Game::SV_GameSendServerCommand(entNum, Game::SV_CMD_CAN_IGNORE, Utils::String::VA("%c \"%s\"", 0x65,
|
||||||
(ent->flags & Game::FL_NOTARGET) ? "GAME_NOTARGETON" : "GAME_NOTARGETOFF"));
|
(ent->flags & Game::FL_NOTARGET) ? "GAME_NOTARGETON" : "GAME_NOTARGETOFF"));
|
||||||
@ -157,7 +157,7 @@ namespace Components
|
|||||||
angles[0] = std::strtof(params->get(5), nullptr); // Pitch
|
angles[0] = std::strtof(params->get(5), nullptr); // Pitch
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::DebugInfo("Teleported entity {} to {:f} {:f} {:f}\nviewpos {:f} {:f}", ent->s.number,
|
Logger::Debug("Teleported entity {} to {:f} {:f} {:f}\nviewpos {:f} {:f}", ent->s.number,
|
||||||
origin[0], origin[1], origin[2], angles[0], angles[2]);
|
origin[0], origin[1], origin[2], angles[0], angles[2]);
|
||||||
Game::TeleportPlayer(ent, origin, angles);
|
Game::TeleportPlayer(ent, origin, angles);
|
||||||
});
|
});
|
||||||
@ -176,7 +176,7 @@ namespace Components
|
|||||||
|
|
||||||
Game::level->initializing = 1;
|
Game::level->initializing = 1;
|
||||||
const auto* weaponName = params->get(1);
|
const auto* weaponName = params->get(1);
|
||||||
Logger::DebugInfo("Giving weapon {} to entity {}", weaponName, ent->s.number);
|
Logger::Debug("Giving weapon {} to entity {}", weaponName, ent->s.number);
|
||||||
const auto weaponIndex = Game::G_GetWeaponIndexForName(weaponName);
|
const auto weaponIndex = Game::G_GetWeaponIndexForName(weaponName);
|
||||||
|
|
||||||
if (weaponIndex == 0)
|
if (weaponIndex == 0)
|
||||||
@ -194,7 +194,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto* weapEnt = Game::G_Spawn();
|
auto* weapEnt = Game::G_Spawn();
|
||||||
Utils::VectorCopy(weapEnt->r.currentOrigin, ent->r.currentOrigin);
|
std::memcpy(weapEnt->r.currentOrigin, ent->r.currentOrigin, sizeof(std::float_t[3]));
|
||||||
Game::G_GetItemClassname(static_cast<int>(weaponIndex), weapEnt);
|
Game::G_GetItemClassname(static_cast<int>(weaponIndex), weapEnt);
|
||||||
Game::G_SpawnItem(weapEnt, static_cast<int>(weaponIndex));
|
Game::G_SpawnItem(weapEnt, static_cast<int>(weaponIndex));
|
||||||
|
|
||||||
@ -210,11 +210,11 @@ namespace Components
|
|||||||
case Game::OFFHAND_CLASS_FRAG_GRENADE:
|
case Game::OFFHAND_CLASS_FRAG_GRENADE:
|
||||||
case Game::OFFHAND_CLASS_THROWINGKNIFE:
|
case Game::OFFHAND_CLASS_THROWINGKNIFE:
|
||||||
case Game::OFFHAND_CLASS_OTHER:
|
case Game::OFFHAND_CLASS_OTHER:
|
||||||
Logger::DebugInfo("Setting offhandPrimary");
|
Logger::Debug("Setting offhandPrimary");
|
||||||
client->ps.weapCommon.offhandPrimary = offHandClass;
|
client->ps.weapCommon.offhandPrimary = offHandClass;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Logger::DebugInfo("Setting offhandSecondary");
|
Logger::Debug("Setting offhandSecondary");
|
||||||
client->ps.weapCommon.offhandSecondary = offHandClass;
|
client->ps.weapCommon.offhandSecondary = offHandClass;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -226,7 +226,7 @@ namespace Components
|
|||||||
|
|
||||||
if (weapEnt->r.isInUse)
|
if (weapEnt->r.isInUse)
|
||||||
{
|
{
|
||||||
Logger::DebugInfo("Freeing up entity {}", weapEnt->s.number);
|
Logger::Debug("Freeing up entity {}", weapEnt->s.number);
|
||||||
Game::G_FreeEntity(weapEnt);
|
Game::G_FreeEntity(weapEnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,7 +327,7 @@ namespace Components
|
|||||||
assert(ent != nullptr);
|
assert(ent != nullptr);
|
||||||
|
|
||||||
ent->client->ps.stunTime = 1000 + Game::level->time; // 1000 is the default test stun time
|
ent->client->ps.stunTime = 1000 + Game::level->time; // 1000 is the default test stun time
|
||||||
Logger::DebugInfo("playerState_s.stunTime is {}", ent->client->ps.stunTime);
|
Logger::Debug("playerState_s.stunTime is {}", ent->client->ps.stunTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
ClientCommand::Add("kill", []([[maybe_unused]] Game::gentity_s* ent, [[maybe_unused]] Command::ServerParams* params)
|
ClientCommand::Add("kill", []([[maybe_unused]] Game::gentity_s* ent, [[maybe_unused]] Command::ServerParams* params)
|
||||||
|
@ -573,7 +573,7 @@ namespace Components
|
|||||||
// TODO: Fix the actual error!
|
// TODO: Fix the actual error!
|
||||||
if (IsBadReadPtr(pConstantData, Vector4fCount * 16))
|
if (IsBadReadPtr(pConstantData, Vector4fCount * 16))
|
||||||
{
|
{
|
||||||
Logger::DebugInfo("Invalid shader constant array!");
|
Logger::Debug("Invalid shader constant array!");
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,13 +48,14 @@ namespace Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logger::DebugInternal(const bool verbose, const std::source_location& srcLoc, const std::string_view fmt, std::format_args&& args)
|
void Logger::DebugInternal(std::string_view fmt, std::format_args&& args, [[maybe_unused]] const std::source_location& loc)
|
||||||
{
|
{
|
||||||
const auto msg = std::vformat(fmt, args);
|
const auto msg = std::vformat(fmt, args);
|
||||||
|
#ifdef LOGGER_TRACE
|
||||||
const auto out = verbose
|
const auto out = std::format("Debug:\n {}\nFile: {}\nLine: {}\n", msg, loc.file_name(), loc.line());
|
||||||
? std::format("Debug:\n {}\nFile: {}\nLine: {}\n", msg, srcLoc.file_name(), srcLoc.line())
|
#else
|
||||||
: std::format("Debug:\n {}\n", msg);
|
const auto out = std::format("Debug:\n {}\n", msg);
|
||||||
|
#endif
|
||||||
|
|
||||||
Logger::MessagePrint(Game::CON_CHANNEL_DONT_FILTER, out);
|
Logger::MessagePrint(Game::CON_CHANNEL_DONT_FILTER, out);
|
||||||
}
|
}
|
||||||
|
@ -21,104 +21,77 @@ namespace Components
|
|||||||
static void ErrorInternal(Game::errorParm_t error, std::string_view fmt, std::format_args&& args);
|
static void ErrorInternal(Game::errorParm_t error, std::string_view fmt, std::format_args&& args);
|
||||||
static void PrintErrorInternal(int channel, std::string_view fmt, std::format_args&& args);
|
static void PrintErrorInternal(int channel, std::string_view fmt, std::format_args&& args);
|
||||||
static void WarningInternal(int channel, std::string_view fmt, std::format_args&& args);
|
static void WarningInternal(int channel, std::string_view fmt, std::format_args&& args);
|
||||||
static void DebugInternal(bool verbose, const std::source_location& srcLoc, std::string_view fmt, std::format_args&& args);
|
static void DebugInternal(std::string_view fmt, std::format_args&& args, const std::source_location& loc);
|
||||||
|
|
||||||
__forceinline static void Print(std::string_view fmt)
|
static void Print(std::string_view fmt)
|
||||||
{
|
{
|
||||||
PrintInternal(Game::CON_CHANNEL_DONT_FILTER, fmt, std::make_format_args(0));
|
PrintInternal(Game::CON_CHANNEL_DONT_FILTER, fmt, std::make_format_args(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
__forceinline static void Print(int channel, std::string_view fmt)
|
static void Print(int channel, std::string_view fmt)
|
||||||
{
|
{
|
||||||
PrintInternal(channel, fmt, std::make_format_args(0));
|
PrintInternal(channel, fmt, std::make_format_args(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
__forceinline static void Print(std::string_view fmt, Args&&... args)
|
static void Print(std::string_view fmt, Args&&... args)
|
||||||
{
|
{
|
||||||
PrintInternal(Game::CON_CHANNEL_DONT_FILTER, fmt, std::make_format_args(args...));
|
PrintInternal(Game::CON_CHANNEL_DONT_FILTER, fmt, std::make_format_args(args...));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
__forceinline static void Print(int channel, std::string_view fmt, Args&&... args)
|
static void Print(int channel, std::string_view fmt, Args&&... args)
|
||||||
{
|
{
|
||||||
PrintInternal(channel, fmt, std::make_format_args(args...));
|
PrintInternal(channel, fmt, std::make_format_args(args...));
|
||||||
}
|
}
|
||||||
|
|
||||||
__forceinline static void Error(Game::errorParm_t error, std::string_view fmt)
|
static void Error(Game::errorParm_t error, std::string_view fmt)
|
||||||
{
|
{
|
||||||
ErrorInternal(error, fmt, std::make_format_args(0));
|
ErrorInternal(error, fmt, std::make_format_args(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
__forceinline static void Error(Game::errorParm_t error, std::string_view fmt, Args&&... args)
|
static void Error(Game::errorParm_t error, std::string_view fmt, Args&&... args)
|
||||||
{
|
{
|
||||||
ErrorInternal(error, fmt, std::make_format_args(args...));
|
ErrorInternal(error, fmt, std::make_format_args(args...));
|
||||||
}
|
}
|
||||||
|
|
||||||
__forceinline static void Warning(int channel, std::string_view fmt)
|
static void Warning(int channel, std::string_view fmt)
|
||||||
{
|
{
|
||||||
WarningInternal(channel, fmt, std::make_format_args(0));
|
WarningInternal(channel, fmt, std::make_format_args(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
__forceinline static void Warning(int channel, std::string_view fmt, Args&&... args)
|
static void Warning(int channel, std::string_view fmt, Args&&... args)
|
||||||
{
|
{
|
||||||
WarningInternal(channel, fmt, std::make_format_args(args...));
|
WarningInternal(channel, fmt, std::make_format_args(args...));
|
||||||
}
|
}
|
||||||
|
|
||||||
__forceinline static void PrintError(int channel, std::string_view fmt)
|
static void PrintError(int channel, std::string_view fmt)
|
||||||
{
|
{
|
||||||
PrintErrorInternal(channel, fmt, std::make_format_args(0));
|
PrintErrorInternal(channel, fmt, std::make_format_args(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
__forceinline static void PrintError(int channel, std::string_view fmt, Args&&... args)
|
static void PrintError(int channel, std::string_view fmt, Args&&... args)
|
||||||
{
|
{
|
||||||
PrintErrorInternal(channel, fmt, std::make_format_args(args...));
|
PrintErrorInternal(channel, fmt, std::make_format_args(args...));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename... Args>
|
||||||
|
class Debug
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Debug([[maybe_unused]] std::string_view fmt, [[maybe_unused]] const Args&... args, [[maybe_unused]] const std::source_location& loc = std::source_location::current())
|
||||||
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
__forceinline static void DebugInfo([[maybe_unused]] std::string_view fmt)
|
DebugInternal(fmt, std::make_format_args(args...), loc);
|
||||||
{
|
|
||||||
DebugInternal(true, std::source_location::current(), fmt, std::make_format_args(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename... Args>
|
|
||||||
__forceinline static void DebugInfo([[maybe_unused]] std::string_view fmt, [[maybe_unused]] Args&&... args)
|
|
||||||
{
|
|
||||||
DebugInternal(true, std::source_location::current(), fmt, std::make_format_args(args...));
|
|
||||||
}
|
|
||||||
|
|
||||||
__forceinline static void Debug([[maybe_unused]] std::string_view fmt)
|
|
||||||
{
|
|
||||||
DebugInternal(false, std::source_location::current(), fmt, std::make_format_args(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename... Args>
|
|
||||||
__forceinline static void Debug([[maybe_unused]] std::string_view fmt, [[maybe_unused]] Args&&... args)
|
|
||||||
{
|
|
||||||
DebugInternal(false, std::source_location::current(), fmt, std::make_format_args(args...));
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
__forceinline static void DebugInfo([[maybe_unused]] std::string_view fmt)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename... Args>
|
|
||||||
__forceinline static void DebugInfo([[maybe_unused]] std::string_view fmt, [[maybe_unused]] Args&&... args)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
__forceinline static void Debug([[maybe_unused]] std::string_view fmt)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename... Args>
|
|
||||||
__forceinline static void Debug([[maybe_unused]] std::string_view fmt, [[maybe_unused]] Args&&... args)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename... Args>
|
||||||
|
Debug(std::string_view fmt, const Args&... args) -> Debug<Args...>;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::mutex MessageMutex;
|
static std::mutex MessageMutex;
|
||||||
|
@ -107,7 +107,7 @@ namespace Components
|
|||||||
Logger::Print(Game::CON_CHANNEL_SERVER, "{}: sv_mapRotation contains invalid data!\n", ex.what());
|
Logger::Print(Game::CON_CHANNEL_SERVER, "{}: sv_mapRotation contains invalid data!\n", ex.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::DebugInfo("DedicatedRotation size after parsing is '{}'\n", DedicatedRotation.getEntriesSize());
|
Logger::Debug("DedicatedRotation size after parsing is '{}'", DedicatedRotation.getEntriesSize());
|
||||||
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
@ -187,7 +187,7 @@ namespace Components
|
|||||||
|
|
||||||
if (entry.first == "map")
|
if (entry.first == "map")
|
||||||
{
|
{
|
||||||
Logger::DebugInfo("Loading new map: '{}'\n", entry.second);
|
Logger::Debug("Loading new map: '{}'", entry.second);
|
||||||
Command::Execute(Utils::String::VA("map %s", entry.second.data()), true);
|
Command::Execute(Utils::String::VA("map %s", entry.second.data()), true);
|
||||||
|
|
||||||
// Map was found so we exit the loop
|
// Map was found so we exit the loop
|
||||||
@ -195,7 +195,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
else if (entry.first == "gametype")
|
else if (entry.first == "gametype")
|
||||||
{
|
{
|
||||||
Logger::DebugInfo("Applying new gametype: '{}'\n", entry.second);
|
Logger::Debug("Applying new gametype: '{}'", entry.second);
|
||||||
Dvar::Var("g_gametype").set(entry.second);
|
Dvar::Var("g_gametype").set(entry.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger::DebugInfo("Map rotation was not randomized");
|
Logger::Debug("Map rotation was not randomized");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,10 +226,10 @@ namespace Components
|
|||||||
Logger::Print(Game::CON_CHANNEL_SERVER, "Rotating map...\n");
|
Logger::Print(Game::CON_CHANNEL_SERVER, "Rotating map...\n");
|
||||||
const std::string mapRotation = (*SVMapRotation)->current.string;
|
const std::string mapRotation = (*SVMapRotation)->current.string;
|
||||||
|
|
||||||
// People may have sv_mapRotation empty because they only use 'addMap' or 'addMap'
|
// People may have sv_mapRotation empty because they only use 'addMap' or 'addGametype'
|
||||||
if (!mapRotation.empty())
|
if (!mapRotation.empty())
|
||||||
{
|
{
|
||||||
Logger::DebugInfo("sv_mapRotation is not empty. Parsing...");
|
Logger::Debug("sv_mapRotation is not empty. Parsing...");
|
||||||
LoadRotation(mapRotation);
|
LoadRotation(mapRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,7 +260,7 @@ namespace Components
|
|||||||
{
|
{
|
||||||
RotationData rotation;
|
RotationData rotation;
|
||||||
|
|
||||||
Logger::DebugInfo("Testing map rotation parsing...");
|
Logger::Debug("Testing map rotation parsing...");
|
||||||
|
|
||||||
const auto* normal = "map mp_highrise map mp_terminal map mp_firingrange map mp_trailerpark gametype dm map mp_shipment_long";
|
const auto* normal = "map mp_highrise map mp_terminal map mp_firingrange map mp_trailerpark gametype dm map mp_shipment_long";
|
||||||
|
|
||||||
|
@ -43,9 +43,9 @@ namespace Components
|
|||||||
void ModList::UIScript_LoadMods(UIScript::Token)
|
void ModList::UIScript_LoadMods(UIScript::Token)
|
||||||
{
|
{
|
||||||
auto folder = Dvar::Var("fs_basepath").get<std::string>() + "\\mods";
|
auto folder = Dvar::Var("fs_basepath").get<std::string>() + "\\mods";
|
||||||
Logger::DebugInfo("Searching for mods in {}...\n", folder);
|
Logger::Debug("Searching for mods in {}...", folder);
|
||||||
ModList::Mods = FileSystem::GetSysFileList(folder, "", true);
|
ModList::Mods = FileSystem::GetSysFileList(folder, "", true);
|
||||||
Logger::DebugInfo("Found {} mods!\n", ModList::Mods.size());
|
Logger::Debug("Found {} mods!", ModList::Mods.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModList::UIScript_RunMod(UIScript::Token)
|
void ModList::UIScript_RunMod(UIScript::Token)
|
||||||
|
@ -13,7 +13,7 @@ namespace Components
|
|||||||
|
|
||||||
if (News::Thread.joinable())
|
if (News::Thread.joinable())
|
||||||
{
|
{
|
||||||
Logger::DebugInfo("Awaiting thread termination...");
|
Logger::Debug("Awaiting thread termination...");
|
||||||
News::Thread.join();
|
News::Thread.join();
|
||||||
|
|
||||||
if (!strcmp(Localization::Get("MPUI_MOTD_TEXT"), NEWS_MOTD_DEFAULT))
|
if (!strcmp(Localization::Get("MPUI_MOTD_TEXT"), NEWS_MOTD_DEFAULT))
|
||||||
@ -23,7 +23,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger::DebugInfo("Successfully fetched motd");
|
Logger::Debug("Successfully fetched motd");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ namespace Components
|
|||||||
|
|
||||||
Session::Send(this->address, "nodeListRequest");
|
Session::Send(this->address, "nodeListRequest");
|
||||||
Node::SendList(this->address);
|
Node::SendList(this->address);
|
||||||
Logger::DebugInfo("Sent request to {}\n", this->address.getCString());
|
Logger::Debug("Sent request to {}", this->address.getCString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::Entry::reset()
|
void Node::Entry::reset()
|
||||||
@ -235,7 +235,7 @@ namespace Components
|
|||||||
Proto::Node::List list;
|
Proto::Node::List list;
|
||||||
if (!list.ParseFromString(data)) return;
|
if (!list.ParseFromString(data)) return;
|
||||||
|
|
||||||
Logger::DebugInfo("Received response from {}\n", address.getCString());
|
Logger::Debug("Received response from {}", address.getCString());
|
||||||
|
|
||||||
std::lock_guard _(Node::Mutex);
|
std::lock_guard _(Node::Mutex);
|
||||||
|
|
||||||
@ -253,12 +253,12 @@ namespace Components
|
|||||||
{
|
{
|
||||||
if (!Dedicated::IsEnabled() && ServerList::IsOnlineList() && !ServerList::useMasterServer && list.protocol() == PROTOCOL)
|
if (!Dedicated::IsEnabled() && ServerList::IsOnlineList() && !ServerList::useMasterServer && list.protocol() == PROTOCOL)
|
||||||
{
|
{
|
||||||
Logger::DebugInfo("Inserting {} into the serverlist\n", address.getCString());
|
Logger::Debug("Inserting {} into the serverlist", address.getCString());
|
||||||
ServerList::InsertRequest(address);
|
ServerList::InsertRequest(address);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger::DebugInfo("Dropping serverlist insertion for {}\n", address.getCString());
|
Logger::Debug("Dropping serverlist insertion for {}", address.getCString());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& node : Node::Nodes)
|
for (auto& node : Node::Nodes)
|
||||||
|
@ -698,7 +698,7 @@ namespace Components
|
|||||||
bool QuickPatch::unitTest()
|
bool QuickPatch::unitTest()
|
||||||
{
|
{
|
||||||
uint32_t randIntCount = 4'000'000;
|
uint32_t randIntCount = 4'000'000;
|
||||||
Logger::Debug("Generating %d random integers...", randIntCount);
|
Logger::Debug("Generating {} random integers...", randIntCount);
|
||||||
|
|
||||||
const auto startTime = std::chrono::high_resolution_clock::now();
|
const auto startTime = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
@ -708,7 +708,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - startTime).count();
|
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - startTime).count();
|
||||||
Logger::Debug("took {}ms\n", duration);
|
Logger::Debug("took {}ms", duration);
|
||||||
|
|
||||||
Logger::Debug("Testing ZLib compression...");
|
Logger::Debug("Testing ZLib compression...");
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ namespace Components
|
|||||||
Logger::Print("Script {}.gsc loaded successfully.\n", script);
|
Logger::Print("Script {}.gsc loaded successfully.\n", script);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::DebugInfo("Finding script handle {}::{}...", script.data(), label.data());
|
Logger::Debug("Finding script handle {}::{}...", script.data(), label.data());
|
||||||
const auto handle = Game::Scr_GetFunctionHandle(script.data(), label.data());
|
const auto handle = Game::Scr_GetFunctionHandle(script.data(), label.data());
|
||||||
if (handle)
|
if (handle)
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ namespace Components
|
|||||||
// If it's a command don't execute it
|
// If it's a command don't execute it
|
||||||
if (Command::Find(name) != nullptr)
|
if (Command::Find(name) != nullptr)
|
||||||
{
|
{
|
||||||
Logger::DebugInfo("CL_SelectStringTableEntryInDvar_f: parameter is a command\n");
|
Logger::Debug("CL_SelectStringTableEntryInDvar_f: parameter is a command");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ namespace Components
|
|||||||
// If it's a dvar check that it does not have disallowed flags
|
// If it's a dvar check that it does not have disallowed flags
|
||||||
if ((dvar->flags & disallowedFlags) != 0)
|
if ((dvar->flags & disallowedFlags) != 0)
|
||||||
{
|
{
|
||||||
Logger::DebugInfo("CL_SelectStringTableEntryInDvar_f: parameter is a protected dvar\n");
|
Logger::Debug("CL_SelectStringTableEntryInDvar_f: parameter is a protected dvar");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,7 +107,7 @@ namespace Components
|
|||||||
|
|
||||||
if (static_cast<std::size_t>(net_message->cursize) >= sizeof(Game::DeferredMsg::data))
|
if (static_cast<std::size_t>(net_message->cursize) >= sizeof(Game::DeferredMsg::data))
|
||||||
{
|
{
|
||||||
Logger::DebugInfo("Dropping net_message. Size is {}", net_message->cursize);
|
Logger::Debug("Dropping net_message. Size is {}", net_message->cursize);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -914,7 +914,7 @@ namespace Components
|
|||||||
count += server.clients;
|
count += server.clients;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::DebugInfo("There are %d players playing", count);
|
Logger::Debug("There are {} players playing", count);
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
// Add required ownerDraws
|
// Add required ownerDraws
|
||||||
|
@ -53,7 +53,7 @@ namespace Components
|
|||||||
Game::Scr_ParamError(0, "^1SetName: Illegal parameter!\n");
|
Game::Scr_ParamError(0, "^1SetName: Illegal parameter!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::DebugInfo("Setting name of {} to {}", ent->s.number, name);
|
Logger::Debug("Setting name of {} to {}", ent->s.number, name);
|
||||||
UserInfoOverrides[ent->s.number]["name"] = name;
|
UserInfoOverrides[ent->s.number]["name"] = name;
|
||||||
Game::ClientUserinfoChanged(ent->s.number);
|
Game::ClientUserinfoChanged(ent->s.number);
|
||||||
});
|
});
|
||||||
@ -62,7 +62,7 @@ namespace Components
|
|||||||
{
|
{
|
||||||
const auto* ent = Game::GetPlayerEntity(entref);
|
const auto* ent = Game::GetPlayerEntity(entref);
|
||||||
|
|
||||||
Logger::DebugInfo("Resetting name of {} ", ent->s.number);
|
Logger::Debug("Resetting name of {} ", ent->s.number);
|
||||||
UserInfoOverrides[ent->s.number].erase("name");
|
UserInfoOverrides[ent->s.number].erase("name");
|
||||||
Game::ClientUserinfoChanged(ent->s.number);
|
Game::ClientUserinfoChanged(ent->s.number);
|
||||||
});
|
});
|
||||||
|
@ -348,7 +348,7 @@ namespace Components
|
|||||||
Logger::Error(Game::ERR_FATAL, "Missing required asset '{}' ({}). Export failed!", name, Game::DB_GetXAssetTypeName(type));
|
Logger::Error(Game::ERR_FATAL, "Missing required asset '{}' ({}). Export failed!", name, Game::DB_GetXAssetTypeName(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::DebugInfo("Saving require ({}): {}\n", Game::DB_GetXAssetTypeName(type), Game::DB_GetXAssetNameHandlers[type](&header));
|
Logger::Debug("Saving require ({}): {}", Game::DB_GetXAssetTypeName(type), Game::DB_GetXAssetNameHandlers[type](&header));
|
||||||
|
|
||||||
// we alias the next 4 (aligned) bytes of the stream b/c DB_InsertPointer gives us a nice pointer to use as the alias
|
// we alias the next 4 (aligned) bytes of the stream b/c DB_InsertPointer gives us a nice pointer to use as the alias
|
||||||
// otherwise it would be a fuckfest trying to figure out where the alias is in the stream
|
// otherwise it would be a fuckfest trying to figure out where the alias is in the stream
|
||||||
@ -489,8 +489,7 @@ namespace Components
|
|||||||
this->buffer.pushBlock(Game::XFILE_BLOCK_TEMP);
|
this->buffer.pushBlock(Game::XFILE_BLOCK_TEMP);
|
||||||
this->buffer.align(Utils::Stream::ALIGN_4);
|
this->buffer.align(Utils::Stream::ALIGN_4);
|
||||||
|
|
||||||
Logger::DebugInfo("Saving ({}): {}",
|
Logger::Debug("Saving ({}): {}", Game::DB_GetXAssetTypeName(asset.type), Game::DB_GetXAssetNameHandlers[asset.type](&asset.header));
|
||||||
Game::DB_GetXAssetTypeName(asset.type), Game::DB_GetXAssetNameHandlers[asset.type](&asset.header));
|
|
||||||
|
|
||||||
this->store(asset.header);
|
this->store(asset.header);
|
||||||
AssetHandler::ZoneSave(asset, this);
|
AssetHandler::ZoneSave(asset, this);
|
||||||
|
Loading…
Reference in New Issue
Block a user