diff --git a/SilentPatchSA/PNGFile.cpp b/SilentPatchSA/PNGFile.cpp index 1995e71..c37de55 100644 --- a/SilentPatchSA/PNGFile.cpp +++ b/SilentPatchSA/PNGFile.cpp @@ -24,10 +24,11 @@ RwTexture* CPNGFile::ReadFromFile(const char* pFileName) RwTexture* CPNGFile::ReadFromMemory(const void* pMemory, unsigned int nLen) { - static BYTE* pMem = AddressByVersion(0x7CF9CA, 0x7D02CA, 0x80998A); - RwTexture* pTexture = nullptr; + static uint8_t* const pMem = AddressByVersion(0x7CF9CA, 0x7D02CA, 0x80998A); + RwTexture* pTexture = nullptr; - Memory::VP::Patch(pMem, rwSTREAMMEMORY); + uint8_t oldMemory = *pMem; + Memory::VP::Patch(pMem, rwSTREAMMEMORY); RwMemory PNGMemory; PNGMemory.start = const_cast(static_cast(pMemory)); @@ -48,7 +49,7 @@ RwTexture* CPNGFile::ReadFromMemory(const void* pMemory, unsigned int nLen) RwImageDestroy(pImage); } - Memory::VP::Patch(pMem, rwSTREAMFILENAME); + Memory::VP::Patch(pMem, oldMemory); return pTexture; } \ No newline at end of file