mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-25 14:17:54 -05:00
refactor: make memory from zone a reference instead of ptr
This commit is contained in:
@ -19,6 +19,6 @@ void Actions_GfxImage::LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image)
|
||||
{
|
||||
const size_t loadDefSize = offsetof(IW3::GfxImageLoadDef, data) + loadDef->resourceSize;
|
||||
|
||||
image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone.GetMemory()->AllocRaw(loadDefSize));
|
||||
image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone.Memory().AllocRaw(loadDefSize));
|
||||
memcpy(image->texture.loadDef, loadDef, loadDefSize);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ void Actions_LoadedSound::SetSoundData(MssSound* sound) const
|
||||
if (sound->info.data_len > 0)
|
||||
{
|
||||
const auto* tempData = sound->data;
|
||||
sound->data = m_zone.GetMemory()->Alloc<char>(sound->info.data_len);
|
||||
sound->data = m_zone.Memory().Alloc<char>(sound->info.data_len);
|
||||
memcpy(sound->data, tempData, sound->info.data_len);
|
||||
}
|
||||
else
|
||||
|
@ -19,6 +19,6 @@ void Actions_GfxImage::LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image)
|
||||
{
|
||||
const size_t loadDefSize = offsetof(IW4::GfxImageLoadDef, data) + loadDef->resourceSize;
|
||||
|
||||
image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone.GetMemory()->AllocRaw(loadDefSize));
|
||||
image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone.Memory().AllocRaw(loadDefSize));
|
||||
memcpy(image->texture.loadDef, loadDef, loadDefSize);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ void Actions_LoadedSound::SetSoundData(MssSound* sound) const
|
||||
if (sound->info.data_len > 0)
|
||||
{
|
||||
const auto* tempData = sound->data;
|
||||
sound->data = m_zone.GetMemory()->Alloc<char>(sound->info.data_len);
|
||||
sound->data = m_zone.Memory().Alloc<char>(sound->info.data_len);
|
||||
memcpy(sound->data, tempData, sound->info.data_len);
|
||||
}
|
||||
else
|
||||
|
@ -13,7 +13,7 @@ void Actions_XModel::SetModelSurfs(XModelLodInfo* lodInfo, XModelSurfs* modelSur
|
||||
{
|
||||
if (modelSurfs)
|
||||
{
|
||||
lodInfo->modelSurfs = m_zone.GetMemory()->Alloc<XModelSurfs>();
|
||||
lodInfo->modelSurfs = m_zone.Memory().Alloc<XModelSurfs>();
|
||||
memcpy(lodInfo->modelSurfs, modelSurfs, sizeof(XModelSurfs));
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,6 @@ Actions_clipMap_t::Actions_clipMap_t(Zone& zone)
|
||||
|
||||
void Actions_clipMap_t::ReallocClipInfo(const ClipInfo* clipInfo, clipMap_t* clipMap) const
|
||||
{
|
||||
clipMap->pInfo = m_zone.GetMemory()->Alloc<ClipInfo>();
|
||||
clipMap->pInfo = m_zone.Memory().Alloc<ClipInfo>();
|
||||
memcpy(clipMap->pInfo, clipInfo, sizeof(ClipInfo));
|
||||
}
|
||||
|
@ -19,6 +19,6 @@ void Actions_GfxImage::LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image)
|
||||
{
|
||||
const size_t loadDefSize = offsetof(IW5::GfxImageLoadDef, data) + loadDef->resourceSize;
|
||||
|
||||
image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone.GetMemory()->AllocRaw(loadDefSize));
|
||||
image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone.Memory().AllocRaw(loadDefSize));
|
||||
memcpy(image->texture.loadDef, loadDef, loadDefSize);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ void Actions_LoadedSound::SetSoundData(MssSound* sound) const
|
||||
if (sound->info.data_len > 0)
|
||||
{
|
||||
char* tempData = sound->data;
|
||||
sound->data = m_zone.GetMemory()->Alloc<char>(sound->info.data_len);
|
||||
sound->data = m_zone.Memory().Alloc<char>(sound->info.data_len);
|
||||
memcpy(sound->data, tempData, sound->info.data_len);
|
||||
}
|
||||
else
|
||||
|
@ -13,7 +13,7 @@ void Actions_XModel::SetModelSurfs(XModelLodInfo* lodInfo, XModelSurfs* modelSur
|
||||
{
|
||||
if (modelSurfs)
|
||||
{
|
||||
lodInfo->modelSurfs = m_zone.GetMemory()->Alloc<XModelSurfs>();
|
||||
lodInfo->modelSurfs = m_zone.Memory().Alloc<XModelSurfs>();
|
||||
memcpy(lodInfo->modelSurfs, modelSurfs, sizeof(XModelSurfs));
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,6 @@ void Actions_GfxImage::LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image)
|
||||
{
|
||||
const size_t loadDefSize = offsetof(GfxImageLoadDef, data) + loadDef->resourceSize;
|
||||
|
||||
image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone.GetMemory()->AllocRaw(loadDefSize));
|
||||
image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone.Memory().AllocRaw(loadDefSize));
|
||||
memcpy(image->texture.loadDef, loadDef, loadDefSize);
|
||||
}
|
||||
|
@ -19,6 +19,6 @@ void Actions_GfxImage::LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image)
|
||||
{
|
||||
const size_t loadDefSize = offsetof(T6::GfxImageLoadDef, data) + loadDef->resourceSize;
|
||||
|
||||
image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone.GetMemory()->AllocRaw(loadDefSize));
|
||||
image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone.Memory().AllocRaw(loadDefSize));
|
||||
memcpy(image->texture.loadDef, loadDef, loadDefSize);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
ContentLoaderBase::ContentLoaderBase(Zone& zone)
|
||||
: varXString(nullptr),
|
||||
m_zone(zone),
|
||||
m_memory(*zone.GetMemory()),
|
||||
m_memory(zone.Memory()),
|
||||
m_stream(nullptr)
|
||||
{
|
||||
}
|
||||
@ -13,7 +13,7 @@ ContentLoaderBase::ContentLoaderBase(Zone& zone)
|
||||
ContentLoaderBase::ContentLoaderBase(Zone& zone, IZoneInputStream* stream)
|
||||
: varXString(nullptr),
|
||||
m_zone(zone),
|
||||
m_memory(*zone.GetMemory()),
|
||||
m_memory(zone.Memory()),
|
||||
m_stream(stream)
|
||||
{
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ void ZoneLoader::AddXBlock(std::unique_ptr<XBlock> block)
|
||||
return b1->m_index < b2->m_index;
|
||||
});
|
||||
|
||||
m_zone->GetMemory()->AddBlock(std::move(block));
|
||||
m_zone->Memory().AddBlock(std::move(block));
|
||||
}
|
||||
|
||||
void ZoneLoader::AddLoadingStep(std::unique_ptr<ILoadingStep> step)
|
||||
|
Reference in New Issue
Block a user