mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Light RTech code cleanup
Use dedicated function for returning pak status as string instead of std::map. reduced compiled code size by 10kb.
This commit is contained in:
parent
bd9cc31599
commit
e12de45eaa
@ -708,6 +708,32 @@ RPakLoadedInfo_t* RTech::GetPakLoadedInfo(const char* szPakName)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: returns pak status as string
|
||||
//-----------------------------------------------------------------------------
|
||||
const char* RTech::PakStatusToString(RPakStatus_t status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case RPakStatus_t::PAK_STATUS_FREED: return "PAK_STATUS_FREED";
|
||||
case RPakStatus_t::PAK_STATUS_LOAD_PENDING: return "PAK_STATUS_LOAD_PENDING";
|
||||
case RPakStatus_t::PAK_STATUS_REPAK_RUNNING: return "PAK_STATUS_REPAK_RUNNING";
|
||||
case RPakStatus_t::PAK_STATUS_REPAK_DONE: return "PAK_STATUS_REPAK_DONE";
|
||||
case RPakStatus_t::PAK_STATUS_LOAD_STARTING: return "PAK_STATUS_LOAD_STARTING";
|
||||
case RPakStatus_t::PAK_STATUS_LOAD_PAKHDR: return "PAK_STATUS_LOAD_PAKHDR";
|
||||
case RPakStatus_t::PAK_STATUS_LOAD_PATCH_INIT: return "PAK_STATUS_LOAD_PATCH_INIT";
|
||||
case RPakStatus_t::PAK_STATUS_LOAD_PATCH_EDIT_STREAM: return "PAK_STATUS_LOAD_PATCH_EDIT_STREAM";
|
||||
case RPakStatus_t::PAK_STATUS_LOAD_ASSETS: return "PAK_STATUS_LOAD_ASSETS";
|
||||
case RPakStatus_t::PAK_STATUS_LOADED: return "PAK_STATUS_LOADED";
|
||||
case RPakStatus_t::PAK_STATUS_UNLOAD_PENDING: return "PAK_STATUS_UNLOAD_PENDING";
|
||||
case RPakStatus_t::PAK_STATUS_FREE_PENDING: return "PAK_STATUS_FREE_PENDING";
|
||||
case RPakStatus_t::PAK_STATUS_CANCELING: return "PAK_STATUS_CANCELING";
|
||||
case RPakStatus_t::PAK_STATUS_ERROR: return "PAK_STATUS_ERROR";
|
||||
case RPakStatus_t::PAK_STATUS_INVALID_PAKHANDLE: return "PAK_STATUS_INVALID_PAKHANDLE";
|
||||
case RPakStatus_t::PAK_STATUS_BUSY: return "PAK_STATUS_BUSY";
|
||||
default: return "PAK_STATUS_UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: process guid relations for asset
|
||||
|
@ -6,8 +6,8 @@
|
||||
#include "public/rendersystem/schema/texture.g.h"
|
||||
#endif // !DEDICATED
|
||||
|
||||
#define PAK_PARAM_SIZE 0xB0
|
||||
#define DCMP_BUF_SIZE 0x400000
|
||||
#define PAK_MAX_TYPES 64
|
||||
#define PAK_PARAM_SIZE 0xB0
|
||||
|
||||
#define RPAKHEADER (('k'<<24)+('a'<<16)+('P'<<8)+'R')
|
||||
|
||||
@ -74,25 +74,6 @@ enum class RPakStatus_t : int32_t
|
||||
PAK_STATUS_BUSY = 15
|
||||
};
|
||||
|
||||
const static std::map<RPakStatus_t, string> g_PakStatusToString {
|
||||
{ RPakStatus_t::PAK_STATUS_FREED, "PAK_STATUS_FREED" },
|
||||
{ RPakStatus_t::PAK_STATUS_LOAD_PENDING, "PAK_STATUS_LOAD_PENDING" },
|
||||
{ RPakStatus_t::PAK_STATUS_REPAK_RUNNING, "PAK_STATUS_REPAK_RUNNING" },
|
||||
{ RPakStatus_t::PAK_STATUS_REPAK_DONE, "PAK_STATUS_REPAK_DONE" },
|
||||
{ RPakStatus_t::PAK_STATUS_LOAD_STARTING, "PAK_STATUS_LOAD_STARTING" },
|
||||
{ RPakStatus_t::PAK_STATUS_LOAD_PAKHDR, "PAK_STATUS_LOAD_PAKHDR" },
|
||||
{ RPakStatus_t::PAK_STATUS_LOAD_PATCH_INIT, "PAK_STATUS_LOAD_PATCH_INIT" },
|
||||
{ RPakStatus_t::PAK_STATUS_LOAD_PATCH_EDIT_STREAM, "PAK_STATUS_LOAD_PATCH_EDIT_STREAM" },
|
||||
{ RPakStatus_t::PAK_STATUS_LOAD_ASSETS, "PAK_STATUS_LOAD_ASSETS" },
|
||||
{ RPakStatus_t::PAK_STATUS_LOADED, "PAK_STATUS_LOADED" },
|
||||
{ RPakStatus_t::PAK_STATUS_UNLOAD_PENDING, "PAK_STATUS_UNLOAD_PENDING" },
|
||||
{ RPakStatus_t::PAK_STATUS_FREE_PENDING, "PAK_STATUS_FREE_PENDING" },
|
||||
{ RPakStatus_t::PAK_STATUS_CANCELING, "PAK_STATUS_CANCELING" },
|
||||
{ RPakStatus_t::PAK_STATUS_ERROR, "PAK_STATUS_ERROR" },
|
||||
{ RPakStatus_t::PAK_STATUS_INVALID_PAKHANDLE, "PAK_STATUS_INVALID_PAKHANDLE" },
|
||||
{ RPakStatus_t::PAK_STATUS_BUSY, "PAK_STATUS_BUSY" },
|
||||
};
|
||||
|
||||
struct RPakAssetBinding_t
|
||||
{
|
||||
uint32_t m_nExtension; // For example '0x6C74616D' for the material asset.
|
||||
@ -353,6 +334,7 @@ public:
|
||||
uint64_t __fastcall DecompressPakFileInit(RPakDecompState_t* state, uint8_t* fileBuffer, uint64_t fileSize, uint64_t offNoHeader, uint64_t headerSize);
|
||||
RPakLoadedInfo_t* GetPakLoadedInfo(RPakHandle_t nPakId);
|
||||
RPakLoadedInfo_t* GetPakLoadedInfo(const char* szPakName);
|
||||
const char* PakStatusToString(RPakStatus_t status);
|
||||
|
||||
static int32_t OpenFile(const CHAR* szFilePath, void* unused, LONGLONG* fileSizeOut);
|
||||
|
||||
|
@ -258,21 +258,17 @@ void Pak_ListPaks_f(const CCommand& args)
|
||||
|
||||
uint32_t nTotalLoaded = 0;
|
||||
|
||||
for (int16_t i = 0; i < *g_pLoadedPakCount; ++i)
|
||||
for (int16_t i = 0, n = *g_pLoadedPakCount; i < n; ++i)
|
||||
{
|
||||
const RPakLoadedInfo_t& info = g_pLoadedPakInfo[i];
|
||||
|
||||
if (info.m_nStatus == RPakStatus_t::PAK_STATUS_FREED)
|
||||
continue;
|
||||
|
||||
string rpakStatus = "RPAK_CREATED_A_NEW_STATUS_SOMEHOW";
|
||||
|
||||
auto it = g_PakStatusToString.find(info.m_nStatus);
|
||||
if (it != g_PakStatusToString.end())
|
||||
rpakStatus = it->second;
|
||||
const char* szRpakStatus = g_pRTech->PakStatusToString(info.m_nStatus);
|
||||
|
||||
// todo: make status into a string from an array/vector
|
||||
DevMsg(eDLL_T::RTECH, "| %04i | %-50s | %-36s | %11i |\n", info.m_nHandle, info.m_pszFileName, rpakStatus.c_str(), info.m_nAssetCount);
|
||||
DevMsg(eDLL_T::RTECH, "| %04i | %-50s | %-36s | %11i |\n", info.m_nHandle, info.m_pszFileName, szRpakStatus, info.m_nAssetCount);
|
||||
nTotalLoaded++;
|
||||
}
|
||||
DevMsg(eDLL_T::RTECH, "|------|----------------------------------------------------|--------------------------------------|-------------|\n");
|
||||
@ -292,7 +288,7 @@ void Pak_ListTypes_f(const CCommand& args)
|
||||
|
||||
uint32_t nRegistered = 0;
|
||||
|
||||
for (int8_t i = 0; i < 64; ++i)
|
||||
for (int8_t i = 0; i < PAK_MAX_TYPES; ++i)
|
||||
{
|
||||
RPakAssetBinding_t* type = &g_pPakGlobals->m_nAssetBindings[i];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user