.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   HPB_bot (http://forums.bots-united.com/forumdisplay.php?f=35)
-   -   Bug in Template version 4 (http://forums.bots-united.com/showthread.php?t=2571)

koraX 30-08-2004 21:39

Bug in Template version 4
 
first look here

1. bug

defined in dlls\h_export.cpp : (same as HPBT3)
Code:

#ifndef __linux__
#ifdef __BORLANDC__
extern "C" DLLEXPORT void EXPORT GiveFnptrsToDll(enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals)
#else
void      DLLEXPORT GiveFnptrsToDll(enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals )
#endif
#else
extern "C" DLLEXPORT GiveFnptrsToDll(enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals )
#endif

ERROR : Under linux, GiveFnptrsToDll will not be returning void (?will return int?). This differs from the SDKs definition. Also definition under Borland looks very strange.

I've read many posts in old botmans forum regarding missing void type ("h_export.cpp: ISO C++ forbids declaration of `GiveFnptrsToDll' with no type"). This can be IMHO simply fixed by adding void return type to declaration of GiveFnptrsToDll() where it is missing.


2. bug, more serious

Defined in dlls\h_export.cpp :
Code:

#ifdef __BORLANDC__
extern "C" DLLEXPORT int EXPORT Server_GetBlendingInterface
( int version, struct sv_blending_interface_s **ppinterface,
struct engine_studio_api_s *pstudio, float (*rotationmatrix)[3][4],
float (*bonetransform)[MAXSTUDIOBONES][3][4] )
#else
int DLLEXPORT Server_GetBlendingInterface
( int version, struct sv_blending_interface_s **ppinterface,
struct engine_studio_api_s *pstudio, float (*rotationmatrix)[3][4],
float (*bonetransform)[MAXSTUDIOBONES][3][4] )
#endif
{
  static SERVER_GETBLENDINGINTERFACE other_Server_GetBlendingInterface = NULL;
  static bool missing = FALSE;
  // if the blending interface has been formerly reported as missing, give up
  if (missing)
      return (FALSE);
  // do we NOT know if the blending interface is provided ? if so, look for its address
  if (other_Server_GetBlendingInterface == NULL)
      other_Server_GetBlendingInterface = (SERVER_GETBLENDINGINTERFACE) GetProcAddress (h_Library, "Server_GetBlendingInterface");
  // have we NOT found it ?
  if (!other_Server_GetBlendingInterface) {
      missing = TRUE; // then mark it as missing, no use to look for it again in the future
      return (FALSE); // and give up
  }
  // else call the function that provides the blending interface on request
  return ((other_Server_GetBlendingInterface) (version, ppinterface, pstudio, rotationmatrix, bonetransform));
}

***ERROR*** : This function is not exported under MSVC. DLLEXPORT macro is wrong and there is no declarator telling that this function should be exported. If this function will be exported by some miracle or .def file, it will crash whole Half-life for sure, because of wrong __stdcall calling convention. Calling convention for this function is __cdecl, which is default



.

Pierre-Marie Baty 30-08-2004 23:17

Re: Bug in Template version 4
 
Fixed

I was the guy responsible of adding Steam support and the blending interface stuff in botman's template. I'm the person to blame :|

koraX 03-09-2004 21:29

Re: Bug in Template version 4
 
Quote:

Originally Posted by Pierre-Marie Baty
I'm the person to blame :|

I blame you again :D

you forgot to change functions declaration in bot.h :
Code:

typedef int (DLLEXPORT *SERVER_GETBLENDINGINTERFACE) ( ... );
Though Server_GetBlendingInterface is exported correctly, it loads Server_GetBlendingInterface from game dll and converts it to that wrong pointer. So it will probably crash.

correct is same as for linux :
Code:

typedef int (*SERVER_GETBLENDINGINTERFACE) ( ... );


All times are GMT +2. The time now is 11:35.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.