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

[SourceMod Suggestion] New sm_dump-related command addition(s)?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
404UserNotFound
BANNED
Join Date: Dec 2011
Old 10-27-2016 , 21:28   [SourceMod Suggestion] New sm_dump-related command addition(s)?
Reply With Quote #1

Yesterday while speaking to Sigsegv about some projectile entity-related topics, I asked if he could help me with a modification I wanted to make to SourceMod, specifically to how sm_dump_datamaps works.

Currently, you specify the filename that all the datamaps for every entity in the game will be dumped into, and the command just dumps everything into that file. That's a bit messy, and it also makes it harder for me to find information on just a specific entity. What I usually ended up doing was highlighting from the entity name (for example "CPhysBox - func_physbox") all the way down to "- m_nModelIndexOverrides (Offset 124) (Save)(16 Bytes)" which (I only know this is true in TF2's datamaps) is always the very last map entry for an entity. I then move that highlighted entity map to a new document so I can easily CTRL+F and find things.

My idea was to instead have the command create a "datamaps" folder within the "tf/" folder and then individually create .TXT files for each entity and its map, for example "tf/datamaps/CTFPlayer - player.txt". However, I am no genius with C++. I personally find it much harder to learn than SourcePawn, even after my surprisingly quick adjustment to the new 1.8 SourcePawn syntax which is much more like C++ than the old syntax.

So after using a text crawler to find out that the vhelper.cpp file (these lines specifically) is what contains the entirety of the sm_dump_datamaps command, I discovered I wasn't learned enough to figure out how to modify it to make it work how I wanted it to. Sigsegv came through however: Here's the diff of the changes he made. And here's the modified vhelpers.cpp file.

Sigsegv was nice enough to build me a TF2-specific copy that I could test-run on my test server to see if it dumped the files correctly, as for some reason whenever I build a copy of the sdktools extension, it loses its link to libtier0 and libvstdlib and refuses to load ingame, citing "unknown symbol: Warning". And it definitely does work! So here's the suggestion. Instead of just outright overwriting sm_dump_datamaps to make it dump all the files individually, let's keep sm_dump_datamaps as it is, and add this new command in as "sm_dump_datamaps_sorted" (no args needed, unless there's a want/need to have an arg to specify a custom directory)

As well, the same could be done for sm_dump_netprops/any other dump commands that currently just dump information on multiple entities into one file, so they also have a "_sorted" command as well. I believe this would be very useful for developers, especially anyone wanting to work with entities who would like to find out what entity datamaps they can utilize.

Note: Sigsegv has given me permission to post this, though he did tell me I should not imply that the modification he made is a "polished finished product". It does work though, as stated above.

Discuss away?

Last edited by 404UserNotFound; 10-28-2016 at 16:59.
404UserNotFound is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 10-27-2016 , 22:12   Re: [SourceMod Suggestion] New sm_dump-related command addition(s)?
Reply With Quote #2

Sounds interesting, now all you would need to do is set it up to a github repo and have it update every time the game updates. ez-pz.
Mitchell is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 10-27-2016 , 22:57   Re: [SourceMod Suggestion] New sm_dump-related command addition(s)?
Reply With Quote #3

Quote:
Originally Posted by Mitchell View Post
Sounds interesting, now all you would need to do is set it up to a github repo and have it update every time the game updates. ez-pz.
Besides the whole "individual files" concept, it's been done for TF2. (If you're already aware of it, can't hurt for other people to know.)

Quote:
Originally Posted by abrandnewday View Post
Discuss away?
I dunno; it seems kind of feature-creep-ish, not to mention having to support it (then again, there is support for dumping netprops to XML...). Can't speak for the devs though; that's just me.

Here's a quick awk script that does something similar.
Just cat the dump and pipe it to awk -f dump_sorted_datamaps.awk.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)

Last edited by nosoop; 10-27-2016 at 23:18.
nosoop is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 10-28-2016 , 00:38   Re: [SourceMod Suggestion] New sm_dump-related command addition(s)?
Reply With Quote #4

Quote:
Originally Posted by abrandnewday View Post
I'm not sure what you mean by "feature-creep-ish" by the way.
I mean that in the sense that the functionality already exists as the sm_dump_* set of commands, besides the whole dumping them as individual files thing. And that can by done by processing an existing dump with other tools (or by hand).

No doubt, having it sorted is useful (and I'd have no complaints if functionality gets added), but at the same time, it's easily doable outside of SourceMod itself.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 10-28-2016 , 10:46   Re: [SourceMod Suggestion] New sm_dump-related command addition(s)?
Reply With Quote #5

Quote:
Originally Posted by abrandnewday View Post
for some reason whenever I build a copy of the sdktools extension, it loses its link to libtier0 and libvstdlib and refuses to load ingame, citing "unknown symbol: Warning".
Building with Clang will fix this, GCC changed how it links libraries in a recentish version and now decides that they're unused and that it shouldn't link them. I found the patch I wrote for it sitting open in a tab in Sublime the other day, so I'll make a PR of it at some point to get it fixed.
__________________
asherkin 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 08:27.


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