mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-20 11:35:45 +00:00
fixed fprintf
This commit is contained in:
parent
751fca0616
commit
7764f13cce
2 changed files with 13 additions and 3 deletions
|
@ -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) {
|
||||
|
|
|
@ -736,6 +736,14 @@ static int printf_ctx(VaCtx* ctx) {
|
|||
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) {
|
||||
char buffer[n];
|
||||
int result = _vsnprintf(_out_buffer, buffer, format, arg);
|
||||
|
|
Loading…
Add table
Reference in a new issue