General: Convert PanicAlerts over to fmt equivalent

Converts lingering panic alert calls over to the fmt-capable ones.
This commit is contained in:
Lioncash 2020-12-02 13:17:27 -05:00
parent 5abae61a8c
commit 139d4fc76e
45 changed files with 206 additions and 195 deletions

View file

@ -46,7 +46,7 @@ void* AllocateExecutableMemory(size_t size)
#endif
if (ptr == nullptr)
PanicAlert("Failed to allocate executable memory");
PanicAlertFmt("Failed to allocate executable memory");
return ptr;
}
@ -63,7 +63,7 @@ void* AllocateMemoryPages(size_t size)
#endif
if (ptr == nullptr)
PanicAlert("Failed to allocate raw memory");
PanicAlertFmt("Failed to allocate raw memory");
return ptr;
}
@ -79,7 +79,7 @@ void* AllocateAlignedMemory(size_t size, size_t alignment)
#endif
if (ptr == nullptr)
PanicAlert("Failed to allocate aligned memory");
PanicAlertFmt("Failed to allocate aligned memory");
return ptr;
}
@ -90,10 +90,10 @@ void FreeMemoryPages(void* ptr, size_t size)
{
#ifdef _WIN32
if (!VirtualFree(ptr, 0, MEM_RELEASE))
PanicAlert("FreeMemoryPages failed!\nVirtualFree: %s", GetLastErrorString().c_str());
PanicAlertFmt("FreeMemoryPages failed!\nVirtualFree: {}", GetLastErrorString());
#else
if (munmap(ptr, size) != 0)
PanicAlert("FreeMemoryPages failed!\nmunmap: %s", LastStrerrorString().c_str());
PanicAlertFmt("FreeMemoryPages failed!\nmunmap: {}", LastStrerrorString());
#endif
}
}
@ -115,10 +115,10 @@ void ReadProtectMemory(void* ptr, size_t size)
#ifdef _WIN32
DWORD oldValue;
if (!VirtualProtect(ptr, size, PAGE_NOACCESS, &oldValue))
PanicAlert("ReadProtectMemory failed!\nVirtualProtect: %s", GetLastErrorString().c_str());
PanicAlertFmt("ReadProtectMemory failed!\nVirtualProtect: {}", GetLastErrorString());
#else
if (mprotect(ptr, size, PROT_NONE) != 0)
PanicAlert("ReadProtectMemory failed!\nmprotect: %s", LastStrerrorString().c_str());
PanicAlertFmt("ReadProtectMemory failed!\nmprotect: {}", LastStrerrorString());
#endif
}
@ -127,10 +127,10 @@ void WriteProtectMemory(void* ptr, size_t size, bool allowExecute)
#ifdef _WIN32
DWORD oldValue;
if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READ : PAGE_READONLY, &oldValue))
PanicAlert("WriteProtectMemory failed!\nVirtualProtect: %s", GetLastErrorString().c_str());
PanicAlertFmt("WriteProtectMemory failed!\nVirtualProtect: {}", GetLastErrorString());
#else
if (mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_EXEC) : PROT_READ) != 0)
PanicAlert("WriteProtectMemory failed!\nmprotect: %s", LastStrerrorString().c_str());
PanicAlertFmt("WriteProtectMemory failed!\nmprotect: {}", LastStrerrorString());
#endif
}
@ -139,12 +139,12 @@ void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute)
#ifdef _WIN32
DWORD oldValue;
if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE, &oldValue))
PanicAlert("UnWriteProtectMemory failed!\nVirtualProtect: %s", GetLastErrorString().c_str());
PanicAlertFmt("UnWriteProtectMemory failed!\nVirtualProtect: {}", GetLastErrorString());
#else
if (mprotect(ptr, size,
allowExecute ? (PROT_READ | PROT_WRITE | PROT_EXEC) : PROT_WRITE | PROT_READ) != 0)
{
PanicAlert("UnWriteProtectMemory failed!\nmprotect: %s", LastStrerrorString().c_str());
PanicAlertFmt("UnWriteProtectMemory failed!\nmprotect: {}", LastStrerrorString());
}
#endif
}