Cleanup a bit
Started to add Primitive creation (very basic at the moment) Should now be ready for merging into trunkConvertToPlugins
parent
6a1cc7c70f
commit
0fcaa11f43
|
@ -1,21 +1,31 @@
|
||||||
using System;
|
using System.Reflection;
|
||||||
using System.Reflection;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// Information about this assembly is defined by the following
|
||||||
// <autogenerated>
|
// attributes.
|
||||||
// This code was generated by a tool.
|
//
|
||||||
// Mono Runtime Version: 2.0.50727.42
|
// change them to the information which is associated with the assembly
|
||||||
//
|
// you compile.
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
[assembly: AssemblyTitle("SimConfig")]
|
||||||
// </autogenerated>
|
[assembly: AssemblyDescription("")]
|
||||||
// ------------------------------------------------------------------------------
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: ComVisibleAttribute(false)]
|
[assembly: AssemblyProduct("SimConfig")]
|
||||||
[assembly: CLSCompliantAttribute(false)]
|
[assembly: AssemblyCopyright("")]
|
||||||
[assembly: AssemblyVersionAttribute("0.1.*.148")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyTitleAttribute("opensim-simconfig")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: AssemblyDescriptionAttribute("The default configuration handler")]
|
|
||||||
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
|
// This sets the default COM visibility of types in the assembly to invisible.
|
||||||
|
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all values by your own or you can build default build and revision
|
||||||
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
|
@ -119,11 +119,6 @@ namespace Db40SimConfig
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one");
|
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one");
|
||||||
HeightmapGenHills hills = new HeightmapGenHills();
|
HeightmapGenHills hills = new HeightmapGenHills();
|
||||||
blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
|
blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
|
||||||
/* blank.LandMap = new float[65536];
|
|
||||||
for(int i = 0 ; i <65536; i++)
|
|
||||||
{
|
|
||||||
blank.LandMap[i] = 20.49f;
|
|
||||||
}*/
|
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database");
|
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database");
|
||||||
db.Set(blank.LandMap);
|
db.Set(blank.LandMap);
|
||||||
db.Commit();
|
db.Commit();
|
||||||
|
|
|
@ -26,12 +26,8 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="OpenSim">
|
|
||||||
<HintPath>..\..\bin\OpenSim.exe</HintPath>
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Db4objects.Db4o">
|
<Reference Include="Db4objects.Db4o">
|
||||||
<HintPath>..\..\..\..\..\Program Files\Db4objects\db4o-6.1\bin\net-2.0\Db4objects.Db4o.dll</HintPath>
|
<HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath>
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -44,6 +40,10 @@
|
||||||
<Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
|
<Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
|
||||||
<Name>ServerConsole</Name>
|
<Name>ServerConsole</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\Second-server.csproj">
|
||||||
|
<Project>{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}</Project>
|
||||||
|
<Name>Second-server</Name>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||||
</Project>
|
</Project>
|
|
@ -1,21 +1,31 @@
|
||||||
using System;
|
using System.Reflection;
|
||||||
using System.Reflection;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// Information about this assembly is defined by the following
|
||||||
// <autogenerated>
|
// attributes.
|
||||||
// This code was generated by a tool.
|
//
|
||||||
// Mono Runtime Version: 2.0.50727.42
|
// change them to the information which is associated with the assembly
|
||||||
//
|
// you compile.
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
[assembly: AssemblyTitle("GridInterfaces")]
|
||||||
// </autogenerated>
|
[assembly: AssemblyDescription("")]
|
||||||
// ------------------------------------------------------------------------------
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: ComVisibleAttribute(false)]
|
[assembly: AssemblyProduct("GridInterfaces")]
|
||||||
[assembly: CLSCompliantAttribute(false)]
|
[assembly: AssemblyCopyright("")]
|
||||||
[assembly: AssemblyVersionAttribute("0.1.*.148")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyTitleAttribute("opensim-gridinterfaces")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: AssemblyDescriptionAttribute("Definitions for OGS interface")]
|
|
||||||
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
|
// This sets the default COM visibility of types in the assembly to invisible.
|
||||||
|
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all values by your own or you can build default build and revision
|
||||||
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="libsecondlife">
|
<Reference Include="libsecondlife">
|
||||||
<HintPath>..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath>
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -1,21 +1,31 @@
|
||||||
using System;
|
using System.Reflection;
|
||||||
using System.Reflection;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// Information about this assembly is defined by the following
|
||||||
// <autogenerated>
|
// attributes.
|
||||||
// This code was generated by a tool.
|
//
|
||||||
// Mono Runtime Version: 2.0.50727.42
|
// change them to the information which is associated with the assembly
|
||||||
//
|
// you compile.
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
[assembly: AssemblyTitle("LocalGridServers")]
|
||||||
// </autogenerated>
|
[assembly: AssemblyDescription("")]
|
||||||
// ------------------------------------------------------------------------------
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: ComVisibleAttribute(false)]
|
[assembly: AssemblyProduct("LocalGridServers")]
|
||||||
[assembly: CLSCompliantAttribute(false)]
|
[assembly: AssemblyCopyright("")]
|
||||||
[assembly: AssemblyVersionAttribute("0.1.*.148")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyTitleAttribute("opensim-localservers")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: AssemblyDescriptionAttribute("local grid servers")]
|
|
||||||
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
|
// This sets the default COM visibility of types in the assembly to invisible.
|
||||||
|
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all values by your own or you can build default build and revision
|
||||||
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="libsecondlife">
|
<Reference Include="libsecondlife">
|
||||||
<HintPath>..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath>
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
423
src/Main.cs
423
src/Main.cs
|
@ -47,126 +47,126 @@ using PhysicsSystem;
|
||||||
|
|
||||||
namespace OpenSim
|
namespace OpenSim
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Description of MainForm.
|
/// Description of MainForm.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class OpenSim_Main
|
public class OpenSim_Main
|
||||||
{
|
{
|
||||||
public static OpenSim_Main sim;
|
public static OpenSim_Main sim;
|
||||||
public static SimConfig cfg;
|
public static SimConfig cfg;
|
||||||
public static World local_world;
|
public static World local_world;
|
||||||
public static Grid gridServers;
|
public static Grid gridServers;
|
||||||
|
|
||||||
public static Socket Server;
|
public static Socket Server;
|
||||||
private static IPEndPoint ServerIncoming;
|
private static IPEndPoint ServerIncoming;
|
||||||
private static byte[] RecvBuffer = new byte[4096];
|
private static byte[] RecvBuffer = new byte[4096];
|
||||||
private byte[] ZeroBuffer = new byte[8192];
|
private byte[] ZeroBuffer = new byte[8192];
|
||||||
private static IPEndPoint ipeSender;
|
private static IPEndPoint ipeSender;
|
||||||
private static EndPoint epSender;
|
private static EndPoint epSender;
|
||||||
private static AsyncCallback ReceivedData;
|
private static AsyncCallback ReceivedData;
|
||||||
|
|
||||||
public AssetCache assetCache;
|
public AssetCache assetCache;
|
||||||
public DateTime startuptime;
|
public DateTime startuptime;
|
||||||
public Dictionary<EndPoint, OpenSimClient> ClientThreads = new Dictionary<EndPoint, OpenSimClient>();
|
public Dictionary<EndPoint, OpenSimClient> ClientThreads = new Dictionary<EndPoint, OpenSimClient>();
|
||||||
private PhysicsManager physManager;
|
private PhysicsManager physManager;
|
||||||
private System.Timers.Timer timer1 = new System.Timers.Timer();
|
private System.Timers.Timer timer1 = new System.Timers.Timer();
|
||||||
private string ConfigDll = "SimConfig.dll";
|
private string ConfigDll = "SimConfig.dll";
|
||||||
public bool sandbox = false;
|
public bool sandbox = false;
|
||||||
public bool loginserver = false;
|
public bool loginserver = false;
|
||||||
|
|
||||||
[STAThread]
|
[STAThread]
|
||||||
public static void Main( string[] args )
|
public static void Main( string[] args )
|
||||||
{
|
{
|
||||||
Console.WriteLine("OpenSim " + VersionInfo.Version + "\n");
|
Console.WriteLine("OpenSim " + VersionInfo.Version + "\n");
|
||||||
Console.WriteLine("Starting...\n");
|
Console.WriteLine("Starting...\n");
|
||||||
ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local,"",0);
|
ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local,"",0);
|
||||||
|
|
||||||
sim = new OpenSim_Main();
|
sim = new OpenSim_Main();
|
||||||
|
|
||||||
for (int i = 0; i < args.Length; i++)
|
for (int i = 0; i < args.Length; i++)
|
||||||
{
|
{
|
||||||
if(args[i] == "-sandbox")
|
if(args[i] == "-sandbox")
|
||||||
{
|
{
|
||||||
sim.sandbox = true;
|
sim.sandbox = true;
|
||||||
}
|
}
|
||||||
if(args[i] == "-loginserver")
|
if(args[i] == "-loginserver")
|
||||||
{
|
{
|
||||||
sim.loginserver = true;
|
sim.loginserver = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenSim_Main.gridServers = new Grid();
|
OpenSim_Main.gridServers = new Grid();
|
||||||
if(sim.sandbox)
|
if(sim.sandbox)
|
||||||
{
|
{
|
||||||
OpenSim_Main.gridServers.AssetDll = "LocalGridServers.dll";
|
OpenSim_Main.gridServers.AssetDll = "LocalGridServers.dll";
|
||||||
OpenSim_Main.gridServers.GridDll = "LocalGridServers.dll";
|
OpenSim_Main.gridServers.GridDll = "LocalGridServers.dll";
|
||||||
OpenSim_Main.gridServers.LoadPlugins();
|
OpenSim_Main.gridServers.LoadPlugins();
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Starting in Sandbox mode");
|
ServerConsole.MainConsole.Instance.WriteLine("Starting in Sandbox mode");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OpenSim_Main.gridServers.AssetDll = "RemoteGridServers.dll";
|
OpenSim_Main.gridServers.AssetDll = "RemoteGridServers.dll";
|
||||||
OpenSim_Main.gridServers.GridDll = "RemoteGridServers.dll";
|
OpenSim_Main.gridServers.GridDll = "RemoteGridServers.dll";
|
||||||
OpenSim_Main.gridServers.LoadPlugins();
|
OpenSim_Main.gridServers.LoadPlugins();
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Starting in Grid mode");
|
ServerConsole.MainConsole.Instance.WriteLine("Starting in Grid mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sim.loginserver && sim.sandbox)
|
if(sim.loginserver && sim.sandbox)
|
||||||
{
|
{
|
||||||
LoginServer loginServer = new LoginServer(OpenSim_Main.gridServers.GridServer);
|
LoginServer loginServer = new LoginServer(OpenSim_Main.gridServers.GridServer);
|
||||||
loginServer.Startup();
|
loginServer.Startup();
|
||||||
}
|
}
|
||||||
sim.assetCache = new AssetCache(OpenSim_Main.gridServers.AssetServer);
|
sim.assetCache = new AssetCache(OpenSim_Main.gridServers.AssetServer);
|
||||||
|
|
||||||
sim.Startup();
|
sim.Startup();
|
||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
ServerConsole.MainConsole.Instance.MainConsolePrompt();
|
ServerConsole.MainConsole.Instance.MainConsolePrompt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private OpenSim_Main() {
|
private OpenSim_Main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Startup() {
|
private void Startup() {
|
||||||
startuptime=DateTime.Now;
|
startuptime=DateTime.Now;
|
||||||
timer1.Enabled = true;
|
timer1.Enabled = true;
|
||||||
timer1.Interval = 100;
|
timer1.Interval = 100;
|
||||||
timer1.Elapsed +=new ElapsedEventHandler( this.Timer1Tick );
|
timer1.Elapsed +=new ElapsedEventHandler( this.Timer1Tick );
|
||||||
|
|
||||||
// We check our local database first, then the grid for config options
|
// We check our local database first, then the grid for config options
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration");
|
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration");
|
||||||
cfg = this.LoadConfigDll(this.ConfigDll);
|
cfg = this.LoadConfigDll(this.ConfigDll);
|
||||||
cfg.InitConfig();
|
cfg.InitConfig();
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Contacting gridserver");
|
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Contacting gridserver");
|
||||||
cfg.LoadFromGrid();
|
cfg.LoadFromGrid();
|
||||||
|
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString());
|
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString());
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Initialising world");
|
ServerConsole.MainConsole.Instance.WriteLine("Initialising world");
|
||||||
local_world = cfg.LoadWorld();
|
local_world = cfg.LoadWorld();
|
||||||
|
|
||||||
this.physManager = new PhysicsSystem.PhysicsManager();
|
this.physManager = new PhysicsSystem.PhysicsManager();
|
||||||
this.physManager.LoadPlugins();
|
this.physManager.LoadPlugins();
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system");
|
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system");
|
||||||
local_world.PhysScene = this.physManager.GetPhysicsScene("PhysX"); //should be reading from the config file what physics engine to use
|
local_world.PhysScene = this.physManager.GetPhysicsScene("PhysX"); //should be reading from the config file what physics engine to use
|
||||||
local_world.PhysScene.SetTerrain(local_world.LandMap);
|
local_world.PhysScene.SetTerrain(local_world.LandMap);
|
||||||
OpenSim_Main.gridServers.AssetServer.SetServerInfo(OpenSim_Main.cfg.AssetURL, OpenSim_Main.cfg.AssetSendKey);
|
OpenSim_Main.gridServers.AssetServer.SetServerInfo(OpenSim_Main.cfg.AssetURL, OpenSim_Main.cfg.AssetSendKey);
|
||||||
OpenSim_Main.gridServers.GridServer.SetServerInfo(OpenSim_Main.cfg.GridURL, OpenSim_Main.cfg.GridSendKey);
|
OpenSim_Main.gridServers.GridServer.SetServerInfo(OpenSim_Main.cfg.GridURL, OpenSim_Main.cfg.GridSendKey);
|
||||||
|
|
||||||
MainServerListener();
|
MainServerListener();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private SimConfig LoadConfigDll(string dllName)
|
private SimConfig LoadConfigDll(string dllName)
|
||||||
{
|
{
|
||||||
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
||||||
SimConfig config = null;
|
SimConfig config = null;
|
||||||
|
|
||||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||||
{
|
{
|
||||||
if (pluginType.IsPublic)
|
if (pluginType.IsPublic)
|
||||||
{
|
{
|
||||||
if (!pluginType.IsAbstract)
|
if (!pluginType.IsAbstract)
|
||||||
{
|
{
|
||||||
Type typeInterface = pluginType.GetInterface("ISimConfig", true);
|
Type typeInterface = pluginType.GetInterface("ISimConfig", true);
|
||||||
|
|
||||||
|
@ -175,100 +175,99 @@ namespace OpenSim
|
||||||
ISimConfig plug = (ISimConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
ISimConfig plug = (ISimConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||||
config = plug.GetConfigObject();
|
config = plug.GetConfigObject();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
typeInterface = null;
|
typeInterface = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pluginAssembly = null;
|
pluginAssembly = null;
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnReceivedData(IAsyncResult result) {
|
private void OnReceivedData(IAsyncResult result) {
|
||||||
ipeSender = new IPEndPoint(IPAddress.Any, 0);
|
ipeSender = new IPEndPoint(IPAddress.Any, 0);
|
||||||
epSender = (EndPoint)ipeSender;
|
epSender = (EndPoint)ipeSender;
|
||||||
Packet packet = null;
|
Packet packet = null;
|
||||||
int numBytes = Server.EndReceiveFrom(result, ref epSender);
|
int numBytes = Server.EndReceiveFrom(result, ref epSender);
|
||||||
int packetEnd = numBytes - 1;
|
int packetEnd = numBytes - 1;
|
||||||
packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
|
packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
|
||||||
//Console.Error.WriteLine(packet.ToString());
|
|
||||||
|
// This is either a new client or a packet to send to an old one
|
||||||
|
if(ClientThreads.ContainsKey(epSender)) {
|
||||||
|
ClientThreads[epSender].InPacket(packet);
|
||||||
|
} else if( packet.Type == PacketType.UseCircuitCode ) { // new client
|
||||||
|
OpenSimClient newuser = new OpenSimClient(epSender,(UseCircuitCodePacket)packet);
|
||||||
|
ClientThreads.Add(epSender, newuser);
|
||||||
|
} else { // invalid client
|
||||||
|
Console.Error.WriteLine("Main.cs:OnReceivedData() - WARNING: Got a packet from an invalid client - " + epSender.ToString());
|
||||||
|
}
|
||||||
|
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
|
||||||
|
}
|
||||||
|
|
||||||
// This is either a new client or a packet to send to an old one
|
private void MainServerListener() {
|
||||||
if(ClientThreads.ContainsKey(epSender)) {
|
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - New thread started");
|
||||||
ClientThreads[epSender].InPacket(packet);
|
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + cfg.IPListenAddr + ":" + cfg.IPListenPort);
|
||||||
} else if( packet.Type == PacketType.UseCircuitCode ) { // new client
|
|
||||||
OpenSimClient newuser = new OpenSimClient(epSender,(UseCircuitCodePacket)packet);
|
|
||||||
ClientThreads.Add(epSender, newuser);
|
|
||||||
} else { // invalid client
|
|
||||||
Console.Error.WriteLine("Main.cs:OnReceivedData() - WARNING: Got a packet from an invalid client - " + epSender.ToString());
|
|
||||||
}
|
|
||||||
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MainServerListener() {
|
ServerIncoming = new IPEndPoint(IPAddress.Any, cfg.IPListenPort);
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - New thread started");
|
Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + cfg.IPListenAddr + ":" + cfg.IPListenPort);
|
Server.Bind(ServerIncoming);
|
||||||
|
|
||||||
|
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen");
|
||||||
|
|
||||||
ServerIncoming = new IPEndPoint(IPAddress.Any, cfg.IPListenPort);
|
ipeSender = new IPEndPoint(IPAddress.Any, 0);
|
||||||
Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
epSender = (EndPoint) ipeSender;
|
||||||
Server.Bind(ServerIncoming);
|
ReceivedData = new AsyncCallback(this.OnReceivedData);
|
||||||
|
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen");
|
|
||||||
|
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Listening...");
|
||||||
ipeSender = new IPEndPoint(IPAddress.Any, 0);
|
|
||||||
epSender = (EndPoint) ipeSender;
|
}
|
||||||
ReceivedData = new AsyncCallback(this.OnReceivedData);
|
|
||||||
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
|
public static void Shutdown() {
|
||||||
|
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing all threads");
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Listening...");
|
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing listener thread");
|
||||||
|
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing clients");
|
||||||
}
|
// IMPLEMENT THIS
|
||||||
|
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing console and terminating");
|
||||||
public static void Shutdown() {
|
ServerConsole.MainConsole.Instance.Close();
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing all threads");
|
Environment.Exit(0);
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing listener thread");
|
}
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing clients");
|
|
||||||
// IMPLEMENT THIS
|
void Timer1Tick( object sender, System.EventArgs e )
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing console and terminating");
|
{
|
||||||
ServerConsole.MainConsole.Instance.Close();
|
|
||||||
Environment.Exit(0);
|
local_world.Update();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void Timer1Tick( object sender, System.EventArgs e )
|
|
||||||
{
|
public class Grid
|
||||||
Console.WriteLine("UPDATE WORLD!");
|
{
|
||||||
local_world.Update();
|
public IAssetServer AssetServer;
|
||||||
}
|
public IGridServer GridServer;
|
||||||
}
|
public string AssetDll = "";
|
||||||
|
public string GridDll = "";
|
||||||
public class Grid
|
|
||||||
{
|
public Grid()
|
||||||
public IAssetServer AssetServer;
|
{
|
||||||
public IGridServer GridServer;
|
}
|
||||||
public string AssetDll = "";
|
|
||||||
public string GridDll = "";
|
public void LoadPlugins()
|
||||||
|
{
|
||||||
public Grid()
|
this.AssetServer = this.LoadAssetDll(this.AssetDll);
|
||||||
{
|
this.GridServer = this.LoadGridDll(this.GridDll);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadPlugins()
|
private IAssetServer LoadAssetDll(string dllName)
|
||||||
{
|
{
|
||||||
this.AssetServer = this.LoadAssetDll(this.AssetDll);
|
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
||||||
this.GridServer = this.LoadGridDll(this.GridDll);
|
|
||||||
}
|
|
||||||
|
|
||||||
private IAssetServer LoadAssetDll(string dllName)
|
|
||||||
{
|
|
||||||
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
|
||||||
IAssetServer server = null;
|
IAssetServer server = null;
|
||||||
|
|
||||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||||
{
|
{
|
||||||
if (pluginType.IsPublic)
|
if (pluginType.IsPublic)
|
||||||
{
|
{
|
||||||
if (!pluginType.IsAbstract)
|
if (!pluginType.IsAbstract)
|
||||||
{
|
{
|
||||||
Type typeInterface = pluginType.GetInterface("IAssetPlugin", true);
|
Type typeInterface = pluginType.GetInterface("IAssetPlugin", true);
|
||||||
|
|
||||||
|
@ -277,26 +276,26 @@ namespace OpenSim
|
||||||
IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||||
server = plug.GetAssetServer();
|
server = plug.GetAssetServer();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
typeInterface = null;
|
typeInterface = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pluginAssembly = null;
|
pluginAssembly = null;
|
||||||
return server;
|
return server;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IGridServer LoadGridDll(string dllName)
|
private IGridServer LoadGridDll(string dllName)
|
||||||
{
|
{
|
||||||
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
||||||
IGridServer server = null;
|
IGridServer server = null;
|
||||||
|
|
||||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||||
{
|
{
|
||||||
if (pluginType.IsPublic)
|
if (pluginType.IsPublic)
|
||||||
{
|
{
|
||||||
if (!pluginType.IsAbstract)
|
if (!pluginType.IsAbstract)
|
||||||
{
|
{
|
||||||
Type typeInterface = pluginType.GetInterface("IGridPlugin", true);
|
Type typeInterface = pluginType.GetInterface("IGridPlugin", true);
|
||||||
|
|
||||||
|
@ -305,14 +304,14 @@ namespace OpenSim
|
||||||
IGridPlugin plug = (IGridPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
IGridPlugin plug = (IGridPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||||
server = plug.GetGridServer();
|
server = plug.GetGridServer();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
typeInterface = null;
|
typeInterface = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pluginAssembly = null;
|
pluginAssembly = null;
|
||||||
return server;
|
return server;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,6 +91,9 @@ namespace OpenSim
|
||||||
case PacketType.AgentWearablesRequest:
|
case PacketType.AgentWearablesRequest:
|
||||||
ClientAvatar.SendInitialAppearance();
|
ClientAvatar.SendInitialAppearance();
|
||||||
break;
|
break;
|
||||||
|
case PacketType.ObjectAdd:
|
||||||
|
OpenSim_Main.local_world.AddNewPrim((ObjectAddPacket)Pack, this);
|
||||||
|
break;
|
||||||
case PacketType.TransferRequest:
|
case PacketType.TransferRequest:
|
||||||
//Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
|
//Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
|
||||||
TransferRequestPacket transfer = (TransferRequestPacket)Pack;
|
TransferRequestPacket transfer = (TransferRequestPacket)Pack;
|
||||||
|
@ -251,7 +254,7 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("OUT: \n" + Pack.ToString());
|
ServerConsole.MainConsole.Instance.WriteLine("OUT: \n" + Pack.ToString());
|
||||||
|
|
||||||
byte[] ZeroOutBuffer = new byte[4096];
|
byte[] ZeroOutBuffer = new byte[4096];
|
||||||
byte[] sendbuffer;
|
byte[] sendbuffer;
|
||||||
|
|
|
@ -1,21 +1,31 @@
|
||||||
using System;
|
using System.Reflection;
|
||||||
using System.Reflection;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// Information about this assembly is defined by the following
|
||||||
// <autogenerated>
|
// attributes.
|
||||||
// This code was generated by a tool.
|
//
|
||||||
// Mono Runtime Version: 2.0.50727.42
|
// change them to the information which is associated with the assembly
|
||||||
//
|
// you compile.
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
[assembly: AssemblyTitle("RemoteGridServers")]
|
||||||
// </autogenerated>
|
[assembly: AssemblyDescription("")]
|
||||||
// ------------------------------------------------------------------------------
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: ComVisibleAttribute(false)]
|
[assembly: AssemblyProduct("RemoteGridServers")]
|
||||||
[assembly: CLSCompliantAttribute(false)]
|
[assembly: AssemblyCopyright("")]
|
||||||
[assembly: AssemblyVersionAttribute("0.1.*.148")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyTitleAttribute("opensim-remoteservers")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: AssemblyDescriptionAttribute("Connects to remote OGS installation")]
|
|
||||||
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
|
// This sets the default COM visibility of types in the assembly to invisible.
|
||||||
|
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all values by your own or you can build default build and revision
|
||||||
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="libsecondlife">
|
<Reference Include="libsecondlife">
|
||||||
<HintPath>..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath>
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -39,16 +39,16 @@
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="log4net">
|
<Reference Include="libsecondlife">
|
||||||
<HintPath>..\Version0_2_myserver\OpenSim\bin\Debug\log4net.dll</HintPath>
|
<HintPath>..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath>
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Axiom.MathLib">
|
<Reference Include="Axiom.MathLib">
|
||||||
<HintPath>..\Version0_2_myserver\OpenSim\bin\Debug\Axiom.MathLib.dll</HintPath>
|
<HintPath>..\..\..\..\..\Opensim-pluginsystem\bin\Axiom.MathLib.dll</HintPath>
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="libsecondlife">
|
<Reference Include="log4net">
|
||||||
<HintPath>..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath>
|
<HintPath>..\bin\log4net.dll</HintPath>
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -1,21 +1,31 @@
|
||||||
using System;
|
using System.Reflection;
|
||||||
using System.Reflection;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// Information about this assembly is defined by the following
|
||||||
// <autogenerated>
|
// attributes.
|
||||||
// This code was generated by a tool.
|
//
|
||||||
// Mono Runtime Version: 2.0.50727.42
|
// change them to the information which is associated with the assembly
|
||||||
//
|
// you compile.
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
[assembly: AssemblyTitle("ServerConsole")]
|
||||||
// </autogenerated>
|
[assembly: AssemblyDescription("")]
|
||||||
// ------------------------------------------------------------------------------
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: ComVisibleAttribute(false)]
|
[assembly: AssemblyProduct("ServerConsole")]
|
||||||
[assembly: CLSCompliantAttribute(false)]
|
[assembly: AssemblyCopyright("")]
|
||||||
[assembly: AssemblyVersionAttribute("0.1.*.148")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyTitleAttribute("opensim-serverconsole")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: AssemblyDescriptionAttribute("The default server console")]
|
|
||||||
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
|
// This sets the default COM visibility of types in the assembly to invisible.
|
||||||
|
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all values by your own or you can build default build and revision
|
||||||
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
116
src/Util.cs
116
src/Util.cs
|
@ -84,120 +84,4 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class VoipConnectionPacket : Packet
|
|
||||||
{
|
|
||||||
/// <exclude/>
|
|
||||||
// [XmlType("VoipConnection_Serverblock1")]
|
|
||||||
public class ServerBlock
|
|
||||||
{
|
|
||||||
public uint Test1;
|
|
||||||
public uint IP;
|
|
||||||
public ushort Port;
|
|
||||||
private byte[] userName;
|
|
||||||
public byte[] UserName
|
|
||||||
{
|
|
||||||
get { return userName; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == null) { userName = null; return; }
|
|
||||||
if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); }
|
|
||||||
else { userName = new byte[value.Length]; Array.Copy(value, userName, value.Length); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//[XmlIgnore]
|
|
||||||
public int Length
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
int length = 4;
|
|
||||||
if (UserName != null) { length += 1 + UserName.Length; }
|
|
||||||
return length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ServerBlock() { }
|
|
||||||
public ServerBlock(byte[] bytes, ref int i)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Test1 = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
throw new MalformedDataException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ToBytes(byte[] bytes, ref int i)
|
|
||||||
{
|
|
||||||
bytes[i++] = (byte)(Test1 % 256);
|
|
||||||
bytes[i++] = (byte)((Test1 >> 8) % 256);
|
|
||||||
bytes[i++] = (byte)((Test1 >> 16) % 256);
|
|
||||||
bytes[i++] = (byte)((Test1 >> 24) % 256);
|
|
||||||
if(UserName == null) { Console.WriteLine("Warning: UserName is null, in " + this.GetType()); }
|
|
||||||
bytes[i++] = (byte)UserName.Length;
|
|
||||||
Array.Copy(UserName, 0, bytes, i, UserName.Length);
|
|
||||||
i += UserName.Length;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
string output = "-- ServerBlock1 --" + Environment.NewLine;
|
|
||||||
output += "Test1: " + Test1.ToString() + "" + Environment.NewLine;
|
|
||||||
output = output.Trim();
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private Header header;
|
|
||||||
public override Header Header { get { return header; } set { header = value; } }
|
|
||||||
public override PacketType Type { get { return PacketType.TestMessage; } }
|
|
||||||
public ServerBlock ServerBlock1;
|
|
||||||
|
|
||||||
public VoipConnectionPacket()
|
|
||||||
{
|
|
||||||
Header = new LowHeader();
|
|
||||||
Header.ID = 600;
|
|
||||||
Header.Reliable = true;
|
|
||||||
Header.Zerocoded = true;
|
|
||||||
ServerBlock1 = new ServerBlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
public VoipConnectionPacket(byte[] bytes, ref int i)
|
|
||||||
{
|
|
||||||
int packetEnd = bytes.Length - 1;
|
|
||||||
Header = new LowHeader(bytes, ref i, ref packetEnd);
|
|
||||||
ServerBlock1 = new ServerBlock(bytes, ref i);
|
|
||||||
}
|
|
||||||
|
|
||||||
public VoipConnectionPacket(Header head, byte[] bytes, ref int i)
|
|
||||||
{
|
|
||||||
Header = head;
|
|
||||||
ServerBlock1 = new ServerBlock(bytes, ref i);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override byte[] ToBytes()
|
|
||||||
{
|
|
||||||
int length = 8;
|
|
||||||
length += ServerBlock1.Length;;
|
|
||||||
if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }
|
|
||||||
byte[] bytes = new byte[length];
|
|
||||||
int i = 0;
|
|
||||||
header.ToBytes(bytes, ref i);
|
|
||||||
ServerBlock1.ToBytes(bytes, ref i);
|
|
||||||
if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }
|
|
||||||
return bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
string output = "--- VoipConnection ---" + Environment.NewLine;
|
|
||||||
output += ServerBlock1.ToString() + Environment.NewLine;
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,31 @@
|
||||||
using System;
|
using System.Reflection;
|
||||||
using System.Reflection;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// Information about this assembly is defined by the following
|
||||||
// <autogenerated>
|
// attributes.
|
||||||
// This code was generated by a tool.
|
//
|
||||||
// Mono Runtime Version: 2.0.50727.42
|
// change them to the information which is associated with the assembly
|
||||||
//
|
// you compile.
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
[assembly: AssemblyTitle("PhysicsManager")]
|
||||||
// </autogenerated>
|
[assembly: AssemblyDescription("")]
|
||||||
// ------------------------------------------------------------------------------
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: ComVisibleAttribute(false)]
|
[assembly: AssemblyProduct("PhysicsManager")]
|
||||||
[assembly: CLSCompliantAttribute(false)]
|
[assembly: AssemblyCopyright("")]
|
||||||
[assembly: AssemblyVersionAttribute("0.1.*.148")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyTitleAttribute("opensim-physicsmanager")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: AssemblyDescriptionAttribute("Handles physics plugins")]
|
|
||||||
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
|
// This sets the default COM visibility of types in the assembly to invisible.
|
||||||
|
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all values by your own or you can build default build and revision
|
||||||
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
|
@ -1,21 +1,31 @@
|
||||||
using System;
|
using System.Reflection;
|
||||||
using System.Reflection;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// Information about this assembly is defined by the following
|
||||||
// <autogenerated>
|
// attributes.
|
||||||
// This code was generated by a tool.
|
//
|
||||||
// Mono Runtime Version: 2.0.50727.42
|
// change them to the information which is associated with the assembly
|
||||||
//
|
// you compile.
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
[assembly: AssemblyTitle("PhysXplugin")]
|
||||||
// </autogenerated>
|
[assembly: AssemblyDescription("")]
|
||||||
// ------------------------------------------------------------------------------
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: ComVisibleAttribute(false)]
|
[assembly: AssemblyProduct("PhysXplugin")]
|
||||||
[assembly: CLSCompliantAttribute(false)]
|
[assembly: AssemblyCopyright("")]
|
||||||
[assembly: AssemblyVersionAttribute("0.1.*.148")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyTitleAttribute("opensim-physicsmanager-physx")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: AssemblyDescriptionAttribute("PhysX plugin for OpenSim")]
|
|
||||||
[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
|
// This sets the default COM visibility of types in the assembly to invisible.
|
||||||
|
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all values by your own or you can build default build and revision
|
||||||
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
|
@ -87,10 +87,8 @@ namespace PhysXplugin
|
||||||
|
|
||||||
public override void Simulate(float timeStep)
|
public override void Simulate(float timeStep)
|
||||||
{
|
{
|
||||||
Console.WriteLine("SIMULATE!");
|
|
||||||
foreach (PhysXActor actor in _actors)
|
foreach (PhysXActor actor in _actors)
|
||||||
{
|
{
|
||||||
Console.WriteLine("AN ACTOR!");
|
|
||||||
actor.Position.X = actor.Position.X + actor.Velocity.X * timeStep;
|
actor.Position.X = actor.Position.X + actor.Velocity.X * timeStep;
|
||||||
actor.Position.Y = actor.Position.Y + actor.Velocity.Y * timeStep;
|
actor.Position.Y = actor.Position.Y + actor.Velocity.Y * timeStep;
|
||||||
actor.Position.Z = actor.Position.Z + actor.Velocity.Z * timeStep;
|
actor.Position.Z = actor.Position.Z + actor.Velocity.Z * timeStep;
|
||||||
|
@ -120,7 +118,7 @@ namespace PhysXplugin
|
||||||
|
|
||||||
public override void GetResults()
|
public override void GetResults()
|
||||||
{
|
{
|
||||||
Console.WriteLine("GET RESULTS!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsThreaded
|
public override bool IsThreaded
|
||||||
|
|
|
@ -26,6 +26,7 @@ namespace OpenSim.world
|
||||||
ControllingClient=TheClient;
|
ControllingClient=TheClient;
|
||||||
SetupTemplate("avatar-template.dat");
|
SetupTemplate("avatar-template.dat");
|
||||||
position = new LLVector3(100.0f,100.0f,30.0f);
|
position = new LLVector3(100.0f,100.0f,30.0f);
|
||||||
|
position.Z = OpenSim_Main.local_world.LandMap[(int)position.Y * 256 + (int)position.X]+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PhysicsActor PhysActor
|
public PhysicsActor PhysActor
|
||||||
|
@ -43,7 +44,6 @@ namespace OpenSim.world
|
||||||
{
|
{
|
||||||
for(int i=0 ; i < this.forcesList.Count; i++)
|
for(int i=0 ; i < this.forcesList.Count; i++)
|
||||||
{
|
{
|
||||||
Console.WriteLine("ADDING A FORCE!");
|
|
||||||
NewForce force = this.forcesList[i];
|
NewForce force = this.forcesList[i];
|
||||||
PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z);
|
PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z);
|
||||||
this._physActor.Velocity = phyVector;
|
this._physActor.Velocity = phyVector;
|
||||||
|
@ -61,8 +61,8 @@ namespace OpenSim.world
|
||||||
|
|
||||||
public override void update()
|
public override void update()
|
||||||
{
|
{
|
||||||
Console.WriteLine("UPDATING AVATAR!");
|
|
||||||
if(this.updateflag)
|
if(this.updateflag)
|
||||||
{
|
{
|
||||||
//need to send movement info
|
//need to send movement info
|
||||||
//so create the improvedterseobjectupdate packet
|
//so create the improvedterseobjectupdate packet
|
||||||
|
@ -74,28 +74,31 @@ namespace OpenSim.world
|
||||||
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
terse.ObjectData[0] = terseBlock;
|
terse.ObjectData[0] = terseBlock;
|
||||||
foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
|
foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
|
||||||
client.OutPacket(terse);
|
client.OutPacket(terse);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateflag =false;
|
updateflag =false;
|
||||||
this._updateCount = 0;
|
this._updateCount = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_updateCount++;
|
if(walking)
|
||||||
if(_updateCount>5)
|
|
||||||
{
|
{
|
||||||
//It has been a while since last update was sent so lets send one.
|
_updateCount++;
|
||||||
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
|
if(_updateCount>3)
|
||||||
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
{
|
||||||
terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME
|
//It has been a while since last update was sent so lets send one.
|
||||||
terse.RegionData.TimeDilation = 64096;
|
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
|
||||||
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
||||||
terse.ObjectData[0] = terseBlock;
|
terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME
|
||||||
foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
|
terse.RegionData.TimeDilation = 64096;
|
||||||
client.OutPacket(terse);
|
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
|
terse.ObjectData[0] = terseBlock;
|
||||||
|
foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
|
||||||
|
client.OutPacket(terse);
|
||||||
|
}
|
||||||
|
_updateCount = 0;
|
||||||
}
|
}
|
||||||
_updateCount = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@ namespace OpenSim.world
|
||||||
{
|
{
|
||||||
public class Entity
|
public class Entity
|
||||||
{
|
{
|
||||||
protected libsecondlife.LLUUID uuid;
|
public libsecondlife.LLUUID uuid;
|
||||||
protected uint localid;
|
public uint localid;
|
||||||
public LLVector3 position;
|
public LLVector3 position;
|
||||||
public LLVector3 velocity;
|
public LLVector3 velocity;
|
||||||
public Quaternion rotation;
|
public Quaternion rotation;
|
||||||
|
|
|
@ -2,6 +2,8 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using OpenSim.types;
|
using OpenSim.types;
|
||||||
|
using libsecondlife;
|
||||||
|
using libsecondlife.Packets;
|
||||||
|
|
||||||
namespace OpenSim.world
|
namespace OpenSim.world
|
||||||
{
|
{
|
||||||
|
@ -9,6 +11,9 @@ namespace OpenSim.world
|
||||||
{
|
{
|
||||||
protected float mesh_cutbegin;
|
protected float mesh_cutbegin;
|
||||||
protected float mesh_cutend;
|
protected float mesh_cutend;
|
||||||
|
protected PrimData primData;
|
||||||
|
protected bool newPrimFlag;
|
||||||
|
protected ObjectUpdatePacket OurPacket;
|
||||||
|
|
||||||
public Primitive()
|
public Primitive()
|
||||||
{
|
{
|
||||||
|
@ -29,5 +34,103 @@ namespace OpenSim.world
|
||||||
|
|
||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void update()
|
||||||
|
{
|
||||||
|
if(this.newPrimFlag)
|
||||||
|
{
|
||||||
|
foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
|
||||||
|
client.OutPacket(OurPacket);
|
||||||
|
}
|
||||||
|
this.newPrimFlag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateFromPacket( ObjectAddPacket addPacket, LLUUID agentID, uint localID)
|
||||||
|
{
|
||||||
|
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
||||||
|
objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle;
|
||||||
|
objupdate.RegionData.TimeDilation = 64096;
|
||||||
|
|
||||||
|
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
|
PrimData PData = new PrimData();
|
||||||
|
this.primData = PData;
|
||||||
|
objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock();//OpenSim_Main.local_world.PrimTemplate;
|
||||||
|
objupdate.ObjectData[0].PSBlock = new byte[0];
|
||||||
|
objupdate.ObjectData[0].ExtraParams = new byte[1];
|
||||||
|
objupdate.ObjectData[0].MediaURL = new byte[0];
|
||||||
|
objupdate.ObjectData[0].NameValue = new byte[0];
|
||||||
|
objupdate.ObjectData[0].PSBlock = new byte[0];
|
||||||
|
objupdate.ObjectData[0].Text = new byte[0];
|
||||||
|
objupdate.ObjectData[0].TextColor = new byte[4];
|
||||||
|
objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0,0,0);
|
||||||
|
objupdate.ObjectData[0].JointPivot = new LLVector3(0,0,0);
|
||||||
|
objupdate.ObjectData[0].Material = 3;
|
||||||
|
objupdate.ObjectData[0].TextureAnim = new byte[0];
|
||||||
|
objupdate.ObjectData[0].Sound = LLUUID.Zero;
|
||||||
|
LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
|
||||||
|
objupdate.ObjectData[0].TextureEntry = ntex.ToBytes();
|
||||||
|
objupdate.ObjectData[0].State = 0;
|
||||||
|
objupdate.ObjectData[0].Data = new byte[0];
|
||||||
|
PData.OwnerID = objupdate.ObjectData[0].OwnerID = agentID;
|
||||||
|
PData.PCode = objupdate.ObjectData[0].PCode = addPacket.ObjectData.PCode;
|
||||||
|
PData.PathBegin = objupdate.ObjectData[0].PathBegin = addPacket.ObjectData.PathBegin;
|
||||||
|
PData.PathEnd = objupdate.ObjectData[0].PathEnd = addPacket.ObjectData.PathEnd;
|
||||||
|
PData.PathScaleX = objupdate.ObjectData[0].PathScaleX = addPacket.ObjectData.PathScaleX;
|
||||||
|
PData.PathScaleY = objupdate.ObjectData[0].PathScaleY = addPacket.ObjectData.PathScaleY;
|
||||||
|
PData.PathShearX = objupdate.ObjectData[0].PathShearX = addPacket.ObjectData.PathShearX;
|
||||||
|
PData.PathShearY = objupdate.ObjectData[0].PathShearY = addPacket.ObjectData.PathShearY;
|
||||||
|
PData.PathSkew = objupdate.ObjectData[0].PathSkew = addPacket.ObjectData.PathSkew;
|
||||||
|
PData.ProfileBegin = objupdate.ObjectData[0].ProfileBegin = addPacket.ObjectData.ProfileBegin;
|
||||||
|
PData.ProfileEnd = objupdate.ObjectData[0].ProfileEnd = addPacket.ObjectData.ProfileEnd;
|
||||||
|
PData.Scale = objupdate.ObjectData[0].Scale = addPacket.ObjectData.Scale;
|
||||||
|
PData.PathCurve = objupdate.ObjectData[0].PathCurve = addPacket.ObjectData.PathCurve;
|
||||||
|
PData.ProfileCurve = objupdate.ObjectData[0].ProfileCurve = addPacket.ObjectData.ProfileCurve;
|
||||||
|
PData.ParentID = objupdate.ObjectData[0].ParentID = 0;
|
||||||
|
PData.ProfileHollow = objupdate.ObjectData[0].ProfileHollow = addPacket.ObjectData.ProfileHollow;
|
||||||
|
//finish off copying rest of shape data
|
||||||
|
|
||||||
|
objupdate.ObjectData[0].ID = (uint)(localID);
|
||||||
|
objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efefda" + (localID- 702000).ToString("000"));
|
||||||
|
|
||||||
|
objupdate.ObjectData[0].ObjectData = new byte[60];
|
||||||
|
objupdate.ObjectData[0].ObjectData[46] = 128;
|
||||||
|
objupdate.ObjectData[0].ObjectData[47] = 63;
|
||||||
|
LLVector3 pos1= addPacket.ObjectData.RayEnd;
|
||||||
|
//update position
|
||||||
|
byte[] pb = pos1.GetBytes();
|
||||||
|
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length);
|
||||||
|
|
||||||
|
this.newPrimFlag = true;
|
||||||
|
this.uuid = objupdate.ObjectData[0].FullID;
|
||||||
|
this.localid = objupdate.ObjectData[0].ID;
|
||||||
|
this.position = pos1;
|
||||||
|
this.OurPacket = objupdate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PrimData
|
||||||
|
{
|
||||||
|
public LLUUID OwnerID;
|
||||||
|
public byte PCode;
|
||||||
|
public byte PathBegin;
|
||||||
|
public byte PathEnd;
|
||||||
|
public byte PathScaleX;
|
||||||
|
public byte PathScaleY;
|
||||||
|
public byte PathShearX;
|
||||||
|
public byte PathShearY;
|
||||||
|
public sbyte PathSkew;
|
||||||
|
public byte ProfileBegin;
|
||||||
|
public byte ProfileEnd;
|
||||||
|
public LLVector3 Scale;
|
||||||
|
public byte PathCurve;
|
||||||
|
public byte ProfileCurve;
|
||||||
|
public uint ParentID=0;
|
||||||
|
public byte ProfileHollow;
|
||||||
|
|
||||||
|
public PrimData()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ namespace OpenSim.world
|
||||||
private libsecondlife.TerrainManager TerrainManager;
|
private libsecondlife.TerrainManager TerrainManager;
|
||||||
|
|
||||||
private Random Rand = new Random();
|
private Random Rand = new Random();
|
||||||
|
private uint _primCount = 702000;
|
||||||
|
|
||||||
public World()
|
public World()
|
||||||
{
|
{
|
||||||
|
@ -95,11 +96,22 @@ namespace OpenSim.world
|
||||||
//this.Update(); // will work for now, but needs to be optimised so we don't update everything in the sim for each new user
|
//this.Update(); // will work for now, but needs to be optimised so we don't update everything in the sim for each new user
|
||||||
this.Entities.Add(AgentClient.AgentID, NewAvatar);
|
this.Entities.Add(AgentClient.AgentID, NewAvatar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddNewPrim(ObjectAddPacket addPacket, OpenSimClient AgentClient)
|
||||||
|
{
|
||||||
|
ServerConsole.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim");
|
||||||
|
Primitive prim = new Primitive();
|
||||||
|
prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount);
|
||||||
|
this.Entities.Add(prim.uuid, prim);
|
||||||
|
this._primCount++;
|
||||||
|
}
|
||||||
|
|
||||||
public bool Backup() {
|
public bool Backup() {
|
||||||
/* TODO: Save the current world entities state. */
|
/* TODO: Save the current world entities state. */
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue