diff --git a/src/core/hle/libraries/libc/libc_stdio.cpp b/src/core/hle/libraries/libc/libc_stdio.cpp index 4292ed1ff..84ddd3bfd 100644 --- a/src/core/hle/libraries/libc/libc_stdio.cpp +++ b/src/core/hle/libraries/libc/libc_stdio.cpp @@ -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 VA_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) { diff --git a/src/core/hle/libraries/libc/printf.h b/src/core/hle/libraries/libc/printf.h index 8bf98adaa..55e1610af 100644 --- a/src/core/hle/libraries/libc/printf.h +++ b/src/core/hle/libraries/libc/printf.h @@ -736,6 +736,14 @@ static int printf_ctx(VaCtx* ctx) { return result; } +static int fprintf_ctx(VaCtx* ctx,char *buf) { + const char* format = vaArgPtr(&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) { char buffer[n]; int result = _vsnprintf(_out_buffer, buffer, format, arg);