RwTexture* utils::gta::load_texture(const std::string& name) {
if (!std::filesystem::exists("resamp++.txd"))
return nullptr;
int txd_slot = CTxdStore::AddTxdSlot("resamp++");
if (txd_slot == -1) {
printf("ERROR: Failed to add TXD slot.\n");
return nullptr;
}
if (!CTxdStore::LoadTxd(txd_slot, "resamp++.txd"))
return nullptr;
CTxdStore::AddRef(txd_slot);
CTxdStore::SetCurrentTxd(txd_slot);
RwTexture* texture =
plugin::CallAndReturn<RwTexture*, 0x7F3AC0, const char*, const char*>(
name.c_str(), nullptr); // RwTextureRead
CTxdStore::PopCurrentTxd();
return texture;
}