Merge branch 'master' into vehicles

0.6.8-post-fixes
Melanie 2009-10-02 19:53:42 +01:00
commit 9eccea5777
41 changed files with 852 additions and 2817 deletions

View File

@ -826,12 +826,7 @@ namespace OpenSim.Client.MXP.ClientStack
OpenSim.Region.Framework.Scenes.Scene scene=(OpenSim.Region.Framework.Scenes.Scene)Scene; OpenSim.Region.Framework.Scenes.Scene scene=(OpenSim.Region.Framework.Scenes.Scene)Scene;
AvatarAppearance appearance; AvatarAppearance appearance;
scene.GetAvatarAppearance(this,out appearance); scene.GetAvatarAppearance(this,out appearance);
List<byte> visualParams = new List<byte>(); OnSetAppearance(appearance.Texture, (byte[])appearance.VisualParams.Clone());
foreach (byte visualParam in appearance.VisualParams)
{
visualParams.Add(visualParam);
}
OnSetAppearance(appearance.Texture.GetBytes(), visualParams);
} }
public void Stop() public void Stop()
@ -1649,5 +1644,9 @@ namespace OpenSim.Client.MXP.ClientStack
public void SendPickInfoReply(UUID pickID,UUID creatorID, bool topPick, UUID parcelID, string name, string desc, UUID snapshotID, string user, string originalName, string simName, Vector3 posGlobal, int sortOrder, bool enabled) public void SendPickInfoReply(UUID pickID,UUID creatorID, bool topPick, UUID parcelID, string name, string desc, UUID snapshotID, string user, string originalName, string simName, Vector3 posGlobal, int sortOrder, bool enabled)
{ {
} }
public void SendRebakeAvatarTextures(UUID textureID)
{
}
} }
} }

View File

@ -1145,5 +1145,9 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
} }
#endregion #endregion
public void SendRebakeAvatarTextures(UUID textureID)
{
}
} }
} }

View File

@ -380,13 +380,13 @@ namespace OpenSim.Framework
/// <summary> /// <summary>
/// Set up appearance textures and avatar parameters, including a height calculation /// Set up appearance textures and avatar parameters, including a height calculation
/// </summary> /// </summary>
/// <param name="texture"></param> public virtual void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams)
/// <param name="visualParam"></param>
public virtual void SetAppearance(byte[] texture, List<byte> visualParam)
{ {
Primitive.TextureEntry textureEnt = new Primitive.TextureEntry(texture, 0, texture.Length); if (textureEntry != null)
m_texture = textureEnt; m_texture = textureEntry;
m_visualparams = visualParam.ToArray(); if (visualParams != null)
m_visualparams = visualParams;
m_avatarHeight = 1.23077f // Shortest possible avatar height m_avatarHeight = 1.23077f // Shortest possible avatar height
+ 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height
+ 0.072514f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f // Head size + 0.072514f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f // Head size

View File

@ -66,7 +66,9 @@ namespace OpenSim.Framework
if (m_pqueue.Count > 0) if (m_pqueue.Count > 0)
return m_pqueue.Dequeue(); return m_pqueue.Dequeue();
if (m_queue.Count > 0)
return m_queue.Dequeue(); return m_queue.Dequeue();
return default(T);
} }
} }
@ -119,6 +121,7 @@ namespace OpenSim.Framework
{ {
m_pqueue.Clear(); m_pqueue.Clear();
m_queue.Clear(); m_queue.Clear();
Monitor.Pulse(m_queueSync);
} }
} }
} }

View File

@ -65,7 +65,7 @@ namespace OpenSim.Framework
public delegate void NetworkStats(int inPackets, int outPackets, int unAckedBytes); public delegate void NetworkStats(int inPackets, int outPackets, int unAckedBytes);
public delegate void SetAppearance(byte[] texture, List<byte> visualParamList); public delegate void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams);
public delegate void StartAnim(IClientAPI remoteClient, UUID animID); public delegate void StartAnim(IClientAPI remoteClient, UUID animID);
@ -1127,7 +1127,6 @@ namespace OpenSim.Framework
void SetClientOption(string option, string value); void SetClientOption(string option, string value);
string GetClientOption(string option); string GetClientOption(string option);
void Terminate();
void SendSetFollowCamProperties(UUID objectID, SortedDictionary<int, float> parameters); void SendSetFollowCamProperties(UUID objectID, SortedDictionary<int, float> parameters);
void SendClearFollowCamProperties(UUID objectID); void SendClearFollowCamProperties(UUID objectID);
@ -1175,5 +1174,7 @@ namespace OpenSim.Framework
void KillEndDone(); void KillEndDone();
bool AddGenericPacketHandler(string MethodName, GenericMessage handler); bool AddGenericPacketHandler(string MethodName, GenericMessage handler);
void SendRebakeAvatarTextures(UUID textureID);
} }
} }

View File

@ -234,6 +234,7 @@ namespace OpenSim.Framework
lock (DataBlocks) lock (DataBlocks)
{ {
if (DataBlocks[typeof(T)].Count < 50)
DataBlocks[typeof(T)].Push(block); DataBlocks[typeof(T)].Push(block);
} }
} }

View File

@ -1,70 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* 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 OpenSimulator Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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.Text;
using NUnit.Framework;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Framework.Servers.HttpServer.Tests
{
[TestFixture]
public class BaseRequestHandlerTests
{
private const string BASE_PATH = "/testpath";
private class BaseRequestHandlerImpl : BaseRequestHandler
{
public BaseRequestHandlerImpl(string httpMethod, string path) : base(httpMethod, path)
{
}
}
[Test]
public void TestConstructor()
{
new BaseRequestHandlerImpl(null, null);
}
[Test]
public void TestGetParams()
{
BaseRequestHandlerImpl handler = new BaseRequestHandlerImpl(null, BASE_PATH);
BaseRequestHandlerTestHelper.BaseTestGetParams(handler, BASE_PATH);
}
[Test]
public void TestSplitParams()
{
BaseRequestHandlerImpl handler = new BaseRequestHandlerImpl(null, BASE_PATH);
BaseRequestHandlerTestHelper.BaseTestSplitParams(handler, BASE_PATH);
}
}
}

View File

@ -227,8 +227,7 @@ namespace OpenSim.Framework.Tests
wearbyte.Add(VisualParams[i]); wearbyte.Add(VisualParams[i]);
} }
AvAppearance.SetAppearance(AvAppearance.Texture, (byte[])VisualParams.Clone());
AvAppearance.SetAppearance(AvAppearance.Texture.GetBytes(), wearbyte);
} }
/// <summary> /// <summary>

View File

@ -306,10 +306,6 @@ namespace OpenSim
"delete-region <name>", "delete-region <name>",
"Delete a region from disk", RunCommand); "Delete a region from disk", RunCommand);
m_console.Commands.AddCommand("region", false, "predecode-j2k",
"predecode-j2k [<num threads>]>",
"Precache assets,decode j2k layerdata", RunCommand);
m_console.Commands.AddCommand("region", false, "modules list", m_console.Commands.AddCommand("region", false, "modules list",
"modules list", "modules list",
"List modules", HandleModules); "List modules", HandleModules);
@ -744,17 +740,6 @@ namespace OpenSim
} }
break; break;
case "predecode-j2k":
if (cmdparams.Length > 0)
{
m_sceneManager.CacheJ2kDecode(Convert.ToInt32(cmdparams[0]));
}
else
{
m_sceneManager.CacheJ2kDecode(1);
}
break;
} }
} }

View File

@ -34,16 +34,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
public delegate void PacketStats(int inPackets, int outPackets, int unAckedBytes); public delegate void PacketStats(int inPackets, int outPackets, int unAckedBytes);
public delegate void PacketDrop(Packet pack, Object id); public delegate void PacketDrop(Packet pack, Object id);
public delegate void QueueEmpty(ThrottleOutPacketType queue);
public delegate bool SynchronizeClientHandler(IScene scene, Packet packet, UUID agentID, ThrottleOutPacketType throttlePacketType); public delegate bool SynchronizeClientHandler(IScene scene, Packet packet, UUID agentID, ThrottleOutPacketType throttlePacketType);
/// <summary> /// <summary>
/// Interface to a class that handles all the activity involved with maintaining the client circuit (handling acks, /// Interface to a class that handles all the activity involved with maintaining the client circuit (handling acks,
/// resends, pings, etc.) /// resends, pings, etc.)
/// </summary> /// </summary>
public interface ILLPacketHandler public interface ILLPacketHandler : IDisposable
{ {
event PacketStats OnPacketStats; event PacketStats OnPacketStats;
event PacketDrop OnPacketDrop; event PacketDrop OnPacketDrop;
event QueueEmpty OnQueueEmpty;
SynchronizeClientHandler SynchronizeClient { set; } SynchronizeClientHandler SynchronizeClient { set; }
int PacketsReceived { get; } int PacketsReceived { get; }
@ -70,12 +72,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
void OutPacket(Packet NewPack, void OutPacket(Packet NewPack,
ThrottleOutPacketType throttlePacketType, Object id); ThrottleOutPacketType throttlePacketType, Object id);
LLPacketQueue PacketQueue { get; } LLPacketQueue PacketQueue { get; }
void Stop();
void Flush(); void Flush();
void Clear(); void Clear();
ClientInfo GetClientInfo(); ClientInfo GetClientInfo();
void SetClientInfo(ClientInfo info); void SetClientInfo(ClientInfo info);
void AddImportantPacket(PacketType type); void AddImportantPacket(PacketType type);
void RemoveImportantPacket(PacketType type); void RemoveImportantPacket(PacketType type);
int GetQueueCount(ThrottleOutPacketType queue);
} }
} }

View File

@ -38,40 +38,37 @@ using System.Reflection;
namespace OpenSim.Region.ClientStack.LindenUDP namespace OpenSim.Region.ClientStack.LindenUDP
{ {
/// <summary> /// <summary>
/// We use this class to store image data and associated request data and attributes /// Stores information about a current texture download and a reference to the texture asset
/// </summary> /// </summary>
public class J2KImage public class J2KImage
{ {
private const int IMAGE_PACKET_SIZE = 1000;
private const int FIRST_PACKET_SIZE = 600;
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public double m_designatedPriorityKey; public uint m_lastSequence;
public double m_requestedPriority = 0.0d; public float m_requestedPriority;
public uint m_lastSequence = 0;
public uint m_requestedPacketNumber; public uint m_requestedPacketNumber;
public sbyte m_requestedDiscardLevel; public sbyte m_requestedDiscardLevel;
public UUID m_requestedUUID; public UUID m_requestedUUID;
public IJ2KDecoder m_j2kDecodeModule; public IJ2KDecoder m_j2kDecodeModule;
public IAssetService m_assetCache; public IAssetService m_assetCache;
public OpenJPEG.J2KLayerInfo[] Layers = new OpenJPEG.J2KLayerInfo[0]; public OpenJPEG.J2KLayerInfo[] m_layers;
public AssetBase m_MissingSubstitute = null; public bool m_decoded;
public bool m_decoded = false; public bool m_hasasset;
public bool m_completedSendAtCurrentDiscardLevel; public C5.IPriorityQueueHandle<J2KImage> m_priorityQueueHandle;
private sbyte m_discardLevel=-1;
private uint m_packetNumber; private uint m_packetNumber;
private bool m_decoderequested = false; private bool m_decoderequested;
private bool m_hasasset = false; private bool m_asset_requested;
private bool m_asset_requested = false; private bool m_sentinfo;
private bool m_sentinfo = false; private uint m_stopPacket;
private uint m_stopPacket = 0; private AssetBase m_asset;
private const int cImagePacketSize = 1000; private int m_assetDataLength;
private const int cFirstPacketSize = 600; private LLImageManager m_imageManager;
private AssetBase m_asset = null;
private LLImageManager m_image; #region Properties
public J2KImage(LLImageManager image)
{
m_image = image;
}
public uint m_pPacketNumber public uint m_pPacketNumber
{ {
@ -97,9 +94,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
if (!m_decoded) if (!m_decoded)
return 0; return 0;
try try
{ {
return (ushort)(((m_asset.Data.Length - cFirstPacketSize + cImagePacketSize - 1) / cImagePacketSize) + 1); return (ushort)(((m_assetDataLength - FIRST_PACKET_SIZE + IMAGE_PACKET_SIZE - 1) / IMAGE_PACKET_SIZE) + 1);
} }
catch (Exception) catch (Exception)
{ {
@ -110,160 +108,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
public void J2KDecodedCallback(UUID AssetId, OpenJPEG.J2KLayerInfo[] layers) #endregion Properties
public J2KImage(LLImageManager imageManager)
{ {
m_image.m_outstandingtextures++; m_imageManager = imageManager;
Layers = layers;
m_decoded = true;
RunUpdate();
} }
public void AssetDataCallback(UUID AssetID, AssetBase asset)
{
m_hasasset = true;
if (asset == null || asset.Data == null)
{
m_asset = m_MissingSubstitute;
}
else
{
m_asset = asset;
}
RunUpdate();
}
protected void AssetReceived(string id, Object sender, AssetBase asset)
{
UUID assetID = UUID.Zero;
if (asset != null)
assetID = asset.FullID;
AssetDataCallback(assetID, asset);
}
private int GetPacketForBytePosition(int bytePosition)
{
return ((bytePosition - cFirstPacketSize + cImagePacketSize - 1) / cImagePacketSize) + 1;
}
public int LastPacketSize()
{
if (m_packetNumber == 1)
return m_asset.Data.Length;
int lastsize = (m_asset.Data.Length - cFirstPacketSize) % cImagePacketSize;
//If the last packet size is zero, it's really cImagePacketSize, it sits on the boundary
if (lastsize == 0)
{
lastsize = cImagePacketSize;
}
return lastsize;
}
public int CurrentBytePosition()
{
if (m_packetNumber == 0)
return 0;
if (m_packetNumber == 1)
return cFirstPacketSize;
int result = cFirstPacketSize + ((int)m_packetNumber - 2) * cImagePacketSize;
if (result < 0)
{
result = cFirstPacketSize;
}
return result;
}
public bool SendFirstPacket(LLClientView client)
{
// this means we don't have
if (Data == null)
{
client.SendImageNotFound(m_requestedUUID);
m_log.WarnFormat("[TEXTURE]: Got null Data element on a asset {0}.. and the missing image Data property is al", m_requestedUUID);
return true;
}
// Do we have less then 1 packet's worth of data?
else if (m_asset.Data.Length <= cFirstPacketSize)
{
// Send only 1 packet
client.SendImageFirstPart(1, m_requestedUUID, (uint)m_asset.Data.Length, m_asset.Data, 2);
m_stopPacket = 0;
return true;
}
else
{
byte[] firstImageData = new byte[cFirstPacketSize];
try
{
Buffer.BlockCopy(m_asset.Data, 0, firstImageData, 0, (int)cFirstPacketSize);
client.SendImageFirstPart(TexturePacketCount(), m_requestedUUID, (uint)m_asset.Data.Length, firstImageData, 2);
}
catch (Exception)
{
m_log.Error("Texture block copy failed. Possibly out of memory?");
return true;
}
}
return false;
}
private bool SendPacket(LLClientView client)
{
bool complete = false;
int imagePacketSize = ((int)m_packetNumber == (TexturePacketCount())) ? LastPacketSize() : cImagePacketSize;
try
{
if ((CurrentBytePosition() + cImagePacketSize) > m_asset.Data.Length)
{
imagePacketSize = LastPacketSize();
complete=true;
if ((CurrentBytePosition() + imagePacketSize) > m_asset.Data.Length)
{
imagePacketSize = m_asset.Data.Length - CurrentBytePosition();
complete = true;
}
}
// It's concievable that the client might request packet one
// from a one packet image, which is really packet 0,
// which would leave us with a negative imagePacketSize..
if (imagePacketSize > 0)
{
byte[] imageData = new byte[imagePacketSize];
try
{
Buffer.BlockCopy(m_asset.Data, CurrentBytePosition(), imageData, 0, imagePacketSize);
}
catch (Exception e)
{
m_log.Error("Error copying texture block. Out of memory? imagePacketSize was " + imagePacketSize.ToString() + " on packet " + m_packetNumber.ToString() + " out of " + m_stopPacket.ToString() + ". Exception: " + e.ToString());
return false;
}
//Send the packet
client.SendImageNextPart((ushort)(m_packetNumber-1), m_requestedUUID, imageData);
}
if (complete)
{
return false;
}
else
{
return true;
}
}
catch (Exception)
{
return false;
}
}
public bool SendPackets(LLClientView client, int maxpack) public bool SendPackets(LLClientView client, int maxpack)
{
if (!m_completedSendAtCurrentDiscardLevel)
{ {
if (m_packetNumber <= m_stopPacket) if (m_packetNumber <= m_stopPacket)
{ {
@ -292,11 +144,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
if (m_packetNumber > m_stopPacket) if (m_packetNumber > m_stopPacket)
{
return true; return true;
} }
}
}
return false; return false;
} }
@ -308,19 +158,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (!m_hasasset) if (!m_hasasset)
{ {
if (!m_asset_requested) if (!m_asset_requested)
{ {
m_asset_requested = true; m_asset_requested = true;
m_assetCache.Get(m_requestedUUID.ToString(), this, AssetReceived); m_assetCache.Get(m_requestedUUID.ToString(), this, AssetReceived);
} }
} }
else else
{ {
if (!m_decoded) if (!m_decoded)
{ {
//We need to decode the requested image first //We need to decode the requested image first
@ -335,8 +180,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
J2KDecodedCallback(m_requestedUUID, new OpenJPEG.J2KLayerInfo[0]); J2KDecodedCallback(m_requestedUUID, new OpenJPEG.J2KLayerInfo[0]);
} }
else
{
// Send it off to the jpeg decoder // Send it off to the jpeg decoder
m_j2kDecodeModule.decode(m_requestedUUID, Data, J2KDecodedCallback); m_j2kDecodeModule.BeginDecode(m_requestedUUID, Data, J2KDecodedCallback);
}
} }
else else
@ -344,30 +192,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP
J2KDecodedCallback(m_requestedUUID, new OpenJPEG.J2KLayerInfo[0]); J2KDecodedCallback(m_requestedUUID, new OpenJPEG.J2KLayerInfo[0]);
} }
} }
}
else
{
// Check for missing image asset data
if (m_asset == null || m_asset.Data == null)
{
// FIXME:
m_packetNumber = m_stopPacket;
return;
}
} if (m_requestedDiscardLevel >= 0 || m_stopPacket == 0)
else
{ {
//discardLevel of -1 means just update the priority int maxDiscardLevel = Math.Max(0, m_layers.Length - 1);
if (m_requestedDiscardLevel != -1)
{ // Treat initial texture downloads with a DiscardLevel of -1 a request for the highest DiscardLevel
//Evaluate the discard level if (m_requestedDiscardLevel < 0 && m_stopPacket == 0)
//First, is it positive? m_requestedDiscardLevel = (sbyte)maxDiscardLevel;
if (m_requestedDiscardLevel >= 0)
{ // Clamp at the highest discard level
if (m_requestedDiscardLevel > Layers.Length - 1) m_requestedDiscardLevel = (sbyte)Math.Min(m_requestedDiscardLevel, maxDiscardLevel);
{
m_discardLevel = (sbyte)(Layers.Length - 1);
}
else
{
m_discardLevel = m_requestedDiscardLevel;
}
//Calculate the m_stopPacket //Calculate the m_stopPacket
if (Layers.Length > 0) if (m_layers.Length > 0)
{ {
m_stopPacket = (uint)GetPacketForBytePosition(Layers[(Layers.Length - 1) - m_discardLevel].End); m_stopPacket = (uint)GetPacketForBytePosition(m_layers[(m_layers.Length - 1) - m_requestedDiscardLevel].End);
//I don't know why, but the viewer seems to expect the final packet if the file //I don't know why, but the viewer seems to expect the final packet if the file
//is just one packet bigger. //is just one packet bigger.
if (TexturePacketCount() == m_stopPacket + 1) if (TexturePacketCount() == m_stopPacket + 1)
@ -379,24 +229,179 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
m_stopPacket = TexturePacketCount(); m_stopPacket = TexturePacketCount();
} }
//Don't reset packet number unless we're waiting or it's ahead of us
if (m_completedSendAtCurrentDiscardLevel || m_requestedPacketNumber>m_packetNumber)
{
m_packetNumber = m_requestedPacketNumber; m_packetNumber = m_requestedPacketNumber;
} }
if (m_packetNumber <= m_stopPacket) if (m_imageManager.Client.PacketHandler.GetQueueCount(ThrottleOutPacketType.Texture) == 0)
{ {
m_completedSendAtCurrentDiscardLevel = false; //m_log.Debug("No textures queued, sending one packet to kickstart it");
SendPacket(m_imageManager.Client);
} }
} }
} }
}
private bool SendPacket(LLClientView client)
{
bool complete = false;
int imagePacketSize = ((int)m_packetNumber == (TexturePacketCount())) ? LastPacketSize() : IMAGE_PACKET_SIZE;
try
{
if ((CurrentBytePosition() + IMAGE_PACKET_SIZE) > m_assetDataLength)
{
imagePacketSize = LastPacketSize();
complete = true;
if ((CurrentBytePosition() + imagePacketSize) > m_assetDataLength)
{
imagePacketSize = m_assetDataLength - CurrentBytePosition();
complete = true;
}
}
// It's concievable that the client might request packet one
// from a one packet image, which is really packet 0,
// which would leave us with a negative imagePacketSize..
if (imagePacketSize > 0)
{
byte[] imageData = new byte[imagePacketSize];
try
{
Buffer.BlockCopy(m_asset.Data, CurrentBytePosition(), imageData, 0, imagePacketSize);
}
catch (Exception e)
{
m_log.Error("Error copying texture block. Out of memory? imagePacketSize was " + imagePacketSize.ToString() + " on packet " + m_packetNumber.ToString() + " out of " + m_stopPacket.ToString() + ". Exception: " + e.ToString());
return false;
}
//Send the packet
client.SendImageNextPart((ushort)(m_packetNumber - 1), m_requestedUUID, imageData);
}
if (complete)
{
return false;
}
else
{
return true;
}
}
catch (Exception)
{
return false;
}
}
private int GetPacketForBytePosition(int bytePosition)
{
return ((bytePosition - FIRST_PACKET_SIZE + IMAGE_PACKET_SIZE - 1) / IMAGE_PACKET_SIZE) + 1;
}
private int LastPacketSize()
{
if (m_packetNumber == 1)
return m_assetDataLength;
int lastsize = (m_assetDataLength - FIRST_PACKET_SIZE) % IMAGE_PACKET_SIZE;
//If the last packet size is zero, it's really cImagePacketSize, it sits on the boundary
if (lastsize == 0)
{
lastsize = IMAGE_PACKET_SIZE;
}
return lastsize;
}
private int CurrentBytePosition()
{
if (m_packetNumber == 0)
return 0;
if (m_packetNumber == 1)
return FIRST_PACKET_SIZE;
int result = FIRST_PACKET_SIZE + ((int)m_packetNumber - 2) * IMAGE_PACKET_SIZE;
if (result < 0)
{
result = FIRST_PACKET_SIZE;
}
return result;
}
private bool SendFirstPacket(LLClientView client)
{
// this means we don't have
if (Data == null)
{
client.SendImageNotFound(m_requestedUUID);
m_log.WarnFormat("[TEXTURE]: Got null Data element on a asset {0}.. and the missing image Data property is also null", m_requestedUUID);
return true;
}
// Do we have less then 1 packet's worth of data?
else if (m_assetDataLength <= FIRST_PACKET_SIZE)
{
// Send only 1 packet
client.SendImageFirstPart(1, m_requestedUUID, (uint)m_assetDataLength, m_asset.Data, 2);
m_stopPacket = 0;
return true;
}
else
{
byte[] firstImageData = new byte[FIRST_PACKET_SIZE];
try
{
Buffer.BlockCopy(m_asset.Data, 0, firstImageData, 0, (int)FIRST_PACKET_SIZE);
client.SendImageFirstPart(TexturePacketCount(), m_requestedUUID, (uint)m_assetDataLength, firstImageData, 2);
}
catch (Exception)
{
m_log.Error("Texture block copy failed. Possibly out of memory?");
return true;
}
}
return false;
}
private void J2KDecodedCallback(UUID AssetId, OpenJPEG.J2KLayerInfo[] layers)
{
m_layers = layers;
m_decoded = true;
RunUpdate();
}
private void AssetDataCallback(UUID AssetID, AssetBase asset)
{
m_hasasset = true;
if (asset == null || asset.Data == null)
{
if (m_imageManager.MissingImage != null)
{
m_asset = m_imageManager.MissingImage;
m_assetDataLength = m_asset.Data.Length;
}
else
{
m_asset = null;
m_decoded = true;
}
}
else else
{ {
m_packetNumber = m_stopPacket; m_asset = asset;
} m_assetDataLength = m_asset.Data.Length;
} }
RunUpdate();
} }
private void AssetReceived(string id, Object sender, AssetBase asset)
{
UUID assetID = UUID.Zero;
if (asset != null)
assetID = asset.FullID;
AssetDataCallback(assetID, asset);
} }
} }
} }

View File

@ -81,8 +81,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private List<ObjectUpdatePacket.ObjectDataBlock> m_primFullUpdates = private List<ObjectUpdatePacket.ObjectDataBlock> m_primFullUpdates =
new List<ObjectUpdatePacket.ObjectDataBlock>(); new List<ObjectUpdatePacket.ObjectDataBlock>();
private Timer m_textureRequestTimer;
private bool m_clientBlocked; private bool m_clientBlocked;
private int m_probesWithNoIngressPackets; private int m_probesWithNoIngressPackets;
@ -143,9 +141,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
protected int m_primTerseUpdateRate = 10; protected int m_primTerseUpdateRate = 10;
protected int m_primFullUpdateRate = 14; protected int m_primFullUpdateRate = 14;
protected int m_textureRequestRate = 100; protected int m_textureSendLimit = 20;
protected int m_textureSendLimit = 10; protected int m_textureDataLimit = 10;
protected int m_textureDataLimit = 5;
protected int m_packetMTU = 1400; protected int m_packetMTU = 1400;
@ -534,6 +531,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_PacketHandler = new LLPacketHandler(this, m_networkServer, userSettings); m_PacketHandler = new LLPacketHandler(this, m_networkServer, userSettings);
m_PacketHandler.SynchronizeClient = SynchronizeClient; m_PacketHandler.SynchronizeClient = SynchronizeClient;
m_PacketHandler.OnPacketStats += PopulateStats; m_PacketHandler.OnPacketStats += PopulateStats;
m_PacketHandler.OnQueueEmpty += HandleQueueEmpty;
if (scene.Config != null) if (scene.Config != null)
{ {
@ -555,9 +553,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_primFullUpdateRate = clientConfig.GetInt("FullUpdateRate", m_primFullUpdateRate = clientConfig.GetInt("FullUpdateRate",
m_primFullUpdateRate); m_primFullUpdateRate);
m_textureRequestRate = clientConfig.GetInt("TextureRequestRate",
m_textureRequestRate);
m_textureSendLimit = clientConfig.GetInt("TextureSendLimit", m_textureSendLimit = clientConfig.GetInt("TextureSendLimit",
m_textureSendLimit); m_textureSendLimit);
@ -607,9 +602,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (m_primFullUpdateTimer.Enabled) if (m_primFullUpdateTimer.Enabled)
lock (m_primFullUpdateTimer) lock (m_primFullUpdateTimer)
m_primFullUpdateTimer.Stop(); m_primFullUpdateTimer.Stop();
if (m_textureRequestTimer.Enabled)
lock (m_textureRequestTimer)
m_textureRequestTimer.Stop();
// This is just to give the client a reasonable chance of // This is just to give the client a reasonable chance of
// flushing out all it's packets. There should probably // flushing out all it's packets. There should probably
@ -633,6 +625,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// of the client thread regardless of where Close() is called. // of the client thread regardless of where Close() is called.
KillEndDone(); KillEndDone();
} }
Terminate();
} }
/// <summary> /// <summary>
@ -704,10 +698,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (m_primFullUpdateTimer.Enabled) if (m_primFullUpdateTimer.Enabled)
lock (m_primFullUpdateTimer) lock (m_primFullUpdateTimer)
m_primFullUpdateTimer.Stop(); m_primFullUpdateTimer.Stop();
if (m_textureRequestTimer.Enabled)
lock (m_textureRequestTimer)
m_textureRequestTimer.Stop();
} }
public void Restart() public void Restart()
@ -730,23 +720,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_primFullUpdateTimer = new Timer(m_primFullUpdateRate); m_primFullUpdateTimer = new Timer(m_primFullUpdateRate);
m_primFullUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessPrimFullUpdates); m_primFullUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessPrimFullUpdates);
m_primFullUpdateTimer.AutoReset = false; m_primFullUpdateTimer.AutoReset = false;
m_textureRequestTimer = new Timer(m_textureRequestRate);
m_textureRequestTimer.Elapsed += new ElapsedEventHandler(ProcessTextureRequests);
m_textureRequestTimer.AutoReset = false;
} }
public void Terminate() private void Terminate()
{ {
IsActive = false;
m_clientPingTimer.Close();
m_avatarTerseUpdateTimer.Close();
m_primTerseUpdateTimer.Close();
m_primFullUpdateTimer.Close();
m_PacketHandler.OnPacketStats -= PopulateStats; m_PacketHandler.OnPacketStats -= PopulateStats;
m_PacketHandler.Stop(); m_PacketHandler.Dispose();
// wait for thread stoped // wait for thread stoped
m_clientThread.Join(); // m_clientThread.Join();
// delete circuit code // delete circuit code
m_networkServer.CloseClient(this); //m_networkServer.CloseClient(this);
} }
#endregion #endregion
@ -877,6 +869,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
LLQueItem nextPacket = m_PacketHandler.PacketQueue.Dequeue(); LLQueItem nextPacket = m_PacketHandler.PacketQueue.Dequeue();
if (nextPacket == null) {
m_log.DebugFormat("[CLIENT]: PacketQueue return null LLQueItem");
continue;
}
if (nextPacket.Incoming) if (nextPacket.Incoming)
{ {
if (m_debugPacketLevel > 0) if (m_debugPacketLevel > 0)
@ -967,10 +964,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_primFullUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessPrimFullUpdates); m_primFullUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessPrimFullUpdates);
m_primFullUpdateTimer.AutoReset = false; m_primFullUpdateTimer.AutoReset = false;
m_textureRequestTimer = new Timer(m_textureRequestRate);
m_textureRequestTimer.Elapsed += new ElapsedEventHandler(ProcessTextureRequests);
m_textureRequestTimer.AutoReset = false;
m_scene.AddNewClient(this); m_scene.AddNewClient(this);
RefreshGroupMembership(); RefreshGroupMembership();
@ -1042,26 +1035,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
protected virtual void TextureRequestHandler()
{
m_log.DebugFormat("[TRH] Thread started");
while (m_imageManager != null)
{
try
{
while (m_imageManager != null)
{
}
}
catch (Exception e)
{
m_log.WarnFormat("[TRH] Exception in handler loop: {0}", e.Message);
m_log.Debug(e);
}
}
m_log.DebugFormat("[TRH] Thread terminated");
}
# endregion # endregion
// Previously ClientView.API partial class // Previously ClientView.API partial class
@ -3161,20 +3134,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
// Unlike the other timers, this one is only started after void HandleQueueEmpty(ThrottleOutPacketType queue)
// the first request is seen. {
switch (queue)
{
case ThrottleOutPacketType.Texture:
ProcessTextureRequests();
break;
}
}
void ProcessTextureRequests(object sender, ElapsedEventArgs e) void ProcessTextureRequests()
{ {
if (m_imageManager != null) if (m_imageManager != null)
{ m_imageManager.ProcessImageQueue(m_textureSendLimit, m_textureDataLimit);
if (m_imageManager.ProcessImageQueue(m_textureSendLimit,
m_textureDataLimit))
{
lock (m_textureRequestTimer)
m_textureRequestTimer.Start();
}
}
} }
void ProcessPrimFullUpdates(object sender, ElapsedEventArgs e) void ProcessPrimFullUpdates(object sender, ElapsedEventArgs e)
@ -5275,13 +5248,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// for the client session anyway, in order to protect ourselves against bad code in plugins // for the client session anyway, in order to protect ourselves against bad code in plugins
try try
{ {
List<byte> visualparams = new List<byte>(); byte[] visualparams = new byte[appear.VisualParam.Length];
foreach (AgentSetAppearancePacket.VisualParamBlock x in appear.VisualParam) for (int i = 0; i < appear.VisualParam.Length; i++)
{ visualparams[i] = appear.VisualParam[i].ParamValue;
visualparams.Add(x.ParamValue);
}
handlerSetAppearance(appear.ObjectData.TextureEntry, visualparams); Primitive.TextureEntry te = null;
if (appear.ObjectData.TextureEntry.Length > 1)
te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length);
handlerSetAppearance(te, visualparams);
} }
catch (Exception e) catch (Exception e)
{ {
@ -6624,8 +6599,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (m_imageManager != null) if (m_imageManager != null)
{ {
m_imageManager.EnqueueReq(args); m_imageManager.EnqueueReq(args);
lock (m_textureRequestTimer)
m_textureRequestTimer.Start();
} }
} }
} }
@ -11026,5 +10999,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
#endregion #endregion
public void SendRebakeAvatarTextures(UUID textureID)
{
RebakeAvatarTexturesPacket pack =
(RebakeAvatarTexturesPacket)PacketPool.Instance.GetPacket(PacketType.RebakeAvatarTextures);
pack.TextureData = new RebakeAvatarTexturesPacket.TextureDataBlock();
pack.TextureData.TextureID = textureID;
OutPacket(pack, ThrottleOutPacketType.Task);
}
} }
} }

View File

@ -27,58 +27,60 @@
using System; using System;
using System.Threading; using System.Threading;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.Imaging; using OpenMetaverse.Imaging;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using log4net; using log4net;
using System.Reflection;
namespace OpenSim.Region.ClientStack.LindenUDP namespace OpenSim.Region.ClientStack.LindenUDP
{ {
public class LLImageManager public class LLImageManager
{ {
private sealed class J2KImageComparer : IComparer<J2KImage>
{
public int Compare(J2KImage x, J2KImage y)
{
return x.m_requestedPriority.CompareTo(y.m_requestedPriority);
}
}
//Public interfaces:
//Constructor - (LLClientView, IAssetCache, IJ2KDecoder);
//void EnqueueReq - (TextureRequestArgs)
//ProcessImageQueue
//Close
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_shuttingdown = false; private bool m_shuttingdown = false;
private long m_lastloopprocessed = 0; private long m_lastloopprocessed = 0;
private AssetBase m_missingImage = null;
private LLClientView m_client; //Client we're assigned to private LLClientView m_client; //Client we're assigned to
private IAssetService m_assetCache; //Asset Cache private IAssetService m_assetCache; //Asset Cache
private IJ2KDecoder m_j2kDecodeModule; //Our J2K module private IJ2KDecoder m_j2kDecodeModule; //Our J2K module
private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer());
private readonly AssetBase m_missingsubstitute; //Sustitute for bad decodes
private Dictionary<UUID,J2KImage> m_imagestore; // Our main image storage dictionary
private SortedList<double,UUID> m_priorities; // For fast image lookup based on priority
private Dictionary<int, int> m_priorityresolver; //Enabling super fast assignment of images with the same priorities
private const double doubleMinimum = .0000001;
public int m_outstandingtextures = 0;
//Constructor
public LLImageManager(LLClientView client, IAssetService pAssetCache, IJ2KDecoder pJ2kDecodeModule) public LLImageManager(LLClientView client, IAssetService pAssetCache, IJ2KDecoder pJ2kDecodeModule)
{ {
m_imagestore = new Dictionary<UUID,J2KImage>();
m_priorities = new SortedList<double,UUID>();
m_priorityresolver = new Dictionary<int, int>();
m_client = client; m_client = client;
m_assetCache = pAssetCache; m_assetCache = pAssetCache;
if (pAssetCache != null) if (pAssetCache != null)
m_missingsubstitute = pAssetCache.Get("5748decc-f629-461c-9a36-a35a221fe21f"); m_missingImage = pAssetCache.Get("5748decc-f629-461c-9a36-a35a221fe21f");
else else
m_log.Error("[ClientView] - couldn't set missing image, all manner of things will probably break"); m_log.Error("[ClientView] - couldn't set missing image asset, falling back to missing image packet. This is known to crash the client");
m_j2kDecodeModule = pJ2kDecodeModule; m_j2kDecodeModule = pJ2kDecodeModule;
} }
public LLClientView Client
{
get { return m_client; }
}
public AssetBase MissingImage
{
get { return m_missingImage; }
}
public void EnqueueReq(TextureRequestArgs newRequest) public void EnqueueReq(TextureRequestArgs newRequest)
{ {
//newRequest is the properties of our new texture fetch request. //newRequest is the properties of our new texture fetch request.
@ -88,59 +90,75 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//Make sure we're not shutting down.. //Make sure we're not shutting down..
if (!m_shuttingdown) if (!m_shuttingdown)
{ {
J2KImage imgrequest;
//Do we already know about this UUID? // Do a linear search for this texture download
if (m_imagestore.ContainsKey(newRequest.RequestedAssetID)) lock (m_priorityQueue)
m_priorityQueue.Find(delegate(J2KImage img) { return img.m_requestedUUID == newRequest.RequestedAssetID; }, out imgrequest);
if (imgrequest != null)
{ {
if (newRequest.DiscardLevel == -1 && newRequest.Priority == 0f)
{
//m_log.Debug("[TEX]: (CAN) ID=" + newRequest.RequestedAssetID);
try
{
lock (m_priorityQueue)
m_priorityQueue.Delete(imgrequest.m_priorityQueueHandle);
}
catch (Exception) { }
}
else
{
//m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}",
// newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority);
//Check the packet sequence to make sure this isn't older than //Check the packet sequence to make sure this isn't older than
//one we've already received //one we've already received
J2KImage imgrequest = m_imagestore[newRequest.RequestedAssetID];
// This is the inbound request sequence number. We can ignore
// "old" ones.
if (newRequest.requestSequence > imgrequest.m_lastSequence) if (newRequest.requestSequence > imgrequest.m_lastSequence)
{ {
//Update the sequence number of the last RequestImage packet
imgrequest.m_lastSequence = newRequest.requestSequence; imgrequest.m_lastSequence = newRequest.requestSequence;
//Check the priority
double priority = imgrequest.m_requestedPriority;
if (priority != newRequest.Priority)
{
//Remove the old priority
m_priorities.Remove(imgrequest.m_designatedPriorityKey);
//Assign a new unique priority
imgrequest.m_requestedPriority = newRequest.Priority;
imgrequest.m_designatedPriorityKey = AssignPriority(newRequest.RequestedAssetID, newRequest.Priority);
}
//Update the requested discard level //Update the requested discard level
imgrequest.m_requestedDiscardLevel = newRequest.DiscardLevel; imgrequest.m_requestedDiscardLevel = newRequest.DiscardLevel;
//Update the requested packet number //Update the requested packet number
imgrequest.m_requestedPacketNumber = newRequest.PacketNumber; imgrequest.m_requestedPacketNumber = newRequest.PacketNumber;
//Check if this will create an outstanding texture request //Update the requested priority
bool activated = imgrequest.m_completedSendAtCurrentDiscardLevel; imgrequest.m_requestedPriority = newRequest.Priority;
//Run an update try
imgrequest.RunUpdate();
if (activated && !imgrequest.m_completedSendAtCurrentDiscardLevel && imgrequest.m_decoded)
{ {
Interlocked.Increment(ref m_outstandingtextures); lock (m_priorityQueue)
m_priorityQueue.Replace(imgrequest.m_priorityQueueHandle, imgrequest);
}
catch (Exception)
{
imgrequest.m_priorityQueueHandle = null;
lock (m_priorityQueue)
m_priorityQueue.Add(ref imgrequest.m_priorityQueueHandle, imgrequest);
}
//Run an update
imgrequest.RunUpdate();
} }
} }
} }
else else
{ {
J2KImage imgrequest = new J2KImage(this); if (newRequest.DiscardLevel == -1 && newRequest.Priority == 0f)
{
//m_log.DebugFormat("[TEX]: (IGN) ID={0}: D={1}, S={2}, P={3}",
// newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority);
}
else
{
//m_log.DebugFormat("[TEX]: (NEW) ID={0}: D={1}, S={2}, P={3}",
// newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority);
//Assign our missing substitute imgrequest = new J2KImage(this);
imgrequest.m_MissingSubstitute = m_missingsubstitute;
//Assign our decoder module //Assign our decoder module
imgrequest.m_j2kDecodeModule = m_j2kDecodeModule; imgrequest.m_j2kDecodeModule = m_j2kDecodeModule;
@ -148,9 +166,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//Assign our asset cache module //Assign our asset cache module
imgrequest.m_assetCache = m_assetCache; imgrequest.m_assetCache = m_assetCache;
//Assign a priority based on our request
imgrequest.m_designatedPriorityKey = AssignPriority(newRequest.RequestedAssetID, newRequest.Priority);
//Assign the requested discard level //Assign the requested discard level
imgrequest.m_requestedDiscardLevel = newRequest.DiscardLevel; imgrequest.m_requestedDiscardLevel = newRequest.DiscardLevel;
@ -163,49 +178,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//Assign the asset uuid //Assign the asset uuid
imgrequest.m_requestedUUID = newRequest.RequestedAssetID; imgrequest.m_requestedUUID = newRequest.RequestedAssetID;
m_imagestore.Add(imgrequest.m_requestedUUID, imgrequest); //Assign the requested priority
imgrequest.m_requestedPriority = newRequest.Priority;
//Add this download to the priority queue
lock (m_priorityQueue)
m_priorityQueue.Add(ref imgrequest.m_priorityQueueHandle, imgrequest);
//Run an update //Run an update
imgrequest.RunUpdate(); imgrequest.RunUpdate();
} }
} }
} }
private double AssignPriority(UUID pAssetID, double pPriority)
{
//First, find out if we can just assign directly
if (m_priorityresolver.ContainsKey((int)pPriority) == false)
{
m_priorities.Add((double)((int)pPriority), pAssetID);
m_priorityresolver.Add((int)pPriority, 0);
return (double)((int)pPriority);
}
else
{
//Use the hash lookup goodness of a secondary dictionary to find a free slot
double mFreePriority = ((int)pPriority) + (doubleMinimum * (m_priorityresolver[(int)pPriority] + 1));
m_priorities[mFreePriority] = pAssetID;
m_priorityresolver[(int)pPriority]++;
return mFreePriority;
}
} }
public bool ProcessImageQueue(int count, int maxpack) public bool ProcessImageQueue(int count, int maxpack)
{ {
lock (this)
{
//count is the number of textures we want to process in one go.
//As part of this class re-write, that number will probably rise
//since we're processing in a more efficient manner.
// this can happen during Close() // this can happen during Close()
if (m_client == null) if (m_client == null)
return false; return false;
//Count is the number of textures we want to process in one go.
//As part of this class re-write, that number will probably rise
//since we're processing in a more efficient manner.
int numCollected = 0; int numCollected = 0;
//Calculate our threshold //Calculate our threshold
@ -232,85 +230,58 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
if (threshold < 10)
{
threshold = 10;
}
if (m_client.PacketHandler == null) if (m_client.PacketHandler == null)
return false; return false;
if (m_client.PacketHandler.PacketQueue == null) if (m_client.PacketHandler.PacketQueue == null)
return false; return false;
//First of all make sure our packet queue isn't above our threshold if (threshold < 10)
threshold = 10;
//Uncomment this to see what the texture stack is doing //Uncomment this to see what the texture stack is doing
//m_log.Debug("Queue: " + m_client.PacketHandler.PacketQueue.TextureOutgoingPacketQueueCount.ToString() + " Threshold: " + threshold.ToString() + " outstanding: " + m_outstandingtextures.ToString()); //m_log.Debug("Queue: " + m_client.PacketHandler.PacketQueue.getQueueCount(ThrottleOutPacketType.Texture).ToString() + " Threshold: " + threshold.ToString() + " outstanding: " + m_outstandingtextures.ToString());
if (m_client.PacketHandler.PacketQueue.TextureOutgoingPacketQueueCount < threshold && m_outstandingtextures > 0) if (true) //m_client.PacketHandler.PacketQueue.GetQueueCount(ThrottleOutPacketType.Texture) < threshold)
{ {
bool justreset = false; while (m_priorityQueue.Count > 0)
{
J2KImage imagereq = null;
lock (m_priorityQueue)
imagereq = m_priorityQueue.FindMax();
for (int x = m_priorities.Count - 1; x > -1; x--) if (imagereq.m_decoded == true)
{ {
// we need to test this here now that we are dropping assets
if (!imagereq.m_hasasset)
{
m_log.WarnFormat("[LLIMAGE MANAGER]: Re-requesting the image asset {0}", imagereq.m_requestedUUID);
imagereq.RunUpdate();
continue;
}
++numCollected;
J2KImage imagereq = m_imagestore[m_priorities.Values[x]];
if (imagereq.m_decoded == true && !imagereq.m_completedSendAtCurrentDiscardLevel)
{
numCollected++;
//SendPackets will send up to ten packets per cycle //SendPackets will send up to ten packets per cycle
if (imagereq.SendPackets(m_client, maxpack)) if (imagereq.SendPackets(m_client, maxpack))
{ {
//Send complete // Send complete. Destroy any knowledge of this transfer
if (!imagereq.m_completedSendAtCurrentDiscardLevel) try
{ {
imagereq.m_completedSendAtCurrentDiscardLevel = true; lock (m_priorityQueue)
Interlocked.Decrement(ref m_outstandingtextures); m_priorityQueue.Delete(imagereq.m_priorityQueueHandle);
//Re-assign priority to bottom
//Remove the old priority
m_priorities.Remove(imagereq.m_designatedPriorityKey);
int lowest;
if (m_priorities.Count > 0)
{
lowest = (int)m_priorities.Keys[0];
lowest--;
}
else
{
lowest = -10000;
}
m_priorities.Add((double)lowest, imagereq.m_requestedUUID);
imagereq.m_designatedPriorityKey = (double)lowest;
if (m_priorityresolver.ContainsKey((int)lowest))
{
m_priorityresolver[(int)lowest]++;
}
else
{
m_priorityresolver.Add((int)lowest, 0);
} }
catch (Exception) { }
} }
} }
if (numCollected == count) if (numCollected == count)
{
break; break;
} }
} }
if (numCollected == count || m_outstandingtextures == 0)
break;
if (numCollected % m_outstandingtextures == 0 && !justreset)
{
//We've gotten as much as we can from the stack,
//reset to the top so that we can send MOAR DATA (nomnomnom)!
x = m_priorities.Count - 1;
justreset = true; //prevents us from getting stuck in a loop return m_priorityQueue.Count > 0;
} }
} }
}
return m_outstandingtextures != 0;
}
//Faux destructor //Faux destructor
public void Close() public void Close()

View File

@ -129,6 +129,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// //
public event PacketStats OnPacketStats; public event PacketStats OnPacketStats;
public event PacketDrop OnPacketDrop; public event PacketDrop OnPacketDrop;
public event QueueEmpty OnQueueEmpty;
//private SynchronizeClientHandler m_SynchronizeClient = null; //private SynchronizeClientHandler m_SynchronizeClient = null;
@ -172,13 +173,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_PacketQueue = new LLPacketQueue(client.AgentId, userSettings); m_PacketQueue = new LLPacketQueue(client.AgentId, userSettings);
m_PacketQueue.OnQueueEmpty += TriggerOnQueueEmpty;
m_AckTimer.Elapsed += AckTimerElapsed; m_AckTimer.Elapsed += AckTimerElapsed;
m_AckTimer.Start(); m_AckTimer.Start();
} }
public void Stop() public void Dispose()
{ {
m_AckTimer.Stop(); m_AckTimer.Stop();
m_AckTimer.Close();
m_PacketQueue.Enqueue(null); m_PacketQueue.Enqueue(null);
m_PacketQueue.Close(); m_PacketQueue.Close();
@ -768,6 +772,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerPacketDrop(packet, id); handlerPacketDrop(packet, id);
} }
private void TriggerOnQueueEmpty(ThrottleOutPacketType queue)
{
QueueEmpty handlerQueueEmpty = OnQueueEmpty;
if (handlerQueueEmpty != null)
handlerQueueEmpty(queue);
}
// Convert the packet to bytes and stuff it onto the send queue // Convert the packet to bytes and stuff it onto the send queue
// //
public void ProcessOutPacket(LLQueItem item) public void ProcessOutPacket(LLQueItem item)
@ -849,5 +861,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_PacketQueue.Close(); m_PacketQueue.Close();
Thread.CurrentThread.Abort(); Thread.CurrentThread.Abort();
} }
public int GetQueueCount(ThrottleOutPacketType queue)
{
return m_PacketQueue.GetQueueCount(queue);
}
} }
} }

View File

@ -39,7 +39,7 @@ using Timer=System.Timers.Timer;
namespace OpenSim.Region.ClientStack.LindenUDP namespace OpenSim.Region.ClientStack.LindenUDP
{ {
public class LLPacketQueue : IPullStatsProvider public class LLPacketQueue : IPullStatsProvider, IDisposable
{ {
private static readonly ILog m_log private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -62,6 +62,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private Queue<LLQueItem> TextureOutgoingPacketQueue; private Queue<LLQueItem> TextureOutgoingPacketQueue;
private Queue<LLQueItem> AssetOutgoingPacketQueue; private Queue<LLQueItem> AssetOutgoingPacketQueue;
private List<ThrottleOutPacketType> Empty = new List<ThrottleOutPacketType>();
// m_log.Info("[THROTTLE]: Entering Throttle");
// private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); // private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
// private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>(); // private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>();
@ -85,26 +87,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private Dictionary<uint,int> contents = new Dictionary<uint, int>(); private Dictionary<uint,int> contents = new Dictionary<uint, int>();
/// <summary>
/// The number of packets in the OutgoingPacketQueue
///
/// </summary>
internal int TextureOutgoingPacketQueueCount
{
get
{
if (TextureOutgoingPacketQueue == null)
return 0;
return TextureOutgoingPacketQueue.Count;
}
}
// private long LastThrottle; // private long LastThrottle;
// private long ThrottleInterval; // private long ThrottleInterval;
private Timer throttleTimer; private Timer throttleTimer;
private UUID m_agentId; private UUID m_agentId;
public event QueueEmpty OnQueueEmpty;
public LLPacketQueue(UUID agentId, ClientStackUserSettings userSettings) public LLPacketQueue(UUID agentId, ClientStackUserSettings userSettings)
{ {
// While working on this, the BlockingQueue had me fooled for a bit. // While working on this, the BlockingQueue had me fooled for a bit.
@ -210,28 +200,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
switch (item.throttleType & ThrottleOutPacketType.TypeMask) switch (item.throttleType & ThrottleOutPacketType.TypeMask)
{ {
case ThrottleOutPacketType.Resend: case ThrottleOutPacketType.Resend:
ThrottleCheck(ref ResendThrottle, ref ResendOutgoingPacketQueue, item); ThrottleCheck(ref ResendThrottle, ref ResendOutgoingPacketQueue, item, ThrottleOutPacketType.Resend);
break; break;
case ThrottleOutPacketType.Texture: case ThrottleOutPacketType.Texture:
ThrottleCheck(ref TextureThrottle, ref TextureOutgoingPacketQueue, item); ThrottleCheck(ref TextureThrottle, ref TextureOutgoingPacketQueue, item, ThrottleOutPacketType.Texture);
break; break;
case ThrottleOutPacketType.Task: case ThrottleOutPacketType.Task:
if ((item.throttleType & ThrottleOutPacketType.LowPriority) != 0) if ((item.throttleType & ThrottleOutPacketType.LowPriority) != 0)
ThrottleCheck(ref TaskThrottle, ref TaskLowpriorityPacketQueue, item); ThrottleCheck(ref TaskThrottle, ref TaskLowpriorityPacketQueue, item, ThrottleOutPacketType.Task);
else else
ThrottleCheck(ref TaskThrottle, ref TaskOutgoingPacketQueue, item); ThrottleCheck(ref TaskThrottle, ref TaskOutgoingPacketQueue, item, ThrottleOutPacketType.Task);
break; break;
case ThrottleOutPacketType.Land: case ThrottleOutPacketType.Land:
ThrottleCheck(ref LandThrottle, ref LandOutgoingPacketQueue, item); ThrottleCheck(ref LandThrottle, ref LandOutgoingPacketQueue, item, ThrottleOutPacketType.Land);
break; break;
case ThrottleOutPacketType.Asset: case ThrottleOutPacketType.Asset:
ThrottleCheck(ref AssetThrottle, ref AssetOutgoingPacketQueue, item); ThrottleCheck(ref AssetThrottle, ref AssetOutgoingPacketQueue, item, ThrottleOutPacketType.Asset);
break; break;
case ThrottleOutPacketType.Cloud: case ThrottleOutPacketType.Cloud:
ThrottleCheck(ref CloudThrottle, ref CloudOutgoingPacketQueue, item); ThrottleCheck(ref CloudThrottle, ref CloudOutgoingPacketQueue, item, ThrottleOutPacketType.Cloud);
break; break;
case ThrottleOutPacketType.Wind: case ThrottleOutPacketType.Wind:
ThrottleCheck(ref WindThrottle, ref WindOutgoingPacketQueue, item); ThrottleCheck(ref WindThrottle, ref WindOutgoingPacketQueue, item, ThrottleOutPacketType.Wind);
break; break;
default: default:
@ -283,43 +273,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
lock (this) lock (this)
{ {
while (PacketsWaiting()) // These categories do not contain transactional packets so we can safely drop any pending data in them
LandOutgoingPacketQueue.Clear();
WindOutgoingPacketQueue.Clear();
CloudOutgoingPacketQueue.Clear();
TextureOutgoingPacketQueue.Clear();
AssetOutgoingPacketQueue.Clear();
// Now comes the fun part.. we dump all remaining resend and task packets into the send queue
while (ResendOutgoingPacketQueue.Count > 0 || TaskOutgoingPacketQueue.Count > 0 || TaskLowpriorityPacketQueue.Count > 0)
{ {
//Now comes the fun part.. we dump all our elements into m_packetQueue that we've saved up.
if (ResendOutgoingPacketQueue.Count > 0) if (ResendOutgoingPacketQueue.Count > 0)
{
SendQueue.Enqueue(ResendOutgoingPacketQueue.Dequeue()); SendQueue.Enqueue(ResendOutgoingPacketQueue.Dequeue());
}
if (LandOutgoingPacketQueue.Count > 0)
{
SendQueue.Enqueue(LandOutgoingPacketQueue.Dequeue());
}
if (WindOutgoingPacketQueue.Count > 0)
{
SendQueue.Enqueue(WindOutgoingPacketQueue.Dequeue());
}
if (CloudOutgoingPacketQueue.Count > 0)
{
SendQueue.Enqueue(CloudOutgoingPacketQueue.Dequeue());
}
if (TaskOutgoingPacketQueue.Count > 0) if (TaskOutgoingPacketQueue.Count > 0)
{
SendQueue.PriorityEnqueue(TaskOutgoingPacketQueue.Dequeue()); SendQueue.PriorityEnqueue(TaskOutgoingPacketQueue.Dequeue());
}
if (TaskLowpriorityPacketQueue.Count > 0) if (TaskLowpriorityPacketQueue.Count > 0)
{
SendQueue.Enqueue(TaskLowpriorityPacketQueue.Dequeue()); SendQueue.Enqueue(TaskLowpriorityPacketQueue.Dequeue());
} }
if (TextureOutgoingPacketQueue.Count > 0)
{
SendQueue.Enqueue(TextureOutgoingPacketQueue.Dequeue());
}
if (AssetOutgoingPacketQueue.Count > 0)
{
SendQueue.Enqueue(AssetOutgoingPacketQueue.Dequeue());
}
}
// m_log.Info("[THROTTLE]: Processed " + throttleLoops + " packets");
} }
} }
@ -341,12 +313,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
public void Close() public void Close()
{
Dispose();
}
public void Dispose()
{ {
Flush(); Flush();
WipeClean(); // I'm sure there's a dirty joke in here somewhere. -AFrisby WipeClean(); // I'm sure there's a dirty joke in here somewhere. -AFrisby
m_enabled = false; m_enabled = false;
throttleTimer.Stop(); throttleTimer.Stop();
throttleTimer.Close();
if (StatsManager.SimExtraStats != null) if (StatsManager.SimExtraStats != null)
{ {
@ -388,6 +366,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int MaxThrottleLoops = 4550; // 50*7 packets can be dequeued at once. int MaxThrottleLoops = 4550; // 50*7 packets can be dequeued at once.
int throttleLoops = 0; int throttleLoops = 0;
List<ThrottleOutPacketType> e;
// We're going to dequeue all of the saved up packets until // We're going to dequeue all of the saved up packets until
// we've hit the throttle limit or there's no more packets to send // we've hit the throttle limit or there's no more packets to send
@ -399,7 +378,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
bool qchanged = true; bool qchanged = true;
ResetCounters(); ResetCounters();
// m_log.Info("[THROTTLE]: Entering Throttle");
while (TotalThrottle.UnderLimit() && qchanged && throttleLoops <= MaxThrottleLoops) while (TotalThrottle.UnderLimit() && qchanged && throttleLoops <= MaxThrottleLoops)
{ {
qchanged = false; // We will break out of the loop if no work was accomplished qchanged = false; // We will break out of the loop if no work was accomplished
@ -425,6 +404,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
TotalThrottle.AddBytes(qpack.Length); TotalThrottle.AddBytes(qpack.Length);
LandThrottle.AddBytes(qpack.Length); LandThrottle.AddBytes(qpack.Length);
qchanged = true; qchanged = true;
if (LandOutgoingPacketQueue.Count == 0 && !Empty.Contains(ThrottleOutPacketType.Land))
Empty.Add(ThrottleOutPacketType.Land);
} }
if ((WindOutgoingPacketQueue.Count > 0) && WindThrottle.UnderLimit()) if ((WindOutgoingPacketQueue.Count > 0) && WindThrottle.UnderLimit())
@ -435,6 +417,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
TotalThrottle.AddBytes(qpack.Length); TotalThrottle.AddBytes(qpack.Length);
WindThrottle.AddBytes(qpack.Length); WindThrottle.AddBytes(qpack.Length);
qchanged = true; qchanged = true;
if (WindOutgoingPacketQueue.Count == 0 && !Empty.Contains(ThrottleOutPacketType.Wind))
Empty.Add(ThrottleOutPacketType.Wind);
} }
if ((CloudOutgoingPacketQueue.Count > 0) && CloudThrottle.UnderLimit()) if ((CloudOutgoingPacketQueue.Count > 0) && CloudThrottle.UnderLimit())
@ -445,6 +430,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
TotalThrottle.AddBytes(qpack.Length); TotalThrottle.AddBytes(qpack.Length);
CloudThrottle.AddBytes(qpack.Length); CloudThrottle.AddBytes(qpack.Length);
qchanged = true; qchanged = true;
if (CloudOutgoingPacketQueue.Count == 0 && !Empty.Contains(ThrottleOutPacketType.Cloud))
Empty.Add(ThrottleOutPacketType.Cloud);
} }
if ((TaskOutgoingPacketQueue.Count > 0 || TaskLowpriorityPacketQueue.Count > 0) && TaskThrottle.UnderLimit()) if ((TaskOutgoingPacketQueue.Count > 0 || TaskLowpriorityPacketQueue.Count > 0) && TaskThrottle.UnderLimit())
@ -464,6 +452,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
TotalThrottle.AddBytes(qpack.Length); TotalThrottle.AddBytes(qpack.Length);
TaskThrottle.AddBytes(qpack.Length); TaskThrottle.AddBytes(qpack.Length);
qchanged = true; qchanged = true;
if (TaskOutgoingPacketQueue.Count == 0 && TaskLowpriorityPacketQueue.Count == 0 && !Empty.Contains(ThrottleOutPacketType.Task))
Empty.Add(ThrottleOutPacketType.Task);
} }
if ((TextureOutgoingPacketQueue.Count > 0) && TextureThrottle.UnderLimit()) if ((TextureOutgoingPacketQueue.Count > 0) && TextureThrottle.UnderLimit())
@ -474,6 +465,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
TotalThrottle.AddBytes(qpack.Length); TotalThrottle.AddBytes(qpack.Length);
TextureThrottle.AddBytes(qpack.Length); TextureThrottle.AddBytes(qpack.Length);
qchanged = true; qchanged = true;
if (TextureOutgoingPacketQueue.Count == 0 && !Empty.Contains(ThrottleOutPacketType.Texture))
Empty.Add(ThrottleOutPacketType.Texture);
} }
if ((AssetOutgoingPacketQueue.Count > 0) && AssetThrottle.UnderLimit()) if ((AssetOutgoingPacketQueue.Count > 0) && AssetThrottle.UnderLimit())
@ -484,10 +478,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP
TotalThrottle.AddBytes(qpack.Length); TotalThrottle.AddBytes(qpack.Length);
AssetThrottle.AddBytes(qpack.Length); AssetThrottle.AddBytes(qpack.Length);
qchanged = true; qchanged = true;
if (AssetOutgoingPacketQueue.Count == 0 && !Empty.Contains(ThrottleOutPacketType.Asset))
Empty.Add(ThrottleOutPacketType.Asset);
} }
} }
// m_log.Info("[THROTTLE]: Processed " + throttleLoops + " packets"); // m_log.Info("[THROTTLE]: Processed " + throttleLoops + " packets");
e = new List<ThrottleOutPacketType>(Empty);
Empty.Clear();
} }
foreach (ThrottleOutPacketType t in e)
{
if (GetQueueCount(t) == 0)
TriggerOnQueueEmpty(t);
}
}
private void TriggerOnQueueEmpty(ThrottleOutPacketType queue)
{
QueueEmpty handlerQueueEmpty = OnQueueEmpty;
if (handlerQueueEmpty != null)
handlerQueueEmpty(queue);
} }
private void ThrottleTimerElapsed(object sender, ElapsedEventArgs e) private void ThrottleTimerElapsed(object sender, ElapsedEventArgs e)
@ -497,7 +511,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ProcessThrottle(); ProcessThrottle();
} }
private void ThrottleCheck(ref LLPacketThrottle throttle, ref Queue<LLQueItem> q, LLQueItem item) private void ThrottleCheck(ref LLPacketThrottle throttle, ref Queue<LLQueItem> q, LLQueItem item, ThrottleOutPacketType itemType)
{ {
// The idea.. is if the packet throttle queues are empty // The idea.. is if the packet throttle queues are empty
// and the client is under throttle for the type. Queue // and the client is under throttle for the type. Queue
@ -513,6 +527,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
throttle.AddBytes(item.Length); throttle.AddBytes(item.Length);
TotalThrottle.AddBytes(item.Length); TotalThrottle.AddBytes(item.Length);
SendQueue.Enqueue(item); SendQueue.Enqueue(item);
lock (this)
{
if (!Empty.Contains(itemType))
Empty.Add(itemType);
}
} }
catch (Exception e) catch (Exception e)
{ {
@ -698,5 +717,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
get { return throttleMultiplier; } get { return throttleMultiplier; }
} }
public int GetQueueCount(ThrottleOutPacketType queue)
{
switch (queue)
{
case ThrottleOutPacketType.Land:
return LandOutgoingPacketQueue.Count;
case ThrottleOutPacketType.Wind:
return WindOutgoingPacketQueue.Count;
case ThrottleOutPacketType.Cloud:
return CloudOutgoingPacketQueue.Count;
case ThrottleOutPacketType.Task:
return TaskOutgoingPacketQueue.Count;
case ThrottleOutPacketType.Texture:
return TextureOutgoingPacketQueue.Count;
case ThrottleOutPacketType.Asset:
return AssetOutgoingPacketQueue.Count;
}
return 0;
}
} }
} }

View File

@ -34,8 +34,8 @@ using System.Threading;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.Assets;
using OpenMetaverse.Imaging; using OpenMetaverse.Imaging;
using CSJ2K;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
@ -43,31 +43,25 @@ using OpenSim.Services.Interfaces;
namespace OpenSim.Region.CoreModules.Agent.TextureSender namespace OpenSim.Region.CoreModules.Agent.TextureSender
{ {
public delegate void J2KDecodeDelegate(UUID AssetId); public delegate void J2KDecodeDelegate(UUID assetID);
public class J2KDecoderModule : IRegionModule, IJ2KDecoder public class J2KDecoderModule : IRegionModule, IJ2KDecoder
{ {
#region IRegionModule Members private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog m_log /// <summary>Temporarily holds deserialized layer data information in memory</summary>
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private readonly ExpiringCache<UUID, OpenJPEG.J2KLayerInfo[]> m_decodedCache = new ExpiringCache<UUID,OpenJPEG.J2KLayerInfo[]>();
/// <summary>List of client methods to notify of results of decode</summary>
/// <summary>
/// Cached Decoded Layers
/// </summary>
private readonly Dictionary<UUID, OpenJPEG.J2KLayerInfo[]> m_cacheddecode = new Dictionary<UUID, OpenJPEG.J2KLayerInfo[]>();
private bool OpenJpegFail = false;
private string CacheFolder = Util.dataDir() + "/j2kDecodeCache";
private int CacheTimeout = 720;
private J2KDecodeFileCache fCache = null;
private Thread CleanerThread = null;
private IAssetService AssetService = null;
private Scene m_Scene = null;
/// <summary>
/// List of client methods to notify of results of decode
/// </summary>
private readonly Dictionary<UUID, List<DecodedCallback>> m_notifyList = new Dictionary<UUID, List<DecodedCallback>>(); private readonly Dictionary<UUID, List<DecodedCallback>> m_notifyList = new Dictionary<UUID, List<DecodedCallback>>();
/// <summary>Cache that will store decoded JPEG2000 layer boundary data</summary>
private IImprovedAssetCache m_cache;
/// <summary>Reference to a scene (doesn't matter which one as long as it can load the cache module)</summary>
private Scene m_scene;
#region IRegionModule
public string Name { get { return "J2KDecoderModule"; } }
public bool IsSharedModule { get { return true; } }
public J2KDecoderModule() public J2KDecoderModule()
{ {
@ -75,488 +69,227 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
public void Initialise(Scene scene, IConfigSource source) public void Initialise(Scene scene, IConfigSource source)
{ {
if (m_Scene == null) if (m_scene == null)
m_Scene = scene; m_scene = scene;
IConfig j2kConfig = source.Configs["J2KDecoder"];
if (j2kConfig != null)
{
CacheFolder = j2kConfig.GetString("CacheDir", CacheFolder);
CacheTimeout = j2kConfig.GetInt("CacheTimeout", CacheTimeout);
}
if (fCache == null)
fCache = new J2KDecodeFileCache(CacheFolder, CacheTimeout);
scene.RegisterModuleInterface<IJ2KDecoder>(this); scene.RegisterModuleInterface<IJ2KDecoder>(this);
if (CleanerThread == null && CacheTimeout != 0)
{
CleanerThread = new Thread(CleanCache);
CleanerThread.Name = "J2KCleanerThread";
CleanerThread.IsBackground = true;
CleanerThread.Start();
}
} }
public void PostInitialise() public void PostInitialise()
{ {
AssetService = m_Scene.AssetService; m_cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
} }
public void Close() public void Close()
{ {
} }
public string Name #endregion IRegionModule
#region IJ2KDecoder
public void BeginDecode(UUID assetID, byte[] j2kData, DecodedCallback callback)
{ {
get { return "J2KDecoderModule"; } OpenJPEG.J2KLayerInfo[] result;
}
public bool IsSharedModule
{
get { return true; }
}
#endregion
#region IJ2KDecoder Members
public void decode(UUID AssetId, byte[] assetData, DecodedCallback decodedReturn)
{
// Dummy for if decoding fails.
OpenJPEG.J2KLayerInfo[] result = new OpenJPEG.J2KLayerInfo[0];
// Check if it's cached
bool cached = false;
lock (m_cacheddecode)
{
if (m_cacheddecode.ContainsKey(AssetId))
{
cached = true;
result = m_cacheddecode[AssetId];
}
}
// If it's cached, return the cached results // If it's cached, return the cached results
if (cached) if (m_decodedCache.TryGetValue(assetID, out result))
{ {
decodedReturn(AssetId, result); callback(assetID, result);
} }
else else
{ {
// not cached, so we need to decode it // Not cached, we need to decode it.
// Add to notify list and start decoding. // Add to notify list and start decoding.
// Next request for this asset while it's decoding will only be added to the notify list // Next request for this asset while it's decoding will only be added to the notify list
// once this is decoded, requests will be served from the cache and all clients in the notifylist will be updated // once this is decoded, requests will be served from the cache and all clients in the notifylist will be updated
bool decode = false; bool decode = false;
lock (m_notifyList) lock (m_notifyList)
{ {
if (m_notifyList.ContainsKey(AssetId)) if (m_notifyList.ContainsKey(assetID))
{ {
m_notifyList[AssetId].Add(decodedReturn); m_notifyList[assetID].Add(callback);
} }
else else
{ {
List<DecodedCallback> notifylist = new List<DecodedCallback>(); List<DecodedCallback> notifylist = new List<DecodedCallback>();
notifylist.Add(decodedReturn); notifylist.Add(callback);
m_notifyList.Add(AssetId, notifylist); m_notifyList.Add(assetID, notifylist);
decode = true; decode = true;
} }
} }
// Do Decode! // Do Decode!
if (decode) if (decode)
{ DoJ2KDecode(assetID, j2kData);
doJ2kDecode(AssetId, assetData);
}
} }
} }
/// <summary> /// <summary>
/// Provides a synchronous decode so that caller can be assured that this executes before the next line /// Provides a synchronous decode so that caller can be assured that this executes before the next line
/// </summary> /// </summary>
/// <param name="AssetId"></param> /// <param name="assetID"></param>
/// <param name="j2kdata"></param> /// <param name="j2kData"></param>
public void syncdecode(UUID AssetId, byte[] j2kdata) public void Decode(UUID assetID, byte[] j2kData)
{ {
doJ2kDecode(AssetId, j2kdata); DoJ2KDecode(assetID, j2kData);
} }
#endregion #endregion IJ2KDecoder
/// <summary> /// <summary>
/// Decode Jpeg2000 Asset Data /// Decode Jpeg2000 Asset Data
/// </summary> /// </summary>
/// <param name="AssetId">UUID of Asset</param> /// <param name="assetID">UUID of Asset</param>
/// <param name="j2kdata">Byte Array Asset Data </param> /// <param name="j2kData">JPEG2000 data</param>
private void doJ2kDecode(UUID AssetId, byte[] j2kdata) private void DoJ2KDecode(UUID assetID, byte[] j2kData)
{ {
int DecodeTime = 0; int DecodeTime = 0;
DecodeTime = Environment.TickCount; DecodeTime = Environment.TickCount;
OpenJPEG.J2KLayerInfo[] layers = new OpenJPEG.J2KLayerInfo[0]; // Dummy result for if it fails. Informs that there's only full quality OpenJPEG.J2KLayerInfo[] layers;
if (!OpenJpegFail) if (!TryLoadCacheForAsset(assetID, out layers))
{
if (!fCache.TryLoadCacheForAsset(AssetId, out layers))
{ {
try try
{ {
List<int> layerStarts = CSJ2K.J2kImage.GetLayerBoundaries(new MemoryStream(j2kData));
AssetTexture texture = new AssetTexture(AssetId, j2kdata); if (layerStarts != null && layerStarts.Count > 0)
if (texture.DecodeLayerBoundaries())
{ {
bool sane = true; layers = new OpenJPEG.J2KLayerInfo[layerStarts.Count];
// Sanity check all of the layers for (int i = 0; i < layerStarts.Count; i++)
for (int i = 0; i < texture.LayerInfo.Length; i++)
{ {
if (texture.LayerInfo[i].End > texture.AssetData.Length) OpenJPEG.J2KLayerInfo layer = new OpenJPEG.J2KLayerInfo();
{
sane = false;
break;
}
}
if (sane)
{
layers = texture.LayerInfo;
fCache.SaveFileCacheForAsset(AssetId, layers);
// Write out decode time
m_log.InfoFormat("[J2KDecoderModule]: {0} Decode Time: {1}", Environment.TickCount - DecodeTime,
AssetId);
}
else
{
m_log.WarnFormat(
"[J2KDecoderModule]: JPEG2000 texture decoding succeeded, but sanity check failed for {0}",
AssetId);
}
}
else
{
/*
Random rnd = new Random();
// scramble ends for test
for (int i = 0; i < texture.LayerInfo.Length; i++)
{
texture.LayerInfo[i].End = rnd.Next(999999);
}
*/
// Try to do some heuristics error correction! Yeah.
bool sane2Heuristics = true;
if (texture.Image == null)
sane2Heuristics = false;
if (texture.LayerInfo == null)
sane2Heuristics = false;
if (sane2Heuristics)
{
if (texture.LayerInfo.Length == 0)
sane2Heuristics = false;
}
if (sane2Heuristics)
{
// Last layer start is less then the end of the file and last layer start is greater then 0
if (texture.LayerInfo[texture.LayerInfo.Length - 1].Start < texture.AssetData.Length && texture.LayerInfo[texture.LayerInfo.Length - 1].Start > 0)
{
}
else
{
sane2Heuristics = false;
}
}
if (sane2Heuristics)
{
int start = 0;
// try to fix it by using consistant data in the start field
for (int i = 0; i < texture.LayerInfo.Length; i++)
{
if (i == 0) if (i == 0)
start = 0; layer.Start = 0;
if (i == texture.LayerInfo.Length - 1)
texture.LayerInfo[i].End = texture.AssetData.Length;
else else
texture.LayerInfo[i].End = texture.LayerInfo[i + 1].Start - 1; layer.Start = layerStarts[i];
// in this case, the end of the next packet is less then the start of the last packet if (i == layerStarts.Count - 1)
// after we've attempted to fix it which means the start of the last packet is borked layer.End = j2kData.Length;
// there's no recovery from this
if (texture.LayerInfo[i].End < start)
{
sane2Heuristics = false;
break;
}
if (texture.LayerInfo[i].End < 0 || texture.LayerInfo[i].End > texture.AssetData.Length)
{
sane2Heuristics = false;
break;
}
if (texture.LayerInfo[i].Start < 0 || texture.LayerInfo[i].Start > texture.AssetData.Length)
{
sane2Heuristics = false;
break;
}
start = texture.LayerInfo[i].Start;
}
}
if (sane2Heuristics)
{
layers = texture.LayerInfo;
fCache.SaveFileCacheForAsset(AssetId, layers);
// Write out decode time
m_log.InfoFormat("[J2KDecoderModule]: HEURISTICS SUCCEEDED {0} Decode Time: {1}", Environment.TickCount - DecodeTime,
AssetId);
}
else else
{ layer.End = layerStarts[i + 1] - 1;
m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding failed for {0}. Is this a texture? is it J2K?", AssetId);
layers[i] = layer;
} }
} }
texture = null; // dereference and dispose of ManagedImage
}
catch (DllNotFoundException)
{
m_log.Error(
"[J2KDecoderModule]: OpenJpeg is not installed properly. Decoding disabled! This will slow down texture performance! Often times this is because of an old version of GLIBC. You must have version 2.4 or above!");
OpenJpegFail = true;
} }
catch (Exception ex) catch (Exception ex)
{ {
m_log.WarnFormat( m_log.Warn("[J2KDecoderModule]: CSJ2K threw an exception decoding texture " + assetID + ": " + ex.Message);
"[J2KDecoderModule]: JPEG2000 texture decoding threw an exception for {0}, {1}",
AssetId, ex);
}
} }
if (layers == null || layers.Length == 0)
{
m_log.Warn("[J2KDecoderModule]: Failed to decode layer data for texture " + assetID + ", guessing sane defaults");
// Layer decoding completely failed. Guess at sane defaults for the layer boundaries
layers = CreateDefaultLayers(j2kData.Length);
} }
// Cache Decoded layers // Cache Decoded layers
lock (m_cacheddecode) SaveFileCacheForAsset(assetID, layers);
{
if (m_cacheddecode.ContainsKey(AssetId))
m_cacheddecode.Remove(AssetId);
m_cacheddecode.Add(AssetId, layers);
} }
// Notify Interested Parties // Notify Interested Parties
lock (m_notifyList) lock (m_notifyList)
{ {
if (m_notifyList.ContainsKey(AssetId)) if (m_notifyList.ContainsKey(assetID))
{ {
foreach (DecodedCallback d in m_notifyList[AssetId]) foreach (DecodedCallback d in m_notifyList[assetID])
{ {
if (d != null) if (d != null)
d.DynamicInvoke(AssetId, layers); d.DynamicInvoke(assetID, layers);
} }
m_notifyList.Remove(AssetId); m_notifyList.Remove(assetID);
} }
} }
} }
private void CleanCache() private OpenJPEG.J2KLayerInfo[] CreateDefaultLayers(int j2kLength)
{ {
m_log.Info("[J2KDecoderModule]: Cleaner thread started"); OpenJPEG.J2KLayerInfo[] layers = new OpenJPEG.J2KLayerInfo[5];
while (true) for (int i = 0; i < layers.Length; i++)
{ layers[i] = new OpenJPEG.J2KLayerInfo();
if (AssetService != null)
fCache.ScanCacheFiles(RedecodeTexture);
System.Threading.Thread.Sleep(600000); // These default layer sizes are based on a small sampling of real-world texture data
} // with extra padding thrown in for good measure. This is a worst case fallback plan
// and may not gracefully handle all real world data
layers[0].Start = 0;
layers[1].Start = (int)((float)j2kLength * 0.02f);
layers[2].Start = (int)((float)j2kLength * 0.05f);
layers[3].Start = (int)((float)j2kLength * 0.20f);
layers[4].Start = (int)((float)j2kLength * 0.50f);
layers[0].End = layers[1].Start - 1;
layers[1].End = layers[2].Start - 1;
layers[2].End = layers[3].Start - 1;
layers[3].End = layers[4].Start - 1;
layers[4].End = j2kLength;
return layers;
} }
private void RedecodeTexture(UUID assetID) private void SaveFileCacheForAsset(UUID AssetId, OpenJPEG.J2KLayerInfo[] Layers)
{ {
AssetBase texture = AssetService.Get(assetID.ToString()); m_decodedCache.AddOrUpdate(AssetId, Layers, TimeSpan.FromMinutes(10));
if (texture == null)
return;
doJ2kDecode(assetID, texture.Data); if (m_cache != null)
} {
} AssetBase layerDecodeAsset = new AssetBase();
layerDecodeAsset.ID = "j2kCache_" + AssetId.ToString();
layerDecodeAsset.Local = true;
layerDecodeAsset.Name = layerDecodeAsset.ID;
layerDecodeAsset.Temporary = true;
layerDecodeAsset.Type = (sbyte)AssetType.Notecard;
public class J2KDecodeFileCache #region Serialize Layer Data
{
private readonly string m_cacheDecodeFolder;
private readonly int m_cacheTimeout;
private bool enabled = true;
private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// Creates a new instance of a file cache
/// </summary>
/// <param name="pFolder">base folder for the cache. Will be created if it doesn't exist</param>
public J2KDecodeFileCache(string pFolder, int timeout)
{
m_cacheDecodeFolder = pFolder;
m_cacheTimeout = timeout;
if (!Directory.Exists(pFolder))
{
Createj2KCacheFolder(pFolder);
}
}
/// <summary>
/// Save Layers to Disk Cache
/// </summary>
/// <param name="AssetId">Asset to Save the layers. Used int he file name by default</param>
/// <param name="Layers">The Layer Data from OpenJpeg</param>
/// <returns></returns>
public bool SaveFileCacheForAsset(UUID AssetId, OpenJPEG.J2KLayerInfo[] Layers)
{
if (Layers.Length > 0 && enabled)
{
FileStream fsCache =
new FileStream(String.Format("{0}/{1}", m_cacheDecodeFolder, FileNameFromAssetId(AssetId)),
FileMode.Create);
StreamWriter fsSWCache = new StreamWriter(fsCache);
StringBuilder stringResult = new StringBuilder(); StringBuilder stringResult = new StringBuilder();
string strEnd = "\n"; string strEnd = "\n";
for (int i = 0; i < Layers.Length; i++) for (int i = 0; i < Layers.Length; i++)
{ {
if (i == (Layers.Length - 1)) if (i == Layers.Length - 1)
strEnd = ""; strEnd = String.Empty;
stringResult.AppendFormat("{0}|{1}|{2}{3}", Layers[i].Start, Layers[i].End, Layers[i].End - Layers[i].Start, strEnd); stringResult.AppendFormat("{0}|{1}|{2}{3}", Layers[i].Start, Layers[i].End, Layers[i].End - Layers[i].Start, strEnd);
} }
fsSWCache.Write(stringResult.ToString());
fsSWCache.Close(); layerDecodeAsset.Data = Encoding.UTF8.GetBytes(stringResult.ToString());
fsSWCache.Dispose();
fsCache.Dispose(); #endregion Serialize Layer Data
m_cache.Cache(layerDecodeAsset);
}
}
bool TryLoadCacheForAsset(UUID AssetId, out OpenJPEG.J2KLayerInfo[] Layers)
{
if (m_decodedCache.TryGetValue(AssetId, out Layers))
{
return true; return true;
} }
else if (m_cache != null)
{
string assetName = "j2kCache_" + AssetId.ToString();
AssetBase layerDecodeAsset = m_cache.Get(assetName);
if (layerDecodeAsset != null)
{
#region Deserialize Layer Data
string readResult = Encoding.UTF8.GetString(layerDecodeAsset.Data);
string[] lines = readResult.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
if (lines.Length == 0)
{
m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (empty) " + assetName);
m_cache.Expire(assetName);
return false; return false;
} }
/// <summary>
/// Loads the Layer data from the disk cache
/// Returns true if load succeeded
/// </summary>
/// <param name="AssetId">AssetId that we're checking the cache for</param>
/// <param name="Layers">out layers to save to</param>
/// <returns>true if load succeeded</returns>
public bool TryLoadCacheForAsset(UUID AssetId, out OpenJPEG.J2KLayerInfo[] Layers)
{
string filename = String.Format("{0}/{1}", m_cacheDecodeFolder, FileNameFromAssetId(AssetId));
Layers = new OpenJPEG.J2KLayerInfo[0];
if (!File.Exists(filename))
return false;
if (!enabled)
{
return false;
}
string readResult = string.Empty;
try
{
FileStream fsCachefile =
new FileStream(filename,
FileMode.Open);
StreamReader sr = new StreamReader(fsCachefile);
readResult = sr.ReadToEnd();
sr.Close();
sr.Dispose();
fsCachefile.Dispose();
}
catch (IOException ioe)
{
if (ioe is PathTooLongException)
{
m_log.Error(
"[J2KDecodeCache]: Cache Read failed. Path is too long.");
}
else if (ioe is DirectoryNotFoundException)
{
m_log.Error(
"[J2KDecodeCache]: Cache Read failed. Cache Directory does not exist!");
enabled = false;
}
else
{
m_log.Error(
"[J2KDecodeCache]: Cache Read failed. IO Exception.");
}
return false;
}
catch (UnauthorizedAccessException)
{
m_log.Error(
"[J2KDecodeCache]: Cache Read failed. UnauthorizedAccessException Exception. Do you have the proper permissions on this file?");
return false;
}
catch (ArgumentException ae)
{
if (ae is ArgumentNullException)
{
m_log.Error(
"[J2KDecodeCache]: Cache Read failed. No Filename provided");
}
else
{
m_log.Error(
"[J2KDecodeCache]: Cache Read failed. Filname was invalid");
}
return false;
}
catch (NotSupportedException)
{
m_log.Error(
"[J2KDecodeCache]: Cache Read failed, not supported. Cache disabled!");
enabled = false;
return false;
}
catch (Exception e)
{
m_log.ErrorFormat(
"[J2KDecodeCache]: Cache Read failed, unknown exception. Error: {0}",
e.ToString());
return false;
}
string[] lines = readResult.Split('\n');
if (lines.Length <= 0)
return false;
Layers = new OpenJPEG.J2KLayerInfo[lines.Length]; Layers = new OpenJPEG.J2KLayerInfo[lines.Length];
for (int i = 0; i < lines.Length; i++) for (int i = 0; i < lines.Length; i++)
@ -573,132 +306,30 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
} }
catch (FormatException) catch (FormatException)
{ {
m_log.WarnFormat("[J2KDecodeCache]: Cache Read failed with ErrorConvert for {0}", AssetId); m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (format) " + assetName);
Layers = new OpenJPEG.J2KLayerInfo[0]; m_cache.Expire(assetName);
return false; return false;
} }
Layers[i] = new OpenJPEG.J2KLayerInfo(); Layers[i] = new OpenJPEG.J2KLayerInfo();
Layers[i].Start = element1; Layers[i].Start = element1;
Layers[i].End = element2; Layers[i].End = element2;
} }
else else
{ {
// reading failed m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (layout) " + assetName);
m_log.WarnFormat("[J2KDecodeCache]: Cache Read failed for {0}", AssetId); m_cache.Expire(assetName);
Layers = new OpenJPEG.J2KLayerInfo[0];
return false; return false;
} }
} }
#endregion Deserialize Layer Data
return true; return true;
} }
/// <summary>
/// Routine which converts assetid to file name
/// </summary>
/// <param name="AssetId">asset id of the image</param>
/// <returns>string filename</returns>
public string FileNameFromAssetId(UUID AssetId)
{
return String.Format("j2kCache_{0}.cache", AssetId);
} }
public UUID AssetIdFromFileName(string fileName) return false;
{
string rawId = fileName.Replace("j2kCache_", "").Replace(".cache", "");
UUID asset;
if (!UUID.TryParse(rawId, out asset))
return UUID.Zero;
return asset;
}
/// <summary>
/// Creates the Cache Folder
/// </summary>
/// <param name="pFolder">Folder to Create</param>
public void Createj2KCacheFolder(string pFolder)
{
try
{
Directory.CreateDirectory(pFolder);
}
catch (IOException ioe)
{
if (ioe is PathTooLongException)
{
m_log.Error(
"[J2KDecodeCache]: Cache Directory does not exist and create failed because the path to the cache folder is too long. Cache disabled!");
}
else if (ioe is DirectoryNotFoundException)
{
m_log.Error(
"[J2KDecodeCache]: Cache Directory does not exist and create failed because the supplied base of the directory folder does not exist. Cache disabled!");
}
else
{
m_log.Error(
"[J2KDecodeCache]: Cache Directory does not exist and create failed because of an IO Exception. Cache disabled!");
}
enabled = false;
}
catch (UnauthorizedAccessException)
{
m_log.Error(
"[J2KDecodeCache]: Cache Directory does not exist and create failed because of an UnauthorizedAccessException Exception. Cache disabled!");
enabled = false;
}
catch (ArgumentException ae)
{
if (ae is ArgumentNullException)
{
m_log.Error(
"[J2KDecodeCache]: Cache Directory does not exist and create failed because the folder provided is invalid! Cache disabled!");
}
else
{
m_log.Error(
"[J2KDecodeCache]: Cache Directory does not exist and create failed because no cache folder was provided! Cache disabled!");
}
enabled = false;
}
catch (NotSupportedException)
{
m_log.Error(
"[J2KDecodeCache]: Cache Directory does not exist and create failed because it's not supported. Cache disabled!");
enabled = false;
}
catch (Exception e)
{
m_log.ErrorFormat(
"[J2KDecodeCache]: Cache Directory does not exist and create failed because of an unknown exception. Cache disabled! Error: {0}",
e.ToString());
enabled = false;
}
}
public void ScanCacheFiles(J2KDecodeDelegate decode)
{
DirectoryInfo dir = new DirectoryInfo(m_cacheDecodeFolder);
FileInfo[] files = dir.GetFiles("j2kCache_*.cache");
foreach (FileInfo f in files)
{
TimeSpan fileAge = DateTime.Now - f.CreationTime;
if (m_cacheTimeout != 0 && fileAge >= TimeSpan.FromMinutes(m_cacheTimeout))
{
File.Delete(f.Name);
decode(AssetIdFromFileName(f.Name));
System.Threading.Thread.Sleep(5000);
}
}
} }
} }
} }

View File

@ -325,7 +325,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface<IJ2KDecoder>(); IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface<IJ2KDecoder>();
if (cacheLayerDecode != null) if (cacheLayerDecode != null)
{ {
cacheLayerDecode.syncdecode(asset.FullID, asset.Data); cacheLayerDecode.Decode(asset.FullID, asset.Data);
cacheLayerDecode = null; cacheLayerDecode = null;
LastAssetID = asset.FullID; LastAssetID = asset.FullID;
} }

View File

@ -1102,5 +1102,9 @@ namespace OpenSim.Region.Examples.SimpleModule
{ {
} }
#endregion #endregion
public void SendRebakeAvatarTextures(UUID textureID)
{
}
} }
} }

View File

@ -30,12 +30,11 @@ using OpenMetaverse.Imaging;
namespace OpenSim.Region.Framework.Interfaces namespace OpenSim.Region.Framework.Interfaces
{ {
public delegate void DecodedCallback(UUID AssetId, OpenJPEG.J2KLayerInfo[] layers); public delegate void DecodedCallback(UUID AssetId, OpenJPEG.J2KLayerInfo[] layers);
public interface IJ2KDecoder public interface IJ2KDecoder
{ {
void decode(UUID AssetId, byte[] assetData, DecodedCallback decodedReturn); void BeginDecode(UUID assetID, byte[] j2kData, DecodedCallback callback);
void syncdecode(UUID AssetId, byte[] j2kdata); void Decode(UUID assetID, byte[] j2kData);
} }
} }

View File

@ -540,127 +540,5 @@ namespace OpenSim.Region.Framework.Scenes
{ {
m_localScenes.ForEach(action); m_localScenes.ForEach(action);
} }
public void CacheJ2kDecode(int threads)
{
if (threads < 1) threads = 1;
IJ2KDecoder m_decoder = m_localScenes[0].RequestModuleInterface<IJ2KDecoder>();
List<UUID> assetRequestList = new List<UUID>();
#region AssetGathering!
foreach (Scene scene in m_localScenes)
{
List<EntityBase> entitles = scene.GetEntities();
foreach (EntityBase entity in entitles)
{
if (entity is SceneObjectGroup)
{
SceneObjectGroup sog = (SceneObjectGroup) entity;
foreach (SceneObjectPart part in sog.Children.Values)
{
if (part.Shape != null)
{
if (part.Shape.TextureEntry.Length > 0)
{
OpenMetaverse.Primitive.TextureEntry te =
new Primitive.TextureEntry(part.Shape.TextureEntry, 0,
part.Shape.TextureEntry.Length);
if (te.DefaultTexture != null) // this has been null for some reason...
{
if (te.DefaultTexture.TextureID != UUID.Zero)
assetRequestList.Add(te.DefaultTexture.TextureID);
}
for (int i=0; i<te.FaceTextures.Length; i++)
{
if (te.FaceTextures[i] != null)
{
if (te.FaceTextures[i].TextureID != UUID.Zero)
{
assetRequestList.Add(te.FaceTextures[i].TextureID);
}
}
}
}
if (part.Shape.SculptTexture != UUID.Zero)
{
assetRequestList.Add(part.Shape.SculptTexture);
}
}
}
}
}
}
#endregion
int entries_per_thread = (assetRequestList.Count / threads) + 1;
UUID[] arrAssetRequestList = assetRequestList.ToArray();
List<UUID[]> arrvalus = new List<UUID[]>();
//split into separate arrays
for (int j = 0; j < threads; j++)
{
List<UUID> val = new List<UUID>();
for (int k = j * entries_per_thread; k < ((j + 1) * entries_per_thread); k++)
{
if (k < arrAssetRequestList.Length)
{
val.Add(arrAssetRequestList[k]);
}
}
arrvalus.Add(val.ToArray());
}
for (int l = 0; l < arrvalus.Count; l++)
{
DecodeThreadContents threadworkItem = new DecodeThreadContents();
threadworkItem.sn = m_localScenes[0];
threadworkItem.j2kdecode = m_decoder;
threadworkItem.arrassets = arrvalus[l];
System.Threading.Thread decodethread =
new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(threadworkItem.run));
threadworkItem.SetThread(decodethread);
decodethread.Priority = System.Threading.ThreadPriority.Lowest;
decodethread.Name = "J2kCacheDecodeThread_" + l + 1;
ThreadTracker.Add(decodethread);
decodethread.Start();
}
}
}
public class DecodeThreadContents
{
public Scene sn;
public UUID[] arrassets;
public IJ2KDecoder j2kdecode;
private System.Threading.Thread thisthread;
public void run(object o)
{
for (int i=0;i<arrassets.Length;i++)
{
AssetBase ab = sn.AssetService.Get(arrassets[i].ToString());
if (ab != null && ab.Data != null)
{
j2kdecode.syncdecode(arrassets[i], ab.Data);
}
}
ThreadTracker.Remove(thisthread);
}
public void SetThread(System.Threading.Thread thr)
{
thisthread = thr;
}
} }
} }

View File

@ -74,6 +74,8 @@ namespace OpenSim.Region.Framework.Scenes
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
public static byte[] DefaultTexture; public static byte[] DefaultTexture;
public UUID currentParcelUUID = UUID.Zero; public UUID currentParcelUUID = UUID.Zero;
@ -2686,7 +2688,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
/// <param name="texture"></param> /// <param name="texture"></param>
/// <param name="visualParam"></param> /// <param name="visualParam"></param>
public void SetAppearance(byte[] texture, List<byte> visualParam) public void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams)
{ {
if (m_physicsActor != null) if (m_physicsActor != null)
{ {
@ -2704,7 +2706,30 @@ namespace OpenSim.Region.Framework.Scenes
AddToPhysicalScene(flyingTemp); AddToPhysicalScene(flyingTemp);
} }
} }
m_appearance.SetAppearance(texture, visualParam);
#region Bake Cache Check
if (textureEntry != null)
{
for (int i = 0; i < BAKE_INDICES.Length; i++)
{
int j = BAKE_INDICES[i];
Primitive.TextureEntryFace face = textureEntry.FaceTextures[j];
if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE)
{
if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
{
m_log.Warn("[APPEARANCE]: Missing baked texture " + face.TextureID + " (" + (AppearanceManager.TextureIndex)j + ") for avatar " + this.Name);
this.ControllingClient.SendRebakeAvatarTextures(face.TextureID);
}
}
}
}
#endregion Bake Cache Check
m_appearance.SetAppearance(textureEntry, visualParams);
if (m_appearance.AvatarHeight > 0) if (m_appearance.AvatarHeight > 0)
SetHeight(m_appearance.AvatarHeight); SetHeight(m_appearance.AvatarHeight);
m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance);
@ -3255,14 +3280,14 @@ namespace OpenSim.Region.Framework.Scenes
wears[i++] = new AvatarWearable(itemId, assetId); wears[i++] = new AvatarWearable(itemId, assetId);
} }
m_appearance.Wearables = wears; m_appearance.Wearables = wears;
byte[] te = null; Primitive.TextureEntry te;
if (cAgent.AgentTextures != null) if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1)
te = cAgent.AgentTextures; te = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length);
else else
te = AvatarAppearance.GetDefaultTexture().GetBytes(); te = AvatarAppearance.GetDefaultTexture();
if ((cAgent.VisualParams == null) || (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT)) if ((cAgent.VisualParams == null) || (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT))
cAgent.VisualParams = AvatarAppearance.GetDefaultVisualParams(); cAgent.VisualParams = AvatarAppearance.GetDefaultVisualParams();
m_appearance.SetAppearance(te, new List<byte>(cAgent.VisualParams)); m_appearance.SetAppearance(te, (byte[])cAgent.VisualParams.Clone());
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -861,12 +861,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
Scene scene = (Scene)Scene; Scene scene = (Scene)Scene;
AvatarAppearance appearance; AvatarAppearance appearance;
scene.GetAvatarAppearance(this, out appearance); scene.GetAvatarAppearance(this, out appearance);
List<byte> visualParams = new List<byte>(); OnSetAppearance(appearance.Texture, (byte[])appearance.VisualParams.Clone());
foreach (byte visualParam in appearance.VisualParams)
{
visualParams.Add(visualParam);
}
OnSetAppearance(appearance.Texture.GetBytes(), visualParams);
} }
public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args)
@ -1609,5 +1604,9 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
} }
#endregion #endregion
public void SendRebakeAvatarTextures(UUID textureID)
{
}
} }
} }

View File

@ -1101,5 +1101,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{ {
} }
#endregion #endregion
public void SendRebakeAvatarTextures(UUID textureID)
{
}
} }
} }

View File

@ -163,13 +163,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{ {
AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene); AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene);
List<byte> wearbyte = new List<byte>(); sp.SetAppearance(x.Texture, (byte[])x.VisualParams.Clone());
for (int i = 0; i < x.VisualParams.Length; i++)
{
wearbyte.Add(x.VisualParams[i]);
}
sp.SetAppearance(x.Texture.GetBytes(), wearbyte);
} }
m_avatars.Add(npcAvatar.AgentId, npcAvatar); m_avatars.Add(npcAvatar.AgentId, npcAvatar);

View File

@ -78,6 +78,20 @@ namespace OpenSim.Region.Physics.Meshing
private Dictionary<ulong, Mesh> m_uniqueMeshes = new Dictionary<ulong, Mesh>(); private Dictionary<ulong, Mesh> m_uniqueMeshes = new Dictionary<ulong, Mesh>();
public Meshmerizer()
{
try
{
if (!Directory.Exists(decodedScultMapPath))
Directory.CreateDirectory(decodedScultMapPath);
}
catch (Exception e)
{
m_log.WarnFormat("[SCULPT]: Unable to create {0} directory: ", decodedScultMapPath, e.Message);
}
}
/// <summary> /// <summary>
/// creates a simple box mesh of the specified size. This mesh is of very low vertex count and may /// creates a simple box mesh of the specified size. This mesh is of very low vertex count and may
/// be useful as a backup proxy when level of detail is not needed or when more complex meshes fail /// be useful as a backup proxy when level of detail is not needed or when more complex meshes fail

View File

@ -1,80 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* 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 OpenSimulator Project 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 THE DEVELOPERS ``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 THE CONTRIBUTORS 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 NUnit.Framework;
using OpenSim.Framework;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Asset;
using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Server.Handlers.Tests.Asset
{
[TestFixture]
public class AssetServerGetHandlerTests
{
private const string ASSETS_PATH = "/assets";
[Test]
public void TestConstructor()
{
TestHelper.InMethod();
new AssetServerGetHandler(null);
}
[Test]
public void TestGetParams()
{
TestHelper.InMethod();
AssetServerGetHandler handler = new AssetServerGetHandler(null);
BaseRequestHandlerTestHelper.BaseTestGetParams(handler, ASSETS_PATH);
}
[Test]
public void TestSplitParams()
{
TestHelper.InMethod();
AssetServerGetHandler handler = new AssetServerGetHandler(null);
BaseRequestHandlerTestHelper.BaseTestSplitParams(handler, ASSETS_PATH);
}
// TODO: unused
// private static AssetBase CreateTestEnvironment(out AssetServerGetHandler handler, out OSHttpResponse response)
// {
// AssetBase asset = GetAssetStreamHandlerTestHelpers.CreateCommonTestResources(out response);
// IAssetService assetDataPlugin = new TestAssetService();
// handler = new AssetServerGetHandler(assetDataPlugin);
// assetDataPlugin.Store(asset);
// return asset;
// }
}
}

View File

@ -1163,5 +1163,9 @@ namespace OpenSim.Tests.Common.Mock
{ {
} }
public void SendRebakeAvatarTextures(UUID textureID)
{
}
} }
} }

View File

@ -1,10 +0,0 @@
Dave Hudson (jendave@yahoo.com),
Matthew Holmes (matthew@wildfiregames.com)
Dan Moorehead (dan05a@gmail.com)
Rob Loach (http://www.robloach.net)
C.J. Adams-Collier (cjac@colliertech.org)
Patch Contributers
lbsa71
chi11ken
sdague

View File

@ -1,65 +0,0 @@
BSD License
Copyright (c)2004-2008
See AUTHORS file for list of copyright holders
Dave Hudson (jendave@yahoo.com),
Matthew Holmes (matthew@wildfiregames.com)
Dan Moorehead (dan05a@gmail.com)
Rob Loach (http://www.robloach.net)
C.J. Adams-Collier (cjac@colliertech.org)
http://dnpb.sourceforge.net
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. 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.
3. The names of the authors may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"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 THE
COPYRIGHT OWNER OR CONTRIBUTORS 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.
---
Portions of src/Core/Targets/AutotoolsTarget.cs
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,461 +0,0 @@
2008-12-09T02:15 D. Moonfire <d.moonfire@mfgames.com>
* src/Core/Kernel.cs
- Added a /ppi target to get the results of processing but before
processing the actual results.
* src/Core/Preprocessor.cs
- Applied the patch from kanato with formatting changes.
- Uses the <?include file="" ?> format.
* tests/
- Added some lightweight tests to test the functionality of the
include patch.
2008-06-19T09:37 John Anderson <sontek@gmail.com>
* src/Core/Kernel.cs
- Only Loop through targets that are not abstract.
* src/Core/Targets/VSGenericTarget.cs
- Marked abstract and removed the Target attribute.
2008-06-16T17:37 John Anderson <sontek@gmail.com>
* src/Core/Nodes/ProjectNode.cs,data/prebuild-1.7.xsd
- Added the ability to hardcode guid's in the projects
2008-05-21T0737 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
- catch exception when unable to compile AssemblyInfo.cs
2008-05-07T17:29 John Anderson <sontek@gmail.com>
* src/Core/Targets/VSGenericTarget.cs
- Generate asp.net output in bin\ folder (asp.net requires it there)
2008-04-30T17:29 John Anderson <sontek@gmail.com>
* src/Core/Nodes/DatabaseReferenceNode.cs,
src/Core/Nodes/Datanode.cs,
src/Core/Nodes/FileNode.cs,
src/Core/Nodes/FileNodes.cs,
src/Core/Nodes/MatchNode.cs,
src/Core/Targets/VS2008Target.cs,
src/data/prebuild-1.7.xsd
- Refactored the project generation code to handle web projects and more
logically handle embedded resources and designer files.
2008-04-30T17:29 Joseph Lombrozo <digitaljeebus@gmail.com>
* src/Core/Nodes/SolutionNode.cs
- Had solutions inherit Configurations in the same way that Projects do.
2008-04-29T06:35 Joseph Lombrozo <digitaljeebus@gmail.com>
* src/Core/Targets/VS2008Target.cs,
src/Core/Nodes/DatabaseProjectNode.cs,
src/Core/Nodes/DatabaseReferenceNode.cs,
src/data/prebuild-1.7.xsd
- Added database references to database projects.
- Prevented nested solutions from being written to disk.
2008-04-29T05:43 Joseph Lombrozo <digitaljeebus@gmail.com>
* src/Core/Targets/VS2008Target.cs
- Enabled embedded solutions to contain Files.
2008-04-29T04:13 Joseph Lombrozo <digitaljeebus@gmail.com>
* src/Core/VSVersion.cs
- Fixed spelling mistake in enum comment.
* src/Core/Attributes/DataNodeAttribute.cs
- Allowed the DataNodeAttribute to be attached to a single class
more than once, allowing one class to be used to parse more than
one node at a time.
* src/Core/Kernel.cs
- Changed CacheNodeTypes() to allow for multiple DataNodeAttribute
instances in one class. Refactored ProcessFile(...) to return Solutions,
rather than adding them to the Kernel.
* src/Core/Nodes/SolutionNode.cs
- Added Guid (for embedded folders)
- Added DatabaseProjects, Solutions and Processes to the SolutionNode
when parsing.
* src/Core/Nodes/ProjectNode.cs
- Added FrameworkVersion property to allow for 2.0/3.0/3.5 differentiation.
* src/Core/Targets/VS2008Target.cs, src/data/prebuild-1.7.xsd
- Added ability to have embedded solutions, and externally referenced
prebuild scripts.
2008-04-24T04:33 John M. Anderson <sontek@gmail.com>
* src/Core/Targets/VS2003Target.cs, src/Core/Targets/VSVersion.cs
- Moved the VSVersion enum into its own file.
* src/Core/Targets/VS2008Target.cs
- added support for VS2008
* src/Core/Nodes/ProjectNode.cs
- Added initial support for ASP.NET projects
* src/Core/Nodes/DatabaseProjectNode.cs
- Added support for Visual Studio database projects
2008-02-19T07:08 C.J. Adams-Collier <cjac@colliertech.org>
* TODO
- added some tasks from Sam Hocevar
* src/Core/Targets/AutotoolsTarget.cs
- added a missing end paren
* COPYING
- Removed Randy Ridge's name from the copyright. Looks to me like
his name was present only because the file was nabbed from Tao
2008-02-09T20:29 C.J. Adams-Collier <cjac@colliertech.org>
* COPYING
- added MIT/X11 license due to inclusion of code from Monodevelop
* THANKS
- added Lluis Sanchez Gual and Todd Berman - I yoinked code from
their pkg-config .pc file parser to build AutotoolsTarget.cs.
Sorry it took me so long to remember to add mention of you guys!
* src/Core/Targets/AutotoolsTarget.cs
- added MIT/X11 license. see above.
2008-02-07T08:27 C.J. Adams-Collier <cjac@colliertech.org>
* AUTHORS
- consolidated names and contact info found laying around the
source
* src/Core/Kernel.cs
- updated copyright date
- re-formatted license for 80-column editor
- updated log banner to indicate new date, new authors
* src/Core/Targets/AutotoolsTarget.cs
- clarified reasoning behind use of constants in
AutotoolsTarget.ParsePCFile
- reduced length of some long lines using newline/indent
- added log messages for parsing .pc files, emitting solutions,
projects
- robustified the inter-package dependency resolution target
- log warning when we can't find assembly for <Reference />
- clarified code for case of inability to find embedded
autotools.xml
* src/data/autotools.xml
- adding system lookup of resgen2 to configure.ac
- fixed .resource -> .resources typo
- added a rule to create <foo>.response file containing all sources
- using @<foo>.response on $(CSC) command line instead of listing
all source files
* src/Properties/AssemblyInfo.cs
- re-formatted license for an 80-column editor
- added more authors to the AssemblyCopyright attribute
- bumped version to 2.0.3
* prebuild.xml
- bumped version to 2.0.3
* scripts/autotools.sh
- if 'mono' is in the path, run Prebuild.exe with it
- using dirname to capture correct path to prebuild.xml &c
2008-02-06T17:18 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/NAntTarget.cs
- re-formatted the license for an 80-column editor
- added myself to the copyright
- added a fix submitted by Gryc Ueusp <gryc.ueusp@gmail.com>
* src/Core/Targets/AutotoolsTarget.cs
- updated copyright to include 2008
* THANKS
- created file, added Gryc Ueusp <gryc.ueusp@gmail.com>
2008-01-01T14:50 C.J. Adams-Collier <cjac@colliertech.org>
* src/data/autotools.xml
- fixed .resx -> .resource compilation
- fixed failing edge case where Project is an unsigned Library
- added $(RESOURCE_SRC) to list of extra dist files
* src/Core/Targets/AutotoolsTarget.cs
- removed embeddedResources from extraDistFiles list
2007-04-18T07:49 C.J. Adams-Collier <cjac@colliertech.org>
* src/data/prebuild-1.7.xsd
- removed default version from references
2007-04-06T12:42 C.J. Adams-Collier <cjac@colliertech.org>
* src/data/autotools.xml
- added support for /doc: output when XmlDocFile is not empty
- not printing \t \\n on lines that have no content
- gacutil now installs the root assembly instead of the one under
bin/Debug or whatever
2007-04-04T22:12 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
- removed debugging Console.WriteLine()
* src/data/autotools.xml
- ensuring that install-sh and missing get distributed
- explicitly stating that the sources, snk, resources and binary
references live under $(srcdir)
- corrected uninstall target
- verified distcheck completes successfully
2007-04-03T21:56 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
- added a using for System.Diagnostics
- added enum ClrVersion for use with the pkg-config parser
- added class SystemPackage for use with the pkg-config parser
- removed explicit "private" property of members since it is implied
- flushing the stream-writer before it's closed
- removed excess braces around an if statement
! NormalizeAsmName(), AddAssembly(), GetAssembliesWithLibInfo(),
GetAssembliesWithoutLibInfo(), ProcessPiece(),
GetVariableFromPkgConfig(), ParsePCFile(),
RegisterSystemAssemblies(), RunInitialization()
- pulled the above from MonoDevelop to parse the system pkgconfig
files and determine /pkg: arguments. Original sources are here:
http://svn.myrealbox.com/source/trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/SystemAssemblyService.cs
http://svn.myrealbox.com/source/trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/ClrVersion.cs
! WriteProject()
- now gathering project version from AssemblyInfo.cs if it is part
of the project
- changed the declaration of the ArrayList's in the method
- now copying assembly .config files to the project, distributing,
installing
- making sure all needed files live under the Project directory
- copying strongname keys to project directory
- parsing AssemblyInfo.cs to determine assembly version
- removing all references to ".."
- removed superfluous if(project.References.Count > 0) around
for(int refNum = 0; refNum < project.References.Count; refNum++)
- removed use of runtimeLibs
- adding hook to copy sibling project's generated assemblies to
this project during Make time
- added extra dist target to ensure all files required to build
get distributed during "make dist"
- added new xslt processing args:
-- assemblyName
-- extraDistFiles
-- pkgLibs (/pkg:foo)
-- localCopyTargets (to copy sibling assemblies at Make time)
-- projectVersion (if determined from AssemblyInfo.cs)
-- hasAssemblyConfig (if there's a assembly.exe.config present)
! Write()
- calling RunInitialization() to gather pkg-config data
* src/data/autotools.xml
- accepting new args passed from AutotoolsTarget.cs
- modernized configure.ac a bit
- using a version of tar that allows >99-char filenames
- added ASSEMBLY_NAME variable
- using assembly name rather than project name for gac installation
- generated assembly is now assembly name and not project name
- accepting /pkg: flags gathered from AutotoolsTarget.cs
- adding Makefile targets to copy sibling project assemblies to .
- fixed Debug, Release targets
- adding support for strongname key signing
- adding /unsafe support
- adding a clean make target
- only running gacutil /u if the assembly being uninstalled is in gac
- added some templates to determine each Configuration's .snk
- added explanation as to why .exe assemblies live in $prefix/lib
* src/Properties/AssemblyInfo.cs
- bumped assembly version
* prebuild.xml
- bumped assembly version
2007-03-29T18:03 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
! WriteProject()
- re-named incorrectly-named variable gacLibs to systemLibs
- added another reference list, runtimeLibs which contains the
libs we will need at runtime. we use this to build a MONO_PATH
- added monoPath to the xslt args list
* src/data/autotools.xml
! <ProjectMakefileAm />
- renamed gacLibs to systemLibs
- added the sources to the dist list
- added logic to install libs that aren't strongnamed
! <ProjectWrapperScriptIn />
- accepting a param to update the MONO_PATH
2007-03-28T19:46 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/MonoDevelopTarget.cs
! CleanProject()
- using Assembly.LoadWithPartialName to locate the assembly
* src/Core/Targets/AutotoolsTarget.cs
! WriteCombine()
- no longer using $PWD to determine a project's source dir; this
doesn't work with <Process /> elements
- passing the solution name to all templates - fixes
multi-solution prebuild systems
! WriteProject()
- no longer using $PWD to determine a project's source dir; this
doesn't work with <Process /> elements
- passing the solution name to all templates - fixes
multi-solution prebuild systems
- copying strongname key to the autotools directory
- using Assembly.LoadWithPartialName to locate assemblies
* src/data/autotools.xml
! <ProjectConfigureAc />
- fixed the .pc AC_CONFIG_FILES macro
! <ProjectMakefileAm />
- added solution name param
- wrapping if type=exe check around script install macro
- added type=lib check and .pc file install macro
- added support for Configuration-specific builds (Debug, Release, etc)
- added strongname keyfile code
- TODO: support non-strongnamed library installation
! <ProjectWrapperScriptIn />
- added space preservation attribute to stylesheet element
- added a lower-case project name variable
- added solution name param
- made for-each template more specific
! <SolutionAutogenSh />
- added solution name param
! <SolutionConfigureAc />
- added solution name param
! <SolutionMakefileAm />
- added solution name param
! <ProjectPcIn />
- added solution name param
2007-03-27T09:33 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
- now processing the wrapper script if type is "Exe" or "WinExe"
* src/data/autotools.xml
! <ProjectConfigureAc />
- being more exact about where text escaping is used
- using the correct variable name for the GACUTIL_FLAGS template
- using correct test="" for the AC_CONFIG_FILES macros
! <ProjectMakefileAm />
- uncommented the bin_SCRIPTS section now that the script is being
generated correctly
! <ProjectWrapperScriptIn />
- fixed whitespace at beginning of file, before #!
- using lower-case packageName to indicate installation location
2007-03-27T09:33 C.J. Adams-Collier <cjac@colliertech.org>
* src/data/autotools.xml
! <ProjectConfigureAc />
* added a lcProjectName which is $projectName lower-cased
* moved autoconf template specifier near AC_OUTPUT
* AC_OUTPUT with args is deprecated. now using AC_CONFIG_FILES
* placed AC_CONFIG_FILES() calls for wrapper script or pkg-config
file in xslt project type checks
! <ProjectMakefileAm />
* commented out bin_SCRIPTS
* added a lcProjectName which is $projectName lower-cased
* using $lcProjectName instead of the longer version
2007-03-27T08:39 C.J. Adams-Collier <cjac@colliertech.org>
* src/data/autotools.xml
! <ProjectMakefileAm />
- added whitespace-preservation
- added the missing projectName param
- replaced bin_SCRIPTS with something that worked
2007-03-27T07:56 C.J. Adams-Collier <cjac@colliertech.org>
* src/data/autotools.xml
! <ProjectConfigureAc />
- cleaned up duplicate checks
- placed initialization macros above system check macros
- added some more messages about what's going on
- added GACUTIL_FLAGS variable including /package option
! <ProjectMakefileAm />
- added an incomplete bin_SCRIPTS
- RCS check says "building" instead of "compiling"
! <SolutionConfigureAc />
- removed macros that are useful only for projects
! <ProjectWrapperScriptIn />
- created this element on this revision
- this is a wrapper shell script that lives in the $PATH and runs
the CIL assembly
2007-03-26T20:18 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
- creating new template arguments to contain the list of libs to
reference: source, binary & GAC
- source libs are included as part of this solution (untested)
- binary libs are distributed with the source (untested)
- GAC libs are assumed to be in the GAC or other lib path (tested)
* src/data/autotools.xml
- created new params through which to accept reference info
- created a working $(CSC) line
- added a TODO item for ordering project dependency for
AC_CONFIG_SUBDIRS code
2007-03-26T08:41 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
- now creating list of source files in managed code and passing
them to the template via <xsl:param>s
* src/data/prebuild-1.7.xsd
- updated the header comment to 2007
* src/data/autotools.xml
! <ProjectConfigureAc>
- copied checks from Solution-level configure.ac
- copied solution-level config status
! <ProjectMakefileAm>
- added <xsl:param> elements for file list to be passed through
- made a temporary target for the assembly we're building
- added this target to the deps of "all:"
! <SolutionConfigureAc>
- changed status header/footer from "- - -" to "==="
2007-03-23T08:33 C.J. Adams-Collier <cjac@colliertech.org>
Added version attribute handling code for Property element
Added description element handling code
* prebuild.xml
- added /Prebuild/Solution/Property/@version attribute
- added /Prebuild/Solution/Property/Description element
* src/Core/Nodes/ProjectNode.cs
- added some docs where they were missing and obvious
- added code to handle @version
* src/Core/Nodes/DescriptionNode.cs
- new file. Used to handle /Prebuild/Solution/Property/Description
* src/Core/Targets/AutotoolsTarget.cs
- added mkdirDashP(), a recursive directory creation method
- WriteProject() now copies the files to autotools/
* src/data/prebuild-1.7.xsd
- added /Prebuild/Solution/Property/Description element
- added /Prebuild/Solution/Property/@version attribute
* src/data/autotools.xml
- removed excess <xsl:value-of select="$projectName"/>
- explicitly using dnpb: prefix
2007-03-23T04:31 C.J. Adams-Collier <cjac@colliertech.org>
Merged code from my stripped-down test
Adding support for the /Prebuild/Solution/Project/Author element
* prebuild.xml
- added Author elements
- cleaned up the really long Project element
* src/Core/Nodes/ProjectNode.cs
- added Author tag processing code
* src/Core/Nodes/AuthorNode.cs
- Created to process Author elements
- based off of ReferencePathNode.cs
* src/Core/Targets/AutotoolsTarget.cs
- merged code from https://svn.colliertech.org/mono/dnpbAutotools/dnpbAutotools/test.cs
- renamed old WriteCombine to WriteCombineOld
- renamed old WriteProject to WriteProjectOld
* src/data/prebuild-1.7.xsd
- added Author element to Project
* src/data/autotools.xml
- lower-cased utf
2007-03-22T13:58 C.J. Adams-Collier <cjac@colliertech.org>
Exposing an XmlDocument that represents the prebuild.xml file
passed to the program
* src/Core/Kernel.cs
- created an object member called XmlDocument m_CurrentDoc
- created a property to access its value
- using m_CurrentDoc to load up the prebuild.xml file rather than
a local variable called "doc"
2007-03-22 C.J. Adams-Collier <cjac@colliertech.org>
* prebuild.xml
- added autotools.xml created at https://svn.colliertech.org/mono/dnpbAutotools/dnpbAutotools/autotools.xml
* src/data/autotools.xml
- the same
* src/Core/Targets/MonoDevelopTarget.cs
- fixed bug introduced in r206
2007-03-07 C.J. Adams-Collier <cjcollier@colliertech.org>
* src/data/prebuild-1.7.xsd
- added version attribute to Solution and Project elements
2006-11-04T00:38 C.J. Adams-Collier <cjcollier@colliertech.org>
* placing AssemblyInfo.cs into Properties/
* Fixed double-mention of the package name
2006-11-03T15:23 C.J. Adams-Collier <cjcollier@colliertech.org>
* corrected a problem in the Include.am generation code
* created the new .exe
* copied it to the root of the build
2006-11-03T14:57 C.J. Adams-Collier <cjcollier@colliertech.org>
* Updated the .exe file
2006-11-03 C.J. Adams-Collier <cjcollier@colliertech.org>
* Added a TODO file
* Added a ChangeLog file
* applied some fixes for autotools gac and pkg-config installation
problems

View File

@ -1,236 +0,0 @@
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. (Caching is
disabled by default to prevent problems with accidental use of stale
cache files.)
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You only need
`configure.ac' if you want to change it or regenerate `configure' using
a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that the
`configure' script does not know about. Run `./configure --help' for
details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not support the `VPATH'
variable, you have to compile the package for one architecture at a
time in the source code directory. After you have installed the
package for one architecture, use `make distclean' before reconfiguring
for another architecture.
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out automatically,
but needs to determine by the type of machine the package will run on.
Usually, assuming the package is built to be run on the _same_
architectures, `configure' can figure that out, but if it prints a
message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share, you
can create a site shell script called `config.site' that gives default
values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script). Here is a another example:
/bin/bash ./configure CONFIG_SHELL=/bin/bash
Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
configuration-related scripts to be executed by `/bin/bash'.
`configure' Invocation
======================
`configure' recognizes the following options to control how it operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

View File

@ -1,200 +0,0 @@
Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, MonoDevelop, and NAnt.
Documentation and downloads are available at http://dnpb.sourceforge.net.
Prebuild is licensed under the BSD license.
[ XXXXXXX XX, XXX - 1.3.2 ]
+ Added Keyfile signing to NAnt target and VS2005 target
+ Updated XSD file to 1.7
+ Boo and VisualBasic Language support in VS2005 target
+ Added basic Autotools target. It creates a non-recursive Autotools system.
! Multiple files can be excluded from the Match node
! VS2005 now handles .resx files correctly.
! NAnt and Autotools now handle defines
! NAnt and Autotools now handle resources
+ Conditional XML variables can be passed through the command line.
+ Added /install and /remove command line flags to install and remove assemblies from the GAC
+ Many fixes to VS2005 target
[ July 21, 2006 - 1.3.1 ]
! VS2005 fixes from Rob Loach
! NAnt fixes from Rob Loach and David Hudson
! XML doc fixes from Rob Loach
+ Added SharpDevelop2 target (really just uses VS2005 target)
! Fixed bug with BuildEvents in Monodevelop target
+ Passing /yes will default to answering yes to any warnings
[ February 28, 2006 - 1.3 ]
+ Added MonoDevelop target.
+ Added NAnt target.
+ Lots of fixes to all targets.
* Cleaned up the code using FXCop.
* Updated schema to 1.6 to fix a typo and add a new parameter.
* jendave is now the maintainer of the project. RobLoach has been added as a developer.
* Removed references to 'dnpb'.
+ Added rudimentary support for pre- and post- build scripts
* Updated examples.
[ August 5, 2004 - 1.2 ]
+ Added Visual Studio Express (vs2005express) target contributed by Borrillis and modified for use with different languages
+ Added the allowedgroups command line option followed by a pipe-delimited list of project group filter flags (eg. Group1|Group2) allow optional filtering of all projects that dont have at least one of these flags
+ Added the filterGroups XML attribute to the project node and updated the scheme to v1.5 for this addition, it is used to specified the delimited list of filter groups to which a project belongs
* Modified the removedir command line option to allow for a pipe-delimited list of directory names
! Modified the resource loading code to search for resourced without the prepended namespace (as Visual Studio .NET does it) to allow for it to be compiled with SharpDevelop as well
+ Added the GenerateXmlDocFile boolean option to the Options XML element
* Changed the behavior of the XmlDocFile option so that if not specified it uses the assemblyName (without file extension) + .xml for the file name instead of just not generating the file since the new GenerateXmlDocFile takes care of this
[ January 3, 2004 - 1.1 ]
! Replaced regex use for more efficient manual parsing to allow use on non-windows platforms with Mono which has Regex problems
+ Added the checkOsVars attribute to the root element for enabling interpolation for Enviroment variables in the form ${var}, otherwise no checking is performed for efficiency-sake
* Make the version attribute on the root element optional as it isn't used and not needed since the schema url contains the version
[ December 30, 2004 - 1.1 ]
! Applied Leed's fix for SharpDevelop references
+ Rewrote much of the processing for better validation and without the use of a temp file
+ Added support for configurations at the project level which are named All. They now apply changes to all Solution level defined configs
* Changed all spaces into tabs
+ Added support for the None build action
* Replaced all sequence's in the XML schema for all's because the order doesn't matter since the xml file is loaded into an XmlDocument
[ December 25, 2004 - 1.0 ]
+ Added the /removedir option for cleaning directories like obj before file releases
+ Changed WriteTempXml() and the new DeleteTempXml() methods to be compiled only in DEBUG builds
* Made path optional for Match elements (defaults to current directory) and updates schema for it
! Fixed XML example in the readme.txt
+ Added example xml files to docs directory
* Updated license.txt to add Dan Moorehead and update copyright years
+ Updated prebuild.xml to take advantage of the default path attribute for match elements
+ Updated Clean to delete the obj directories
[ December 25, 2004 - 0.13 ]
+ Added dnpb.exe so that it can be used to generate the project files
+ Added dnpb.ico
* Added parameterless Write statement to Log for writing a single line
* Changed scehema to version 1.3 for support of icon attribute
* Added support for All configuration name under a Project node signifying common settings for all configurations
! Fixed the SupressWarnings by adding the corresponding field to OptionsNode
* Wrote documentation in docs/readme.txt
* Added Dan Moorehead to copyrights and extended date from 2004 to 2004-2005
* Updated prebuild.xml
* Optimized Log class
* Updated OutputUsage()
* /clean targets all by default
* No log file is used by default, /log without value specified uses default file name
+ Added support for the /pause which pauses the utility after execution to observe output
[ September 27, 2004 - 0.12.2a ]
! Fixed a nasty bug when trying to delete our temp file for pre-processing.
[ September 15, 2004 - 0.12.2 ]
+ Expanded platform identification, thanks to the NAnt guys for shedding some
light on how to properly check for UNIX platforms! Thanks guys!
* POSIX OS identifier changed to UNIX. Valid OS names are now "Win32", "UNIX",
and "Unknown".
! Fixed SharpDevelop target to properly use the 'rootNamespace' attribute of
the Project tag.
+ New command-line switch, /ppo, forces DNPB to pre-process the file and write
the pre-processed file. This allows you to test/debug your pre-processor
macros. No other processing will be done. You can specify a target file as
a paramter for the /ppo switch, or DNPB will write the file 'preprocessed.xml'
if you do not specify a file.
+ The Match tag now has a 'buildAction' attribute which functions exactly like
the attribute of the same name for the File tag.
[ August 5, 2004 - 0.12.1 ]
+ Added environment variable expansion for all values. Environment variables
should be listed in the form ${VAR}.
[ July 30, 2004 - 0.12.0 ]
+ Added preprocessing via XML processing information tags. Available tags
are: <?if <exp> ?>, <?elseif <exp> ?>, <?else ?> and <?endif ?>. The
current expression parser is very basic, but will be replaced with a more
capable parser over time. Current operators available are: =, !=, <, >,
<=, >=. Current test variables available: OS, RuntimeVersion, RuntimeMajor,
RuntimeMinor, RuntimeRevision.
[ July 27, 2004 - 0.11.4 ]
+ Added 'useRegex' attribute to the Match tag. Matches can now use regular
expressions to match filenames.
+ Added the 'assemblyName' attribute to the Project tag. Projects can now
set their output assembly name.
! Fixed several bugs in the way that Project tags inheirt their parent
Solutions configuration options. This operation should now work fully as
intended.
! Due to some wierdness, Project Guid's are now stored as part of the Project
node and created at parse time.
[ May 11, 2004 - 0.11.3 ]
! Fixed a bug where I was writing the wrong property name for a projects root
namespace.
! Removed a DEBUG statement I had left in the code in 0.11.2.
! Fixed a bug in the VS2002 writer which caused the version variables to not
be overriden correctly.
+ Added the rootNamespace property to the <Project> element, allowing you to
specify the root namespace.
* /target and /clean are now mutually exclusive command line switches, and
they both now take the all option. In the case of /target all, all build
file for all targets will be created. In the case of /clean all, the user
will be prompted to make sure they want to do it, and if so, will clean
all build files for all targets.
[ April 22, 2004 - 0.11.2 ]
! Fixed a bug with the /file command-line operator. Was using the unresolved
file path rather then the resolved one, was making the attempt to open the
dnpb file fail.
! Fixed a bug in the schema that required at least 1 solution and 1 reference
path. We can do just fine with 0 of either of these. Some files may be all
<Process> statements and not have any <Solution> tags.
! Fixed a bug that caused the project references not to be written with the
SharpDevelop target.
* Changed the schema to version 1.2, allowing for Configuration nodes to exist
under project nodes. The inheritance of values is hierarchical. Meaning, if
you define a configuration named Debug at the Soltion level, and one by the
same name at the Project level, the one at the Project level will first
inherit the options of the Solution level configuration, then set it's own
options. If you define a configuration at the Project level and it does not
exist at the Solution level, it will be created at the Solution level.
* Project references should now work correctly across the board. Note that due
to a restriction in Visual Studio, you can only reference projects in the same
solution.
[ April 21, 2004 - 0.11.1 ]
! Fixed a problem with resolving paths in various targets. Was not properly
setting the CWD.
* Schema updated to 1.1, moving the ReferencePath element from the Options
element to the Project element. This makes more logical sense, given that
reference paths are resolved relative to the project path. Any prebuild.xml
file referecning verison 1.0 will fail! Please update to the 1.1 schema.
[ April 19, 2004 - 0.11.0 ]
* Added several attributes across the code to make FxCop happy
! Fixed bugs in reference paths being written in the VS targets.
! Fixed a bug in ProjectNode which was doing two CWDStack.Push() calls instead of
a Push/Pop pair. Was wreaking havoc with <Process> tags.
! Fixed some bugs in the path tracking, both the Project and Solution nodes now
have a FullPath property, which is the full path to the file resolved at load
time. This should fix all path relativity problems.
+ Added new /clean switch, allowing the target to clean up any files it generated.
in accordance, the ITarget interface has been updated to support a new Clean()
method.
+ Completed addition of the <Process> tag, to allow the referencing of external
prebuild.xml files.
+ Added the runtime attribute to the Project element. This allows the developer
to specify which runtime a project should target (Mono or Microsoft). This is
of course ignored in certain targets like the Visual Studio targets.
+ Added the SharpDevelop target.
[ April 13, 2004 - 0.10.1a ]
+ Added the buildAction attribute to the File node. This is needed for dnpb
to even be able to bootstrap itself (dnpb-1.0.xsd must be an embedded resource)
[ April 13, 2004 - 0.10.1 ]
* First Release
[ Key ]
* = Change or information
+ = Addition
! = Bug Fix

View File

@ -1,274 +0,0 @@
Prebuild Instructions
Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, SharpDevelop2, MonoDevelop, and NAnt.
_______________________________________________________________________________
Overview
Prebuild can be either be run from the command line to generate the
project and make files or you can execute the included batch (*.bat)
and Unix Shell script (*.sh) files.
_______________________________________________________________________________
The currently supported developement tools and their associated batch
and shell script files.
Visual Studio .NET 2005 (VS2005.bat)
Visual Studio .NET 2003 (VS2003.bat)
Visual Studio .NET 2002 (VS2002.bat)
SharpDevelop (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/
SharpDevelop2 (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/
MonoDevelop (MonoDevelop.sh) - http://www.monodevelop.com/
NAnt (nant.sh and nant.bat) - http://nant.sourceforge.net/
Autotools (autotools.bat and autotools.sh) - http://en.wikipedia.org/wiki/GNU_build_system
Notes:
A Unix Shell script is provided for MonoDevelop, as it does not run on
Windows at this time.
Visual Studio .NET 2005 and the Visual Express IDE's can import
solutions from older versions of Visual Studio .NET.
Makefiles are not currently supported.
_______________________________________________________________________________
Command Line Syntax:
Example:
> Prebuild /target vs2003
This will generate the project files for Visual Studio.NET 2003 and
place the redirect the log to a file named PrebuildLog.txt in the
parent directory
The syntax structure is as below, where commandParameter is optional
depending on the command and you can provide several option-value
pairs.
Note: The '> ' signifies the command prompt, do not enter this literally
> Prebuild /<option> <commandParameter>
> Prebuild /target vs2003 /pause
> Prebuild /target vs2003 /log ../Log.txt /pause /ppo /file ProjectConfig.xml
> Prebuild /target sharpdev /log
> Prebuild /removedir obj|bin
> Prebuild /target vs2003 /allowedgroups Group1|Group2
> Prebuild /clean
> Prebuild /clean /yes
> Prebuild /clean vs2003
_______________________________________________________________________________
Command Line Options:
/usage - Shows the help information on how to use Prebuild and what
the different options are and what they do
/clean - The project files generated for the target type specified as
a parameter for this option will be deleted. If no value is specified
or if 'all' is specified, then project files for all the target types
will be deleted.
/target - Specified the name of the development tool for which project
or make files will be generated. Possible parameter values include:
vs2003, vs2002, sharpdev
/file - Specifies the name of the XML which defines what files are to
be referenced by the generated project files as well as configures the
options for them. If not specified, prebuild.xml in the current
directory will be used as the default.
/log - Specified the log file that should be written to for build
errors. If this option is not specified, no log file is generated,
but if just no value is specified, then the defaul filename will be
used for the log (Prebuild.log).
/ppo - Preprocesses the xml file to test for syntax errors or problems
but doesn't generate the files
/pause - Shows the console until you press a key so that you can view
the messages written while performing the specified actions.
This allows you to check if an errors occurred and - if so - what it
was.
/showtargets - Shows a list of all the targets that can be specified
as values for the /clean and /target commands.
/allowedgroups - This is followed by a pipe-delimited list of project
group filter flags (eg. Group1|Group2) allow optional filtering of all
projects that dont have at least one of these flags
/removedir - This is followed by a pipe-delimited list of directory
names that will be deleted while recursivly searching the directory of
the prebuild application and its child directories (eg. use obj|bin to
delete all output and temporary directories before file releases)
/yes - Answer yes to any warnings (e.g. when cleaning all projects).
_______________________________________________________________________________
Example Batch Files and Shell Scripts
NOTE: Common batch and shell script files are included with Prebuild source and file releases.
______________________________
MonoDevelop
#!/bin/sh
# Generates a solution (.mds) and a set of project files (.mdp)
# for MonoDevelop, a Mono port of SharpDevelop
# (http://icsharpcode.net/OpenSource/SD/Default.aspx)
./Prebuild /target monodev /pause
______________________________
Visual Studio .NET 2003
@rem Generates a solution (.sln) and a set of project files (.csproj)
@rem for Microsoft Visual Studio .NET 2002
Prebuild /target vs2003 /pause
Notes:
Text after lines that start with @rem are comments and are not evaluated
You can also place pause on the last line instead of specifing the /pause command.
_______________________________________________________________________________
Example XML Configuration File
Note:
XML Comments (<!-- Comment -->) are used to markup the prebuild.xml
file with notes
The below file may be out-of-date, however the RealmForge Prebuild
file serves as an up-to-date and extensive example.
It can be viewed using Tigris.org's WebSVN
(http://realmforge.tigris.org/source/browse/realmforge/trunk/src/prebuild.xml)
by just clicking on the "view file" link for the latest revision.
_________________________________
<?xml version="1.0" encoding="utf-8"?>
<!--The version of the XML schema specified in the version and xmlns attributes should match the one for which the version of Prebuild.exe used was compiled for. In this example it is the version 1.3 schema, you can find the XSD schema file at the url specified in the xmlns attribute. -->
<Prebuild version="1.6" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.6.xsd">
<Solution name="RealmForge"> <!--The title and file name for the solution, combine, workspace, or project group (depending on what development tool you are using)-->
<!--Configurations found as children of Solution are used as templates for the configurations found in the project, this allows you to avoid writing the same options in each project (and maintaining each of these). You can provide defaults and then override them in the configurations defined for each project. All options are optional.-->
<Configuration name="Debug">
<Options>
<!-- simple logically expressions can be evaluated, if, else, elseif, and endif are valid statements. Note that it is not neccisary to define POSIX or WIN32 -->
<?if OS = "Win32" ?>
<CompilerDefines>DEBUG;TRACE;WIN32</CompilerDefines>
<?else ?>
<CompilerDefines>DEBUG;TRACE;POSIX</CompilerDefines>
<?endif ?>
<OptimizeCode>false</OptimizeCode>
<CheckUnderflowOverflow>false</CheckUnderflowOverflow>
<AllowUnsafe>false</AllowUnsafe>
<WarningLevel>4</WarningLevel>
<!-The filter for the number of warnings or errors shown and the tolerance level as to what is an error. This is value from 0 to 4 where 4 is the most strict (least tolerent).-->
<WarningsAsErrors>false</WarningsAsErrors>
<SuppressWarnings>1591;219;1573;1572;168</SuppressWarnings>
<!-- A semicolon ';' delimited list of the warnings that are filtered and not shown in the output window during compiling a project. Only include the number portion of the warning codes that are shown in output during compilation (eg CS1591, should be entered as 1591)-->
<OutputPath>..\bin</OutputPath>
<DebugInformation>true</DebugInformation>
<RegisterComInterop>false</RegisterComInterop>
<IncrementalBuild>true</IncrementalBuild>
<BaseAddress>285212672</BaseAddress>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<XmlDocFile>Docs.xml</XmlDocFile>
</Options>
</Configuration>
<Configuration name="Release"> <!-- You can define multple configurations that projects can have, but there is no way to define which one is selected by default as this is a part of the user preferences for a project, not the solution or project files -->
<Options>
<CompilerDefines>TRACE</CompilerDefines>
<OptimizeCode>true</OptimizeCode>
<CheckUnderflowOverflow>false</CheckUnderflowOverflow>
<AllowUnsafe>false</AllowUnsafe>
<WarningLevel>4</WarningLevel>
<WarningsAsErrors>false</WarningsAsErrors>
<SuppressWarnings>1591;219;1573;1572;168</SuppressWarnings>
<OutputPath>..\bin</OutputPath>
<DebugInformation>false</DebugInformation>
<RegisterComInterop>false</RegisterComInterop>
<IncrementalBuild>true</IncrementalBuild>
<BaseAddress>285212672</BaseAddress>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<GenerateXmlDocFile>true</GenerateXmlDocFile>
<XmlDocFile>Docs.xml</XmlDocFile>
</Options>
</Configuration>
<!-- One of the projects that is included in the Solution -->
<Project name="RealmForge.Utility" Language="VisualBasic" path="Utility" type="Library" assemblyName="RealmForge.Utility" rootNamespace="RealmForge">
<Configuration name="Debug">
<Options>
<OutputPath>..\bin\lib\Utility</OutputPath>
<XmlDocFile>RealmForge.Utility.xml</XmlDocFile>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>..\bin\lib\Utility</OutputPath>
<XmlDocFile>RealmForge.Utility.xml</XmlDocFile>
</Options>
</Configuration>
<ReferencePath>../bin</ReferencePath>
<Reference name="System"/>
<Reference name="System.Data"/>
<Reference name="System.Drawing"/>
<Reference name="System.Xml"/>
<Reference name="System.Runtime.Serialization.Formatters.Soap"/>
<Reference name="ICSharpCode.SharpZipLib"/>
<Files>
<Match path="." pattern="*.vb" recurse="true"/>
</Files>
</Project>
<!-- Another projects that is included in the Solution -->
<Project name="DemoGame" Language="C#" path="DemoGame" type="WinExe" icon="..\bin\RealmForge.ico" assemblyName="DemoGame" rootNamespace="RealmForge">
<!-- icon is used to define the location of the .ico file that is embeeded in the assembly when the project is compiled. This is relative to the project path -->
<!--type defines the type of project, valid types are Library (.dll), WinExe (.exe), and Exe (.exe). WinExe is not windows specific, it just defines that it is a GUI application and that no Console or Command window will show when it is started-->
<Configuration name="Debug">
<Options>
<OutputPath>..\bin</OutputPath>
<XmlDocFile>DemoGame.xml</XmlDocFile>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>..\bin</OutputPath>
<XmlDocFile>DemoGame.xml</XmlDocFile>
</Options>
</Configuration>
<ReferencePath>../bin</ReferencePath>
<Reference name="System"/> <!-- Assemblies that are located in the GAC (installed, global) can be referenced-->
<Reference name="ode"/> <!-- Assemblies that are located in the output directory to which the file is built can be referenced -->
<Reference name="RealmForge.Utility"/> <!-- When you reference the name of another project, then that project (and it's output) will be referenced instead of looking for a pre-built assembly-->
<Files>
<Match path="." pattern="*.cs" recurse="true"/>
<Match path="." pattern="*.bmp" recurse="true" buildAction="EmbeddedResource"/>
<Match path="." pattern="[^a]*\.(png|jpg)" useRegex="true" buildAction="EmbeddedResource"/>
<!-- Uses a regex or regular expression to find all files that end with .png or .jpg but dont have the letter 'a' in their name and add them to the project as EmbeddedResource's. Because recurse enabled (default is false), only the values in the files in that are directly in the project directory (not child directories) are checked.-->
<!--EmbeddedResource, Content, and Compile are valid buildAction's-->
</Files>
</Project>
</Solution>
</Prebuild>

View File

@ -1,18 +0,0 @@
Gryc Ueusp <gryc.ueusp@gmail.com>
caught a problem with the NAnt target's .build output which caused
the Ubuntu build servers to choke on prebuild-generated packages
Todd Berman <tberman@sevenl.net>
Lluis Sanchez Gual <lluis@novell.com>
pkg-config .pc file parser used in AutotoolsTarget.cs was ripped off
from work contributed to MonoDevelop by Lluis and Todd. It came
from
src/core/MonoDevelop.Core/MonoDevelop.Core/SystemPackage.cs (Lluis)
and
src/core/MonoDevelop.Core/MonoDevelop.Core/SystemAssemblyService.cs
(Lluis && Todd)

View File

@ -1,43 +0,0 @@
* monodev target should be able to detect whether the project is 1.x
or 2.x runtime
* remove target which links ../project/foo.dll to each project's build
root
* generate .config files
* Fix the autotools target so that
sub generate_project_files { ... }
sub generate_solution_files { ... }
sub generate_multi_solution_files { ... }
sub generate_project {
...
generate_project_files();
}
sub generate_solution {
foreach $project ( @projects ){
mkdir "$project/";
pushd "$project/";
generate_project();
popd;
}
generate_solution_files();
}
sub generate_multi_solution {
foreach $solution ( @solutions ){
mkdir "$solution/";
pushd "$solution/";
generate_solution();
popd;
}
generate_multi_solution_files();
}
if(numProjects == 1){
generate_project();
}elsif(numSolutions == 1){
generate_solution();
}else{
generate_multi_solution();
}

View File

@ -1,2 +0,0 @@
#!/bin/sh
exec mono [PREFIX]/prebuild.exe "$@"

BIN
bin/CSJ2K.dll Normal file

Binary file not shown.

View File

@ -1356,11 +1356,6 @@
;PacketMTU = 1400 ;PacketMTU = 1400
; TextureUpdateRate (mS) determines how many times per second
; texture send processing will occur. The default is 100mS.
;
;TextureRequestRate = 100
; TextureSendLimit determines how many different textures ; TextureSendLimit determines how many different textures
; will be considered on each cycle. Textures are selected ; will be considered on each cycle. Textures are selected
; by priority. The old mechanism specified a value of 10 for ; by priority. The old mechanism specified a value of 10 for
@ -1373,14 +1368,6 @@
; ;
;TextureDataLimit = 5 ;TextureDataLimit = 5
;; The JPEG2000 decode cache
;; Timeout is in minutes
[J2KDecoder]
;CacheDir = "./j2kDecodeCache"
; Time in minutes before cached decodes expire. Set to 0 for no expiration. Default is 720 minutes.
;CacheTimeout = 720
;; ;;
;; These are defaults that are overwritten below in [Architecture]. ;; These are defaults that are overwritten below in [Architecture].
;; These defaults allow OpenSim to work out of the box with ;; These defaults allow OpenSim to work out of the box with

View File

@ -401,4 +401,11 @@
<Key Name="assetType" Value="0" /> <Key Name="assetType" Value="0" />
<Key Name="fileName" Value="default_clear.jp2" /> <Key Name="fileName" Value="default_clear.jp2" />
</Section> </Section>
<Section Name="Default Avatar">
<Key Name="assetID" Value="c228d1cf-4b5d-4ba8-84f4-899a0796aa97"/>
<Key Name="name" Value="Default Avatar"/>
<Key Name="assetType" Value="0" />
<Key Name="fileName" Value="default_avatar.jp2" />
</Section>
</Nini> </Nini>

Binary file not shown.

View File

@ -1541,6 +1541,7 @@
<Reference name="OpenMetaverseTypes.dll"/> <Reference name="OpenMetaverseTypes.dll"/>
<Reference name="OpenMetaverse.StructuredData.dll"/> <Reference name="OpenMetaverse.StructuredData.dll"/>
<Reference name="OpenMetaverse.dll"/> <Reference name="OpenMetaverse.dll"/>
<Reference name="CSJ2K.dll"/>
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Capabilities"/> <Reference name="OpenSim.Framework.Capabilities"/>
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
@ -3534,35 +3535,6 @@
</Files> </Files>
</Project> </Project>
<Project frameworkVersion="v3_5" name="OpenSim.Framework.Servers.HttpServer.Tests" path="OpenSim/Framework/Servers/HttpServer/Tests" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Tests.Common"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="log4net.dll"/>
<Reference name="HttpServer_OpenSim.dll"/>
<Reference name="nunit.framework.dll" />
<Files>
<Match pattern="*.cs" recurse="true">
</Match>
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Framework.Communications.Tests" path="OpenSim/Framework/Communications/Tests" type="Library"> <Project frameworkVersion="v3_5" name="OpenSim.Framework.Communications.Tests" path="OpenSim/Framework/Communications/Tests" type="Library">
<Configuration name="Debug"> <Configuration name="Debug">
<Options> <Options>
@ -3829,40 +3801,6 @@
</Files> </Files>
</Project> </Project>
<Project frameworkVersion="v3_5" name="OpenSim.Server.Handlers.Tests" path="OpenSim/Server/Handlers/Tests" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Xml"/>
<Reference name="OpenMetaverseTypes.dll"/>
<Reference name="OpenMetaverse.dll"/>
<Reference name="nunit.framework.dll" />
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Server.Handlers"/>
<Reference name="OpenSim.Server.Base"/>
<Reference name="OpenSim.Services.Base" />
<Reference name="OpenSim.Services.Interfaces"/>
<Reference name="OpenSim.Tests.Common"/>
<Reference name="Nini.dll" />
<Reference name="log4net.dll"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<?include file="addon-modules/*/prebuild.xml" ?> <?include file="addon-modules/*/prebuild.xml" ?>
</Solution> </Solution>