File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 1- // COPYRIGHT 2014, 2018 by the Open Rails project.
1+ // COPYRIGHT 2014, 2018 by the Open Rails project.
22//
33// This file is part of Open Rails.
44//
1515// You should have received a copy of the GNU General Public License
1616// along with Open Rails. If not, see <http://www.gnu.org/licenses/>.
1717using System ;
18+ using System . IO ;
1819using System . Diagnostics ;
20+ using System . Reflection ;
1921using System . Windows . Forms ;
2022
21-
2223namespace ORTS . TrackViewer
2324{
2425 static class Program
@@ -31,6 +32,11 @@ static void Main(string[] args)
3132 {
3233 using ( TrackViewer trackViewer = new TrackViewer ( args ) )
3334 {
35+ //enables loading of dll for specific architecture(32 or 64bit) from distinct folders, useful when both versions require same name (as for OpenAL32.dll)
36+ string path = Path . Combine ( Path . GetDirectoryName ( Assembly . GetExecutingAssembly ( ) . Location ) , "Native" ) ;
37+ path = Path . Combine ( path , ( Environment . Is64BitProcess ) ? "X64" : "X86" ) ;
38+ Orts . NativeMethods . SetDllDirectory ( path ) ;
39+
3440 // code below is modified version from what is found in GameStateRunActivity.cs
3541 if ( Debugger . IsAttached ) // Separate code path during debugging, so IDE stops at the problem and not at the message.
3642 {
Original file line number Diff line number Diff line change 3030
3131namespace Orts
3232{
33- static class NativeMethods
33+ public static class NativeMethods
3434 {
3535 [ DllImport ( "kernel32.dll" , CallingConvention = CallingConvention . StdCall ) ]
36- internal static extern bool SetDllDirectory ( string pathName ) ;
36+ public static extern bool SetDllDirectory ( string pathName ) ;
3737 }
3838
3939 static class Program
You can’t perform that action at this time.
0 commit comments