From 2159b3079ec8df2a7337a9d4ea54810b7028c4e1 Mon Sep 17 00:00:00 2001 From: gareth Date: Wed, 7 Mar 2007 19:07:00 +0000 Subject: fixed last screwup --- ConvertToPlugins/bin/Axiom.MathLib.dll | Bin 69632 -> 0 bytes ConvertToPlugins/bin/Db4objects.Db4o.dll | Bin 593408 -> 0 bytes ConvertToPlugins/bin/avatar-template.dat | Bin 552 -> 0 bytes ConvertToPlugins/bin/libsecondlife.dll | Bin 2338816 -> 0 bytes ConvertToPlugins/bin/log4net.dll | Bin 270336 -> 0 bytes ConvertToPlugins/bin/new-login.dat | 1 - ConvertToPlugins/genvers.sh | 9 - ConvertToPlugins/opensim.build | 80 ---- ConvertToPlugins/src/Assets/AssetCache.cs | 436 --------------------- ConvertToPlugins/src/Config.cs | 72 ---- .../src/Config/SimConfig/AssemblyInfo.cs | 31 -- .../src/Config/SimConfig/Db4SimConfig.cs | 146 ------- .../src/Config/SimConfig/SimConfig.csproj | 49 --- .../src/Config/SimConfig/SimConfig.sln | 7 - ConvertToPlugins/src/Config/default.build | 52 --- .../src/GridInterfaces/AssemblyInfo.cs | 31 -- .../src/GridInterfaces/GridInterfaces.csproj | 40 -- .../src/GridInterfaces/GridInterfaces.sln | 17 - .../src/GridInterfaces/IAssetServer.cs | 82 ---- ConvertToPlugins/src/GridInterfaces/IGridServer.cs | 94 ----- ConvertToPlugins/src/GridInterfaces/default.build | 49 --- ConvertToPlugins/src/GridServers/LoginServer.cs | 322 --------------- ConvertToPlugins/src/HeightMapGenHills.cs | 149 ------- .../LocalServers/LocalGridServers/AssemblyInfo.cs | 31 -- .../src/LocalServers/LocalGridServers/LocalGrid.cs | 205 ---------- .../LocalGridServers/LocalGridServers.csproj | 49 --- .../LocalGridServers/LocalGridServers.sln | 7 - ConvertToPlugins/src/LocalServers/default.build | 51 --- ConvertToPlugins/src/Main.cs | 317 --------------- ConvertToPlugins/src/OpenSimClient.cs | 387 ------------------ ConvertToPlugins/src/OpenSimConsole.cs | 194 --------- .../RemoteGridServers/AssemblyInfo.cs | 31 -- .../RemoteServers/RemoteGridServers/RemoteGrid.cs | 241 ------------ .../RemoteGridServers/RemoteGridServers.csproj | 49 --- .../RemoteGridServers/RemoteGridServers.sln | 7 - ConvertToPlugins/src/RemoteServers/default.build | 51 --- ConvertToPlugins/src/Second-server.csproj | 92 ----- ConvertToPlugins/src/Second-server.sln | 96 ----- .../ServerConsole/ServerConsole/AssemblyInfo.cs | 31 -- .../ServerConsole/ServerConsole/ServerConsole.cs | 91 ----- .../ServerConsole/ServerConsole.csproj | 35 -- .../ServerConsole/ServerConsole/ServerConsole.sln | 7 - ConvertToPlugins/src/ServerConsole/default.build | 48 --- ConvertToPlugins/src/Util.cs | 87 ---- ConvertToPlugins/src/VersionInfo.cs | 37 -- ConvertToPlugins/src/VersionInfo.cs.template | 37 -- ConvertToPlugins/src/physics/AssemblyInfo.cs | 31 -- ConvertToPlugins/src/physics/PhysicsManager.cs | 167 -------- ConvertToPlugins/src/physics/PhysicsManager.csproj | 41 -- ConvertToPlugins/src/physics/PhysicsManager.sln | 23 -- ConvertToPlugins/src/physics/default.build | 49 --- .../src/physics/plugins/AssemblyInfo.cs | 31 -- .../src/physics/plugins/PhysXplugin.cs | 199 ---------- .../src/physics/plugins/PhysXplugin.csproj | 41 -- .../src/physics/plugins/PhysXplugin.sln | 17 - ConvertToPlugins/src/physics/plugins/default.build | 49 --- ConvertToPlugins/src/types/Mesh.cs | 28 -- ConvertToPlugins/src/types/Triangle.cs | 28 -- ConvertToPlugins/src/world/Avatar.cs | 355 ----------------- ConvertToPlugins/src/world/Entity.cs | 62 --- ConvertToPlugins/src/world/Primitive.cs | 136 ------- ConvertToPlugins/src/world/ScriptEngine.cs | 18 - ConvertToPlugins/src/world/SurfacePatch.cs | 22 -- ConvertToPlugins/src/world/World.cs | 117 ------ ConvertToPlugins/src/world/scripting/IScript.cs | 16 - bin/Axiom.MathLib.dll | Bin 0 -> 69632 bytes bin/Db4objects.Db4o.dll | Bin 0 -> 593408 bytes bin/avatar-template.dat | Bin 0 -> 552 bytes bin/libsecondlife.dll | Bin 0 -> 2338816 bytes bin/log4net.dll | Bin 0 -> 270336 bytes bin/new-login.dat | 1 + genvers.sh | 9 + opensim.build | 80 ++++ src/Assets/AssetCache.cs | 436 +++++++++++++++++++++ src/Config.cs | 72 ++++ src/Config/SimConfig/AssemblyInfo.cs | 31 ++ src/Config/SimConfig/Db4SimConfig.cs | 146 +++++++ src/Config/SimConfig/SimConfig.csproj | 49 +++ src/Config/SimConfig/SimConfig.sln | 7 + src/Config/default.build | 52 +++ src/GridInterfaces/AssemblyInfo.cs | 31 ++ src/GridInterfaces/GridInterfaces.csproj | 40 ++ src/GridInterfaces/GridInterfaces.sln | 17 + src/GridInterfaces/IAssetServer.cs | 82 ++++ src/GridInterfaces/IGridServer.cs | 94 +++++ src/GridInterfaces/default.build | 49 +++ src/GridServers/LoginServer.cs | 322 +++++++++++++++ src/HeightMapGenHills.cs | 149 +++++++ src/LocalServers/LocalGridServers/AssemblyInfo.cs | 31 ++ src/LocalServers/LocalGridServers/LocalGrid.cs | 205 ++++++++++ .../LocalGridServers/LocalGridServers.csproj | 49 +++ .../LocalGridServers/LocalGridServers.sln | 7 + src/LocalServers/default.build | 51 +++ src/Main.cs | 317 +++++++++++++++ src/OpenSimClient.cs | 387 ++++++++++++++++++ src/OpenSimConsole.cs | 194 +++++++++ .../RemoteGridServers/AssemblyInfo.cs | 31 ++ src/RemoteServers/RemoteGridServers/RemoteGrid.cs | 241 ++++++++++++ .../RemoteGridServers/RemoteGridServers.csproj | 49 +++ .../RemoteGridServers/RemoteGridServers.sln | 7 + src/RemoteServers/default.build | 51 +++ src/Second-server.csproj | 92 +++++ src/Second-server.sln | 96 +++++ src/ServerConsole/ServerConsole/AssemblyInfo.cs | 31 ++ src/ServerConsole/ServerConsole/ServerConsole.cs | 91 +++++ .../ServerConsole/ServerConsole.csproj | 35 ++ src/ServerConsole/ServerConsole/ServerConsole.sln | 7 + src/ServerConsole/default.build | 48 +++ src/Util.cs | 87 ++++ src/VersionInfo.cs | 37 ++ src/VersionInfo.cs.template | 37 ++ src/physics/AssemblyInfo.cs | 31 ++ src/physics/PhysicsManager.cs | 167 ++++++++ src/physics/PhysicsManager.csproj | 41 ++ src/physics/PhysicsManager.sln | 23 ++ src/physics/default.build | 49 +++ src/physics/plugins/AssemblyInfo.cs | 31 ++ src/physics/plugins/PhysXplugin.cs | 199 ++++++++++ src/physics/plugins/PhysXplugin.csproj | 41 ++ src/physics/plugins/PhysXplugin.sln | 17 + src/physics/plugins/default.build | 49 +++ src/types/Mesh.cs | 28 ++ src/types/Triangle.cs | 28 ++ src/world/Avatar.cs | 355 +++++++++++++++++ src/world/Entity.cs | 62 +++ src/world/Primitive.cs | 136 +++++++ src/world/ScriptEngine.cs | 18 + src/world/SurfacePatch.cs | 22 ++ src/world/World.cs | 117 ++++++ src/world/scripting/IScript.cs | 16 + 130 files changed, 5278 insertions(+), 5278 deletions(-) delete mode 100644 ConvertToPlugins/bin/Axiom.MathLib.dll delete mode 100755 ConvertToPlugins/bin/Db4objects.Db4o.dll delete mode 100644 ConvertToPlugins/bin/avatar-template.dat delete mode 100755 ConvertToPlugins/bin/libsecondlife.dll delete mode 100644 ConvertToPlugins/bin/log4net.dll delete mode 100644 ConvertToPlugins/bin/new-login.dat delete mode 100755 ConvertToPlugins/genvers.sh delete mode 100644 ConvertToPlugins/opensim.build delete mode 100644 ConvertToPlugins/src/Assets/AssetCache.cs delete mode 100644 ConvertToPlugins/src/Config.cs delete mode 100644 ConvertToPlugins/src/Config/SimConfig/AssemblyInfo.cs delete mode 100644 ConvertToPlugins/src/Config/SimConfig/Db4SimConfig.cs delete mode 100644 ConvertToPlugins/src/Config/SimConfig/SimConfig.csproj delete mode 100644 ConvertToPlugins/src/Config/SimConfig/SimConfig.sln delete mode 100644 ConvertToPlugins/src/Config/default.build delete mode 100644 ConvertToPlugins/src/GridInterfaces/AssemblyInfo.cs delete mode 100644 ConvertToPlugins/src/GridInterfaces/GridInterfaces.csproj delete mode 100644 ConvertToPlugins/src/GridInterfaces/GridInterfaces.sln delete mode 100644 ConvertToPlugins/src/GridInterfaces/IAssetServer.cs delete mode 100644 ConvertToPlugins/src/GridInterfaces/IGridServer.cs delete mode 100644 ConvertToPlugins/src/GridInterfaces/default.build delete mode 100644 ConvertToPlugins/src/GridServers/LoginServer.cs delete mode 100644 ConvertToPlugins/src/HeightMapGenHills.cs delete mode 100644 ConvertToPlugins/src/LocalServers/LocalGridServers/AssemblyInfo.cs delete mode 100644 ConvertToPlugins/src/LocalServers/LocalGridServers/LocalGrid.cs delete mode 100644 ConvertToPlugins/src/LocalServers/LocalGridServers/LocalGridServers.csproj delete mode 100644 ConvertToPlugins/src/LocalServers/LocalGridServers/LocalGridServers.sln delete mode 100644 ConvertToPlugins/src/LocalServers/default.build delete mode 100644 ConvertToPlugins/src/Main.cs delete mode 100644 ConvertToPlugins/src/OpenSimClient.cs delete mode 100644 ConvertToPlugins/src/OpenSimConsole.cs delete mode 100644 ConvertToPlugins/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs delete mode 100644 ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGrid.cs delete mode 100644 ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj delete mode 100644 ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGridServers.sln delete mode 100644 ConvertToPlugins/src/RemoteServers/default.build delete mode 100644 ConvertToPlugins/src/Second-server.csproj delete mode 100644 ConvertToPlugins/src/Second-server.sln delete mode 100644 ConvertToPlugins/src/ServerConsole/ServerConsole/AssemblyInfo.cs delete mode 100644 ConvertToPlugins/src/ServerConsole/ServerConsole/ServerConsole.cs delete mode 100644 ConvertToPlugins/src/ServerConsole/ServerConsole/ServerConsole.csproj delete mode 100644 ConvertToPlugins/src/ServerConsole/ServerConsole/ServerConsole.sln delete mode 100644 ConvertToPlugins/src/ServerConsole/default.build delete mode 100644 ConvertToPlugins/src/Util.cs delete mode 100644 ConvertToPlugins/src/VersionInfo.cs delete mode 100644 ConvertToPlugins/src/VersionInfo.cs.template delete mode 100644 ConvertToPlugins/src/physics/AssemblyInfo.cs delete mode 100644 ConvertToPlugins/src/physics/PhysicsManager.cs delete mode 100644 ConvertToPlugins/src/physics/PhysicsManager.csproj delete mode 100644 ConvertToPlugins/src/physics/PhysicsManager.sln delete mode 100644 ConvertToPlugins/src/physics/default.build delete mode 100644 ConvertToPlugins/src/physics/plugins/AssemblyInfo.cs delete mode 100644 ConvertToPlugins/src/physics/plugins/PhysXplugin.cs delete mode 100644 ConvertToPlugins/src/physics/plugins/PhysXplugin.csproj delete mode 100644 ConvertToPlugins/src/physics/plugins/PhysXplugin.sln delete mode 100644 ConvertToPlugins/src/physics/plugins/default.build delete mode 100644 ConvertToPlugins/src/types/Mesh.cs delete mode 100644 ConvertToPlugins/src/types/Triangle.cs delete mode 100644 ConvertToPlugins/src/world/Avatar.cs delete mode 100644 ConvertToPlugins/src/world/Entity.cs delete mode 100644 ConvertToPlugins/src/world/Primitive.cs delete mode 100644 ConvertToPlugins/src/world/ScriptEngine.cs delete mode 100644 ConvertToPlugins/src/world/SurfacePatch.cs delete mode 100644 ConvertToPlugins/src/world/World.cs delete mode 100644 ConvertToPlugins/src/world/scripting/IScript.cs create mode 100644 bin/Axiom.MathLib.dll create mode 100755 bin/Db4objects.Db4o.dll create mode 100644 bin/avatar-template.dat create mode 100755 bin/libsecondlife.dll create mode 100644 bin/log4net.dll create mode 100644 bin/new-login.dat create mode 100755 genvers.sh create mode 100644 opensim.build create mode 100644 src/Assets/AssetCache.cs create mode 100644 src/Config.cs create mode 100644 src/Config/SimConfig/AssemblyInfo.cs create mode 100644 src/Config/SimConfig/Db4SimConfig.cs create mode 100644 src/Config/SimConfig/SimConfig.csproj create mode 100644 src/Config/SimConfig/SimConfig.sln create mode 100644 src/Config/default.build create mode 100644 src/GridInterfaces/AssemblyInfo.cs create mode 100644 src/GridInterfaces/GridInterfaces.csproj create mode 100644 src/GridInterfaces/GridInterfaces.sln create mode 100644 src/GridInterfaces/IAssetServer.cs create mode 100644 src/GridInterfaces/IGridServer.cs create mode 100644 src/GridInterfaces/default.build create mode 100644 src/GridServers/LoginServer.cs create mode 100644 src/HeightMapGenHills.cs create mode 100644 src/LocalServers/LocalGridServers/AssemblyInfo.cs create mode 100644 src/LocalServers/LocalGridServers/LocalGrid.cs create mode 100644 src/LocalServers/LocalGridServers/LocalGridServers.csproj create mode 100644 src/LocalServers/LocalGridServers/LocalGridServers.sln create mode 100644 src/LocalServers/default.build create mode 100644 src/Main.cs create mode 100644 src/OpenSimClient.cs create mode 100644 src/OpenSimConsole.cs create mode 100644 src/RemoteServers/RemoteGridServers/AssemblyInfo.cs create mode 100644 src/RemoteServers/RemoteGridServers/RemoteGrid.cs create mode 100644 src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj create mode 100644 src/RemoteServers/RemoteGridServers/RemoteGridServers.sln create mode 100644 src/RemoteServers/default.build create mode 100644 src/Second-server.csproj create mode 100644 src/Second-server.sln create mode 100644 src/ServerConsole/ServerConsole/AssemblyInfo.cs create mode 100644 src/ServerConsole/ServerConsole/ServerConsole.cs create mode 100644 src/ServerConsole/ServerConsole/ServerConsole.csproj create mode 100644 src/ServerConsole/ServerConsole/ServerConsole.sln create mode 100644 src/ServerConsole/default.build create mode 100644 src/Util.cs create mode 100644 src/VersionInfo.cs create mode 100644 src/VersionInfo.cs.template create mode 100644 src/physics/AssemblyInfo.cs create mode 100644 src/physics/PhysicsManager.cs create mode 100644 src/physics/PhysicsManager.csproj create mode 100644 src/physics/PhysicsManager.sln create mode 100644 src/physics/default.build create mode 100644 src/physics/plugins/AssemblyInfo.cs create mode 100644 src/physics/plugins/PhysXplugin.cs create mode 100644 src/physics/plugins/PhysXplugin.csproj create mode 100644 src/physics/plugins/PhysXplugin.sln create mode 100644 src/physics/plugins/default.build create mode 100644 src/types/Mesh.cs create mode 100644 src/types/Triangle.cs create mode 100644 src/world/Avatar.cs create mode 100644 src/world/Entity.cs create mode 100644 src/world/Primitive.cs create mode 100644 src/world/ScriptEngine.cs create mode 100644 src/world/SurfacePatch.cs create mode 100644 src/world/World.cs create mode 100644 src/world/scripting/IScript.cs diff --git a/ConvertToPlugins/bin/Axiom.MathLib.dll b/ConvertToPlugins/bin/Axiom.MathLib.dll deleted file mode 100644 index 21ce3a8..0000000 Binary files a/ConvertToPlugins/bin/Axiom.MathLib.dll and /dev/null differ diff --git a/ConvertToPlugins/bin/Db4objects.Db4o.dll b/ConvertToPlugins/bin/Db4objects.Db4o.dll deleted file mode 100755 index be976a1..0000000 Binary files a/ConvertToPlugins/bin/Db4objects.Db4o.dll and /dev/null differ diff --git a/ConvertToPlugins/bin/avatar-template.dat b/ConvertToPlugins/bin/avatar-template.dat deleted file mode 100644 index c13c2c7..0000000 Binary files a/ConvertToPlugins/bin/avatar-template.dat and /dev/null differ diff --git a/ConvertToPlugins/bin/libsecondlife.dll b/ConvertToPlugins/bin/libsecondlife.dll deleted file mode 100755 index 89d692a..0000000 Binary files a/ConvertToPlugins/bin/libsecondlife.dll and /dev/null differ diff --git a/ConvertToPlugins/bin/log4net.dll b/ConvertToPlugins/bin/log4net.dll deleted file mode 100644 index ffc57e1..0000000 Binary files a/ConvertToPlugins/bin/log4net.dll and /dev/null differ diff --git a/ConvertToPlugins/bin/new-login.dat b/ConvertToPlugins/bin/new-login.dat deleted file mode 100644 index 3c91151..0000000 --- a/ConvertToPlugins/bin/new-login.dat +++ /dev/null @@ -1 +0,0 @@ -messageWelcome to OpenSimsession_id99998888-8520-4f52-8ec1-0b1d5cd6aeadinventory-skel-libsim_port50000agent_accessMevent_notificationsstart_locationlastglobal-texturessun_texture_idcce0f112-878f-4586-a2e2-a8f104bba271cloud_texture_idfc4b9f0b-d008-45c6-96a4-01dd947ac621moon_texture_idd07f6eed-b96a-47cd-b51d-400ad4a1c428seconds_since_epoch1169908672first_name"Test"circuit_code50633318event_categorieslogin-flagsstipend_since_loginNever_logged_inYgenderedYdaylight_savingsNseed_capabilityhome{'region_handle':[r258560, r259840], 'position':[r41.6589, r100.8374, r22.5072], 'look_at':[r-0.57343, r-0.819255,r0]}secure_session_id71810f75-7437-49fb-8963-02b8fd1b95bflast_nameUserui-configallow_first_lifeYclassified_categoriescategory_nameShoppingcategory_id1category_nameLand Rentalcategory_id2category_nameProperty Rentalcategory_id3category_nameSpecial Attractioncategory_id4category_nameNew Productscategory_id5category_nameEmploymentcategory_id6category_nameWantedcategory_id7category_nameServicecategory_id8category_namePersonalcategory_id9region_x255232inventory-skeletonnameMy Inventoryparent_id00000000-0000-0000-0000-000000000000version4type_default8folder_idf798e114-c10f-409b-a90d-a11577ff1de8nameTexturesparent_idf798e114-c10f-409b-a90d-a11577ff1de8version1type_default0folder_idfc8b4059-30bb-43a8-a042-46f5b431ad82sim_ip127.0.0.1region_y254976gesturesinventory-lib-ownerinventory-rootfolder_idf798e114-c10f-409b-a90d-a11577ff1de8logintruelook_at[r0.99949799999999999756,r0.03166859999999999814,r0]agent_idaaaabbbb-8932-0271-8664-58f53e442797inventory-lib-rootinitial-outfitfolder_nameNightclub Femalegenderfemale \ No newline at end of file diff --git a/ConvertToPlugins/genvers.sh b/ConvertToPlugins/genvers.sh deleted file mode 100755 index 3da91d7..0000000 --- a/ConvertToPlugins/genvers.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -MAJOR=0 -MINOR=1 -BUILD=`date +%s` -REVISION=`svnversion | sed s/:// | sed s/M//` -REALREVISION=`svnversion` -cat src/VersionInfo.cs.template | sed s/@@VERSION/"$MAJOR.$MINOR, Build $BUILD, Revision $REALREVISION"/g >src/VersionInfo.cs -echo -n $MAJOR.$MINOR.*.$REVISION >VERSION diff --git a/ConvertToPlugins/opensim.build b/ConvertToPlugins/opensim.build deleted file mode 100644 index 279f836..0000000 --- a/ConvertToPlugins/opensim.build +++ /dev/null @@ -1,80 +0,0 @@ - - - nant buildfile for OpenSim - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ConvertToPlugins/src/Assets/AssetCache.cs b/ConvertToPlugins/src/Assets/AssetCache.cs deleted file mode 100644 index d35b482..0000000 --- a/ConvertToPlugins/src/Assets/AssetCache.cs +++ /dev/null @@ -1,436 +0,0 @@ -/* -* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -using System; -using System.Collections.Generic; -using System.Threading; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim; -using OpenSim.GridServers; - -namespace OpenSim.Assets -{ - /// - /// Manages local cache of assets and their sending to viewers. - /// - public class AssetCache : IAssetReceiver - { - public Dictionary Assets; - public Dictionary Textures; - - public List AssetRequests = new List(); //assets ready to be sent to viewers - public List TextureRequests = new List(); //textures ready to be sent - - public Dictionary RequestedAssets = new Dictionary(); //Assets requested from the asset server - public Dictionary RequestedTextures = new Dictionary(); //Textures requested from the asset server - - private IAssetServer _assetServer; - private Thread _assetCacheThread; - - /// - /// - /// - public AssetCache( IAssetServer assetServer) - { - _assetServer = assetServer; - _assetServer.SetReceiver(this); - Assets = new Dictionary (); - Textures = new Dictionary (); - this._assetCacheThread = new Thread( new ThreadStart(RunAssetManager)); - this._assetCacheThread.IsBackground = true; - this._assetCacheThread.Start(); - } - - /// - /// - /// - private void RunAssetManager() - { - this.ProcessAssetQueue(); - this.ProcessTextureQueue(); - Thread.Sleep(100); - } - - /// - /// - /// - private void ProcessTextureQueue() - { - if(this.TextureRequests.Count == 0) - { - //no requests waiting - return; - } - int num; - - if(this.TextureRequests.Count < 5) - { - //lower than 5 so do all of them - num = this.TextureRequests.Count; - } - else - { - num=5; - } - AssetRequest req; - for(int i = 0; i < num; i++) - { - req=(AssetRequest)this.TextureRequests[i]; - - if(req.PacketCounter == 0) - { - //first time for this request so send imagedata packet - if(req.NumPackets == 1) - { - //only one packet so send whole file - ImageDataPacket im = new ImageDataPacket(); - im.ImageID.Packets = 1; - im.ImageID.ID = req.ImageInfo.FullID; - im.ImageID.Size = (uint)req.ImageInfo.Data.Length; - im.ImageData.Data = req.ImageInfo.Data; - im.ImageID.Codec = 2; - req.RequestUser.OutPacket(im); - req.PacketCounter++; - //req.ImageInfo.l= time; - //System.Console.WriteLine("sent texture: "+req.image_info.FullID); - } - else - { - //more than one packet so split file up - ImageDataPacket im = new ImageDataPacket(); - im.ImageID.Packets = (ushort)req.NumPackets; - im.ImageID.ID = req.ImageInfo.FullID; - im.ImageID.Size = (uint)req.ImageInfo.Data.Length; - im.ImageData.Data = new byte[600]; - Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600); - im.ImageID.Codec = 2; - req.RequestUser.OutPacket(im); - req.PacketCounter++; - //req.ImageInfo.last_used = time; - //System.Console.WriteLine("sent first packet of texture: - } - } - else - { - //send imagepacket - //more than one packet so split file up - ImagePacketPacket im = new ImagePacketPacket(); - im.ImageID.Packet = (ushort)req.PacketCounter; - im.ImageID.ID = req.ImageInfo.FullID; - int size = req.ImageInfo.Data.Length - 600 - 1000*(req.PacketCounter - 1); - if(size > 1000) size = 1000; - im.ImageData.Data = new byte[size]; - Array.Copy(req.ImageInfo.Data, 600 + 1000*(req.PacketCounter - 1), im.ImageData.Data, 0, size); - req.RequestUser.OutPacket(im); - req.PacketCounter++; - //req.ImageInfo.last_used = time; - //System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID); - } - } - - //remove requests that have been completed - int count = 0; - for(int i = 0; i < num; i++) - { - req=(AssetRequest)this.TextureRequests[count]; - if(req.PacketCounter == req.NumPackets) - { - this.TextureRequests.Remove(req); - } - else - { - count++; - } - } - - } - public void AssetReceived(AssetBase asset, bool IsTexture) - { - //check if it is a texture or not - //then add to the correct cache list - //then check for waiting requests for this asset/texture (in the Requested lists) - //and move those requests into the Requests list. - if(IsTexture) - { - TextureImage image = new TextureImage(asset); - this.Textures.Add(image.FullID, image); - if(this.RequestedTextures.ContainsKey(image.FullID)) - { - AssetRequest req = this.RequestedTextures[image.FullID]; - req.ImageInfo = image; - this.RequestedTextures.Remove(image.FullID); - this.TextureRequests.Add(req); - } - } - else - { - AssetInfo assetInf = new AssetInfo(asset); - this.Assets.Add(assetInf.FullID, assetInf); - if(this.RequestedAssets.ContainsKey(assetInf.FullID)) - { - AssetRequest req = this.RequestedAssets[assetInf.FullID]; - req.AssetInf = assetInf; - this.RequestedAssets.Remove(assetInf.FullID); - this.AssetRequests.Add(req); - } - } - } - - public void AssetNotFound(AssetBase asset) - { - //the asset server had no knowledge of requested asset - - } - - #region Assets - /// - /// - /// - /// - /// - public void AddAssetRequest(OpenSimClient userInfo, TransferRequestPacket transferRequest) - { - LLUUID requestID = new LLUUID(transferRequest.TransferInfo.Params, 0); - //check to see if asset is in local cache, if not we need to request it from asset server. - if(!this.Assets.ContainsKey(requestID)) - { - //not found asset - // so request from asset server - AssetRequest request = new AssetRequest(); - request.RequestUser = userInfo; - request.RequestAssetID = requestID; - request.TransferRequestID = transferRequest.TransferInfo.TransferID; - this.RequestedAssets.Add(requestID,request); - this._assetServer.RequestAsset(requestID, false); - return; - } - //it is in our cache - AssetInfo asset = this.Assets[requestID]; - - //work out how many packets it should be sent in - // and add to the AssetRequests list - AssetRequest req = new AssetRequest(); - req.RequestUser = userInfo; - req.RequestAssetID = requestID; - req.TransferRequestID = transferRequest.TransferInfo.TransferID; - req.AssetInf = asset; - - if(asset.Data.LongLength>600) - { - //over 600 bytes so split up file - req.NumPackets = 1 + (int)(asset.Data.Length-600+999)/1000; - } - else - { - req.NumPackets = 1; - } - - this.AssetRequests.Add(req); - } - - /// - /// - /// - private void ProcessAssetQueue() - { - if(this.AssetRequests.Count == 0) - { - //no requests waiting - return; - } - int num; - - if(this.AssetRequests.Count < 5) - { - //lower than 5 so do all of them - num = this.AssetRequests.Count; - } - else - { - num=5; - } - AssetRequest req; - for(int i = 0; i < num; i++) - { - req=(AssetRequest)this.AssetRequests[i]; - - TransferInfoPacket Transfer = new TransferInfoPacket(); - Transfer.TransferInfo.ChannelType = 2; - Transfer.TransferInfo.Status = 0; - Transfer.TransferInfo.TargetType = 0; - Transfer.TransferInfo.Params = req.RequestAssetID.GetBytes(); - Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length; - Transfer.TransferInfo.TransferID = req.TransferRequestID; - req.RequestUser.OutPacket(Transfer); - - if(req.NumPackets == 1) - { - TransferPacketPacket TransferPacket = new TransferPacketPacket(); - TransferPacket.TransferData.Packet = 0; - TransferPacket.TransferData.ChannelType = 2; - TransferPacket.TransferData.TransferID=req.TransferRequestID; - TransferPacket.TransferData.Data = req.AssetInf.Data; - TransferPacket.TransferData.Status = 1; - req.RequestUser.OutPacket(TransferPacket); - } - else - { - //more than one packet so split file up , for now it can't be bigger than 2000 bytes - TransferPacketPacket TransferPacket = new TransferPacketPacket(); - TransferPacket.TransferData.Packet = 0; - TransferPacket.TransferData.ChannelType = 2; - TransferPacket.TransferData.TransferID=req.TransferRequestID; - byte[] chunk = new byte[1000]; - Array.Copy(req.AssetInf.Data,chunk,1000); - TransferPacket.TransferData.Data = chunk; - TransferPacket.TransferData.Status = 0; - req.RequestUser.OutPacket(TransferPacket); - - TransferPacket = new TransferPacketPacket(); - TransferPacket.TransferData.Packet = 1; - TransferPacket.TransferData.ChannelType = 2; - TransferPacket.TransferData.TransferID = req.TransferRequestID; - byte[] chunk1 = new byte[(req.AssetInf.Data.Length-1000)]; - Array.Copy(req.AssetInf.Data, 1000, chunk1, 0, chunk1.Length); - TransferPacket.TransferData.Data = chunk1; - TransferPacket.TransferData.Status = 1; - req.RequestUser.OutPacket(TransferPacket); - } - - } - - //remove requests that have been completed - for(int i = 0; i < num; i++) - { - this.AssetRequests.RemoveAt(0); - } - - } - - #endregion - - #region Textures - /// - /// - /// - /// - /// - public void AddTextureRequest(OpenSimClient userInfo, LLUUID imageID) - { - //check to see if texture is in local cache, if not request from asset server - if(!this.Textures.ContainsKey(imageID)) - { - //not is cache so request from asset server - AssetRequest request = new AssetRequest(); - request.RequestUser = userInfo; - request.RequestAssetID = imageID; - request.IsTextureRequest = true; - this.RequestedTextures.Add(imageID, request); - this._assetServer.RequestAsset(imageID, true); - return; - } - TextureImage imag = this.Textures[imageID]; - AssetRequest req = new AssetRequest(); - req.RequestUser = userInfo; - req.RequestAssetID = imageID; - req.IsTextureRequest = true; - req.ImageInfo = imag; - - if(imag.Data.LongLength>600) - { - //over 600 bytes so split up file - req.NumPackets = 1 + (int)(imag.Data.Length-600+999)/1000; - } - else - { - req.NumPackets = 1; - } - - this.TextureRequests.Add(req); - } - #endregion - - } - - public class AssetRequest - { - public OpenSimClient RequestUser; - public LLUUID RequestAssetID; - public AssetInfo AssetInf; - public TextureImage ImageInfo; - public LLUUID TransferRequestID; - public long DataPointer = 0; - public int NumPackets = 0; - public int PacketCounter = 0; - public bool IsTextureRequest; - //public bool AssetInCache; - //public int TimeRequested; - - public AssetRequest() - { - - } - } - - public class AssetInfo : AssetBase - { - public AssetInfo() - { - - } - - public AssetInfo(AssetBase aBase) - { - Data= aBase.Data; - FullID = aBase.FullID; - Type = aBase.Type; - InvType = aBase.InvType; - Name= aBase.Name; - Description = aBase.Description; - } - } - - public class TextureImage : AssetBase - { - public TextureImage() - { - - } - - public TextureImage(AssetBase aBase) - { - Data= aBase.Data; - FullID = aBase.FullID; - Type = aBase.Type; - InvType = aBase.InvType; - Name= aBase.Name; - Description = aBase.Description; - } - } - -} diff --git a/ConvertToPlugins/src/Config.cs b/ConvertToPlugins/src/Config.cs deleted file mode 100644 index c42b80e..0000000 --- a/ConvertToPlugins/src/Config.cs +++ /dev/null @@ -1,72 +0,0 @@ -/* -Copyright (c) OpenSim project, http://osgrid.org/ - -* Copyright (c) , -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -using System; -using System.Collections.Generic; -using System.IO; -using libsecondlife; -using OpenSim.world; - -namespace OpenSim -{ - /// - /// This class handles connection to the underlying database used for configuration of the region. - /// Region content is also stored by this class. The main entry point is InitConfig() which attempts to locate - /// opensim.yap in the current working directory. If opensim.yap can not be found, default settings are loaded from - /// what is hardcoded here and then saved into opensim.yap for future startups. - /// - - - public abstract class SimConfig - { - public string RegionName; - - public uint RegionLocX; - public uint RegionLocY; - public ulong RegionHandle; - - public int IPListenPort; - public string IPListenAddr; - - public string AssetURL; - public string AssetSendKey; - - public string GridURL; - public string GridSendKey; - - public abstract void InitConfig(); - public abstract void LoadFromGrid(); - public abstract World LoadWorld(); - } - - public interface ISimConfig - { - SimConfig GetConfigObject(); - } -} diff --git a/ConvertToPlugins/src/Config/SimConfig/AssemblyInfo.cs b/ConvertToPlugins/src/Config/SimConfig/AssemblyInfo.cs deleted file mode 100644 index 96c3e73..0000000 --- a/ConvertToPlugins/src/Config/SimConfig/AssemblyInfo.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("SimConfig")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("SimConfig")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 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.*")] diff --git a/ConvertToPlugins/src/Config/SimConfig/Db4SimConfig.cs b/ConvertToPlugins/src/Config/SimConfig/Db4SimConfig.cs deleted file mode 100644 index cc31328..0000000 --- a/ConvertToPlugins/src/Config/SimConfig/Db4SimConfig.cs +++ /dev/null @@ -1,146 +0,0 @@ -/* -* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using OpenSim; -using OpenSim.world; -using Db4objects.Db4o; - -namespace Db40SimConfig -{ - public class Db40ConfigPlugin: ISimConfig - { - public SimConfig GetConfigObject() - { - ServerConsole.MainConsole.Instance.WriteLine("Loading Db40Config dll"); - return ( new DbSimConfig()); - } - } - - public class DbSimConfig :SimConfig - { - private IObjectContainer db; - - public void LoadDefaults() { - ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); - - this.RegionName=ServerConsole.MainConsole.Instance.CmdPrompt("Name [OpenSim test]: ","OpenSim test"); - this.RegionLocX=(uint)Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("Grid Location X [997]: ","997")); - this.RegionLocY=(uint)Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("Grid Location Y [996]: ","996")); - this.IPListenPort=Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("UDP port for client connections [9000]: ","9000")); - this.IPListenAddr=ServerConsole.MainConsole.Instance.CmdPrompt("IP Address to listen on for client connections [127.0.0.1]: ","127.0.0.1"); - - if(!OpenSim_Main.sim.sandbox) - { - this.AssetURL=ServerConsole.MainConsole.Instance.CmdPrompt("Asset server URL: "); - this.AssetSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Asset server key: "); - this.GridURL=ServerConsole.MainConsole.Instance.CmdPrompt("Grid server URL: "); - this.GridSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Grid server key: "); - } - this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); - } - - public override void InitConfig() { - try { - db = Db4oFactory.OpenFile("opensim.yap"); - IObjectSet result = db.Get(typeof(DbSimConfig)); - if(result.Count==1) { - ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Found a SimConfig object in the local database, loading"); - foreach (DbSimConfig cfg in result) { - this.RegionName = cfg.RegionName; - this.RegionLocX = cfg.RegionLocX; - this.RegionLocY = cfg.RegionLocY; - this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); - this.IPListenPort = cfg.IPListenPort; - this.IPListenAddr = cfg.IPListenAddr; - this.AssetURL = cfg.AssetURL; - this.AssetSendKey = cfg.AssetSendKey; - this.GridURL = cfg.GridURL; - this.GridSendKey = cfg.GridSendKey; - } - } else { - ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); - LoadDefaults(); - ServerConsole.MainConsole.Instance.WriteLine("Writing out default settings to local database"); - db.Set(this); - } - } catch(Exception e) { - db.Close(); - ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Exception occured"); - ServerConsole.MainConsole.Instance.WriteLine(e.ToString()); - } - - ServerConsole.MainConsole.Instance.WriteLine("Sim settings loaded:"); - ServerConsole.MainConsole.Instance.WriteLine("Name: " + this.RegionName); - ServerConsole.MainConsole.Instance.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); - ServerConsole.MainConsole.Instance.WriteLine("Region Handle: " + this.RegionHandle.ToString()); - ServerConsole.MainConsole.Instance.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort); - ServerConsole.MainConsole.Instance.WriteLine("Sandbox Mode? " + OpenSim_Main.sim.sandbox.ToString()); - ServerConsole.MainConsole.Instance.WriteLine("Asset URL: " + this.AssetURL); - ServerConsole.MainConsole.Instance.WriteLine("Asset key: " + this.AssetSendKey); - ServerConsole.MainConsole.Instance.WriteLine("Grid URL: " + this.GridURL); - ServerConsole.MainConsole.Instance.WriteLine("Grid key: " + this.GridSendKey); - } - - public override World LoadWorld() - { - ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Loading world...."); - World blank = new World(); - ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB"); - IObjectSet world_result = db.Get(new float[65536]); - if(world_result.Count>0) { - ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading"); - blank.LandMap=(float[])world_result.Next(); - } else { - ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one"); - HeightmapGenHills hills = new HeightmapGenHills(); - blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); - ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database"); - db.Set(blank.LandMap); - db.Commit(); - } - return blank; - } - - public override void LoadFromGrid() { - ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!"); - // TODO: Make this crap work - /* WebRequest GridLogin = WebRequest.Create(this.GridURL + "regions/" + this.RegionHandle.ToString() + "/login"); - WebResponse GridResponse = GridLogin.GetResponse(); - byte[] idata = new byte[(int)GridResponse.ContentLength]; - BinaryReader br = new BinaryReader(GridResponse.GetResponseStream()); - - br.Close(); - GridResponse.Close(); - */ - } - - public void Shutdown() { - db.Close(); - } - } -} diff --git a/ConvertToPlugins/src/Config/SimConfig/SimConfig.csproj b/ConvertToPlugins/src/Config/SimConfig/SimConfig.csproj deleted file mode 100644 index 08f0f24..0000000 --- a/ConvertToPlugins/src/Config/SimConfig/SimConfig.csproj +++ /dev/null @@ -1,49 +0,0 @@ - - - Library - SimConfig - SimConfig - Debug - AnyCPU - {B063760D-DB8D-4F64-B6FE-335FAD1E650A} - - - bin\Debug\ - False - DEBUG;TRACE - True - Full - True - - - bin\Release\ - True - TRACE - False - None - False - - - - - - ..\..\..\bin\Db4objects.Db4o.dll - False - - - - - - - - - {C9A6026D-8E0C-4FE4-8691-FB2A566AA245} - ServerConsole - - - {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E} - Second-server - - - - \ No newline at end of file diff --git a/ConvertToPlugins/src/Config/SimConfig/SimConfig.sln b/ConvertToPlugins/src/Config/SimConfig/SimConfig.sln deleted file mode 100644 index 944d6a8..0000000 --- a/ConvertToPlugins/src/Config/SimConfig/SimConfig.sln +++ /dev/null @@ -1,7 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# SharpDevelop 2.1.0.2017 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimConfig", "SimConfig.csproj", "{B063760D-DB8D-4F64-B6FE-335FAD1E650A}" -EndProject -Global -EndGlobal diff --git a/ConvertToPlugins/src/Config/default.build b/ConvertToPlugins/src/Config/default.build deleted file mode 100644 index 2ee0c52..0000000 --- a/ConvertToPlugins/src/Config/default.build +++ /dev/null @@ -1,52 +0,0 @@ - - - nant buildfile for OpenSim - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ConvertToPlugins/src/GridInterfaces/AssemblyInfo.cs b/ConvertToPlugins/src/GridInterfaces/AssemblyInfo.cs deleted file mode 100644 index 89731a1..0000000 --- a/ConvertToPlugins/src/GridInterfaces/AssemblyInfo.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("GridInterfaces")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GridInterfaces")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 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.*")] diff --git a/ConvertToPlugins/src/GridInterfaces/GridInterfaces.csproj b/ConvertToPlugins/src/GridInterfaces/GridInterfaces.csproj deleted file mode 100644 index 3284e7f..0000000 --- a/ConvertToPlugins/src/GridInterfaces/GridInterfaces.csproj +++ /dev/null @@ -1,40 +0,0 @@ - - - Library - GridInterfaces - GridInterfaces - Debug - AnyCPU - {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9} - - - bin\Debug\ - False - DEBUG;TRACE - True - Full - True - - - bin\Release\ - True - TRACE - False - None - False - - - - - - ..\..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll - False - - - - - - - - - \ No newline at end of file diff --git a/ConvertToPlugins/src/GridInterfaces/GridInterfaces.sln b/ConvertToPlugins/src/GridInterfaces/GridInterfaces.sln deleted file mode 100644 index 5ac2b6d..0000000 --- a/ConvertToPlugins/src/GridInterfaces/GridInterfaces.sln +++ /dev/null @@ -1,17 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# SharpDevelop 2.1.0.2017 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GridInterfaces", "GridInterfaces.csproj", "{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Release|Any CPU.Build.0 = Release|Any CPU - {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Release|Any CPU.ActiveCfg = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/ConvertToPlugins/src/GridInterfaces/IAssetServer.cs b/ConvertToPlugins/src/GridInterfaces/IAssetServer.cs deleted file mode 100644 index 6050a6c..0000000 --- a/ConvertToPlugins/src/GridInterfaces/IAssetServer.cs +++ /dev/null @@ -1,82 +0,0 @@ -/* -* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Net; -using System.Net.Sockets; -using System.IO; -using System.Threading; -using libsecondlife; - - -namespace OpenSim.GridServers -{ - /// - /// Description of IAssetServer. - /// - - public interface IAssetServer - { - void SetReceiver(IAssetReceiver receiver); - void RequestAsset(LLUUID assetID, bool isTexture); - void UpdateAsset(AssetBase asset); - void UploadNewAsset(AssetBase asset); - void SetServerInfo(string ServerUrl, string ServerKey); - } - - // could change to delegate? - public interface IAssetReceiver - { - void AssetReceived(AssetBase asset, bool IsTexture); - void AssetNotFound(AssetBase asset); - } - - public struct ARequest - { - public LLUUID AssetID; - public bool IsTexture; - } - - public class AssetBase - { - public byte[] Data; - public LLUUID FullID; - public sbyte Type; - public sbyte InvType; - public string Name; - public string Description; - - public AssetBase() - { - - } - } - - public interface IAssetPlugin - { - IAssetServer GetAssetServer(); - } -} diff --git a/ConvertToPlugins/src/GridInterfaces/IGridServer.cs b/ConvertToPlugins/src/GridInterfaces/IGridServer.cs deleted file mode 100644 index fef4c3e..0000000 --- a/ConvertToPlugins/src/GridInterfaces/IGridServer.cs +++ /dev/null @@ -1,94 +0,0 @@ -/* -* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - - -using System; -using System.Collections.Generic; -using System.Net; -using System.Net.Sockets; -using System.IO; -using libsecondlife; - -namespace OpenSim.GridServers -{ - /// - /// Handles connection to Grid Servers. - /// also Sim to Sim connections? - /// - - - - - public interface IGridServer - { - bool RequestConnection(); - UUIDBlock RequestUUIDBlock(); - void RequestNeighbours(); //should return a array of neighbouring regions - AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode); - bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode); - void SetServerInfo(string ServerUrl, string ServerKey); - void AddNewSession(Login session); // only used by local version of grid server - // and didn't use to be part of this interface until we put this in a dll - } - - public struct UUIDBlock - { - public LLUUID BlockStart; - public LLUUID BlockEnd; - } - - public class AuthenticateResponse - { - public bool Authorised; - public Login LoginInfo; - - public AuthenticateResponse() - { - - } - - } - - public class Login - { - public string First = "Test"; - public string Last = "User"; - public LLUUID Agent; - public LLUUID Session; - public LLUUID InventoryFolder; - public LLUUID BaseFolder; - public Login() - { - - } - } - - public interface IGridPlugin - { - IGridServer GetGridServer(); - } -} diff --git a/ConvertToPlugins/src/GridInterfaces/default.build b/ConvertToPlugins/src/GridInterfaces/default.build deleted file mode 100644 index f29f108..0000000 --- a/ConvertToPlugins/src/GridInterfaces/default.build +++ /dev/null @@ -1,49 +0,0 @@ - - - nant buildfile for OpenSim - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ConvertToPlugins/src/GridServers/LoginServer.cs b/ConvertToPlugins/src/GridServers/LoginServer.cs deleted file mode 100644 index da982e7..0000000 --- a/ConvertToPlugins/src/GridServers/LoginServer.cs +++ /dev/null @@ -1,322 +0,0 @@ -/* -* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -using Nwc.XmlRpc; -using System; -using System.IO; -using System.Net; -using System.Net.Sockets; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading; -using System.Collections; -using System.Security.Cryptography; -using System.Xml; -using libsecondlife; -using OpenSim; - -namespace OpenSim.GridServers -{ - - /// - /// When running in local (default) mode , handles client logins. - /// - public class LoginServer - { - public LoginServer(IGridServer gridServer) - { - _gridServer = gridServer; - } - private Login _login; - private IGridServer _gridServer; - private ushort _loginPort = 8080; - public IPAddress clientAddress = IPAddress.Loopback; - public IPAddress remoteAddress = IPAddress.Any; - private Socket loginServer; - private Random RandomClass = new Random(); - private int NumClients; - private string _defaultResponse; - - private string _mpasswd; - private bool _needPasswd=false; - - // InitializeLogin: initialize the login - private void InitializeLogin() { - loginServer = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - loginServer.Bind(new IPEndPoint(remoteAddress, _loginPort)); - loginServer.Listen(1); - - this._needPasswd=false; - //read in default response string - StreamReader SR; - string lines; - SR=File.OpenText("new-login.dat"); - - //lines=SR.ReadLine(); - - while(!SR.EndOfStream) - { - lines = SR.ReadLine(); - _defaultResponse += lines; - //lines = SR.ReadLine(); - } - SR.Close(); - this._mpasswd = EncodePassword("testpass"); - } - - public void Startup() - { - this.InitializeLogin(); - Thread runLoginProxy = new Thread(new ThreadStart(RunLogin)); - runLoginProxy.IsBackground = true; - runLoginProxy.Start(); - } - - private void RunLogin() - { - Console.WriteLine("Starting Login Server"); - try - { - for (;;) - { - Socket client = loginServer.Accept(); - IPEndPoint clientEndPoint = (IPEndPoint)client.RemoteEndPoint; - - - NetworkStream networkStream = new NetworkStream(client); - StreamReader networkReader = new StreamReader(networkStream); - StreamWriter networkWriter = new StreamWriter(networkStream); - - try - { - LoginRequest(networkReader, networkWriter); - } - catch (Exception e) - { - Console.WriteLine(e.Message); - } - - networkWriter.Close(); - networkReader.Close(); - networkStream.Close(); - - client.Close(); - - // send any packets queued for injection - - } - } - catch (Exception e) - { - Console.WriteLine(e.Message); - Console.WriteLine(e.StackTrace); - } - } - - // ProxyLogin: proxy a login request - private void LoginRequest(StreamReader reader, StreamWriter writer) - { - lock(this) - { - string line; - int contentLength = 0; - // read HTTP header - do - { - // read one line of the header - line = reader.ReadLine(); - - // check for premature EOF - if (line == null) - throw new Exception("EOF in client HTTP header"); - - // look for Content-Length - Match match = (new Regex(@"Content-Length: (\d+)$")).Match(line); - if (match.Success) - contentLength = Convert.ToInt32(match.Groups[1].Captures[0].ToString()); - } while (line != ""); - - // read the HTTP body into a buffer - char[] content = new char[contentLength]; - reader.Read(content, 0, contentLength); - - XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(new String(content)); - if(request.MethodName == "login_to_simulator") - { - Hashtable requestData = (Hashtable)request.Params[0]; - string first; - string last; - string passwd; - LLUUID Agent; - LLUUID Session; - - //get login name - if(requestData.Contains("first")) - { - first = (string)requestData["first"]; - } - else - { - first = "test"; - } - - if(requestData.Contains("last")) - { - last = (string)requestData["last"]; - } - else - { - last = "User"+NumClients.ToString(); - } - - if(requestData.Contains("passwd")) - { - passwd = (string)requestData["passwd"]; - } - else - { - passwd = "notfound"; - } - - if( !Authenticate(first, last, passwd)) - { - // Fail miserably - writer.WriteLine("HTTP/1.0 403 Authentication Forbidden"); - writer.WriteLine(); - return; - } - NumClients++; - - //create a agent and session LLUUID - Agent = GetAgentId( first, last ); - int SessionRand = this.RandomClass.Next(1,999); - Session = new LLUUID("aaaabbbb-0200-"+SessionRand.ToString("0000")+"-8664-58f53e442797"); - - - XmlRpcResponse response =(XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse); - Hashtable responseData = (Hashtable)response.Value; - - responseData["sim_port"] = OpenSim_Main.cfg.IPListenPort; - responseData["sim_ip"] = OpenSim_Main.cfg.IPListenAddr; - responseData["agent_id"] = Agent.ToStringHyphenated(); - responseData["session_id"] = Session.ToStringHyphenated(); - ArrayList InventoryList = (ArrayList) responseData["inventory-skeleton"]; - Hashtable Inventory1 = (Hashtable)InventoryList[0]; - Hashtable Inventory2 = (Hashtable)InventoryList[1]; - LLUUID BaseFolderID = LLUUID.Random(); - LLUUID InventoryFolderID = LLUUID.Random(); - Inventory2["name"] = "Base"; - Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated(); - Inventory2["type_default"] =6; - Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated(); - - ArrayList InventoryRoot = (ArrayList) responseData["inventory-root"]; - Hashtable Inventoryroot = (Hashtable)InventoryRoot[0]; - Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated(); - - CustomiseLoginResponse( responseData, first, last ); - - this._login = new Login(); - //copy data to login object - _login.First = first; - _login.Last = last; - _login.Agent = Agent; - _login.Session = Session; - _login.BaseFolder = BaseFolderID; - _login.InventoryFolder = InventoryFolderID; - - //working on local computer so lets add to the gridserver's list of sessions - this._gridServer.AddNewSession(_login); - - // forward the XML-RPC response to the client - writer.WriteLine("HTTP/1.0 200 OK"); - writer.WriteLine("Content-type: text/xml"); - writer.WriteLine(); - - XmlTextWriter responseWriter = new XmlTextWriter(writer); - XmlRpcResponseSerializer.Singleton.Serialize(responseWriter, response); - responseWriter.Close(); - } - else - { - writer.WriteLine("HTTP/1.0 403 Authentication Forbidden"); - writer.WriteLine(); - } - } - } - - protected virtual void CustomiseLoginResponse( Hashtable responseData, string first, string last ) - { - } - - protected virtual LLUUID GetAgentId(string firstName, string lastName) - { - LLUUID Agent; - int AgentRand = this.RandomClass.Next(1,9999); - Agent = new LLUUID("99998888-0100-"+AgentRand.ToString("0000")+"-8ec1-0b1d5cd6aead"); - return Agent; - } - - protected virtual bool Authenticate(string first, string last, string passwd) - { - if(this._needPasswd) - { - //every user needs the password to login - string encodedPass = passwd.Remove(0,3); //remove $1$ - if(encodedPass == this._mpasswd) - { - return true; - } - else - { - return false; - } - } - else - { - //do not need password to login - return true; - } - } - - private static string EncodePassword(string passwd) - { - Byte[] originalBytes; - Byte[] encodedBytes; - MD5 md5; - - md5 = new MD5CryptoServiceProvider(); - originalBytes = ASCIIEncoding.Default.GetBytes(passwd); - encodedBytes = md5.ComputeHash(originalBytes); - - return Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower(); - } - - } - - -} diff --git a/ConvertToPlugins/src/HeightMapGenHills.cs b/ConvertToPlugins/src/HeightMapGenHills.cs deleted file mode 100644 index e7589af..0000000 --- a/ConvertToPlugins/src/HeightMapGenHills.cs +++ /dev/null @@ -1,149 +0,0 @@ -/* -* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -using System; - -namespace OpenSim -{ - public class HeightmapGenHills - { - private Random Rand = new Random(); - private int NumHills; - private float HillMin; - private float HillMax; - private bool Island; - private float[] heightmap; - - public float[] GenerateHeightmap(int numHills, float hillMin, float hillMax, bool island) - { - NumHills = numHills; - HillMin = hillMin; - HillMax = hillMax; - Island = island; - - heightmap = new float[256 * 256]; - - for (int i = 0; i < numHills; i++) - { - AddHill(); - } - - Normalize(); - - return heightmap; - } - - private void AddHill() - { - float x, y; - float radius = RandomRange(HillMin, HillMax); - - if (Island) - { - // Which direction from the center of the map the hill is placed - float theta = RandomRange(0, 6.28f); - - // How far from the center of the map to place the hill. The radius - // is subtracted from the range to prevent any part of the hill from - // reaching the edge of the map - float distance = RandomRange(radius / 2.0f, 128.0f - radius); - - x = 128.0f + (float)Math.Cos(theta) * distance; - y = 128.0f + (float)Math.Sin(theta) * distance; - } - else - { - x = RandomRange(-radius, 256.0f + radius); - y = RandomRange(-radius, 256.0f + radius); - } - - float radiusSq = radius * radius; - float distSq; - float height; - - int xMin = (int)(x - radius) - 1; - int xMax = (int)(x + radius) + 1; - if (xMin < 0) xMin = 0; - if (xMax > 255) xMax = 255; - - int yMin = (int)(y - radius) - 1; - int yMax = (int)(y + radius) + 1; - if (yMin < 0) yMin = 0; - if (yMax > 255) yMax = 255; - - // Loop through each affected cell and determine the height at that point - for (int v = yMin; v <= yMax; ++v) - { - float fv = (float)v; - - for (int h = xMin; h <= xMax; ++h) - { - float fh = (float)h; - - // Determine how far from the center of this hill this point is - distSq = (x - fh) * (x - fh) + (y - fv) * (y - fv); - height = radiusSq - distSq; - - // Don't add negative hill values - if (height > 0.0f) heightmap[h + v * 256] += height; - } - } - } - - private void Normalize() - { - float min = heightmap[0]; - float max = heightmap[0]; - - for (int x = 0; x < 256; x++) - { - for (int y = 0; y < 256; y++) - { - if (heightmap[x + y * 256] < min) min = heightmap[x + y * 256]; - if (heightmap[x + y * 256] > max) max = heightmap[x + y * 256]; - } - } - - // Avoid a rare divide by zero - if (min != max) - { - for (int x = 0; x < 256; x++) - { - for (int y = 0; y < 256; y++) - { - heightmap[x + y * 256] = ((heightmap[x + y * 256] - min) / (max - min)) * (HillMax - HillMin); - } - } - } - } - - private float RandomRange(float min, float max) - { - return (float)Rand.NextDouble() * (max - min) + min; - } - } -} diff --git a/ConvertToPlugins/src/LocalServers/LocalGridServers/AssemblyInfo.cs b/ConvertToPlugins/src/LocalServers/LocalGridServers/AssemblyInfo.cs deleted file mode 100644 index 103b49a..0000000 --- a/ConvertToPlugins/src/LocalServers/LocalGridServers/AssemblyInfo.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("LocalGridServers")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("LocalGridServers")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 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.*")] diff --git a/ConvertToPlugins/src/LocalServers/LocalGridServers/LocalGrid.cs b/ConvertToPlugins/src/LocalServers/LocalGridServers/LocalGrid.cs deleted file mode 100644 index 5adce27..0000000 --- a/ConvertToPlugins/src/LocalServers/LocalGridServers/LocalGrid.cs +++ /dev/null @@ -1,205 +0,0 @@ -/* -* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Threading; -using OpenSim.GridServers; -using libsecondlife; - -namespace LocalGridServers -{ - /// - /// - /// - /// - public class LocalGridPlugin : IGridPlugin - { - public LocalGridPlugin() - { - - } - - public IGridServer GetGridServer() - { - return(new LocalGridServer()); - } - } - - public class LocalAssetPlugin : IAssetPlugin - { - public LocalAssetPlugin() - { - - } - - public IAssetServer GetAssetServer() - { - return(new LocalAssetServer()); - } - } - - public class LocalAssetServer : IAssetServer - { - private IAssetReceiver _receiver; - private BlockingQueue _assetRequests; - - public LocalAssetServer() - { - this._assetRequests = new BlockingQueue(); - ServerConsole.MainConsole.Instance.WriteLine("Local Asset Server class created"); - } - - public void SetReceiver(IAssetReceiver receiver) - { - this._receiver = receiver; - } - - public void RequestAsset(LLUUID assetID, bool isTexture) - { - ARequest req = new ARequest(); - req.AssetID = assetID; - req.IsTexture = isTexture; - //this._assetRequests.Enqueue(req); - } - - public void UpdateAsset(AssetBase asset) - { - - } - - public void UploadNewAsset(AssetBase asset) - { - - } - - public void SetServerInfo(string ServerUrl, string ServerKey) - { - - } - - private void RunRequests() - { - while(true) - { - - } - } - } - - public class LocalGridServer :IGridServer - { - public List Sessions = new List(); - - public LocalGridServer() - { - Sessions = new List(); - ServerConsole.MainConsole.Instance.WriteLine("Local Grid Server class created"); - } - - public bool RequestConnection() - { - return true; - } - public AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) - { - //we are running local - AuthenticateResponse user = new AuthenticateResponse(); - - lock(this.Sessions) - { - - for(int i = 0; i < Sessions.Count; i++) - { - if((Sessions[i].Agent == agentID) && (Sessions[i].Session == sessionID)) - { - user.Authorised = true; - user.LoginInfo = Sessions[i]; - } - } - } - return(user); - } - - public bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) - { - return(true); - } - - public UUIDBlock RequestUUIDBlock() - { - UUIDBlock uuidBlock = new UUIDBlock(); - return(uuidBlock); - } - - public void RequestNeighbours() - { - return; - } - - public void SetServerInfo(string ServerUrl, string ServerKey) - { - - } - /// - /// used by the local login server to inform us of new sessions - /// - /// - public void AddNewSession(Login session) - { - lock(this.Sessions) - { - this.Sessions.Add(session); - } - } - } - - public class BlockingQueue< T > { - private Queue< T > _queue = new Queue< T >(); - private object _queueSync = new object(); - - public void Enqueue(T value) - { - lock(_queueSync) - { - _queue.Enqueue(value); - Monitor.Pulse(_queueSync); - } - } - - public T Dequeue() - { - lock(_queueSync) - { - if( _queue.Count < 1) - Monitor.Wait(_queueSync); - - return _queue.Dequeue(); - } - } - } - -} diff --git a/ConvertToPlugins/src/LocalServers/LocalGridServers/LocalGridServers.csproj b/ConvertToPlugins/src/LocalServers/LocalGridServers/LocalGridServers.csproj deleted file mode 100644 index dc9c566..0000000 --- a/ConvertToPlugins/src/LocalServers/LocalGridServers/LocalGridServers.csproj +++ /dev/null @@ -1,49 +0,0 @@ - - - Library - LocalGridServers - LocalGridServers - Debug - AnyCPU - {D7F0395B-FADC-4936-80A0-D95AACE92F62} - - - bin\Debug\ - False - DEBUG;TRACE - True - Full - True - - - bin\Release\ - True - TRACE - False - None - False - - - - - - ..\..\..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll - False - - - - - - - - - {C9A6026D-8E0C-4FE4-8691-FB2A566AA245} - ServerConsole - - - {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9} - GridInterfaces - - - - \ No newline at end of file diff --git a/ConvertToPlugins/src/LocalServers/LocalGridServers/LocalGridServers.sln b/ConvertToPlugins/src/LocalServers/LocalGridServers/LocalGridServers.sln deleted file mode 100644 index 659e1d5..0000000 --- a/ConvertToPlugins/src/LocalServers/LocalGridServers/LocalGridServers.sln +++ /dev/null @@ -1,7 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# SharpDevelop 2.1.0.2017 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalGridServers", "LocalGridServers.csproj", "{D7F0395B-FADC-4936-80A0-D95AACE92F62}" -EndProject -Global -EndGlobal diff --git a/ConvertToPlugins/src/LocalServers/default.build b/ConvertToPlugins/src/LocalServers/default.build deleted file mode 100644 index 06bfcaa..0000000 --- a/ConvertToPlugins/src/LocalServers/default.build +++ /dev/null @@ -1,51 +0,0 @@ - - - nant buildfile for OpenSim - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ConvertToPlugins/src/Main.cs b/ConvertToPlugins/src/Main.cs deleted file mode 100644 index 4fc7d54..0000000 --- a/ConvertToPlugins/src/Main.cs +++ /dev/null @@ -1,317 +0,0 @@ -/* -Copyright (c) OpenSim project, http://osgrid.org/ - - -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -using System; -using System.Text; -using System.IO; -using System.Threading; -using System.Net; -using System.Net.Sockets; -using System.Timers; -using System.Reflection; -using System.Collections; -using System.Collections.Generic; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim.world; -using OpenSim.GridServers; -using OpenSim.Assets; -using ServerConsole; -using PhysicsSystem; - -namespace OpenSim -{ - /// - /// Description of MainForm. - /// - public class OpenSim_Main - { - public static OpenSim_Main sim; - public static SimConfig cfg; - public static World local_world; - public static Grid gridServers; - - public static Socket Server; - private static IPEndPoint ServerIncoming; - private static byte[] RecvBuffer = new byte[4096]; - private byte[] ZeroBuffer = new byte[8192]; - private static IPEndPoint ipeSender; - private static EndPoint epSender; - private static AsyncCallback ReceivedData; - - public AssetCache assetCache; - public DateTime startuptime; - public Dictionary ClientThreads = new Dictionary(); - private PhysicsManager physManager; - private System.Timers.Timer timer1 = new System.Timers.Timer(); - private string ConfigDll = "SimConfig.dll"; - public bool sandbox = false; - public bool loginserver = false; - - [STAThread] - public static void Main( string[] args ) - { - Console.WriteLine("OpenSim " + VersionInfo.Version + "\n"); - Console.WriteLine("Starting...\n"); - ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local,"",0); - - sim = new OpenSim_Main(); - - for (int i = 0; i < args.Length; i++) - { - if(args[i] == "-sandbox") - { - sim.sandbox = true; - } - if(args[i] == "-loginserver") - { - sim.loginserver = true; - } - } - - OpenSim_Main.gridServers = new Grid(); - if(sim.sandbox) - { - OpenSim_Main.gridServers.AssetDll = "LocalGridServers.dll"; - OpenSim_Main.gridServers.GridDll = "LocalGridServers.dll"; - OpenSim_Main.gridServers.LoadPlugins(); - ServerConsole.MainConsole.Instance.WriteLine("Starting in Sandbox mode"); - } - else - { - OpenSim_Main.gridServers.AssetDll = "RemoteGridServers.dll"; - OpenSim_Main.gridServers.GridDll = "RemoteGridServers.dll"; - OpenSim_Main.gridServers.LoadPlugins(); - ServerConsole.MainConsole.Instance.WriteLine("Starting in Grid mode"); - } - - if(sim.loginserver && sim.sandbox) - { - LoginServer loginServer = new LoginServer(OpenSim_Main.gridServers.GridServer); - loginServer.Startup(); - } - sim.assetCache = new AssetCache(OpenSim_Main.gridServers.AssetServer); - - sim.Startup(); - - while(true) { - ServerConsole.MainConsole.Instance.MainConsolePrompt(); - } - } - - private OpenSim_Main() { - } - - private void Startup() { - startuptime=DateTime.Now; - timer1.Enabled = true; - timer1.Interval = 100; - timer1.Elapsed +=new ElapsedEventHandler( this.Timer1Tick ); - - // We check our local database first, then the grid for config options - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration"); - cfg = this.LoadConfigDll(this.ConfigDll); - cfg.InitConfig(); - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Contacting gridserver"); - cfg.LoadFromGrid(); - - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString()); - ServerConsole.MainConsole.Instance.WriteLine("Initialising world"); - local_world = cfg.LoadWorld(); - - this.physManager = new PhysicsSystem.PhysicsManager(); - this.physManager.LoadPlugins(); - 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.SetTerrain(local_world.LandMap); - 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); - - MainServerListener(); - - } - - private SimConfig LoadConfigDll(string dllName) - { - Assembly pluginAssembly = Assembly.LoadFrom(dllName); - SimConfig config = null; - - foreach (Type pluginType in pluginAssembly.GetTypes()) - { - if (pluginType.IsPublic) - { - if (!pluginType.IsAbstract) - { - Type typeInterface = pluginType.GetInterface("ISimConfig", true); - - if (typeInterface != null) - { - ISimConfig plug = (ISimConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - config = plug.GetConfigObject(); - break; - } - - typeInterface = null; - } - } - } - pluginAssembly = null; - return config; - } - - private void OnReceivedData(IAsyncResult result) { - ipeSender = new IPEndPoint(IPAddress.Any, 0); - epSender = (EndPoint)ipeSender; - Packet packet = null; - int numBytes = Server.EndReceiveFrom(result, ref epSender); - int packetEnd = numBytes - 1; - packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); - - // 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); - } - - private void MainServerListener() { - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - New thread started"); - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + cfg.IPListenAddr + ":" + cfg.IPListenPort); - - ServerIncoming = new IPEndPoint(IPAddress.Any, cfg.IPListenPort); - Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); - Server.Bind(ServerIncoming); - - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen"); - - 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); - - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Listening..."); - - } - - public static void Shutdown() { - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing all threads"); - 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"); - ServerConsole.MainConsole.Instance.Close(); - Environment.Exit(0); - } - - void Timer1Tick( object sender, System.EventArgs e ) - { - - local_world.Update(); - } - } - - public class Grid - { - public IAssetServer AssetServer; - public IGridServer GridServer; - public string AssetDll = ""; - public string GridDll = ""; - - public Grid() - { - } - - public void LoadPlugins() - { - this.AssetServer = this.LoadAssetDll(this.AssetDll); - this.GridServer = this.LoadGridDll(this.GridDll); - } - - private IAssetServer LoadAssetDll(string dllName) - { - Assembly pluginAssembly = Assembly.LoadFrom(dllName); - IAssetServer server = null; - - foreach (Type pluginType in pluginAssembly.GetTypes()) - { - if (pluginType.IsPublic) - { - if (!pluginType.IsAbstract) - { - Type typeInterface = pluginType.GetInterface("IAssetPlugin", true); - - if (typeInterface != null) - { - IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - server = plug.GetAssetServer(); - break; - } - - typeInterface = null; - } - } - } - pluginAssembly = null; - return server; - } - - private IGridServer LoadGridDll(string dllName) - { - Assembly pluginAssembly = Assembly.LoadFrom(dllName); - IGridServer server = null; - - foreach (Type pluginType in pluginAssembly.GetTypes()) - { - if (pluginType.IsPublic) - { - if (!pluginType.IsAbstract) - { - Type typeInterface = pluginType.GetInterface("IGridPlugin", true); - - if (typeInterface != null) - { - IGridPlugin plug = (IGridPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - server = plug.GetGridServer(); - break; - } - - typeInterface = null; - } - } - } - pluginAssembly = null; - return server; - } - } -} diff --git a/ConvertToPlugins/src/OpenSimClient.cs b/ConvertToPlugins/src/OpenSimClient.cs deleted file mode 100644 index 8021d59..0000000 --- a/ConvertToPlugins/src/OpenSimClient.cs +++ /dev/null @@ -1,387 +0,0 @@ -/* -Copyright (c) OpenSim project, http://osgrid.org/ -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -using System; -using System.Collections; -using System.Collections.Generic; -using libsecondlife; -using libsecondlife.Packets; -using System.Net; -using System.Net.Sockets; -using System.IO; -using System.Threading; -using System.Timers; -using OpenSim.GridServers; - -namespace OpenSim -{ - /// - /// Handles new client connections - /// Constructor takes a single Packet and authenticates everything - /// - public class OpenSimClient { - - public LLUUID AgentID; - public LLUUID SessionID; - public uint CircuitCode; - public world.Avatar ClientAvatar; - private UseCircuitCodePacket cirpack; - private Thread ClientThread; - public EndPoint userEP; - private BlockingQueue PacketQueue; - private Dictionary PendingAcks = new Dictionary(); - private Dictionary NeedAck = new Dictionary(); - private System.Timers.Timer AckTimer; - private uint Sequence = 0; - private object SequenceLock = new object(); - private const int MAX_APPENDED_ACKS = 10; - private const int RESEND_TIMEOUT = 4000; - private const int MAX_SEQUENCE = 0xFFFFFF; - - public void ack_pack(Packet Pack) { - //libsecondlife.Packets.PacketAckPacket ack_it = new PacketAckPacket(); - //ack_it.Packets = new PacketAckPacket.PacketsBlock[1]; - //ack_it.Packets[0] = new PacketAckPacket.PacketsBlock(); - //ack_it.Packets[0].ID = Pack.Header.ID; - //ack_it.Header.Reliable = false; - - //OutPacket(ack_it); - - if (Pack.Header.Reliable) { - lock (PendingAcks) { - uint sequence = (uint)Pack.Header.Sequence; - if (!PendingAcks.ContainsKey(sequence)) { PendingAcks[sequence] = sequence; } - } - } - } - - public void ProcessInPacket(Packet Pack) { - ack_pack(Pack); - switch(Pack.Type) { - case PacketType.CompleteAgentMovement: - ClientAvatar.CompleteMovement(OpenSim_Main.local_world); - ClientAvatar.SendInitialPosition(); - break; - case PacketType.RegionHandshakeReply: - OpenSim_Main.local_world.SendLayerData(this); - break; - case PacketType.AgentWearablesRequest: - ClientAvatar.SendInitialAppearance(); - break; - case PacketType.ObjectAdd: - OpenSim_Main.local_world.AddNewPrim((ObjectAddPacket)Pack, this); - break; - case PacketType.TransferRequest: - //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); - TransferRequestPacket transfer = (TransferRequestPacket)Pack; - OpenSim_Main.sim.assetCache.AddAssetRequest(this, transfer); - break; - case PacketType.AgentUpdate: - ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack); - break; - case PacketType.LogoutRequest: - ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got a logout request"); - lock(OpenSim_Main.local_world.Entities) { - OpenSim_Main.local_world.Entities.Remove(this.AgentID); - } - //need to do other cleaning up here too - OpenSim_Main.gridServers.GridServer.LogoutSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); - this.ClientThread.Abort(); - break; - case PacketType.ChatFromViewer: - ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; - if(Helpers.FieldToString(inchatpack.ChatData.Message)=="") break; - - System.Text.Encoding _enc = System.Text.Encoding.ASCII; - libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); - reply.ChatData.Audible = 1; - reply.ChatData.Message = inchatpack.ChatData.Message; - reply.ChatData.ChatType = 1; - reply.ChatData.SourceType = 1; - reply.ChatData.Position = this.ClientAvatar.position; - reply.ChatData.FromName = _enc.GetBytes(this.ClientAvatar.firstname + " " + this.ClientAvatar.lastname + "\0"); - reply.ChatData.OwnerID = this.AgentID; - reply.ChatData.SourceID = this.AgentID; - foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { - client.OutPacket(reply); - } - break; - } - } - - private void ResendUnacked() - { - int now = Environment.TickCount; - - lock (NeedAck) - { - foreach (Packet packet in NeedAck.Values) - { - if (now - packet.TickCount > RESEND_TIMEOUT) - { - ServerConsole.MainConsole.Instance.WriteLine("Resending " + packet.Type.ToString() + " packet, " + - (now - packet.TickCount) + "ms have passed"); - - packet.Header.Resent = true; - OutPacket(packet); - } - } - } - } - - private void SendAcks() - { - lock (PendingAcks) - { - if (PendingAcks.Count > 0) - { - if (PendingAcks.Count > 250) - { - // FIXME: Handle the odd case where we have too many pending ACKs queued up - ServerConsole.MainConsole.Instance.WriteLine("Too many ACKs queued up!"); - return; - } - - ServerConsole.MainConsole.Instance.WriteLine("Sending PacketAck"); - - - int i = 0; - PacketAckPacket acks = new PacketAckPacket(); - acks.Packets = new PacketAckPacket.PacketsBlock[PendingAcks.Count]; - - foreach (uint ack in PendingAcks.Values) - { - acks.Packets[i] = new PacketAckPacket.PacketsBlock(); - acks.Packets[i].ID = ack; - i++; - } - - acks.Header.Reliable = false; - OutPacket(acks); - - PendingAcks.Clear(); - } - } - } - - private void AckTimer_Elapsed(object sender, ElapsedEventArgs ea) - { - SendAcks(); - ResendUnacked(); - } - - public void ProcessOutPacket(Packet Pack) { - - // Keep track of when this packet was sent out - Pack.TickCount = Environment.TickCount; - - if (!Pack.Header.Resent) - { - // Set the sequence number - lock (SequenceLock) - { - if (Sequence >= MAX_SEQUENCE) - Sequence = 1; - else - Sequence++; - Pack.Header.Sequence = Sequence; - } - - if (Pack.Header.Reliable) //DIRTY HACK - { - lock (NeedAck) - { - if (!NeedAck.ContainsKey(Pack.Header.Sequence)) - { - NeedAck.Add(Pack.Header.Sequence, Pack); - } - else - { - // Client.Log("Attempted to add a duplicate sequence number (" + - // packet.Header.Sequence + ") to the NeedAck dictionary for packet type " + - // packet.Type.ToString(), Helpers.LogLevel.Warning); - } - } - - // Don't append ACKs to resent packets, in case that's what was causing the - // delivery to fail - if (!Pack.Header.Resent) - { - // Append any ACKs that need to be sent out to this packet - lock (PendingAcks) - { - if (PendingAcks.Count > 0 && PendingAcks.Count < MAX_APPENDED_ACKS && - Pack.Type != PacketType.PacketAck && - Pack.Type != PacketType.LogoutRequest) - { - Pack.Header.AckList = new uint[PendingAcks.Count]; - int i = 0; - - foreach (uint ack in PendingAcks.Values) - { - Pack.Header.AckList[i] = ack; - i++; - } - - PendingAcks.Clear(); - Pack.Header.AppendedAcks = true; - } - } - } - } - } - - - byte[] ZeroOutBuffer = new byte[4096]; - byte[] sendbuffer; - sendbuffer = Pack.ToBytes(); - - try { - if (Pack.Header.Zerocoded) { - int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); - OpenSim_Main.Server.SendTo(ZeroOutBuffer, packetsize, SocketFlags.None,userEP); - } else { - OpenSim_Main.Server.SendTo(sendbuffer, sendbuffer.Length, SocketFlags.None,userEP); - } - } catch (Exception) { - ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread"); - ClientThread.Abort(); - } - - } - - public void InPacket(Packet NewPack) { - // Handle appended ACKs - if (NewPack.Header.AppendedAcks) - { - lock (NeedAck) - { - foreach (uint ack in NewPack.Header.AckList) - { - NeedAck.Remove(ack); - } - } - } - - // Handle PacketAck packets - if (NewPack.Type == PacketType.PacketAck) - { - PacketAckPacket ackPacket = (PacketAckPacket)NewPack; - - lock (NeedAck) - { - foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets) - { - NeedAck.Remove(block.ID); - } - } - } else if( ( NewPack.Type == PacketType.StartPingCheck ) ) { - //reply to pingcheck - libsecondlife.Packets.StartPingCheckPacket startPing = (libsecondlife.Packets.StartPingCheckPacket)NewPack; - libsecondlife.Packets.CompletePingCheckPacket endPing = new CompletePingCheckPacket(); - endPing.PingID.PingID = startPing.PingID.PingID; - OutPacket(endPing); - } - else - { - QueItem item = new QueItem(); - item.Packet = NewPack; - item.Incoming = true; - this.PacketQueue.Enqueue(item); - } - - } - - public void OutPacket(Packet NewPack) { - QueItem item = new QueItem(); - item.Packet = NewPack; - item.Incoming = false; - this.PacketQueue.Enqueue(item); - } - - public OpenSimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack) { - ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request"); - cirpack = initialcirpack; - userEP = remoteEP; - PacketQueue = new BlockingQueue(); - AckTimer = new System.Timers.Timer(500); - AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); - AckTimer.Start(); - - ClientThread = new Thread(new ThreadStart(AuthUser)); - ClientThread.IsBackground = true; - ClientThread.Start(); - } - - private void ClientLoop() { - ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:ClientLoop() - Entered loop"); - while(true) { - QueItem nextPacket = PacketQueue.Dequeue(); - if(nextPacket.Incoming) - { - //is a incoming packet - ProcessInPacket(nextPacket.Packet); - } - else - { - //is a out going packet - ProcessOutPacket(nextPacket.Packet); - } - } - } - - private void InitNewClient() { - ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); - OpenSim_Main.local_world.AddViewerAgent(this); - world.Entity tempent=OpenSim_Main.local_world.Entities[this.AgentID]; - this.ClientAvatar=(world.Avatar)tempent; - } - - private void AuthUser() - { - AuthenticateResponse sessionInfo = OpenSim_Main.gridServers.GridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); - if(!sessionInfo.Authorised) - { - //session/circuit not authorised - ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString()); - ClientThread.Abort(); - } - else - { - ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString()); - //session is authorised - this.AgentID=cirpack.CircuitCode.ID; - this.SessionID=cirpack.CircuitCode.SessionID; - this.CircuitCode=cirpack.CircuitCode.Code; - InitNewClient(); - this.ClientAvatar.firstname = sessionInfo.LoginInfo.First; - this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last; - ClientLoop(); - } - } - } - -} diff --git a/ConvertToPlugins/src/OpenSimConsole.cs b/ConvertToPlugins/src/OpenSimConsole.cs deleted file mode 100644 index 7d8563f..0000000 --- a/ConvertToPlugins/src/OpenSimConsole.cs +++ /dev/null @@ -1,194 +0,0 @@ -/* -* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Threading; -using System.IO; -using System.Net; -using libsecondlife; -using libsecondlife.Packets; -using ServerConsole; - -namespace OpenSim -{ - /// - /// Description of ServerConsole. - /// - public class MServerConsole : ConsoleBase - { - - private ConsoleType ConsType; - StreamWriter Log; - - - // STUPID HACK ALERT!!!! STUPID HACK ALERT!!!!! - // constype - the type of console to use (see enum ConsoleType) - // sparam - depending on the console type: - // TCP - the IP to bind to (127.0.0.1 if blank) - // Local - param ignored - // SimChat - the AgentID of this sim's admin - // and for the iparam: - // TCP - the port to bind to - // Local - param ignored - // SimChat - the chat channel to accept commands from - public MServerConsole(ConsoleType constype, string sparam, int iparam) { - ConsType = constype; - switch(constype) { - case ConsoleType.Local: - Console.WriteLine("ServerConsole.cs - creating new local console"); - Console.WriteLine("Logs will be saved to current directory in opensim-console.log"); - Log=File.AppendText("opensim-console.log"); - Log.WriteLine("========================================================================"); - //Log.WriteLine("OpenSim " + VersionInfo.Version + " Started at " + DateTime.Now.ToString()); - break; - case ConsoleType.TCP: - break; - case ConsoleType.SimChat: - break; - - default: - Console.WriteLine("ServerConsole.cs - what are you smoking? that isn't a valid console type!"); - break; - } - } - - public override void Close() { - Log.WriteLine("OpenSim shutdown at " + DateTime.Now.ToString()); - Log.Close(); - } - - // You know what ReadLine() and WriteLine() do, right? And Read() and Write()? Right, you do actually know C#, right? Are you actually a programmer? Do you know english? Do you find my sense of humour in comments irritating? Good, glad you're still here - public override void WriteLine(string Line) { - Log.WriteLine(Line); - Console.WriteLine(Line); - return; - } - - public override string ReadLine() { - string TempStr=Console.ReadLine(); - Log.WriteLine(TempStr); - return TempStr; - } - - public override int Read() { - int TempInt= Console.Read(); - Log.Write((char)TempInt); - return TempInt; - } - - public override void Write(string Line) { - Console.Write(Line); - Log.Write(Line); - return; - } - - // Displays a command prompt and waits for the user to enter a string, then returns that string - public override string CmdPrompt(string prompt) { - this.Write(prompt); - return this.ReadLine(); - } - - // Displays a command prompt and returns a default value if the user simply presses enter - public override string CmdPrompt(string prompt, string defaultresponse) { - string temp=CmdPrompt(prompt); - if(temp=="") { - return defaultresponse; - } else { - return temp; - } - } - - // Displays a command prompt and returns a default value, user may only enter 1 of 2 options - public override string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB) { - bool itisdone=false; - string temp=CmdPrompt(prompt,defaultresponse); - while(itisdone==false) { - if((temp==OptionA) || (temp==OptionB)) { - itisdone=true; - } else { - this.WriteLine("Valid options are " + OptionA + " or " + OptionB); - temp=CmdPrompt(prompt,defaultresponse); - } - } - return temp; - } - - // Runs a command with a number of parameters - public override Object RunCmd(string Cmd, string[] cmdparams) { - switch(Cmd) { - case "help": - this.WriteLine("show users - show info about connected users"); - this.WriteLine("shutdown - disconnect all clients and shutdown"); - break; - - case "show": - ShowCommands(cmdparams[0]); - break; - - case "shutdown": - OpenSim_Main.Shutdown(); - break; - } - return null; - } - - // Shows data about something - public override void ShowCommands(string ShowWhat) { - switch(ShowWhat) { - case "uptime": - this.WriteLine("OpenSim has been running since " + OpenSim_Main.sim.startuptime.ToString()); - this.WriteLine("That is " + (DateTime.Now-OpenSim_Main.sim.startuptime).ToString()); - break; - case "users": - OpenSim.world.Avatar TempAv; - this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}","Firstname", "Lastname","Agent ID", "Session ID", "Circuit", "IP")); - foreach (libsecondlife.LLUUID UUID in OpenSim_Main.local_world.Entities.Keys) { - TempAv=(OpenSim.world.Avatar)OpenSim_Main.local_world.Entities[UUID]; - this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}",TempAv.firstname, TempAv.lastname,UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString())); - } - break; - } - } - - // Displays a prompt to the user and then runs the command they entered - public override void MainConsolePrompt() { - string[] tempstrarray; - string tempstr = this.CmdPrompt("OpenSim-" + OpenSim_Main.cfg.RegionHandle.ToString() + " # "); - tempstrarray = tempstr.Split(' '); - string cmd=tempstrarray[0]; - Array.Reverse(tempstrarray); - Array.Resize(ref tempstrarray,tempstrarray.Length-1); - Array.Reverse(tempstrarray); - string[] cmdparams=(string[])tempstrarray; - RunCmd(cmd,cmdparams); - } - } -} - - diff --git a/ConvertToPlugins/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs b/ConvertToPlugins/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs deleted file mode 100644 index 0fa7d6e..0000000 --- a/ConvertToPlugins/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("RemoteGridServers")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("RemoteGridServers")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 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.*")] diff --git a/ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGrid.cs b/ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGrid.cs deleted file mode 100644 index f7c33e8..0000000 --- a/ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGrid.cs +++ /dev/null @@ -1,241 +0,0 @@ -/* -* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Threading; -using System.Net; -using System.Net.Sockets; -using System.IO; -using libsecondlife; -using OpenSim.GridServers; - -namespace RemoteGridServers -{ - /// - /// - /// - /// - - public class RemoteGridPlugin : IGridPlugin - { - public RemoteGridPlugin() - { - - } - - public IGridServer GetGridServer() - { - return(new RemoteGridServer()); - } - } - - public class RemoteAssetPlugin : IAssetPlugin - { - public RemoteAssetPlugin() - { - - } - - public IAssetServer GetAssetServer() - { - return(new RemoteAssetServer()); - } - } - public class RemoteGridServer :IGridServer - { - private string GridServerUrl; - private string GridSendKey; - - public RemoteGridServer() - { - ServerConsole.MainConsole.Instance.WriteLine("Remote Grid Server class created"); - } - - public bool RequestConnection() - { - return true; - } - public AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) - { - AuthenticateResponse user = new AuthenticateResponse(); - - WebRequest CheckSession = WebRequest.Create(GridServerUrl + "/usersessions/" + GridSendKey + "/" + agentID.ToString() + "/" + circuitCode.ToString() + "/exists"); - WebResponse GridResponse = CheckSession.GetResponse(); - StreamReader sr = new StreamReader(GridResponse.GetResponseStream()); - String grTest = sr.ReadLine(); - sr.Close(); - GridResponse.Close(); - if(String.IsNullOrEmpty(grTest) || grTest.Equals("1")) - { - // YAY! Valid login - user.Authorised = true; - user.LoginInfo = new Login(); - user.LoginInfo.Agent = agentID; - user.LoginInfo.Session = sessionID; - user.LoginInfo.First = ""; - user.LoginInfo.Last = ""; - - } - else - { - // Invalid - user.Authorised = false; - } - - return(user); - } - - public bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) - { - WebRequest DeleteSession = WebRequest.Create(GridServerUrl + "/usersessions/" + GridSendKey + "/" + agentID.ToString() + circuitCode.ToString() + "/delete"); - WebResponse GridResponse = DeleteSession.GetResponse(); - StreamReader sr = new StreamReader(GridResponse.GetResponseStream()); - String grTest = sr.ReadLine(); - sr.Close(); - GridResponse.Close(); - ServerConsole.MainConsole.Instance.WriteLine("DEBUG: " + grTest); - return(true); - } - - public UUIDBlock RequestUUIDBlock() - { - UUIDBlock uuidBlock = new UUIDBlock(); - return(uuidBlock); - } - - public void RequestNeighbours() - { - return; - } - - public void SetServerInfo(string ServerUrl, string ServerKey) - { - this.GridServerUrl = ServerUrl; - this.GridSendKey = ServerKey; - } - - public void AddNewSession(Login session) - { - - } - } - - - public class RemoteAssetServer : IAssetServer - { - private IAssetReceiver _receiver; - private BlockingQueue _assetRequests; - private Thread _remoteAssetServerThread; - private string AssetServerUrl; - private string AssetSendKey; - - public RemoteAssetServer() - { - this._assetRequests = new BlockingQueue(); - this._remoteAssetServerThread = new Thread(new ThreadStart(RunRequests)); - this._remoteAssetServerThread.IsBackground = true; - this._remoteAssetServerThread.Start(); - ServerConsole.MainConsole.Instance.WriteLine("Remote Asset Server class created"); - } - - public void SetReceiver(IAssetReceiver receiver) - { - this._receiver = receiver; - } - - public void RequestAsset(LLUUID assetID, bool isTexture) - { - ARequest req = new ARequest(); - req.AssetID = assetID; - req.IsTexture = isTexture; - this._assetRequests.Enqueue(req); - } - - public void UpdateAsset(AssetBase asset) - { - - } - - public void UploadNewAsset(AssetBase asset) - { - - } - - public void SetServerInfo(string ServerUrl, string ServerKey) - { - this.AssetServerUrl = ServerUrl; - this.AssetSendKey = ServerKey; - } - - private void RunRequests() - { - while(true) - { - //we need to add support for the asset server not knowing about a requested asset - ARequest req = this._assetRequests.Dequeue(); - LLUUID assetID = req.AssetID; - ServerConsole.MainConsole.Instance.WriteLine(" RemoteAssetServer- Got a AssetServer request, processing it"); - WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "getasset/" + AssetSendKey + "/" + assetID + "/data"); - WebResponse AssetResponse = AssetLoad.GetResponse(); - byte[] idata = new byte[(int)AssetResponse.ContentLength]; - BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream()); - idata = br.ReadBytes((int)AssetResponse.ContentLength); - br.Close(); - - AssetBase asset = new AssetBase(); - asset.FullID = assetID; - asset.Data = idata; - _receiver.AssetReceived(asset, req.IsTexture ); - } - } - } - - public class BlockingQueue< T > { - private Queue< T > _queue = new Queue< T >(); - private object _queueSync = new object(); - - public void Enqueue(T value) - { - lock(_queueSync) - { - _queue.Enqueue(value); - Monitor.Pulse(_queueSync); - } - } - - public T Dequeue() - { - lock(_queueSync) - { - if( _queue.Count < 1) - Monitor.Wait(_queueSync); - - return _queue.Dequeue(); - } - } - } -} diff --git a/ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj b/ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj deleted file mode 100644 index 6fc1e5a..0000000 --- a/ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj +++ /dev/null @@ -1,49 +0,0 @@ - - - Library - RemoteGridServers - RemoteGridServers - Debug - AnyCPU - {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5} - - - bin\Debug\ - False - DEBUG;TRACE - True - Full - True - - - bin\Release\ - True - TRACE - False - None - False - - - - - - ..\..\..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll - False - - - - - - - - - {C9A6026D-8E0C-4FE4-8691-FB2A566AA245} - ServerConsole - - - {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9} - GridInterfaces - - - - \ No newline at end of file diff --git a/ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGridServers.sln b/ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGridServers.sln deleted file mode 100644 index a990022..0000000 --- a/ConvertToPlugins/src/RemoteServers/RemoteGridServers/RemoteGridServers.sln +++ /dev/null @@ -1,7 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# SharpDevelop 2.1.0.2017 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteGridServers", "RemoteGridServers.csproj", "{CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}" -EndProject -Global -EndGlobal diff --git a/ConvertToPlugins/src/RemoteServers/default.build b/ConvertToPlugins/src/RemoteServers/default.build deleted file mode 100644 index 8819600..0000000 --- a/ConvertToPlugins/src/RemoteServers/default.build +++ /dev/null @@ -1,51 +0,0 @@ - - - nant buildfile for OpenSim - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ConvertToPlugins/src/Second-server.csproj b/ConvertToPlugins/src/Second-server.csproj deleted file mode 100644 index dfb5168..0000000 --- a/ConvertToPlugins/src/Second-server.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - Exe - OpenSim - OpenSim - Debug - AnyCPU - {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E} - OpenSim.OpenSim_Main - False - False - 4 - false - - - bin\ - False - DEBUG;TRACE - true - Full - True - - - ..\bin\ - True - TRACE - False - None - False - - - False - Auto - 4194304 - AnyCPU - 4096 - - - - - - - ..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll - False - - - ..\..\..\..\..\Opensim-pluginsystem\bin\Axiom.MathLib.dll - False - - - ..\bin\log4net.dll - False - - - - - - - - - - - - - - - - - - - - - - - - - - - {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9} - GridInterfaces - - - {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B} - PhysicsManager - - - {C9A6026D-8E0C-4FE4-8691-FB2A566AA245} - ServerConsole - - - - \ No newline at end of file diff --git a/ConvertToPlugins/src/Second-server.sln b/ConvertToPlugins/src/Second-server.sln deleted file mode 100644 index 96755ee..0000000 --- a/ConvertToPlugins/src/Second-server.sln +++ /dev/null @@ -1,96 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# SharpDevelop 2.1.0.2017 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Second-server", "Second-server.csproj", "{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimConfig", "Config\SimConfig\SimConfig.csproj", "{B063760D-DB8D-4F64-B6FE-335FAD1E650A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalGridServers", "LocalServers\LocalGridServers\LocalGridServers.csproj", "{D7F0395B-FADC-4936-80A0-D95AACE92F62}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteGridServers", "RemoteServers\RemoteGridServers\RemoteGridServers.csproj", "{CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GridInterfaces", "GridInterfaces\GridInterfaces.csproj", "{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysicsManager", "physics\PhysicsManager.csproj", "{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysXplugin", "physics\plugins\PhysXplugin.csproj", "{ADB751AA-8426-4668-B1FA-43762126CEB3}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerConsole", "ServerConsole\ServerConsole\ServerConsole.csproj", "{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|.NET 1.1 = Debug|.NET 1.1 - Debug|Any CPU = Debug|Any CPU - Release|.NET 1.1 = Release|.NET 1.1 - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|.NET 1.1.ActiveCfg = Debug|Any CPU - {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|.NET 1.1.Build.0 = Debug|Any CPU - {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|.NET 1.1.ActiveCfg = Release|Any CPU - {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|.NET 1.1.Build.0 = Release|.NET 1.1 - {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|Any CPU.Build.0 = Release|Any CPU - {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Debug|.NET 1.1.Build.0 = Debug|.NET 1.1 - {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Debug|.NET 1.1.ActiveCfg = Debug|.NET 1.1 - {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Release|.NET 1.1.Build.0 = Release|.NET 1.1 - {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1 - {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Release|Any CPU.Build.0 = Release|Any CPU - {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Debug|.NET 1.1.Build.0 = Debug|.NET 1.1 - {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Debug|.NET 1.1.ActiveCfg = Debug|.NET 1.1 - {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Release|.NET 1.1.Build.0 = Release|.NET 1.1 - {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1 - {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Release|Any CPU.Build.0 = Release|Any CPU - {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Debug|.NET 1.1.Build.0 = Debug|.NET 1.1 - {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Debug|.NET 1.1.ActiveCfg = Debug|.NET 1.1 - {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Release|.NET 1.1.Build.0 = Release|.NET 1.1 - {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1 - {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Release|Any CPU.Build.0 = Release|Any CPU - {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Debug|.NET 1.1.Build.0 = Debug|.NET 1.1 - {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Debug|.NET 1.1.ActiveCfg = Debug|.NET 1.1 - {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Release|.NET 1.1.Build.0 = Release|.NET 1.1 - {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1 - {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Release|Any CPU.Build.0 = Release|Any CPU - {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|.NET 1.1.Build.0 = Debug|.NET 1.1 - {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|.NET 1.1.ActiveCfg = Debug|.NET 1.1 - {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|.NET 1.1.Build.0 = Release|.NET 1.1 - {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1 - {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|Any CPU.Build.0 = Release|Any CPU - {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ADB751AA-8426-4668-B1FA-43762126CEB3}.Debug|.NET 1.1.Build.0 = Debug|.NET 1.1 - {ADB751AA-8426-4668-B1FA-43762126CEB3}.Debug|.NET 1.1.ActiveCfg = Debug|.NET 1.1 - {ADB751AA-8426-4668-B1FA-43762126CEB3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ADB751AA-8426-4668-B1FA-43762126CEB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|.NET 1.1.Build.0 = Release|.NET 1.1 - {ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1 - {ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|Any CPU.Build.0 = Release|Any CPU - {ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Debug|.NET 1.1.Build.0 = Debug|.NET 1.1 - {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Debug|.NET 1.1.ActiveCfg = Debug|.NET 1.1 - {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|.NET 1.1.Build.0 = Release|.NET 1.1 - {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1 - {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|Any CPU.Build.0 = Release|Any CPU - {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|Any CPU.ActiveCfg = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/ConvertToPlugins/src/ServerConsole/ServerConsole/AssemblyInfo.cs b/ConvertToPlugins/src/ServerConsole/ServerConsole/AssemblyInfo.cs deleted file mode 100644 index 00a9b7d..0000000 --- a/ConvertToPlugins/src/ServerConsole/ServerConsole/AssemblyInfo.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("ServerConsole")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ServerConsole")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 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.*")] diff --git a/ConvertToPlugins/src/ServerConsole/ServerConsole/ServerConsole.cs b/ConvertToPlugins/src/ServerConsole/ServerConsole/ServerConsole.cs deleted file mode 100644 index 93c8114..0000000 --- a/ConvertToPlugins/src/ServerConsole/ServerConsole/ServerConsole.cs +++ /dev/null @@ -1,91 +0,0 @@ -/* -* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; - -namespace ServerConsole -{ - public class MainConsole { - - private static ConsoleBase instance; - - public static ConsoleBase Instance - { - get - { - return instance; - } - set - { - instance = value; - } - } - - public MainConsole() - { - - } - } - - public abstract class ConsoleBase - { - - public enum ConsoleType { - Local, // Use stdio - TCP, // Use TCP/telnet - SimChat // Use in-world chat (for gods) - } - - public abstract void Close(); - - // You know what ReadLine() and WriteLine() do, right? And Read() and Write()? Right, you do actually know C#, right? Are you actually a programmer? Do you know english? Do you find my sense of humour in comments irritating? Good, glad you're still here - public abstract void WriteLine(string Line) ; - - public abstract string ReadLine(); - - public abstract int Read() ; - - public abstract void Write(string Line) ; - - // Displays a command prompt and waits for the user to enter a string, then returns that string - public abstract string CmdPrompt(string prompt) ; - - // Displays a command prompt and returns a default value if the user simply presses enter - public abstract string CmdPrompt(string prompt, string defaultresponse); - - // Displays a command prompt and returns a default value, user may only enter 1 of 2 options - public abstract string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB) ; - - // Runs a command with a number of parameters - public abstract Object RunCmd(string Cmd, string[] cmdparams) ; - - // Shows data about something - public abstract void ShowCommands(string ShowWhat) ; - - // Displays a prompt to the user and then runs the command they entered - public abstract void MainConsolePrompt() ; - } -} diff --git a/ConvertToPlugins/src/ServerConsole/ServerConsole/ServerConsole.csproj b/ConvertToPlugins/src/ServerConsole/ServerConsole/ServerConsole.csproj deleted file mode 100644 index 3d85860..0000000 --- a/ConvertToPlugins/src/ServerConsole/ServerConsole/ServerConsole.csproj +++ /dev/null @@ -1,35 +0,0 @@ - - - Library - ServerConsole - ServerConsole - Debug - AnyCPU - {C9A6026D-8E0C-4FE4-8691-FB2A566AA245} - - - bin\Debug\ - False - DEBUG;TRACE - True - Full - True - - - bin\Release\ - True - TRACE - False - None - False - - - - - - - - - - - \ No newline at end of file diff --git a/ConvertToPlugins/src/ServerConsole/ServerConsole/ServerConsole.sln b/ConvertToPlugins/src/ServerConsole/ServerConsole/ServerConsole.sln deleted file mode 100644 index 07445db..0000000 --- a/ConvertToPlugins/src/ServerConsole/ServerConsole/ServerConsole.sln +++ /dev/null @@ -1,7 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# SharpDevelop 2.1.0.2017 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerConsole", "ServerConsole.csproj", "{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}" -EndProject -Global -EndGlobal diff --git a/ConvertToPlugins/src/ServerConsole/default.build b/ConvertToPlugins/src/ServerConsole/default.build deleted file mode 100644 index a6f6dc2..0000000 --- a/ConvertToPlugins/src/ServerConsole/default.build +++ /dev/null @@ -1,48 +0,0 @@ - - - nant buildfile for OpenSim - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ConvertToPlugins/src/Util.cs b/ConvertToPlugins/src/Util.cs deleted file mode 100644 index d575bee..0000000 --- a/ConvertToPlugins/src/Util.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright (c) OpenSim project, http://osgrid.org/ - -* Copyright (c) , -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -using System; -using System.Collections.Generic; -using System.Threading; -using libsecondlife; -using libsecondlife.Packets; - -namespace OpenSim -{ - /// - /// - /// - public class Util - { - public static ulong UIntsToLong(uint X, uint Y) - { - return Helpers.UIntsToLong(X,Y); - } - public Util() - { - - } - } - - public class QueItem { - public QueItem() - { - } - - public Packet Packet; - public bool Incoming; - } - - - public class BlockingQueue< T > { - private Queue< T > _queue = new Queue< T >(); - private object _queueSync = new object(); - - public void Enqueue(T value) - { - lock(_queueSync) - { - _queue.Enqueue(value); - Monitor.Pulse(_queueSync); - } - } - - public T Dequeue() - { - lock(_queueSync) - { - if( _queue.Count < 1) - Monitor.Wait(_queueSync); - - return _queue.Dequeue(); - } - } - } -} diff --git a/ConvertToPlugins/src/VersionInfo.cs b/ConvertToPlugins/src/VersionInfo.cs deleted file mode 100644 index 949462c..0000000 --- a/ConvertToPlugins/src/VersionInfo.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* -Copyright (c) OpenSim project, http://osgrid.org/ -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -using System; - -namespace OpenSim -{ - /// - /// - public class VersionInfo - { - public static string Version = "0.1, Build 1173288035, Revision 148M"; - } -} diff --git a/ConvertToPlugins/src/VersionInfo.cs.template b/ConvertToPlugins/src/VersionInfo.cs.template deleted file mode 100644 index e4e1b95..0000000 --- a/ConvertToPlugins/src/VersionInfo.cs.template +++ /dev/null @@ -1,37 +0,0 @@ -/* -Copyright (c) OpenSim project, http://osgrid.org/ -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -using System; - -namespace OpenSim -{ - /// - /// - public class VersionInfo - { - public static string Version = "@@VERSION"; - } -} diff --git a/ConvertToPlugins/src/physics/AssemblyInfo.cs b/ConvertToPlugins/src/physics/AssemblyInfo.cs deleted file mode 100644 index 57a8913..0000000 --- a/ConvertToPlugins/src/physics/AssemblyInfo.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("PhysicsManager")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("PhysicsManager")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 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.*")] diff --git a/ConvertToPlugins/src/physics/PhysicsManager.cs b/ConvertToPlugins/src/physics/PhysicsManager.cs deleted file mode 100644 index 0986501..0000000 --- a/ConvertToPlugins/src/physics/PhysicsManager.cs +++ /dev/null @@ -1,167 +0,0 @@ -/* -* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Collections; -using System.IO; -using System.Reflection; - -namespace PhysicsSystem -{ - /// - /// Description of MyClass. - /// - public class PhysicsManager - { - private Dictionary _plugins=new Dictionary(); - - public PhysicsManager() - { - - } - - public PhysicsScene GetPhysicsScene(string engineName) - { - if(_plugins.ContainsKey(engineName)) - { - ServerConsole.MainConsole.Instance.WriteLine("creating "+engineName); - return _plugins[engineName].GetScene(); - } - else - { - ServerConsole.MainConsole.Instance.WriteLine("couldn't find physicsEngine: "+ engineName); - return null; - } - } - - public void LoadPlugins() - { - string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory ,"Physics"); - string[] pluginFiles = Directory.GetFiles(path, "*.dll"); - - - for(int i= 0; i - - Library - PhysicsManager - PhysicsManager - Debug - AnyCPU - {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B} - - - bin\Debug\ - False - DEBUG;TRACE - True - Full - True - - - bin\Release\ - True - TRACE - False - None - False - - - - - - - - - - - - {C9A6026D-8E0C-4FE4-8691-FB2A566AA245} - ServerConsole - - - - \ No newline at end of file diff --git a/ConvertToPlugins/src/physics/PhysicsManager.sln b/ConvertToPlugins/src/physics/PhysicsManager.sln deleted file mode 100644 index 565813f..0000000 --- a/ConvertToPlugins/src/physics/PhysicsManager.sln +++ /dev/null @@ -1,23 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# SharpDevelop 2.1.0.2017 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysicsManager", "PhysicsManager.csproj", "{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysXplugin", "..\PhysXplugin\PhysXplugin\PhysXplugin.csproj", "{ADB751AA-8426-4668-B1FA-43762126CEB3}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|Any CPU.Build.0 = Release|Any CPU - {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ADB751AA-8426-4668-B1FA-43762126CEB3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ADB751AA-8426-4668-B1FA-43762126CEB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|Any CPU.Build.0 = Release|Any CPU - {ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|Any CPU.ActiveCfg = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/ConvertToPlugins/src/physics/default.build b/ConvertToPlugins/src/physics/default.build deleted file mode 100644 index d39e62b..0000000 --- a/ConvertToPlugins/src/physics/default.build +++ /dev/null @@ -1,49 +0,0 @@ - - - nant buildfile for OpenSim - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ConvertToPlugins/src/physics/plugins/AssemblyInfo.cs b/ConvertToPlugins/src/physics/plugins/AssemblyInfo.cs deleted file mode 100644 index 0c9c06c..0000000 --- a/ConvertToPlugins/src/physics/plugins/AssemblyInfo.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("PhysXplugin")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("PhysXplugin")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 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.*")] diff --git a/ConvertToPlugins/src/physics/plugins/PhysXplugin.cs b/ConvertToPlugins/src/physics/plugins/PhysXplugin.cs deleted file mode 100644 index 58a82fb..0000000 --- a/ConvertToPlugins/src/physics/plugins/PhysXplugin.cs +++ /dev/null @@ -1,199 +0,0 @@ -/* -* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using PhysicsSystem; - -namespace PhysXplugin -{ - /// - /// Will be the PhysX plugin but for now will be a very basic physics engine - /// - public class PhysXPlugin : IPhysicsPlugin - { - private PhysXScene _mScene; - - public PhysXPlugin() - { - - } - - public bool Init() - { - return true; - } - - public PhysicsScene GetScene() - { - if(_mScene == null) - { - _mScene = new PhysXScene(); - } - return(_mScene); - } - - public string GetName() - { - return("PhysX"); - } - - public void Dispose() - { - - } - } - - public class PhysXScene :PhysicsScene - { - private List _actors = new List(); - private float[] _heightMap; - - public PhysXScene() - { - - } - - public override PhysicsActor AddAvatar(PhysicsVector position) - { - PhysXActor act = new PhysXActor(); - act.Position = position; - _actors.Add(act); - return act; - } - - public override void Simulate(float timeStep) - { - foreach (PhysXActor actor in _actors) - { - actor.Position.X = actor.Position.X + actor.Velocity.X * timeStep; - actor.Position.Y = actor.Position.Y + actor.Velocity.Y * timeStep; - actor.Position.Z = actor.Position.Z + actor.Velocity.Z * timeStep; - actor.Position.Z = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X]+1; - if(actor.Position.X<0) - { - actor.Position.X = 0; - actor.Velocity.X = 0; - } - if(actor.Position.Y < 0) - { - actor.Position.Y = 0; - actor.Velocity.Y = 0; - } - if(actor.Position.X > 255) - { - actor.Position.X = 255; - actor.Velocity.X = 0; - } - if(actor.Position.Y > 255) - { - actor.Position.Y = 255; - actor.Velocity.X = 0; - } - } - } - - public override void GetResults() - { - - } - - public override bool IsThreaded - { - get - { - return(false); // for now we won't be multithreaded - } - } - - public override void SetTerrain(float[] heightMap) - { - this._heightMap = heightMap; - } - } - - public class PhysXActor : PhysicsActor - { - private PhysicsVector _position; - private PhysicsVector _velocity; - private PhysicsVector _acceleration; - - public PhysXActor() - { - _velocity = new PhysicsVector(); - _position = new PhysicsVector(); - _acceleration = new PhysicsVector(); - } - - public override PhysicsVector Position - { - get - { - return _position; - } - set - { - _position = value; - } - } - - public override PhysicsVector Velocity - { - get - { - return _velocity; - } - set - { - _velocity = value; - } - } - - public override PhysicsVector Acceleration - { - get - { - return _acceleration; - } - - } - public void SetAcceleration (PhysicsVector accel) - { - this._acceleration = accel; - } - - public override void AddForce(PhysicsVector force) - { - - } - - public override void SetMomentum(PhysicsVector momentum) - { - - } - } - -} diff --git a/ConvertToPlugins/src/physics/plugins/PhysXplugin.csproj b/ConvertToPlugins/src/physics/plugins/PhysXplugin.csproj deleted file mode 100644 index 1b84046..0000000 --- a/ConvertToPlugins/src/physics/plugins/PhysXplugin.csproj +++ /dev/null @@ -1,41 +0,0 @@ - - - Library - PhysXplugin - PhysXplugin - Debug - AnyCPU - {ADB751AA-8426-4668-B1FA-43762126CEB3} - - - bin\Debug\ - False - DEBUG;TRACE - True - Full - True - - - bin\Release\ - True - TRACE - False - None - False - - - - - - - - - - - - {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B} - PhysicsManager - - - - \ No newline at end of file diff --git a/ConvertToPlugins/src/physics/plugins/PhysXplugin.sln b/ConvertToPlugins/src/physics/plugins/PhysXplugin.sln deleted file mode 100644 index 06e73d1..0000000 --- a/ConvertToPlugins/src/physics/plugins/PhysXplugin.sln +++ /dev/null @@ -1,17 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# SharpDevelop 2.1.0.2017 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysXplugin", "PhysXplugin.csproj", "{ADB751AA-8426-4668-B1FA-43762126CEB3}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {ADB751AA-8426-4668-B1FA-43762126CEB3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ADB751AA-8426-4668-B1FA-43762126CEB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|Any CPU.Build.0 = Release|Any CPU - {ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|Any CPU.ActiveCfg = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/ConvertToPlugins/src/physics/plugins/default.build b/ConvertToPlugins/src/physics/plugins/default.build deleted file mode 100644 index c40fea1..0000000 --- a/ConvertToPlugins/src/physics/plugins/default.build +++ /dev/null @@ -1,49 +0,0 @@ - - - nant buildfile for OpenSim - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ConvertToPlugins/src/types/Mesh.cs b/ConvertToPlugins/src/types/Mesh.cs deleted file mode 100644 index 3e00c91..0000000 --- a/ConvertToPlugins/src/types/Mesh.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.types -{ - // TODO: This will need some performance tuning no doubt. - public class Mesh - { - public List mesh; - - public Mesh() - { - mesh = new List(); - } - - public void AddTri(Triangle tri) - { - mesh.Add(tri); - } - - public static Mesh operator +(Mesh a, Mesh b) - { - a.mesh.AddRange(b.mesh); - return a; - } - } -} diff --git a/ConvertToPlugins/src/types/Triangle.cs b/ConvertToPlugins/src/types/Triangle.cs deleted file mode 100644 index 8dfea6e..0000000 --- a/ConvertToPlugins/src/types/Triangle.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Axiom.MathLib; - -namespace OpenSim.types -{ - public class Triangle - { - Vector3 a; - Vector3 b; - Vector3 c; - - public Triangle() - { - a = new Vector3(); - b = new Vector3(); - c = new Vector3(); - } - - public Triangle(Vector3 A, Vector3 B, Vector3 C) - { - a = A; - b = B; - c = C; - } - } -} diff --git a/ConvertToPlugins/src/world/Avatar.cs b/ConvertToPlugins/src/world/Avatar.cs deleted file mode 100644 index c8469f8..0000000 --- a/ConvertToPlugins/src/world/Avatar.cs +++ /dev/null @@ -1,355 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using libsecondlife; -using libsecondlife.Packets; -using PhysicsSystem; -using Axiom.MathLib; - -namespace OpenSim.world -{ - public class Avatar : Entity - { - public string firstname; - public string lastname; - public OpenSimClient ControllingClient; - private PhysicsActor _physActor; - private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; - private bool updateflag; - private bool walking; - private List forcesList = new List(); - private short _updateCount; - - public Avatar(OpenSimClient TheClient) { - ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); - ControllingClient=TheClient; - SetupTemplate("avatar-template.dat"); - 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 - { - set - { - this._physActor = value; - } - } - public override void addForces() - { - lock(this.forcesList) - { - if(this.forcesList.Count>0) - { - for(int i=0 ; i < this.forcesList.Count; i++) - { - NewForce force = this.forcesList[i]; - PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z); - this._physActor.Velocity = phyVector; - this.updateflag = true; - this.velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this - // but as we are setting the velocity (rather than using real forces) at the moment it is okay. - } - for(int i=0 ; i < this.forcesList.Count; i++) - { - this.forcesList.RemoveAt(0); - } - } - } - } - - public override void update() - { - - if(this.updateflag) - { - //need to send movement info - //so create the improvedterseobjectupdate packet - //use CreateTerseBlock() - ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); - ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); - terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME - terse.RegionData.TimeDilation = 64096; - terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; - terse.ObjectData[0] = terseBlock; - foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { - client.OutPacket(terse); - } - - updateflag =false; - this._updateCount = 0; - } - else - { - if(walking) - { - _updateCount++; - if(_updateCount>3) - { - //It has been a while since last update was sent so lets send one. - ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); - ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); - terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME - terse.RegionData.TimeDilation = 64096; - terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; - terse.ObjectData[0] = terseBlock; - foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { - client.OutPacket(terse); - } - _updateCount = 0; - } - } - } - } - - private void SetupTemplate(string name) - { - - int i = 0; - FileInfo fInfo = new FileInfo(name); - long numBytes = fInfo.Length; - FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); - BinaryReader br = new BinaryReader(fStream); - byte [] data1 = br.ReadBytes((int)numBytes); - br.Close(); - fStream.Close(); - - libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); - - System.Text.Encoding enc = System.Text.Encoding.ASCII; - libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16); - pos.X = 100f; - objdata.ID = 8880000; - objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0"); - libsecondlife.LLVector3 pos2 = new LLVector3(100f,100f,23f); - //objdata.FullID=user.AgentID; - byte[] pb = pos.GetBytes(); - Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length); - - AvatarTemplate = objdata; - - } - - public void CompleteMovement(World RegionInfo) { - ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet"); - AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); - mov.AgentData.SessionID = this.ControllingClient.SessionID; - mov.AgentData.AgentID = this.ControllingClient.AgentID; - mov.Data.RegionHandle = OpenSim_Main.cfg.RegionHandle; - // TODO - dynamicalise this stuff - mov.Data.Timestamp = 1172750370; - mov.Data.Position = new LLVector3(100f, 100f, 23f); - mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0); - - ControllingClient.OutPacket(mov); - } - - public void SendInitialPosition() { - - System.Text.Encoding _enc = System.Text.Encoding.ASCII; - //send a objectupdate packet with information about the clients avatar - ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); - objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; - objupdate.RegionData.TimeDilation = 64096; - objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; - - objupdate.ObjectData[0] = AvatarTemplate; - //give this avatar object a local id and assign the user a name - objupdate.ObjectData[0].ID = this.localid; - objupdate.ObjectData[0].FullID = ControllingClient.AgentID; - objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0"); - - libsecondlife.LLVector3 pos2 = new LLVector3((float)this.position.X, (float)this.position.Y, (float)this.position.Z); - - byte[] pb = pos2.GetBytes(); - - Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); - OpenSim_Main.local_world._localNumber++; - this.ControllingClient.OutPacket(objupdate); - } - - public void SendInitialAppearance() { - AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); - aw.AgentData.AgentID = this.ControllingClient.AgentID; - aw.AgentData.SerialNum = 0; - aw.AgentData.SessionID = ControllingClient.SessionID; - - aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; - AgentWearablesUpdatePacket.WearableDataBlock awb = new AgentWearablesUpdatePacket.WearableDataBlock(); - awb.WearableType = (byte)0; - awb.AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); - awb.ItemID = LLUUID.Random(); - aw.WearableData[0] = awb; - - for(int i=1; i<13; i++) { - awb = new AgentWearablesUpdatePacket.WearableDataBlock(); - awb.WearableType = (byte)i; - awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); - awb.ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); - aw.WearableData[i] = awb; - } - - ControllingClient.OutPacket(aw); - } - - public void HandleUpdate(AgentUpdatePacket pack) { - if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) !=0) { - if(!walking) - { - //we should add a new force to the list - // but for now we will deal with velocities - NewForce newVelocity = new NewForce(); - Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0); - Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z); - Axiom.MathLib.Vector3 direc = q * v3; - direc.Normalize(); - - //work out velocity for sim physics system - direc = direc * ((0.03f) * 128f); - newVelocity.X = direc.x; - newVelocity.Y = direc.y; - newVelocity.Z = direc.z; - this.forcesList.Add(newVelocity); - walking=true; - } - } - else - { - if(walking) - { - NewForce newVelocity = new NewForce(); - newVelocity.X = 0; - newVelocity.Y = 0; - newVelocity.Z = 0; - this.forcesList.Add(newVelocity); - walking = false; - } - } - } - - //should be moved somewhere else - public void SendRegionHandshake(World RegionInfo) { - ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet"); - System.Text.Encoding _enc = System.Text.Encoding.ASCII; - RegionHandshakePacket handshake = new RegionHandshakePacket(); - - ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionhandshake() - Filling in RegionHandshake details"); - handshake.RegionInfo.BillableFactor = 0; - handshake.RegionInfo.IsEstateManager = false; - handshake.RegionInfo.TerrainHeightRange00 = 60; - handshake.RegionInfo.TerrainHeightRange01 = 60; - handshake.RegionInfo.TerrainHeightRange10 = 60; - handshake.RegionInfo.TerrainHeightRange11 = 60; - handshake.RegionInfo.TerrainStartHeight00 = 10; - handshake.RegionInfo.TerrainStartHeight01 = 10; - handshake.RegionInfo.TerrainStartHeight10 = 10; - handshake.RegionInfo.TerrainStartHeight11 = 10; - handshake.RegionInfo.SimAccess = 13; - handshake.RegionInfo.WaterHeight = 5; - handshake.RegionInfo.RegionFlags = 72458694; - handshake.RegionInfo.SimName = _enc.GetBytes(OpenSim_Main.cfg.RegionName + "\0"); - handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); - handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); - handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3"); - handshake.RegionInfo.TerrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f"); - handshake.RegionInfo.TerrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2"); - handshake.RegionInfo.TerrainDetail0 = new LLUUID("00000000-0000-0000-0000-000000000000"); - handshake.RegionInfo.TerrainDetail1 = new LLUUID("00000000-0000-0000-0000-000000000000"); - handshake.RegionInfo.TerrainDetail2 = new LLUUID("00000000-0000-0000-0000-000000000000"); - handshake.RegionInfo.TerrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000"); - handshake.RegionInfo.CacheID = new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37"); - - ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionHandshake() - Sending RegionHandshake packet"); - this.ControllingClient.OutPacket(handshake); - } - - public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock() - { - byte[] bytes = new byte[60]; - int i=0; - ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); - - dat.TextureEntry = AvatarTemplate.TextureEntry; - libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z); - - uint ID = this.localid; - - bytes[i++] = (byte)(ID % 256); - bytes[i++] = (byte)((ID >> 8) % 256); - bytes[i++] = (byte)((ID >> 16) % 256); - bytes[i++] = (byte)((ID >> 24) % 256); - bytes[i++] = 0; - bytes[i++] = 1; - i += 14; - bytes[i++] = 128; - bytes[i++] = 63; - - byte[] pb = pos2.GetBytes(); - Array.Copy(pb, 0, bytes, i, pb.Length); - i += 12; - ushort InternVelocityX; - ushort InternVelocityY; - ushort InternVelocityZ; - - Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(this._physActor.Velocity.X, this._physActor.Velocity.Y, this._physActor.Velocity.Z); - internDirec = internDirec /128.0f; - internDirec.x += 1; - internDirec.y += 1; - internDirec.z += 1; - - InternVelocityX = (ushort)(32768 * internDirec.x); - InternVelocityY = (ushort)(32768 * internDirec.y); - InternVelocityZ = (ushort)(32768 * internDirec.z); - - ushort ac = 32767; - bytes[i++] = (byte)(InternVelocityX % 256); - bytes[i++] = (byte)((InternVelocityX >> 8) % 256); - bytes[i++] = (byte)(InternVelocityY % 256); - bytes[i++] = (byte)((InternVelocityY>> 8) % 256); - bytes[i++] = (byte)(InternVelocityZ % 256); - bytes[i++] = (byte)((InternVelocityZ >> 8) % 256); - - //accel - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - - //rot - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - - //rotation vel - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - - dat.Data=bytes; - return(dat); - } - } - - public class NewForce - { - public float X; - public float Y; - public float Z; - - public NewForce() - { - - } - } -} diff --git a/ConvertToPlugins/src/world/Entity.cs b/ConvertToPlugins/src/world/Entity.cs deleted file mode 100644 index 147478b..0000000 --- a/ConvertToPlugins/src/world/Entity.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Axiom.MathLib; -using OpenSim.types; -using libsecondlife; - -namespace OpenSim.world -{ - public class Entity - { - public libsecondlife.LLUUID uuid; - public uint localid; - public LLVector3 position; - public LLVector3 velocity; - public Quaternion rotation; - protected string name; - protected List children; - - public Entity() - { - uuid = new libsecondlife.LLUUID(); - localid = 8880000 + (OpenSim_Main.local_world._localNumber++); // FIXME - race condition! - position = new LLVector3(); - velocity = new LLVector3(); - rotation = new Quaternion(); - name = "(basic entity)"; - children = new List(); - } - public virtual void addForces() - { - foreach (Entity child in children) - { - child.addForces(); - } - } - public virtual void update() { - // Do any per-frame updates needed that are applicable to every type of entity - foreach (Entity child in children) - { - child.update(); - } - } - - public virtual string getName() - { - return name; - } - - public virtual Mesh getMesh() - { - Mesh mesh = new Mesh(); - - foreach (Entity child in children) - { - mesh += child.getMesh(); - } - - return mesh; - } - } -} diff --git a/ConvertToPlugins/src/world/Primitive.cs b/ConvertToPlugins/src/world/Primitive.cs deleted file mode 100644 index 18b5715..0000000 --- a/ConvertToPlugins/src/world/Primitive.cs +++ /dev/null @@ -1,136 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.types; -using libsecondlife; -using libsecondlife.Packets; - -namespace OpenSim.world -{ - public class Primitive : Entity - { - protected float mesh_cutbegin; - protected float mesh_cutend; - protected PrimData primData; - protected bool newPrimFlag; - protected ObjectUpdatePacket OurPacket; - - public Primitive() - { - mesh_cutbegin = 0.0f; - mesh_cutend = 1.0f; - } - - public override Mesh getMesh() - { - Mesh mesh = new Mesh(); - Triangle tri = new Triangle( - new Axiom.MathLib.Vector3(0.0f, 1.0f, 1.0f), - new Axiom.MathLib.Vector3(1.0f, 0.0f, 1.0f), - new Axiom.MathLib.Vector3(1.0f, 1.0f, 0.0f)); - - mesh.AddTri(tri); - mesh += base.getMesh(); - - 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() - { - - } - } -} diff --git a/ConvertToPlugins/src/world/ScriptEngine.cs b/ConvertToPlugins/src/world/ScriptEngine.cs deleted file mode 100644 index f20a08e..0000000 --- a/ConvertToPlugins/src/world/ScriptEngine.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.world -{ - public class ScriptEngine - { - public ScriptEngine(World env) - { - } - - public void LoadScript() - { - - } - } -} diff --git a/ConvertToPlugins/src/world/SurfacePatch.cs b/ConvertToPlugins/src/world/SurfacePatch.cs deleted file mode 100644 index 71e4116..0000000 --- a/ConvertToPlugins/src/world/SurfacePatch.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.world -{ - public class SurfacePatch - { - public float[] HeightMap; - - public SurfacePatch() { - HeightMap = new float[16*16]; - - int xinc; - int yinc; - for(xinc=0; xinc<16; xinc++) for(yinc=0; yinc<16; yinc++) { - HeightMap[xinc+(yinc*16)]=100.0f; - } - - } - } -} diff --git a/ConvertToPlugins/src/world/World.cs b/ConvertToPlugins/src/world/World.cs deleted file mode 100644 index 8427a38..0000000 --- a/ConvertToPlugins/src/world/World.cs +++ /dev/null @@ -1,117 +0,0 @@ -using System; -using libsecondlife; -using libsecondlife.Packets; -using System.Collections.Generic; -using System.Text; -using PhysicsSystem; - -namespace OpenSim.world -{ - public class World - { - public Dictionary Entities; - public float[] LandMap; - public ScriptEngine Scripts; - public uint _localNumber=0; - private PhysicsScene phyScene; - private float timeStep= 0.1f; - private libsecondlife.TerrainManager TerrainManager; - - private Random Rand = new Random(); - private uint _primCount = 702000; - - public World() - { - ServerConsole.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance"); - Entities = new Dictionary(); - - ServerConsole.MainConsole.Instance.WriteLine("World.cs - creating LandMap"); - TerrainManager = new TerrainManager(new SecondLife()); - - // ServerConsole.MainConsole.Instance.WriteLine("World.cs - Creating script engine instance"); - // Initialise this only after the world has loaded - // Scripts = new ScriptEngine(this); - } - - public PhysicsScene PhysScene - { - set - { - this.phyScene = value; - } - get - { - return(this.phyScene); - } - } - - public void Update() - { - - if(this.phyScene.IsThreaded) - { - this.phyScene.GetResults(); - - } - - foreach (libsecondlife.LLUUID UUID in Entities.Keys) - { - Entities[UUID].addForces(); - } - - this.phyScene.Simulate(timeStep); - - foreach (libsecondlife.LLUUID UUID in Entities.Keys) - { - Entities[UUID].update(); - } - } - - public void SendLayerData(OpenSimClient RemoteClient) { - int[] patches = new int[4]; - - for (int y = 0; y < 16; y++) - { - for (int x = 0; x < 16; x = x + 4) - { - patches[0] = x + 0 + y * 16; - patches[1] = x + 1 + y * 16; - patches[2] = x + 2 + y * 16; - patches[3] = x + 3 + y * 16; - - Packet layerpack = TerrainManager.CreateLandPacket(LandMap, patches); - RemoteClient.OutPacket(layerpack); - } - } - } - - public void AddViewerAgent(OpenSimClient AgentClient) { - ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); - Avatar NewAvatar = new Avatar(AgentClient); - ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); - ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); - NewAvatar.SendRegionHandshake(this); - - NewAvatar.PhysActor = this.phyScene.AddAvatar(new PhysicsVector(NewAvatar.position.X, NewAvatar.position.Y, NewAvatar.position.Z)); - //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); - } - - 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() { - /* TODO: Save the current world entities state. */ - - return false; - } - - - } -} diff --git a/ConvertToPlugins/src/world/scripting/IScript.cs b/ConvertToPlugins/src/world/scripting/IScript.cs deleted file mode 100644 index 550594d..0000000 --- a/ConvertToPlugins/src/world/scripting/IScript.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.world.scripting -{ - public interface IScriptHost { - bool Register(IScript iscript); - } - public interface IScript - { - string Name{get;set;} - IScriptHost Host{get;set;} - void Show(); - } -} diff --git a/bin/Axiom.MathLib.dll b/bin/Axiom.MathLib.dll new file mode 100644 index 0000000..21ce3a8 Binary files /dev/null and b/bin/Axiom.MathLib.dll differ diff --git a/bin/Db4objects.Db4o.dll b/bin/Db4objects.Db4o.dll new file mode 100755 index 0000000..be976a1 Binary files /dev/null and b/bin/Db4objects.Db4o.dll differ diff --git a/bin/avatar-template.dat b/bin/avatar-template.dat new file mode 100644 index 0000000..c13c2c7 Binary files /dev/null and b/bin/avatar-template.dat differ diff --git a/bin/libsecondlife.dll b/bin/libsecondlife.dll new file mode 100755 index 0000000..89d692a Binary files /dev/null and b/bin/libsecondlife.dll differ diff --git a/bin/log4net.dll b/bin/log4net.dll new file mode 100644 index 0000000..ffc57e1 Binary files /dev/null and b/bin/log4net.dll differ diff --git a/bin/new-login.dat b/bin/new-login.dat new file mode 100644 index 0000000..3c91151 --- /dev/null +++ b/bin/new-login.dat @@ -0,0 +1 @@ +messageWelcome to OpenSimsession_id99998888-8520-4f52-8ec1-0b1d5cd6aeadinventory-skel-libsim_port50000agent_accessMevent_notificationsstart_locationlastglobal-texturessun_texture_idcce0f112-878f-4586-a2e2-a8f104bba271cloud_texture_idfc4b9f0b-d008-45c6-96a4-01dd947ac621moon_texture_idd07f6eed-b96a-47cd-b51d-400ad4a1c428seconds_since_epoch1169908672first_name"Test"circuit_code50633318event_categorieslogin-flagsstipend_since_loginNever_logged_inYgenderedYdaylight_savingsNseed_capabilityhome{'region_handle':[r258560, r259840], 'position':[r41.6589, r100.8374, r22.5072], 'look_at':[r-0.57343, r-0.819255,r0]}secure_session_id71810f75-7437-49fb-8963-02b8fd1b95bflast_nameUserui-configallow_first_lifeYclassified_categoriescategory_nameShoppingcategory_id1category_nameLand Rentalcategory_id2category_nameProperty Rentalcategory_id3category_nameSpecial Attractioncategory_id4category_nameNew Productscategory_id5category_nameEmploymentcategory_id6category_nameWantedcategory_id7category_nameServicecategory_id8category_namePersonalcategory_id9region_x255232inventory-skeletonnameMy Inventoryparent_id00000000-0000-0000-0000-000000000000version4type_default8folder_idf798e114-c10f-409b-a90d-a11577ff1de8nameTexturesparent_idf798e114-c10f-409b-a90d-a11577ff1de8version1type_default0folder_idfc8b4059-30bb-43a8-a042-46f5b431ad82sim_ip127.0.0.1region_y254976gesturesinventory-lib-ownerinventory-rootfolder_idf798e114-c10f-409b-a90d-a11577ff1de8logintruelook_at[r0.99949799999999999756,r0.03166859999999999814,r0]agent_idaaaabbbb-8932-0271-8664-58f53e442797inventory-lib-rootinitial-outfitfolder_nameNightclub Femalegenderfemale \ No newline at end of file diff --git a/genvers.sh b/genvers.sh new file mode 100755 index 0000000..3da91d7 --- /dev/null +++ b/genvers.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +MAJOR=0 +MINOR=1 +BUILD=`date +%s` +REVISION=`svnversion | sed s/:// | sed s/M//` +REALREVISION=`svnversion` +cat src/VersionInfo.cs.template | sed s/@@VERSION/"$MAJOR.$MINOR, Build $BUILD, Revision $REALREVISION"/g >src/VersionInfo.cs +echo -n $MAJOR.$MINOR.*.$REVISION >VERSION diff --git a/opensim.build b/opensim.build new file mode 100644 index 0000000..279f836 --- /dev/null +++ b/opensim.build @@ -0,0 +1,80 @@ + + + nant buildfile for OpenSim + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Assets/AssetCache.cs b/src/Assets/AssetCache.cs new file mode 100644 index 0000000..d35b482 --- /dev/null +++ b/src/Assets/AssetCache.cs @@ -0,0 +1,436 @@ +/* +* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +using System; +using System.Collections.Generic; +using System.Threading; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim; +using OpenSim.GridServers; + +namespace OpenSim.Assets +{ + /// + /// Manages local cache of assets and their sending to viewers. + /// + public class AssetCache : IAssetReceiver + { + public Dictionary Assets; + public Dictionary Textures; + + public List AssetRequests = new List(); //assets ready to be sent to viewers + public List TextureRequests = new List(); //textures ready to be sent + + public Dictionary RequestedAssets = new Dictionary(); //Assets requested from the asset server + public Dictionary RequestedTextures = new Dictionary(); //Textures requested from the asset server + + private IAssetServer _assetServer; + private Thread _assetCacheThread; + + /// + /// + /// + public AssetCache( IAssetServer assetServer) + { + _assetServer = assetServer; + _assetServer.SetReceiver(this); + Assets = new Dictionary (); + Textures = new Dictionary (); + this._assetCacheThread = new Thread( new ThreadStart(RunAssetManager)); + this._assetCacheThread.IsBackground = true; + this._assetCacheThread.Start(); + } + + /// + /// + /// + private void RunAssetManager() + { + this.ProcessAssetQueue(); + this.ProcessTextureQueue(); + Thread.Sleep(100); + } + + /// + /// + /// + private void ProcessTextureQueue() + { + if(this.TextureRequests.Count == 0) + { + //no requests waiting + return; + } + int num; + + if(this.TextureRequests.Count < 5) + { + //lower than 5 so do all of them + num = this.TextureRequests.Count; + } + else + { + num=5; + } + AssetRequest req; + for(int i = 0; i < num; i++) + { + req=(AssetRequest)this.TextureRequests[i]; + + if(req.PacketCounter == 0) + { + //first time for this request so send imagedata packet + if(req.NumPackets == 1) + { + //only one packet so send whole file + ImageDataPacket im = new ImageDataPacket(); + im.ImageID.Packets = 1; + im.ImageID.ID = req.ImageInfo.FullID; + im.ImageID.Size = (uint)req.ImageInfo.Data.Length; + im.ImageData.Data = req.ImageInfo.Data; + im.ImageID.Codec = 2; + req.RequestUser.OutPacket(im); + req.PacketCounter++; + //req.ImageInfo.l= time; + //System.Console.WriteLine("sent texture: "+req.image_info.FullID); + } + else + { + //more than one packet so split file up + ImageDataPacket im = new ImageDataPacket(); + im.ImageID.Packets = (ushort)req.NumPackets; + im.ImageID.ID = req.ImageInfo.FullID; + im.ImageID.Size = (uint)req.ImageInfo.Data.Length; + im.ImageData.Data = new byte[600]; + Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600); + im.ImageID.Codec = 2; + req.RequestUser.OutPacket(im); + req.PacketCounter++; + //req.ImageInfo.last_used = time; + //System.Console.WriteLine("sent first packet of texture: + } + } + else + { + //send imagepacket + //more than one packet so split file up + ImagePacketPacket im = new ImagePacketPacket(); + im.ImageID.Packet = (ushort)req.PacketCounter; + im.ImageID.ID = req.ImageInfo.FullID; + int size = req.ImageInfo.Data.Length - 600 - 1000*(req.PacketCounter - 1); + if(size > 1000) size = 1000; + im.ImageData.Data = new byte[size]; + Array.Copy(req.ImageInfo.Data, 600 + 1000*(req.PacketCounter - 1), im.ImageData.Data, 0, size); + req.RequestUser.OutPacket(im); + req.PacketCounter++; + //req.ImageInfo.last_used = time; + //System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID); + } + } + + //remove requests that have been completed + int count = 0; + for(int i = 0; i < num; i++) + { + req=(AssetRequest)this.TextureRequests[count]; + if(req.PacketCounter == req.NumPackets) + { + this.TextureRequests.Remove(req); + } + else + { + count++; + } + } + + } + public void AssetReceived(AssetBase asset, bool IsTexture) + { + //check if it is a texture or not + //then add to the correct cache list + //then check for waiting requests for this asset/texture (in the Requested lists) + //and move those requests into the Requests list. + if(IsTexture) + { + TextureImage image = new TextureImage(asset); + this.Textures.Add(image.FullID, image); + if(this.RequestedTextures.ContainsKey(image.FullID)) + { + AssetRequest req = this.RequestedTextures[image.FullID]; + req.ImageInfo = image; + this.RequestedTextures.Remove(image.FullID); + this.TextureRequests.Add(req); + } + } + else + { + AssetInfo assetInf = new AssetInfo(asset); + this.Assets.Add(assetInf.FullID, assetInf); + if(this.RequestedAssets.ContainsKey(assetInf.FullID)) + { + AssetRequest req = this.RequestedAssets[assetInf.FullID]; + req.AssetInf = assetInf; + this.RequestedAssets.Remove(assetInf.FullID); + this.AssetRequests.Add(req); + } + } + } + + public void AssetNotFound(AssetBase asset) + { + //the asset server had no knowledge of requested asset + + } + + #region Assets + /// + /// + /// + /// + /// + public void AddAssetRequest(OpenSimClient userInfo, TransferRequestPacket transferRequest) + { + LLUUID requestID = new LLUUID(transferRequest.TransferInfo.Params, 0); + //check to see if asset is in local cache, if not we need to request it from asset server. + if(!this.Assets.ContainsKey(requestID)) + { + //not found asset + // so request from asset server + AssetRequest request = new AssetRequest(); + request.RequestUser = userInfo; + request.RequestAssetID = requestID; + request.TransferRequestID = transferRequest.TransferInfo.TransferID; + this.RequestedAssets.Add(requestID,request); + this._assetServer.RequestAsset(requestID, false); + return; + } + //it is in our cache + AssetInfo asset = this.Assets[requestID]; + + //work out how many packets it should be sent in + // and add to the AssetRequests list + AssetRequest req = new AssetRequest(); + req.RequestUser = userInfo; + req.RequestAssetID = requestID; + req.TransferRequestID = transferRequest.TransferInfo.TransferID; + req.AssetInf = asset; + + if(asset.Data.LongLength>600) + { + //over 600 bytes so split up file + req.NumPackets = 1 + (int)(asset.Data.Length-600+999)/1000; + } + else + { + req.NumPackets = 1; + } + + this.AssetRequests.Add(req); + } + + /// + /// + /// + private void ProcessAssetQueue() + { + if(this.AssetRequests.Count == 0) + { + //no requests waiting + return; + } + int num; + + if(this.AssetRequests.Count < 5) + { + //lower than 5 so do all of them + num = this.AssetRequests.Count; + } + else + { + num=5; + } + AssetRequest req; + for(int i = 0; i < num; i++) + { + req=(AssetRequest)this.AssetRequests[i]; + + TransferInfoPacket Transfer = new TransferInfoPacket(); + Transfer.TransferInfo.ChannelType = 2; + Transfer.TransferInfo.Status = 0; + Transfer.TransferInfo.TargetType = 0; + Transfer.TransferInfo.Params = req.RequestAssetID.GetBytes(); + Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length; + Transfer.TransferInfo.TransferID = req.TransferRequestID; + req.RequestUser.OutPacket(Transfer); + + if(req.NumPackets == 1) + { + TransferPacketPacket TransferPacket = new TransferPacketPacket(); + TransferPacket.TransferData.Packet = 0; + TransferPacket.TransferData.ChannelType = 2; + TransferPacket.TransferData.TransferID=req.TransferRequestID; + TransferPacket.TransferData.Data = req.AssetInf.Data; + TransferPacket.TransferData.Status = 1; + req.RequestUser.OutPacket(TransferPacket); + } + else + { + //more than one packet so split file up , for now it can't be bigger than 2000 bytes + TransferPacketPacket TransferPacket = new TransferPacketPacket(); + TransferPacket.TransferData.Packet = 0; + TransferPacket.TransferData.ChannelType = 2; + TransferPacket.TransferData.TransferID=req.TransferRequestID; + byte[] chunk = new byte[1000]; + Array.Copy(req.AssetInf.Data,chunk,1000); + TransferPacket.TransferData.Data = chunk; + TransferPacket.TransferData.Status = 0; + req.RequestUser.OutPacket(TransferPacket); + + TransferPacket = new TransferPacketPacket(); + TransferPacket.TransferData.Packet = 1; + TransferPacket.TransferData.ChannelType = 2; + TransferPacket.TransferData.TransferID = req.TransferRequestID; + byte[] chunk1 = new byte[(req.AssetInf.Data.Length-1000)]; + Array.Copy(req.AssetInf.Data, 1000, chunk1, 0, chunk1.Length); + TransferPacket.TransferData.Data = chunk1; + TransferPacket.TransferData.Status = 1; + req.RequestUser.OutPacket(TransferPacket); + } + + } + + //remove requests that have been completed + for(int i = 0; i < num; i++) + { + this.AssetRequests.RemoveAt(0); + } + + } + + #endregion + + #region Textures + /// + /// + /// + /// + /// + public void AddTextureRequest(OpenSimClient userInfo, LLUUID imageID) + { + //check to see if texture is in local cache, if not request from asset server + if(!this.Textures.ContainsKey(imageID)) + { + //not is cache so request from asset server + AssetRequest request = new AssetRequest(); + request.RequestUser = userInfo; + request.RequestAssetID = imageID; + request.IsTextureRequest = true; + this.RequestedTextures.Add(imageID, request); + this._assetServer.RequestAsset(imageID, true); + return; + } + TextureImage imag = this.Textures[imageID]; + AssetRequest req = new AssetRequest(); + req.RequestUser = userInfo; + req.RequestAssetID = imageID; + req.IsTextureRequest = true; + req.ImageInfo = imag; + + if(imag.Data.LongLength>600) + { + //over 600 bytes so split up file + req.NumPackets = 1 + (int)(imag.Data.Length-600+999)/1000; + } + else + { + req.NumPackets = 1; + } + + this.TextureRequests.Add(req); + } + #endregion + + } + + public class AssetRequest + { + public OpenSimClient RequestUser; + public LLUUID RequestAssetID; + public AssetInfo AssetInf; + public TextureImage ImageInfo; + public LLUUID TransferRequestID; + public long DataPointer = 0; + public int NumPackets = 0; + public int PacketCounter = 0; + public bool IsTextureRequest; + //public bool AssetInCache; + //public int TimeRequested; + + public AssetRequest() + { + + } + } + + public class AssetInfo : AssetBase + { + public AssetInfo() + { + + } + + public AssetInfo(AssetBase aBase) + { + Data= aBase.Data; + FullID = aBase.FullID; + Type = aBase.Type; + InvType = aBase.InvType; + Name= aBase.Name; + Description = aBase.Description; + } + } + + public class TextureImage : AssetBase + { + public TextureImage() + { + + } + + public TextureImage(AssetBase aBase) + { + Data= aBase.Data; + FullID = aBase.FullID; + Type = aBase.Type; + InvType = aBase.InvType; + Name= aBase.Name; + Description = aBase.Description; + } + } + +} diff --git a/src/Config.cs b/src/Config.cs new file mode 100644 index 0000000..c42b80e --- /dev/null +++ b/src/Config.cs @@ -0,0 +1,72 @@ +/* +Copyright (c) OpenSim project, http://osgrid.org/ + +* Copyright (c) , +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Collections.Generic; +using System.IO; +using libsecondlife; +using OpenSim.world; + +namespace OpenSim +{ + /// + /// This class handles connection to the underlying database used for configuration of the region. + /// Region content is also stored by this class. The main entry point is InitConfig() which attempts to locate + /// opensim.yap in the current working directory. If opensim.yap can not be found, default settings are loaded from + /// what is hardcoded here and then saved into opensim.yap for future startups. + /// + + + public abstract class SimConfig + { + public string RegionName; + + public uint RegionLocX; + public uint RegionLocY; + public ulong RegionHandle; + + public int IPListenPort; + public string IPListenAddr; + + public string AssetURL; + public string AssetSendKey; + + public string GridURL; + public string GridSendKey; + + public abstract void InitConfig(); + public abstract void LoadFromGrid(); + public abstract World LoadWorld(); + } + + public interface ISimConfig + { + SimConfig GetConfigObject(); + } +} diff --git a/src/Config/SimConfig/AssemblyInfo.cs b/src/Config/SimConfig/AssemblyInfo.cs new file mode 100644 index 0000000..96c3e73 --- /dev/null +++ b/src/Config/SimConfig/AssemblyInfo.cs @@ -0,0 +1,31 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("SimConfig")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SimConfig")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 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.*")] diff --git a/src/Config/SimConfig/Db4SimConfig.cs b/src/Config/SimConfig/Db4SimConfig.cs new file mode 100644 index 0000000..cc31328 --- /dev/null +++ b/src/Config/SimConfig/Db4SimConfig.cs @@ -0,0 +1,146 @@ +/* +* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using OpenSim; +using OpenSim.world; +using Db4objects.Db4o; + +namespace Db40SimConfig +{ + public class Db40ConfigPlugin: ISimConfig + { + public SimConfig GetConfigObject() + { + ServerConsole.MainConsole.Instance.WriteLine("Loading Db40Config dll"); + return ( new DbSimConfig()); + } + } + + public class DbSimConfig :SimConfig + { + private IObjectContainer db; + + public void LoadDefaults() { + ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); + + this.RegionName=ServerConsole.MainConsole.Instance.CmdPrompt("Name [OpenSim test]: ","OpenSim test"); + this.RegionLocX=(uint)Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("Grid Location X [997]: ","997")); + this.RegionLocY=(uint)Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("Grid Location Y [996]: ","996")); + this.IPListenPort=Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("UDP port for client connections [9000]: ","9000")); + this.IPListenAddr=ServerConsole.MainConsole.Instance.CmdPrompt("IP Address to listen on for client connections [127.0.0.1]: ","127.0.0.1"); + + if(!OpenSim_Main.sim.sandbox) + { + this.AssetURL=ServerConsole.MainConsole.Instance.CmdPrompt("Asset server URL: "); + this.AssetSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Asset server key: "); + this.GridURL=ServerConsole.MainConsole.Instance.CmdPrompt("Grid server URL: "); + this.GridSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Grid server key: "); + } + this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); + } + + public override void InitConfig() { + try { + db = Db4oFactory.OpenFile("opensim.yap"); + IObjectSet result = db.Get(typeof(DbSimConfig)); + if(result.Count==1) { + ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Found a SimConfig object in the local database, loading"); + foreach (DbSimConfig cfg in result) { + this.RegionName = cfg.RegionName; + this.RegionLocX = cfg.RegionLocX; + this.RegionLocY = cfg.RegionLocY; + this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); + this.IPListenPort = cfg.IPListenPort; + this.IPListenAddr = cfg.IPListenAddr; + this.AssetURL = cfg.AssetURL; + this.AssetSendKey = cfg.AssetSendKey; + this.GridURL = cfg.GridURL; + this.GridSendKey = cfg.GridSendKey; + } + } else { + ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); + LoadDefaults(); + ServerConsole.MainConsole.Instance.WriteLine("Writing out default settings to local database"); + db.Set(this); + } + } catch(Exception e) { + db.Close(); + ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Exception occured"); + ServerConsole.MainConsole.Instance.WriteLine(e.ToString()); + } + + ServerConsole.MainConsole.Instance.WriteLine("Sim settings loaded:"); + ServerConsole.MainConsole.Instance.WriteLine("Name: " + this.RegionName); + ServerConsole.MainConsole.Instance.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); + ServerConsole.MainConsole.Instance.WriteLine("Region Handle: " + this.RegionHandle.ToString()); + ServerConsole.MainConsole.Instance.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort); + ServerConsole.MainConsole.Instance.WriteLine("Sandbox Mode? " + OpenSim_Main.sim.sandbox.ToString()); + ServerConsole.MainConsole.Instance.WriteLine("Asset URL: " + this.AssetURL); + ServerConsole.MainConsole.Instance.WriteLine("Asset key: " + this.AssetSendKey); + ServerConsole.MainConsole.Instance.WriteLine("Grid URL: " + this.GridURL); + ServerConsole.MainConsole.Instance.WriteLine("Grid key: " + this.GridSendKey); + } + + public override World LoadWorld() + { + ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Loading world...."); + World blank = new World(); + ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB"); + IObjectSet world_result = db.Get(new float[65536]); + if(world_result.Count>0) { + ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading"); + blank.LandMap=(float[])world_result.Next(); + } else { + ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one"); + HeightmapGenHills hills = new HeightmapGenHills(); + blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); + ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database"); + db.Set(blank.LandMap); + db.Commit(); + } + return blank; + } + + public override void LoadFromGrid() { + ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!"); + // TODO: Make this crap work + /* WebRequest GridLogin = WebRequest.Create(this.GridURL + "regions/" + this.RegionHandle.ToString() + "/login"); + WebResponse GridResponse = GridLogin.GetResponse(); + byte[] idata = new byte[(int)GridResponse.ContentLength]; + BinaryReader br = new BinaryReader(GridResponse.GetResponseStream()); + + br.Close(); + GridResponse.Close(); + */ + } + + public void Shutdown() { + db.Close(); + } + } +} diff --git a/src/Config/SimConfig/SimConfig.csproj b/src/Config/SimConfig/SimConfig.csproj new file mode 100644 index 0000000..08f0f24 --- /dev/null +++ b/src/Config/SimConfig/SimConfig.csproj @@ -0,0 +1,49 @@ + + + Library + SimConfig + SimConfig + Debug + AnyCPU + {B063760D-DB8D-4F64-B6FE-335FAD1E650A} + + + bin\Debug\ + False + DEBUG;TRACE + True + Full + True + + + bin\Release\ + True + TRACE + False + None + False + + + + + + ..\..\..\bin\Db4objects.Db4o.dll + False + + + + + + + + + {C9A6026D-8E0C-4FE4-8691-FB2A566AA245} + ServerConsole + + + {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E} + Second-server + + + + \ No newline at end of file diff --git a/src/Config/SimConfig/SimConfig.sln b/src/Config/SimConfig/SimConfig.sln new file mode 100644 index 0000000..944d6a8 --- /dev/null +++ b/src/Config/SimConfig/SimConfig.sln @@ -0,0 +1,7 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# SharpDevelop 2.1.0.2017 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimConfig", "SimConfig.csproj", "{B063760D-DB8D-4F64-B6FE-335FAD1E650A}" +EndProject +Global +EndGlobal diff --git a/src/Config/default.build b/src/Config/default.build new file mode 100644 index 0000000..2ee0c52 --- /dev/null +++ b/src/Config/default.build @@ -0,0 +1,52 @@ + + + nant buildfile for OpenSim + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/GridInterfaces/AssemblyInfo.cs b/src/GridInterfaces/AssemblyInfo.cs new file mode 100644 index 0000000..89731a1 --- /dev/null +++ b/src/GridInterfaces/AssemblyInfo.cs @@ -0,0 +1,31 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("GridInterfaces")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("GridInterfaces")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 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.*")] diff --git a/src/GridInterfaces/GridInterfaces.csproj b/src/GridInterfaces/GridInterfaces.csproj new file mode 100644 index 0000000..3284e7f --- /dev/null +++ b/src/GridInterfaces/GridInterfaces.csproj @@ -0,0 +1,40 @@ + + + Library + GridInterfaces + GridInterfaces + Debug + AnyCPU + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9} + + + bin\Debug\ + False + DEBUG;TRACE + True + Full + True + + + bin\Release\ + True + TRACE + False + None + False + + + + + + ..\..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll + False + + + + + + + + + \ No newline at end of file diff --git a/src/GridInterfaces/GridInterfaces.sln b/src/GridInterfaces/GridInterfaces.sln new file mode 100644 index 0000000..5ac2b6d --- /dev/null +++ b/src/GridInterfaces/GridInterfaces.sln @@ -0,0 +1,17 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# SharpDevelop 2.1.0.2017 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GridInterfaces", "GridInterfaces.csproj", "{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Release|Any CPU.Build.0 = Release|Any CPU + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Release|Any CPU.ActiveCfg = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/src/GridInterfaces/IAssetServer.cs b/src/GridInterfaces/IAssetServer.cs new file mode 100644 index 0000000..6050a6c --- /dev/null +++ b/src/GridInterfaces/IAssetServer.cs @@ -0,0 +1,82 @@ +/* +* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Net; +using System.Net.Sockets; +using System.IO; +using System.Threading; +using libsecondlife; + + +namespace OpenSim.GridServers +{ + /// + /// Description of IAssetServer. + /// + + public interface IAssetServer + { + void SetReceiver(IAssetReceiver receiver); + void RequestAsset(LLUUID assetID, bool isTexture); + void UpdateAsset(AssetBase asset); + void UploadNewAsset(AssetBase asset); + void SetServerInfo(string ServerUrl, string ServerKey); + } + + // could change to delegate? + public interface IAssetReceiver + { + void AssetReceived(AssetBase asset, bool IsTexture); + void AssetNotFound(AssetBase asset); + } + + public struct ARequest + { + public LLUUID AssetID; + public bool IsTexture; + } + + public class AssetBase + { + public byte[] Data; + public LLUUID FullID; + public sbyte Type; + public sbyte InvType; + public string Name; + public string Description; + + public AssetBase() + { + + } + } + + public interface IAssetPlugin + { + IAssetServer GetAssetServer(); + } +} diff --git a/src/GridInterfaces/IGridServer.cs b/src/GridInterfaces/IGridServer.cs new file mode 100644 index 0000000..fef4c3e --- /dev/null +++ b/src/GridInterfaces/IGridServer.cs @@ -0,0 +1,94 @@ +/* +* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + + +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Sockets; +using System.IO; +using libsecondlife; + +namespace OpenSim.GridServers +{ + /// + /// Handles connection to Grid Servers. + /// also Sim to Sim connections? + /// + + + + + public interface IGridServer + { + bool RequestConnection(); + UUIDBlock RequestUUIDBlock(); + void RequestNeighbours(); //should return a array of neighbouring regions + AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode); + bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode); + void SetServerInfo(string ServerUrl, string ServerKey); + void AddNewSession(Login session); // only used by local version of grid server + // and didn't use to be part of this interface until we put this in a dll + } + + public struct UUIDBlock + { + public LLUUID BlockStart; + public LLUUID BlockEnd; + } + + public class AuthenticateResponse + { + public bool Authorised; + public Login LoginInfo; + + public AuthenticateResponse() + { + + } + + } + + public class Login + { + public string First = "Test"; + public string Last = "User"; + public LLUUID Agent; + public LLUUID Session; + public LLUUID InventoryFolder; + public LLUUID BaseFolder; + public Login() + { + + } + } + + public interface IGridPlugin + { + IGridServer GetGridServer(); + } +} diff --git a/src/GridInterfaces/default.build b/src/GridInterfaces/default.build new file mode 100644 index 0000000..f29f108 --- /dev/null +++ b/src/GridInterfaces/default.build @@ -0,0 +1,49 @@ + + + nant buildfile for OpenSim + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/GridServers/LoginServer.cs b/src/GridServers/LoginServer.cs new file mode 100644 index 0000000..da982e7 --- /dev/null +++ b/src/GridServers/LoginServer.cs @@ -0,0 +1,322 @@ +/* +* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +using Nwc.XmlRpc; +using System; +using System.IO; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading; +using System.Collections; +using System.Security.Cryptography; +using System.Xml; +using libsecondlife; +using OpenSim; + +namespace OpenSim.GridServers +{ + + /// + /// When running in local (default) mode , handles client logins. + /// + public class LoginServer + { + public LoginServer(IGridServer gridServer) + { + _gridServer = gridServer; + } + private Login _login; + private IGridServer _gridServer; + private ushort _loginPort = 8080; + public IPAddress clientAddress = IPAddress.Loopback; + public IPAddress remoteAddress = IPAddress.Any; + private Socket loginServer; + private Random RandomClass = new Random(); + private int NumClients; + private string _defaultResponse; + + private string _mpasswd; + private bool _needPasswd=false; + + // InitializeLogin: initialize the login + private void InitializeLogin() { + loginServer = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + loginServer.Bind(new IPEndPoint(remoteAddress, _loginPort)); + loginServer.Listen(1); + + this._needPasswd=false; + //read in default response string + StreamReader SR; + string lines; + SR=File.OpenText("new-login.dat"); + + //lines=SR.ReadLine(); + + while(!SR.EndOfStream) + { + lines = SR.ReadLine(); + _defaultResponse += lines; + //lines = SR.ReadLine(); + } + SR.Close(); + this._mpasswd = EncodePassword("testpass"); + } + + public void Startup() + { + this.InitializeLogin(); + Thread runLoginProxy = new Thread(new ThreadStart(RunLogin)); + runLoginProxy.IsBackground = true; + runLoginProxy.Start(); + } + + private void RunLogin() + { + Console.WriteLine("Starting Login Server"); + try + { + for (;;) + { + Socket client = loginServer.Accept(); + IPEndPoint clientEndPoint = (IPEndPoint)client.RemoteEndPoint; + + + NetworkStream networkStream = new NetworkStream(client); + StreamReader networkReader = new StreamReader(networkStream); + StreamWriter networkWriter = new StreamWriter(networkStream); + + try + { + LoginRequest(networkReader, networkWriter); + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } + + networkWriter.Close(); + networkReader.Close(); + networkStream.Close(); + + client.Close(); + + // send any packets queued for injection + + } + } + catch (Exception e) + { + Console.WriteLine(e.Message); + Console.WriteLine(e.StackTrace); + } + } + + // ProxyLogin: proxy a login request + private void LoginRequest(StreamReader reader, StreamWriter writer) + { + lock(this) + { + string line; + int contentLength = 0; + // read HTTP header + do + { + // read one line of the header + line = reader.ReadLine(); + + // check for premature EOF + if (line == null) + throw new Exception("EOF in client HTTP header"); + + // look for Content-Length + Match match = (new Regex(@"Content-Length: (\d+)$")).Match(line); + if (match.Success) + contentLength = Convert.ToInt32(match.Groups[1].Captures[0].ToString()); + } while (line != ""); + + // read the HTTP body into a buffer + char[] content = new char[contentLength]; + reader.Read(content, 0, contentLength); + + XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(new String(content)); + if(request.MethodName == "login_to_simulator") + { + Hashtable requestData = (Hashtable)request.Params[0]; + string first; + string last; + string passwd; + LLUUID Agent; + LLUUID Session; + + //get login name + if(requestData.Contains("first")) + { + first = (string)requestData["first"]; + } + else + { + first = "test"; + } + + if(requestData.Contains("last")) + { + last = (string)requestData["last"]; + } + else + { + last = "User"+NumClients.ToString(); + } + + if(requestData.Contains("passwd")) + { + passwd = (string)requestData["passwd"]; + } + else + { + passwd = "notfound"; + } + + if( !Authenticate(first, last, passwd)) + { + // Fail miserably + writer.WriteLine("HTTP/1.0 403 Authentication Forbidden"); + writer.WriteLine(); + return; + } + NumClients++; + + //create a agent and session LLUUID + Agent = GetAgentId( first, last ); + int SessionRand = this.RandomClass.Next(1,999); + Session = new LLUUID("aaaabbbb-0200-"+SessionRand.ToString("0000")+"-8664-58f53e442797"); + + + XmlRpcResponse response =(XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse); + Hashtable responseData = (Hashtable)response.Value; + + responseData["sim_port"] = OpenSim_Main.cfg.IPListenPort; + responseData["sim_ip"] = OpenSim_Main.cfg.IPListenAddr; + responseData["agent_id"] = Agent.ToStringHyphenated(); + responseData["session_id"] = Session.ToStringHyphenated(); + ArrayList InventoryList = (ArrayList) responseData["inventory-skeleton"]; + Hashtable Inventory1 = (Hashtable)InventoryList[0]; + Hashtable Inventory2 = (Hashtable)InventoryList[1]; + LLUUID BaseFolderID = LLUUID.Random(); + LLUUID InventoryFolderID = LLUUID.Random(); + Inventory2["name"] = "Base"; + Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated(); + Inventory2["type_default"] =6; + Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated(); + + ArrayList InventoryRoot = (ArrayList) responseData["inventory-root"]; + Hashtable Inventoryroot = (Hashtable)InventoryRoot[0]; + Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated(); + + CustomiseLoginResponse( responseData, first, last ); + + this._login = new Login(); + //copy data to login object + _login.First = first; + _login.Last = last; + _login.Agent = Agent; + _login.Session = Session; + _login.BaseFolder = BaseFolderID; + _login.InventoryFolder = InventoryFolderID; + + //working on local computer so lets add to the gridserver's list of sessions + this._gridServer.AddNewSession(_login); + + // forward the XML-RPC response to the client + writer.WriteLine("HTTP/1.0 200 OK"); + writer.WriteLine("Content-type: text/xml"); + writer.WriteLine(); + + XmlTextWriter responseWriter = new XmlTextWriter(writer); + XmlRpcResponseSerializer.Singleton.Serialize(responseWriter, response); + responseWriter.Close(); + } + else + { + writer.WriteLine("HTTP/1.0 403 Authentication Forbidden"); + writer.WriteLine(); + } + } + } + + protected virtual void CustomiseLoginResponse( Hashtable responseData, string first, string last ) + { + } + + protected virtual LLUUID GetAgentId(string firstName, string lastName) + { + LLUUID Agent; + int AgentRand = this.RandomClass.Next(1,9999); + Agent = new LLUUID("99998888-0100-"+AgentRand.ToString("0000")+"-8ec1-0b1d5cd6aead"); + return Agent; + } + + protected virtual bool Authenticate(string first, string last, string passwd) + { + if(this._needPasswd) + { + //every user needs the password to login + string encodedPass = passwd.Remove(0,3); //remove $1$ + if(encodedPass == this._mpasswd) + { + return true; + } + else + { + return false; + } + } + else + { + //do not need password to login + return true; + } + } + + private static string EncodePassword(string passwd) + { + Byte[] originalBytes; + Byte[] encodedBytes; + MD5 md5; + + md5 = new MD5CryptoServiceProvider(); + originalBytes = ASCIIEncoding.Default.GetBytes(passwd); + encodedBytes = md5.ComputeHash(originalBytes); + + return Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower(); + } + + } + + +} diff --git a/src/HeightMapGenHills.cs b/src/HeightMapGenHills.cs new file mode 100644 index 0000000..e7589af --- /dev/null +++ b/src/HeightMapGenHills.cs @@ -0,0 +1,149 @@ +/* +* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +using System; + +namespace OpenSim +{ + public class HeightmapGenHills + { + private Random Rand = new Random(); + private int NumHills; + private float HillMin; + private float HillMax; + private bool Island; + private float[] heightmap; + + public float[] GenerateHeightmap(int numHills, float hillMin, float hillMax, bool island) + { + NumHills = numHills; + HillMin = hillMin; + HillMax = hillMax; + Island = island; + + heightmap = new float[256 * 256]; + + for (int i = 0; i < numHills; i++) + { + AddHill(); + } + + Normalize(); + + return heightmap; + } + + private void AddHill() + { + float x, y; + float radius = RandomRange(HillMin, HillMax); + + if (Island) + { + // Which direction from the center of the map the hill is placed + float theta = RandomRange(0, 6.28f); + + // How far from the center of the map to place the hill. The radius + // is subtracted from the range to prevent any part of the hill from + // reaching the edge of the map + float distance = RandomRange(radius / 2.0f, 128.0f - radius); + + x = 128.0f + (float)Math.Cos(theta) * distance; + y = 128.0f + (float)Math.Sin(theta) * distance; + } + else + { + x = RandomRange(-radius, 256.0f + radius); + y = RandomRange(-radius, 256.0f + radius); + } + + float radiusSq = radius * radius; + float distSq; + float height; + + int xMin = (int)(x - radius) - 1; + int xMax = (int)(x + radius) + 1; + if (xMin < 0) xMin = 0; + if (xMax > 255) xMax = 255; + + int yMin = (int)(y - radius) - 1; + int yMax = (int)(y + radius) + 1; + if (yMin < 0) yMin = 0; + if (yMax > 255) yMax = 255; + + // Loop through each affected cell and determine the height at that point + for (int v = yMin; v <= yMax; ++v) + { + float fv = (float)v; + + for (int h = xMin; h <= xMax; ++h) + { + float fh = (float)h; + + // Determine how far from the center of this hill this point is + distSq = (x - fh) * (x - fh) + (y - fv) * (y - fv); + height = radiusSq - distSq; + + // Don't add negative hill values + if (height > 0.0f) heightmap[h + v * 256] += height; + } + } + } + + private void Normalize() + { + float min = heightmap[0]; + float max = heightmap[0]; + + for (int x = 0; x < 256; x++) + { + for (int y = 0; y < 256; y++) + { + if (heightmap[x + y * 256] < min) min = heightmap[x + y * 256]; + if (heightmap[x + y * 256] > max) max = heightmap[x + y * 256]; + } + } + + // Avoid a rare divide by zero + if (min != max) + { + for (int x = 0; x < 256; x++) + { + for (int y = 0; y < 256; y++) + { + heightmap[x + y * 256] = ((heightmap[x + y * 256] - min) / (max - min)) * (HillMax - HillMin); + } + } + } + } + + private float RandomRange(float min, float max) + { + return (float)Rand.NextDouble() * (max - min) + min; + } + } +} diff --git a/src/LocalServers/LocalGridServers/AssemblyInfo.cs b/src/LocalServers/LocalGridServers/AssemblyInfo.cs new file mode 100644 index 0000000..103b49a --- /dev/null +++ b/src/LocalServers/LocalGridServers/AssemblyInfo.cs @@ -0,0 +1,31 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("LocalGridServers")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("LocalGridServers")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 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.*")] diff --git a/src/LocalServers/LocalGridServers/LocalGrid.cs b/src/LocalServers/LocalGridServers/LocalGrid.cs new file mode 100644 index 0000000..5adce27 --- /dev/null +++ b/src/LocalServers/LocalGridServers/LocalGrid.cs @@ -0,0 +1,205 @@ +/* +* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Threading; +using OpenSim.GridServers; +using libsecondlife; + +namespace LocalGridServers +{ + /// + /// + /// + /// + public class LocalGridPlugin : IGridPlugin + { + public LocalGridPlugin() + { + + } + + public IGridServer GetGridServer() + { + return(new LocalGridServer()); + } + } + + public class LocalAssetPlugin : IAssetPlugin + { + public LocalAssetPlugin() + { + + } + + public IAssetServer GetAssetServer() + { + return(new LocalAssetServer()); + } + } + + public class LocalAssetServer : IAssetServer + { + private IAssetReceiver _receiver; + private BlockingQueue _assetRequests; + + public LocalAssetServer() + { + this._assetRequests = new BlockingQueue(); + ServerConsole.MainConsole.Instance.WriteLine("Local Asset Server class created"); + } + + public void SetReceiver(IAssetReceiver receiver) + { + this._receiver = receiver; + } + + public void RequestAsset(LLUUID assetID, bool isTexture) + { + ARequest req = new ARequest(); + req.AssetID = assetID; + req.IsTexture = isTexture; + //this._assetRequests.Enqueue(req); + } + + public void UpdateAsset(AssetBase asset) + { + + } + + public void UploadNewAsset(AssetBase asset) + { + + } + + public void SetServerInfo(string ServerUrl, string ServerKey) + { + + } + + private void RunRequests() + { + while(true) + { + + } + } + } + + public class LocalGridServer :IGridServer + { + public List Sessions = new List(); + + public LocalGridServer() + { + Sessions = new List(); + ServerConsole.MainConsole.Instance.WriteLine("Local Grid Server class created"); + } + + public bool RequestConnection() + { + return true; + } + public AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) + { + //we are running local + AuthenticateResponse user = new AuthenticateResponse(); + + lock(this.Sessions) + { + + for(int i = 0; i < Sessions.Count; i++) + { + if((Sessions[i].Agent == agentID) && (Sessions[i].Session == sessionID)) + { + user.Authorised = true; + user.LoginInfo = Sessions[i]; + } + } + } + return(user); + } + + public bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) + { + return(true); + } + + public UUIDBlock RequestUUIDBlock() + { + UUIDBlock uuidBlock = new UUIDBlock(); + return(uuidBlock); + } + + public void RequestNeighbours() + { + return; + } + + public void SetServerInfo(string ServerUrl, string ServerKey) + { + + } + /// + /// used by the local login server to inform us of new sessions + /// + /// + public void AddNewSession(Login session) + { + lock(this.Sessions) + { + this.Sessions.Add(session); + } + } + } + + public class BlockingQueue< T > { + private Queue< T > _queue = new Queue< T >(); + private object _queueSync = new object(); + + public void Enqueue(T value) + { + lock(_queueSync) + { + _queue.Enqueue(value); + Monitor.Pulse(_queueSync); + } + } + + public T Dequeue() + { + lock(_queueSync) + { + if( _queue.Count < 1) + Monitor.Wait(_queueSync); + + return _queue.Dequeue(); + } + } + } + +} diff --git a/src/LocalServers/LocalGridServers/LocalGridServers.csproj b/src/LocalServers/LocalGridServers/LocalGridServers.csproj new file mode 100644 index 0000000..dc9c566 --- /dev/null +++ b/src/LocalServers/LocalGridServers/LocalGridServers.csproj @@ -0,0 +1,49 @@ + + + Library + LocalGridServers + LocalGridServers + Debug + AnyCPU + {D7F0395B-FADC-4936-80A0-D95AACE92F62} + + + bin\Debug\ + False + DEBUG;TRACE + True + Full + True + + + bin\Release\ + True + TRACE + False + None + False + + + + + + ..\..\..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll + False + + + + + + + + + {C9A6026D-8E0C-4FE4-8691-FB2A566AA245} + ServerConsole + + + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9} + GridInterfaces + + + + \ No newline at end of file diff --git a/src/LocalServers/LocalGridServers/LocalGridServers.sln b/src/LocalServers/LocalGridServers/LocalGridServers.sln new file mode 100644 index 0000000..659e1d5 --- /dev/null +++ b/src/LocalServers/LocalGridServers/LocalGridServers.sln @@ -0,0 +1,7 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# SharpDevelop 2.1.0.2017 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalGridServers", "LocalGridServers.csproj", "{D7F0395B-FADC-4936-80A0-D95AACE92F62}" +EndProject +Global +EndGlobal diff --git a/src/LocalServers/default.build b/src/LocalServers/default.build new file mode 100644 index 0000000..06bfcaa --- /dev/null +++ b/src/LocalServers/default.build @@ -0,0 +1,51 @@ + + + nant buildfile for OpenSim + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Main.cs b/src/Main.cs new file mode 100644 index 0000000..4fc7d54 --- /dev/null +++ b/src/Main.cs @@ -0,0 +1,317 @@ +/* +Copyright (c) OpenSim project, http://osgrid.org/ + + +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Text; +using System.IO; +using System.Threading; +using System.Net; +using System.Net.Sockets; +using System.Timers; +using System.Reflection; +using System.Collections; +using System.Collections.Generic; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.world; +using OpenSim.GridServers; +using OpenSim.Assets; +using ServerConsole; +using PhysicsSystem; + +namespace OpenSim +{ + /// + /// Description of MainForm. + /// + public class OpenSim_Main + { + public static OpenSim_Main sim; + public static SimConfig cfg; + public static World local_world; + public static Grid gridServers; + + public static Socket Server; + private static IPEndPoint ServerIncoming; + private static byte[] RecvBuffer = new byte[4096]; + private byte[] ZeroBuffer = new byte[8192]; + private static IPEndPoint ipeSender; + private static EndPoint epSender; + private static AsyncCallback ReceivedData; + + public AssetCache assetCache; + public DateTime startuptime; + public Dictionary ClientThreads = new Dictionary(); + private PhysicsManager physManager; + private System.Timers.Timer timer1 = new System.Timers.Timer(); + private string ConfigDll = "SimConfig.dll"; + public bool sandbox = false; + public bool loginserver = false; + + [STAThread] + public static void Main( string[] args ) + { + Console.WriteLine("OpenSim " + VersionInfo.Version + "\n"); + Console.WriteLine("Starting...\n"); + ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local,"",0); + + sim = new OpenSim_Main(); + + for (int i = 0; i < args.Length; i++) + { + if(args[i] == "-sandbox") + { + sim.sandbox = true; + } + if(args[i] == "-loginserver") + { + sim.loginserver = true; + } + } + + OpenSim_Main.gridServers = new Grid(); + if(sim.sandbox) + { + OpenSim_Main.gridServers.AssetDll = "LocalGridServers.dll"; + OpenSim_Main.gridServers.GridDll = "LocalGridServers.dll"; + OpenSim_Main.gridServers.LoadPlugins(); + ServerConsole.MainConsole.Instance.WriteLine("Starting in Sandbox mode"); + } + else + { + OpenSim_Main.gridServers.AssetDll = "RemoteGridServers.dll"; + OpenSim_Main.gridServers.GridDll = "RemoteGridServers.dll"; + OpenSim_Main.gridServers.LoadPlugins(); + ServerConsole.MainConsole.Instance.WriteLine("Starting in Grid mode"); + } + + if(sim.loginserver && sim.sandbox) + { + LoginServer loginServer = new LoginServer(OpenSim_Main.gridServers.GridServer); + loginServer.Startup(); + } + sim.assetCache = new AssetCache(OpenSim_Main.gridServers.AssetServer); + + sim.Startup(); + + while(true) { + ServerConsole.MainConsole.Instance.MainConsolePrompt(); + } + } + + private OpenSim_Main() { + } + + private void Startup() { + startuptime=DateTime.Now; + timer1.Enabled = true; + timer1.Interval = 100; + timer1.Elapsed +=new ElapsedEventHandler( this.Timer1Tick ); + + // We check our local database first, then the grid for config options + ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration"); + cfg = this.LoadConfigDll(this.ConfigDll); + cfg.InitConfig(); + ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Contacting gridserver"); + cfg.LoadFromGrid(); + + ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString()); + ServerConsole.MainConsole.Instance.WriteLine("Initialising world"); + local_world = cfg.LoadWorld(); + + this.physManager = new PhysicsSystem.PhysicsManager(); + this.physManager.LoadPlugins(); + 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.SetTerrain(local_world.LandMap); + 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); + + MainServerListener(); + + } + + private SimConfig LoadConfigDll(string dllName) + { + Assembly pluginAssembly = Assembly.LoadFrom(dllName); + SimConfig config = null; + + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (pluginType.IsPublic) + { + if (!pluginType.IsAbstract) + { + Type typeInterface = pluginType.GetInterface("ISimConfig", true); + + if (typeInterface != null) + { + ISimConfig plug = (ISimConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + config = plug.GetConfigObject(); + break; + } + + typeInterface = null; + } + } + } + pluginAssembly = null; + return config; + } + + private void OnReceivedData(IAsyncResult result) { + ipeSender = new IPEndPoint(IPAddress.Any, 0); + epSender = (EndPoint)ipeSender; + Packet packet = null; + int numBytes = Server.EndReceiveFrom(result, ref epSender); + int packetEnd = numBytes - 1; + packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); + + // 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); + } + + private void MainServerListener() { + ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - New thread started"); + ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + cfg.IPListenAddr + ":" + cfg.IPListenPort); + + ServerIncoming = new IPEndPoint(IPAddress.Any, cfg.IPListenPort); + Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); + Server.Bind(ServerIncoming); + + ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen"); + + 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); + + ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Listening..."); + + } + + public static void Shutdown() { + ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing all threads"); + 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"); + ServerConsole.MainConsole.Instance.Close(); + Environment.Exit(0); + } + + void Timer1Tick( object sender, System.EventArgs e ) + { + + local_world.Update(); + } + } + + public class Grid + { + public IAssetServer AssetServer; + public IGridServer GridServer; + public string AssetDll = ""; + public string GridDll = ""; + + public Grid() + { + } + + public void LoadPlugins() + { + this.AssetServer = this.LoadAssetDll(this.AssetDll); + this.GridServer = this.LoadGridDll(this.GridDll); + } + + private IAssetServer LoadAssetDll(string dllName) + { + Assembly pluginAssembly = Assembly.LoadFrom(dllName); + IAssetServer server = null; + + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (pluginType.IsPublic) + { + if (!pluginType.IsAbstract) + { + Type typeInterface = pluginType.GetInterface("IAssetPlugin", true); + + if (typeInterface != null) + { + IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + server = plug.GetAssetServer(); + break; + } + + typeInterface = null; + } + } + } + pluginAssembly = null; + return server; + } + + private IGridServer LoadGridDll(string dllName) + { + Assembly pluginAssembly = Assembly.LoadFrom(dllName); + IGridServer server = null; + + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (pluginType.IsPublic) + { + if (!pluginType.IsAbstract) + { + Type typeInterface = pluginType.GetInterface("IGridPlugin", true); + + if (typeInterface != null) + { + IGridPlugin plug = (IGridPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + server = plug.GetGridServer(); + break; + } + + typeInterface = null; + } + } + } + pluginAssembly = null; + return server; + } + } +} diff --git a/src/OpenSimClient.cs b/src/OpenSimClient.cs new file mode 100644 index 0000000..8021d59 --- /dev/null +++ b/src/OpenSimClient.cs @@ -0,0 +1,387 @@ +/* +Copyright (c) OpenSim project, http://osgrid.org/ +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Collections; +using System.Collections.Generic; +using libsecondlife; +using libsecondlife.Packets; +using System.Net; +using System.Net.Sockets; +using System.IO; +using System.Threading; +using System.Timers; +using OpenSim.GridServers; + +namespace OpenSim +{ + /// + /// Handles new client connections + /// Constructor takes a single Packet and authenticates everything + /// + public class OpenSimClient { + + public LLUUID AgentID; + public LLUUID SessionID; + public uint CircuitCode; + public world.Avatar ClientAvatar; + private UseCircuitCodePacket cirpack; + private Thread ClientThread; + public EndPoint userEP; + private BlockingQueue PacketQueue; + private Dictionary PendingAcks = new Dictionary(); + private Dictionary NeedAck = new Dictionary(); + private System.Timers.Timer AckTimer; + private uint Sequence = 0; + private object SequenceLock = new object(); + private const int MAX_APPENDED_ACKS = 10; + private const int RESEND_TIMEOUT = 4000; + private const int MAX_SEQUENCE = 0xFFFFFF; + + public void ack_pack(Packet Pack) { + //libsecondlife.Packets.PacketAckPacket ack_it = new PacketAckPacket(); + //ack_it.Packets = new PacketAckPacket.PacketsBlock[1]; + //ack_it.Packets[0] = new PacketAckPacket.PacketsBlock(); + //ack_it.Packets[0].ID = Pack.Header.ID; + //ack_it.Header.Reliable = false; + + //OutPacket(ack_it); + + if (Pack.Header.Reliable) { + lock (PendingAcks) { + uint sequence = (uint)Pack.Header.Sequence; + if (!PendingAcks.ContainsKey(sequence)) { PendingAcks[sequence] = sequence; } + } + } + } + + public void ProcessInPacket(Packet Pack) { + ack_pack(Pack); + switch(Pack.Type) { + case PacketType.CompleteAgentMovement: + ClientAvatar.CompleteMovement(OpenSim_Main.local_world); + ClientAvatar.SendInitialPosition(); + break; + case PacketType.RegionHandshakeReply: + OpenSim_Main.local_world.SendLayerData(this); + break; + case PacketType.AgentWearablesRequest: + ClientAvatar.SendInitialAppearance(); + break; + case PacketType.ObjectAdd: + OpenSim_Main.local_world.AddNewPrim((ObjectAddPacket)Pack, this); + break; + case PacketType.TransferRequest: + //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); + TransferRequestPacket transfer = (TransferRequestPacket)Pack; + OpenSim_Main.sim.assetCache.AddAssetRequest(this, transfer); + break; + case PacketType.AgentUpdate: + ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack); + break; + case PacketType.LogoutRequest: + ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got a logout request"); + lock(OpenSim_Main.local_world.Entities) { + OpenSim_Main.local_world.Entities.Remove(this.AgentID); + } + //need to do other cleaning up here too + OpenSim_Main.gridServers.GridServer.LogoutSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); + this.ClientThread.Abort(); + break; + case PacketType.ChatFromViewer: + ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; + if(Helpers.FieldToString(inchatpack.ChatData.Message)=="") break; + + System.Text.Encoding _enc = System.Text.Encoding.ASCII; + libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); + reply.ChatData.Audible = 1; + reply.ChatData.Message = inchatpack.ChatData.Message; + reply.ChatData.ChatType = 1; + reply.ChatData.SourceType = 1; + reply.ChatData.Position = this.ClientAvatar.position; + reply.ChatData.FromName = _enc.GetBytes(this.ClientAvatar.firstname + " " + this.ClientAvatar.lastname + "\0"); + reply.ChatData.OwnerID = this.AgentID; + reply.ChatData.SourceID = this.AgentID; + foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { + client.OutPacket(reply); + } + break; + } + } + + private void ResendUnacked() + { + int now = Environment.TickCount; + + lock (NeedAck) + { + foreach (Packet packet in NeedAck.Values) + { + if (now - packet.TickCount > RESEND_TIMEOUT) + { + ServerConsole.MainConsole.Instance.WriteLine("Resending " + packet.Type.ToString() + " packet, " + + (now - packet.TickCount) + "ms have passed"); + + packet.Header.Resent = true; + OutPacket(packet); + } + } + } + } + + private void SendAcks() + { + lock (PendingAcks) + { + if (PendingAcks.Count > 0) + { + if (PendingAcks.Count > 250) + { + // FIXME: Handle the odd case where we have too many pending ACKs queued up + ServerConsole.MainConsole.Instance.WriteLine("Too many ACKs queued up!"); + return; + } + + ServerConsole.MainConsole.Instance.WriteLine("Sending PacketAck"); + + + int i = 0; + PacketAckPacket acks = new PacketAckPacket(); + acks.Packets = new PacketAckPacket.PacketsBlock[PendingAcks.Count]; + + foreach (uint ack in PendingAcks.Values) + { + acks.Packets[i] = new PacketAckPacket.PacketsBlock(); + acks.Packets[i].ID = ack; + i++; + } + + acks.Header.Reliable = false; + OutPacket(acks); + + PendingAcks.Clear(); + } + } + } + + private void AckTimer_Elapsed(object sender, ElapsedEventArgs ea) + { + SendAcks(); + ResendUnacked(); + } + + public void ProcessOutPacket(Packet Pack) { + + // Keep track of when this packet was sent out + Pack.TickCount = Environment.TickCount; + + if (!Pack.Header.Resent) + { + // Set the sequence number + lock (SequenceLock) + { + if (Sequence >= MAX_SEQUENCE) + Sequence = 1; + else + Sequence++; + Pack.Header.Sequence = Sequence; + } + + if (Pack.Header.Reliable) //DIRTY HACK + { + lock (NeedAck) + { + if (!NeedAck.ContainsKey(Pack.Header.Sequence)) + { + NeedAck.Add(Pack.Header.Sequence, Pack); + } + else + { + // Client.Log("Attempted to add a duplicate sequence number (" + + // packet.Header.Sequence + ") to the NeedAck dictionary for packet type " + + // packet.Type.ToString(), Helpers.LogLevel.Warning); + } + } + + // Don't append ACKs to resent packets, in case that's what was causing the + // delivery to fail + if (!Pack.Header.Resent) + { + // Append any ACKs that need to be sent out to this packet + lock (PendingAcks) + { + if (PendingAcks.Count > 0 && PendingAcks.Count < MAX_APPENDED_ACKS && + Pack.Type != PacketType.PacketAck && + Pack.Type != PacketType.LogoutRequest) + { + Pack.Header.AckList = new uint[PendingAcks.Count]; + int i = 0; + + foreach (uint ack in PendingAcks.Values) + { + Pack.Header.AckList[i] = ack; + i++; + } + + PendingAcks.Clear(); + Pack.Header.AppendedAcks = true; + } + } + } + } + } + + + byte[] ZeroOutBuffer = new byte[4096]; + byte[] sendbuffer; + sendbuffer = Pack.ToBytes(); + + try { + if (Pack.Header.Zerocoded) { + int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); + OpenSim_Main.Server.SendTo(ZeroOutBuffer, packetsize, SocketFlags.None,userEP); + } else { + OpenSim_Main.Server.SendTo(sendbuffer, sendbuffer.Length, SocketFlags.None,userEP); + } + } catch (Exception) { + ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread"); + ClientThread.Abort(); + } + + } + + public void InPacket(Packet NewPack) { + // Handle appended ACKs + if (NewPack.Header.AppendedAcks) + { + lock (NeedAck) + { + foreach (uint ack in NewPack.Header.AckList) + { + NeedAck.Remove(ack); + } + } + } + + // Handle PacketAck packets + if (NewPack.Type == PacketType.PacketAck) + { + PacketAckPacket ackPacket = (PacketAckPacket)NewPack; + + lock (NeedAck) + { + foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets) + { + NeedAck.Remove(block.ID); + } + } + } else if( ( NewPack.Type == PacketType.StartPingCheck ) ) { + //reply to pingcheck + libsecondlife.Packets.StartPingCheckPacket startPing = (libsecondlife.Packets.StartPingCheckPacket)NewPack; + libsecondlife.Packets.CompletePingCheckPacket endPing = new CompletePingCheckPacket(); + endPing.PingID.PingID = startPing.PingID.PingID; + OutPacket(endPing); + } + else + { + QueItem item = new QueItem(); + item.Packet = NewPack; + item.Incoming = true; + this.PacketQueue.Enqueue(item); + } + + } + + public void OutPacket(Packet NewPack) { + QueItem item = new QueItem(); + item.Packet = NewPack; + item.Incoming = false; + this.PacketQueue.Enqueue(item); + } + + public OpenSimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack) { + ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request"); + cirpack = initialcirpack; + userEP = remoteEP; + PacketQueue = new BlockingQueue(); + AckTimer = new System.Timers.Timer(500); + AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); + AckTimer.Start(); + + ClientThread = new Thread(new ThreadStart(AuthUser)); + ClientThread.IsBackground = true; + ClientThread.Start(); + } + + private void ClientLoop() { + ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:ClientLoop() - Entered loop"); + while(true) { + QueItem nextPacket = PacketQueue.Dequeue(); + if(nextPacket.Incoming) + { + //is a incoming packet + ProcessInPacket(nextPacket.Packet); + } + else + { + //is a out going packet + ProcessOutPacket(nextPacket.Packet); + } + } + } + + private void InitNewClient() { + ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); + OpenSim_Main.local_world.AddViewerAgent(this); + world.Entity tempent=OpenSim_Main.local_world.Entities[this.AgentID]; + this.ClientAvatar=(world.Avatar)tempent; + } + + private void AuthUser() + { + AuthenticateResponse sessionInfo = OpenSim_Main.gridServers.GridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); + if(!sessionInfo.Authorised) + { + //session/circuit not authorised + ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString()); + ClientThread.Abort(); + } + else + { + ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString()); + //session is authorised + this.AgentID=cirpack.CircuitCode.ID; + this.SessionID=cirpack.CircuitCode.SessionID; + this.CircuitCode=cirpack.CircuitCode.Code; + InitNewClient(); + this.ClientAvatar.firstname = sessionInfo.LoginInfo.First; + this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last; + ClientLoop(); + } + } + } + +} diff --git a/src/OpenSimConsole.cs b/src/OpenSimConsole.cs new file mode 100644 index 0000000..7d8563f --- /dev/null +++ b/src/OpenSimConsole.cs @@ -0,0 +1,194 @@ +/* +* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Threading; +using System.IO; +using System.Net; +using libsecondlife; +using libsecondlife.Packets; +using ServerConsole; + +namespace OpenSim +{ + /// + /// Description of ServerConsole. + /// + public class MServerConsole : ConsoleBase + { + + private ConsoleType ConsType; + StreamWriter Log; + + + // STUPID HACK ALERT!!!! STUPID HACK ALERT!!!!! + // constype - the type of console to use (see enum ConsoleType) + // sparam - depending on the console type: + // TCP - the IP to bind to (127.0.0.1 if blank) + // Local - param ignored + // SimChat - the AgentID of this sim's admin + // and for the iparam: + // TCP - the port to bind to + // Local - param ignored + // SimChat - the chat channel to accept commands from + public MServerConsole(ConsoleType constype, string sparam, int iparam) { + ConsType = constype; + switch(constype) { + case ConsoleType.Local: + Console.WriteLine("ServerConsole.cs - creating new local console"); + Console.WriteLine("Logs will be saved to current directory in opensim-console.log"); + Log=File.AppendText("opensim-console.log"); + Log.WriteLine("========================================================================"); + //Log.WriteLine("OpenSim " + VersionInfo.Version + " Started at " + DateTime.Now.ToString()); + break; + case ConsoleType.TCP: + break; + case ConsoleType.SimChat: + break; + + default: + Console.WriteLine("ServerConsole.cs - what are you smoking? that isn't a valid console type!"); + break; + } + } + + public override void Close() { + Log.WriteLine("OpenSim shutdown at " + DateTime.Now.ToString()); + Log.Close(); + } + + // You know what ReadLine() and WriteLine() do, right? And Read() and Write()? Right, you do actually know C#, right? Are you actually a programmer? Do you know english? Do you find my sense of humour in comments irritating? Good, glad you're still here + public override void WriteLine(string Line) { + Log.WriteLine(Line); + Console.WriteLine(Line); + return; + } + + public override string ReadLine() { + string TempStr=Console.ReadLine(); + Log.WriteLine(TempStr); + return TempStr; + } + + public override int Read() { + int TempInt= Console.Read(); + Log.Write((char)TempInt); + return TempInt; + } + + public override void Write(string Line) { + Console.Write(Line); + Log.Write(Line); + return; + } + + // Displays a command prompt and waits for the user to enter a string, then returns that string + public override string CmdPrompt(string prompt) { + this.Write(prompt); + return this.ReadLine(); + } + + // Displays a command prompt and returns a default value if the user simply presses enter + public override string CmdPrompt(string prompt, string defaultresponse) { + string temp=CmdPrompt(prompt); + if(temp=="") { + return defaultresponse; + } else { + return temp; + } + } + + // Displays a command prompt and returns a default value, user may only enter 1 of 2 options + public override string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB) { + bool itisdone=false; + string temp=CmdPrompt(prompt,defaultresponse); + while(itisdone==false) { + if((temp==OptionA) || (temp==OptionB)) { + itisdone=true; + } else { + this.WriteLine("Valid options are " + OptionA + " or " + OptionB); + temp=CmdPrompt(prompt,defaultresponse); + } + } + return temp; + } + + // Runs a command with a number of parameters + public override Object RunCmd(string Cmd, string[] cmdparams) { + switch(Cmd) { + case "help": + this.WriteLine("show users - show info about connected users"); + this.WriteLine("shutdown - disconnect all clients and shutdown"); + break; + + case "show": + ShowCommands(cmdparams[0]); + break; + + case "shutdown": + OpenSim_Main.Shutdown(); + break; + } + return null; + } + + // Shows data about something + public override void ShowCommands(string ShowWhat) { + switch(ShowWhat) { + case "uptime": + this.WriteLine("OpenSim has been running since " + OpenSim_Main.sim.startuptime.ToString()); + this.WriteLine("That is " + (DateTime.Now-OpenSim_Main.sim.startuptime).ToString()); + break; + case "users": + OpenSim.world.Avatar TempAv; + this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}","Firstname", "Lastname","Agent ID", "Session ID", "Circuit", "IP")); + foreach (libsecondlife.LLUUID UUID in OpenSim_Main.local_world.Entities.Keys) { + TempAv=(OpenSim.world.Avatar)OpenSim_Main.local_world.Entities[UUID]; + this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}",TempAv.firstname, TempAv.lastname,UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString())); + } + break; + } + } + + // Displays a prompt to the user and then runs the command they entered + public override void MainConsolePrompt() { + string[] tempstrarray; + string tempstr = this.CmdPrompt("OpenSim-" + OpenSim_Main.cfg.RegionHandle.ToString() + " # "); + tempstrarray = tempstr.Split(' '); + string cmd=tempstrarray[0]; + Array.Reverse(tempstrarray); + Array.Resize(ref tempstrarray,tempstrarray.Length-1); + Array.Reverse(tempstrarray); + string[] cmdparams=(string[])tempstrarray; + RunCmd(cmd,cmdparams); + } + } +} + + diff --git a/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs b/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs new file mode 100644 index 0000000..0fa7d6e --- /dev/null +++ b/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs @@ -0,0 +1,31 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("RemoteGridServers")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("RemoteGridServers")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 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.*")] diff --git a/src/RemoteServers/RemoteGridServers/RemoteGrid.cs b/src/RemoteServers/RemoteGridServers/RemoteGrid.cs new file mode 100644 index 0000000..f7c33e8 --- /dev/null +++ b/src/RemoteServers/RemoteGridServers/RemoteGrid.cs @@ -0,0 +1,241 @@ +/* +* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Net; +using System.Net.Sockets; +using System.IO; +using libsecondlife; +using OpenSim.GridServers; + +namespace RemoteGridServers +{ + /// + /// + /// + /// + + public class RemoteGridPlugin : IGridPlugin + { + public RemoteGridPlugin() + { + + } + + public IGridServer GetGridServer() + { + return(new RemoteGridServer()); + } + } + + public class RemoteAssetPlugin : IAssetPlugin + { + public RemoteAssetPlugin() + { + + } + + public IAssetServer GetAssetServer() + { + return(new RemoteAssetServer()); + } + } + public class RemoteGridServer :IGridServer + { + private string GridServerUrl; + private string GridSendKey; + + public RemoteGridServer() + { + ServerConsole.MainConsole.Instance.WriteLine("Remote Grid Server class created"); + } + + public bool RequestConnection() + { + return true; + } + public AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) + { + AuthenticateResponse user = new AuthenticateResponse(); + + WebRequest CheckSession = WebRequest.Create(GridServerUrl + "/usersessions/" + GridSendKey + "/" + agentID.ToString() + "/" + circuitCode.ToString() + "/exists"); + WebResponse GridResponse = CheckSession.GetResponse(); + StreamReader sr = new StreamReader(GridResponse.GetResponseStream()); + String grTest = sr.ReadLine(); + sr.Close(); + GridResponse.Close(); + if(String.IsNullOrEmpty(grTest) || grTest.Equals("1")) + { + // YAY! Valid login + user.Authorised = true; + user.LoginInfo = new Login(); + user.LoginInfo.Agent = agentID; + user.LoginInfo.Session = sessionID; + user.LoginInfo.First = ""; + user.LoginInfo.Last = ""; + + } + else + { + // Invalid + user.Authorised = false; + } + + return(user); + } + + public bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) + { + WebRequest DeleteSession = WebRequest.Create(GridServerUrl + "/usersessions/" + GridSendKey + "/" + agentID.ToString() + circuitCode.ToString() + "/delete"); + WebResponse GridResponse = DeleteSession.GetResponse(); + StreamReader sr = new StreamReader(GridResponse.GetResponseStream()); + String grTest = sr.ReadLine(); + sr.Close(); + GridResponse.Close(); + ServerConsole.MainConsole.Instance.WriteLine("DEBUG: " + grTest); + return(true); + } + + public UUIDBlock RequestUUIDBlock() + { + UUIDBlock uuidBlock = new UUIDBlock(); + return(uuidBlock); + } + + public void RequestNeighbours() + { + return; + } + + public void SetServerInfo(string ServerUrl, string ServerKey) + { + this.GridServerUrl = ServerUrl; + this.GridSendKey = ServerKey; + } + + public void AddNewSession(Login session) + { + + } + } + + + public class RemoteAssetServer : IAssetServer + { + private IAssetReceiver _receiver; + private BlockingQueue _assetRequests; + private Thread _remoteAssetServerThread; + private string AssetServerUrl; + private string AssetSendKey; + + public RemoteAssetServer() + { + this._assetRequests = new BlockingQueue(); + this._remoteAssetServerThread = new Thread(new ThreadStart(RunRequests)); + this._remoteAssetServerThread.IsBackground = true; + this._remoteAssetServerThread.Start(); + ServerConsole.MainConsole.Instance.WriteLine("Remote Asset Server class created"); + } + + public void SetReceiver(IAssetReceiver receiver) + { + this._receiver = receiver; + } + + public void RequestAsset(LLUUID assetID, bool isTexture) + { + ARequest req = new ARequest(); + req.AssetID = assetID; + req.IsTexture = isTexture; + this._assetRequests.Enqueue(req); + } + + public void UpdateAsset(AssetBase asset) + { + + } + + public void UploadNewAsset(AssetBase asset) + { + + } + + public void SetServerInfo(string ServerUrl, string ServerKey) + { + this.AssetServerUrl = ServerUrl; + this.AssetSendKey = ServerKey; + } + + private void RunRequests() + { + while(true) + { + //we need to add support for the asset server not knowing about a requested asset + ARequest req = this._assetRequests.Dequeue(); + LLUUID assetID = req.AssetID; + ServerConsole.MainConsole.Instance.WriteLine(" RemoteAssetServer- Got a AssetServer request, processing it"); + WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "getasset/" + AssetSendKey + "/" + assetID + "/data"); + WebResponse AssetResponse = AssetLoad.GetResponse(); + byte[] idata = new byte[(int)AssetResponse.ContentLength]; + BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream()); + idata = br.ReadBytes((int)AssetResponse.ContentLength); + br.Close(); + + AssetBase asset = new AssetBase(); + asset.FullID = assetID; + asset.Data = idata; + _receiver.AssetReceived(asset, req.IsTexture ); + } + } + } + + public class BlockingQueue< T > { + private Queue< T > _queue = new Queue< T >(); + private object _queueSync = new object(); + + public void Enqueue(T value) + { + lock(_queueSync) + { + _queue.Enqueue(value); + Monitor.Pulse(_queueSync); + } + } + + public T Dequeue() + { + lock(_queueSync) + { + if( _queue.Count < 1) + Monitor.Wait(_queueSync); + + return _queue.Dequeue(); + } + } + } +} diff --git a/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj b/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj new file mode 100644 index 0000000..6fc1e5a --- /dev/null +++ b/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj @@ -0,0 +1,49 @@ + + + Library + RemoteGridServers + RemoteGridServers + Debug + AnyCPU + {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5} + + + bin\Debug\ + False + DEBUG;TRACE + True + Full + True + + + bin\Release\ + True + TRACE + False + None + False + + + + + + ..\..\..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll + False + + + + + + + + + {C9A6026D-8E0C-4FE4-8691-FB2A566AA245} + ServerConsole + + + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9} + GridInterfaces + + + + \ No newline at end of file diff --git a/src/RemoteServers/RemoteGridServers/RemoteGridServers.sln b/src/RemoteServers/RemoteGridServers/RemoteGridServers.sln new file mode 100644 index 0000000..a990022 --- /dev/null +++ b/src/RemoteServers/RemoteGridServers/RemoteGridServers.sln @@ -0,0 +1,7 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# SharpDevelop 2.1.0.2017 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteGridServers", "RemoteGridServers.csproj", "{CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}" +EndProject +Global +EndGlobal diff --git a/src/RemoteServers/default.build b/src/RemoteServers/default.build new file mode 100644 index 0000000..8819600 --- /dev/null +++ b/src/RemoteServers/default.build @@ -0,0 +1,51 @@ + + + nant buildfile for OpenSim + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Second-server.csproj b/src/Second-server.csproj new file mode 100644 index 0000000..dfb5168 --- /dev/null +++ b/src/Second-server.csproj @@ -0,0 +1,92 @@ + + + Exe + OpenSim + OpenSim + Debug + AnyCPU + {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E} + OpenSim.OpenSim_Main + False + False + 4 + false + + + bin\ + False + DEBUG;TRACE + true + Full + True + + + ..\bin\ + True + TRACE + False + None + False + + + False + Auto + 4194304 + AnyCPU + 4096 + + + + + + + ..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll + False + + + ..\..\..\..\..\Opensim-pluginsystem\bin\Axiom.MathLib.dll + False + + + ..\bin\log4net.dll + False + + + + + + + + + + + + + + + + + + + + + + + + + + + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9} + GridInterfaces + + + {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B} + PhysicsManager + + + {C9A6026D-8E0C-4FE4-8691-FB2A566AA245} + ServerConsole + + + + \ No newline at end of file diff --git a/src/Second-server.sln b/src/Second-server.sln new file mode 100644 index 0000000..96755ee --- /dev/null +++ b/src/Second-server.sln @@ -0,0 +1,96 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# SharpDevelop 2.1.0.2017 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Second-server", "Second-server.csproj", "{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimConfig", "Config\SimConfig\SimConfig.csproj", "{B063760D-DB8D-4F64-B6FE-335FAD1E650A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalGridServers", "LocalServers\LocalGridServers\LocalGridServers.csproj", "{D7F0395B-FADC-4936-80A0-D95AACE92F62}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteGridServers", "RemoteServers\RemoteGridServers\RemoteGridServers.csproj", "{CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GridInterfaces", "GridInterfaces\GridInterfaces.csproj", "{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysicsManager", "physics\PhysicsManager.csproj", "{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysXplugin", "physics\plugins\PhysXplugin.csproj", "{ADB751AA-8426-4668-B1FA-43762126CEB3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerConsole", "ServerConsole\ServerConsole\ServerConsole.csproj", "{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|.NET 1.1 = Debug|.NET 1.1 + Debug|Any CPU = Debug|Any CPU + Release|.NET 1.1 = Release|.NET 1.1 + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|.NET 1.1.ActiveCfg = Debug|Any CPU + {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|.NET 1.1.Build.0 = Debug|Any CPU + {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|.NET 1.1.ActiveCfg = Release|Any CPU + {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|.NET 1.1.Build.0 = Release|.NET 1.1 + {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|Any CPU.Build.0 = Release|Any CPU + {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Debug|.NET 1.1.Build.0 = Debug|.NET 1.1 + {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Debug|.NET 1.1.ActiveCfg = Debug|.NET 1.1 + {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Release|.NET 1.1.Build.0 = Release|.NET 1.1 + {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1 + {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Release|Any CPU.Build.0 = Release|Any CPU + {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Debug|.NET 1.1.Build.0 = Debug|.NET 1.1 + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Debug|.NET 1.1.ActiveCfg = Debug|.NET 1.1 + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Release|.NET 1.1.Build.0 = Release|.NET 1.1 + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1 + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Release|Any CPU.Build.0 = Release|Any CPU + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Debug|.NET 1.1.Build.0 = Debug|.NET 1.1 + {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Debug|.NET 1.1.ActiveCfg = Debug|.NET 1.1 + {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Release|.NET 1.1.Build.0 = Release|.NET 1.1 + {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1 + {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Release|Any CPU.Build.0 = Release|Any CPU + {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Debug|.NET 1.1.Build.0 = Debug|.NET 1.1 + {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Debug|.NET 1.1.ActiveCfg = Debug|.NET 1.1 + {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Release|.NET 1.1.Build.0 = Release|.NET 1.1 + {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1 + {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Release|Any CPU.Build.0 = Release|Any CPU + {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|.NET 1.1.Build.0 = Debug|.NET 1.1 + {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|.NET 1.1.ActiveCfg = Debug|.NET 1.1 + {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|.NET 1.1.Build.0 = Release|.NET 1.1 + {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1 + {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|Any CPU.Build.0 = Release|Any CPU + {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ADB751AA-8426-4668-B1FA-43762126CEB3}.Debug|.NET 1.1.Build.0 = Debug|.NET 1.1 + {ADB751AA-8426-4668-B1FA-43762126CEB3}.Debug|.NET 1.1.ActiveCfg = Debug|.NET 1.1 + {ADB751AA-8426-4668-B1FA-43762126CEB3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ADB751AA-8426-4668-B1FA-43762126CEB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|.NET 1.1.Build.0 = Release|.NET 1.1 + {ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1 + {ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|Any CPU.Build.0 = Release|Any CPU + {ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Debug|.NET 1.1.Build.0 = Debug|.NET 1.1 + {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Debug|.NET 1.1.ActiveCfg = Debug|.NET 1.1 + {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|.NET 1.1.Build.0 = Release|.NET 1.1 + {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1 + {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|Any CPU.Build.0 = Release|Any CPU + {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|Any CPU.ActiveCfg = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/ServerConsole/ServerConsole/AssemblyInfo.cs b/src/ServerConsole/ServerConsole/AssemblyInfo.cs new file mode 100644 index 0000000..00a9b7d --- /dev/null +++ b/src/ServerConsole/ServerConsole/AssemblyInfo.cs @@ -0,0 +1,31 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("ServerConsole")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ServerConsole")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 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.*")] diff --git a/src/ServerConsole/ServerConsole/ServerConsole.cs b/src/ServerConsole/ServerConsole/ServerConsole.cs new file mode 100644 index 0000000..93c8114 --- /dev/null +++ b/src/ServerConsole/ServerConsole/ServerConsole.cs @@ -0,0 +1,91 @@ +/* +* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; + +namespace ServerConsole +{ + public class MainConsole { + + private static ConsoleBase instance; + + public static ConsoleBase Instance + { + get + { + return instance; + } + set + { + instance = value; + } + } + + public MainConsole() + { + + } + } + + public abstract class ConsoleBase + { + + public enum ConsoleType { + Local, // Use stdio + TCP, // Use TCP/telnet + SimChat // Use in-world chat (for gods) + } + + public abstract void Close(); + + // You know what ReadLine() and WriteLine() do, right? And Read() and Write()? Right, you do actually know C#, right? Are you actually a programmer? Do you know english? Do you find my sense of humour in comments irritating? Good, glad you're still here + public abstract void WriteLine(string Line) ; + + public abstract string ReadLine(); + + public abstract int Read() ; + + public abstract void Write(string Line) ; + + // Displays a command prompt and waits for the user to enter a string, then returns that string + public abstract string CmdPrompt(string prompt) ; + + // Displays a command prompt and returns a default value if the user simply presses enter + public abstract string CmdPrompt(string prompt, string defaultresponse); + + // Displays a command prompt and returns a default value, user may only enter 1 of 2 options + public abstract string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB) ; + + // Runs a command with a number of parameters + public abstract Object RunCmd(string Cmd, string[] cmdparams) ; + + // Shows data about something + public abstract void ShowCommands(string ShowWhat) ; + + // Displays a prompt to the user and then runs the command they entered + public abstract void MainConsolePrompt() ; + } +} diff --git a/src/ServerConsole/ServerConsole/ServerConsole.csproj b/src/ServerConsole/ServerConsole/ServerConsole.csproj new file mode 100644 index 0000000..3d85860 --- /dev/null +++ b/src/ServerConsole/ServerConsole/ServerConsole.csproj @@ -0,0 +1,35 @@ + + + Library + ServerConsole + ServerConsole + Debug + AnyCPU + {C9A6026D-8E0C-4FE4-8691-FB2A566AA245} + + + bin\Debug\ + False + DEBUG;TRACE + True + Full + True + + + bin\Release\ + True + TRACE + False + None + False + + + + + + + + + + + \ No newline at end of file diff --git a/src/ServerConsole/ServerConsole/ServerConsole.sln b/src/ServerConsole/ServerConsole/ServerConsole.sln new file mode 100644 index 0000000..07445db --- /dev/null +++ b/src/ServerConsole/ServerConsole/ServerConsole.sln @@ -0,0 +1,7 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# SharpDevelop 2.1.0.2017 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerConsole", "ServerConsole.csproj", "{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}" +EndProject +Global +EndGlobal diff --git a/src/ServerConsole/default.build b/src/ServerConsole/default.build new file mode 100644 index 0000000..a6f6dc2 --- /dev/null +++ b/src/ServerConsole/default.build @@ -0,0 +1,48 @@ + + + nant buildfile for OpenSim + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Util.cs b/src/Util.cs new file mode 100644 index 0000000..d575bee --- /dev/null +++ b/src/Util.cs @@ -0,0 +1,87 @@ +/* +Copyright (c) OpenSim project, http://osgrid.org/ + +* Copyright (c) , +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Collections.Generic; +using System.Threading; +using libsecondlife; +using libsecondlife.Packets; + +namespace OpenSim +{ + /// + /// + /// + public class Util + { + public static ulong UIntsToLong(uint X, uint Y) + { + return Helpers.UIntsToLong(X,Y); + } + public Util() + { + + } + } + + public class QueItem { + public QueItem() + { + } + + public Packet Packet; + public bool Incoming; + } + + + public class BlockingQueue< T > { + private Queue< T > _queue = new Queue< T >(); + private object _queueSync = new object(); + + public void Enqueue(T value) + { + lock(_queueSync) + { + _queue.Enqueue(value); + Monitor.Pulse(_queueSync); + } + } + + public T Dequeue() + { + lock(_queueSync) + { + if( _queue.Count < 1) + Monitor.Wait(_queueSync); + + return _queue.Dequeue(); + } + } + } +} diff --git a/src/VersionInfo.cs b/src/VersionInfo.cs new file mode 100644 index 0000000..949462c --- /dev/null +++ b/src/VersionInfo.cs @@ -0,0 +1,37 @@ +/* +Copyright (c) OpenSim project, http://osgrid.org/ +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; + +namespace OpenSim +{ + /// + /// + public class VersionInfo + { + public static string Version = "0.1, Build 1173288035, Revision 148M"; + } +} diff --git a/src/VersionInfo.cs.template b/src/VersionInfo.cs.template new file mode 100644 index 0000000..e4e1b95 --- /dev/null +++ b/src/VersionInfo.cs.template @@ -0,0 +1,37 @@ +/* +Copyright (c) OpenSim project, http://osgrid.org/ +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; + +namespace OpenSim +{ + /// + /// + public class VersionInfo + { + public static string Version = "@@VERSION"; + } +} diff --git a/src/physics/AssemblyInfo.cs b/src/physics/AssemblyInfo.cs new file mode 100644 index 0000000..57a8913 --- /dev/null +++ b/src/physics/AssemblyInfo.cs @@ -0,0 +1,31 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("PhysicsManager")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("PhysicsManager")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 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.*")] diff --git a/src/physics/PhysicsManager.cs b/src/physics/PhysicsManager.cs new file mode 100644 index 0000000..0986501 --- /dev/null +++ b/src/physics/PhysicsManager.cs @@ -0,0 +1,167 @@ +/* +* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Collections; +using System.IO; +using System.Reflection; + +namespace PhysicsSystem +{ + /// + /// Description of MyClass. + /// + public class PhysicsManager + { + private Dictionary _plugins=new Dictionary(); + + public PhysicsManager() + { + + } + + public PhysicsScene GetPhysicsScene(string engineName) + { + if(_plugins.ContainsKey(engineName)) + { + ServerConsole.MainConsole.Instance.WriteLine("creating "+engineName); + return _plugins[engineName].GetScene(); + } + else + { + ServerConsole.MainConsole.Instance.WriteLine("couldn't find physicsEngine: "+ engineName); + return null; + } + } + + public void LoadPlugins() + { + string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory ,"Physics"); + string[] pluginFiles = Directory.GetFiles(path, "*.dll"); + + + for(int i= 0; i + + Library + PhysicsManager + PhysicsManager + Debug + AnyCPU + {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B} + + + bin\Debug\ + False + DEBUG;TRACE + True + Full + True + + + bin\Release\ + True + TRACE + False + None + False + + + + + + + + + + + + {C9A6026D-8E0C-4FE4-8691-FB2A566AA245} + ServerConsole + + + + \ No newline at end of file diff --git a/src/physics/PhysicsManager.sln b/src/physics/PhysicsManager.sln new file mode 100644 index 0000000..565813f --- /dev/null +++ b/src/physics/PhysicsManager.sln @@ -0,0 +1,23 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# SharpDevelop 2.1.0.2017 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysicsManager", "PhysicsManager.csproj", "{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysXplugin", "..\PhysXplugin\PhysXplugin\PhysXplugin.csproj", "{ADB751AA-8426-4668-B1FA-43762126CEB3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|Any CPU.Build.0 = Release|Any CPU + {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ADB751AA-8426-4668-B1FA-43762126CEB3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ADB751AA-8426-4668-B1FA-43762126CEB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|Any CPU.Build.0 = Release|Any CPU + {ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|Any CPU.ActiveCfg = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/src/physics/default.build b/src/physics/default.build new file mode 100644 index 0000000..d39e62b --- /dev/null +++ b/src/physics/default.build @@ -0,0 +1,49 @@ + + + nant buildfile for OpenSim + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/physics/plugins/AssemblyInfo.cs b/src/physics/plugins/AssemblyInfo.cs new file mode 100644 index 0000000..0c9c06c --- /dev/null +++ b/src/physics/plugins/AssemblyInfo.cs @@ -0,0 +1,31 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("PhysXplugin")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("PhysXplugin")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 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.*")] diff --git a/src/physics/plugins/PhysXplugin.cs b/src/physics/plugins/PhysXplugin.cs new file mode 100644 index 0000000..58a82fb --- /dev/null +++ b/src/physics/plugins/PhysXplugin.cs @@ -0,0 +1,199 @@ +/* +* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using PhysicsSystem; + +namespace PhysXplugin +{ + /// + /// Will be the PhysX plugin but for now will be a very basic physics engine + /// + public class PhysXPlugin : IPhysicsPlugin + { + private PhysXScene _mScene; + + public PhysXPlugin() + { + + } + + public bool Init() + { + return true; + } + + public PhysicsScene GetScene() + { + if(_mScene == null) + { + _mScene = new PhysXScene(); + } + return(_mScene); + } + + public string GetName() + { + return("PhysX"); + } + + public void Dispose() + { + + } + } + + public class PhysXScene :PhysicsScene + { + private List _actors = new List(); + private float[] _heightMap; + + public PhysXScene() + { + + } + + public override PhysicsActor AddAvatar(PhysicsVector position) + { + PhysXActor act = new PhysXActor(); + act.Position = position; + _actors.Add(act); + return act; + } + + public override void Simulate(float timeStep) + { + foreach (PhysXActor actor in _actors) + { + actor.Position.X = actor.Position.X + actor.Velocity.X * timeStep; + actor.Position.Y = actor.Position.Y + actor.Velocity.Y * timeStep; + actor.Position.Z = actor.Position.Z + actor.Velocity.Z * timeStep; + actor.Position.Z = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X]+1; + if(actor.Position.X<0) + { + actor.Position.X = 0; + actor.Velocity.X = 0; + } + if(actor.Position.Y < 0) + { + actor.Position.Y = 0; + actor.Velocity.Y = 0; + } + if(actor.Position.X > 255) + { + actor.Position.X = 255; + actor.Velocity.X = 0; + } + if(actor.Position.Y > 255) + { + actor.Position.Y = 255; + actor.Velocity.X = 0; + } + } + } + + public override void GetResults() + { + + } + + public override bool IsThreaded + { + get + { + return(false); // for now we won't be multithreaded + } + } + + public override void SetTerrain(float[] heightMap) + { + this._heightMap = heightMap; + } + } + + public class PhysXActor : PhysicsActor + { + private PhysicsVector _position; + private PhysicsVector _velocity; + private PhysicsVector _acceleration; + + public PhysXActor() + { + _velocity = new PhysicsVector(); + _position = new PhysicsVector(); + _acceleration = new PhysicsVector(); + } + + public override PhysicsVector Position + { + get + { + return _position; + } + set + { + _position = value; + } + } + + public override PhysicsVector Velocity + { + get + { + return _velocity; + } + set + { + _velocity = value; + } + } + + public override PhysicsVector Acceleration + { + get + { + return _acceleration; + } + + } + public void SetAcceleration (PhysicsVector accel) + { + this._acceleration = accel; + } + + public override void AddForce(PhysicsVector force) + { + + } + + public override void SetMomentum(PhysicsVector momentum) + { + + } + } + +} diff --git a/src/physics/plugins/PhysXplugin.csproj b/src/physics/plugins/PhysXplugin.csproj new file mode 100644 index 0000000..1b84046 --- /dev/null +++ b/src/physics/plugins/PhysXplugin.csproj @@ -0,0 +1,41 @@ + + + Library + PhysXplugin + PhysXplugin + Debug + AnyCPU + {ADB751AA-8426-4668-B1FA-43762126CEB3} + + + bin\Debug\ + False + DEBUG;TRACE + True + Full + True + + + bin\Release\ + True + TRACE + False + None + False + + + + + + + + + + + + {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B} + PhysicsManager + + + + \ No newline at end of file diff --git a/src/physics/plugins/PhysXplugin.sln b/src/physics/plugins/PhysXplugin.sln new file mode 100644 index 0000000..06e73d1 --- /dev/null +++ b/src/physics/plugins/PhysXplugin.sln @@ -0,0 +1,17 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# SharpDevelop 2.1.0.2017 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysXplugin", "PhysXplugin.csproj", "{ADB751AA-8426-4668-B1FA-43762126CEB3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {ADB751AA-8426-4668-B1FA-43762126CEB3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ADB751AA-8426-4668-B1FA-43762126CEB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|Any CPU.Build.0 = Release|Any CPU + {ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|Any CPU.ActiveCfg = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/src/physics/plugins/default.build b/src/physics/plugins/default.build new file mode 100644 index 0000000..c40fea1 --- /dev/null +++ b/src/physics/plugins/default.build @@ -0,0 +1,49 @@ + + + nant buildfile for OpenSim + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/types/Mesh.cs b/src/types/Mesh.cs new file mode 100644 index 0000000..3e00c91 --- /dev/null +++ b/src/types/Mesh.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.types +{ + // TODO: This will need some performance tuning no doubt. + public class Mesh + { + public List mesh; + + public Mesh() + { + mesh = new List(); + } + + public void AddTri(Triangle tri) + { + mesh.Add(tri); + } + + public static Mesh operator +(Mesh a, Mesh b) + { + a.mesh.AddRange(b.mesh); + return a; + } + } +} diff --git a/src/types/Triangle.cs b/src/types/Triangle.cs new file mode 100644 index 0000000..8dfea6e --- /dev/null +++ b/src/types/Triangle.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Axiom.MathLib; + +namespace OpenSim.types +{ + public class Triangle + { + Vector3 a; + Vector3 b; + Vector3 c; + + public Triangle() + { + a = new Vector3(); + b = new Vector3(); + c = new Vector3(); + } + + public Triangle(Vector3 A, Vector3 B, Vector3 C) + { + a = A; + b = B; + c = C; + } + } +} diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs new file mode 100644 index 0000000..c8469f8 --- /dev/null +++ b/src/world/Avatar.cs @@ -0,0 +1,355 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using libsecondlife; +using libsecondlife.Packets; +using PhysicsSystem; +using Axiom.MathLib; + +namespace OpenSim.world +{ + public class Avatar : Entity + { + public string firstname; + public string lastname; + public OpenSimClient ControllingClient; + private PhysicsActor _physActor; + private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; + private bool updateflag; + private bool walking; + private List forcesList = new List(); + private short _updateCount; + + public Avatar(OpenSimClient TheClient) { + ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); + ControllingClient=TheClient; + SetupTemplate("avatar-template.dat"); + 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 + { + set + { + this._physActor = value; + } + } + public override void addForces() + { + lock(this.forcesList) + { + if(this.forcesList.Count>0) + { + for(int i=0 ; i < this.forcesList.Count; i++) + { + NewForce force = this.forcesList[i]; + PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z); + this._physActor.Velocity = phyVector; + this.updateflag = true; + this.velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this + // but as we are setting the velocity (rather than using real forces) at the moment it is okay. + } + for(int i=0 ; i < this.forcesList.Count; i++) + { + this.forcesList.RemoveAt(0); + } + } + } + } + + public override void update() + { + + if(this.updateflag) + { + //need to send movement info + //so create the improvedterseobjectupdate packet + //use CreateTerseBlock() + ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); + ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); + terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME + terse.RegionData.TimeDilation = 64096; + terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; + terse.ObjectData[0] = terseBlock; + foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { + client.OutPacket(terse); + } + + updateflag =false; + this._updateCount = 0; + } + else + { + if(walking) + { + _updateCount++; + if(_updateCount>3) + { + //It has been a while since last update was sent so lets send one. + ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); + ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); + terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME + terse.RegionData.TimeDilation = 64096; + terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; + terse.ObjectData[0] = terseBlock; + foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { + client.OutPacket(terse); + } + _updateCount = 0; + } + } + } + } + + private void SetupTemplate(string name) + { + + int i = 0; + FileInfo fInfo = new FileInfo(name); + long numBytes = fInfo.Length; + FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); + BinaryReader br = new BinaryReader(fStream); + byte [] data1 = br.ReadBytes((int)numBytes); + br.Close(); + fStream.Close(); + + libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); + + System.Text.Encoding enc = System.Text.Encoding.ASCII; + libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16); + pos.X = 100f; + objdata.ID = 8880000; + objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0"); + libsecondlife.LLVector3 pos2 = new LLVector3(100f,100f,23f); + //objdata.FullID=user.AgentID; + byte[] pb = pos.GetBytes(); + Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length); + + AvatarTemplate = objdata; + + } + + public void CompleteMovement(World RegionInfo) { + ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet"); + AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); + mov.AgentData.SessionID = this.ControllingClient.SessionID; + mov.AgentData.AgentID = this.ControllingClient.AgentID; + mov.Data.RegionHandle = OpenSim_Main.cfg.RegionHandle; + // TODO - dynamicalise this stuff + mov.Data.Timestamp = 1172750370; + mov.Data.Position = new LLVector3(100f, 100f, 23f); + mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0); + + ControllingClient.OutPacket(mov); + } + + public void SendInitialPosition() { + + System.Text.Encoding _enc = System.Text.Encoding.ASCII; + //send a objectupdate packet with information about the clients avatar + ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); + objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; + objupdate.RegionData.TimeDilation = 64096; + objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; + + objupdate.ObjectData[0] = AvatarTemplate; + //give this avatar object a local id and assign the user a name + objupdate.ObjectData[0].ID = this.localid; + objupdate.ObjectData[0].FullID = ControllingClient.AgentID; + objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0"); + + libsecondlife.LLVector3 pos2 = new LLVector3((float)this.position.X, (float)this.position.Y, (float)this.position.Z); + + byte[] pb = pos2.GetBytes(); + + Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); + OpenSim_Main.local_world._localNumber++; + this.ControllingClient.OutPacket(objupdate); + } + + public void SendInitialAppearance() { + AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); + aw.AgentData.AgentID = this.ControllingClient.AgentID; + aw.AgentData.SerialNum = 0; + aw.AgentData.SessionID = ControllingClient.SessionID; + + aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; + AgentWearablesUpdatePacket.WearableDataBlock awb = new AgentWearablesUpdatePacket.WearableDataBlock(); + awb.WearableType = (byte)0; + awb.AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); + awb.ItemID = LLUUID.Random(); + aw.WearableData[0] = awb; + + for(int i=1; i<13; i++) { + awb = new AgentWearablesUpdatePacket.WearableDataBlock(); + awb.WearableType = (byte)i; + awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); + awb.ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); + aw.WearableData[i] = awb; + } + + ControllingClient.OutPacket(aw); + } + + public void HandleUpdate(AgentUpdatePacket pack) { + if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) !=0) { + if(!walking) + { + //we should add a new force to the list + // but for now we will deal with velocities + NewForce newVelocity = new NewForce(); + Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0); + Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z); + Axiom.MathLib.Vector3 direc = q * v3; + direc.Normalize(); + + //work out velocity for sim physics system + direc = direc * ((0.03f) * 128f); + newVelocity.X = direc.x; + newVelocity.Y = direc.y; + newVelocity.Z = direc.z; + this.forcesList.Add(newVelocity); + walking=true; + } + } + else + { + if(walking) + { + NewForce newVelocity = new NewForce(); + newVelocity.X = 0; + newVelocity.Y = 0; + newVelocity.Z = 0; + this.forcesList.Add(newVelocity); + walking = false; + } + } + } + + //should be moved somewhere else + public void SendRegionHandshake(World RegionInfo) { + ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet"); + System.Text.Encoding _enc = System.Text.Encoding.ASCII; + RegionHandshakePacket handshake = new RegionHandshakePacket(); + + ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionhandshake() - Filling in RegionHandshake details"); + handshake.RegionInfo.BillableFactor = 0; + handshake.RegionInfo.IsEstateManager = false; + handshake.RegionInfo.TerrainHeightRange00 = 60; + handshake.RegionInfo.TerrainHeightRange01 = 60; + handshake.RegionInfo.TerrainHeightRange10 = 60; + handshake.RegionInfo.TerrainHeightRange11 = 60; + handshake.RegionInfo.TerrainStartHeight00 = 10; + handshake.RegionInfo.TerrainStartHeight01 = 10; + handshake.RegionInfo.TerrainStartHeight10 = 10; + handshake.RegionInfo.TerrainStartHeight11 = 10; + handshake.RegionInfo.SimAccess = 13; + handshake.RegionInfo.WaterHeight = 5; + handshake.RegionInfo.RegionFlags = 72458694; + handshake.RegionInfo.SimName = _enc.GetBytes(OpenSim_Main.cfg.RegionName + "\0"); + handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); + handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); + handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3"); + handshake.RegionInfo.TerrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f"); + handshake.RegionInfo.TerrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2"); + handshake.RegionInfo.TerrainDetail0 = new LLUUID("00000000-0000-0000-0000-000000000000"); + handshake.RegionInfo.TerrainDetail1 = new LLUUID("00000000-0000-0000-0000-000000000000"); + handshake.RegionInfo.TerrainDetail2 = new LLUUID("00000000-0000-0000-0000-000000000000"); + handshake.RegionInfo.TerrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000"); + handshake.RegionInfo.CacheID = new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37"); + + ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionHandshake() - Sending RegionHandshake packet"); + this.ControllingClient.OutPacket(handshake); + } + + public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock() + { + byte[] bytes = new byte[60]; + int i=0; + ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); + + dat.TextureEntry = AvatarTemplate.TextureEntry; + libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z); + + uint ID = this.localid; + + bytes[i++] = (byte)(ID % 256); + bytes[i++] = (byte)((ID >> 8) % 256); + bytes[i++] = (byte)((ID >> 16) % 256); + bytes[i++] = (byte)((ID >> 24) % 256); + bytes[i++] = 0; + bytes[i++] = 1; + i += 14; + bytes[i++] = 128; + bytes[i++] = 63; + + byte[] pb = pos2.GetBytes(); + Array.Copy(pb, 0, bytes, i, pb.Length); + i += 12; + ushort InternVelocityX; + ushort InternVelocityY; + ushort InternVelocityZ; + + Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(this._physActor.Velocity.X, this._physActor.Velocity.Y, this._physActor.Velocity.Z); + internDirec = internDirec /128.0f; + internDirec.x += 1; + internDirec.y += 1; + internDirec.z += 1; + + InternVelocityX = (ushort)(32768 * internDirec.x); + InternVelocityY = (ushort)(32768 * internDirec.y); + InternVelocityZ = (ushort)(32768 * internDirec.z); + + ushort ac = 32767; + bytes[i++] = (byte)(InternVelocityX % 256); + bytes[i++] = (byte)((InternVelocityX >> 8) % 256); + bytes[i++] = (byte)(InternVelocityY % 256); + bytes[i++] = (byte)((InternVelocityY>> 8) % 256); + bytes[i++] = (byte)(InternVelocityZ % 256); + bytes[i++] = (byte)((InternVelocityZ >> 8) % 256); + + //accel + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + + //rot + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + + //rotation vel + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + + dat.Data=bytes; + return(dat); + } + } + + public class NewForce + { + public float X; + public float Y; + public float Z; + + public NewForce() + { + + } + } +} diff --git a/src/world/Entity.cs b/src/world/Entity.cs new file mode 100644 index 0000000..147478b --- /dev/null +++ b/src/world/Entity.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Axiom.MathLib; +using OpenSim.types; +using libsecondlife; + +namespace OpenSim.world +{ + public class Entity + { + public libsecondlife.LLUUID uuid; + public uint localid; + public LLVector3 position; + public LLVector3 velocity; + public Quaternion rotation; + protected string name; + protected List children; + + public Entity() + { + uuid = new libsecondlife.LLUUID(); + localid = 8880000 + (OpenSim_Main.local_world._localNumber++); // FIXME - race condition! + position = new LLVector3(); + velocity = new LLVector3(); + rotation = new Quaternion(); + name = "(basic entity)"; + children = new List(); + } + public virtual void addForces() + { + foreach (Entity child in children) + { + child.addForces(); + } + } + public virtual void update() { + // Do any per-frame updates needed that are applicable to every type of entity + foreach (Entity child in children) + { + child.update(); + } + } + + public virtual string getName() + { + return name; + } + + public virtual Mesh getMesh() + { + Mesh mesh = new Mesh(); + + foreach (Entity child in children) + { + mesh += child.getMesh(); + } + + return mesh; + } + } +} diff --git a/src/world/Primitive.cs b/src/world/Primitive.cs new file mode 100644 index 0000000..18b5715 --- /dev/null +++ b/src/world/Primitive.cs @@ -0,0 +1,136 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.types; +using libsecondlife; +using libsecondlife.Packets; + +namespace OpenSim.world +{ + public class Primitive : Entity + { + protected float mesh_cutbegin; + protected float mesh_cutend; + protected PrimData primData; + protected bool newPrimFlag; + protected ObjectUpdatePacket OurPacket; + + public Primitive() + { + mesh_cutbegin = 0.0f; + mesh_cutend = 1.0f; + } + + public override Mesh getMesh() + { + Mesh mesh = new Mesh(); + Triangle tri = new Triangle( + new Axiom.MathLib.Vector3(0.0f, 1.0f, 1.0f), + new Axiom.MathLib.Vector3(1.0f, 0.0f, 1.0f), + new Axiom.MathLib.Vector3(1.0f, 1.0f, 0.0f)); + + mesh.AddTri(tri); + mesh += base.getMesh(); + + 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() + { + + } + } +} diff --git a/src/world/ScriptEngine.cs b/src/world/ScriptEngine.cs new file mode 100644 index 0000000..f20a08e --- /dev/null +++ b/src/world/ScriptEngine.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.world +{ + public class ScriptEngine + { + public ScriptEngine(World env) + { + } + + public void LoadScript() + { + + } + } +} diff --git a/src/world/SurfacePatch.cs b/src/world/SurfacePatch.cs new file mode 100644 index 0000000..71e4116 --- /dev/null +++ b/src/world/SurfacePatch.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.world +{ + public class SurfacePatch + { + public float[] HeightMap; + + public SurfacePatch() { + HeightMap = new float[16*16]; + + int xinc; + int yinc; + for(xinc=0; xinc<16; xinc++) for(yinc=0; yinc<16; yinc++) { + HeightMap[xinc+(yinc*16)]=100.0f; + } + + } + } +} diff --git a/src/world/World.cs b/src/world/World.cs new file mode 100644 index 0000000..8427a38 --- /dev/null +++ b/src/world/World.cs @@ -0,0 +1,117 @@ +using System; +using libsecondlife; +using libsecondlife.Packets; +using System.Collections.Generic; +using System.Text; +using PhysicsSystem; + +namespace OpenSim.world +{ + public class World + { + public Dictionary Entities; + public float[] LandMap; + public ScriptEngine Scripts; + public uint _localNumber=0; + private PhysicsScene phyScene; + private float timeStep= 0.1f; + private libsecondlife.TerrainManager TerrainManager; + + private Random Rand = new Random(); + private uint _primCount = 702000; + + public World() + { + ServerConsole.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance"); + Entities = new Dictionary(); + + ServerConsole.MainConsole.Instance.WriteLine("World.cs - creating LandMap"); + TerrainManager = new TerrainManager(new SecondLife()); + + // ServerConsole.MainConsole.Instance.WriteLine("World.cs - Creating script engine instance"); + // Initialise this only after the world has loaded + // Scripts = new ScriptEngine(this); + } + + public PhysicsScene PhysScene + { + set + { + this.phyScene = value; + } + get + { + return(this.phyScene); + } + } + + public void Update() + { + + if(this.phyScene.IsThreaded) + { + this.phyScene.GetResults(); + + } + + foreach (libsecondlife.LLUUID UUID in Entities.Keys) + { + Entities[UUID].addForces(); + } + + this.phyScene.Simulate(timeStep); + + foreach (libsecondlife.LLUUID UUID in Entities.Keys) + { + Entities[UUID].update(); + } + } + + public void SendLayerData(OpenSimClient RemoteClient) { + int[] patches = new int[4]; + + for (int y = 0; y < 16; y++) + { + for (int x = 0; x < 16; x = x + 4) + { + patches[0] = x + 0 + y * 16; + patches[1] = x + 1 + y * 16; + patches[2] = x + 2 + y * 16; + patches[3] = x + 3 + y * 16; + + Packet layerpack = TerrainManager.CreateLandPacket(LandMap, patches); + RemoteClient.OutPacket(layerpack); + } + } + } + + public void AddViewerAgent(OpenSimClient AgentClient) { + ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); + Avatar NewAvatar = new Avatar(AgentClient); + ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); + ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); + NewAvatar.SendRegionHandshake(this); + + NewAvatar.PhysActor = this.phyScene.AddAvatar(new PhysicsVector(NewAvatar.position.X, NewAvatar.position.Y, NewAvatar.position.Z)); + //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); + } + + 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() { + /* TODO: Save the current world entities state. */ + + return false; + } + + + } +} diff --git a/src/world/scripting/IScript.cs b/src/world/scripting/IScript.cs new file mode 100644 index 0000000..550594d --- /dev/null +++ b/src/world/scripting/IScript.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.world.scripting +{ + public interface IScriptHost { + bool Register(IScript iscript); + } + public interface IScript + { + string Name{get;set;} + IScriptHost Host{get;set;} + void Show(); + } +} -- cgit v1.1