From ee78a74025b78b0c5c813a7beb7c94629a30c2ff Mon Sep 17 00:00:00 2001 From: DwifteJB Date: Wed, 4 Mar 2026 21:27:29 +0000 Subject: [PATCH] fix: implement IobShim.cpp --- Minecraft.Client/IobShim.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Minecraft.Client/IobShim.cpp b/Minecraft.Client/IobShim.cpp index bb7b9b29e..a3059f496 100644 --- a/Minecraft.Client/IobShim.cpp +++ b/Minecraft.Client/IobShim.cpp @@ -1,5 +1,7 @@ // Original file is iob_shim.asm // Rewritten in C because the build system breaks on linux-windows crosscomp with this +// rm: __declspec(naked) is seemingly(?) not working on x86_64 (atleast via wine); use __attribute__((naked)) instead. + #if 0 .code EXTRN __acrt_iob_func:PROC @@ -14,7 +16,11 @@ END #include -extern "C" FILE* __cdecl __iob_func ( void ) { - static FILE iob [ ] = { *stdin, *stdout, *stderr }; - return iob; +extern "C" FILE* __cdecl __acrt_iob_func(unsigned index); + +extern "C" __attribute__((naked)) FILE* __cdecl __iob_func(void) { + __asm__( + "xorl %ecx, %ecx\n\t" + "jmp __acrt_iob_func" + ); }