DK22Pac / plugin-sdk

An SDK for developing ASI/CLEO plugins for GTA San Andreas, GTA Vice City and GTA III
zlib License
431 stars 114 forks source link

Fix: assembly.hpp now compiles with mingw #176

Closed likeawindrammer closed 9 months ago

likeawindrammer commented 9 months ago

This file used to have inline assembly that would only compile with msvc, a new code path was added for other compilers, but keeping the original assembly exactly so that compilation with msvc will continue to generate the exact same instructions.

A summary of the changes:

This is the generated machine code of the assembly for and used only for mingw as compiled by mingw:

Disassembly of section .text$_ZN8injector12injector_asm22make_reg_pack_and_callINS0_7wrapperI10staticHookEEEEvv:
00000000 <__ZN8injector12injector_asm22make_reg_pack_and_callINS0_7wrapperI10staticHookEEEEvv>:
   0:   60                      pusha
   1:   83 44 24 0c 04          add    DWORD PTR [esp+0xc],0x4
   6:   9c                      pushf
   7:   54                      push   esp
   8:   e8 00 00 00 00          call   d <__ZN8injector12injector_asm22make_reg_pack_and_callINS0_7wrapperI10staticHookEEEEvv+0xd>
   d:   83 c4 04                add    esp,0x4
  10:   83 6c 24 10 04          sub    DWORD PTR [esp+0x10],0x4
  15:   9d                      popf
  16:   61                      popa
  17:   c3                      ret
  18:   0f 0b                   ud2
  1a:   90                      nop
  1b:   90                      nop
  1c:   90                      nop
  1d:   90                      nop
  1e:   90                      nop
  1f:   90                      nop