mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-21 21:12:29 +01:00
Safer CPNGFile::ReadFromMemory
This commit is contained in:
parent
6e470ab20d
commit
fe46468e7c
@ -24,10 +24,11 @@ RwTexture* CPNGFile::ReadFromFile(const char* pFileName)
|
||||
|
||||
RwTexture* CPNGFile::ReadFromMemory(const void* pMemory, unsigned int nLen)
|
||||
{
|
||||
static BYTE* pMem = AddressByVersion<BYTE*>(0x7CF9CA, 0x7D02CA, 0x80998A);
|
||||
RwTexture* pTexture = nullptr;
|
||||
static uint8_t* const pMem = AddressByVersion<uint8_t*>(0x7CF9CA, 0x7D02CA, 0x80998A);
|
||||
RwTexture* pTexture = nullptr;
|
||||
|
||||
Memory::VP::Patch<BYTE>(pMem, rwSTREAMMEMORY);
|
||||
uint8_t oldMemory = *pMem;
|
||||
Memory::VP::Patch<uint8_t>(pMem, rwSTREAMMEMORY);
|
||||
|
||||
RwMemory PNGMemory;
|
||||
PNGMemory.start = const_cast<RwUInt8*>(static_cast<const RwUInt8*>(pMemory));
|
||||
@ -48,7 +49,7 @@ RwTexture* CPNGFile::ReadFromMemory(const void* pMemory, unsigned int nLen)
|
||||
RwImageDestroy(pImage);
|
||||
}
|
||||
|
||||
Memory::VP::Patch<BYTE>(pMem, rwSTREAMFILENAME);
|
||||
Memory::VP::Patch<uint8_t>(pMem, oldMemory);
|
||||
|
||||
return pTexture;
|
||||
}
|
Loading…
Reference in New Issue
Block a user