mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-28 06:43:01 +05:00
Safer CPNGFile::ReadFromMemory
This commit is contained in:
parent
6e470ab20d
commit
fe46468e7c
1 changed files with 5 additions and 4 deletions
|
@ -24,10 +24,11 @@ RwTexture* CPNGFile::ReadFromFile(const char* pFileName)
|
||||||
|
|
||||||
RwTexture* CPNGFile::ReadFromMemory(const void* pMemory, unsigned int nLen)
|
RwTexture* CPNGFile::ReadFromMemory(const void* pMemory, unsigned int nLen)
|
||||||
{
|
{
|
||||||
static BYTE* pMem = AddressByVersion<BYTE*>(0x7CF9CA, 0x7D02CA, 0x80998A);
|
static uint8_t* const pMem = AddressByVersion<uint8_t*>(0x7CF9CA, 0x7D02CA, 0x80998A);
|
||||||
RwTexture* pTexture = nullptr;
|
RwTexture* pTexture = nullptr;
|
||||||
|
|
||||||
Memory::VP::Patch<BYTE>(pMem, rwSTREAMMEMORY);
|
uint8_t oldMemory = *pMem;
|
||||||
|
Memory::VP::Patch<uint8_t>(pMem, rwSTREAMMEMORY);
|
||||||
|
|
||||||
RwMemory PNGMemory;
|
RwMemory PNGMemory;
|
||||||
PNGMemory.start = const_cast<RwUInt8*>(static_cast<const RwUInt8*>(pMemory));
|
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);
|
RwImageDestroy(pImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
Memory::VP::Patch<BYTE>(pMem, rwSTREAMFILENAME);
|
Memory::VP::Patch<uint8_t>(pMem, oldMemory);
|
||||||
|
|
||||||
return pTexture;
|
return pTexture;
|
||||||
}
|
}
|
Loading…
Reference in a new issue