more libc string functions
This commit is contained in:
parent
365222ee9a
commit
c6459f35a7
|
@ -115,6 +115,7 @@ void libcSymbolsRegister(Loader::SymbolsResolver* sym) {
|
||||||
LIB_FUNCTION("DfivPArhucg", "libc", 1, "libc", 1, 1, memcmp);
|
LIB_FUNCTION("DfivPArhucg", "libc", 1, "libc", 1, 1, memcmp);
|
||||||
LIB_FUNCTION("Q3VBxCXhUHs", "libc", 1, "libc", 1, 1, memcpy);
|
LIB_FUNCTION("Q3VBxCXhUHs", "libc", 1, "libc", 1, 1, memcpy);
|
||||||
LIB_FUNCTION("8zTFvBIAIN8", "libc", 1, "libc", 1, 1, memset);
|
LIB_FUNCTION("8zTFvBIAIN8", "libc", 1, "libc", 1, 1, memset);
|
||||||
|
LIB_FUNCTION("viiwFMaNamA", "libc", 1, "libc", 1, 1, strstr);
|
||||||
|
|
||||||
// stdio functions
|
// stdio functions
|
||||||
LIB_FUNCTION("hcuQgD53UxM", "libc", 1, "libc", 1, 1, printf);
|
LIB_FUNCTION("hcuQgD53UxM", "libc", 1, "libc", 1, 1, printf);
|
||||||
|
|
|
@ -1,42 +1,37 @@
|
||||||
#include <cstring>
|
|
||||||
#include "core/hle/libraries/libc/libc_string.h"
|
#include "core/hle/libraries/libc/libc_string.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
#include <common/log.h>
|
||||||
|
|
||||||
namespace Core::Libraries::LibC {
|
namespace Core::Libraries::LibC {
|
||||||
|
|
||||||
int PS4_SYSV_ABI memcmp(const void* s1, const void* s2, size_t n) {
|
constexpr bool log_file_libc = true; // disable it to disable logging
|
||||||
return std::memcmp(s1, s2, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
void* PS4_SYSV_ABI memcpy(void* dest, const void* src, size_t n) {
|
int PS4_SYSV_ABI memcmp(const void* s1, const void* s2, size_t n) { return std::memcmp(s1, s2, n); }
|
||||||
return std::memcpy(dest, src, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
void* PS4_SYSV_ABI memset(void* s, int c, size_t n) {
|
void* PS4_SYSV_ABI memcpy(void* dest, const void* src, size_t n) { return std::memcpy(dest, src, n); }
|
||||||
return std::memset(s, c, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
int PS4_SYSV_ABI strcmp(const char* str1, const char* str2) {
|
void* PS4_SYSV_ABI memset(void* s, int c, size_t n) { return std::memset(s, c, n); }
|
||||||
return std::strcmp(str1, str2);
|
|
||||||
}
|
|
||||||
|
|
||||||
char* PS4_SYSV_ABI strncpy(char* dest, const char* src, size_t count) {
|
int PS4_SYSV_ABI strcmp(const char* str1, const char* str2) { return std::strcmp(str1, str2); }
|
||||||
return std::strncpy(dest, src, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
void* PS4_SYSV_ABI memmove(void* dest, const void* src, std::size_t count) {
|
char* PS4_SYSV_ABI strncpy(char* dest, const char* src, size_t count) { return std::strncpy(dest, src, count); }
|
||||||
return std::memmove(dest, src, count);
|
|
||||||
}
|
void* PS4_SYSV_ABI memmove(void* dest, const void* src, std::size_t count) { return std::memmove(dest, src, count); }
|
||||||
|
|
||||||
char* PS4_SYSV_ABI strcpy(char* dest, const char* src) {
|
char* PS4_SYSV_ABI strcpy(char* dest, const char* src) {
|
||||||
|
LOG_TRACE_IF(log_file_libc, "strcpy dest ={} src ={}", dest, src);
|
||||||
return std::strcpy(dest, src);
|
return std::strcpy(dest, src);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* PS4_SYSV_ABI strcat(char* dest, const char* src) {
|
char* PS4_SYSV_ABI strcat(char* dest, const char* src) {
|
||||||
|
LOG_TRACE_IF(log_file_libc, "strcat dest ={} src ={}", dest, src);
|
||||||
return std::strcat(dest, src);
|
return std::strcat(dest, src);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t PS4_SYSV_ABI strlen(const char* str) {
|
size_t PS4_SYSV_ABI strlen(const char* str) { return std::strlen(str); }
|
||||||
return std::strlen(str);
|
char* PS4_SYSV_ABI strstr(const char* haystack, const char* needle) {
|
||||||
|
LOG_TRACE_IF(log_file_libc, "strstr haystack ={} needle ={}", haystack, needle);
|
||||||
|
return (char*)std::strstr(haystack, needle);
|
||||||
}
|
}
|
||||||
|
} // namespace Core::Libraries::LibC
|
||||||
} // namespace Core::Libraries::LibC
|
|
||||||
|
|
|
@ -14,5 +14,5 @@ void* PS4_SYSV_ABI memmove(void* dest, const void* src, std::size_t count);
|
||||||
char* PS4_SYSV_ABI strcpy(char* destination, const char* source);
|
char* PS4_SYSV_ABI strcpy(char* destination, const char* source);
|
||||||
char* PS4_SYSV_ABI strcat(char* dest, const char* src);
|
char* PS4_SYSV_ABI strcat(char* dest, const char* src);
|
||||||
size_t PS4_SYSV_ABI strlen(const char* str);
|
size_t PS4_SYSV_ABI strlen(const char* str);
|
||||||
|
char* PS4_SYSV_ABI strstr(const char* haystack, const char* needle);
|
||||||
} // namespace Core::Libraries::LibC
|
} // namespace Core::Libraries::LibC
|
||||||
|
|
Loading…
Reference in New Issue