A+ A A-

How to restore missing green tick marks in the scenario list

RWDBRepair: a script for restoring the completion status of your Railworks scenarios.

Chacal
2015-10-08

When you complete a scenario successfully in Railworks, it gets a green tick mark in the scenario list.
This is important for keeping track of your progress and so you don't keep playing the same scenarios all over again.
Railworks (TS2014) keeps information about this and other achievements in your local database.
For some reason, this database sometimes gets corrupted and some or all of your green tick marks get erased. You may not immediately notice it if only some of them disappear. This is quite annoying.

The only way to preserve this information is to back up your local scenario database, which is a file named SDBCache.bin in the Railworks/Content folder. Of course if you back up your whole Railworks folder then you also back up the database.

The problem lies in restoring this information. If you copy the backup over the current database, you will recover the information in the state it was at the time of the backup. You will lose all tick marks gathered after the backup. If you don't back up regularly, this can be a lot of tick marks.

A better solution would be to open both the old and the new databases and recover only the lost tick marks.
This can be done manually, by decompressing the SDBCache.bin files into xml files with serz.exe or RW-Tools, and, for each scenario in the backup database, if its "Completion" attribute is "CompletedSuccessfully", check its "Completion" attribute in the active database, and if it is different then change it to "CompletedSuccessfully".

This may look trivial but for hundreds of scenarios it would take hours, and if you make a single mistake you end up with a corrupt database. Clearly this needs to be automated.

Enter the RWDBRepair script. It automates this process in a secure and user-friendly way and completes the whole operation in a few seconds.

Prerequisites

You don't need any technical knowledge in order to use RWDBRepair. You don't even need to understand the above text.

All you need is:

- to have lost some or all of your green tick marks;

- one or several backups of Railworks, or at least the Railworks/Content/SDBCache.bin file (make a note of where you have put them);

- Windows XP, 7 or 8 with the Windows Scripting Host installed (should be installed by default);

- the RWDBRepair.vbs script.

Installation

1. Download the attached zip file

2. Open it using either Windows Explorer, Winzip, WinRAR, 7Zip, etc.

3. Extract the contents to a new folder on your computer

Note: Recent versions of Windows try to be nice and user-friendly, and let you open a .zip archive file in Windows Explorer as if it was a folder. This is a lie! An archive file is NOT a folder. It is important to extract the contents and use it from outside the archive.

The folder you have created should now contain two files: this readme in PDF format and the RWDBRepair.vbs script as shown below. Depending on your Windows configuration, you may not see the .pdf and .vbs file extensions.

RWDBRepair 01

Operation

1. Double-click on RWDBRepair.vbs

2. Change the path to your Railworks installation or keep the one displayed

RWDBRepair 02

RWDBRepair 03

3. Select the folder containing a backup of your scenario database (normally in a "Content" folder)

RWDBRepair 04

4. Confirm the operation

RWDBRepair 05

5. Wait until the operation is completed

RWDBRepair 06

6. Read the result message, and view the log if you want

RWDBRepair 07


If you have several backups, you should perform this operation first with your oldest backup (it doesn't matter how old, if the database is not compatible the script will not change anything), and then repeat with as many newer backups as you wish. This will ensure that you catch any lost green tick mark.

Details and notes

1. Before making any change, the script will make a backup of your current SDBCache.bin and SDBCache.bin.md5 files into the script folder. It will not delete this backup after the operation. However it will overwrite it, so you may want to back up the backup after the first run if you want to run the script several times.

2. For now it seems the md5 is not used for validating the database file, it only has to exist. If RSC one day decides to use it, then we're screwed unless RSC tells us how to generate the md5, which doesn't seem to be standard.

3. I have taken great pains for ensuring the script is safe to use. The script makes all kinds of validations before and during the operation. The operation itself is only this: for each scenario in the backup database, if its "Completion" attribute is "CompletedSuccessfully", check its "Completion" attribute in the active database, and if it is different then change it to "CompletedSuccessfully".

4. However I cannot test the script on every user's computer. Some errors may occur, in which case the operation will abort and you will see an error message. If this happens you should review the log, which is quite verbose. Most often the log will point to an obvious cause to the problem, such as a missing file, etc.

RWDBRepair 08

5. If you have any problem with no obvious cause in the log, contact me on the forums at www.RailworksAmerica.com with a precise description of the problem, and provide the log.

6. This is a VBScript. VBS is not VB, not VBA, not VB.Net. It is not a true programming language and it has very limited access to the Windows API. Consequently the GUI is not as nice as I would like it to be. For example, ther is no file browser, only a folder browser. You will not see the files in the folders. This means you can select a wrong folder, but the script will warn you if it can't find the files.

7. The first time it is run, the script will create a configuration file (RWLibConfig.xml) containing the paths to your Railworks installation and to serz.exe. It calculates these paths from the path to Steam, which it finds in the Windows registry. Further runs of the script will use the value in the configuration file. You can change the path to Railworks in the GUI, or you can edit the configuration file manually using a text editor. Should you mess it up, just delete it and run the script again.

8. After processing, the script folder contains the additional files mentioned above:

RWDBRepair 09

9. Even after being restored, some green tick marks may disappear again, deleted by Railworks. This seems to be normal behavior, and usually there will be a note in the LogMate window about it. For example, after the upgrade to TS2014 I lost the marks for all Cajon Pass scenarios. RW would delete them every time it started. LogMate had a note for each scenario, about it being outdated or something. I have no idea why it does that, but there's nothing I can do to prevent it.

10. The script is over 800 lines long, most of which are comments, validation, logging and GUI stuff for making it safe and user-friendly. You can view the code in any decent text editor, and use it as learning material for making your own scripts for manipulating Railworks blueprints and other XML files. A solid understanding of XML and Xpath is required though.

Last modified on
HOT NEWS

Visitors Counter

37100312
Today
Yesterday
This Week
This Month
Last Month
10176
10610
66442
488730
411802

Your IP: 3.239.57.87

Who's Online

We have 2529 guests and no members online

blue green orange red

Copyright 2018 by Mutagenix - A subsidiary of the NERR Network. Best viewed at 1280 x or more.