Parsing the current build-number from a external program

cH40z-LordcH40z-Lord Join Date: 2009-07-26 Member: 68269Members, Reinforced - Shadow
Hey guys,

I'm currently working on a more or less small project, which I may announce later in this forum as I made some progress, and now I'm wondering which file contains the current build number ( later on maybe the whole version ?) of NS2.

Please note I'm not creating any mod so I can't use Lua calls.

Hope anyone can help me out :)

Cheers!

Comments

  • MaxMax Technical Director, Unknown Worlds Entertainment Join Date: 2002-03-15 Member: 318Super Administrators, Retired Developer, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, Subnautica Developer, Pistachionauts, Future Perfect Developer
    There isn't really any file that contains the version number. The best you can probably do is read it from the users options.xml file.
  • cH40z-LordcH40z-Lord Join Date: 2009-07-26 Member: 68269Members, Reinforced - Shadow
    Thanks Max!

    That's all I need ^_^
  • CamronCamron Join Date: 2011-01-06 Member: 76356Members
    Reading from options.xml could be a bit risky. That file is only updated with the correct build number when NS2 is ran, and not when it is actually updated. Since Steam auto-updates and since most people have Steam running in the background, and since new builds are frequent, there's a decent chance someone will run your program and have it read the outdated build number. If you are doing file manipulation based on the build, you could end up corrupting the game files by modifying them incorrectly.

    To get the true current build number you could just load Engine.dll and call "<b>?GetBuildNumber@M4@@YAIXZ</b>" AKA "<b>M4::GetBuildNumber</b>". You could optionally just pattern match and parse that function if you don't want to load the dll and it's dependencies. NS2.exe uses that function to report's its build number so it's guaranteed to be correct (unless the function is deprecated and not updated).

    Multiple binaries also contain the string pattern "c:\users\admin\build\engine\tags\build_203\bin\ship\" so you could always look for that too but it's not guaranteed to be there in newer builds and it has a lot of elements that could change.
Sign In or Register to comment.