aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-02-18 00:33:52 +0000
committerJustin Clark-Casey (justincc)2012-02-18 00:33:52 +0000
commitb817c337dc2c5d8efda710f445114aa9a9344611 (patch)
tree4ff5ef565c57495fa89e051504983117413d8cee
parentFillin missing SQLite support for Telehubs (diff)
downloadopensim-SC_OLD-b817c337dc2c5d8efda710f445114aa9a9344611.zip
opensim-SC_OLD-b817c337dc2c5d8efda710f445114aa9a9344611.tar.gz
opensim-SC_OLD-b817c337dc2c5d8efda710f445114aa9a9344611.tar.bz2
opensim-SC_OLD-b817c337dc2c5d8efda710f445114aa9a9344611.tar.xz
On Windows automatically load the correct native ODE library depending on whether the process is 32-bit or 64-bit
In theory, this means that a 64-bit Windows OS user can now run OpenSim.exe with ODE and use more than 2 (or 3) GB of memory. However, this is completely untested since I don't currently own a 64-bit Windows box. Feedback appreciated. Using OpenSim.32BitLaunch.exe should continue to work. Other platforms are unaffected. This will currently not work with sqlite - I will add that too if this works.
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs4
-rw-r--r--OpenSim/Framework/Util.cs38
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs3
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs24
-rwxr-xr-xbin/lib32/ode.dll (renamed from bin/ode.dll)bin496640 -> 496640 bytes
5 files changed, 64 insertions, 5 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 545e76c..0dd01af 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -308,7 +308,9 @@ namespace OpenSim.Framework.Servers
308 // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and 308 // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and
309 // the clr version number doesn't match the project version number under Mono. 309 // the clr version number doesn't match the project version number under Mono.
310 //m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine); 310 //m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine);
311 m_log.Info("[STARTUP]: Operating system version: " + Environment.OSVersion + Environment.NewLine); 311 m_log.InfoFormat(
312 "[STARTUP]: Operating system version: {0}, .NET platform {1}, {2}-bit\n",
313 Environment.OSVersion, Environment.OSVersion.Platform, Util.Is64BitProcess() ? "64" : "32");
312 314
313 StartupSpecific(); 315 StartupSpecific();
314 316
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 4b0b13c..b3ec5c2 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -35,7 +35,8 @@ using System.IO;
35using System.IO.Compression; 35using System.IO.Compression;
36using System.Net; 36using System.Net;
37using System.Net.Sockets; 37using System.Net.Sockets;
38using System.Reflection; 38using System.Reflection;
39using System.Runtime.InteropServices;
39using System.Runtime.Serialization; 40using System.Runtime.Serialization;
40using System.Runtime.Serialization.Formatters.Binary; 41using System.Runtime.Serialization.Formatters.Binary;
41using System.Security.Cryptography; 42using System.Security.Cryptography;
@@ -375,6 +376,20 @@ namespace OpenSim.Framework
375 } 376 }
376 377
377 return sb.ToString(); 378 return sb.ToString();
379 }
380
381 /// <summary>
382 /// Is the platform Windows?
383 /// </summary>
384 /// <returns>true if so, false otherwise</returns>
385 public static bool IsWindows()
386 {
387 PlatformID platformId = Environment.OSVersion.Platform;
388
389 return (platformId == PlatformID.Win32NT
390 || platformId == PlatformID.Win32S
391 || platformId == PlatformID.Win32Windows
392 || platformId == PlatformID.WinCE);
378 } 393 }
379 394
380 public static bool IsEnvironmentSupported(ref string reason) 395 public static bool IsEnvironmentSupported(ref string reason)
@@ -1457,6 +1472,27 @@ namespace OpenSim.Framework
1457 } 1472 }
1458 1473
1459 return data; 1474 return data;
1475 }
1476
1477 /// <summary>
1478 /// Used to trigger an early library load on Windows systems.
1479 /// </summary>
1480 /// <remarks>
1481 /// Required to get 32-bit and 64-bit processes to automatically use the
1482 /// appropriate native library.
1483 /// </remarks>
1484 /// <param name="dllToLoad"></param>
1485 /// <returns></returns>
1486 [DllImport("kernel32.dll")]
1487 public static extern IntPtr LoadLibrary(string dllToLoad);
1488
1489 /// <summary>
1490 /// Determine whether the current process is 64 bit
1491 /// </summary>
1492 /// <returns>true if so, false if not</returns>
1493 public static bool Is64BitProcess()
1494 {
1495 return IntPtr.Size == 8;
1460 } 1496 }
1461 1497
1462 #region FireAndForget Threading Pattern 1498 #region FireAndForget Threading Pattern
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
index 3763696..8587a2b 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
@@ -30,7 +30,8 @@ using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using Nini.Config; 32using Nini.Config;
33using log4net; 33using log4net;
34using OpenSim.Framework;
34 35
35namespace OpenSim.Region.Physics.Manager 36namespace OpenSim.Region.Physics.Manager
36{ 37{
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 716161a..6ee2714 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Region.Physics.OdePlugin
46 /// </summary> 46 /// </summary>
47 public class OdePlugin : IPhysicsPlugin 47 public class OdePlugin : IPhysicsPlugin
48 { 48 {
49 //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
50 50
51 private OdeScene m_scene; 51 private OdeScene m_scene;
52 52
@@ -59,13 +59,33 @@ namespace OpenSim.Region.Physics.OdePlugin
59 { 59 {
60 if (m_scene == null) 60 if (m_scene == null)
61 { 61 {
62 // We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether
63 // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports
64 // will find it already loaded later on.
65 //
66 // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be
67 // controlled in Ode.NET.dll.config
68 if (Util.IsWindows())
69 {
70 string nativeLibraryPath;
71
72 if (Util.Is64BitProcess())
73 nativeLibraryPath = "lib64/ode.dll";
74 else
75 nativeLibraryPath = "lib32/ode.dll";
76
77 m_log.DebugFormat("[ODE PLUGIN]: Loading native Windows ODE library at {0}", nativeLibraryPath);
78 Util.LoadLibrary(nativeLibraryPath);
79 }
80
62 // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to 81 // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to
63 // http://opensimulator.org/mantis/view.php?id=2750). 82 // http://opensimulator.org/mantis/view.php?id=2750).
64 d.InitODE(); 83 d.InitODE();
65 84
66 m_scene = new OdeScene(sceneIdentifier); 85 m_scene = new OdeScene(sceneIdentifier);
67 } 86 }
68 return (m_scene); 87
88 return m_scene;
69 } 89 }
70 90
71 public string GetName() 91 public string GetName()
diff --git a/bin/ode.dll b/bin/lib32/ode.dll
index f310358..f310358 100755
--- a/bin/ode.dll
+++ b/bin/lib32/ode.dll
Binary files differ