From 95f0d582a51ed91c24e03ea2c16d87ac3f416a22 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 20 Jul 2014 00:17:35 +0200 Subject: [PATCH 1/9] Fix coalesced objects not showing up as "piles" of prims (AVN only bug) --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7c62f9017b..5ee159600a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1737,7 +1737,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP newBlock.CreationDate = item.CreationDate; newBlock.SalePrice = item.SalePrice; newBlock.SaleType = item.SaleType; - newBlock.Flags = item.Flags & 0xff; + newBlock.Flags = item.Flags & 0x2000ff; newBlock.CRC = Helpers.InventoryCRC(newBlock.CreationDate, newBlock.SaleType, @@ -1991,7 +1991,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP itemBlock.GroupID = item.GroupID; itemBlock.GroupOwned = item.GroupOwned; itemBlock.GroupMask = item.GroupPermissions; - itemBlock.Flags = item.Flags & 0xff; + itemBlock.Flags = item.Flags & 0x2000ff; itemBlock.SalePrice = item.SalePrice; itemBlock.SaleType = item.SaleType; itemBlock.CreationDate = item.CreationDate; @@ -2058,7 +2058,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP bulkUpdate.ItemData[0].GroupID = item.GroupID; bulkUpdate.ItemData[0].GroupOwned = item.GroupOwned; bulkUpdate.ItemData[0].GroupMask = item.GroupPermissions; - bulkUpdate.ItemData[0].Flags = item.Flags & 0xff; + bulkUpdate.ItemData[0].Flags = item.Flags & 0x2000ff; bulkUpdate.ItemData[0].SalePrice = item.SalePrice; bulkUpdate.ItemData[0].SaleType = item.SaleType; @@ -2112,7 +2112,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP InventoryReply.InventoryData[0].GroupID = Item.GroupID; InventoryReply.InventoryData[0].GroupOwned = Item.GroupOwned; InventoryReply.InventoryData[0].GroupMask = Item.GroupPermissions; - InventoryReply.InventoryData[0].Flags = Item.Flags & 0xff; + InventoryReply.InventoryData[0].Flags = Item.Flags & 0x2000ff; InventoryReply.InventoryData[0].SalePrice = Item.SalePrice; InventoryReply.InventoryData[0].SaleType = Item.SaleType; InventoryReply.InventoryData[0].CreationDate = Item.CreationDate; From c6cdd597f3ac0165d73a152b23a3abbbceb9a96e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 8 Aug 2014 01:32:16 +0100 Subject: [PATCH 2/9] add wearables array size checks on unpack --- OpenSim/Framework/AvatarAppearance.cs | 14 ++++++++++++-- OpenSim/Framework/ChildAgentDataUpdate.cs | 7 ++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index a34c85f531..55e4b40bce 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -458,7 +458,12 @@ namespace OpenSim.Framework // m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); // DEBUG OFF m_wearables[wearableId].Clear(); - for (int i = 0; i < wearable.Count; i++) + + int count = wearable.Count; + if (count > AvatarWearable.MAX_WEARABLES) + count = AvatarWearable.MAX_WEARABLES; + + for (int i = 0; i < count; i++) m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); } @@ -751,7 +756,12 @@ namespace OpenSim.Framework if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) { OSDArray wears = (OSDArray)(data["wearables"]); - for (int i = 0; i < wears.Count; i++) + + int count = wears.Count; + if (count > AvatarWearable.MAX_WEARABLES) + count = AvatarWearable.MAX_WEARABLES; + + for (int i = 0; i < count; i++) m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); } else diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 8c32734980..967278e543 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -657,7 +657,12 @@ namespace OpenSim.Framework if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) { OSDArray wears = (OSDArray)(args["wearables"]); - for (int i = 0; i < wears.Count / 2; i++) + + int count = wears.Count; + if (count > AvatarWearable.MAX_WEARABLES) + count = AvatarWearable.MAX_WEARABLES; + + for (int i = 0; i < count / 2; i++) { AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); Appearance.SetWearable(i,awear); From 4707c488282732b56bc7121544960d3bcb877e20 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 10 Aug 2014 22:00:01 +0200 Subject: [PATCH 3/9] LSL llListFindList fix: check types as well as content. Items must be same type to be found. --- .../Shared/Api/Implementation/LSL_Api.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c65f9334e6..b5691943d6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6001,17 +6001,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { for (int i = 0; i < length; i++) { + int needle = llGetListEntryType(test, 0).value; + int haystack = llGetListEntryType(src, i).value; + // Why this piece of insanity? This is because most script constants are C# value types (e.g. int) // rather than wrapped LSL types. Such a script constant does not have int.Equal(LSL_Integer) code // and so the comparison fails even if the LSL_Integer conceptually has the same value. // Therefore, here we test Equals on both the source and destination objects. // However, a future better approach may be use LSL struct script constants (e.g. LSL_Integer(1)). - if (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i])) + if ((needle == haystack) && (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i]))) { int j; for (j = 1; j < test.Length; j++) - if (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j]))) + { + needle = llGetListEntryType(test, j).value; + haystack = llGetListEntryType(src, i+j).value; + + if ((needle != haystack) || (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j])))) break; + } if (j == test.Length) { From 0e809ab2658d9aff51d7a12754630ccfec977b79 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 10 Aug 2014 22:00:01 +0200 Subject: [PATCH 4/9] LSL llListFindList fix: check types as well as content. Items must be same type to be found. --- .../Shared/Api/Implementation/LSL_Api.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 3f0af6dcd6..e72b3dde3b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5950,17 +5950,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { for (int i = 0; i < length; i++) { + int needle = llGetListEntryType(test, 0).value; + int haystack = llGetListEntryType(src, i).value; + // Why this piece of insanity? This is because most script constants are C# value types (e.g. int) // rather than wrapped LSL types. Such a script constant does not have int.Equal(LSL_Integer) code // and so the comparison fails even if the LSL_Integer conceptually has the same value. // Therefore, here we test Equals on both the source and destination objects. // However, a future better approach may be use LSL struct script constants (e.g. LSL_Integer(1)). - if (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i])) + if ((needle == haystack) && (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i]))) { int j; for (j = 1; j < test.Length; j++) - if (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j]))) + { + needle = llGetListEntryType(test, j).value; + haystack = llGetListEntryType(src, i+j).value; + + if ((needle != haystack) || (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j])))) break; + } if (j == test.Length) { From 01e381fa33a7bd8ca9141a73f8dca0ff7832aaca Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 11 Aug 2014 02:07:23 +0200 Subject: [PATCH 5/9] Make texture anims work right on singu --- .../Framework/Scenes/SceneObjectPart.cs | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 055473db0f..a292c79fc9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1878,22 +1878,29 @@ namespace OpenSim.Region.Framework.Scenes public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim) { - byte[] data = new byte[16]; - int pos = 0; + if (((int)pTexAnim.Flags & 1) == 0) // ANIM_ON + { + byte[] data = new byte[16]; + int pos = 0; - // The flags don't like conversion from uint to byte, so we have to do - // it the crappy way. See the above function :( + // The flags don't like conversion from uint to byte, so we have to do + // it the crappy way. See the above function :( - data[pos] = ConvertScriptUintToByte((uint)pTexAnim.Flags); pos++; - data[pos] = (byte)pTexAnim.Face; pos++; - data[pos] = (byte)pTexAnim.SizeX; pos++; - data[pos] = (byte)pTexAnim.SizeY; pos++; + data[pos] = ConvertScriptUintToByte((uint)pTexAnim.Flags); pos++; + data[pos] = (byte)pTexAnim.Face; pos++; + data[pos] = (byte)pTexAnim.SizeX; pos++; + data[pos] = (byte)pTexAnim.SizeY; pos++; - Utils.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); - Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4); - Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); + Utils.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); + Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4); + Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); - m_TextureAnimation = data; + m_TextureAnimation = data; + } + else + { + m_TextureAnimation = Utils.EmptyBytes; + } } public void AdjustSoundGain(double volume) From 036017bba7195d052efa9eb4d289c87cd38515e0 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 11 Aug 2014 02:07:23 +0200 Subject: [PATCH 6/9] Make texture anims work right on singu --- .../Framework/Scenes/SceneObjectPart.cs | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 261e9584e9..a3c60ea903 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1880,22 +1880,29 @@ namespace OpenSim.Region.Framework.Scenes public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim) { - byte[] data = new byte[16]; - int pos = 0; + if (((int)pTexAnim.Flags & 1) == 0) // ANIM_ON + { + byte[] data = new byte[16]; + int pos = 0; - // The flags don't like conversion from uint to byte, so we have to do - // it the crappy way. See the above function :( + // The flags don't like conversion from uint to byte, so we have to do + // it the crappy way. See the above function :( - data[pos] = ConvertScriptUintToByte((uint)pTexAnim.Flags); pos++; - data[pos] = (byte)pTexAnim.Face; pos++; - data[pos] = (byte)pTexAnim.SizeX; pos++; - data[pos] = (byte)pTexAnim.SizeY; pos++; + data[pos] = ConvertScriptUintToByte((uint)pTexAnim.Flags); pos++; + data[pos] = (byte)pTexAnim.Face; pos++; + data[pos] = (byte)pTexAnim.SizeX; pos++; + data[pos] = (byte)pTexAnim.SizeY; pos++; - Utils.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); - Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4); - Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); + Utils.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); + Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4); + Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); - m_TextureAnimation = data; + m_TextureAnimation = data; + } + else + { + m_TextureAnimation = Utils.EmptyBytes; + } } public void AdjustSoundGain(double volume) From 519df0d2a3e63190a56062859f79e5fabab23e26 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 11 Aug 2014 02:30:09 +0200 Subject: [PATCH 7/9] Fix a condition check --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a292c79fc9..98ea880355 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1878,7 +1878,7 @@ namespace OpenSim.Region.Framework.Scenes public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim) { - if (((int)pTexAnim.Flags & 1) == 0) // ANIM_ON + if (((int)pTexAnim.Flags & 1) != 0) // ANIM_ON { byte[] data = new byte[16]; int pos = 0; From 0eaabef1dc8ac18319fa77c699e50226df5ca2bd Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 11 Aug 2014 02:30:09 +0200 Subject: [PATCH 8/9] Fix a condition check --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a3c60ea903..566605a6d2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1880,7 +1880,7 @@ namespace OpenSim.Region.Framework.Scenes public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim) { - if (((int)pTexAnim.Flags & 1) == 0) // ANIM_ON + if (((int)pTexAnim.Flags & 1) != 0) // ANIM_ON { byte[] data = new byte[16]; int pos = 0; From ecae45a21e4dff4986ff90f10a6eae54f95b391c Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 13 Aug 2014 03:05:25 +0200 Subject: [PATCH 9/9] Revert "make HandlerRegionHandshakeReply processing async and delay it a bit. This" This reverts commit 30f00bfb14cce582382bd37b1e22062af664ec64. Conflicts: OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8a28fafe60..aa742eff2b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4884,7 +4884,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { // m_log.DebugFormat("[LLCLIENTVIEW]: Sending land properties for {0} to {1}", lo.LandData.GlobalID, Name); - + LandData landData = lo.LandData; ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); @@ -5522,10 +5522,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.RezObject, HandlerRezObject); AddLocalPacketHandler(PacketType.DeRezObject, HandlerDeRezObject); AddLocalPacketHandler(PacketType.ModifyLand, HandlerModifyLand); - -// AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, false); - AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, true); - + AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, false); AddLocalPacketHandler(PacketType.AgentWearablesRequest, HandlerAgentWearablesRequest); AddLocalPacketHandler(PacketType.AgentSetAppearance, HandlerAgentSetAppearance); AddLocalPacketHandler(PacketType.AgentIsNowWearing, HandlerAgentIsNowWearing); @@ -6481,7 +6478,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP Action handlerRegionHandShakeReply = OnRegionHandShakeReply; if (handlerRegionHandShakeReply != null) { - Thread.Sleep(100); handlerRegionHandShakeReply(this); }