about summary refs log tree commit diff stats
path: root/src/wrapped32
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-09-14 17:36:45 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-09-14 17:36:45 +0200
commit9fa43f2386b6ee9370e69eda7f8023cf857f0bb9 (patch)
treedbb81791df55192dea635e4e7b26b37c1949c8ba /src/wrapped32
parentf2397256e2942500f6a7577c103bdb6fb3a98ac7 (diff)
downloadbox64-9fa43f2386b6ee9370e69eda7f8023cf857f0bb9.tar.gz
box64-9fa43f2386b6ee9370e69eda7f8023cf857f0bb9.zip
Added a hack so program that wprintf to the console actualy work if box64 already printed something
Diffstat (limited to 'src/wrapped32')
-rwxr-xr-xsrc/wrapped32/wrappedlibc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/wrapped32/wrappedlibc.c b/src/wrapped32/wrappedlibc.c
index e4b1ed82..8d387f91 100755
--- a/src/wrapped32/wrappedlibc.c
+++ b/src/wrapped32/wrappedlibc.c
@@ -728,10 +728,17 @@ EXPORT int my32_fprintf(x64emu_t *emu, void* F, void* fmt, void* V)  {
     return vfprintf(F, fmt, VARARGS_32);
 }
 EXPORT int my32___fprintf_chk(x64emu_t *emu, void* F, void* fmt, void* V) __attribute__((alias("my32_fprintf")));
+extern int box64_stdout_no_w;
 EXPORT int my32_wprintf(x64emu_t *emu, void* fmt, void* V) {
     // need to align on arm
     myStackAlignW32((const char*)fmt, V, emu->scratch);
     PREPARE_VALIST_32;
+    if(box64_stdout_no_w) {
+        wchar_t buff[2048];
+        int ret = vswprintf(buff, 2047, fmt, VARARGS_32);
+        printf("%S", buff);
+        return ret;
+    }
     return vwprintf(fmt, VARARGS_32);
 }
 #if 0