.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Bot Coding
General Bot Coding See what a pain it is to get those little mechs shooting around

Reply
 
Thread Tools
Problem with the sounds in AMX
Old
  (#1)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,618
Join Date: Jul 2004
Location: Bulgaria
Default Problem with the sounds in AMX - 26-05-2005

Ok since many people have reported that after they install E[POD]bot the AMX sounds and some menues are disabled, I start to looking for a way to fix that. So I try the old version of RACC that too load metamod and there is no problem with it, all sounds and menues are in place but when E[POD]bot load metamod the sounds and some menues are gone. So I start to think that is from the GiveFnptrsToDll() function but I can't understand where I wrong. If you can help me? Here the function :

Code:
void WINAPI GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals )
{

   // get the engine functions from the engine...
   memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t));
   gpGlobals = pGlobals;

#ifndef __linux__
	// This is the new metamod support.
	// metamod.dll will be loaded instead of mp.dll if it exists.
	// Metamod then will run and load mp.dll, the normal CS-Game-DLL
 
	// It has to be in "default" folder "addons/metamod/dlls/metamod.dll"
	
	// see if metamod exists

   if (FileExists (METAMOD_DLL)) //if it exists, load metamod as game DLL (it will load the cs game dll for us)
	   h_Library = LoadLibrary (METAMOD_DLL);// if so, load the metamod DLL
   else //else load normal CS-DLL
	   h_Library = LoadLibrary (CS_DLL); // else, load the official game DLL
#else
   h_Library = dlopen("cstrike/dlls/cs_i386.so", RTLD_NOW);
#endif

   if (!h_Library)
   {
	 // Directory error or Unsupported MOD!
		ALERT( at_error, "E[POD]bot couldn't find the CounterStrike DLL!" );
		fp=fopen("PODERROR.txt","a"); fprintf(fp, "E[POD]bot couldn't find the CounterStrike DLL!\n"); fclose(fp);
   }


#ifndef __linux__
   h_global_argv = GlobalAlloc(GMEM_SHARE, 1024);
   g_argv = (char *)GlobalLock(h_global_argv);
#else
   g_argv = (char *)h_global_argv;
#endif

   other_GetEntityAPI = (GETENTITYAPI)GetProcAddress(h_Library, "GetEntityAPI");
   other_GetNewDLLFunctions = (GETNEWDLLFUNCTIONS)GetProcAddress(h_Library, "GetNewDLLFunctions");
   other_GiveFnptrsToDll = (GIVEFNPTRSTODLL)GetProcAddress(h_Library, "GiveFnptrsToDll");

#ifdef _WIN32
   LoadSymbols (CS_DLL);  // Load exported symbol table
   pengfuncsFromEngine->pfnFunctionFromName = pfnFunctionFromName;
   pengfuncsFromEngine->pfnNameForFunction = pfnNameForFunction;
#endif

// for engine testing
   pengfuncsFromEngine->pfnCmd_Args = pfnCmd_Args;
   pengfuncsFromEngine->pfnCmd_Argv = pfnCmd_Argv;
   pengfuncsFromEngine->pfnCmd_Argc = pfnCmd_Argc;
   pengfuncsFromEngine->pfnPrecacheModel = pfnPrecacheModel;
   pengfuncsFromEngine->pfnPrecacheSound = pfnPrecacheSound;
   pengfuncsFromEngine->pfnSetModel = pfnSetModel;
   pengfuncsFromEngine->pfnModelIndex = pfnModelIndex;
   pengfuncsFromEngine->pfnModelFrames = pfnModelFrames;
   pengfuncsFromEngine->pfnSetSize = pfnSetSize;
   pengfuncsFromEngine->pfnChangeLevel = pfnChangeLevel;
   pengfuncsFromEngine->pfnGetSpawnParms = pfnGetSpawnParms;
   pengfuncsFromEngine->pfnSaveSpawnParms = pfnSaveSpawnParms;
   pengfuncsFromEngine->pfnVecToYaw = pfnVecToYaw;
   pengfuncsFromEngine->pfnVecToAngles = pfnVecToAngles;
   pengfuncsFromEngine->pfnMoveToOrigin = pfnMoveToOrigin;
   pengfuncsFromEngine->pfnChangeYaw = pfnChangeYaw;
   pengfuncsFromEngine->pfnChangePitch = pfnChangePitch;
   pengfuncsFromEngine->pfnFindEntityByString = pfnFindEntityByString;
   pengfuncsFromEngine->pfnGetEntityIllum = pfnGetEntityIllum;
   pengfuncsFromEngine->pfnFindEntityInSphere = pfnFindEntityInSphere;
   pengfuncsFromEngine->pfnFindClientInPVS = pfnFindClientInPVS;
   pengfuncsFromEngine->pfnEntitiesInPVS = pfnEntitiesInPVS;
   pengfuncsFromEngine->pfnMakeVectors = pfnMakeVectors;
   pengfuncsFromEngine->pfnAngleVectors = pfnAngleVectors;
   pengfuncsFromEngine->pfnCreateEntity = pfnCreateEntity;
   pengfuncsFromEngine->pfnRemoveEntity = pfnRemoveEntity;
   pengfuncsFromEngine->pfnCreateNamedEntity = pfnCreateNamedEntity;
   pengfuncsFromEngine->pfnMakeStatic = pfnMakeStatic;
   pengfuncsFromEngine->pfnEntIsOnFloor = pfnEntIsOnFloor;
   pengfuncsFromEngine->pfnDropToFloor = pfnDropToFloor;
   pengfuncsFromEngine->pfnWalkMove = pfnWalkMove;
   pengfuncsFromEngine->pfnSetOrigin = pfnSetOrigin;
   pengfuncsFromEngine->pfnEmitSound = pfnEmitSound;
   pengfuncsFromEngine->pfnEmitAmbientSound = pfnEmitAmbientSound;
   pengfuncsFromEngine->pfnTraceLine = pfnTraceLine;
   pengfuncsFromEngine->pfnTraceToss = pfnTraceToss;
   pengfuncsFromEngine->pfnTraceMonsterHull = pfnTraceMonsterHull;
   pengfuncsFromEngine->pfnTraceHull = pfnTraceHull;
   pengfuncsFromEngine->pfnTraceModel = pfnTraceModel;
   pengfuncsFromEngine->pfnTraceTexture = pfnTraceTexture;
   pengfuncsFromEngine->pfnTraceSphere = pfnTraceSphere;
   pengfuncsFromEngine->pfnGetAimVector = pfnGetAimVector;
   pengfuncsFromEngine->pfnServerCommand = pfnServerCommand;
   pengfuncsFromEngine->pfnServerExecute = pfnServerExecute;
   pengfuncsFromEngine->pfnClientCommand = pfnClientCommand;
   pengfuncsFromEngine->pfnParticleEffect = pfnParticleEffect;
   pengfuncsFromEngine->pfnLightStyle = pfnLightStyle;
   pengfuncsFromEngine->pfnDecalIndex = pfnDecalIndex;
   pengfuncsFromEngine->pfnPointContents = pfnPointContents;
   pengfuncsFromEngine->pfnMessageBegin = pfnMessageBegin;
   pengfuncsFromEngine->pfnMessageEnd = pfnMessageEnd;
   pengfuncsFromEngine->pfnWriteByte = pfnWriteByte;
   pengfuncsFromEngine->pfnWriteChar = pfnWriteChar;
   pengfuncsFromEngine->pfnWriteShort = pfnWriteShort;
   pengfuncsFromEngine->pfnWriteLong = pfnWriteLong;
   pengfuncsFromEngine->pfnWriteAngle = pfnWriteAngle;
   pengfuncsFromEngine->pfnWriteCoord = pfnWriteCoord;
   pengfuncsFromEngine->pfnWriteString = pfnWriteString;
   pengfuncsFromEngine->pfnWriteEntity = pfnWriteEntity;
   pengfuncsFromEngine->pfnCVarRegister = pfnCVarRegister;
   pengfuncsFromEngine->pfnCVarGetFloat = pfnCVarGetFloat;
   pengfuncsFromEngine->pfnCVarGetString = pfnCVarGetString;
   pengfuncsFromEngine->pfnCVarSetFloat = pfnCVarSetFloat;
   pengfuncsFromEngine->pfnCVarSetString = pfnCVarSetString;
   pengfuncsFromEngine->pfnPvAllocEntPrivateData = pfnPvAllocEntPrivateData;
   pengfuncsFromEngine->pfnPvEntPrivateData = pfnPvEntPrivateData;
   pengfuncsFromEngine->pfnFreeEntPrivateData = pfnFreeEntPrivateData;
   pengfuncsFromEngine->pfnSzFromIndex = pfnSzFromIndex;
   pengfuncsFromEngine->pfnAllocString = pfnAllocString;
   pengfuncsFromEngine->pfnGetVarsOfEnt = pfnGetVarsOfEnt;
   pengfuncsFromEngine->pfnPEntityOfEntOffset = pfnPEntityOfEntOffset;
   pengfuncsFromEngine->pfnEntOffsetOfPEntity = pfnEntOffsetOfPEntity;
   pengfuncsFromEngine->pfnIndexOfEdict = pfnIndexOfEdict;
   pengfuncsFromEngine->pfnPEntityOfEntIndex = pfnPEntityOfEntIndex;
   pengfuncsFromEngine->pfnFindEntityByVars = pfnFindEntityByVars;
   pengfuncsFromEngine->pfnGetModelPtr = pfnGetModelPtr;
   pengfuncsFromEngine->pfnRegUserMsg = pfnRegUserMsg;
   pengfuncsFromEngine->pfnAnimationAutomove = pfnAnimationAutomove;
   pengfuncsFromEngine->pfnGetBonePosition = pfnGetBonePosition;
   pengfuncsFromEngine->pfnClientPrintf = pfnClientPrintf;
   pengfuncsFromEngine->pfnServerPrint = pfnServerPrint;
   pengfuncsFromEngine->pfnGetAttachment = pfnGetAttachment;
   pengfuncsFromEngine->pfnCRC32_Init = pfnCRC32_Init;
   pengfuncsFromEngine->pfnCRC32_ProcessBuffer = pfnCRC32_ProcessBuffer;
   pengfuncsFromEngine->pfnCRC32_ProcessByte = pfnCRC32_ProcessByte;
   pengfuncsFromEngine->pfnCRC32_Final = pfnCRC32_Final;
   pengfuncsFromEngine->pfnRandomLong = pfnRandomLong;
   pengfuncsFromEngine->pfnRandomFloat = pfnRandomFloat;
   pengfuncsFromEngine->pfnSetView = pfnSetView;
   pengfuncsFromEngine->pfnTime = pfnTime;
   pengfuncsFromEngine->pfnCrosshairAngle = pfnCrosshairAngle;
   pengfuncsFromEngine->pfnLoadFileForMe = pfnLoadFileForMe;
   pengfuncsFromEngine->pfnFreeFile = pfnFreeFile;
   pengfuncsFromEngine->pfnEndSection = pfnEndSection;
   pengfuncsFromEngine->pfnCompareFileTime = pfnCompareFileTime;
   pengfuncsFromEngine->pfnGetGameDir = pfnGetGameDir;
   pengfuncsFromEngine->pfnCvar_RegisterVariable = pfnCvar_RegisterVariable;
   pengfuncsFromEngine->pfnFadeClientVolume = pfnFadeClientVolume;
   pengfuncsFromEngine->pfnSetClientMaxspeed = pfnSetClientMaxspeed;
   pengfuncsFromEngine->pfnCreateFakeClient = pfnCreateFakeClient;
   pengfuncsFromEngine->pfnRunPlayerMove = pfnRunPlayerMove;
   pengfuncsFromEngine->pfnNumberOfEntities = pfnNumberOfEntities;
   pengfuncsFromEngine->pfnGetInfoKeyBuffer = pfnGetInfoKeyBuffer;
   pengfuncsFromEngine->pfnInfoKeyValue = pfnInfoKeyValue;
   pengfuncsFromEngine->pfnSetKeyValue = pfnSetKeyValue;
   pengfuncsFromEngine->pfnSetClientKeyValue = pfnSetClientKeyValue;
   pengfuncsFromEngine->pfnIsMapValid = pfnIsMapValid;
   pengfuncsFromEngine->pfnStaticDecal = pfnStaticDecal;
   pengfuncsFromEngine->pfnPrecacheGeneric = pfnPrecacheGeneric;
   pengfuncsFromEngine->pfnGetPlayerUserId = pfnGetPlayerUserId;
   pengfuncsFromEngine->pfnBuildSoundMsg = pfnBuildSoundMsg;
   pengfuncsFromEngine->pfnIsDedicatedServer = pfnIsDedicatedServer;
   pengfuncsFromEngine->pfnCVarGetPointer = pfnCVarGetPointer;
   pengfuncsFromEngine->pfnGetPlayerWONId = pfnGetPlayerWONId;
// end engine testing

   // give the engine functions to the other DLL...
   (*other_GiveFnptrsToDll)(pengfuncsFromEngine, pGlobals);
}

Last edited by The Storm; 26-05-2005 at 20:41..
  
Reply With Quote
Re: Problem with the sounds in AMX
Old
  (#2)
KWo
Developer of PODBot mm
 
KWo's Avatar
 
Status: Offline
Posts: 3,425
Join Date: Apr 2004
Default Re: Problem with the sounds in AMX - 26-05-2005

I guess it's probably corresponding to some known issue with confusing AMX by bots (no stats, no admin rights, player "seen" by AMX as just kicked bot etc).

http://forums.bots-united.com/showpo...5&postcount=16

http://djeyl.net/forum/index.php?showtopic=39787

The people of AMX Dev Team know this and they are still working for the new release of AMX including this fix. sPlOrYgOn helped them in solving this problem, but still there is not any new official release of AMX since 08.2004 (when the problem has been solved).
AMX Mod X team released few version of his mod and this fix has been included since the version 0.20 (currently 1.01).

[EDIT]
I forgot to say - there is already availiable some beta version with this bot fix, but only for linux (0.9.9b).
http://djeyl.net/forum/index.php?showtopic=41122
[/EDIT]

Last edited by KWo; 26-05-2005 at 21:24..
  
Reply With Quote
Re: Problem with the sounds in AMX
Old
  (#3)
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: Problem with the sounds in AMX - 26-05-2005

No, that's because you don't tie all the functions in pEngFuncsFromEngine

The engine interface and the game DLL interface have changed A LOT since the date when POD-bot was released.

You should switch to a full metamod plugin this time. Take the step, it's worth it.



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
Re: Problem with the sounds in AMX
Old
  (#4)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,618
Join Date: Jul 2004
Location: Bulgaria
Default Re: Problem with the sounds in AMX - 26-05-2005

I want to make E[POD]bot a real metamod plugin but LightNinja don't want E[POD]bot to be open source. Before a week I send again a mail to him to ask if I can publish the source but still not reply. But maybe there is anoder reason that LightNinja don't allow me to publish the code. When I get this code and after I start to understand it, I actually see that LightNinja is ripped a bit stuff from other bots and maybe he don't want to show that. I don't know but if he don't reply of my mails after 2 week I will make E[POD]bot metamod plugin and open source.

Thanks for the help PMB.
  
Reply With Quote
Re: Problem with the sounds in AMX
Old
  (#5)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: Problem with the sounds in AMX - 27-05-2005

You can support metamod and standalone loading methods in the same dll, its alot of work but can be done...

- Export Meta_Init and set a global variable saying that we are being loaded by metamod
- Modify RETURN_META and RETURN_META_VALUE macros or make your own to handle both metamod and the standalone method at the same time.

Its fairly easy to do and lots of people have done it already, if I remember correctly the NeoTF team, FoxBot, TheFlipside of TFC, and I have done metamod/standalone compatible dlls.
  
Reply With Quote
Re: Problem with the sounds in AMX
Old
  (#6)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: Problem with the sounds in AMX - 27-05-2005

Quote:
Originally Posted by Pierre-Marie Baty
No, that's because you don't tie all the functions in pEngFuncsFromEngine

The engine interface and the game DLL interface have changed A LOT since the date when POD-bot was released.
that isn't necessary, as if you don't tie one function in pengFuncsFromEngine, the "original" address of a engine function (passed from engine to the bot dll) will just be passed to the game dll.

I only tied 2-3 functions in the Realbot 1.0 fix, and it also works well and doesn't crash.
  
Reply With Quote
Re: Problem with the sounds in AMX
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: Problem with the sounds in AMX - 28-05-2005

You are wrong. This cannot happen in a hook DLL since it is the Hook DLL that is in charge of doing the interface exchange.



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
Re: Problem with the sounds in AMX
Old
  (#8)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: Problem with the sounds in AMX - 28-05-2005

I think he means is:
Make a enginefuncs_t variable...
memcpy the engine functions into it...
variable.pfnXXX = ourhookedfunc...
mod_givefnptrstodll( &variable, pGlobals );

That way should make it so you don't need to hook __every__ function.
Or maybe I'm wayyyyy off?
  
Reply With Quote
Re: Problem with the sounds in AMX
Old
  (#9)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: Problem with the sounds in AMX - 28-05-2005

nah...

suppose this is what's passed in the parameter "pengfuncsFromEngine" to the bot dll:

note: for simplification, let's suppose the enginefuncs_t only contains pfnFunc1, pfnFunc2, pfnFunc3:

PHP Code:
pfnFunc1          pfnFunc2          pfnFunc3
ENGINE_func1      ENGINE_func1      ENGINE_func3 
ENGINE_func* means the address of functions in the original engine, so that gamedll can call it

then if you do this...

pengfuncsFromEngine->pfnFunc1 = bot_func1;
pengfuncsFromEngine->pfnFunc2 = bot_func2;
pengfuncsFromEngine->pfnFunc3 = bot_func3;

this will be passed into the original game dll:

PHP Code:
pfnFunc1          pfnFunc2          pfnFunc3
bot_func1         bot_func2         bot_func3 
...and just like what HPB bot does, bot_func1 will call the ENGINE_func1

but if you do this...

pengfuncsFromEngine->pfnFunc1 = bot_func1;

and leave the pfnFunc2, pfnFunc3 untouched. We'll get result like this:

PHP Code:
pfnFunc1          pfnFunc2         pfnFunc3
bot_func1         ENGINE_func2     ENGINE_func3 
...and now, this will be passed into the original gamedll and the gamedll can still call the ENGINE_func2 directly using g_engfuncs.pfnFunc2().

you can just choose not to "hijack" a certain engine function in the game dll, and it will be okay. No need to "hijack" every functions.
  
Reply With Quote
Re: Problem with the sounds in AMX
Old
  (#10)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: Problem with the sounds in AMX - 28-05-2005

Thats MUCH simpler, thx for pointing that out.
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com