thelink2012 / modloader

Mod Loader for GTA III, Vice City and San Andreas
MIT License
268 stars 29 forks source link

Use compiler intrinsics instead of CaptureStackBackTrace #13

Closed thelink2012 closed 10 years ago

thelink2012 commented 10 years ago

On the plugin std-asi, instead of calling CaptureStackBackTrace to get a reference to the caller module, use compiler intrinsics!

CaptureStackBackTrace may fail on unknown circumstances, while the compiler instricts won't. . Since it will be directly getting the return address from the stack (esp/ebp), it is also much faster than the current method.

The instricts are: _ReturnAddress() on MSVC ___builtin_returnaddress(0) on MinGW GCC.

Files that needs the patch: _translatorcdecl.hpp _translatorstdcall.hpp