[Command] Use pointers instead of an abstraction interface for params
This commit is contained in:
parent
8745f774e5
commit
788ccae967
@ -470,7 +470,7 @@ namespace Components
|
|||||||
AntiCheat::Hash.clear();
|
AntiCheat::Hash.clear();
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Command::Add("penis", [] (Command::Params)
|
Command::Add("penis", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
AntiCheat::CrashClient();
|
AntiCheat::CrashClient();
|
||||||
});
|
});
|
||||||
|
@ -67,7 +67,7 @@ namespace Components
|
|||||||
std::string connectString(format, len);
|
std::string connectString(format, len);
|
||||||
Game::SV_Cmd_TokenizeString(connectString.data());
|
Game::SV_Cmd_TokenizeString(connectString.data());
|
||||||
|
|
||||||
Command::IServerParams params;
|
Command::ServerParams params;
|
||||||
|
|
||||||
if (params.length() < 3)
|
if (params.length() < 3)
|
||||||
{
|
{
|
||||||
@ -141,7 +141,7 @@ namespace Components
|
|||||||
Game::SV_Cmd_TokenizeString(connectData.infostring().data());
|
Game::SV_Cmd_TokenizeString(connectData.infostring().data());
|
||||||
|
|
||||||
// Access the params
|
// Access the params
|
||||||
Command::IServerParams params;
|
Command::ServerParams params;
|
||||||
|
|
||||||
// Ensure there are enough params
|
// Ensure there are enough params
|
||||||
if (params.length() < 3)
|
if (params.length() < 3)
|
||||||
@ -386,16 +386,16 @@ namespace Components
|
|||||||
Utils::Hook(0x41D3E3, Auth::SendConnectDataStub, HOOK_CALL).install()->quick();
|
Utils::Hook(0x41D3E3, Auth::SendConnectDataStub, HOOK_CALL).install()->quick();
|
||||||
|
|
||||||
// Guid command
|
// Guid command
|
||||||
Command::Add("guid", [] (Command::Params)
|
Command::Add("guid", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
Logger::Print("Your guid: %llX\n", Steam::SteamUser()->GetSteamID().Bits);
|
Logger::Print("Your guid: %llX\n", Steam::SteamUser()->GetSteamID().Bits);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled())
|
if (!Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled())
|
||||||
{
|
{
|
||||||
Command::Add("securityLevel", [] (Command::Params params)
|
Command::Add("securityLevel", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() < 2)
|
if (params->length() < 2)
|
||||||
{
|
{
|
||||||
uint32_t level = Auth::GetZeroBits(Auth::GuidToken, Auth::GuidKey.getPublicKey());
|
uint32_t level = Auth::GetZeroBits(Auth::GuidToken, Auth::GuidKey.getPublicKey());
|
||||||
Logger::Print("Your current security level is %d\n", level);
|
Logger::Print("Your current security level is %d\n", level);
|
||||||
@ -406,7 +406,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint32_t level = static_cast<uint32_t>(atoi(params[1]));
|
uint32_t level = static_cast<uint32_t>(atoi(params->get(1)));
|
||||||
Auth::IncreaseSecurityLevel(level);
|
Auth::IncreaseSecurityLevel(level);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -187,14 +187,14 @@ namespace Components
|
|||||||
|
|
||||||
Bans::Bans()
|
Bans::Bans()
|
||||||
{
|
{
|
||||||
Command::Add("banclient", [] (Command::Params params)
|
Command::Add("banclient", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() < 2) return;
|
if (params->length() < 2) return;
|
||||||
|
|
||||||
std::string reason = "EXE_ERR_BANNED_PERM";
|
std::string reason = "EXE_ERR_BANNED_PERM";
|
||||||
if (params.length() >= 3) reason = params[2];
|
if (params->length() >= 3) reason = params->get(2);
|
||||||
|
|
||||||
Bans::BanClientNum(atoi(params[1]), reason);
|
Bans::BanClientNum(atoi(params->get(1)), reason);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Verify the list on startup
|
// Verify the list on startup
|
||||||
|
@ -44,18 +44,18 @@ namespace Components
|
|||||||
BitMessage::BMClient->start();
|
BitMessage::BMClient->start();
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Command::Add("bm_send", [] (Command::Params params)
|
Command::Add("bm_send", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() < 3) return;
|
if (params->length() < 3) return;
|
||||||
|
|
||||||
ustring pubAddrString;
|
ustring pubAddrString;
|
||||||
pubAddrString.fromString(params[1]);
|
pubAddrString.fromString(params->get(1));
|
||||||
|
|
||||||
PubAddr pubAddr;
|
PubAddr pubAddr;
|
||||||
if (pubAddr.loadAddr(pubAddrString))
|
if (pubAddr.loadAddr(pubAddrString))
|
||||||
{
|
{
|
||||||
ustring msg;
|
ustring msg;
|
||||||
msg.fromString(params.join(2));
|
msg.fromString(params->join(2));
|
||||||
|
|
||||||
Logger::Print("Sending message (this may take a while)...\n");
|
Logger::Print("Sending message (this may take a while)...\n");
|
||||||
BitMessage::BMClient->sendMessage(msg, pubAddr, BitMessage::BMClient->PrivAddresses[0]);
|
BitMessage::BMClient->sendMessage(msg, pubAddr, BitMessage::BMClient->PrivAddresses[0]);
|
||||||
@ -67,18 +67,18 @@ namespace Components
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("bm_sendb", [] (Command::Params params)
|
Command::Add("bm_sendb", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() < 2) return;
|
if (params->length() < 2) return;
|
||||||
|
|
||||||
ustring msg;
|
ustring msg;
|
||||||
msg.appendVarString(params.join(1));
|
msg.appendVarString(params->join(1));
|
||||||
Logger::Print("Sending broadcast...\n");
|
Logger::Print("Sending broadcast...\n");
|
||||||
BitMessage::BMClient->sendBroadcast(msg, BitMessage::BMClient->PrivAddresses[0]);
|
BitMessage::BMClient->sendBroadcast(msg, BitMessage::BMClient->PrivAddresses[0]);
|
||||||
Logger::Print("Broadcast done.\n");
|
Logger::Print("Broadcast done.\n");
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("bm_check_messages", [] (Command::Params)
|
Command::Add("bm_check_messages", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
if (!BitMessage::BMClient) return;
|
if (!BitMessage::BMClient) return;
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("bm_check_connections", [] (Command::Params)
|
Command::Add("bm_check_connections", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
if (!BitMessage::BMClient) return;
|
if (!BitMessage::BMClient) return;
|
||||||
std::shared_lock<std::shared_timed_mutex> mlock(BitMessage::BMClient->mutex_nodes);
|
std::shared_lock<std::shared_timed_mutex> mlock(BitMessage::BMClient->mutex_nodes);
|
||||||
@ -116,7 +116,7 @@ namespace Components
|
|||||||
mlock.unlock();
|
mlock.unlock();
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("bm_check_privatekey", [] (Command::Params)
|
Command::Add("bm_check_privatekey", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
if (!BitMessage::BMClient) return;
|
if (!BitMessage::BMClient) return;
|
||||||
std::shared_lock<std::shared_timed_mutex> mlock(BitMessage::BMClient->mutex_priv);
|
std::shared_lock<std::shared_timed_mutex> mlock(BitMessage::BMClient->mutex_priv);
|
||||||
@ -136,7 +136,7 @@ namespace Components
|
|||||||
mlock.unlock();
|
mlock.unlock();
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("bm_check_publickey", [] (Command::Params)
|
Command::Add("bm_check_publickey", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
if (!BitMessage::BMClient) return;
|
if (!BitMessage::BMClient) return;
|
||||||
std::shared_lock<std::shared_timed_mutex> mlock(BitMessage::BMClient->mutex_pub);
|
std::shared_lock<std::shared_timed_mutex> mlock(BitMessage::BMClient->mutex_pub);
|
||||||
@ -154,18 +154,18 @@ namespace Components
|
|||||||
mlock.unlock();
|
mlock.unlock();
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("bm_save", [] (Command::Params)
|
Command::Add("bm_save", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
BitMessage::Save();
|
BitMessage::Save();
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("bm_address_public", [] (Command::Params params)
|
Command::Add("bm_address_public", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (!BitMessage::BMClient) return;
|
if (!BitMessage::BMClient) return;
|
||||||
if (params.length() < 2) return;
|
if (params->length() < 2) return;
|
||||||
|
|
||||||
ustring addre;
|
ustring addre;
|
||||||
addre.fromString(params.join(1));
|
addre.fromString(params->join(1));
|
||||||
|
|
||||||
PubAddr address;
|
PubAddr address;
|
||||||
if (address.loadAddr(addre))
|
if (address.loadAddr(addre))
|
||||||
@ -180,13 +180,13 @@ namespace Components
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("bm_address_broadcast", [] (Command::Params params)
|
Command::Add("bm_address_broadcast", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (!BitMessage::BMClient) return;
|
if (!BitMessage::BMClient) return;
|
||||||
if (params.length() < 2) return;
|
if (params->length() < 2) return;
|
||||||
|
|
||||||
ustring addre;
|
ustring addre;
|
||||||
addre.fromString(params.join(1));
|
addre.fromString(params->join(1));
|
||||||
PubAddr address;
|
PubAddr address;
|
||||||
if (address.loadAddr(addre))
|
if (address.loadAddr(addre))
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@ namespace Components
|
|||||||
std::map<std::string, wink::slot<Command::Callback>> Command::FunctionMap;
|
std::map<std::string, wink::slot<Command::Callback>> Command::FunctionMap;
|
||||||
std::map<std::string, wink::slot<Command::Callback>> Command::FunctionMapSV;
|
std::map<std::string, wink::slot<Command::Callback>> Command::FunctionMapSV;
|
||||||
|
|
||||||
std::string Command::IParams::join(size_t startIndex)
|
std::string Command::Params::join(size_t startIndex)
|
||||||
{
|
{
|
||||||
std::string result;
|
std::string result;
|
||||||
|
|
||||||
@ -19,24 +19,29 @@ namespace Components
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* Command::IClientParams::operator[](size_t index)
|
char* Command::Params::operator[](size_t index)
|
||||||
|
{
|
||||||
|
return this->get(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
char* Command::ClientParams::get(size_t index)
|
||||||
{
|
{
|
||||||
if (index >= this->length()) return "";
|
if (index >= this->length()) return "";
|
||||||
return Game::cmd_argv[this->commandId][index];
|
return Game::cmd_argv[this->commandId][index];
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Command::IClientParams::length()
|
size_t Command::ClientParams::length()
|
||||||
{
|
{
|
||||||
return Game::cmd_argc[this->commandId];
|
return Game::cmd_argc[this->commandId];
|
||||||
}
|
}
|
||||||
|
|
||||||
char* Command::IServerParams::operator[](size_t index)
|
char* Command::ServerParams::get(size_t index)
|
||||||
{
|
{
|
||||||
if (index >= this->length()) return "";
|
if (index >= this->length()) return "";
|
||||||
return Game::cmd_argv_sv[this->commandId][index];
|
return Game::cmd_argv_sv[this->commandId][index];
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Command::IServerParams::length()
|
size_t Command::ServerParams::length()
|
||||||
{
|
{
|
||||||
return Game::cmd_argc_sv[this->commandId];
|
return Game::cmd_argc_sv[this->commandId];
|
||||||
}
|
}
|
||||||
@ -130,7 +135,7 @@ namespace Components
|
|||||||
|
|
||||||
void Command::MainCallback()
|
void Command::MainCallback()
|
||||||
{
|
{
|
||||||
Command::IClientParams params(*Game::cmd_id);
|
Command::ClientParams params(*Game::cmd_id);
|
||||||
|
|
||||||
std::string command = Utils::String::ToLower(params[0]);
|
std::string command = Utils::String::ToLower(params[0]);
|
||||||
|
|
||||||
@ -142,7 +147,7 @@ namespace Components
|
|||||||
|
|
||||||
void Command::MainCallbackSV()
|
void Command::MainCallbackSV()
|
||||||
{
|
{
|
||||||
Command::IServerParams params(*Game::cmd_id_sv);
|
Command::ServerParams params(*Game::cmd_id_sv);
|
||||||
|
|
||||||
std::string command = Utils::String::ToLower(params[0]);
|
std::string command = Utils::String::ToLower(params[0]);
|
||||||
|
|
||||||
@ -159,7 +164,7 @@ namespace Components
|
|||||||
// Disable native noclip command
|
// Disable native noclip command
|
||||||
Utils::Hook::Nop(0x474846, 5);
|
Utils::Hook::Nop(0x474846, 5);
|
||||||
|
|
||||||
Command::Add("noclip", [] (Command::Params)
|
Command::Add("noclip", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
int clientNum = Game::CG_GetClientNum();
|
int clientNum = Game::CG_GetClientNum();
|
||||||
if (!Game::CL_IsCgameInitialized() || clientNum >= 18 || clientNum < 0 || !Game::g_entities[clientNum].client)
|
if (!Game::CL_IsCgameInitialized() || clientNum >= 18 || clientNum < 0 || !Game::g_entities[clientNum].client)
|
||||||
@ -182,7 +187,7 @@ namespace Components
|
|||||||
Toast::Show("cardicon_abduction", "Success", "Noclip toggled", 3000);
|
Toast::Show("cardicon_abduction", "Success", "Noclip toggled", 3000);
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("ufo", [] (Command::Params)
|
Command::Add("ufo", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
int clientNum = Game::CG_GetClientNum();
|
int clientNum = Game::CG_GetClientNum();
|
||||||
if (!Game::CL_IsCgameInitialized() || clientNum >= 18 || clientNum < 0 || !Game::g_entities[clientNum].client)
|
if (!Game::CL_IsCgameInitialized() || clientNum >= 18 || clientNum < 0 || !Game::g_entities[clientNum].client)
|
||||||
@ -205,7 +210,7 @@ namespace Components
|
|||||||
Toast::Show("cardicon_abduction", "Success", "UFO toggled", 3000);
|
Toast::Show("cardicon_abduction", "Success", "UFO toggled", 3000);
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("setviewpos", [](Command::Params params)
|
Command::Add("setviewpos", [](Command::Params* params)
|
||||||
{
|
{
|
||||||
int clientNum = Game::CG_GetClientNum();
|
int clientNum = Game::CG_GetClientNum();
|
||||||
if (!Game::CL_IsCgameInitialized() || clientNum >= 18 || clientNum < 0 || !Game::g_entities[clientNum].client)
|
if (!Game::CL_IsCgameInitialized() || clientNum >= 18 || clientNum < 0 || !Game::g_entities[clientNum].client)
|
||||||
@ -222,7 +227,7 @@ namespace Components
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.length() != 4 && params.length() != 6)
|
if (params->length() != 4 && params->length() != 6)
|
||||||
{
|
{
|
||||||
Logger::Print("Invalid coordinate specified!\n");
|
Logger::Print("Invalid coordinate specified!\n");
|
||||||
Toast::Show("cardicon_stop", "Error", "Invalid coordinate specified!", 3000);
|
Toast::Show("cardicon_stop", "Error", "Invalid coordinate specified!", 3000);
|
||||||
@ -232,14 +237,14 @@ namespace Components
|
|||||||
float pos[3] = { 0.0f, 0.0f, 0.0f };
|
float pos[3] = { 0.0f, 0.0f, 0.0f };
|
||||||
float orientation[3] = { 0.0f, 0.0f, 0.0f };
|
float orientation[3] = { 0.0f, 0.0f, 0.0f };
|
||||||
|
|
||||||
pos[0] = strtof(params[1], NULL);
|
pos[0] = strtof(params->get(1), NULL);
|
||||||
pos[1] = strtof(params[2], NULL);
|
pos[1] = strtof(params->get(2), NULL);
|
||||||
pos[2] = strtof(params[3], NULL);
|
pos[2] = strtof(params->get(3), NULL);
|
||||||
|
|
||||||
if(params.length() == 6)
|
if(params->length() == 6)
|
||||||
{
|
{
|
||||||
orientation[0] = strtof(params[4], NULL);
|
orientation[0] = strtof(params->get(4), NULL);
|
||||||
orientation[1] = strtof(params[5], NULL);
|
orientation[1] = strtof(params->get(5), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::TeleportPlayer(&Game::g_entities[clientNum], pos, orientation);
|
Game::TeleportPlayer(&Game::g_entities[clientNum], pos, orientation);
|
||||||
|
@ -3,79 +3,47 @@ namespace Components
|
|||||||
class Command : public Component
|
class Command : public Component
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
class IParams
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
IParams() {};
|
|
||||||
virtual ~IParams() {};
|
|
||||||
virtual char* operator[](size_t index) = 0;
|
|
||||||
virtual size_t length() = 0;
|
|
||||||
virtual std::string join(size_t startIndex);
|
|
||||||
};
|
|
||||||
|
|
||||||
class IClientParams : public IParams
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
IClientParams(unsigned int id) : commandId(id) {};
|
|
||||||
IClientParams(const IClientParams &obj) : commandId(obj.commandId) {};
|
|
||||||
IClientParams() : IClientParams(*Game::cmd_id) {};
|
|
||||||
|
|
||||||
~IClientParams() {};
|
|
||||||
char* operator[](size_t index) override;
|
|
||||||
size_t length() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
unsigned int commandId;
|
|
||||||
};
|
|
||||||
|
|
||||||
class IServerParams : public IParams
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
IServerParams(unsigned int id) : commandId(id) {};
|
|
||||||
IServerParams(const IServerParams &obj) : commandId(obj.commandId) {};
|
|
||||||
IServerParams() : IServerParams(*Game::cmd_id_sv) {};
|
|
||||||
|
|
||||||
~IServerParams() {};
|
|
||||||
char* operator[](size_t index) override;
|
|
||||||
size_t length() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
unsigned int commandId;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Params
|
class Params
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Params(IParams* _paramInterface) : paramInterface(_paramInterface)
|
Params() {};
|
||||||
{
|
virtual ~Params() {};
|
||||||
if (!paramInterface)
|
virtual char* get(size_t index) = 0;
|
||||||
{
|
virtual size_t length() = 0;
|
||||||
throw new std::invalid_argument("Invalid command parameter interface!");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Params(const Params &obj) : paramInterface(obj.paramInterface) {};
|
virtual std::string join(size_t startIndex);
|
||||||
|
virtual char* operator[](size_t index);
|
||||||
char* operator[](size_t index)
|
|
||||||
{
|
|
||||||
return paramInterface->operator[](index);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t length()
|
|
||||||
{
|
|
||||||
return paramInterface->length();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string join(size_t startIndex)
|
|
||||||
{
|
|
||||||
return paramInterface->join(startIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
IParams* paramInterface;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void(Callback)(Command::Params params);
|
class ClientParams : public Params
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ClientParams(unsigned int id) : commandId(id) {};
|
||||||
|
ClientParams(const ClientParams &obj) : commandId(obj.commandId) {};
|
||||||
|
ClientParams() : ClientParams(*Game::cmd_id) {};
|
||||||
|
|
||||||
|
char* get(size_t index) override;
|
||||||
|
size_t length() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned int commandId;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ServerParams : public Params
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ServerParams(unsigned int id) : commandId(id) {};
|
||||||
|
ServerParams(const ServerParams &obj) : commandId(obj.commandId) {};
|
||||||
|
ServerParams() : ServerParams(*Game::cmd_id_sv) {};
|
||||||
|
|
||||||
|
char* get(size_t index) override;
|
||||||
|
size_t length() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned int commandId;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef void(Callback)(Command::Params* params);
|
||||||
|
|
||||||
Command();
|
Command();
|
||||||
~Command();
|
~Command();
|
||||||
|
@ -333,11 +333,11 @@ namespace Components
|
|||||||
Dvar::Register<const char*>("sv_motd", "", Game::dvar_flag::DVAR_FLAG_NONE, "A custom message of the day for servers");
|
Dvar::Register<const char*>("sv_motd", "", Game::dvar_flag::DVAR_FLAG_NONE, "A custom message of the day for servers");
|
||||||
|
|
||||||
// Say command
|
// Say command
|
||||||
Command::AddSV("say", [] (Command::Params params)
|
Command::AddSV("say", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() < 2) return;
|
if (params->length() < 2) return;
|
||||||
|
|
||||||
std::string message = params.join(1);
|
std::string message = params->join(1);
|
||||||
std::string name = Dvar::Var("sv_sayName").get<std::string>();
|
std::string name = Dvar::Var("sv_sayName").get<std::string>();
|
||||||
|
|
||||||
if (!name.empty())
|
if (!name.empty())
|
||||||
@ -353,12 +353,12 @@ namespace Components
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Tell command
|
// Tell command
|
||||||
Command::AddSV("tell", [] (Command::Params params)
|
Command::AddSV("tell", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() < 3) return;
|
if (params->length() < 3) return;
|
||||||
|
|
||||||
int client = atoi(params[1]);
|
int client = atoi(params->get(1));
|
||||||
std::string message = params.join(2);
|
std::string message = params->join(2);
|
||||||
std::string name = Dvar::Var("sv_sayName").get<std::string>();
|
std::string name = Dvar::Var("sv_sayName").get<std::string>();
|
||||||
|
|
||||||
if (!name.empty())
|
if (!name.empty())
|
||||||
@ -374,35 +374,35 @@ namespace Components
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Sayraw command
|
// Sayraw command
|
||||||
Command::AddSV("sayraw", [] (Command::Params params)
|
Command::AddSV("sayraw", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() < 2) return;
|
if (params->length() < 2) return;
|
||||||
|
|
||||||
std::string message = params.join(1);
|
std::string message = params->join(1);
|
||||||
Game::SV_GameSendServerCommand(-1, 0, Utils::String::VA("%c \"%s\"", 104, message.data()));
|
Game::SV_GameSendServerCommand(-1, 0, Utils::String::VA("%c \"%s\"", 104, message.data()));
|
||||||
Game::Com_Printf(15, "Raw: %s\n", message.data());
|
Game::Com_Printf(15, "Raw: %s\n", message.data());
|
||||||
});
|
});
|
||||||
|
|
||||||
// Tellraw command
|
// Tellraw command
|
||||||
Command::AddSV("tellraw", [] (Command::Params params)
|
Command::AddSV("tellraw", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() < 3) return;
|
if (params->length() < 3) return;
|
||||||
|
|
||||||
int client = atoi(params[1]);
|
int client = atoi(params->get(1));
|
||||||
std::string message = params.join(2);
|
std::string message = params->join(2);
|
||||||
Game::SV_GameSendServerCommand(client, 0, Utils::String::VA("%c \"%s\"", 104, message.data()));
|
Game::SV_GameSendServerCommand(client, 0, Utils::String::VA("%c \"%s\"", 104, message.data()));
|
||||||
Game::Com_Printf(15, "Raw -> %i: %s\n", client, message.data());
|
Game::Com_Printf(15, "Raw -> %i: %s\n", client, message.data());
|
||||||
});
|
});
|
||||||
|
|
||||||
// ! command
|
// ! command
|
||||||
Command::AddSV("!", [] (Command::Params params)
|
Command::AddSV("!", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() != 2) return;
|
if (params->length() != 2) return;
|
||||||
|
|
||||||
int client = -1;
|
int client = -1;
|
||||||
if (params[1] != "all"s)
|
if (params->get(1) != "all"s)
|
||||||
{
|
{
|
||||||
client = atoi(params[1]);
|
client = atoi(params->get(1));
|
||||||
|
|
||||||
if (client >= *reinterpret_cast<int*>(0x31D938C))
|
if (client >= *reinterpret_cast<int*>(0x31D938C))
|
||||||
{
|
{
|
||||||
|
@ -97,12 +97,12 @@ namespace Components
|
|||||||
|
|
||||||
//Utils::Hook(0x4B241F, Exception::ErrorLongJmp, HOOK_CALL).install()->quick();
|
//Utils::Hook(0x4B241F, Exception::ErrorLongJmp, HOOK_CALL).install()->quick();
|
||||||
|
|
||||||
Command::Add("mapTest", [](Command::Params params)
|
Command::Add("mapTest", [](Command::Params* params)
|
||||||
{
|
{
|
||||||
Game::UI_UpdateArenas();
|
Game::UI_UpdateArenas();
|
||||||
|
|
||||||
std::string command;
|
std::string command;
|
||||||
for (int i = 0; i < (params.length() >= 2 ? atoi(params[1]) : *Game::arenaCount); ++i)
|
for (int i = 0; i < (params->length() >= 2 ? atoi(params->get(1)) : *Game::arenaCount); ++i)
|
||||||
{
|
{
|
||||||
char* mapname = ArenaLength::NewArenas[i % *Game::arenaCount].mapName;
|
char* mapname = ArenaLength::NewArenas[i % *Game::arenaCount].mapName;
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ namespace Components
|
|||||||
Command::Execute(command, false);
|
Command::Execute(command, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("debug_exceptionhandler", [](Command::Params)
|
Command::Add("debug_exceptionhandler", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
Logger::Print("Rerunning SetUnhandledExceptionHandler...\n");
|
Logger::Print("Rerunning SetUnhandledExceptionHandler...\n");
|
||||||
auto oldHandler = Exception::Hook();
|
auto oldHandler = Exception::Hook();
|
||||||
@ -123,7 +123,7 @@ namespace Components
|
|||||||
|
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable:4740) // flow in or out of inline asm code suppresses global optimization
|
#pragma warning(disable:4740) // flow in or out of inline asm code suppresses global optimization
|
||||||
Command::Add("debug_minidump", [](Command::Params)
|
Command::Add("debug_minidump", [](Command::Params*)
|
||||||
{
|
{
|
||||||
// The following code was taken from VC++ 8.0 CRT (invarg.c: line 104)
|
// The following code was taken from VC++ 8.0 CRT (invarg.c: line 104)
|
||||||
|
|
||||||
|
@ -454,12 +454,12 @@ namespace Components
|
|||||||
Game::R_AddCmdDrawText(Utils::String::VA("Loading FastFile: %s", FastFiles::Current().data()), 0x7FFFFFFF, font, 5.0f, static_cast<float>(Renderer::Height() - 5), 1.0f, 1.0f, 0.0f, color, Game::ITEM_TEXTSTYLE_NORMAL);
|
Game::R_AddCmdDrawText(Utils::String::VA("Loading FastFile: %s", FastFiles::Current().data()), 0x7FFFFFFF, font, 5.0f, static_cast<float>(Renderer::Height() - 5), 1.0f, 1.0f, 0.0f, color, Game::ITEM_TEXTSTYLE_NORMAL);
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("loadzone", [] (Command::Params params)
|
Command::Add("loadzone", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() < 2) return;
|
if (params->length() < 2) return;
|
||||||
|
|
||||||
Game::XZoneInfo info;
|
Game::XZoneInfo info;
|
||||||
info.name = params[1];
|
info.name = params->get(1);
|
||||||
info.allocFlags = 1;//0x01000000;
|
info.allocFlags = 1;//0x01000000;
|
||||||
info.freeFlags = 0;
|
info.freeFlags = 0;
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ namespace Components
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Test pipe functionality by sending pings
|
// Test pipe functionality by sending pings
|
||||||
Command::Add("ipcping", [] (Command::Params)
|
Command::Add("ipcping", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
Logger::Print("Sending ping to pipe!\n");
|
Logger::Print("Sending ping to pipe!\n");
|
||||||
IPCPipe::Write("ping", "");
|
IPCPipe::Write("ping", "");
|
||||||
|
@ -203,11 +203,11 @@ namespace Components
|
|||||||
|
|
||||||
Dvar::OnInit([] ()
|
Dvar::OnInit([] ()
|
||||||
{
|
{
|
||||||
Command::AddSV("log_add", [] (Command::Params params)
|
Command::AddSV("log_add", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() < 2) return;
|
if (params->length() < 2) return;
|
||||||
|
|
||||||
Network::Address addr(params[1]);
|
Network::Address addr(params->get(1));
|
||||||
|
|
||||||
if (std::find(Logger::LoggingAddresses[0].begin(), Logger::LoggingAddresses[0].end(), addr) == Logger::LoggingAddresses[0].end())
|
if (std::find(Logger::LoggingAddresses[0].begin(), Logger::LoggingAddresses[0].end(), addr) == Logger::LoggingAddresses[0].end())
|
||||||
{
|
{
|
||||||
@ -215,12 +215,12 @@ namespace Components
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::AddSV("log_del", [] (Command::Params params)
|
Command::AddSV("log_del", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() < 2) return;
|
if (params->length() < 2) return;
|
||||||
|
|
||||||
int num = atoi(params[1]);
|
int num = atoi(params->get(1));
|
||||||
if (fmt::sprintf("%i", num) == params[1] && static_cast<unsigned int>(num) < Logger::LoggingAddresses[0].size())
|
if (fmt::sprintf("%i", num) == params->get(1) && static_cast<unsigned int>(num) < Logger::LoggingAddresses[0].size())
|
||||||
{
|
{
|
||||||
auto addr = Logger::LoggingAddresses[0].begin() + num;
|
auto addr = Logger::LoggingAddresses[0].begin() + num;
|
||||||
Logger::Print("Address %s removed\n", addr->getCString());
|
Logger::Print("Address %s removed\n", addr->getCString());
|
||||||
@ -228,7 +228,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Network::Address addr(params[1]);
|
Network::Address addr(params->get(1));
|
||||||
|
|
||||||
auto i = std::find(Logger::LoggingAddresses[0].begin(), Logger::LoggingAddresses[0].end(), addr);
|
auto i = std::find(Logger::LoggingAddresses[0].begin(), Logger::LoggingAddresses[0].end(), addr);
|
||||||
if (i != Logger::LoggingAddresses[0].end())
|
if (i != Logger::LoggingAddresses[0].end())
|
||||||
@ -243,7 +243,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::AddSV("log_list", [] (Command::Params)
|
Command::AddSV("log_list", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
Logger::Print("# ID: Address\n");
|
Logger::Print("# ID: Address\n");
|
||||||
Logger::Print("-------------\n");
|
Logger::Print("-------------\n");
|
||||||
@ -254,11 +254,11 @@ namespace Components
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::AddSV("g_log_add", [] (Command::Params params)
|
Command::AddSV("g_log_add", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() < 2) return;
|
if (params->length() < 2) return;
|
||||||
|
|
||||||
Network::Address addr(params[1]);
|
Network::Address addr(params->get(1));
|
||||||
|
|
||||||
if (std::find(Logger::LoggingAddresses[1].begin(), Logger::LoggingAddresses[1].end(), addr) == Logger::LoggingAddresses[1].end())
|
if (std::find(Logger::LoggingAddresses[1].begin(), Logger::LoggingAddresses[1].end(), addr) == Logger::LoggingAddresses[1].end())
|
||||||
{
|
{
|
||||||
@ -266,12 +266,12 @@ namespace Components
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::AddSV("g_log_del", [] (Command::Params params)
|
Command::AddSV("g_log_del", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() < 2) return;
|
if (params->length() < 2) return;
|
||||||
|
|
||||||
int num = atoi(params[1]);
|
int num = atoi(params->get(1));
|
||||||
if (fmt::sprintf("%i", num) == params[1] && static_cast<unsigned int>(num) < Logger::LoggingAddresses[1].size())
|
if (fmt::sprintf("%i", num) == params->get(1) && static_cast<unsigned int>(num) < Logger::LoggingAddresses[1].size())
|
||||||
{
|
{
|
||||||
auto addr = Logger::LoggingAddresses[1].begin() + num;
|
auto addr = Logger::LoggingAddresses[1].begin() + num;
|
||||||
Logger::Print("Address %s removed\n", addr->getCString());
|
Logger::Print("Address %s removed\n", addr->getCString());
|
||||||
@ -279,7 +279,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Network::Address addr(params[1]);
|
Network::Address addr(params->get(1));
|
||||||
|
|
||||||
auto i = std::find(Logger::LoggingAddresses[1].begin(), Logger::LoggingAddresses[1].end(), addr);
|
auto i = std::find(Logger::LoggingAddresses[1].begin(), Logger::LoggingAddresses[1].end(), addr);
|
||||||
if (i != Logger::LoggingAddresses[1].end())
|
if (i != Logger::LoggingAddresses[1].end())
|
||||||
@ -294,7 +294,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::AddSV("g_log_list", [] (Command::Params)
|
Command::AddSV("g_log_list", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
Logger::Print("# ID: Address\n");
|
Logger::Print("# ID: Address\n");
|
||||||
Logger::Print("-------------\n");
|
Logger::Print("-------------\n");
|
||||||
|
@ -586,7 +586,7 @@ namespace Components
|
|||||||
//Maps::AddDependency("mp_shipment", "mp_shipment_long");
|
//Maps::AddDependency("mp_shipment", "mp_shipment_long");
|
||||||
|
|
||||||
#if defined(DEBUG) && defined(ENABLE_DXSDK)
|
#if defined(DEBUG) && defined(ENABLE_DXSDK)
|
||||||
Command::Add("dumpmap", [] (Command::Params)
|
Command::Add("dumpmap", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled())
|
if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled())
|
||||||
{
|
{
|
||||||
|
@ -646,9 +646,9 @@ namespace Components
|
|||||||
//make Com_Error and similar go back to main_text instead of menu_xboxlive.
|
//make Com_Error and similar go back to main_text instead of menu_xboxlive.
|
||||||
Utils::Hook::SetString(0x6FC790, "main_text");
|
Utils::Hook::SetString(0x6FC790, "main_text");
|
||||||
|
|
||||||
Command::Add("openmenu", [] (Command::Params params)
|
Command::Add("openmenu", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() != 2)
|
if (params->length() != 2)
|
||||||
{
|
{
|
||||||
Logger::Print("USAGE: openmenu <menu name>\n");
|
Logger::Print("USAGE: openmenu <menu name>\n");
|
||||||
return;
|
return;
|
||||||
@ -660,10 +660,10 @@ namespace Components
|
|||||||
Game::Key_SetCatcher(0, 16);
|
Game::Key_SetCatcher(0, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::Menus_OpenByName(Game::uiContext, params[1]);
|
Game::Menus_OpenByName(Game::uiContext, params->get(1));
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("reloadmenus", [] (Command::Params)
|
Command::Add("reloadmenus", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
// Close all menus
|
// Close all menus
|
||||||
Game::Menus_CloseAll(Game::uiContext);
|
Game::Menus_CloseAll(Game::uiContext);
|
||||||
@ -686,7 +686,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("mp_QuickMessage", [] (Command::Params)
|
Command::Add("mp_QuickMessage", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
Command::Execute("openmenu quickmessage");
|
Command::Execute("openmenu quickmessage");
|
||||||
});
|
});
|
||||||
|
@ -117,12 +117,12 @@ namespace Components
|
|||||||
Utils::Hook::Nop(0x6388BB, 2); // skip the "if (item->text[0] == '@')" localize check
|
Utils::Hook::Nop(0x6388BB, 2); // skip the "if (item->text[0] == '@')" localize check
|
||||||
Utils::Hook(0x6388C1, News::GetNewsText, HOOK_CALL).install()->quick();
|
Utils::Hook(0x6388C1, News::GetNewsText, HOOK_CALL).install()->quick();
|
||||||
|
|
||||||
Command::Add("checkforupdate", [] (Command::Params)
|
Command::Add("checkforupdate", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
News::CheckForUpdate();
|
News::CheckForUpdate();
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("getautoupdate", [] (Command::Params)
|
Command::Add("getautoupdate", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
if (!Dvar::Var("cl_updateavailable").get<Game::dvar_t*>()->current.boolean) return;
|
if (!Dvar::Var("cl_updateavailable").get<Game::dvar_t*>()->current.boolean) return;
|
||||||
|
|
||||||
|
@ -835,7 +835,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("listnodes", [] (Command::Params)
|
Command::Add("listnodes", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
Logger::Print("Nodes: %d (%d)\n", Node::Nodes.size(), Node::GetValidNodeCount());
|
Logger::Print("Nodes: %d (%d)\n", Node::Nodes.size(), Node::GetValidNodeCount());
|
||||||
|
|
||||||
@ -846,11 +846,11 @@ namespace Components
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("addnode", [] (Command::Params params)
|
Command::Add("addnode", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() < 2) return;
|
if (params->length() < 2) return;
|
||||||
|
|
||||||
Network::Address address(params[1]);
|
Network::Address address(params->get(1));
|
||||||
Node::AddNode(address);
|
Node::AddNode(address);
|
||||||
|
|
||||||
std::lock_guard<std::mutex> _(Node::NodeMutex);
|
std::lock_guard<std::mutex> _(Node::NodeMutex);
|
||||||
@ -862,7 +862,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("syncnodes", [] (Command::Params)
|
Command::Add("syncnodes", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
Logger::Print("Resynchronizing nodes...\n");
|
Logger::Print("Resynchronizing nodes...\n");
|
||||||
|
|
||||||
|
@ -248,16 +248,16 @@ namespace Components
|
|||||||
// Patch Live_PlayerHasLoopbackAddr
|
// Patch Live_PlayerHasLoopbackAddr
|
||||||
//Utils::Hook::Set<DWORD>(0x418F30, 0x90C3C033);
|
//Utils::Hook::Set<DWORD>(0x418F30, 0x90C3C033);
|
||||||
|
|
||||||
Command::Add("connect", [] (Command::Params params)
|
Command::Add("connect", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() < 2)
|
if (params->length() < 2)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Party::Connect(Network::Address(params[1]));
|
Party::Connect(Network::Address(params->get(1)));
|
||||||
});
|
});
|
||||||
Command::Add("reconnect", [] (Command::Params)
|
Command::Add("reconnect", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
Party::Connect(Party::Container.target);
|
Party::Connect(Party::Container.target);
|
||||||
});
|
});
|
||||||
|
@ -114,7 +114,7 @@ namespace Components
|
|||||||
|
|
||||||
void QuickPatch::CL_HandleRelayPacketCheck(Game::msg_t* msg, int client)
|
void QuickPatch::CL_HandleRelayPacketCheck(Game::msg_t* msg, int client)
|
||||||
{
|
{
|
||||||
if (Command::IClientParams().length() >= 3)
|
if (Command::ClientParams().length() >= 3)
|
||||||
{
|
{
|
||||||
Game::CL_HandleRelayPacket(msg, client);
|
Game::CL_HandleRelayPacket(msg, client);
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ namespace Components
|
|||||||
|
|
||||||
void QuickPatch::SelectStringTableEntryInDvarStub()
|
void QuickPatch::SelectStringTableEntryInDvarStub()
|
||||||
{
|
{
|
||||||
Command::IClientParams args;
|
Command::ClientParams args;
|
||||||
|
|
||||||
if (args.length() >= 4)
|
if (args.length() >= 4)
|
||||||
{
|
{
|
||||||
@ -392,12 +392,12 @@ namespace Components
|
|||||||
// Patch selectStringTableEntryInDvar
|
// Patch selectStringTableEntryInDvar
|
||||||
Utils::Hook::Set(0x405959, QuickPatch::SelectStringTableEntryInDvarStub);
|
Utils::Hook::Set(0x405959, QuickPatch::SelectStringTableEntryInDvarStub);
|
||||||
|
|
||||||
Command::Add("unlockstats", [] (Command::Params)
|
Command::Add("unlockstats", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
QuickPatch::UnlockStats();
|
QuickPatch::UnlockStats();
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("crash", [] (Command::Params)
|
Command::Add("crash", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
throw new std::exception();
|
throw new std::exception();
|
||||||
});
|
});
|
||||||
|
@ -9,15 +9,15 @@ namespace Components
|
|||||||
|
|
||||||
RCon::RCon()
|
RCon::RCon()
|
||||||
{
|
{
|
||||||
Command::Add("rcon", [] (Command::Params params)
|
Command::Add("rcon", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() < 2) return;
|
if (params->length() < 2) return;
|
||||||
|
|
||||||
std::string operation = params[1];
|
std::string operation = params->get(1);
|
||||||
if (operation == "login")
|
if (operation == "login")
|
||||||
{
|
{
|
||||||
if (params.length() < 3) return;
|
if (params->length() < 3) return;
|
||||||
RCon::Password = params[2];
|
RCon::Password = params->get(2);
|
||||||
}
|
}
|
||||||
else if (operation == "logout")
|
else if (operation == "logout")
|
||||||
{
|
{
|
||||||
@ -31,7 +31,7 @@ namespace Components
|
|||||||
|
|
||||||
if (target.isValid())
|
if (target.isValid())
|
||||||
{
|
{
|
||||||
Network::SendCommand(target, "rcon", RCon::Password + " " + params.join(1));
|
Network::SendCommand(target, "rcon", RCon::Password + " " + params->join(1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -21,15 +21,15 @@ namespace Components
|
|||||||
// remove fs_game check for moddable rawfiles - allows non-fs_game to modify rawfiles
|
// remove fs_game check for moddable rawfiles - allows non-fs_game to modify rawfiles
|
||||||
Utils::Hook::Nop(0x61AB76, 2);
|
Utils::Hook::Nop(0x61AB76, 2);
|
||||||
|
|
||||||
Command::Add("dumpraw", [] (Command::Params params)
|
Command::Add("dumpraw", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() < 2)
|
if (params->length() < 2)
|
||||||
{
|
{
|
||||||
Logger::Print("Specify a filename!\n");
|
Logger::Print("Specify a filename!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystem::File file(params.join(1));
|
FileSystem::File file(params->join(1));
|
||||||
if (file.exists())
|
if (file.exists())
|
||||||
{
|
{
|
||||||
Utils::IO::WriteFile("raw/" + file.getName(), file.getBuffer());
|
Utils::IO::WriteFile("raw/" + file.getName(), file.getBuffer());
|
||||||
|
@ -127,7 +127,7 @@ namespace Components
|
|||||||
{
|
{
|
||||||
Renderer::OnFrame(Toast::Handler);
|
Renderer::OnFrame(Toast::Handler);
|
||||||
|
|
||||||
Command::Add("testtoast", [] (Command::Params)
|
Command::Add("testtoast", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
Toast::Show("cardicon_prestige10", "Test", "This is a test toast", 3000);
|
Toast::Show("cardicon_prestige10", "Test", "This is a test toast", 3000);
|
||||||
});
|
});
|
||||||
|
@ -540,11 +540,11 @@ namespace Components
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("verifyzone", [] (Command::Params params)
|
Command::Add("verifyzone", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() < 2) return;
|
if (params->length() < 2) return;
|
||||||
|
|
||||||
std::string zone = params[1];
|
std::string zone = params->get(1);
|
||||||
|
|
||||||
ZoneBuilder::BeginAssetTrace(zone);
|
ZoneBuilder::BeginAssetTrace(zone);
|
||||||
|
|
||||||
@ -579,17 +579,17 @@ namespace Components
|
|||||||
Logger::Print("\n");
|
Logger::Print("\n");
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("buildzone", [] (Command::Params params)
|
Command::Add("buildzone", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() < 2) return;
|
if (params->length() < 2) return;
|
||||||
|
|
||||||
std::string zoneName = params[1];
|
std::string zoneName = params->get(1);
|
||||||
Logger::Print("Building zone '%s'...\n", zoneName.data());
|
Logger::Print("Building zone '%s'...\n", zoneName.data());
|
||||||
|
|
||||||
Zone(zoneName).build();
|
Zone(zoneName).build();
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("buildall", [] (Command::Params)
|
Command::Add("buildall", [] (Command::Params*)
|
||||||
{
|
{
|
||||||
auto zoneSources = FileSystem::GetSysFileList(Dvar::Var("fs_basepath").get<std::string>() + "\\zone_source", "csv", false);
|
auto zoneSources = FileSystem::GetSysFileList(Dvar::Var("fs_basepath").get<std::string>() + "\\zone_source", "csv", false);
|
||||||
|
|
||||||
@ -604,10 +604,10 @@ namespace Components
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("listassets", [] (Command::Params params)
|
Command::Add("listassets", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
if (params.length() < 2) return;
|
if (params->length() < 2) return;
|
||||||
Game::XAssetType type = Game::DB_GetXAssetNameType(params[1]);
|
Game::XAssetType type = Game::DB_GetXAssetNameType(params->get(1));
|
||||||
|
|
||||||
if (type != Game::XAssetType::ASSET_TYPE_INVALID)
|
if (type != Game::XAssetType::ASSET_TYPE_INVALID)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user