mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-20 03:24:49 +00:00
sprintf implementation
This commit is contained in:
parent
9b8615e99b
commit
49090c1ba5
4 changed files with 16 additions and 2 deletions
|
@ -441,7 +441,7 @@ void libcSymbolsRegister(Loader::SymbolsResolver* sym) {
|
|||
LIB_FUNCTION("YQ0navp+YIc", "libc", 1, "libc", 1, 1, puts);
|
||||
LIB_FUNCTION("fffwELXNVFA", "libc", 1, "libc", 1, 1, fprintf);
|
||||
LIB_FUNCTION("eLdDw6l0-bU", "libc", 1, "libc", 1, 1, snprintf);
|
||||
|
||||
LIB_FUNCTION("tcVi5SivF7Q", "libc", 1, "libc", 1, 1, sprintf);
|
||||
// misc
|
||||
LIB_OBJ("P330P3dFF68", "libc", 1, "libc", 1, 1, &g_need_sceLibc);
|
||||
LIB_OBJ("2sWzhYqFH4E","libc", 1, "libc", 1, 1,stdout);
|
||||
|
|
|
@ -27,6 +27,11 @@ int PS4_SYSV_ABI snprintf(char* s, size_t n, VA_ARGS) {
|
|||
return snprintf_ctx(s, n, &ctx);
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sprintf(char* s,VA_ARGS) {
|
||||
VA_CTX(ctx);
|
||||
return sprintf_ctx(s,&ctx);
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI vsnprintf(char* s, size_t n, const char* format, VaList* arg) {
|
||||
return vsnprintf_ctx(s, n, format, arg);
|
||||
}
|
||||
|
|
|
@ -10,4 +10,5 @@ int PS4_SYSV_ABI vsnprintf(char* s, size_t n, const char* format, VaList* arg);
|
|||
int PS4_SYSV_ABI puts(const char* s);
|
||||
int PS4_SYSV_ABI fprintf(FILE* file, VA_ARGS);
|
||||
int PS4_SYSV_ABI snprintf(char* s, size_t n, VA_ARGS);
|
||||
} // namespace Core::Libraries::LibC
|
||||
int PS4_SYSV_ABI sprintf(char* s, VA_ARGS);
|
||||
} // namespace Core::Libraries::LibC
|
||||
|
|
|
@ -702,6 +702,14 @@ static int snprintf_ctx(char* s, size_t n,VaCtx* ctx) {
|
|||
return result;
|
||||
}
|
||||
|
||||
static int sprintf_ctx(char* s, VaCtx* ctx) {
|
||||
const char* format = vaArgPtr<const char>(&ctx->va_list);
|
||||
char buffer[256]; // it is big enough?
|
||||
int result = _vsnprintf(_out_buffer, buffer, format, &ctx->va_list);
|
||||
std::strcpy(s, buffer);
|
||||
return result;
|
||||
}
|
||||
|
||||
static int vsnprintf_ctx(char* s, size_t n, const char* format, VaList* arg) {
|
||||
char buffer[n];
|
||||
int result = _vsnprintf(_out_buffer, buffer, format, arg);
|
||||
|
|
Loading…
Add table
Reference in a new issue