mirror of
https://github.com/XLabsProject/s1x-client.git
synced 2023-08-02 15:02:12 +02:00
add listassetpool cmd & remove specific pool list cmds
This commit is contained in:
parent
ca3907b20e
commit
854631dfd8
@ -291,6 +291,72 @@ namespace command
|
||||
game_console::print(game_console::con_type_info,
|
||||
"================================ END COMMAND DUMP =================================\n");
|
||||
});
|
||||
|
||||
add("listassetpool", [](const params& params)
|
||||
{
|
||||
if (params.size() < 2)
|
||||
{
|
||||
game_console::print(game_console::con_type_info,
|
||||
"listassetpool <poolnumber>: list all the assets in the specified pool\n");
|
||||
|
||||
for (int i = 0; i < game::ASSET_TYPE_COUNT; i++)
|
||||
{
|
||||
game_console::print(game_console::con_type_info, "%d %s\n", i, game::g_assetNames[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto type_index = atoi(params.get(1));
|
||||
|
||||
if (type_index < 0 || type_index >= game::XAssetType::ASSET_TYPE_COUNT)
|
||||
{
|
||||
game_console::print(game_console::con_type_error,
|
||||
"Invalid pool passed must be between [%d, %d]", 0,
|
||||
game::XAssetType::ASSET_TYPE_COUNT - 1);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto type = static_cast<game::XAssetType>(type_index);
|
||||
game_console::print(game_console::con_type_info, "Listing assets in pool %s",
|
||||
game::g_assetNames[type]);
|
||||
|
||||
auto db_size = 121000;
|
||||
unsigned int* table = game::db_hashTable;
|
||||
game::XAssetEntry* entry;
|
||||
auto num_type_assets = 0, num_type_override_assets = 0;
|
||||
|
||||
do
|
||||
{
|
||||
for (auto hash = *table; hash; hash = entry->nextHash)
|
||||
{
|
||||
entry = &game::g_assetEntryPool[hash];
|
||||
if (entry->asset.type == type)
|
||||
{
|
||||
num_type_assets++;
|
||||
game_console::print(game_console::con_type_info, "%s",
|
||||
game::DB_GetXAssetName(&entry->asset));
|
||||
auto hash_override = entry->nextOverride;
|
||||
if (hash_override)
|
||||
{
|
||||
do
|
||||
{
|
||||
num_type_assets++;
|
||||
num_type_override_assets++;
|
||||
game::XAssetEntry* entry_override = &game::g_assetEntryPool[hash_override];
|
||||
hash_override = game::g_assetEntryPool[hash_override].nextOverride;
|
||||
game_console::print(game_console::con_type_info, "%s | override",
|
||||
game::DB_GetXAssetName(&entry_override->asset));
|
||||
} while (hash_override);
|
||||
}
|
||||
}
|
||||
}
|
||||
table++;
|
||||
} while (db_size--);
|
||||
game_console::print(game_console::con_type_info,
|
||||
"Total of type: %d | Overrides: %d",
|
||||
num_type_assets, num_type_override_assets);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void add_commands_sp()
|
||||
|
@ -63,39 +63,6 @@ namespace fastfiles
|
||||
game::DB_LoadXAssets(&info, 1u, game::DBSyncMode::DB_LOAD_SYNC);
|
||||
});
|
||||
|
||||
command::add("materiallist", [](const command::params& params)
|
||||
{
|
||||
game::DB_EnumXAssets_FastFile(game::ASSET_TYPE_MATERIAL, [](const game::XAssetHeader header, void*)
|
||||
{
|
||||
if (header.material && header.material->name)
|
||||
{
|
||||
printf("%s\n", header.material->name);
|
||||
}
|
||||
}, 0, false);
|
||||
});
|
||||
|
||||
command::add("fontlist", [](const command::params& params)
|
||||
{
|
||||
game::DB_EnumXAssets_FastFile(game::ASSET_TYPE_FONT, [](const game::XAssetHeader header, void*)
|
||||
{
|
||||
if (header.font && header.font->fontName)
|
||||
{
|
||||
printf("%s\n", header.font->fontName);
|
||||
}
|
||||
}, 0, false);
|
||||
});
|
||||
|
||||
command::add("rawfilelist", [](const command::params& params)
|
||||
{
|
||||
game::DB_EnumXAssets_FastFile(game::ASSET_TYPE_RAWFILE, [](const game::XAssetHeader header, void*)
|
||||
{
|
||||
if (header.rawfile && header.rawfile->name)
|
||||
{
|
||||
printf("%s\n", header.rawfile->name);
|
||||
}
|
||||
}, 0, false);
|
||||
});
|
||||
|
||||
command::add("g_poolSizes", []()
|
||||
{
|
||||
for (auto i = 0; i < game::ASSET_TYPE_COUNT; i++)
|
||||
|
Loading…
Reference in New Issue
Block a user