Remove WinAPI byte allocation in common app

This commit is contained in:
notmatthewbeshay 2026-03-16 04:52:17 +11:00
parent 3a98ff640c
commit 506964f2b4

View file

@ -5353,8 +5353,7 @@ void CMinecraftApp::AddMemoryTextureFile(const std::wstring &wName, std::uint8_t
// add this texture to the list of memory texture files - it will then be picked up by the level renderer's AddEntity // add this texture to the list of memory texture files - it will then be picked up by the level renderer's AddEntity
pData = (PMEMDATA)new BYTE[sizeof(MEMDATA)]; pData = new MEMDATA();
ZeroMemory( pData, sizeof(MEMDATA) );
pData->pbData=pbData; pData->pbData=pbData;
pData->dwBytes=dwBytes; pData->dwBytes=dwBytes;
pData->ucRefCount = 1; pData->ucRefCount = 1;
@ -5382,7 +5381,7 @@ void CMinecraftApp::RemoveMemoryTextureFile(const std::wstring &wName)
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
wprintf(L"Erasing the memory texture file data for %ls\n", wName.c_str()); wprintf(L"Erasing the memory texture file data for %ls\n", wName.c_str());
#endif #endif
delete [] pData; delete pData;
m_MEM_Files.erase(wName); m_MEM_Files.erase(wName);
} }
} }
@ -5435,8 +5434,7 @@ void CMinecraftApp::AddMemoryTPDFile(int iConfig, std::uint8_t *pbData, unsigned
AUTO_VAR(it, m_MEM_TPD.find(iConfig)); AUTO_VAR(it, m_MEM_TPD.find(iConfig));
if(it == m_MEM_TPD.end()) if(it == m_MEM_TPD.end())
{ {
pData = (PMEMDATA)new BYTE[sizeof(MEMDATA)]; pData = new MEMDATA();
ZeroMemory( pData, sizeof(MEMDATA) );
pData->pbData=pbData; pData->pbData=pbData;
pData->dwBytes=dwBytes; pData->dwBytes=dwBytes;
pData->ucRefCount = 1; pData->ucRefCount = 1;
@ -5456,7 +5454,7 @@ void CMinecraftApp::RemoveMemoryTPDFile(int iConfig)
if(it != m_MEM_TPD.end()) if(it != m_MEM_TPD.end())
{ {
pData=m_MEM_TPD[iConfig]; pData=m_MEM_TPD[iConfig];
delete [] pData; delete pData;
m_MEM_TPD.erase(iConfig); m_MEM_TPD.erase(iConfig);
} }