Raised This Month: $51 Target: $400
 12% 

[Solved] Like "Meta Mod" Code From Windows to Linux


Post New Thread Reply   
 
Thread Tools Display Modes
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 12-14-2012 , 11:51   Re: [Awaiting] Like "Meta Mod" code from Windows to Linux
Reply With Quote #11

with 'extern "C"' you're just telling the compiler to not mangle symbol names.

Mangling came up with C++ function override features (not supported in pure C)

Edit:

That's why GiveFnptrsToDll is the pure name and not something like __ti15GiveFnptrsToDllP13enginefuncs_tP12globa lvars_t
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.

Last edited by joropito; 12-14-2012 at 11:56.
joropito is offline
Send a message via MSN to joropito
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 12-14-2012 , 13:18   Re: [Awaiting] Like "Meta Mod" code from Windows to Linux
Reply With Quote #12

Quote:
Originally Posted by joropito View Post
with 'extern "C"' you're just telling the compiler to not mangle symbol names.

Mangling came up with C++ function override features (not supported in pure C)

Edit:

That's why GiveFnptrsToDll is the pure name and not something like __ti15GiveFnptrsToDllP13enginefuncs_tP12globa lvars_t
Hmmm, then why is this line required for Windows build?

PHP Code:
#pragma comment ( linker, "/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8" ) 
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 12-14-2012 , 15:01   Re: [Awaiting] Like "Meta Mod" code from Windows to Linux
Reply With Quote #13

Quote:
Originally Posted by claudiuhks View Post
Hmmm, then why is this line required for Windows build?

PHP Code:
#pragma comment ( linker, "/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8" ) 
I know nothing about compiling under windows
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 12-14-2012 , 17:48   Re: [Awaiting] Like "Meta Mod" code from Windows to Linux
Reply With Quote #14

Thank you to share ! We could develop some funny modules now .
Someone said ZpPlague ? :p
__________________
micapat is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 12-14-2012 , 21:01   Re: [Awaiting] Like "Meta Mod" code from Windows to Linux
Reply With Quote #15

extern "C" __declspec(dllexport) will make your export functions name unchanged when you export your functions, but it only works with __cdecl, you see that in front of "GiveFnptrsToDll" , I add a WINAPI modification, which is __stdecl, so the export function name will be changed. I must tell the linker to fix it. You can see that other export functions like GetEntityAPI or entity functions don't have this treatment.

About the game entity, there are lots of tools which can view the export functions in dll, or you can just copy those names from meta mod source code to complete it.
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 12-14-2012 , 23:56   Re: [Awaiting] Like "Meta Mod" code from Windows to Linux
Reply With Quote #16

Quote:
Originally Posted by Arkshine View Post
Call the original function and get it's returned value ?
After a few tests, I realized that is the returned value decreased by one.

PHP Code:
int g_Colored_Message;

int RegUserMsg( const char pNameint Size ) {
  
int Returned_Value g_engfuncs.pfnRegUserMsgpNameSize );
  if( !
strcmppName"cstrike" ) || !strcmppName"czero" ) )
    
g_Colored_Message Returned_Value 1;
  return 
Returned_Value;

The archives have been updated due to optimization and complexity.

Quote:
Originally Posted by jim_yang View Post
About the game entity, there are lots of tools which can view the export functions in dll, or you can just copy those names from meta mod source code to complete it.
Hmap contains the entity list from Meta Mod v1.19 source code, but still doesn't work with de_airstrip.
Thank you for recommending me a DLL exports viewer. I solved the problem with a free software, now de_airstrip works. Of course, many entities are missing in Meta Mod v1.19. I upload the software in this post.

Quote:
Originally Posted by micapat View Post
Thank you to share ! We could develop some funny modules now .
Someone said ZpPlague ? :p
Building Zombie Plague is like building a game. The only difference is that for building a game you get paid whether you're licensed. What about Zombie Plague?
Attached Files
File Type: zip dllexp.zip (38.3 KB, 65 views)
__________________

Last edited by claudiuhks; 12-15-2012 at 01:39.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-16-2012 , 06:41   Re: [Solved] Like "Meta Mod" code from Windows to Linux
Reply With Quote #17

About de_airstrip issue, if I'm right, is not metamod-p deals dynamically with the entities so you don't need to hardcode them ? If so, you might take a look to see how it's done.
__________________
Arkshine is offline
sparky99
Junior Member
Join Date: Jan 2006
Old 01-03-2013 , 23:04   Re: [Solved] Like "Meta Mod" code from Windows to Linux
Reply With Quote #18

A good explanation of those weird lines is found here.

neuron.tuke.sk/wagner/bot/declarations.html

neuron.tuke.sk/wagner/bot/export.html
sparky99 is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 01-04-2013 , 04:07   Re: [Solved] Like "Meta Mod" code from Windows to Linux
Reply With Quote #19

Quote:
Originally Posted by sparky99 View Post
A good explanation of those weird lines is found here.

neuron.tuke.sk/wagner/bot/declarations.html

neuron.tuke.sk/wagner/bot/export.html
Very nice.

I'm still wondering how to create a "Like Meta Mod" plugin which works without all entity class names exported inside it.
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
jim_yang
Veteran Member
Join Date: Aug 2006
Old 01-04-2013 , 04:34   Re: [Solved] Like "Meta Mod" code from Windows to Linux
Reply With Quote #20

Like Arkshine told you, you may see metamod-p source code, it dynamicly edit your module's export table in memory. combine export functions of your module with the ones game dll has.
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
Reply



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


All times are GMT -4. The time now is 03:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode