asherkin / vtable

Emscripten-based VTable Dumper
https://asherkin.github.io/vtable/
55 stars 16 forks source link

Incorrect virtual offsets for CBaseObject in TF2 on Windows #6

Open nosoop opened 4 years ago

nosoop commented 4 years ago

As requested, here's the vtable dumper mismatch that was initially reported on Discord:

[2:24 PM] nosoop: curious what's different between win/linux for the CBaseObject table, windows offsets are off by one there [...] [2:25 PM] nosoop: I mean the windows offset is off by one from actual (CBaseObject::CanBeUpgraded(CTFPlayer) is 375, not 376 as the webapp reports) [...] [3:21 PM] asherkin: ah, multiple inheritance [3:26 PM] asherkin: I suspect the problem is it thinking that FindObjectOnBuildPoint should be skipped on Windows [3:28 PM] asherkin: the confusion seems to be because that is both on the actual CBaseObject vtable and one of the MI classes [3:29 PM] asherkin: in fact I think that case is one of the main ones that led to the "This class uses C++ features which can not be accounted for by this tool." as there doesn't seem to be a way to tell them apart

edit: mixed up the dumper results because of a copy/paste error, my bad

nosoop commented 3 years ago

Confus. The dumper-reported values were actually off by -2. These should be correct now.

Same issue as #7; FindObjectOnBuildPoint is indeed skipped on Windows (the dumper is correct on this one), but CanBeUpgraded is overloaded, and there is a CBaseObject::CanBeUpgraded(void) inserted at offset 374 (all the other entries are shifted one to the right).

nosoop commented 3 years ago

Have to watch out for subclasses, though; CTFPlayer::ChangeTeam(int) exists as an override for CBaseEntity, but CTFPlayer also implements its own CTFPlayer::ChangeTeam(int, bool, bool, bool) exclusive to it and its subclasses. Can't make those contiguous.