diff --git a/src/Components/Modules/ZoneBuilder.cpp b/src/Components/Modules/ZoneBuilder.cpp index 88220c49..ed38193c 100644 --- a/src/Components/Modules/ZoneBuilder.cpp +++ b/src/Components/Modules/ZoneBuilder.cpp @@ -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(0x112AE04); auto length = sound->info.data_len; - auto allocatedSpace = Utils::Memory::AllocateArray(length); + auto allocatedSpace = Game::Z_Malloc(length); memcpy_s(allocatedSpace, length, data, length); data = allocatedSpace; - sound->data = allocatedSpace; + sound->data = static_cast(allocatedSpace); sound->info.data_ptr = allocatedSpace; } diff --git a/src/Game/Functions.cpp b/src/Game/Functions.cpp index e8bf6e6a..6444eff5 100644 --- a/src/Game/Functions.cpp +++ b/src/Game/Functions.cpp @@ -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); diff --git a/src/Game/Functions.hpp b/src/Game/Functions.hpp index 2834a2e0..29750448 100644 --- a/src/Game/Functions.hpp +++ b/src/Game/Functions.hpp @@ -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;