Initial LibcInternal

This commit is contained in:
georgemoralis 2024-05-13 16:13:33 +03:00
parent 99e4301dcc
commit f1883870fd
6 changed files with 60 additions and 0 deletions

View File

@ -175,6 +175,8 @@ set(LIBC_SOURCES src/core/libraries/libc/libc.cpp
src/core/libraries/libc/libc_string.h
src/core/libraries/libc/libc_stdlib.cpp
src/core/libraries/libc/libc_stdlib.h
src/core/libraries/libc_internal/libc_internal.cpp
src/core/libraries/libc_internal/libc_internal.h
)
set(PAD_LIB src/core/libraries/pad/pad.cpp

View File

@ -100,6 +100,7 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
SUB(Lib, NpScore) \
SUB(Lib, NpTrophy) \
SUB(Lib, Screenshot) \
SUB(Lib, LibCInternal) \
CLS(Frontend) \
CLS(Render) \
SUB(Render, Vulkan) \

View File

@ -67,6 +67,7 @@ enum class Class : u8 {
Lib_NpScore, ///< The LibSceNpScore implementation
Lib_NpTrophy, ///< The LibSceNpTrophy implementation
Lib_Screenshot, ///< The LibSceScreenshot implementation
Lib_LibCInternal, ///< The LibCInternal implementation.
Frontend, ///< Emulator UI
Render, ///< Video Core
Render_Vulkan, ///< Vulkan backend

View File

@ -0,0 +1,39 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
// Generated By moduleGenerator
#include "common/logging/log.h"
#include "core/libraries/error_codes.h"
#include "core/libraries/libs.h"
#include "libc_internal.h"
namespace Libraries::LibcInternal {
void* PS4_SYSV_ABI internal_memset(void* s, int c, size_t n) {
return std::memset(s, c, n);
}
errno_t PS4_SYSV_ABI internal_memcpy_s(void* dest, rsize_t destsz, const void* src, rsize_t count) {
return memcpy_s(dest, destsz, src, count);
}
errno_t PS4_SYSV_ABI internal_strcpy_s(char* dest, rsize_t dest_size, const char* src) {
return strcpy_s(dest, dest_size, src);
}
int PS4_SYSV_ABI internal_memcmp(const void* s1, const void* s2, size_t n) {
return std::memcmp(s1, s2, n);
}
void RegisterlibSceLibcInternal(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("NFLs+dRJGNg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_memcpy_s);
LIB_FUNCTION("8zTFvBIAIN8", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_memset);
LIB_FUNCTION("5Xa2ACNECdo", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strcpy_s);
LIB_FUNCTION("DfivPArhucg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_memcmp);
};
} // namespace Libraries::LibcInternal

View File

@ -0,0 +1,15 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/types.h"
namespace Core::Loader {
class SymbolsResolver;
}
namespace Libraries::LibcInternal {
void RegisterlibSceLibcInternal(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::LibcInternal

View File

@ -7,6 +7,7 @@
#include "core/libraries/gnmdriver/gnmdriver.h"
#include "core/libraries/kernel/libkernel.h"
#include "core/libraries/libc/libc.h"
#include "core/libraries/libc_internal/libc_internal.h"
#include "core/libraries/libs.h"
#include "core/libraries/network/http.h"
#include "core/libraries/network/net.h"
@ -57,6 +58,7 @@ void InitHLELibs(Core::Loader::SymbolsResolver* sym) {
Libraries::NpScore::RegisterlibSceNpScore(sym);
Libraries::NpTrophy::RegisterlibSceNpTrophy(sym);
Libraries::ScreenShot::RegisterlibSceScreenShot(sym);
Libraries::LibcInternal::RegisterlibSceLibcInternal(sym);
}
} // namespace Libraries