mirror of
https://github.com/XLabsProject/s1x-client.git
synced 2023-08-02 15:02:12 +02:00
make listassetpool use game function to iterate specified asset pool
Co-Authored-By: Maurice Heumann <MauriceHeumann@gmail.com>
This commit is contained in:
parent
46406fac62
commit
107907f003
@ -226,44 +226,13 @@ namespace command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void list_asset_pool(const game::XAssetType type)
|
void enum_assets(const game::XAssetType type, const std::function<void(game::XAssetHeader)>& callback, const bool includeOverride)
|
||||||
{
|
{
|
||||||
if (type < 0 || type >= game::XAssetType::ASSET_TYPE_COUNT)
|
game::DB_EnumXAssets_Internal(type, static_cast<void(*)(game::XAssetHeader, void*)>([](game::XAssetHeader header, void* data)
|
||||||
{
|
|
||||||
game_console::print(game_console::con_type_error,
|
|
||||||
"Invalid pool passed must be between [%d, %d]", 0,
|
|
||||||
game::XAssetType::ASSET_TYPE_COUNT - 1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
while (db_size--)
|
|
||||||
{
|
|
||||||
for (auto hash = *table; hash; hash = entry->nextHash)
|
|
||||||
{
|
{
|
||||||
entry = &game::g_assetEntryPool[hash];
|
const auto& cb = *static_cast<const std::function<void(game::XAssetHeader)>*>(data);
|
||||||
if (entry->asset.type == type)
|
cb(header);
|
||||||
{
|
}), &callback, includeOverride);
|
||||||
game_console::print(game_console::con_type_info, "%s",
|
|
||||||
game::DB_GetXAssetName(&entry->asset));
|
|
||||||
auto hash_override = entry->nextOverride;
|
|
||||||
while (hash_override)
|
|
||||||
{
|
|
||||||
const auto* 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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
table++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class component final : public component_interface
|
class component final : public component_interface
|
||||||
@ -370,7 +339,26 @@ namespace command
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
const auto type = static_cast<game::XAssetType>(atoi(params.get(1)));
|
const auto type = static_cast<game::XAssetType>(atoi(params.get(1)));
|
||||||
list_asset_pool(type);
|
|
||||||
|
if (type < 0 || type >= 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
game_console::print(game_console::con_type_info, "Listing assets in pool %s",
|
||||||
|
game::g_assetNames[type]);
|
||||||
|
|
||||||
|
enum_assets(type, [type](game::XAssetHeader header)
|
||||||
|
{
|
||||||
|
const auto asset = game::XAsset{ type, header };
|
||||||
|
const auto* const asset_name = game::DB_GetXAssetName(&asset);
|
||||||
|
//const auto entry = game::DB_FindXAssetEntry(type, asset_name);
|
||||||
|
//TODO: display which zone the asset is from
|
||||||
|
game_console::print(game_console::con_type_info, "%s", asset_name);
|
||||||
|
}, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,10 @@ namespace game
|
|||||||
|
|
||||||
WEAK symbol<void(XAssetType type, void (__cdecl* func)(XAssetHeader, void*), void* inData, bool includeOverride)>
|
WEAK symbol<void(XAssetType type, void (__cdecl* func)(XAssetHeader, void*), void* inData, bool includeOverride)>
|
||||||
DB_EnumXAssets_FastFile{0x14017D7C0, 0x14026EC10};
|
DB_EnumXAssets_FastFile{0x14017D7C0, 0x14026EC10};
|
||||||
|
WEAK symbol<void(XAssetType type, void(__cdecl* func)(game::XAssetHeader, void*), const void* inData, bool includeOverride)>
|
||||||
|
DB_EnumXAssets_Internal{ 0x14017D830, 0x14026EC80 };
|
||||||
|
WEAK symbol<game::XAssetEntry(game::XAssetType type, const char* name)>
|
||||||
|
DB_FindXAssetEntry{ 0x14017D830, 0x14026F020 };
|
||||||
WEAK symbol<const char* (const XAsset* asset)> DB_GetXAssetName{0x140151C00, 0x140240DD0};
|
WEAK symbol<const char* (const XAsset* asset)> DB_GetXAssetName{0x140151C00, 0x140240DD0};
|
||||||
WEAK symbol<int(XAssetType type)> DB_GetXAssetTypeSize{0x140151C20, 0x140240DF0};
|
WEAK symbol<int(XAssetType type)> DB_GetXAssetTypeSize{0x140151C20, 0x140240DF0};
|
||||||
WEAK symbol<void(XZoneInfo* zoneInfo, unsigned int zoneCount, DBSyncMode syncMode)> DB_LoadXAssets{
|
WEAK symbol<void(XZoneInfo* zoneInfo, unsigned int zoneCount, DBSyncMode syncMode)> DB_LoadXAssets{
|
||||||
|
Loading…
Reference in New Issue
Block a user