Raised This Month: $319 Target: $400
 79%   Almost there!

Invalid GiveNamedItem offset(?)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Marios2
Junior Member
Join Date: Apr 2015
Location: Greece
Old 04-13-2015 , 09:59   Invalid GiveNamedItem offset(?)
Reply With Quote #1

Not sure if this is only on my end or not, but when you use any plugin that gives weapons, it crashes the server.

Upon (quite later) research, TF2Items claims that 471 is for GiveNamedItem. However, the correct one is 477 (478 for Linux and Mac). See for yourself (https://www.sourcemodplugins.org/vtableoffsets/tf)
Scroll to the bottom of the page, see where it says "GiveNamedItem".

Why does this happen and how can i fix it, if it is not dependent on the developer?

(Operative System: Windows 7, all associated plugins and stuff are up-to-date.)

Last edited by Marios2; 04-13-2015 at 10:06.
Marios2 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 04-13-2015 , 12:56   Re: Invalid GiveNamedItem offset(?)
Reply With Quote #2

Offsets are usually determined from a VTable dump of the class from the Linux server_srv.so file. The Windows values are usually 1 less than the Linux offsets.

However, in the case of CTFPlayer, the upper offsets are off by a considerably wider margin than 1. This seems to be because the Windows version inlines some functions that aren't inlined on Linux.

What I'm saying is that SourceModPlugins is wrong as it's naively assuming Windows offsets are always the Linux offset -1.

Incidentally, you're probably like me and missed the big announcement about TF2Items needing an update as of the March 30 update as Valve changed the layout of the internal game class TF2Items uses*.

* To be more specific, they appear to have added color data to items... halloween related mainly.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 04-13-2015 at 13:00.
Powerlord is offline
Marios2
Junior Member
Join Date: Apr 2015
Location: Greece
Old 04-13-2015 , 14:30   Re: Invalid GiveNamedItem offset(?)
Reply With Quote #3

Quote:
Originally Posted by Powerlord View Post
Offsets are usually determined from a VTable dump of the class from the Linux server_srv.so file. The Windows values are usually 1 less than the Linux offsets.

However, in the case of CTFPlayer, the upper offsets are off by a considerably wider margin than 1. This seems to be because the Windows version inlines some functions that aren't inlined on Linux.

What I'm saying is that SourceModPlugins is wrong as it's naively assuming Windows offsets are always the Linux offset -1.

Incidentally, you're probably like me and missed the big announcement about TF2Items needing an update as of the March 30 update as Valve changed the layout of the internal game class TF2Items uses*.

* To be more specific, they appear to have added color data to items... halloween related mainly.
About one and a half hours after posting this i downloaded the update, if the big announcement meant the most recent snapshot at the link, but, same stuff. So this issue is only for me? Or which of the snapshots did i have to download then?
Marios2 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 04-13-2015 , 15:37   Re: Invalid GiveNamedItem offset(?)
Reply With Quote #4

Quote:
Originally Posted by Marios2 View Post
About one and a half hours after posting this i downloaded the update, if the big announcement meant the most recent snapshot at the link, but, same stuff. So this issue is only for me? Or which of the snapshots did i have to download then?
Run <tt>sm exts list</tt> to make sure the latest version is installed. It should be listed like this:

[03] TF2Items (1.6.1): TF2 Item Modifier

(The [03] will be different if it loaded in a different order)

On a side note, if this is a Windows server (which I assume it is), Windows will block you from overwriting TF2Items's DLL while TF2Items is loaded. On Linux, you can overwrite SO files while the server is running, but it has a tendency to crash the server. Thus, I tend to shut my servers down before overwriting SourceMod or its extensions.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 04-13-2015 at 15:37.
Powerlord is offline
Marios2
Junior Member
Join Date: Apr 2015
Location: Greece
Old 04-14-2015 , 07:18   Re: Invalid GiveNamedItem offset(?)
Reply With Quote #5

Quote:
Originally Posted by Powerlord View Post
Run <tt>sm exts list</tt> to make sure the latest version is installed. It should be listed like this:

[03] TF2Items (1.6.1): TF2 Item Modifier

(The [03] will be different if it loaded in a different order)

On a side note, if this is a Windows server (which I assume it is), Windows will block you from overwriting TF2Items's DLL while TF2Items is loaded. On Linux, you can overwrite SO files while the server is running, but it has a tendency to crash the server. Thus, I tend to shut my servers down before overwriting SourceMod or its extensions.

It is indeed the latest version. I put the files correctly, while the server was down, yada yada yada. Also check that offset again to make sure - it's the same...

What to?

Last edited by Marios2; 04-14-2015 at 07:20.
Marios2 is offline
psychonic

BAFFLED
Join Date: May 2008
Old 04-14-2015 , 07:35   Re: Invalid GiveNamedItem offset(?)
Reply With Quote #6

Quote:
Originally Posted by Powerlord View Post
Offsets are usually determined from a VTable dump of the class from the Linux server_srv.so file. The Windows values are usually 1 less than the Linux offsets.

However, in the case of CTFPlayer, the upper offsets are off by a considerably wider margin than 1. This seems to be because the Windows version inlines some functions that aren't inlined on Linux.
Virtual functions cannot be inlined as that would break the ABI.

CTFPlayer has multiple inheritance, and MSVC handles that differently from GCC/Clang. It ends up with multiple vtables, rather than cramming them all into one. The offset being lower in the Windows binary is a result of the vtable from one of the parent classes being split out.
psychonic is offline
Marios2
Junior Member
Join Date: Apr 2015
Location: Greece
Old 04-15-2015 , 14:40   Re: Invalid GiveNamedItem offset(?)
Reply With Quote #7

False alarm - the snapshot build may announce invalid givenameditem offset, but it WORKS!!!


You may no longer care on this case anymore.

Last edited by Marios2; 04-15-2015 at 14:41.
Marios2 is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 04-15-2015 , 15:46   Re: Invalid GiveNamedItem offset(?)
Reply With Quote #8

It doesn't "announce" anything invalid, TF2Items is using the correct offset, that site is the one that is incorrect.
__________________
asherkin is offline
Reply


Thread Tools
Display Modes

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 14:31.


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