mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-24 19:14:40 +00:00
fixed fprintf
This commit is contained in:
parent
751fca0616
commit
7764f13cce
@ -54,10 +54,12 @@ int PS4_SYSV_ABI ps4_fprintf(FILE* file, VA_ARGS) {
|
|||||||
if (fd == 1 || fd == 2) { // output stdout and stderr to console
|
if (fd == 1 || fd == 2) { // output stdout and stderr to console
|
||||||
VA_CTX(ctx);
|
VA_CTX(ctx);
|
||||||
return printf_ctx(&ctx);
|
return printf_ctx(&ctx);
|
||||||
|
} else {
|
||||||
|
VA_CTX(ctx);
|
||||||
|
char buf[256];
|
||||||
|
fprintf_ctx(&ctx,buf);
|
||||||
|
return fprintf(file,"%s", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
UNREACHABLE_MSG("Unimplemented fprintf case");
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI ps4_vsnprintf(char* s, size_t n, const char* format, VaList* arg) {
|
int PS4_SYSV_ABI ps4_vsnprintf(char* s, size_t n, const char* format, VaList* arg) {
|
||||||
|
@ -736,6 +736,14 @@ static int printf_ctx(VaCtx* ctx) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int fprintf_ctx(VaCtx* ctx,char *buf) {
|
||||||
|
const char* format = vaArgPtr<const char>(&ctx->va_list);
|
||||||
|
char buffer[256];
|
||||||
|
int result = _vsnprintf(_out_buffer, buffer, format, &ctx->va_list);
|
||||||
|
strcpy(buf, buffer);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static int vsnprintf_ctx(char* s, size_t n, const char* format, VaList* arg) {
|
static int vsnprintf_ctx(char* s, size_t n, const char* format, VaList* arg) {
|
||||||
char buffer[n];
|
char buffer[n];
|
||||||
int result = _vsnprintf(_out_buffer, buffer, format, arg);
|
int result = _vsnprintf(_out_buffer, buffer, format, arg);
|
||||||
|
Loading…
Reference in New Issue
Block a user