mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 08:55:56 +08:00
a few changes on udp zero encoder and part text color
This commit is contained in:
@@ -52,7 +52,6 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
using PermissionMask = OpenSim.Framework.PermissionMask;
|
||||
using RegionFlags = OpenMetaverse.RegionFlags;
|
||||
using System.Linq;
|
||||
using System.Drawing;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
@@ -7545,11 +7544,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
zc.AddShortLimitedUTF8(osUTF8PartText);
|
||||
|
||||
//textcolor
|
||||
Color c = part.Color;
|
||||
zc.AddByte(c.R);
|
||||
zc.AddByte(c.G);
|
||||
zc.AddByte(c.B);
|
||||
zc.AddByte((byte)(0xff - c.A));
|
||||
zc.AddColorArgb(part.TextColorArgb());
|
||||
}
|
||||
|
||||
//media url
|
||||
@@ -8105,11 +8100,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
if (osUTF8PartText[^1] != 0)
|
||||
zc.AddZeros(1);
|
||||
|
||||
Color c = part.Color;
|
||||
zc.AddByte(c.R);
|
||||
zc.AddByte(c.G);
|
||||
zc.AddByte(c.B);
|
||||
zc.AddByte((byte)(0xff - c.A));
|
||||
zc.AddColorArgb(part.TextColorArgb());
|
||||
}
|
||||
if (hasmediaurl)
|
||||
{
|
||||
|
||||
@@ -144,30 +144,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
UpdateImageInQueue(imgrequest);
|
||||
|
||||
imgrequest.RunUpdate();
|
||||
|
||||
// J2KImage imgrequest2 = new J2KImage(this);
|
||||
// imgrequest2.J2KDecoder = m_j2kDecodeModule;
|
||||
// imgrequest2.AssetService = m_assetCache;
|
||||
// imgrequest2.AgentID = m_client.AgentId;
|
||||
// imgrequest2.InventoryAccessModule = m_client.Scene.RequestModuleInterface<IInventoryAccessModule>();
|
||||
// imgrequest2.DiscardLevel = newRequest.DiscardLevel;
|
||||
// imgrequest2.StartPacket = Math.Max(1, newRequest.PacketNumber);
|
||||
// imgrequest2.Priority = newRequest.Priority;
|
||||
// imgrequest2.TextureID = newRequest.RequestedAssetID;
|
||||
// imgrequest2.Priority = newRequest.Priority;
|
||||
//
|
||||
// //Add this download to the priority queue
|
||||
// AddImageToQueue(imgrequest2);
|
||||
//
|
||||
// imgrequest2.RunUpdate();
|
||||
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// m_log.DebugFormat(
|
||||
// "[LL IMAGE MANAGER]: Ignoring duplicate of existing request for {0} (sequence {1}) from {2} as its request sequence {3} is not greater",
|
||||
// newRequest.RequestedAssetID, imgrequest.LastSequence, m_client.Name, newRequest.requestSequence);
|
||||
// }
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -29,6 +29,7 @@ using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using OpenSim.Framework;
|
||||
using OpenMetaverse;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
@@ -88,10 +89,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
public unsafe void AddZeros(int len)
|
||||
{
|
||||
zerocount += len;
|
||||
ref byte dst = ref MemoryMarshal.GetArrayDataReference(m_dest);
|
||||
while (zerocount > 0xff)
|
||||
{
|
||||
m_dest[pos++] = 0x00;
|
||||
m_dest[pos++] = 0xff;
|
||||
Unsafe.Add(ref dst, pos) = 0x00;
|
||||
pos++;
|
||||
Unsafe.Add(ref dst, pos) = 0xff;
|
||||
pos++;
|
||||
zerocount -= 256;
|
||||
}
|
||||
}
|
||||
@@ -101,24 +105,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
if (zerocount > 0)
|
||||
{
|
||||
m_dest[pos++] = 0x00;
|
||||
m_dest[pos++] = (byte)zerocount;
|
||||
ref byte dst = ref MemoryMarshal.GetArrayDataReference(m_dest);
|
||||
Unsafe.Add(ref dst, pos) = 0x00;
|
||||
pos++;
|
||||
Unsafe.Add(ref dst, pos) = (byte)zerocount;
|
||||
pos++;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
public unsafe void AddBytes(byte[] src, int srclen)
|
||||
{
|
||||
ref byte dst = ref MemoryMarshal.GetArrayDataReference(m_dest);
|
||||
for (int i = 0; i < srclen; ++i)
|
||||
{
|
||||
if (src[i] == 0x00)
|
||||
byte b = src[i];
|
||||
if (b == 0x00)
|
||||
{
|
||||
if (zerocount != 0xff)
|
||||
zerocount++;
|
||||
else
|
||||
{
|
||||
m_dest[pos++] = 0x00;
|
||||
m_dest[pos++] = 0xff;
|
||||
Unsafe.Add(ref dst, pos) = 0x00;
|
||||
pos++;
|
||||
Unsafe.Add(ref dst, pos) = 0xff;
|
||||
pos++;
|
||||
zerocount = 1;
|
||||
}
|
||||
}
|
||||
@@ -126,18 +137,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
if (zerocount != 0)
|
||||
{
|
||||
m_dest[pos++] = 0x00;
|
||||
m_dest[pos++] = (byte)zerocount;
|
||||
Unsafe.Add(ref dst, pos) = 0x00;
|
||||
pos++;
|
||||
Unsafe.Add(ref dst, pos) = (byte)zerocount;
|
||||
pos++;
|
||||
zerocount = 0;
|
||||
}
|
||||
|
||||
m_dest[pos++] = src[i];
|
||||
Unsafe.Add(ref dst, pos) = b;
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void AddBytes(byte* src, int srclen)
|
||||
{
|
||||
ref byte dst = ref MemoryMarshal.GetArrayDataReference(m_dest);
|
||||
for (int i = 0; i < srclen; ++i)
|
||||
{
|
||||
if (src[i] == 0x00)
|
||||
@@ -146,8 +160,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
zerocount++;
|
||||
else
|
||||
{
|
||||
m_dest[pos++] = 0x00;
|
||||
m_dest[pos++] = 0xff;
|
||||
Unsafe.Add(ref dst, pos) = 0x00;
|
||||
pos++;
|
||||
Unsafe.Add(ref dst, pos) = 0xff;
|
||||
pos++;
|
||||
zerocount = 1;
|
||||
}
|
||||
}
|
||||
@@ -155,17 +171,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
if (zerocount != 0)
|
||||
{
|
||||
m_dest[pos++] = 0x00;
|
||||
m_dest[pos++] = (byte)zerocount;
|
||||
Unsafe.Add(ref dst, pos) = 0x00;
|
||||
pos++;
|
||||
Unsafe.Add(ref dst, pos) = (byte)zerocount;
|
||||
pos++;
|
||||
zerocount = 0;
|
||||
}
|
||||
|
||||
m_dest[pos++] = src[i];
|
||||
Unsafe.Add(ref dst, pos) = src[i];
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void AddByte(byte v)
|
||||
public void AddByte(byte v)
|
||||
{
|
||||
if (v == 0x00)
|
||||
{
|
||||
@@ -173,21 +191,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
zerocount++;
|
||||
else
|
||||
{
|
||||
m_dest[pos++] = 0x00;
|
||||
m_dest[pos++] = 0xff;
|
||||
ref byte dst = ref MemoryMarshal.GetArrayDataReference(m_dest);
|
||||
Unsafe.Add(ref dst, pos) = 0x00;
|
||||
pos++;
|
||||
Unsafe.Add(ref dst, pos) = 0xff;
|
||||
pos++;
|
||||
zerocount = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ref byte dst = ref MemoryMarshal.GetArrayDataReference(m_dest);
|
||||
if (zerocount != 0)
|
||||
{
|
||||
m_dest[pos++] = 0x00;
|
||||
m_dest[pos++] = (byte)zerocount;
|
||||
Unsafe.Add(ref dst, pos) = 0x00;
|
||||
pos++;
|
||||
Unsafe.Add(ref dst, pos) = (byte)zerocount;
|
||||
pos++;
|
||||
zerocount = 0;
|
||||
}
|
||||
|
||||
m_dest[pos++] = v;
|
||||
Unsafe.Add(ref dst, pos) = v;
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,6 +356,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
AddBytes(b, 16);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void AddColorArgb(int argb)
|
||||
{
|
||||
uint ua = (uint)argb ^ 0xff000000;
|
||||
if(ua == 0)
|
||||
{
|
||||
AddZeros(4);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddByte((byte)(ua >> 16));
|
||||
AddByte((byte)(ua >> 8));
|
||||
AddByte((byte)ua);
|
||||
AddByte((byte)(ua >> 24));
|
||||
}
|
||||
|
||||
}
|
||||
// maxlen <= 255 and includes null termination byte
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public unsafe void AddShortString(string str, int maxlen)
|
||||
|
||||
@@ -1025,34 +1025,50 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </value>
|
||||
public Color Color
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get { return m_color; }
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set { m_color = value; }
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public int TextColorArgb()
|
||||
{
|
||||
return m_color.ToArgb();
|
||||
}
|
||||
|
||||
public osUTF8 osUTF8Text;
|
||||
public string Text
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get { return osUTF8Text == null ? string.Empty : osUTF8Text.ToString(); }
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set { osUTF8Text = string.IsNullOrEmpty(value) ? null : new osUTF8(value, 254); }
|
||||
}
|
||||
|
||||
public osUTF8 osUTF8SitName;
|
||||
public string SitName
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get { return osUTF8SitName == null ? string.Empty : osUTF8SitName.ToString(); }
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set { osUTF8SitName = string.IsNullOrEmpty(value) ? null : new osUTF8(value, 36); }
|
||||
}
|
||||
|
||||
public osUTF8 osUTF8TouchName;
|
||||
public string TouchName
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get { return osUTF8TouchName == null ? string.Empty : osUTF8TouchName.ToString(); }
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set { osUTF8TouchName = string.IsNullOrEmpty(value) ? null : new osUTF8(value, 36); }
|
||||
}
|
||||
|
||||
public int LinkNum
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get { return m_linkNum; }
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set
|
||||
{
|
||||
// if (ParentGroup != null)
|
||||
|
||||
@@ -315,8 +315,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (scriptEngines.Length == 0) // No engine at all
|
||||
return;
|
||||
|
||||
bool running;
|
||||
|
||||
m_items.LockItemsForRead(true);
|
||||
|
||||
foreach (TaskInventoryItem item in m_scripts.Values)
|
||||
@@ -324,7 +322,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
//running = false;
|
||||
foreach (IScriptModule e in scriptEngines)
|
||||
{
|
||||
if (e.HasScript(item.ItemID, out running))
|
||||
if (e.HasScript(item.ItemID, out bool running))
|
||||
{
|
||||
item.ScriptRunning = running;
|
||||
break;
|
||||
|
||||
@@ -60,10 +60,10 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||
private XMRInstAbstract inst; // script instance debited with heap use
|
||||
private int heapUse; // current heap use debit amount
|
||||
|
||||
public static TokenTypeSDTypeDelegate countDelegate = new TokenTypeSDTypeDelegate(new TokenTypeInt(null), new TokenType[0]);
|
||||
public static TokenTypeSDTypeDelegate clearDelegate = new TokenTypeSDTypeDelegate(new TokenTypeVoid(null), new TokenType[0]);
|
||||
public static TokenTypeSDTypeDelegate indexDelegate = new TokenTypeSDTypeDelegate(new TokenTypeObject(null), new TokenType[] { new TokenTypeInt(null) });
|
||||
public static TokenTypeSDTypeDelegate valueDelegate = new TokenTypeSDTypeDelegate(new TokenTypeObject(null), new TokenType[] { new TokenTypeInt(null) });
|
||||
public static TokenTypeSDTypeDelegate countDelegate = new TokenTypeSDTypeDelegate(new TokenTypeInt(null), []);
|
||||
public static TokenTypeSDTypeDelegate clearDelegate = new TokenTypeSDTypeDelegate(new TokenTypeVoid(null), []);
|
||||
public static TokenTypeSDTypeDelegate indexDelegate = new TokenTypeSDTypeDelegate(new TokenTypeObject(null), [new TokenTypeInt(null)]);
|
||||
public static TokenTypeSDTypeDelegate valueDelegate = new TokenTypeSDTypeDelegate(new TokenTypeObject(null), [new TokenTypeInt(null)]);
|
||||
|
||||
public XMR_Array(XMRInstAbstract inst)
|
||||
{
|
||||
|
||||
@@ -1806,7 +1806,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||
{
|
||||
migrateInReader = mir;
|
||||
migrateInObjects = new Dictionary<int, object>();
|
||||
ehArgs = (object[])RecvObjValue();
|
||||
ehArgs = (object[])RecvObjValue() ?? [];
|
||||
doGblInit = mir.ReadBoolean();
|
||||
stateCode = mir.ReadInt32();
|
||||
eventCode = (ScriptEventCode)mir.ReadInt32();
|
||||
@@ -1824,7 +1824,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||
XMRStackFrame thisSF = new XMRStackFrame();
|
||||
thisSF.funcName = funcName;
|
||||
thisSF.callNo = mir.ReadInt32();
|
||||
thisSF.objArray = (object[])RecvObjValue();
|
||||
thisSF.objArray = (object[])RecvObjValue() ?? [];
|
||||
if(lastSF == null)
|
||||
stackFrames = thisSF;
|
||||
else
|
||||
@@ -1870,7 +1870,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||
case Ser.LSLLIST:
|
||||
{
|
||||
this.migrateInObjects.Add(ident, null); // placeholder
|
||||
object[] data = (object[])RecvObjValue(); // read data, maybe using another index
|
||||
object[] data = (object[])RecvObjValue() ?? []; // read data, maybe using another index
|
||||
LSL_List list = new LSL_List(data); // make LSL-level list
|
||||
this.migrateInObjects[ident] = list; // fill in slot
|
||||
return list;
|
||||
@@ -1899,8 +1899,14 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||
{
|
||||
Type eletype = String2SysType(mir.ReadString());
|
||||
int length = mir.ReadInt32();
|
||||
if(length == 0)
|
||||
{
|
||||
migrateInObjects.Add(ident, null);
|
||||
return null;
|
||||
}
|
||||
|
||||
Array array = Array.CreateInstance(eletype, length);
|
||||
this.migrateInObjects.Add(ident, array);
|
||||
migrateInObjects.Add(ident, array);
|
||||
for(int i = 0; i < length; i++)
|
||||
array.SetValue(RecvObjValue(), i);
|
||||
return array;
|
||||
|
||||
Reference in New Issue
Block a user