mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Add pak_listtypes command
This commit is contained in:
parent
d9ac275d71
commit
3c3e1c46df
@ -847,6 +847,18 @@ pair<vector<uint8_t>, string> StringToMaskedBytes(const string& svInput, bool bN
|
||||
return make_pair(vBytes, svMask);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// For converting a 32-bit integer into a 4-char ascii string
|
||||
string FourCCToString(int n)
|
||||
{
|
||||
stringstream ss;
|
||||
ss << (char)((n & 0x000000ff) >> 0);
|
||||
ss << (char)((n & 0x0000ff00) >> 8);
|
||||
ss << (char)((n & 0x00ff0000) >> 16);
|
||||
ss << (char)((n & 0xff000000) >> 24);
|
||||
return ss.str();
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// For converting a string pattern with wildcards to an array of bytes.
|
||||
vector<int> PatternToBytes(const string& svInput)
|
||||
|
@ -57,6 +57,8 @@ string& StringLTrim(string& svInput, const char* pszToTrim, bool bTrimBefore = f
|
||||
string& StringRTrim(string& svInput, const char* pszToTrim, bool bTrimAfter = false);
|
||||
string& StringTrim(string& svInput, const char* pszToTrim, bool bTrimAll = false);
|
||||
|
||||
string FourCCToString(int n);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Bytes
|
||||
vector<int> StringToBytes(const string& svInput, bool bNullTerminator);
|
||||
|
@ -378,6 +378,7 @@ void ConCommand::Init(void)
|
||||
ConCommand::Create("pak_requestunload", "Requests unload for specified RPAK file or ID.", FCVAR_DEVELOPMENTONLY, Pak_RequestUnload_f, nullptr);
|
||||
ConCommand::Create("pak_swap", "Requests swap for specified RPAK file or ID", FCVAR_DEVELOPMENTONLY, Pak_Swap_f, nullptr);
|
||||
ConCommand::Create("pak_listpaks", "Display a list of the loaded Pak files.", FCVAR_RELEASE, Pak_ListPaks_f, nullptr);
|
||||
ConCommand::Create("pak_listtypes", "Display a list of the registered asset types.", FCVAR_RELEASE, Pak_ListTypes_f, nullptr);
|
||||
//-------------------------------------------------------------------------
|
||||
// NETCHANNEL |
|
||||
ConCommand::Create("net_setkey", "Sets user specified base64 net key.", FCVAR_RELEASE, NET_SetKey_f, nullptr);
|
||||
|
@ -275,6 +275,34 @@ void Pak_ListPaks_f(const CCommand& args)
|
||||
DevMsg(eDLL_T::RTECH, "|------|----------------------------------------------------|--------------------------------------|-------------|\n");
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
Pak_ListTypes_f
|
||||
=====================
|
||||
*/
|
||||
void Pak_ListTypes_f(const CCommand& args)
|
||||
{
|
||||
DevMsg(eDLL_T::RTECH, "| ext | description | version | header size | native size |\n");
|
||||
DevMsg(eDLL_T::RTECH, "|------|---------------------------|---------|-------------|-------------|\n");
|
||||
|
||||
uint32_t nRegistered = 0;
|
||||
|
||||
for (int8_t i = 0; i < 64; ++i)
|
||||
{
|
||||
RPakAssetBinding_t* type = &g_pUnknownPakStruct->m_nAssetBindings[i];
|
||||
|
||||
if (!type->m_szDescription)
|
||||
continue;
|
||||
|
||||
// todo: make status into a string from an array/vector
|
||||
DevMsg(eDLL_T::RTECH, "| %-4s | %-25s | %7i | %11i | %11i |\n", FourCCToString(type->m_nExtension).c_str(), type->m_szDescription, type->m_iVersion, type->m_iSubHeaderSize, type->m_iNativeClassSize);
|
||||
nRegistered++;
|
||||
}
|
||||
DevMsg(eDLL_T::RTECH, "|------|---------------------------|---------|-------------|-------------|\n");
|
||||
DevMsg(eDLL_T::RTECH, "| %18i registered types. |\n", nRegistered);
|
||||
DevMsg(eDLL_T::RTECH, "|------|---------------------------|---------|-------------|-------------|\n");
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
Pak_RequestUnload_f
|
||||
|
@ -27,6 +27,7 @@ void Host_Changelevel_f(const CCommand& args);
|
||||
void Detour_HotSwap_f(const CCommand& args);
|
||||
#endif // !CLIENT_DLL
|
||||
void Pak_ListPaks_f(const CCommand& args);
|
||||
void Pak_ListTypes_f(const CCommand& args);
|
||||
void Pak_RequestUnload_f(const CCommand& args);
|
||||
void Pak_RequestLoad_f(const CCommand& args);
|
||||
void Pak_Swap_f(const CCommand& args);
|
||||
|
Loading…
x
Reference in New Issue
Block a user