• The best way to get all the FactoryInterfaceFn
    12 replies, posted
[highlight]This method requires SigScan.[/highlight] [code]struct factorylist_t { CreateInterfaceFn engineFactory; CreateInterfaceFn physicsFactory; CreateInterfaceFn fileSystemFactory; }; void (*FactoryList_Retrieve)( factorylist_t &destData );[/code] [b]FactoryList_Retrieve[/b] is a function that exists in both server.dll and client.dll and can be used to get access to all the CreateInterfaceFn. [highlight]This is the signature for the server.dll only.[/highlight] [code]CSigScan::sigscan_dllfunc = Sys_GetFactory("server.dll"); if(!CSigScan::GetDllMemInfo()) Lua()->Error("Could not get access to factories."); CSigScan sigscanFactories; sigscanFactories.Init((unsigned char *)"\x8B\x44\x24\x04\x8B\x0D\xC0\x33\x6D\x10\x8B\x15\xC4\x33\x6D\x10\x89\x08\x8B\x0D\xC8\x33\x6D\x10\x89\x50\x04\x89\x48\x08\xC3", "xxxxxx????xx????xxxx????xxxxxxx", 31); if(!sigscanFactories.is_set) Lua()->Error("Could not get access to factories."); FactoryList_Retrieve = (void (*)(factorylist_t &))sigscanFactories.sig_addr; factorylist_t factories; FactoryList_Retrieve(factories);[/code] Now you can get [b]all[/b] the interfaces you want. [highlight]I will post back with the signature for client.dll once I have disassembled it with IDA.[/highlight]
Found this a while back, not sure how up-to-date it is or exactly the headers you need to include but here you go:[code] I've been trying to determine which interface factories are supported by Source Engine plugins. Here's some code I added to the empty plugin Load() function... // IClientEntityList *cliententitylist = (IClientEntityList*)interfaceFactory(VCLIENTENTITYLIST_INTERFACE_VERSION, NULL); // if ( !cliententitylist ) // Msg("PLUGIN: Unable to load cliententitylist, ignoring\n"); // else // Msg("PLUGIN: Loaded cliententitylist\n"); IEngineTrace *enginetrace = (IEngineTrace*)interfaceFactory(INTERFACEVERSION_ENGINETRACE_SERVER, NULL); if ( !enginetrace ) Msg("PLUGIN: Unable to load enginetrace, ignoring\n"); else Msg("PLUGIN: Loaded enginetrace\n"); // IServerGameDLL *gamedll = (IServerGameDLL*)interfaceFactory(INTERFACEVERSION_SERVERGAMEDLL, NULL); // if ( !gamedll ) // Msg("PLUGIN: Unable to load gamedll, ignoring\n"); // else // Msg("PLUGIN: Loaded gamedll\n"); // IServerGameEnts *gameents = (IServerGameEnts*)interfaceFactory(INTERFACEVERSION_SERVERGAMEENTS, NULL); // if ( !gameents ) // Msg("PLUGIN: Unable to load gameents, ignoring\n"); // else // Msg("PLUGIN: Loaded gameents\n"); // IServerGameClients *gameclients = (IServerGameClients*)interfaceFactory(INTERFACEVERSION_SERVERGAMECLIENTS, NULL); // if ( !gameclients ) // Msg("PLUGIN: Unable to load gameclients, ignoring\n"); // else // Msg("PLUGIN: Loaded gameclients\n"); ISpatialPartition *spatialpartition = (ISpatialPartition*)interfaceFactory(INTERFACEVERSION_SPATIALPARTITION, NULL); if ( !spatialpartition ) Msg("PLUGIN: Unable to load spatialpartition, ignoring\n"); else Msg("PLUGIN: Loaded spatialpartition\n"); IVoiceServer *voiceserver = (IVoiceServer*)interfaceFactory(INTERFACEVERSION_VOICESERVER, NULL); if ( !voiceserver ) Msg("PLUGIN: Unable to load voiceserver, ignoring\n"); else Msg("PLUGIN: Loaded voiceserver\n"); IStaticPropMgr *staticprops = (IStaticPropMgr*)interfaceFactory(INTERFACEVERSION_STATICPROPMGR_SERVER, NULL); if ( !staticprops ) Msg("PLUGIN: Unable to load staticprops, ignoring\n"); else Msg("PLUGIN: Loaded staticprops\n"); // IMapData *mapdata = (IMapData*)interfaceFactory(INTERFACEVERSION_MAPDATA, NULL); // if ( !mapdata ) // Msg("PLUGIN: Unable to load mapdata, ignoring\n"); // else // Msg("PLUGIN: Loaded mapdata\n"); // IPhysics *physics = (IPhysics*)interfaceFactory(VPHYSICS_INTERFACE_VERSION, NULL); // if ( !physics ) // Msg("PLUGIN: Unable to load physics, ignoring\n"); // else // Msg("PLUGIN: Loaded physics\n"); // IPhysicsCollision *physicscol = (IPhysicsCollision*)interfaceFactory(VPHYSICS_COLLISION_INTERFACE_VERSION, NULL); // if ( !physicscol ) // Msg("PLUGIN: Unable to load physicscol, ignoring\n"); // else // Msg("PLUGIN: Loaded physicscol\n"); // IPhysicsSurfaceProps *physicssurfprop = (IPhysicsSurfaceProps*)interfaceFactory(VPHYSICS_SURFACEPROPS_INTERFACE_VERS ION, NULL); // if ( !physicssurfprop ) // Msg("PLUGIN: Unable to load physicssurfprop, ignoring\n"); // else // Msg("PLUGIN: Loaded physicssurfprop\n"); IEngineSound *enginesound = (IEngineSound*)interfaceFactory(IENGINESOUND_SERVER_INTERFACE_VERSION, NULL); if ( !enginesound ) Msg("PLUGIN: Unable to load enginesound, ignoring\n"); else Msg("PLUGIN: Loaded enginesound\n"); IVEngineCache *enginecache = (IVEngineCache*)interfaceFactory(VENGINE_CACHE_INTERFACE_VERSION, NULL); if ( !enginecache ) Msg("PLUGIN: Unable to load enginecache, ignoring\n"); else Msg("PLUGIN: Loaded enginecache\n"); IVModelInfo *modelinfo = (IVModelInfo*)interfaceFactory(VMODELINFO_SERVER_INTERFACE_VERSION, NULL); if ( !modelinfo ) Msg("PLUGIN: Unable to load modelinfo, ignoring\n"); else Msg("PLUGIN: Loaded modelinfo\n"); ...and I obviously included the proper .h files to resolve these at compile time (Alfred: public/engine is not in the list of default include directories in the empty plugin project, you might want to add it for later updates). When I start HL2DM up, the plugin loads fine, but many of the interface factories return NULL (they don't get resolved). I'm assuming that plugins only have access to certain interface factories. I didn't even try most of the ones that I knew were client side only (like anything with "render", "shadow" or "client" in it). The ones that are commented out above, returned NULL for the interface. Hopefully this will help some people along who are writting plugins for Source. v----- HELP!!!! -----v I STILL haven't determined a method to get each player's "origin" and "angles" in a plugin. The best I have found so far is to use the ICollideable::GetCollisionOrigin() and ICollideable::GetCollisionAngles() for each client (ICollideable is available through the edict_t structure using GetCollideable() function). ^----- HELP!!!! -----^ P.S. I *LOVE* the interface factory stuff! It REALLY helps you figure out exactly which functions are valid on different types of entities. I think that people who complained about how "messy" the Source SDK is, just isn't used to the interface factory stuff. Once you get the hang of it, it ROCKS!!! But you DEFINITELY have to use grep a lot to find stuff. You also need to "unlearn" all the old Half-Life/Quake engine crap. Dump all that you know about Half-Life, free up some brain cells, and begin learning how Source works. Embrace the new technology. Open your arms up WIDE and give the Source SDK a BIG HUG. :) Jeffrey "botman" Broome [/code]
Okay. How the hell can a wall of code be artistic?
Eh the art credit goes to the guy who put them together. You should be able to get interfaceFactory through either getting the engine/server/client dll's respectively
[QUOTE=TehBigA;19735125]Eh the art credit goes to the guy who put them together. You should be able to get interfaceFactory through either getting the engine/server/client dll's respectively[/QUOTE] Getting the physics interface/file system interface is a bit harder.
Thanks. You really helped me with that code. I was unable to get IFileSystem or IBaseFileSystem on a dedicated server (there is no filesystem_steam.dll you could export it from). The code above made my day and helped me really much. I have no idea why everyone votes you dumb - That workaround really helpfull if you get into such a situation!
[QUOTE=aVoN;20326620]Thanks. You really helped me with that code. I was unable to get IFileSystem or IBaseFileSystem on a dedicated server (there is no filesystem_steam.dll you could export it from). The code above made my day and helped me really much. I have no idea why everyone votes you dumb - That workaround really helpfull if you get into such a situation![/QUOTE] Because most of the people on facepunch don't have the experience you or I have. There is only a select few people who have been in the trenches of the source engine.
[QUOTE=aVoN;20326620]I have no idea why everyone votes you dumb - That workaround really helpfull if you get into such a situation![/QUOTE] In this case, the rating reflects the level of intelligence of the people who gave the rating.
[ERROR] gmcl_extras: Error getting filesystem_steam.dll factory. 1. unknown - [C]:-1 2. require - [C]:-1 3. Scan - lua/autorun/client/clientcheck.lua:181 4. oldFunc - lua/autorun/client/clientcheck.lua:201 5. v - addons/dbugr/lua/util/modules/sh_func.lua:80 6. unknown - lua/includes/modules/hook.lua:82 can anyone tell me what this is
This is an error. Probably caused by the fact that this thing is 3 years old?
Sorry, you need to Log In to post a reply to this thread.