TS2015 Raildriver Interface

When downloads are added a topic is automatically created where discussion of that download can take place.

TS2015 Raildriver Interface

Postby CobraOne » Wed Nov 12, 2014 10:51 pm

Name: TS2015 Raildriver Interface
Version Number: 2.0
File Name: TS2015 Raildriver Interface - V2.0.zip
Size: 2.45 Mb
View Download: TS2015 Raildriver Interface

Description:
I have spent the last year writing a program to enable me to extract data from TS2015, then read data from a Raildriver console and finally pass the data back to TS2015. This enables the controlling of the virtual cab controls that the supplied driver for the Raildriver controller can't operate such as Cab Reverser, Virtual Reverser, Cab Throttle, Virtual Train Brake and many others.
You can also assign different values to the Wiper & Lights switches instead of the default ones, and although you still have only 3 positions, they can be 0, 2, 3 for off, fast intermittent and continous for example for the wipers. You can also setup the reverser as a 4 position reverser such as off, forward, neutral and reverse or off, reverse, neutral and forward, the choice is yours. I have also designed the interface for assigning the buttons in a way that allows you to add new commands as new trains are added and you can assign the same command to two buttons as I have done with the Bell being assigned to the Bell button and the Horn Down.

I have tested all this software as best I can on my machine and all works well and I can see no reason why it shouldn't on other machines. Read the Quick Setup section at the beginning of the TS2015 Interface Readme V2.0.pdf/doc to get started with the default setup as used with the Macroworks software then when you are ready, read the Detailed Setup section for instructions on how to customise the Raildriver for each engine.

In this zip file you should find the following folders:-
1. CalculateNotchValues - This is used to calculate values to enable a lever to become a lever with notches
2. Railworks Editor - Used to edit the Railworks files to allow communication between Railworks and the Railworks_Getdata_Script.
3. TS2015 Raildriver Interface (Program) - This is the main program for the Raildriver to communicate with TS2015.

And the following files:-
1. TS2015 Interface Readme V2.0.pdf or doc- 11 page tutorial with pictures on how to use these programs
2. Railworks_GetData_Script.lua - The script that communicates with TS2015 and should be placed in your plugins folder.

Please let me know how you get on with the software

Chris (CobraOne)
Last edited by CobraOne on Sat Feb 21, 2015 7:05 pm, edited 4 times in total.
Reason: The download was updated
CobraOne
General Shed Duties
 
Posts: 23
Images: 1
Joined: Thu May 22, 2014 11:35 am
Has thanked: 0 time
Been thanked: 9 times

Re: TS2015 Raildriver Interface

Postby VictoryWorks » Thu Nov 13, 2014 1:57 am

Hi Chris
Good to have you here :)

Is it safe to assume that the Engine Script Editor (and therefore the whole thing) only works on locos with plain .lua engine files and not ones with the .out encrypted ones?
User avatar
VictoryWorks
Driver
 
Posts: 333
Joined: Mon Apr 07, 2014 1:22 pm
Has thanked: 41 times
Been thanked: 224 times

Re: TS2015 Raildriver Interface

Postby CobraOne » Thu Nov 13, 2014 12:15 pm

VictoryWorks wrote:Hi Chris
Good to have you here :)

Is it safe to assume that the Engine Script Editor (and therefore the whole thing) only works on locos with plain .lua engine files and not ones with the .out encrypted ones?


The engine script editor will work with both lua and out files. It doesn't edit the original file, but instead renames the file with a .bak extension and then replaces the original file with a new file that calls my script and then calls the renamed file with the .bak extension. If you look in the folder containing the engine script editor folder you will see a lua script called New_Engine_Template.lua that does all the work
Code: Select all
-- This script is used to call the original code from the enegine script and
-- inject a call to my code which will extract data from and inject data into
-- TS2015. I originally wrote a C# program  that decompiled the engine files
-- then automatically injected my script into into the decompiled code and
-- then recompiled the code. This was a bit long winded and thanks to 'Havner'
-- from UKTrainSim he pointed me in the right direction so I could rewrite my
-- code without having to decompile and recompile.

-- Require the original renamed script, we still need it
require ("NameOfFileToEdit")

--  keep previous functions before we provide our own
-- you can similarly override any other function (OnControlChange, OnConsistMessage, etc...)

old_update = Update

-- Require my script
require ("plugins/Railworks_GetData_Script")

-- Provide a basic Initialise for some of the old locos such as in the Kuju folder that don't have one.
function DummyInitialise()
   Call("BeginUpdate")
end

-- Check if we have an Initialise, if not call our DummyInitialise
if not Initialise then
   Initialise = DummyInitialise
end

-- Our Update function that is called continuously
function Update(interval)
   -- Check if we have an Update function in the original engine script
   -- If we do then call it.
   if old_update then
      old_update(interval)
   end
   -- Now call my function in the Railworks_GetData_Script
   getdata()

end


Where you have the line:- require ("NameOfFileToEdit") my C# program simply replaces the "NameOfFileToEdit" with the name of the file you selected.

Off course you could edit this replacement script template and then call anything you like or just edit the Railworks_Getdata_Script.lua file instead.

Chris
CobraOne
General Shed Duties
 
Posts: 23
Images: 1
Joined: Thu May 22, 2014 11:35 am
Has thanked: 0 time
Been thanked: 9 times

Re: TS2015 Raildriver Interface

Postby VictoryWorks » Thu Nov 13, 2014 2:44 pm

Aha very elegant, nice one
User avatar
VictoryWorks
Driver
 
Posts: 333
Joined: Mon Apr 07, 2014 1:22 pm
Has thanked: 41 times
Been thanked: 224 times

Re: TS2015 Raildriver Interface

Postby JamesLit » Sat Nov 15, 2014 3:51 pm

Chris, I have found that when I apply the script edit with the program, it crashes TS with a dump when I go near a loco fitted with it. Any ideas? Will try some more.

EDIT: This was with AP's Class 52. I have tried it with the default Class 47 and the buttons all work, but all the axes (including the lights and wiper buttons, considered as axes) do not work at all! :? Time for more experiments.

Another edit: I've also noticed that while I have it running (and I did press start) it's not showing any data being sent to or fro TS.....
The Forge Simulation | Like us on Facebook!
Owner & Director | Content built with care, not compromises.
User avatar
JamesLit
Driver
 
Posts: 370
Images: 26
Joined: Mon Apr 07, 2014 3:26 pm
Location: Kent
Has thanked: 433 times
Been thanked: 141 times

Re: TS2015 Raildriver Interface

Postby CobraOne » Sat Nov 15, 2014 4:13 pm

Hi James

If no data is being displayed then it is an indication of an error in the Railworks_Getdata_Script.lua file, can you confirm you copied this file to the plugins folder?

Chris
CobraOne
General Shed Duties
 
Posts: 23
Images: 1
Joined: Thu May 22, 2014 11:35 am
Has thanked: 0 time
Been thanked: 9 times

Re: TS2015 Raildriver Interface

Postby JamesLit » Sat Nov 15, 2014 4:23 pm

Hi Chris,

All present and correct. Even tried to copy it again just to make sure, Windows showed an exactly identical file already there.

Edit: just looked and there's a GetData.txt with values in it which seems to have been there for a while, if that helps.
The Forge Simulation | Like us on Facebook!
Owner & Director | Content built with care, not compromises.
User avatar
JamesLit
Driver
 
Posts: 370
Images: 26
Joined: Mon Apr 07, 2014 3:26 pm
Location: Kent
Has thanked: 433 times
Been thanked: 141 times

Re: TS2015 Raildriver Interface

Postby CobraOne » Sat Nov 15, 2014 4:39 pm

Hi James

If you have a getdata.txt file then both the Railworks_getdata_script and the edited engine file are working fine, do you have a sendcommand.txt as well?
The reason the buttons work is because my program talks directly to the keyboard input using win32's sendinput and don't go through TS2015.

I take it you don't get any errors regarding net framework 3.5 not being installed.
Can you try running the program as administrator to see if that helps

Chris
CobraOne
General Shed Duties
 
Posts: 23
Images: 1
Joined: Thu May 22, 2014 11:35 am
Has thanked: 0 time
Been thanked: 9 times

Re: TS2015 Raildriver Interface

Postby CobraOne » Sat Nov 15, 2014 4:48 pm

Hi all,
It appears James is not the only person having this problem.
If you bear with me I will try my program on another machine that does not have visual studio installed to see if I can duplicate the problem

Chris
CobraOne
General Shed Duties
 
Posts: 23
Images: 1
Joined: Thu May 22, 2014 11:35 am
Has thanked: 0 time
Been thanked: 9 times

Re: TS2015 Raildriver Interface

Postby JamesLit » Sat Nov 15, 2014 4:52 pm

Hi Chris,

Thanks for the update. Hopefully some of this info might be useful:

There's no senddata.txt or anything like that.

Just ran as admin and went to try again, only for it to dump again.

No errors of any sort other than the actual dump from TS.

Have now set it under compatibility in the properties of the program to run in Windows XP Service Pack 3 mode and running as admin, and I then manually ran it as admin with those settings applied. No errors upon getting into the 47 again, but still the same story - no data showing as being sent or received, no senddata.txt or similar, and no axes working.

Hope you get it sorted soon - best of luck and thanks for all your work, mate. Doing this will keep me ticking over till I can finally get my other bits sorted, like a real speedo and some real levers! :D
The Forge Simulation | Like us on Facebook!
Owner & Director | Content built with care, not compromises.
User avatar
JamesLit
Driver
 
Posts: 370
Images: 26
Joined: Mon Apr 07, 2014 3:26 pm
Location: Kent
Has thanked: 433 times
Been thanked: 141 times

Next

Return to Download Discussion

Who is online

Users browsing this forum: No registered users and 10 guests