Track your playtime with OGSR (or any mod)

Track your playtime with OGSR (or any mod)

1. Introduction

I need to be clear up front, you need good Windows knowledge at a power user level, this guide is not going to drill into hand holding steps.

If the guide says simply "run an elevated command prompt", you need to know that means run cmd as administrator and how to do it because you've done it a thousand times before.

You won't see "Hold Windows+R > type cmd > click OK > right click in the task bar > Run as admin etc etc etc."

The assumed skillset of the intended audience is:

1. A solid grasp of files and folders, where Steam installs your games

2. A solid grasp of file types and extensions

3. You know where to find files without being given explicit instructions

4. A working knowledge of navigating directories and calling programs from the command line (DOS)

5. A working knowledge of stringing the above into batch files (.bat or .cmd)

6. Are familiar with how to run a program as administrator without explicit instructions.

7. You're have experience installing Stalker mods, you've played your share of them and been around the block a few times with the general process.

I will only be displaying default Steam installation locations. If you use a different folder then tailor the guide to your PC.

NOTE: This guide is intended to be applied to mods that are not normally track-able with simple techniques. There are relatively simple ways to make Steam track your hours on some Stalker mods, and there are detailed walkthrough guide for some examples such as CoC and Anomaly. Use those guides for those mods. This guide presents you a technique to apply for the tricky ones using OGSR as the focus and some other examples in the Appendix. But yes, you can still use the techniques in this guide for any/every mod, it would simply be overkill in some cases.

With that said, as you follow the steps in the guide and look over the other mods if you wish, you are going to read an awful lot about Stalker's "bin" subfolders and the names of the executable (.exe) files that reside in them, until you're sick of them. Thats just how this works.

APPENDIX A: A brief outline of the files Steam installs for Stalker SHoC and CoP, and a summary of the type of mods you will encounter and what (generally) to expect.

APPENDIX B: A few random example mods (including OGSR) of mods that cannot be forced to run via Steam with traditional techniques presented in APPENDIX A, and what happens when you try (hint: it doesn't work, they all crash).

APPENDIX C: Solutions to all the examples in APPENDIX B, plus how to run Anomaly via Mod Manager and have it tracked via Steam.

2 Install OGSR


Track your playtime with OGSR (or any mod) image 19
Track your playtime with OGSR (or any mod) image 20
Track your playtime with OGSR (or any mod) image 21

Before you get started

1. Make sure you've installed vanilla Shadow of Chernobyl so Steam 'knows' it's installed

By default this will be here

C:\Program Files (x86)\Steam\steamapps\common\STALKER Shadow of Chernobyl

2. Now delete it. The contents or the whole folder.

3: Install OGSR back into the same folder

Test it manually, make sure it works.

Now let's bind it to Steam so clicking PLAY makes it run and tracks your hours

TIP: See Appendix B, EXAMPLE 1 to see what happens if you try to force it to run by only renaming the files/folders to make them "fit" where Steam target's its PLAY button. (Spoiler, it doenst work)

3.0 Summary Of The Process

At its core, the solution I use to make mods be tracked by Steam (that are otherwise not track-able) is to replace the game's executable file with one of my own making. Which in turn, calls a batch file, which in turn runs any other program I put in that batch file via good old fashion DOS (cmd) commands.

This bridges the gap completely and gives you the flexibility to run any program anywhere on your machine. Meaning it no longer matters where the mod's files are or what they're called.

Please follow the remainder of SECTION 3 of this guide to walk through doing this with O.G.S.R

SCRIPTING WARNING: Time to get messy.

3.1 Baseline Files (step By Step)


Track your playtime with OGSR (or any mod) image 37
Track your playtime with OGSR (or any mod) image 38
Track your playtime with OGSR (or any mod) image 39
Track your playtime with OGSR (or any mod) image 40
Track your playtime with OGSR (or any mod) image 41
Track your playtime with OGSR (or any mod) image 42
Track your playtime with OGSR (or any mod) image 43
Track your playtime with OGSR (or any mod) image 44

Track your playtime with OGSR (or any mod) image 45
Track your playtime with OGSR (or any mod) image 46

1. Make a new empty folder somewhere else on your PC. My example is c:\temp

2. Create two empty text files

3. Open the first one in notepad

Paste in this text

Start-Process launch.bat

4. Now rename it to myfile.ps1

IMPORTANT: Make sure it actually has that extension. If you've got extensions hidden for known file types enabled in Windows all you'll be renaming it to is myfile.ps1.txt Dont do that.

5. Open the second text file in notepad

Paste in this text

notepad

6. Now rename it to launch.bat

IMPORTANT: Again make sure it has that .bat extension and not still .txt.

!!!*** I will drill this point home ***!!!

If you cannot tell the difference between these two images then you need to get more intimate with Windows files. The latter 2 are still .txt files. If this is what you see, fix it !

CHECKPOINT #1.

You now have two files.

myfile.ps1 which has the text "Start-Process launch.bat"

launch.bat which has the text "notepad"

TEST 1:

Double click launch.bat, it should open a cmd window, which then opens notepad.

Close them.

TEST 2:

myfile.ps1 is a a Powershell script.

Righ-click myfile.ps1 and go "Run with Powershell"

If powershell is working properly on your machine it should run that script, which does nothing but turn around and look for (and run) launch.bat. Because it found it in the same folder it runs it, and you once again have a cmd window and notepad.

Close them.

So far so good.

If Powershell isnt working on your PC and you need to troubleshoot it then go and find a resource online until you get it working.

NOTE: Why launch.bat ? No reason. Call it happyhappylalaland.bat for all it matters. Just keep it consistent throughout.

3.2 Compile


Track your playtime with OGSR (or any mod) image 77
Track your playtime with OGSR (or any mod) image 78
Track your playtime with OGSR (or any mod) image 79
Track your playtime with OGSR (or any mod) image 80
Track your playtime with OGSR (or any mod) image 81
Track your playtime with OGSR (or any mod) image 82

This step walks through converting myfile.ps1 into myfile.exe

7. Run Powershell as administrator.

Once in Powershell, navigate to where your files are. The commands are similar to DOS/CMD.

8. Install the compiler

Powershell has a module for compiling scirpts to exe.

It should be installed already if you run Windows 10,

but if not you can install it with this

Install-Module ps2exe

(Look it up if you need clarity)

9. Convert

Run this in powershell.

The prerequisites up to this point are:

- You are running powershell as administrator

- You have navigated to the directory where the files are (verified with dir)

- You have installed ps2exe

Invoke-PS2EXE myfile.ps1 myfile.exe

10. You should now have 3 files in the original folder, myfile.exe is the new one.

TEST 3: Myfile.exe should now do exactly what it did when it was a .ps1 file.

Double click myfile.exe to run it, it should make a call to launch.bat, which if is still there with a "notepad" command, should once again open a cmd window which opens notepad.

If that is the case, congratulations. The hard bit is over.

You may now

- Close Powershell

- Delete myfile.ps1 (You won't need it ever again)

TIP: If you keep this executable file for future use you never need to do this process ever again.

Note: I could have just shared a similar .exe file on Google drive but this way you know its 100% safe because you engineered it yourself.

3.3 Putting It Together (Quick Guide)

With luck you might see where this is going already.

QUICK GUIDE

-You are going to keep that .exe file safe for future use.

-Rename it to XR_3DA.exe

-Go to the OGSR installation folder

-Create a new folder called "bin"

-Drop your custom xr_3da.exe into it (and only that file, don't worry Steam won't complain, it only needs that 1 file in that 1 folder to work)

-Drop launch.bat into Stalker's (root) install folder. <-- IMPORTANT: game's root folder, not bin subfolder.

-Edit launch.bat so that it is populated with the appropriate DOS/CMD commands such that its navigates to, and runs the real OGSR executable.

===== CONTENTS OF LAUNCH.BAT ======

c:

cd "C:\Program Files (x86)\Steam\steamapps\common\STALKER Shadow of Chernobyl\bin_x64"

xrengine.exe

====================================

- Test launch.bat first by double clicking it. This verifies you've go the commands and syntax all correct. It should launch the game

- Clicking Play on Steam will now cause it to run your XR_3DA.exe file which will trigger the batch file, which now runs the above DOS commands, and will launch OGSR.

DETAILED GUIDE

If you need a little bit of a walkthrough please read the next section.

3.4 Detailed Guide


Track your playtime with OGSR (or any mod) image 128
Track your playtime with OGSR (or any mod) image 129
Track your playtime with OGSR (or any mod) image 130

Track your playtime with OGSR (or any mod) image 131
Track your playtime with OGSR (or any mod) image 132
Track your playtime with OGSR (or any mod) image 133
Track your playtime with OGSR (or any mod) image 134

OGSR dos not have a bin folder, its bin_x64

Further, it's launch file is xrEngine.exe (not xr_3da.exe which ShoC uses) because its a newer engine.

PRE-REQUISITE. You have Installed OGSR into the Same Folder that Steam installs SHoC, per section 2

1. Create an empty bin folder under the OGSR installtion.

2. Put myfile.exe into the bin folder, and rename it to XR_3DA.exe

You have now provided the file that Steam is hardcoded to execute.

3. Take launch.bat (or just re-create it) and put it into the root of the game's folder

IMPORTANT: game's root folder, not bin subfolder.

4. Edit launch.bat

Enter the cmd commands needed to launch OGSR

c:

cd "C:\Program Files (x86)\Steam\steamapps\common\STALKER Shadow of Chernobyl\bin_x64"

xrengine.exe

YES, those are quotes around the folder structure, yes they are important because the folder has spaces in the name. Do not forget your quotes when dealing with BATCH files.

5. TEST IT FIRST.

Double click launch.bat and make sure it works. If the batch file is good then double clicking it will launch the mod. You need to see it work before you try launching it from Steam or you'll be scratching your head if it doesn't work straight away, you need to know if its your batch file or something in your process that needs attention.

This is good

6. Open from Steam.

If you have done everything correctly clicking Play on Steam should open OGSR.

- There exists the file bin\xr_3da.exe which you put there (will be the only file in bin)

- There exists launch.bat in the main game folder

- launch.bat contains the correct commands to open OGSR and you have tested it manually first.

Steam overlay showing it works

----------------------------------------------------------------------------------------------------

NOTE: Why are we putting launch.bat in the game's root folder and not in "bin" where the executable lies, despite knowing it's behavior is to look for launch.bat in the same folder it lives ?

This caught me out big time when I was first engineering this solution for myself and I almost gave up until I figured it out. Best guess is Steam uses the game's root folder as its "working" directory, even thought its calling bin\<game>.exe it's starting it within the context of the game's root folder, so that is evidently where it looks for launch.bat, go figure.

APPENDIX A: Know The Files, Know Which Mods You Don't *need* This Guide For


Track your playtime with OGSR (or any mod) image 162
Track your playtime with OGSR (or any mod) image 163
Track your playtime with OGSR (or any mod) image 164
Track your playtime with OGSR (or any mod) image 165

You can use this guide to make steam run any mod, i.e. all of them.

Its not necessary though, not all stalker mods are created equal.

It helps to understand which type of mod you are working on to identify whether it needs the techniques outlined later or not.

KNOW THE VANILLA FILES

It helps to know up front the where the installation files are for S.T.A.L.K.E.R and and how Steam launches it.

SHADOW OF CHERNOBYL

In the "STALKER Shadow of Chernobyl\bin" subfolder lies XR_3DA.exe.

When you click PLAY on Steam it looks for this exact file of this name in that folder and runs it.

Steam is HARDCODED to do this, you cannot alter that behavior.

CALL OF PRIPYAT

Similarly with Call of Pripyat, in the "Stalker Call of Pripyat\bin" subfolder lies xrengine.exe.

Again, Steam is hardcoded to look for that file in that location.

Back to the question, which mod do I need this guide for and which don't you need it for.

Lets rule out mods you DON'T NEED any fancy manipulation.

1. GAMEDATA only

Mods that rely on the game already installed but just use the gamedata folder DO NOT NEED the process outlined in the rest of this guide;

>> Why ? Because the executable, its name and location have not changed from Vanilla

Some brief examples of this type of mod are:

- MISERY / SGM for CoP

- ZRP / Lurk / Narodnaya Solyanka for ShoC.

2. STANDALONE but still fit-the-mould or can be manipulated to fit the mould.

Mods that are standalone but can be EASILY manipulated with little or no effort into having their files and executables being placed in the above locations that Steam is looking for, with the appropriate name, also DO NOT NEED the process outlined in the rest of this guide.

>> Why ? Because you can simply engineer the mod's installation to go into the same folder Steam uses for Vanilla.

Examples: Anomaly

You can extract Anomaly's (1.5.1 at the time of writing) files into Steam's default CoP Location, go into the "bin" folder, and rename the appropriate one (Example "AnomalyDX11.exe" for DX11) to "xrEngine.exe" and it will run fine through Steam or on its own.

This screenshot shows Anomaly freshly unpacked into

C:\Program Files (x86)\Steam\steamapps\common\Stalker Call of Pripyat

with no change to the executables under the bin subfolder, and what you see if you click Play.

Predictably it throws an error

Rename the executable as described in the previous paragraph and it works.

APPENDIX B: Mods That Wont Play Ball

Lets focus on S.T.A.L.K.E.R mods that use their own folder structure or file names ; and demonstrate how attempts to manipulate them with the above techniques simply don't work.

Example 1: OGSR And NS-OGSR


Track your playtime with OGSR (or any mod) image 199
Track your playtime with OGSR (or any mod) image 200
Track your playtime with OGSR (or any mod) image 201
Track your playtime with OGSR (or any mod) image 202
Track your playtime with OGSR (or any mod) image 203

Install it to the Steam folder

Lets look at the files

Two things should become evident, there is no "bin" folder, its now "bin_x64"

When you go in, the launch file is also using the new xrEngine.exe instead of XR_3DA.exe that SHoC uses.

Can we alter them to fit the Steam's hardcoded behavior ? Lets rename "bin_x64" to just "bin" then go in and rename xrEngine.exe to XR_3DA.exe.

Hit PLAY on Steam: Well, it called the executable file, but the mod is not happy.

Note: This error is not limited to you trying to launch from Steam, if you run it manually you get the same error, the mod is broken at this point until you reverse the changes.

NS-OGSR Edition

Same problem as OGSR

Example 2: Oblivion Lost Remake


Track your playtime with OGSR (or any mod) image 214
Track your playtime with OGSR (or any mod) image 215
Track your playtime with OGSR (or any mod) image 216

Track your playtime with OGSR (or any mod) image 217

Install it to the Steam folder

Lets look at the files

It does use XR_3DA.exe, but uses its own bin folder called "_bin_olr_"

Lets try and make it work. Rename "_bin_olr_" to "bin".

Hit PLAY on Steam, it did indeed call the executable file, but the mod is not happy.

The reference to the original folder suggests its hard coded.

Note: This error is not limited to you trying to launch from Steam, if you run it manually you get the same error, the mod is broken at this point until you reverse the changes.

Example 3: Lost Alpha Directors Cut


Track your playtime with OGSR (or any mod) image 226
Track your playtime with OGSR (or any mod) image 227
Track your playtime with OGSR (or any mod) image 228
Track your playtime with OGSR (or any mod) image 229
Track your playtime with OGSR (or any mod) image 230
Track your playtime with OGSR (or any mod) image 231

Install it to the Steam folder

Lets look at the files

It does use XR_3DA.exe, but uses its own bin folder called "bins"

Furthermore for this specific mod, you cant even launch it as-is from XR-3DA.exe, even manually, it complains straight away.

In the case of Lost Alpha you have to use its own Launcher.

Which itself is hardcoded to launch the engine from "bins".

There is no point trying to rename "bins" to "bin" for the sake of Steam, its already not going to work because we have already seen that it wants you to use the launcher and won't accept any other way.

What if you get creative, rename the Launcher itself to XR-3DA.exe and try to manipulate it that way. Save you the effort, outright doesn't work.

Example 4: Anomaly Via Mod Oganizer

I have demonstrated three examples of mods that wont mesh with Steam for time tracking, at least not using basic techniques.

Branching out, what if you use Mod Manager to manage Anomaly addons and need to launch it through that, which has nothing at all to do with a Steam-installed game, its it's own program installed elsewhere on your PC.

APPENDIX C: Solutions To APPENDIX B

Let's look at how to fix the problem mods presented in APPENDIX B.

OGSR was already presented as the main focus of this guide at the very top.

For the rest, the short answer is its basically the same process, you just have to see what needs tailored for each one. It really only boils down to

- Knowing where you need to put the custom executable file relative to what game you need the hours tracked against. This is relatively fixed for one game or the other (bin\xr_3da.exe for ShoC || bin\xrengine.exe for CoP) (Or Clear Sky equivalent if you're doing a CS mod)

- Knowing how to string the cmd lines together into a batch file to trigger the actual mod.

To help drive the points home, APPENDIX C will now walk through the remaining examples from APPENDIX B.

Oblivion Lost Remake - FIXED


Track your playtime with OGSR (or any mod) image 251
Track your playtime with OGSR (or any mod) image 252
Track your playtime with OGSR (or any mod) image 253
Track your playtime with OGSR (or any mod) image 254
Track your playtime with OGSR (or any mod) image 255
Track your playtime with OGSR (or any mod) image 256
Track your playtime with OGSR (or any mod) image 257

Recap

- OLR does not use a bin folder, its _bin_olr_

1. Create a bin folder, its there now and empty.

2. Put myfile.exe into the bin folder, and rename it to XR_3DA.exe

You have now provided the file that Steam is hardcoded to execute.

3. Take launch.bat (or just re-create it) and put it into the root of the game's folder

NOT in "bin".

4. Edit launch.bat

And enter the cmd commands needed to launch OLR

Put these three lines into launch.bat

c:

cd "C:\Program Files (x86)\Steam\steamapps\common\STALKER Shadow of Chernobyl\_bin_olr_"

XR_3DA.exe

5. TEST IT FIRST.

Double click launch.bat and make sure it works. If the batch file is good then double clicking it will launch the mod. It needs to be solid before you try launching it from Steam or you'll be scratching your head where you went wrong.

This is good

6. Open from Steam.

If you have done everything correctly clicking Play on Steam should open OLR.

- There exists the file bin\xr_3da.exe which you put there (will be the only one)

- There exists launch.bat in the main/root game folder

- launch.bat contains the correct commands to open OLR, and you have manually tested and verified it works.

Steam overlay showing it works

Lost Alpha Directors Cut - FIXED


Track your playtime with OGSR (or any mod) image 281
Track your playtime with OGSR (or any mod) image 282
Track your playtime with OGSR (or any mod) image 283
Track your playtime with OGSR (or any mod) image 284
Track your playtime with OGSR (or any mod) image 285
Track your playtime with OGSR (or any mod) image 286
Track your playtime with OGSR (or any mod) image 287

Recap

- LADC uses a bins folder instead of bin

- Does not let you launch the mod manually

- Must use its launcher

1. Create a bin folder, its there now and empty.

2. Put myfile.exe into the bin folder, and rename it to XR_3DA.exe

You have now provided the file that Steam is hardcoded to execute.

3. Take launch.bat (or just re-create it) and put it into the root of the game's folder

NOT in "bin".

4. Edit launch.bat

And enter the cmd commands needed to launch OLR

Put these three lines into launch.bat

c:

cd "C:\Program Files (x86)\Steam\steamapps\common\STALKER Shadow of Chernobyl"

"Lost Alpha Configurator.exe"

5. TEST IT FIRST.

Double click launch.bat and make sure it works. If the batch file is good then double clicking it will launch the mod. It needs to be solid before you try launching it from Steam or you'll be scratching your head where you went wrong.

This is good

6. Open from Steam.

If you have done everything correctly clicking Play on Steam should open LADC.

- There exists the file bin\xr_3da.exe which you put there (will be the only file)

- There exists launch.bat in the main/root game folder

- launch.bat contains the correct commands to open the LADC launcher, and you have manually tested it.

Because Steam considers the Launcher as the game it's actually countring runtime of the launcher not the mod, but it's all the same to us.

You can already see it counting it as playtime before you even start the mod.

Anomaly Via Mod Oranizer - FIXED


Track your playtime with OGSR (or any mod) image 314
Track your playtime with OGSR (or any mod) image 315
Track your playtime with OGSR (or any mod) image 316
Track your playtime with OGSR (or any mod) image 317
Track your playtime with OGSR (or any mod) image 318

This is actually quite simple. If you've been following there should be no surprises.

1. Install Anomaly as normal.

2. Install Mod Organizer wherever you want, as normal.

3. Configure Mod Organizer, set it all up, add the addons and get it working, as normal.

1. Put your myfile.exe into the bin folder

You have now provided the file that Steam is hardcoded to execute.

2. Rename it to xrEngine.exe so Steam will call it.

3. Take launch.bat (or just re-create it) and put it into the root of the game's folder

NOT in "bin".

4. Edit launch.bat

And enter the cmd commands needed to launch Mod Organizer (Instead of Anomaly directly)

Put in the cmd commands to run Mod Oranizer (wherever you installed it)

5. TEST IT FIRST.

Double click launch.bat and make sure it works. If the batch file is good then double clicking it will launch the mod. It needs to be solid before you try launching it from Steam or you'll be scratching your head where you went wrong.

6. Open from Steam.

If you have done everything correctly clicking Play on Steam should open Mod Organizer.

- There exists the file bin\xrEngine.exe which you put there

- There exists launch.bat in the main game folder

- launch.bat contains the correct commands to open Mod Organizer

Above screenshot shows Call of Pripyat is "Running".

Technically Steam is counting Mod Oraganizer's runtime as your hours not Anomaly, but its all the same to you and me.

And yes, you have to click Play 3 times, once on Steam to launch MO, then in MO to launch the Anomaly Launcher, then in the Anomaly launcher to launch the game. Get used to it.

What About... Insert Other Mod Here

What about Gunslinger you might ask ? What about this mod or that mod ?

Do this enough times, it's all the same really.

If this guide helps you getting one of the specifically provided mods working through Steam that's great.

You can also see from the Mod Organizer example that the Mod you wish to run does not in fact even need to be sitting in the same folder that Steam puts Vanilla. It can be anywhere, you only need to edit the batch file accordingly and point it to the real location. In that regard this solution is highly flexible.

The intended outcome of this guide is it gives you the knowledge to tailor this trick it to any Stalker mod you want to play through Steam. Not just Stalker mods either, literally any Steam game can (theoretically) be given the same treatment with the same custom files. At least in theory, I've only done this for this game personally.

Source: https://steamcommunity.com/sharedfiles/filedetails/?id=2537491584					

More S.T.A.L.K.E.R.: Shadow of Chernobyl guilds