Fix zonebuilder FindAsset always returning -1 (not found) even when t… (#655)
Co-authored-by: Louvenarde <louve@louve.systems> Co-authored-by: Edo <edoardo.sanguineti222@gmail.com>
This commit is contained in:
parent
b9f5aa7eae
commit
54aabee08d
@ -46,7 +46,7 @@ namespace Components
|
||||
|
||||
if (!found)
|
||||
{
|
||||
Logger::Print("Asset {} of type {} was loaded, but not written!", name, Game::DB_GetXAssetTypeName(subAsset.type));
|
||||
Logger::Print("Asset {} of type {} was loaded, but not written!\n", name, Game::DB_GetXAssetTypeName(subAsset.type));
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,17 +66,18 @@ namespace Components
|
||||
|
||||
if (!found)
|
||||
{
|
||||
Logger::Error(Game::ERR_FATAL, "Asset {} of type {} was written, but not loaded!", name, Game::DB_GetXAssetTypeName(alias.first.type));
|
||||
Logger::Error(Game::ERR_FATAL, "Asset {} of type {} was written, but not loaded!\n", name, Game::DB_GetXAssetTypeName(alias.first.type));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Unload our fastfiles
|
||||
Game::XZoneInfo info;
|
||||
Game::XZoneInfo info{};
|
||||
info.name = nullptr;
|
||||
info.allocFlags = 0;
|
||||
info.freeFlags = 0x20;
|
||||
|
||||
|
||||
Game::DB_LoadXAssets(&info, 1, true);
|
||||
|
||||
AssetHandler::ClearTemporaryAssets();
|
||||
@ -277,7 +278,6 @@ namespace Components
|
||||
const auto* assetName = Game::DB_GetXAssetName(asset);
|
||||
if (!assetName) return -1;
|
||||
if (assetName[0] == ',' && assetName[1] != '\0') ++assetName;
|
||||
else return -1;
|
||||
|
||||
if (this->getAssetName(type, assetName) == name)
|
||||
{
|
||||
@ -1007,11 +1007,11 @@ namespace Components
|
||||
assert(data);
|
||||
auto* sound = Utils::Hook::Get<Game::MssSound*>(0x112AE04);
|
||||
auto length = sound->info.data_len;
|
||||
auto allocatedSpace = Utils::Memory::AllocateArray<char>(length);
|
||||
auto allocatedSpace = Game::Z_Malloc(length);
|
||||
memcpy_s(allocatedSpace, length, data, length);
|
||||
|
||||
data = allocatedSpace;
|
||||
sound->data = allocatedSpace;
|
||||
sound->data = static_cast<char*>(allocatedSpace);
|
||||
sound->info.data_ptr = allocatedSpace;
|
||||
}
|
||||
|
||||
|
@ -253,6 +253,7 @@ namespace Game
|
||||
Vec2NormalizeFast_t Vec2NormalizeFast = Vec2NormalizeFast_t(0x5FC830);
|
||||
|
||||
Z_VirtualAlloc_t Z_VirtualAlloc = Z_VirtualAlloc_t(0x4CFBA0);
|
||||
Z_Malloc_t Z_Malloc = Z_Malloc_t(0x4F3680);
|
||||
|
||||
I_strncpyz_t I_strncpyz = I_strncpyz_t(0x4D6F80);
|
||||
I_CleanStr_t I_CleanStr = I_CleanStr_t(0x4AD470);
|
||||
|
@ -563,6 +563,9 @@ namespace Game
|
||||
typedef void*(*Z_VirtualAlloc_t)(int size);
|
||||
extern Z_VirtualAlloc_t Z_VirtualAlloc;
|
||||
|
||||
typedef void*(*Z_Malloc_t)(int size);
|
||||
extern Z_Malloc_t Z_Malloc;
|
||||
|
||||
typedef void(*I_strncpyz_t)(char* dest, const char* src, int destsize);
|
||||
extern I_strncpyz_t I_strncpyz;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user