diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 62a6416..1b21e72 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -5472,6 +5472,21 @@ void SV_CreateBaseline(void) * leads to inconsistent behavior (since stack data may contain pointers) across different systems. */ /* + * This is true in theory, but in reality things might differs. In Valve's Linux all builds hl.so (and cs.so) expects pointers instead of array elements. + * This looks like a flaw in the compilers or some option, because code specifies to pass a class object which should be passed by a value in that case. + * And this is correctly happen in MSVC, ICC and modern GCC. + * Also, there often will be a metatmod in between that is designed to get and pass pointers. + * So, we have no choice but to pass data but reference so functions that expects references don't crash on dereference + * and append some fake data for the cases when called function will be the one that expects pass by value. + */ + /* + * If you are the mod author, you can correctly receive the data by changing CreateBaseline signature: + * vec3_t player_mins, vec3_t player_maxs + * into + * vec3_t& player_mins, vec3_t& player_maxs + * so after macro expantion it will be the class passed by reference. + */ + /* * This function call emulates swds.dll behavior, i.e. it sends the same garbage when invoking CreateBaseline as swds.dll does. * This is required since not emulating this behavior will break rehlds test demos. */