etfdevs / ETe

Improved Wolfenstein: Enemy Territory Engine
GNU General Public License v3.0
56 stars 17 forks source link

Fix 64-bit calling convention on Windows #98

Open Aciz opened 1 month ago

Aciz commented 1 month ago

On 64-bit, va_arg does not pass in all arguments via stack, instead some are passed in via registers. GCC/Clang expand these correctly to the argument list, but MSVC does some funky shit and would require some manual macro hell to correctly expand the arguments from registers to the va_arg call. By doing VM_Call like this, we avoid passing in random integers to mod in vmMain arguments.

https://blog.nelhage.com/2010/10/amd64-and-va_arg/