Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinkSet Data feature from SL #64

Merged
merged 29 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d4ab207
Manually applied the Linkset Data patch from zontreck (Aria) that had…
mdickson Nov 5, 2023
f9674b1
Add using around binary compression of linksetdata so that Dispose is…
mdickson Nov 5, 2023
e05b559
Declare and set linksetdata to null when updating prims table where t…
mdickson Nov 5, 2023
d363388
Update the script syntax XML
zontreck Nov 6, 2023
f42a8eb
Apparently forgot to add the Read and Delete protected methods
zontreck Nov 6, 2023
1b4a6f7
Rewrite null checks for older dot net
zontreck Nov 6, 2023
ff5b3c3
Update linkset data accounting on reset
zontreck Nov 6, 2023
89eeb5d
Rename ProtectedData to LinksetDataEntry
zontreck Nov 6, 2023
0b63ff2
Fix protected attribute not being set on new entries
zontreck Nov 7, 2023
893973f
Add the new linkset data functions
zontreck Nov 7, 2023
88d5090
Finish adding remaining linkset data functions
zontreck Nov 7, 2023
884ac48
Fix a compile error due to typo
zontreck Nov 7, 2023
bc498d5
Parity: Don't send value on write protected in event
zontreck Nov 7, 2023
28f8851
Do some code cleanup and fixes in multi-delete function
zontreck Nov 7, 2023
f29ec1b
Parity: When testing passwords, even for unsecured values, treat as s…
zontreck Nov 7, 2023
9613376
Parity: Fix some return values
zontreck Nov 7, 2023
781523f
Oops... compile error
zontreck Nov 7, 2023
646b345
Fix up a few CodqQL scanner errors.
mdickson Nov 9, 2023
017381a
For LinkSetData Find and returning a list of keys a count value of < …
mdickson Nov 13, 2023
778a089
Reformat LinksetDataEntry to be consistent with coding standards. Fun…
mdickson Nov 13, 2023
5543c2f
Change the underlying storage to a SortedList so we return keys in al…
mdickson Nov 14, 2023
eb27523
Fix list handling in llLinksetDataDeleteFound, we can't delete keys f…
mdickson Nov 15, 2023
21f9ce2
Update LSL support for LinksetData to use string.Empty where appropriate
mdickson Nov 15, 2023
1ab558d
Rework the scheme migration to use MEDIUMTEXT for the linksetdata fie…
mdickson Nov 16, 2023
47bd8c8
Revert to using a binary count for the space accounting for the links…
mdickson Nov 16, 2023
2ca03f0
For llLinksetDeleteFound take a copy of the KVP's so we can delete as…
mdickson Nov 16, 2023
07675f8
Add missing stub functions
zontreck Nov 16, 2023
cc8a416
Cleaned unused System.Text.Json references in Data namespaces. Added…
mdickson Nov 16, 2023
1e70f8f
Merge branch 'feature/zontreck-linkset-data' of github.com:OpenSim-NG…
mdickson Nov 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions OpenSim/Data/MySQL/MySQLSimulationData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ public virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID)
"AttachedPosY, AttachedPosZ, " +
"PhysicsShapeType, Density, GravityModifier, " +
"Friction, Restitution, Vehicle, PhysInertia, DynAttrs, " +
"RotationAxisLocks, sopanims, sitactrange, pseudocrc" +
"RotationAxisLocks, sopanims, sitactrange, pseudocrc, " +
"linksetdata" +
") values (" + "?UUID, " +
"?CreationDate, ?Name, ?Text, " +
"?Description, ?SitName, ?TouchName, " +
Expand Down Expand Up @@ -216,7 +217,8 @@ public virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID)
"?AttachedPosY, ?AttachedPosZ, " +
"?PhysicsShapeType, ?Density, ?GravityModifier, " +
"?Friction, ?Restitution, ?Vehicle, ?PhysInertia, ?DynAttrs," +
"?RotationAxisLocks, ?sopanims, ?sitactrange, ?pseudocrc)";
"?RotationAxisLocks, ?sopanims, ?sitactrange, ?pseudocrc, " +
"?linksetdata)";

FillPrimCommand(cmd, prim, obj.UUID, regionUUID);

Expand Down Expand Up @@ -1202,6 +1204,11 @@ private SceneObjectPart BuildPrim(IDataReader row)
if(pseudocrc != 0)
prim.PseudoCRC = pseudocrc;

if (!(row["linksetdata"] is DBNull))
{
prim.DeserializeLinksetData((byte[])row["linksetdata"]);
}

return prim;
}

Expand Down Expand Up @@ -1620,6 +1627,15 @@ private void FillPrimCommand(MySqlCommand cmd, SceneObjectPart prim, UUID sceneG

cmd.Parameters.AddWithValue("sitactrange", prim.SitActiveRange);
cmd.Parameters.AddWithValue("pseudocrc", prim.PseudoCRC);

if (prim.HasLinksetData)
{
cmd.Parameters.AddWithValue("linksetdata", prim.SerializeLinksetData());
}
else
{
cmd.Parameters.AddWithValue("linksetdata", null);
}
}

/// <summary>
Expand Down
8 changes: 8 additions & 0 deletions OpenSim/Data/MySQL/Resources/RegionStore.migrations
Original file line number Diff line number Diff line change
Expand Up @@ -550,3 +550,11 @@ BEGIN;
ALTER TABLE `land` ADD COLUMN `environment` MEDIUMTEXT default NULL;
COMMIT;

:VERSION 64 #----- material overrides
ALTER TABLE `primshapes` ADD COLUMN `MatOvrd` blob default NULL;
COMMIT;

:VERSION 65 #----- add linkset data storage column
BEGIN;
ALTER TABLE `prims` ADD COLUMN `linksetdata` blob default NULL;
COMMIT;
17 changes: 12 additions & 5 deletions OpenSim/Data/PGSQL/PGSQLSimulationData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,9 @@ UPDATE prims SET
""ClickAction"" = :ClickAction, ""Material"" = :Material, ""CollisionSound"" = :CollisionSound, ""CollisionSoundVolume"" = :CollisionSoundVolume, ""PassTouches"" = :PassTouches,
""LinkNumber"" = :LinkNumber, ""MediaURL"" = :MediaURL, ""DynAttrs"" = :DynAttrs, ""Vehicle"" = :Vehicle,
""PhysInertia"" = :PhysInertia, ""standtargetx"" =:standtargetx, ""standtargety"" =:standtargety, ""standtargetz"" =:standtargetz,
""sitactrange"" =:sitactrange, ""pseudocrc"" = :pseudocrc, ""sopanims"" = :sopanims

WHERE ""UUID"" = :UUID ;
""sitactrange"" =:sitactrange, ""pseudocrc"" = :pseudocrc, ""sopanims"" = :sopanims,
""linksetdata"" =:linksetdata
WHERE ""UUID"" = :UUID ;

INSERT INTO
prims (
Expand All @@ -371,7 +371,7 @@ INSERT INTO
""ForceMouselook"", ""ScriptAccessPin"", ""AllowedDrop"", ""DieAtEdge"", ""SalePrice"", ""SaleType"", ""ColorR"", ""ColorG"", ""ColorB"", ""ColorA"",
""ParticleSystem"", ""ClickAction"", ""Material"", ""CollisionSound"", ""CollisionSoundVolume"", ""PassTouches"", ""LinkNumber"", ""MediaURL"", ""DynAttrs"",
""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution"", ""PassCollisions"", ""RotationAxisLocks"", ""RezzerID"" , ""Vehicle"", ""PhysInertia"",
""standtargetx"", ""standtargety"", ""standtargetz"", ""sitactrange"", ""pseudocrc"", ""sopanims""
""standtargetx"", ""standtargety"", ""standtargetz"", ""sitactrange"", ""pseudocrc"", ""sopanims"", ""linksetdata""
) Select
:UUID, :CreationDate, :Name, :Text, :Description, :SitName, :TouchName, :ObjectFlags, :OwnerMask, :NextOwnerMask, :GroupMask,
:EveryoneMask, :BaseMask, :PositionX, :PositionY, :PositionZ, :GroupPositionX, :GroupPositionY, :GroupPositionZ, :VelocityX,
Expand All @@ -383,7 +383,7 @@ INSERT INTO
:ForceMouselook, :ScriptAccessPin, :AllowedDrop, :DieAtEdge, :SalePrice, :SaleType, :ColorR, :ColorG, :ColorB, :ColorA,
:ParticleSystem, :ClickAction, :Material, :CollisionSound, :CollisionSoundVolume, :PassTouches, :LinkNumber, :MediaURL, :DynAttrs,
:PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution, :PassCollisions, :RotationAxisLocks, :RezzerID, :Vehicle, :PhysInertia,
:standtargetx, :standtargety, :standtargetz,:sitactrange, :pseudocrc, :sopanims
:standtargetx, :standtargety, :standtargetz,:sitactrange, :pseudocrc, :sopanims, :LinksetData
where not EXISTS (SELECT ""UUID"" FROM prims WHERE ""UUID"" = :UUID);
";

Expand Down Expand Up @@ -1406,6 +1406,11 @@ private static SceneObjectPart BuildPrim(IDataRecord primRow)
prim.Animations = null;
}

if ((primRow["LinksetData"] is DBNull) == false)
{
prim.DeserializeLinksetData(((byte[])primRow["linksetdata"]));
}

return prim;
}

Expand Down Expand Up @@ -1870,6 +1875,8 @@ private NpgsqlParameter[] CreatePrimParameters(SceneObjectPart prim, UUID sceneG
else
parameters.Add(_Database.CreateParameter("sopanims", null));

parameters.Add(_Database.CreateParameter("linksetdata", prim.SerializeLinksetData()));

return parameters.ToArray();
}

Expand Down
5 changes: 5 additions & 0 deletions OpenSim/Data/PGSQL/Resources/RegionStore.migrations
Original file line number Diff line number Diff line change
Expand Up @@ -1261,3 +1261,8 @@ BEGIN;
ALTER TABLE `prims` ADD COLUMN `sopanims` bytea NULL;
ALTER TABLE `primshapes` ADD COLUMN `MatOvrd` bytea NULL;
COMMIT;

:VERSION 53 #----- add linkset data storage column
BEGIN;
ALTER TABLE `prims` ADD COLUMN `linksetdata` bytea NULL;
COMMIT;
5 changes: 5 additions & 0 deletions OpenSim/Data/SQLite/Resources/RegionStore.migrations
Original file line number Diff line number Diff line change
Expand Up @@ -406,3 +406,8 @@ BEGIN;
ALTER TABLE `prims` ADD COLUMN `sopanims` blob default NULL;
ALTER TABLE `primshapes` ADD COLUMN `MatOvrd` blob default NULL;
COMMIT;

:VERSION 41 #----- add linkset data storage column
BEGIN;
ALTER TABLE `prims` ADD COLUMN `linksetdata` blob default NULL;
COMMIT;
9 changes: 9 additions & 0 deletions OpenSim/Data/SQLite/SQLiteSimulationData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,8 @@ private static DataTable createPrimTable()
createCol(prims, "pseudocrc", typeof(int));
createCol(prims, "sopanims", typeof(byte[]));

createCol(prims, "linksetdata", typeof(byte[]));

// Add in contraints
prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] };

Expand Down Expand Up @@ -1810,6 +1812,11 @@ private SceneObjectPart buildPrim(DataRow row)
prim.Animations = null;
}

if (!(row["linksetdata"] is DBNull))
{
prim.DeserializeLinksetData((byte[])row["LinksetData"]);
}

return prim;
}

Expand Down Expand Up @@ -2199,6 +2206,8 @@ private static void fillPrimRow(DataRow row, SceneObjectPart prim, UUID sceneGro

row["pseudocrc"] = prim.PseudoCRC;
row["sopanims"] = prim.SerializeAnimations();

row["linksetdata"] = prim.SerializeLinksetData();
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion OpenSim/Framework/VersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class VersionInfo
{
public const string VersionNumber = "0.9.2.2";
public const string AssemblyVersionNumber = "0.9.2.2";
public const string Release = "8688";
public const string Release = "8717";

public static string Version
{
Expand Down
68 changes: 68 additions & 0 deletions OpenSim/Region/Framework/Scenes/LinksetDataEntry.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using System;
using System.IO;

namespace OpenSim.Region.Framework.Scenes
{
public class LinksetDataEntry
{
public LinksetDataEntry(string value, string pass)
{
this.Value = value;
this.Password = pass;
}

private LinksetDataEntry()
{ }

public bool IsProtected
{
get { return (string.IsNullOrEmpty(this.Password) == false); }
}

public string Password { get; private set; } = string.Empty;

public string Value { get; private set; }

public bool CheckPassword(string pass)
{
// A undocumented caveat for LinksetData appears to be that even for unprotected values, if a pass is provided, it is still treated as protected
if (this.Password == pass)
return true;
else
return false;
}

public string CheckPasswordAndGetValue(string pass)
{
if (string.IsNullOrEmpty(this.Password) || (this.Password == pass))
return this.Value;
else
return string.Empty;
}

public Byte[] Serialize()
{
using (MemoryStream ms = new MemoryStream())
{
using (BinaryWriter bw = new BinaryWriter(ms))
{
bw.Write(this.Value);
bw.Write(this.Password);
return ms.ToArray();
}
}
}

public static LinksetDataEntry Deserialize(Byte[] inf)

Check warning on line 56 in OpenSim/Region/Framework/Scenes/LinksetDataEntry.cs

View workflow job for this annotation

GitHub Actions / build

The type 'LinksetDataEntry' in '/home/runner/work/OpenSim-Sasquatch/OpenSim-Sasquatch/OpenSim/Region/Framework/Scenes/LinksetDataEntry.cs' conflicts with the imported type 'LinksetDataEntry' in 'OpenSim.Region.Framework, Version=0.9.2.2, Culture=neutral, PublicKeyToken=null'. Using the type defined in '/home/runner/work/OpenSim-Sasquatch/OpenSim-Sasquatch/OpenSim/Region/Framework/Scenes/LinksetDataEntry.cs'.

Check warning on line 56 in OpenSim/Region/Framework/Scenes/LinksetDataEntry.cs

View workflow job for this annotation

GitHub Actions / build

The type 'LinksetDataEntry' in '/home/runner/work/OpenSim-Sasquatch/OpenSim-Sasquatch/OpenSim/Region/Framework/Scenes/LinksetDataEntry.cs' conflicts with the imported type 'LinksetDataEntry' in 'OpenSim.Region.Framework, Version=0.9.2.2, Culture=neutral, PublicKeyToken=null'. Using the type defined in '/home/runner/work/OpenSim-Sasquatch/OpenSim-Sasquatch/OpenSim/Region/Framework/Scenes/LinksetDataEntry.cs'.
{
LinksetDataEntry pd = new LinksetDataEntry();

Check warning on line 58 in OpenSim/Region/Framework/Scenes/LinksetDataEntry.cs

View workflow job for this annotation

GitHub Actions / build

The type 'LinksetDataEntry' in '/home/runner/work/OpenSim-Sasquatch/OpenSim-Sasquatch/OpenSim/Region/Framework/Scenes/LinksetDataEntry.cs' conflicts with the imported type 'LinksetDataEntry' in 'OpenSim.Region.Framework, Version=0.9.2.2, Culture=neutral, PublicKeyToken=null'. Using the type defined in '/home/runner/work/OpenSim-Sasquatch/OpenSim-Sasquatch/OpenSim/Region/Framework/Scenes/LinksetDataEntry.cs'.

Check warning on line 58 in OpenSim/Region/Framework/Scenes/LinksetDataEntry.cs

View workflow job for this annotation

GitHub Actions / build

The type 'LinksetDataEntry' in '/home/runner/work/OpenSim-Sasquatch/OpenSim-Sasquatch/OpenSim/Region/Framework/Scenes/LinksetDataEntry.cs' conflicts with the imported type 'LinksetDataEntry' in 'OpenSim.Region.Framework, Version=0.9.2.2, Culture=neutral, PublicKeyToken=null'. Using the type defined in '/home/runner/work/OpenSim-Sasquatch/OpenSim-Sasquatch/OpenSim/Region/Framework/Scenes/LinksetDataEntry.cs'.

Check warning on line 58 in OpenSim/Region/Framework/Scenes/LinksetDataEntry.cs

View workflow job for this annotation

GitHub Actions / build

The type 'LinksetDataEntry' in '/home/runner/work/OpenSim-Sasquatch/OpenSim-Sasquatch/OpenSim/Region/Framework/Scenes/LinksetDataEntry.cs' conflicts with the imported type 'LinksetDataEntry' in 'OpenSim.Region.Framework, Version=0.9.2.2, Culture=neutral, PublicKeyToken=null'. Using the type defined in '/home/runner/work/OpenSim-Sasquatch/OpenSim-Sasquatch/OpenSim/Region/Framework/Scenes/LinksetDataEntry.cs'.

Check warning on line 58 in OpenSim/Region/Framework/Scenes/LinksetDataEntry.cs

View workflow job for this annotation

GitHub Actions / build

The type 'LinksetDataEntry' in '/home/runner/work/OpenSim-Sasquatch/OpenSim-Sasquatch/OpenSim/Region/Framework/Scenes/LinksetDataEntry.cs' conflicts with the imported type 'LinksetDataEntry' in 'OpenSim.Region.Framework, Version=0.9.2.2, Culture=neutral, PublicKeyToken=null'. Using the type defined in '/home/runner/work/OpenSim-Sasquatch/OpenSim-Sasquatch/OpenSim/Region/Framework/Scenes/LinksetDataEntry.cs'.
using (BinaryReader br = new BinaryReader(new MemoryStream(inf)))
{
pd.Value = br.ReadString();
pd.Password = br.ReadString();

return pd;
}
}
}
}
7 changes: 5 additions & 2 deletions OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ public enum ScriptEventCode : int
http_request = 38,

path_update = 40,
linkset_data = 41,

// marks highest numbered event
Size = 41
Size = 42
}

// this is not the right place for this
Expand Down Expand Up @@ -145,7 +146,9 @@ public enum scriptEvents : ulong
anytouch = touch | touch_end | touch_start,
anyTarget = at_target | not_at_target | at_rot_target | not_at_rot_target,
anyobjcollision = collision | collision_end | collision_start,
anylandcollision = land_collision | land_collision_end | land_collision_start
anylandcollision = land_collision | land_collision_end | land_collision_start,

linkset_data = 1UL << 41
}

public struct scriptPosTarget
Expand Down
Loading
Loading