View Single Post
Re: HPB_bot template #4 released!
Old
  (#7)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: HPB_bot template #4 released! - 26-03-2004

This is needed to make the bot compatible with both Steam and non-Steam HL engines. There have been non-official changes to the HL SDK for the Steam engine, notably the adding of a bunch of new functions in the enginefuncs interface to support the Condition Zero carreer mode. The interface has thus grown from 144 function pointers (unsigned int), to 160 or 170, which makes more bytes to copy from one place to another in memory. But since older engines expect only 144 *4 bytes to be copied, if you memcpy() more and send them the WHOLE function table (including the new engine functions from Steam), chances are that the destination space will overflow and you will overwrite into forbidden memory, leading to a crash.

That's why, if we detect Steam, we send the engine the whole function list, and if we don't, we only send the engine the 144 first functions (that used to make the previous interface).

I should tell Will Day about this



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote