Some xmodel progress
This commit is contained in:
parent
642002ec1e
commit
bd1b3e321d
@ -205,18 +205,116 @@ namespace fastfiles
|
||||
return reallocate_asset_pool<Type, pool_size * Multiplier>();
|
||||
}
|
||||
|
||||
#define RVA(ptr) static_cast<uint32_t>(reinterpret_cast<size_t>(ptr) - 0x140000000)
|
||||
|
||||
void reallocate_xmodel_pool()
|
||||
{
|
||||
// array used for DB_GetAllXAssetOfType, not big enough if many assets are added
|
||||
static game::XAssetHeader assets[0x100000]{};
|
||||
utils::hook::inject(0x1403E2AB7, &assets);
|
||||
utils::hook::inject(0x1403E2AC3, &assets);
|
||||
utils::hook::inject(0x1403E2ACF, &assets);
|
||||
|
||||
constexpr auto xmodel_pool_size = get_pool_type_size(game::ASSET_TYPE_XMODEL) * 2;
|
||||
const auto xmodel_pool = reallocate_asset_pool<game::ASSET_TYPE_XMODEL, xmodel_pool_size>();
|
||||
utils::hook::inject(0x140413D93, xmodel_pool + 8);
|
||||
|
||||
// table 1
|
||||
static int xmodel_table_1[xmodel_pool_size]{};
|
||||
utils::hook::set<uint32_t>(0x14041E0C2 + 4, RVA(&xmodel_table_1[0]));
|
||||
utils::hook::inject(0x14041E7F6 + 3, &xmodel_table_1[0]);
|
||||
utils::hook::set<uint32_t>(0x140420797 + 4, RVA(&xmodel_table_1[0]));
|
||||
utils::hook::inject(0x1404228F6 + 3, &xmodel_table_1[0]);
|
||||
utils::hook::inject(0x14042290E + 3, &xmodel_table_1[0]);
|
||||
utils::hook::set<uint32_t>(0x140710280 + 4, RVA(&xmodel_table_1[0]));
|
||||
|
||||
// everything below doesnt seem to change anything
|
||||
// table 2
|
||||
static int xmodel_table_2[xmodel_pool_size]{};
|
||||
utils::hook::set<uint32_t>(0x14041E2FA + 4, RVA(&xmodel_table_2[0]));
|
||||
utils::hook::set<uint32_t>(0x1404207BC + 4, RVA(&xmodel_table_2[0]));
|
||||
utils::hook::inject(0x140422AE1 + 3, &xmodel_table_2[0]);
|
||||
utils::hook::set<uint32_t>(0x140422B20 + 4, RVA(&xmodel_table_2[0]));
|
||||
utils::hook::inject(0x140422B8D + 3, &xmodel_table_2[0]);
|
||||
utils::hook::set<uint32_t>(0x140422BC7 + 4, RVA(&xmodel_table_2[0]));
|
||||
utils::hook::inject(0x140422C41 + 3, &xmodel_table_2[0]);
|
||||
utils::hook::set<uint32_t>(0x140422CE0 + 4, RVA(&xmodel_table_2[0]));
|
||||
utils::hook::set<uint32_t>(0x140422D16 + 4, RVA(&xmodel_table_2[0]));
|
||||
utils::hook::set<uint32_t>(0x140723BAE + 5, RVA(&xmodel_table_2[0]));
|
||||
utils::hook::set<uint32_t>(0x140723BCC + 5, RVA(&xmodel_table_2[0]));
|
||||
utils::hook::inject(0x140728332 + 3, &xmodel_table_2[0]);
|
||||
|
||||
// table 3
|
||||
static int xmodel_table_3[xmodel_pool_size]{};
|
||||
utils::hook::set<uint32_t>(0x1404207D4 + 4, RVA(&xmodel_table_3[0]));
|
||||
utils::hook::set<uint32_t>(0x140724BA3 + 5, RVA(&xmodel_table_3[0]));
|
||||
utils::hook::set<uint32_t>(0x140724BC1 + 5, RVA(&xmodel_table_3[0]));
|
||||
|
||||
// table 4
|
||||
static int xmodel_table_4[xmodel_pool_size]{};
|
||||
utils::hook::set<uint32_t>(0x1404207C8 + 4, RVA(&xmodel_table_4[0]));
|
||||
utils::hook::inject(0x140422888 + 3, &xmodel_table_4[0]);
|
||||
utils::hook::inject(0x14041EAC0 + 3, reinterpret_cast<void*>(reinterpret_cast<size_t>(&xmodel_table_4[0]) + 0x10));
|
||||
|
||||
// table 5
|
||||
static int xmodel_table_5[xmodel_pool_size]{};
|
||||
utils::hook::set<uint32_t>(0x1404205BC + 4, RVA(&xmodel_table_5[0]));
|
||||
utils::hook::set<uint32_t>(0x14042062D + 4, RVA(&xmodel_table_5[0]));
|
||||
utils::hook::inject(0x140420A35 + 3, &xmodel_table_5[0]);
|
||||
|
||||
// hash table 1
|
||||
static int xmodel_hash_table_1[xmodel_pool_size]{};
|
||||
utils::hook::set<uint32_t>(0x1404207AA + 4, RVA(&xmodel_hash_table_1[0]));
|
||||
utils::hook::inject(0x1404208DE + 3, &xmodel_hash_table_1[0]);
|
||||
utils::hook::inject(0x140422535 + 2, &xmodel_hash_table_1[0]);
|
||||
|
||||
// hash table 2
|
||||
static int xmodel_hash_table_2[xmodel_pool_size]{};
|
||||
utils::hook::inject(0x1403E2A8E + 3, &xmodel_hash_table_2[0]);
|
||||
utils::hook::inject(0x1403E2FD9 + 3, &xmodel_hash_table_2[0]);
|
||||
utils::hook::inject(0x1403E37C5 + 3, &xmodel_hash_table_2[0]);
|
||||
|
||||
// hash table 2
|
||||
static int xmodel_hash_table_3[xmodel_pool_size]{};
|
||||
utils::hook::inject(0x1403E2A8E + 3, &xmodel_hash_table_3[0]);
|
||||
utils::hook::inject(0x1403E2FD9 + 3, &xmodel_hash_table_3[0]);
|
||||
utils::hook::inject(0x1403E37C5 + 3, &xmodel_hash_table_3[0]);
|
||||
|
||||
// hash table 3
|
||||
static int xmodel_hash_table_4[xmodel_pool_size]{};
|
||||
utils::hook::set<uint32_t>(0x1404207B4 + 4, RVA(&xmodel_hash_table_4[0]));
|
||||
utils::hook::inject(0x140422AD7 + 3, &xmodel_hash_table_4[0]);
|
||||
utils::hook::set<uint32_t>(0x140422B18 + 4, RVA(&xmodel_hash_table_4[0]));
|
||||
utils::hook::inject(0x140422B83 + 3, &xmodel_hash_table_4[0]);
|
||||
utils::hook::set<uint32_t>(0x140422BBF + 4, RVA(&xmodel_hash_table_4[0]));
|
||||
utils::hook::inject(0x140422C37 + 3, &xmodel_hash_table_4[0]);
|
||||
utils::hook::inject(0x140422C97 + 3, &xmodel_hash_table_4[0]);
|
||||
utils::hook::set<uint32_t>(0x140422CD8 + 4, RVA(&xmodel_hash_table_4[0]));
|
||||
utils::hook::set<uint32_t>(0x140422D0E + 4, RVA(&xmodel_hash_table_4[0]));
|
||||
|
||||
// seems to fix some issues but causes models to load slowly, probably not done correctly
|
||||
static int xmodel_table_7[xmodel_pool_size * 6]{};
|
||||
utils::hook::set<uint32_t>(0x1404205AF + 3, RVA(reinterpret_cast<void*>(reinterpret_cast<size_t>(&xmodel_table_7) + 0)));
|
||||
utils::hook::set<uint32_t>(0x140420752 + 4, RVA(reinterpret_cast<void*>(reinterpret_cast<size_t>(&xmodel_table_7) + 0)));
|
||||
|
||||
utils::hook::set<uint32_t>(0x1404205A7 + 4, RVA(reinterpret_cast<void*>(reinterpret_cast<size_t>(&xmodel_table_7) + 8)));
|
||||
utils::hook::set<uint32_t>(0x14042065B + 4, RVA(reinterpret_cast<void*>(reinterpret_cast<size_t>(&xmodel_table_7) + 8)));
|
||||
utils::hook::set<uint32_t>(0x14042068D + 4, RVA(reinterpret_cast<void*>(reinterpret_cast<size_t>(&xmodel_table_7) + 8)));
|
||||
utils::hook::set<uint32_t>(0x1404206AF + 4, RVA(reinterpret_cast<void*>(reinterpret_cast<size_t>(&xmodel_table_7) + 8)));
|
||||
utils::hook::set<uint32_t>(0x1404206F0 + 4, RVA(reinterpret_cast<void*>(reinterpret_cast<size_t>(&xmodel_table_7) + 8)));
|
||||
utils::hook::set<uint32_t>(0x140420720 + 4, RVA(reinterpret_cast<void*>(reinterpret_cast<size_t>(&xmodel_table_7) + 8)));
|
||||
utils::hook::set<uint32_t>(0x14042075F + 4, RVA(reinterpret_cast<void*>(reinterpret_cast<size_t>(&xmodel_table_7) + 8)));
|
||||
|
||||
utils::hook::set<uint32_t>(0x14041EE9B + 4, RVA(reinterpret_cast<void*>(reinterpret_cast<size_t>(&xmodel_table_7) + 0x10)));
|
||||
utils::hook::set<uint32_t>(0x1404205A0 + 3, RVA(reinterpret_cast<void*>(reinterpret_cast<size_t>(&xmodel_table_7) + 0x10)));
|
||||
utils::hook::set<uint32_t>(0x14042060D + 5, RVA(reinterpret_cast<void*>(reinterpret_cast<size_t>(&xmodel_table_7) + 0x10)));
|
||||
utils::hook::set<uint32_t>(0x140420618 + 3, RVA(reinterpret_cast<void*>(reinterpret_cast<size_t>(&xmodel_table_7) + 0x10)));
|
||||
}
|
||||
|
||||
void reallocate_asset_pools()
|
||||
{
|
||||
//reallocate_xmodel_pool();
|
||||
//reallocate_asset_pool_multiplier<game::ASSET_TYPE_XMODELSURFS, 2>();
|
||||
|
||||
// other arrays depend on the xmodel pool size, they also have to be reallocated
|
||||
//const auto xmodel_pool = reallocate_asset_pool_multiplier<game::ASSET_TYPE_XMODEL, 2>();
|
||||
//utils::hook::inject(0x140413D93, xmodel_pool + 8);
|
||||
|
||||
/*const auto image_pool = reallocate_asset_pool_multiplier<game::ASSET_TYPE_IMAGE, 2>();
|
||||
utils::hook::inject(0x140413B45, image_pool + 8);
|
||||
utils::hook::inject(0x140413B63, image_pool + 8);*/
|
||||
|
||||
reallocate_asset_pool_multiplier<game::ASSET_TYPE_WEAPON, 2>();
|
||||
reallocate_asset_pool_multiplier<game::ASSET_TYPE_SOUND, 2>();
|
||||
reallocate_asset_pool_multiplier<game::ASSET_TYPE_LOADED_SOUND, 2>();
|
||||
|
Loading…
Reference in New Issue
Block a user