mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-22 10:04:39 +00:00
Add back memory functions that were already added once
Co-authored-by: squidbus <175574877+squidbus@users.noreply.github.com>
This commit is contained in:
parent
af0bdb89ed
commit
25afeb3602
@ -30,6 +30,43 @@ s32 PS4_SYSV_ABI internal_memcmp(const void* s1, const void* s2, size_t n) {
|
||||
return std::memcmp(s1, s2, n);
|
||||
}
|
||||
|
||||
void* PS4_SYSV_ABI internal_malloc(size_t size) {
|
||||
return std::malloc(size);
|
||||
}
|
||||
|
||||
void PS4_SYSV_ABI internal_free(void* ptr) {
|
||||
std::free(ptr);
|
||||
}
|
||||
|
||||
void* PS4_SYSV_ABI internal_operator_new(size_t size) {
|
||||
if (size == 0) {
|
||||
// Size of 1 is used if 0 is provided.
|
||||
size = 1;
|
||||
}
|
||||
void* ptr = std::malloc(size);
|
||||
ASSERT_MSG(ptr, "Failed to allocate new object with size {}", size);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void PS4_SYSV_ABI internal_operator_delete(void* ptr) {
|
||||
if (ptr) {
|
||||
std::free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI internal_posix_memalign(void** ptr, size_t alignment, size_t size) {
|
||||
#ifdef _WIN64
|
||||
void* allocated = _aligned_malloc(size, alignment);
|
||||
if (!allocated) {
|
||||
return errno;
|
||||
}
|
||||
*ptr = allocated;
|
||||
return 0;
|
||||
#else
|
||||
return posix_memalign(ptr, alignment, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
void RegisterlibSceLibcInternalMemory(Core::Loader::SymbolsResolver* sym) {
|
||||
|
||||
LIB_FUNCTION("NFLs+dRJGNg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
|
||||
@ -40,6 +77,19 @@ void RegisterlibSceLibcInternalMemory(Core::Loader::SymbolsResolver* sym) {
|
||||
internal_memset);
|
||||
LIB_FUNCTION("DfivPArhucg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
|
||||
internal_memcmp);
|
||||
LIB_FUNCTION("gQX+4GDQjpM", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
|
||||
internal_malloc);
|
||||
LIB_FUNCTION("tIhsqj0qsFE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_free);
|
||||
LIB_FUNCTION("fJnpuVVBbKk", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
|
||||
internal_operator_new);
|
||||
LIB_FUNCTION("hdm0YfMa7TQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
|
||||
internal_operator_new);
|
||||
LIB_FUNCTION("MLWl90SFWNE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
|
||||
internal_operator_delete);
|
||||
LIB_FUNCTION("z+P+xCnWLBk", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
|
||||
internal_operator_delete);
|
||||
LIB_FUNCTION("cVSk9y8URbc", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
|
||||
internal_posix_memalign);
|
||||
}
|
||||
|
||||
} // namespace Libraries::LibcInternal
|
||||
|
@ -10,5 +10,24 @@ class SymbolsResolver;
|
||||
}
|
||||
|
||||
namespace Libraries::LibcInternal {
|
||||
|
||||
void* PS4_SYSV_ABI internal_memset(void* s, int c, size_t n);
|
||||
|
||||
void* PS4_SYSV_ABI internal_memcpy(void* dest, const void* src, size_t n);
|
||||
|
||||
s32 PS4_SYSV_ABI internal_memcpy_s(void* dest, size_t destsz, const void* src, size_t count);
|
||||
|
||||
s32 PS4_SYSV_ABI internal_memcmp(const void* s1, const void* s2, size_t n);
|
||||
|
||||
void* PS4_SYSV_ABI internal_malloc(size_t size);
|
||||
|
||||
void PS4_SYSV_ABI internal_free(void* ptr);
|
||||
|
||||
void* PS4_SYSV_ABI internal_operator_new(size_t size);
|
||||
|
||||
void PS4_SYSV_ABI internal_operator_delete(void* ptr);
|
||||
|
||||
int PS4_SYSV_ABI internal_posix_memalign(void** ptr, size_t alignment, size_t size);
|
||||
|
||||
void RegisterlibSceLibcInternalMemory(Core::Loader::SymbolsResolver* sym);
|
||||
} // namespace Libraries::LibcInternal
|
Loading…
Reference in New Issue
Block a user