aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs13
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs7
-rw-r--r--OpenSim/Framework/General/Interfaces/IClientAPI.cs1
-rw-r--r--OpenSim/Framework/General/NullClientAPI.cs3
-rw-r--r--OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs2
-rw-r--r--OpenSim/Region/ClientStack/ClientView.API.cs13
-rw-r--r--OpenSim/Region/Communications/Local/LocalUserServices.cs1
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs1
-rw-r--r--OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs16
-rw-r--r--OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs109
-rw-r--r--OpenSim/Region/Environment/Scenes/Primitive.cs3
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject.cs12
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs7
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassInstance.cs1
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs239
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs222
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/OpCodes.cs56
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs1
19 files changed, 578 insertions, 133 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs
index 05fa963..d133617 100644
--- a/OpenSim/Framework/Communications/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Region.Capabilities
48 private string m_requestPath = "0000/"; 48 private string m_requestPath = "0000/";
49 private string m_mapLayerPath = "0001/"; 49 private string m_mapLayerPath = "0001/";
50 private string m_newInventory = "0002/"; 50 private string m_newInventory = "0002/";
51 // private string m_requestTexture = "0003/"; 51 //private string m_requestTexture = "0003/";
52 private string m_notecardUpdatePath = "0004/"; 52 private string m_notecardUpdatePath = "0004/";
53 //private string eventQueue = "0100/"; 53 //private string eventQueue = "0100/";
54 private BaseHttpServer httpListener; 54 private BaseHttpServer httpListener;
@@ -79,6 +79,7 @@ namespace OpenSim.Region.Capabilities
79 httpListener.AddStreamHandler( new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", capsBase + m_newInventory, this.NewAgentInventoryRequest)); 79 httpListener.AddStreamHandler( new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", capsBase + m_newInventory, this.NewAgentInventoryRequest));
80 80
81 AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest); 81 AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest);
82 //AddLegacyCapsHandler(httpListener, m_requestTexture , RequestTexture);
82 AddLegacyCapsHandler(httpListener, m_notecardUpdatePath, NoteCardAgentInventory); 83 AddLegacyCapsHandler(httpListener, m_notecardUpdatePath, NoteCardAgentInventory);
83 } 84 }
84 85
@@ -116,7 +117,6 @@ namespace OpenSim.Region.Capabilities
116 string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath; 117 string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath;
117 caps.MapLayer = capsBaseUrl + m_mapLayerPath; 118 caps.MapLayer = capsBaseUrl + m_mapLayerPath;
118 caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; 119 caps.NewFileAgentInventory = capsBaseUrl + m_newInventory;
119 //caps.RequestTextureDownload = capsBaseUrl + m_requestTexture;
120 caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath; 120 caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath;
121 return caps; 121 return caps;
122 } 122 }
@@ -299,7 +299,7 @@ namespace OpenSim.Region.Capabilities
299 private LLUUID newAssetID; 299 private LLUUID newAssetID;
300 private LLUUID inventoryItemID; 300 private LLUUID inventoryItemID;
301 private BaseHttpServer httpListener; 301 private BaseHttpServer httpListener;
302 private bool SaveImages = false; 302 private bool SaveAssets = false;
303 private string m_assetName = ""; 303 private string m_assetName = "";
304 304
305 /// <summary> 305 /// <summary>
@@ -338,8 +338,8 @@ namespace OpenSim.Region.Capabilities
338 338
339 httpListener.RemoveStreamHandler("POST", uploaderPath); 339 httpListener.RemoveStreamHandler("POST", uploaderPath);
340 340
341 if(this.SaveImages) 341 if(this.SaveAssets)
342 this.SaveImageToFile(m_assetName + ".jp2", data); 342 this.SaveAssetToFile(m_assetName + ".jp2", data);
343 343
344 if (OnUpLoad != null) 344 if (OnUpLoad != null)
345 { 345 {
@@ -349,7 +349,7 @@ namespace OpenSim.Region.Capabilities
349 return res; 349 return res;
350 } 350 }
351 351
352 private void SaveImageToFile(string filename, byte[] data) 352 private void SaveAssetToFile(string filename, byte[] data)
353 { 353 {
354 FileStream fs = File.Create(filename); 354 FileStream fs = File.Create(filename);
355 BinaryWriter bw = new BinaryWriter(fs); 355 BinaryWriter bw = new BinaryWriter(fs);
@@ -360,3 +360,4 @@ namespace OpenSim.Region.Capabilities
360 } 360 }
361 } 361 }
362} 362}
363
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs b/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs
index cae7e97..913d7ab 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs
@@ -6,9 +6,10 @@ namespace OpenSim.Region.Capabilities
6 public string MapLayer = ""; 6 public string MapLayer = "";
7 public string NewFileAgentInventory = ""; 7 public string NewFileAgentInventory = "";
8 //public string EventQueueGet = ""; 8 //public string EventQueueGet = "";
9 //public string RequestTextureDownload = ""; 9 // public string RequestTextureDownload = "";
10 //public string ChatSessionRequest = ""; 10 // public string ChatSessionRequest = "";
11 public string UpdateNotecardAgentInventory = ""; 11 public string UpdateNotecardAgentInventory = "";
12 // public string ParcelVoiceInfoRequest = "";
12 13
13 public LLSDCapsDetails() 14 public LLSDCapsDetails()
14 { 15 {
@@ -16,3 +17,5 @@ namespace OpenSim.Region.Capabilities
16 } 17 }
17 } 18 }
18} 19}
20
21
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
index 3162e9c..5320196 100644
--- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs
+++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
@@ -211,5 +211,6 @@ namespace OpenSim.Framework.Interfaces
211 void SendNameReply(LLUUID profileId, string firstname, string lastname); 211 void SendNameReply(LLUUID profileId, string firstname, string lastname);
212 void SendAlertMessage(string message); 212 void SendAlertMessage(string message);
213 void SendAgentAlertMessage(string message, bool modal); 213 void SendAgentAlertMessage(string message, bool modal);
214 void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url);
214 } 215 }
215} 216}
diff --git a/OpenSim/Framework/General/NullClientAPI.cs b/OpenSim/Framework/General/NullClientAPI.cs
index 7c6c6689..017828e 100644
--- a/OpenSim/Framework/General/NullClientAPI.cs
+++ b/OpenSim/Framework/General/NullClientAPI.cs
@@ -142,5 +142,8 @@ namespace OpenSim.Framework
142 public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname){} 142 public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname){}
143 public void SendAlertMessage(string message) { } 143 public void SendAlertMessage(string message) { }
144 public void SendAgentAlertMessage(string message, bool modal) { } 144 public void SendAgentAlertMessage(string message, bool modal) { }
145 public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) { }
146
145 } 147 }
146} 148}
149
diff --git a/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs b/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs
index 9f681c2..f2e6128 100644
--- a/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs
+++ b/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs
@@ -133,4 +133,4 @@ namespace OpenSim.Framework.InventoryServiceBase
133 } 133 }
134 } 134 }
135 } 135 }
136} 136} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs
index 392745f..5ef0e1a 100644
--- a/OpenSim/Region/ClientStack/ClientView.API.cs
+++ b/OpenSim/Region/ClientStack/ClientView.API.cs
@@ -658,6 +658,19 @@ namespace OpenSim.Region.ClientStack
658 OutPacket(alertPack); 658 OutPacket(alertPack);
659 } 659 }
660 660
661 public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url)
662 {
663 LoadURLPacket loadURL = new LoadURLPacket();
664 loadURL.Data.ObjectName = Helpers.StringToField(objectname);
665 loadURL.Data.ObjectID = objectID;
666 loadURL.Data.OwnerID = ownerID;
667 loadURL.Data.OwnerIsGroup = groupOwned;
668 loadURL.Data.Message = Helpers.StringToField(message);
669 loadURL.Data.URL = Helpers.StringToField(url);
670
671 OutPacket(loadURL);
672 }
673
661 #region Appearance/ Wearables Methods 674 #region Appearance/ Wearables Methods
662 675
663 /// <summary> 676 /// <summary>
diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs
index a4cefc4..c351451 100644
--- a/OpenSim/Region/Communications/Local/LocalUserServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs
@@ -15,6 +15,7 @@ namespace OpenSim.Region.Communications.Local
15 private NetworkServersInfo serversInfo; 15 private NetworkServersInfo serversInfo;
16 private uint defaultHomeX ; 16 private uint defaultHomeX ;
17 private uint defaultHomeY; 17 private uint defaultHomeY;
18
18 public LocalUserServices(CommunicationsLocal parent, NetworkServersInfo serversData) 19 public LocalUserServices(CommunicationsLocal parent, NetworkServersInfo serversData)
19 { 20 {
20 m_Parent = parent; 21 m_Parent = parent;
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 69d0d57..eb22b90 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -152,7 +152,6 @@ namespace OpenSim.Region.Communications.OGS1
152 { 152 {
153 return this.regions[regionHandle]; 153 return this.regions[regionHandle];
154 } 154 }
155 //TODO not a region in this instance so ask remote grid server
156 155
157 Hashtable requestData = new Hashtable(); 156 Hashtable requestData = new Hashtable();
158 requestData["region_handle"] = regionHandle.ToString(); 157 requestData["region_handle"] = regionHandle.ToString();
diff --git a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs
index a4b3852..f932b70 100644
--- a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs
+++ b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs
@@ -23,7 +23,7 @@ namespace OpenSim.Region.Environment.Scenes
23 /// <summary> 23 /// <summary>
24 /// 24 ///
25 /// </summary> 25 /// </summary>
26 public int primCount 26 public int PrimCount
27 { 27 {
28 get 28 get
29 { 29 {
@@ -99,7 +99,7 @@ namespace OpenSim.Region.Environment.Scenes
99 { 99 {
100 foreach (AllNewSceneObjectPart2 part in this.m_parts.Values) 100 foreach (AllNewSceneObjectPart2 part in this.m_parts.Values)
101 { 101 {
102 if (part.m_localID == localID) 102 if (part.LocalID == localID)
103 { 103 {
104 return part; 104 return part;
105 } 105 }
@@ -185,7 +185,7 @@ namespace OpenSim.Region.Environment.Scenes
185 AllNewSceneObjectPart2 part = this.GetChildPrim(localID); 185 AllNewSceneObjectPart2 part = this.GetChildPrim(localID);
186 if (part != null) 186 if (part != null)
187 { 187 {
188 if (part.uuid == this.m_rootPart.uuid) 188 if (part.UUID == this.m_rootPart.UUID)
189 { 189 {
190 this.UpdateRootPosition(pos); 190 this.UpdateRootPosition(pos);
191 } 191 }
@@ -210,7 +210,7 @@ namespace OpenSim.Region.Environment.Scenes
210 210
211 foreach (AllNewSceneObjectPart2 obPart in this.m_parts.Values) 211 foreach (AllNewSceneObjectPart2 obPart in this.m_parts.Values)
212 { 212 {
213 if (obPart.uuid != this.m_rootPart.uuid) 213 if (obPart.UUID != this.m_rootPart.UUID)
214 { 214 {
215 obPart.OffsetPosition = obPart.OffsetPosition + diff; 215 obPart.OffsetPosition = obPart.OffsetPosition + diff;
216 } 216 }
@@ -244,7 +244,7 @@ namespace OpenSim.Region.Environment.Scenes
244 AllNewSceneObjectPart2 part = this.GetChildPrim(localID); 244 AllNewSceneObjectPart2 part = this.GetChildPrim(localID);
245 if (part != null) 245 if (part != null)
246 { 246 {
247 if (part.uuid == this.m_rootPart.uuid) 247 if (part.UUID == this.m_rootPart.UUID)
248 { 248 {
249 this.UpdateRootRotation(rot); 249 this.UpdateRootRotation(rot);
250 } 250 }
@@ -262,7 +262,7 @@ namespace OpenSim.Region.Environment.Scenes
262 262
263 foreach (AllNewSceneObjectPart2 prim in this.m_parts.Values) 263 foreach (AllNewSceneObjectPart2 prim in this.m_parts.Values)
264 { 264 {
265 if (prim.uuid != this.m_rootPart.uuid) 265 if (prim.UUID != this.m_rootPart.UUID)
266 { 266 {
267 Vector3 axPos = new Vector3(prim.OffsetPosition.X, prim.OffsetPosition.Y, prim.OffsetPosition.Z); 267 Vector3 axPos = new Vector3(prim.OffsetPosition.X, prim.OffsetPosition.Y, prim.OffsetPosition.Z);
268 axPos = oldParentRot * axPos; 268 axPos = oldParentRot * axPos;
@@ -283,8 +283,8 @@ namespace OpenSim.Region.Environment.Scenes
283 private void SetPartAsRoot(AllNewSceneObjectPart2 part) 283 private void SetPartAsRoot(AllNewSceneObjectPart2 part)
284 { 284 {
285 this.m_rootPart = part; 285 this.m_rootPart = part;
286 this.m_uuid = part.uuid; 286 this.m_uuid = part.UUID;
287 this.m_localId = part.m_localID; 287 this.m_localId = part.LocalID;
288 } 288 }
289 289
290 /// <summary> 290 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs
index 07d1357..8a995e0 100644
--- a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs
+++ b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs
@@ -14,21 +14,15 @@ namespace OpenSim.Region.Environment.Scenes
14 { 14 {
15 private const uint FULL_MASK_PERMISSIONS = 2147483647; 15 private const uint FULL_MASK_PERMISSIONS = 2147483647;
16 16
17 private uint m_flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128;
18 private ulong m_regionHandle;
19
20 public string SitName = ""; 17 public string SitName = "";
21 public string TouchName = ""; 18 public string TouchName = "";
22 public string Text = ""; 19 public string Text = "";
23 20
24 public LLUUID CreatorID; 21 public LLUUID CreatorID;
25 public LLUUID OwnerID; 22 public LLUUID OwnerID;
23 public LLUUID GroupID;
26 public LLUUID LastOwnerID; 24 public LLUUID LastOwnerID;
27 public Int32 CreationDate; 25 public Int32 CreationDate;
28
29 public LLUUID uuid;
30 public uint m_localID;
31
32 public uint ParentID = 0; 26 public uint ParentID = 0;
33 27
34 public uint OwnerMask = FULL_MASK_PERMISSIONS; 28 public uint OwnerMask = FULL_MASK_PERMISSIONS;
@@ -43,6 +37,33 @@ namespace OpenSim.Region.Environment.Scenes
43 37
44 38
45 #region Properties 39 #region Properties
40
41 protected LLUUID m_uuid;
42 public LLUUID UUID
43 {
44 get
45 {
46 return m_uuid;
47 }
48 set
49 {
50 value = m_uuid;
51 }
52 }
53
54 protected uint m_localID;
55 public uint LocalID
56 {
57 get
58 {
59 return m_localID;
60 }
61 set
62 {
63 m_localID = value;
64 }
65 }
66
46 protected string m_name; 67 protected string m_name;
47 /// <summary> 68 /// <summary>
48 /// 69 ///
@@ -53,6 +74,32 @@ namespace OpenSim.Region.Environment.Scenes
53 set { m_name = value; } 74 set { m_name = value; }
54 } 75 }
55 76
77 protected LLObject.ObjectFlags m_flags = (LLObject.ObjectFlags) 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128;
78 public uint ObjectFlags
79 {
80 get
81 {
82 return (uint)m_flags;
83 }
84 set
85 {
86 m_flags =(LLObject.ObjectFlags) value;
87 }
88 }
89
90 protected ulong m_regionHandle;
91 public ulong RegionHandle
92 {
93 get
94 {
95 return m_regionHandle;
96 }
97 set
98 {
99 m_regionHandle = value;
100 }
101 }
102
56 protected LLVector3 m_offset; 103 protected LLVector3 m_offset;
57 public LLVector3 OffsetPosition 104 public LLVector3 OffsetPosition
58 { 105 {
@@ -79,6 +126,48 @@ namespace OpenSim.Region.Environment.Scenes
79 } 126 }
80 } 127 }
81 128
129 protected LLVector3 m_velocity;
130 /// <summary></summary>
131 public LLVector3 Velocity
132 {
133 get
134 {
135 return m_velocity;
136 }
137 set
138 {
139 m_velocity = value;
140 }
141 }
142
143 protected LLVector3 m_angularVelocity;
144 /// <summary></summary>
145 public LLVector3 AngularVelocity
146 {
147 get
148 {
149 return m_angularVelocity;
150 }
151 set
152 {
153 m_angularVelocity = value;
154 }
155 }
156
157 protected LLVector3 m_acceleration;
158 /// <summary></summary>
159 public LLVector3 Acceleration
160 {
161 get
162 {
163 return m_acceleration;
164 }
165 set
166 {
167 m_acceleration = value;
168 }
169 }
170
82 private string m_description = ""; 171 private string m_description = "";
83 public string Description 172 public string Description
84 { 173 {
@@ -123,14 +212,14 @@ namespace OpenSim.Region.Environment.Scenes
123 this.OwnerID = ownerID; 212 this.OwnerID = ownerID;
124 this.CreatorID = this.OwnerID; 213 this.CreatorID = this.OwnerID;
125 this.LastOwnerID = LLUUID.Zero; 214 this.LastOwnerID = LLUUID.Zero;
126 this.uuid = LLUUID.Random(); 215 this.UUID = LLUUID.Random();
127 this.m_localID = (uint)(localID); 216 this.LocalID = (uint)(localID);
128 this.m_Shape = shape; 217 this.m_Shape = shape;
129 218
130 this.OffsetPosition = position; 219 this.OffsetPosition = position;
131 220
132 //temporary code just so the m_flags field doesn't give a compiler warning 221 //temporary code just so the m_flags field doesn't give a compiler warning
133 if (m_flags == 1) 222 if (m_flags ==LLObject.ObjectFlags.AllowInventoryDrop)
134 { 223 {
135 224
136 } 225 }
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs
index 60ea28f..3d3e25a 100644
--- a/OpenSim/Region/Environment/Scenes/Primitive.cs
+++ b/OpenSim/Region/Environment/Scenes/Primitive.cs
@@ -1,5 +1,7 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Xml;
4using System.Xml.Serialization;
3using Axiom.Math; 5using Axiom.Math;
4using libsecondlife; 6using libsecondlife;
5using libsecondlife.Packets; 7using libsecondlife.Packets;
@@ -27,6 +29,7 @@ namespace OpenSim.Region.Environment.Scenes
27 public LLUUID CreatorID; 29 public LLUUID CreatorID;
28 public LLUUID OwnerID; 30 public LLUUID OwnerID;
29 public LLUUID LastOwnerID; 31 public LLUUID LastOwnerID;
32
30 public Int32 CreationDate; 33 public Int32 CreationDate;
31 34
32 public uint ParentID = 0; 35 public uint ParentID = 0;
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index dbc6f92..d75a7f3 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -550,7 +550,7 @@ namespace OpenSim.Region.Environment.Scenes
550 m_estateManager.sendRegionHandshake(client); 550 m_estateManager.sendRegionHandshake(client);
551 CreateAndAddScenePresence(client); 551 CreateAndAddScenePresence(client);
552 m_LandManager.sendParcelOverlay(client); 552 m_LandManager.sendParcelOverlay(client);
553 // commsManager.UserProfiles.AddNewUser(client.AgentId); 553 //commsManager.UserProfiles.AddNewUser(client.AgentId);
554 } 554 }
555 555
556 protected virtual void SubscribeToClientEvents(IClientAPI client) 556 protected virtual void SubscribeToClientEvents(IClientAPI client)
@@ -595,7 +595,7 @@ namespace OpenSim.Region.Environment.Scenes
595 595
596 client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); 596 client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage);
597 597
598 // client.OnCreateNewInventoryItem += CreateNewInventoryItem; 598 // client.OnCreateNewInventoryItem += CreateNewInventoryItem;
599 //client.OnCreateNewInventoryFolder += commsManager.UserProfiles.HandleCreateInventoryFolder; 599 //client.OnCreateNewInventoryFolder += commsManager.UserProfiles.HandleCreateInventoryFolder;
600 client.OnFetchInventoryDescendents += commsManager.UserProfiles.HandleFecthInventoryDescendents; 600 client.OnFetchInventoryDescendents += commsManager.UserProfiles.HandleFecthInventoryDescendents;
601 client.OnRequestTaskInventory += RequestTaskInventory; 601 client.OnRequestTaskInventory += RequestTaskInventory;
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs
index 03a7f55..2fae556 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObject.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs
@@ -27,6 +27,9 @@
27*/ 27*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Text; 29using System.Text;
30using System.IO;
31using System.Xml;
32using System.Xml.Serialization;
30using libsecondlife; 33using libsecondlife;
31using libsecondlife.Packets; 34using libsecondlife.Packets;
32using OpenSim.Framework.Interfaces; 35using OpenSim.Framework.Interfaces;
@@ -93,7 +96,6 @@ namespace OpenSim.Region.Environment.Scenes
93 this.CreateRootFromShape(ownerID, localID, shape, pos); 96 this.CreateRootFromShape(ownerID, localID, shape, pos);
94 97
95 registerEvents(); 98 registerEvents();
96
97 } 99 }
98 100
99 /// <summary> 101 /// <summary>
@@ -185,6 +187,14 @@ namespace OpenSim.Region.Environment.Scenes
185 /// <summary> 187 /// <summary>
186 /// 188 ///
187 /// </summary> 189 /// </summary>
190 public void Serialise()
191 {
192
193 }
194
195 /// <summary>
196 ///
197 /// </summary>
188 public void DeleteAllChildren() 198 public void DeleteAllChildren()
189 { 199 {
190 this.m_children.Clear(); 200 this.m_children.Clear();
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 4bb48b8..9638152 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -443,8 +443,11 @@ namespace OpenSim.Region.Environment.Scenes
443 foreach (ScenePresence avatar in this.m_scene.RequestAvatarList()) 443 foreach (ScenePresence avatar in this.m_scene.RequestAvatarList())
444 { 444 {
445 this.SendFullUpdateToOtherClient(avatar); 445 this.SendFullUpdateToOtherClient(avatar);
446 avatar.SendFullUpdateToOtherClient(this); 446 if (avatar.LocalId != this.LocalId)
447 avatar.SendAppearanceToOtherAgent(this); 447 {
448 avatar.SendFullUpdateToOtherClient(this);
449 avatar.SendAppearanceToOtherAgent(this);
450 }
448 } 451 }
449 } 452 }
450 453
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassInstance.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassInstance.cs
index ca729b4..be29ee9 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassInstance.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassInstance.cs
@@ -35,6 +35,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
35 public class ClassInstance : Object 35 public class ClassInstance : Object
36 { 36 {
37 public int size; 37 public int size;
38 public ClassRecord ClassRec;
38 public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>(); 39 public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>();
39 40
40 public ClassInstance() 41 public ClassInstance()
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs
index f151b7e..a609a40 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs
@@ -30,6 +30,7 @@ using System.IO;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Text;
32using OpenSim.Region.Scripting.EmbeddedJVM.Types; 32using OpenSim.Region.Scripting.EmbeddedJVM.Types;
33using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
33 34
34namespace OpenSim.Region.Scripting.EmbeddedJVM 35namespace OpenSim.Region.Scripting.EmbeddedJVM
35{ 36{
@@ -60,7 +61,11 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
60 61
61 public ClassInstance CreateNewInstance() 62 public ClassInstance CreateNewInstance()
62 { 63 {
63 return new ClassInstance(); 64 ClassInstance classInst = new ClassInstance();
65 classInst.ClassRec = this;
66 //TODO: set fields
67
68 return classInst;
64 } 69 }
65 70
66 public void LoadClassFromFile(string fileName) 71 public void LoadClassFromFile(string fileName)
@@ -75,33 +80,40 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
75 { 80 {
76 int i = 0; 81 int i = 0;
77 i += 4; 82 i += 4;
78 _minorVersion = (ushort)((data[i++] << 8) + data[i++] ); 83 _minorVersion = (ushort)((data[i++] << 8) + data[i++]);
79 _majorVersion = (ushort)((data[i++] << 8) + data[i++] ); 84 _majorVersion = (ushort)((data[i++] << 8) + data[i++]);
80 _constantPoolCount = (ushort)((data[i++] << 8) + data[i++] ); 85 _constantPoolCount = (ushort)((data[i++] << 8) + data[i++]);
81 // Console.WriteLine("there should be " + _constantPoolCount + " items in the pool"); 86 Console.WriteLine("there should be " + _constantPoolCount + " items in the pool");
82 for (int count = 0; count < _constantPoolCount -1 ; count++) 87 for (int count = 0; count < (_constantPoolCount - 1); count++)
83 { 88 {
84 //read in the constant pool 89 //read in the constant pool
85 byte pooltype = data[i++]; 90 byte pooltype = data[i++];
86 //Console.WriteLine("#" +count +": new constant type = " +pooltype); 91 Console.WriteLine("#" + count + ": new constant type = " + pooltype);
87 //Console.WriteLine("start position is: " + i); 92 //Console.WriteLine("start position is: " + i);
88 switch (pooltype) 93 switch (pooltype)
89 { 94 {
90 case 1: //Utf8 95 case 1: //Utf8
91 ushort uLength = (ushort)((data[i++] << 8) + data[i++] ); 96 ushort uLength = (ushort)((data[i++] << 8) + data[i++]);
92 97
93 // Console.WriteLine("new utf8 type, length is " + uLength); 98 // Console.WriteLine("new utf8 type, length is " + uLength);
94 PoolUtf8 utf8 = new PoolUtf8(); 99 PoolUtf8 utf8 = new PoolUtf8();
95 utf8.readValue(data, ref i, uLength); 100 utf8.readValue(data, ref i, uLength);
96 this._constantsPool.Add(utf8); 101 this._constantsPool.Add(utf8);
97 break; 102 break;
98 case 3: //Int 103 case 3: //Int
99 break; 104 break;
105 case 4: //Float
106 break;
100 case 7: //Class 107 case 7: //Class
101 PoolClass pClass = new PoolClass(this); 108 PoolClass pClass = new PoolClass(this);
102 pClass.readValue(data, ref i); 109 pClass.readValue(data, ref i);
103 this._constantsPool.Add(pClass); 110 this._constantsPool.Add(pClass);
104 break; 111 break;
112 case 9: //FieldRef
113 PoolFieldRef pField = new PoolFieldRef(this);
114 pField.readValue(data, ref i);
115 this._constantsPool.Add(pField);
116 break;
105 case 10: //Method 117 case 10: //Method
106 PoolMethodRef pMeth = new PoolMethodRef(this); 118 PoolMethodRef pMeth = new PoolMethodRef(this);
107 pMeth.readValue(data, ref i); 119 pMeth.readValue(data, ref i);
@@ -115,9 +127,9 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
115 } 127 }
116 } 128 }
117 129
118 _accessFlags = (ushort)((data[i++] << 8) + data[i++] ); 130 _accessFlags = (ushort)((data[i++] << 8) + data[i++]);
119 _thisClass = (ushort)((data[i++] << 8) + data[i++] ); 131 _thisClass = (ushort)((data[i++] << 8) + data[i++]);
120 _supperClass = (ushort)((data[i++] << 8) + data[i++] ); 132 _supperClass = (ushort)((data[i++] << 8) + data[i++]);
121 133
122 if (this._constantsPool[this._thisClass - 1] is PoolClass) 134 if (this._constantsPool[this._thisClass - 1] is PoolClass)
123 { 135 {
@@ -126,8 +138,16 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
126 138
127 _interfaceCount = (ushort)((data[i++] << 8) + data[i++]); 139 _interfaceCount = (ushort)((data[i++] << 8) + data[i++]);
128 //should now read in the info for each interface 140 //should now read in the info for each interface
141
129 _fieldCount = (ushort)((data[i++] << 8) + data[i++]); 142 _fieldCount = (ushort)((data[i++] << 8) + data[i++]);
130 //should now read in the info for each field 143 //should now read in the info for each field
144 for (int count = 0; count < _fieldCount; count++)
145 {
146 FieldInfo fieldInf = new FieldInfo(this);
147 fieldInf.ReadData(data, ref i);
148 this._fieldList.Add(fieldInf);
149 }
150
131 _methodCount = (ushort)((data[i++] << 8) + data[i++]); 151 _methodCount = (ushort)((data[i++] << 8) + data[i++]);
132 for (int count = 0; count < _methodCount; count++) 152 for (int count = 0; count < _methodCount; count++)
133 { 153 {
@@ -149,9 +169,9 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
149 { 169 {
150 for (int count = 0; count < _methodCount; count++) 170 for (int count = 0; count < _methodCount; count++)
151 { 171 {
152 if (this._constantsPool[this._methodsList[count].NameIndex-1] is PoolUtf8) 172 if (this._constantsPool[this._methodsList[count].NameIndex - 1] is PoolUtf8)
153 { 173 {
154 if (((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex-1]).Value == methodName) 174 if (((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value == methodName)
155 { 175 {
156 //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value); 176 //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value);
157 thread.SetPC(this._methodsList[count].CodePointer); 177 thread.SetPC(this._methodsList[count].CodePointer);
@@ -165,8 +185,8 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
165 public void PrintToConsole() 185 public void PrintToConsole()
166 { 186 {
167 Console.WriteLine("Class File:"); 187 Console.WriteLine("Class File:");
168 Console.WriteLine("Major version: " + _majorVersion); 188 Console.WriteLine("Major version: " + _majorVersion);
169 Console.WriteLine("Minor version: " + _minorVersion); 189 Console.WriteLine("Minor version: " + _minorVersion);
170 Console.WriteLine("Pool size: " + _constantPoolCount); 190 Console.WriteLine("Pool size: " + _constantPoolCount);
171 191
172 for (int i = 0; i < _constantsPool.Count; i++) 192 for (int i = 0; i < _constantsPool.Count; i++)
@@ -174,9 +194,15 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
174 this._constantsPool[i].Print(); 194 this._constantsPool[i].Print();
175 } 195 }
176 196
177 Console.WriteLine("Access flags: " + _accessFlags); 197 Console.WriteLine("Access flags: " + _accessFlags);
178 Console.WriteLine("This class: " + _thisClass ); 198 Console.WriteLine("This class: " + _thisClass);
179 Console.WriteLine("Super class: " + _supperClass); 199 Console.WriteLine("Super class: " + _supperClass);
200
201 for (int count = 0; count < _fieldCount; count++)
202 {
203 Console.WriteLine();
204 this._fieldList[count].Print();
205 }
180 206
181 for (int count = 0; count < _methodCount; count++) 207 for (int count = 0; count < _methodCount; count++)
182 { 208 {
@@ -184,7 +210,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
184 this._methodsList[count].Print(); 210 this._methodsList[count].Print();
185 } 211 }
186 212
187 Console.WriteLine("class name is " + this.mClass.Name.Value); 213 Console.WriteLine("class name is " + this.mClass.Name.Value);
188 } 214 }
189 215
190 public static byte[] ReadFully(Stream stream) 216 public static byte[] ReadFully(Stream stream)
@@ -215,32 +241,32 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
215 { 241 {
216 public string Value = ""; 242 public string Value = "";
217 243
218 public void readValue(byte[] data,ref int pointer , int length) 244 public void readValue(byte[] data, ref int pointer, int length)
219 { 245 {
220 for (int i = 0; i < length; i++) 246 for (int i = 0; i < length; i++)
221 { 247 {
222 int a =(int) data[pointer++]; 248 int a = (int)data[pointer++];
223 if ((a & 0x80) == 0) 249 if ((a & 0x80) == 0)
224 { 250 {
225 Value = Value + (char)a; 251 Value = Value + (char)a;
226 } 252 }
227 else if ((a & 0x20) == 0) 253 else if ((a & 0x20) == 0)
228 { 254 {
229 int b = (int) data[pointer++]; 255 int b = (int)data[pointer++];
230 Value = Value + (char)(((a & 0x1f) << 6) + (b & 0x3f)); 256 Value = Value + (char)(((a & 0x1f) << 6) + (b & 0x3f));
231 } 257 }
232 else 258 else
233 { 259 {
234 int b = (int)data[pointer++]; 260 int b = (int)data[pointer++];
235 int c = (int)data[pointer++]; 261 int c = (int)data[pointer++];
236 Value = Value + (char)(((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f)); 262 Value = Value + (char)(((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f));
237 } 263 }
238 } 264 }
239 } 265 }
240 266
241 public override void Print() 267 public override void Print()
242 { 268 {
243 Console.WriteLine("Utf8 type: " + Value); 269 Console.WriteLine("Utf8 type: " + Value);
244 } 270 }
245 } 271 }
246 272
@@ -263,7 +289,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
263 289
264 public void readValue(byte[] data, ref int pointer) 290 public void readValue(byte[] data, ref int pointer)
265 { 291 {
266 namePointer = (ushort)((data[pointer++] << 8) + data[pointer++] ); 292 namePointer = (ushort)((data[pointer++] << 8) + data[pointer++]);
267 } 293 }
268 294
269 public override void Print() 295 public override void Print()
@@ -271,7 +297,34 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
271 this.Name = ((PoolUtf8)this.parent._constantsPool[namePointer - 1]); 297 this.Name = ((PoolUtf8)this.parent._constantsPool[namePointer - 1]);
272 Console.Write("Class type: " + namePointer); 298 Console.Write("Class type: " + namePointer);
273 Console.WriteLine(" // " + ((PoolUtf8)this.parent._constantsPool[namePointer - 1]).Value); 299 Console.WriteLine(" // " + ((PoolUtf8)this.parent._constantsPool[namePointer - 1]).Value);
274 300
301 }
302 }
303
304 public class PoolFieldRef : PoolItem
305 {
306 public ushort classPointer = 0;
307 public ushort nameTypePointer = 0;
308 public PoolNamedType mNameType;
309 public PoolClass mClass;
310 private ClassRecord parent;
311
312 public PoolFieldRef(ClassRecord paren)
313 {
314 parent = paren;
315 }
316
317 public void readValue(byte[] data, ref int pointer)
318 {
319 classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]);
320 nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]);
321 }
322
323 public override void Print()
324 {
325 this.mNameType = ((PoolNamedType)this.parent._constantsPool[nameTypePointer - 1]);
326 this.mClass = ((PoolClass)this.parent._constantsPool[classPointer - 1]);
327 Console.WriteLine("FieldRef type: " + classPointer + " , " + nameTypePointer);
275 } 328 }
276 } 329 }
277 330
@@ -298,7 +351,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
298 { 351 {
299 this.mNameType = ((PoolNamedType)this.parent._constantsPool[nameTypePointer - 1]); 352 this.mNameType = ((PoolNamedType)this.parent._constantsPool[nameTypePointer - 1]);
300 this.mClass = ((PoolClass)this.parent._constantsPool[classPointer - 1]); 353 this.mClass = ((PoolClass)this.parent._constantsPool[classPointer - 1]);
301 Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer); 354 Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer);
302 } 355 }
303 } 356 }
304 357
@@ -317,16 +370,16 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
317 370
318 public void readValue(byte[] data, ref int pointer) 371 public void readValue(byte[] data, ref int pointer)
319 { 372 {
320 namePointer = (ushort)((data[pointer++] << 8) + data[pointer++] ); 373 namePointer = (ushort)((data[pointer++] << 8) + data[pointer++]);
321 typePointer = (ushort)((data[pointer++] << 8) + data[pointer++] ); 374 typePointer = (ushort)((data[pointer++] << 8) + data[pointer++]);
322 } 375 }
323 376
324 public override void Print() 377 public override void Print()
325 { 378 {
326 Name = ((PoolUtf8)this.parent._constantsPool[namePointer-1]); 379 Name = ((PoolUtf8)this.parent._constantsPool[namePointer - 1]);
327 Type = ((PoolUtf8)this.parent._constantsPool[typePointer-1]); 380 Type = ((PoolUtf8)this.parent._constantsPool[typePointer - 1]);
328 Console.Write("Named type: " + namePointer + " , " + typePointer ); 381 Console.Write("Named type: " + namePointer + " , " + typePointer);
329 Console.WriteLine(" // "+ ((PoolUtf8)this.parent._constantsPool[namePointer-1]).Value); 382 Console.WriteLine(" // " + ((PoolUtf8)this.parent._constantsPool[namePointer - 1]).Value);
330 } 383 }
331 } 384 }
332 385
@@ -341,7 +394,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
341 public List<MethodAttribute> Attributes = new List<MethodAttribute>(); 394 public List<MethodAttribute> Attributes = new List<MethodAttribute>();
342 private ClassRecord parent; 395 private ClassRecord parent;
343 public int CodePointer = 0; 396 public int CodePointer = 0;
344 397
345 public MethodInfo(ClassRecord paren) 398 public MethodInfo(ClassRecord paren)
346 { 399 {
347 parent = paren; 400 parent = paren;
@@ -361,7 +414,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
361 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 414 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]);
362 DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 415 DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]);
363 AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); 416 AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]);
364 for(int i =0; i< AttributeCount; i++) 417 for (int i = 0; i < AttributeCount; i++)
365 { 418 {
366 MethodAttribute attri = new MethodAttribute(this.parent); 419 MethodAttribute attri = new MethodAttribute(this.parent);
367 attri.ReadData(data, ref pointer); 420 attri.ReadData(data, ref pointer);
@@ -371,11 +424,11 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
371 424
372 public void Print() 425 public void Print()
373 { 426 {
374 Console.WriteLine("Method Info Struct: "); 427 Console.WriteLine("Method Info Struct: ");
375 Console.WriteLine("AccessFlags: " + AccessFlags); 428 Console.WriteLine("AccessFlags: " + AccessFlags);
376 Console.WriteLine("NameIndex: " + NameIndex +" // "+ ((PoolUtf8)this.parent._constantsPool[NameIndex-1]).Value); 429 Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value);
377 Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // "+ ((PoolUtf8)this.parent._constantsPool[DescriptorIndex-1]).Value); 430 Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent._constantsPool[DescriptorIndex - 1]).Value);
378 Console.WriteLine("Attribute Count:" + AttributeCount); 431 Console.WriteLine("Attribute Count:" + AttributeCount);
379 for (int i = 0; i < AttributeCount; i++) 432 for (int i = 0; i < AttributeCount; i++)
380 { 433 {
381 this.Attributes[i].Print(); 434 this.Attributes[i].Print();
@@ -426,12 +479,12 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
426 479
427 public void Print() 480 public void Print()
428 { 481 {
429 Console.WriteLine("Method Attribute: "); 482 Console.WriteLine("Method Attribute: ");
430 Console.WriteLine("Name Index: " + NameIndex + " // "+ ((PoolUtf8)this.parent._constantsPool[NameIndex-1]).Value); 483 Console.WriteLine("Name Index: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value);
431 Console.WriteLine("Length: " + Length); 484 Console.WriteLine("Length: " + Length);
432 Console.WriteLine("MaxStack: " + MaxStack); 485 Console.WriteLine("MaxStack: " + MaxStack);
433 Console.WriteLine("MaxLocals: " + MaxLocals); 486 Console.WriteLine("MaxLocals: " + MaxLocals);
434 Console.WriteLine("CodeLength: " + CodeLength); 487 Console.WriteLine("CodeLength: " + CodeLength);
435 for (int i = 0; i < Code.Length; i++) 488 for (int i = 0; i < Code.Length; i++)
436 { 489 {
437 Console.WriteLine("OpCode #" + i + " is: " + Code[i]); 490 Console.WriteLine("OpCode #" + i + " is: " + Code[i]);
@@ -483,13 +536,97 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
483 536
484 } 537 }
485 } 538 }
486 private class FieldInfo 539
540 public class FieldInfo
487 { 541 {
488 public void ReadData(byte[] data, ref int i) 542 public ushort AccessFlags = 0;
543 public ushort NameIndex = 0;
544 public string Name = "";
545 public ushort DescriptorIndex = 0;
546 public ushort AttributeCount = 0;
547 public List<FieldAttribute> Attributes = new List<FieldAttribute>();
548 private ClassRecord parent;
549
550 public FieldInfo(ClassRecord paren)
489 { 551 {
552 parent = paren;
553 }
490 554
555 public void ReadData(byte[] data, ref int pointer)
556 {
557 AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]);
558 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]);
559 DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]);
560 AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]);
561 for (int i = 0; i < AttributeCount; i++)
562 {
563 FieldAttribute attri = new FieldAttribute(this.parent);
564 attri.ReadData(data, ref pointer);
565 this.Attributes.Add(attri);
566 }
567 }
568
569 public void Print()
570 {
571 Console.WriteLine("Field Info Struct: ");
572 Console.WriteLine("AccessFlags: " + AccessFlags);
573 Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value);
574 Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent._constantsPool[DescriptorIndex - 1]).Value);
575 Console.WriteLine("Attribute Count:" + AttributeCount);
576 //if static, add to static field list
577 // if (this.AccessFlags == 9) //public and static
578 if ((this.AccessFlags & 0x08) != 0)
579 {
580 switch (((PoolUtf8)this.parent._constantsPool[DescriptorIndex - 1]).Value)
581 {
582 case "I":
583 Int newin = new Int();
584 this.parent.StaticFields.Add(((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value, newin);
585 break;
586 case "F":
587 Float newfl = new Float();
588 this.parent.StaticFields.Add(((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value, newfl);
589 break;
590 }
591
592 }
593 for (int i = 0; i < AttributeCount; i++)
594 {
595 this.Attributes[i].Print();
596 }
597 }
598
599 public class FieldAttribute
600 {
601 public ushort NameIndex = 0;
602 public string Name = "";
603 public Int32 Length = 0;
604 public byte[] Data;
605 private ClassRecord parent;
606
607 public FieldAttribute(ClassRecord paren)
608 {
609 parent = paren;
610 }
611
612 public void ReadData(byte[] data, ref int pointer)
613 {
614 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]);
615 Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]);
616 Data = new byte[Length];
617 for (int i = 0; i < Length; i++)
618 {
619 Data[i] = data[pointer++];
620 }
621 }
622
623 public void Print()
624 {
625 Console.WriteLine("FieldAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value);
626 }
491 } 627 }
492 } 628 }
629
493 private class AttributeInfo 630 private class AttributeInfo
494 { 631 {
495 public void ReadData(byte[] data, ref int i) 632 public void ReadData(byte[] data, ref int i)
@@ -500,4 +637,4 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
500 #endregion 637 #endregion
501 638
502 } 639 }
503} 640} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs
index 56135d3..6f8d70c 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs
@@ -42,66 +42,66 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
42 bool result = false; 42 bool result = false;
43 switch (opcode) 43 switch (opcode)
44 { 44 {
45 case 2: 45 case (byte)(byte)OpCode.iconst_m1:
46 Int m_int= new Int(); 46 Int m_int = new Int();
47 m_int.mValue = -1; 47 m_int.mValue = -1;
48 this._mThread.currentFrame.OpStack.Push(m_int); 48 this._mThread.currentFrame.OpStack.Push(m_int);
49 result = true; 49 result = true;
50 break; 50 break;
51 case 3: 51 case (byte)(byte)OpCode.iconst_0:
52 m_int= new Int(); 52 m_int = new Int();
53 m_int.mValue = 0; 53 m_int.mValue = 0;
54 this._mThread.currentFrame.OpStack.Push(m_int); 54 this._mThread.currentFrame.OpStack.Push(m_int);
55 result = true; 55 result = true;
56 break; 56 break;
57 case 4: 57 case (byte)(byte)OpCode.iconst_1:
58 m_int = new Int(); 58 m_int = new Int();
59 m_int.mValue = 1; 59 m_int.mValue = 1;
60 this._mThread.currentFrame.OpStack.Push(m_int); 60 this._mThread.currentFrame.OpStack.Push(m_int);
61 result = true; 61 result = true;
62 break; 62 break;
63 case 5: 63 case (byte)(byte)OpCode.iconst_2:
64 m_int = new Int(); 64 m_int = new Int();
65 m_int.mValue = 2; 65 m_int.mValue = 2;
66 this._mThread.currentFrame.OpStack.Push(m_int); 66 this._mThread.currentFrame.OpStack.Push(m_int);
67 result = true; 67 result = true;
68 break; 68 break;
69 case 6: 69 case (byte)(byte)OpCode.iconst_3:
70 m_int = new Int(); 70 m_int = new Int();
71 m_int.mValue = 3; 71 m_int.mValue = 3;
72 this._mThread.currentFrame.OpStack.Push(m_int); 72 this._mThread.currentFrame.OpStack.Push(m_int);
73 break; 73 break;
74 case 7: 74 case (byte)(byte)OpCode.iconst_4:
75 m_int = new Int(); 75 m_int = new Int();
76 m_int.mValue = 4; 76 m_int.mValue = 4;
77 this._mThread.currentFrame.OpStack.Push(m_int); 77 this._mThread.currentFrame.OpStack.Push(m_int);
78 result = true; 78 result = true;
79 break; 79 break;
80 case 8: 80 case (byte)OpCode.iconst_5:
81 m_int = new Int(); 81 m_int = new Int();
82 m_int.mValue = 5; 82 m_int.mValue = 5;
83 this._mThread.currentFrame.OpStack.Push(m_int); 83 this._mThread.currentFrame.OpStack.Push(m_int);
84 result = true; 84 result = true;
85 break; 85 break;
86 case 11: 86 case (byte)OpCode.fconst_0:
87 Float m_float = new Float(); 87 Float m_float = new Float();
88 m_float.mValue = 0.0f; 88 m_float.mValue = 0.0f;
89 this._mThread.currentFrame.OpStack.Push(m_float); 89 this._mThread.currentFrame.OpStack.Push(m_float);
90 result = true; 90 result = true;
91 break; 91 break;
92 case 12: 92 case (byte)OpCode.fconst_1:
93 m_float = new Float(); 93 m_float = new Float();
94 m_float.mValue = 1.0f; 94 m_float.mValue = 1.0f;
95 this._mThread.currentFrame.OpStack.Push(m_float); 95 this._mThread.currentFrame.OpStack.Push(m_float);
96 result = true; 96 result = true;
97 break; 97 break;
98 case 13: 98 case (byte)OpCode.fconst_2:
99 m_float = new Float(); 99 m_float = new Float();
100 m_float.mValue = 2.0f; 100 m_float.mValue = 2.0f;
101 this._mThread.currentFrame.OpStack.Push(m_float); 101 this._mThread.currentFrame.OpStack.Push(m_float);
102 result = true; 102 result = true;
103 break; 103 break;
104 case 16: 104 case (byte)OpCode.bipush: //is this right? this should be pushing a byte onto stack not int?
105 int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]; 105 int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC];
106 Int pushInt = new Int(); 106 Int pushInt = new Int();
107 pushInt.mValue = pushvalue; 107 pushInt.mValue = pushvalue;
@@ -109,7 +109,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
109 this._mThread.PC++; 109 this._mThread.PC++;
110 result = true; 110 result = true;
111 break; 111 break;
112 case 17: 112 case (byte)OpCode.sipush:
113 short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); 113 short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
114 Int pushInt2 = new Int(); 114 Int pushInt2 = new Int();
115 pushInt2.mValue = pushvalue2; 115 pushInt2.mValue = pushvalue2;
@@ -117,7 +117,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
117 this._mThread.PC += 2; 117 this._mThread.PC += 2;
118 result = true; 118 result = true;
119 break; 119 break;
120 case 23: 120 case (byte)OpCode.fload:
121 short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC])); 121 short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]));
122 Float fload = new Float(); 122 Float fload = new Float();
123 if (this._mThread.currentFrame.LocalVariables[findex1] != null) 123 if (this._mThread.currentFrame.LocalVariables[findex1] != null)
@@ -131,7 +131,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
131 this._mThread.PC++; 131 this._mThread.PC++;
132 result = true; 132 result = true;
133 break; 133 break;
134 case 26: 134 case (byte)OpCode.iload_0:
135 if (this._mThread.currentFrame.LocalVariables[0] != null) 135 if (this._mThread.currentFrame.LocalVariables[0] != null)
136 { 136 {
137 if (this._mThread.currentFrame.LocalVariables[0] is Int) 137 if (this._mThread.currentFrame.LocalVariables[0] is Int)
@@ -143,7 +143,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
143 } 143 }
144 result = true; 144 result = true;
145 break; 145 break;
146 case 27: 146 case (byte)OpCode.iload_1:
147 if (this._mThread.currentFrame.LocalVariables[1] != null) 147 if (this._mThread.currentFrame.LocalVariables[1] != null)
148 { 148 {
149 if (this._mThread.currentFrame.LocalVariables[1] is Int) 149 if (this._mThread.currentFrame.LocalVariables[1] is Int)
@@ -155,7 +155,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
155 } 155 }
156 result = true; 156 result = true;
157 break; 157 break;
158 case 34: 158 case (byte)OpCode.fload_0:
159 if (this._mThread.currentFrame.LocalVariables[0] != null) 159 if (this._mThread.currentFrame.LocalVariables[0] != null)
160 { 160 {
161 if (this._mThread.currentFrame.LocalVariables[0] is Float) 161 if (this._mThread.currentFrame.LocalVariables[0] is Float)
@@ -167,7 +167,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
167 } 167 }
168 result = true; 168 result = true;
169 break; 169 break;
170 case 35: 170 case (byte)OpCode.fload_1:
171 if (this._mThread.currentFrame.LocalVariables[1] != null) 171 if (this._mThread.currentFrame.LocalVariables[1] != null)
172 { 172 {
173 if (this._mThread.currentFrame.LocalVariables[1] is Float) 173 if (this._mThread.currentFrame.LocalVariables[1] is Float)
@@ -179,7 +179,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
179 } 179 }
180 result = true; 180 result = true;
181 break; 181 break;
182 case 36: 182 case (byte)OpCode.fload_2:
183 if (this._mThread.currentFrame.LocalVariables[2] != null) 183 if (this._mThread.currentFrame.LocalVariables[2] != null)
184 { 184 {
185 if (this._mThread.currentFrame.LocalVariables[2] is Float) 185 if (this._mThread.currentFrame.LocalVariables[2] is Float)
@@ -191,7 +191,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
191 } 191 }
192 result = true; 192 result = true;
193 break; 193 break;
194 case 37: 194 case (byte)OpCode.fload_3:
195 if (this._mThread.currentFrame.LocalVariables[3] != null) 195 if (this._mThread.currentFrame.LocalVariables[3] != null)
196 { 196 {
197 if (this._mThread.currentFrame.LocalVariables[3] is Float) 197 if (this._mThread.currentFrame.LocalVariables[3] is Float)
@@ -203,8 +203,18 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
203 } 203 }
204 result = true; 204 result = true;
205 break; 205 break;
206 case 56: 206 case (byte)OpCode.istore:
207 short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] )); 207 short findex3 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]));
208 BaseType istor = this._mThread.currentFrame.OpStack.Pop();
209 if (istor is Int)
210 {
211 this._mThread.currentFrame.LocalVariables[findex3] = (Int)istor;
212 }
213 this._mThread.PC++;
214 result = true;
215 break;
216 case (byte)OpCode.fstore:
217 short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]));
208 BaseType fstor = this._mThread.currentFrame.OpStack.Pop(); 218 BaseType fstor = this._mThread.currentFrame.OpStack.Pop();
209 if (fstor is Float) 219 if (fstor is Float)
210 { 220 {
@@ -213,7 +223,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
213 this._mThread.PC++; 223 this._mThread.PC++;
214 result = true; 224 result = true;
215 break; 225 break;
216 case 59: 226 case (byte)OpCode.istore_0:
217 BaseType baset = this._mThread.currentFrame.OpStack.Pop(); 227 BaseType baset = this._mThread.currentFrame.OpStack.Pop();
218 if (baset is Int) 228 if (baset is Int)
219 { 229 {
@@ -221,7 +231,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
221 } 231 }
222 result = true; 232 result = true;
223 break; 233 break;
224 case 60: 234 case (byte)OpCode.istore_1:
225 baset = this._mThread.currentFrame.OpStack.Pop(); 235 baset = this._mThread.currentFrame.OpStack.Pop();
226 if (baset is Int) 236 if (baset is Int)
227 { 237 {
@@ -229,7 +239,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
229 } 239 }
230 result = true; 240 result = true;
231 break; 241 break;
232 case 67: 242 case (byte)OpCode.fstore_0:
233 baset = this._mThread.currentFrame.OpStack.Pop(); 243 baset = this._mThread.currentFrame.OpStack.Pop();
234 if (baset is Float) 244 if (baset is Float)
235 { 245 {
@@ -237,7 +247,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
237 } 247 }
238 result = true; 248 result = true;
239 break; 249 break;
240 case 68: 250 case (byte)OpCode.fstore_1:
241 baset = this._mThread.currentFrame.OpStack.Pop(); 251 baset = this._mThread.currentFrame.OpStack.Pop();
242 if (baset is Float) 252 if (baset is Float)
243 { 253 {
@@ -245,7 +255,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
245 } 255 }
246 result = true; 256 result = true;
247 break; 257 break;
248 case 69: 258 case (byte)OpCode.fstore_2:
249 baset = this._mThread.currentFrame.OpStack.Pop(); 259 baset = this._mThread.currentFrame.OpStack.Pop();
250 if (baset is Float) 260 if (baset is Float)
251 { 261 {
@@ -253,7 +263,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
253 } 263 }
254 result = true; 264 result = true;
255 break; 265 break;
256 case 70: 266 case (byte)OpCode.fstore_3:
257 baset = this._mThread.currentFrame.OpStack.Pop(); 267 baset = this._mThread.currentFrame.OpStack.Pop();
258 if (baset is Float) 268 if (baset is Float)
259 { 269 {
@@ -261,11 +271,11 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
261 } 271 }
262 result = true; 272 result = true;
263 break; 273 break;
264 case 87: 274 case (byte)OpCode.pop:
265 this._mThread.currentFrame.OpStack.Pop(); 275 this._mThread.currentFrame.OpStack.Pop();
266 result = true; 276 result = true;
267 break; 277 break;
268 case 98: 278 case (byte)OpCode.fadd:
269 BaseType bf2 = this._mThread.currentFrame.OpStack.Pop(); 279 BaseType bf2 = this._mThread.currentFrame.OpStack.Pop();
270 BaseType bf1 = this._mThread.currentFrame.OpStack.Pop(); 280 BaseType bf1 = this._mThread.currentFrame.OpStack.Pop();
271 if (bf1 is Float && bf2 is Float) 281 if (bf1 is Float && bf2 is Float)
@@ -276,7 +286,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
276 } 286 }
277 result = true; 287 result = true;
278 break; 288 break;
279 case 102: 289 case (byte)OpCode.fsub:
280 BaseType bsf2 = this._mThread.currentFrame.OpStack.Pop(); 290 BaseType bsf2 = this._mThread.currentFrame.OpStack.Pop();
281 BaseType bsf1 = this._mThread.currentFrame.OpStack.Pop(); 291 BaseType bsf1 = this._mThread.currentFrame.OpStack.Pop();
282 if (bsf1 is Float && bsf2 is Float) 292 if (bsf1 is Float && bsf2 is Float)
@@ -287,7 +297,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
287 } 297 }
288 result = true; 298 result = true;
289 break; 299 break;
290 case 104: //check the order of the two values off the stack is correct 300 case (byte)OpCode.imul: //check the order of the two values off the stack is correct
291 BaseType bs2 = this._mThread.currentFrame.OpStack.Pop(); 301 BaseType bs2 = this._mThread.currentFrame.OpStack.Pop();
292 BaseType bs1 = this._mThread.currentFrame.OpStack.Pop(); 302 BaseType bs1 = this._mThread.currentFrame.OpStack.Pop();
293 if (bs1 is Int && bs2 is Int) 303 if (bs1 is Int && bs2 is Int)
@@ -298,18 +308,18 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
298 } 308 }
299 result = true; 309 result = true;
300 break; 310 break;
301 case 132: 311 case (byte)OpCode.iinc:
302 if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] != null) 312 if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] != null)
303 { 313 {
304 if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] is Int) 314 if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] is Int)
305 { 315 {
306 ((Int)this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]]).mValue += (sbyte) GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]; 316 ((Int)this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]]).mValue += (sbyte)GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1];
307 } 317 }
308 } 318 }
309 this._mThread.PC += 2; 319 this._mThread.PC += 2;
310 result = true; 320 result = true;
311 break; 321 break;
312 case 139: 322 case (byte)OpCode.f2i:
313 BaseType conv1 = this._mThread.currentFrame.OpStack.Pop(); 323 BaseType conv1 = this._mThread.currentFrame.OpStack.Pop();
314 if (conv1 is Float) 324 if (conv1 is Float)
315 { 325 {
@@ -319,7 +329,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
319 } 329 }
320 result = true; 330 result = true;
321 break; 331 break;
322 case 149: 332 case (byte)OpCode.fcmpl:
323 BaseType flcom2 = this._mThread.currentFrame.OpStack.Pop(); 333 BaseType flcom2 = this._mThread.currentFrame.OpStack.Pop();
324 BaseType flcom1 = this._mThread.currentFrame.OpStack.Pop(); 334 BaseType flcom1 = this._mThread.currentFrame.OpStack.Pop();
325 if (flcom1 is Float && flcom2 is Float) 335 if (flcom1 is Float && flcom2 is Float)
@@ -341,7 +351,49 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
341 } 351 }
342 result = true; 352 result = true;
343 break; 353 break;
344 case 158: 354 case (byte)OpCode.fcmpg:
355 flcom2 = this._mThread.currentFrame.OpStack.Pop();
356 flcom1 = this._mThread.currentFrame.OpStack.Pop();
357 if (flcom1 is Float && flcom2 is Float)
358 {
359 Int compres = new Int();
360 if (((Float)flcom1).mValue < ((Float)flcom2).mValue)
361 {
362 compres.mValue = -1;
363 }
364 else if (((Float)flcom1).mValue > ((Float)flcom2).mValue)
365 {
366 compres.mValue = 1;
367 }
368 else
369 {
370 compres.mValue = 0;
371 }
372 this._mThread.currentFrame.OpStack.Push(compres);
373 }
374 result = true;
375 break;
376 case (byte)OpCode.ifge:
377 short compareoffset2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
378 BaseType compe1 = this._mThread.currentFrame.OpStack.Pop();
379 if (compe1 is Int)
380 {
381 if (((Int)compe1).mValue >= 0)
382 {
383 this._mThread.PC += -1 + compareoffset2;
384 }
385 else
386 {
387 this._mThread.PC += 2;
388 }
389 }
390 else
391 {
392 this._mThread.PC += 2;
393 }
394 result = true;
395 break;
396 case (byte)OpCode.ifle:
345 short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); 397 short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
346 BaseType comp1 = this._mThread.currentFrame.OpStack.Pop(); 398 BaseType comp1 = this._mThread.currentFrame.OpStack.Pop();
347 if (comp1 is Int) 399 if (comp1 is Int)
@@ -361,7 +413,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
361 } 413 }
362 result = true; 414 result = true;
363 break; 415 break;
364 case 162: 416 case (byte)OpCode.if_icmpge:
365 short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); 417 short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
366 BaseType bc2 = this._mThread.currentFrame.OpStack.Pop(); 418 BaseType bc2 = this._mThread.currentFrame.OpStack.Pop();
367 BaseType bc1 = this._mThread.currentFrame.OpStack.Pop(); 419 BaseType bc1 = this._mThread.currentFrame.OpStack.Pop();
@@ -370,8 +422,8 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
370 //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue); 422 //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue);
371 if (((Int)bc1).mValue >= ((Int)bc2).mValue) 423 if (((Int)bc1).mValue >= ((Int)bc2).mValue)
372 { 424 {
373 // Console.WriteLine("branch compare true , offset is " +compareoffset); 425 // Console.WriteLine("branch compare true , offset is " +compareoffset);
374 // Console.WriteLine("current PC is " + this._mThread.PC); 426 // Console.WriteLine("current PC is " + this._mThread.PC);
375 this._mThread.PC += -1 + compareoffset; 427 this._mThread.PC += -1 + compareoffset;
376 //Console.WriteLine("new PC is " + this._mThread.PC); 428 //Console.WriteLine("new PC is " + this._mThread.PC);
377 } 429 }
@@ -387,7 +439,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
387 } 439 }
388 result = true; 440 result = true;
389 break; 441 break;
390 case 164: 442 case (byte)OpCode.if_icmple:
391 short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); 443 short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
392 BaseType bcl2 = this._mThread.currentFrame.OpStack.Pop(); 444 BaseType bcl2 = this._mThread.currentFrame.OpStack.Pop();
393 BaseType bcl1 = this._mThread.currentFrame.OpStack.Pop(); 445 BaseType bcl1 = this._mThread.currentFrame.OpStack.Pop();
@@ -396,10 +448,10 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
396 //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue); 448 //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue);
397 if (((Int)bcl1).mValue <= ((Int)bcl2).mValue) 449 if (((Int)bcl1).mValue <= ((Int)bcl2).mValue)
398 { 450 {
399 // Console.WriteLine("branch compare true , offset is " + compareloffset); 451 // Console.WriteLine("branch compare true , offset is " + compareloffset);
400 // Console.WriteLine("current PC is " + this._mThread.PC); 452 // Console.WriteLine("current PC is " + this._mThread.PC);
401 this._mThread.PC += -1 + compareloffset; 453 this._mThread.PC += -1 + compareloffset;
402 // Console.WriteLine("new PC is " + this._mThread.PC); 454 // Console.WriteLine("new PC is " + this._mThread.PC);
403 } 455 }
404 else 456 else
405 { 457 {
@@ -413,15 +465,87 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
413 } 465 }
414 result = true; 466 result = true;
415 break; 467 break;
416 case 167: 468 case (byte)OpCode._goto:
417 short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]); 469 short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
418 this._mThread.PC += -1 + offset; 470 this._mThread.PC += -1 + offset;
419 result = true; 471 result = true;
420 break; 472 break;
473 case (byte)OpCode.getstatic:
474 short fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
475 if (this._mThread.currentClass._constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef)
476 {
477 if (((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this._mThread.currentClass.mClass.Name.Value)
478 {
479 //from this class
480 if (this._mThread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value))
481 {
482 if (this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float)
483 {
484 Float retFloat = new Float();
485 retFloat.mValue = ((Float)this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue;
486 this._mThread.currentFrame.OpStack.Push(retFloat);
487 }
488 else if (this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int)
489 {
490 Int retInt = new Int();
491 retInt.mValue = ((Int)this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue;
492 // Console.WriteLine("getting static field, " + retInt.mValue);
493 this._mThread.currentFrame.OpStack.Push(retInt);
494 }
495 }
496 }
497 else
498 {
499 //get from a different class
500 }
501 }
502 this._mThread.PC += 2;
503 result = true;
504 break;
505 case (byte)OpCode.putstatic:
506 fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
507 BaseType addstatic = this._mThread.currentFrame.OpStack.Pop();
508 if (this._mThread.currentClass._constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef)
509 {
510 if (((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this._mThread.currentClass.mClass.Name.Value)
511 {
512 // this class
513 if (this._mThread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value))
514 {
515 if (addstatic is Float)
516 {
517 if (this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float)
518 {
519 Float newf = new Float();
520 newf.mValue = ((Float)addstatic).mValue;
521 this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newf;
522 }
523 }
524 else if (addstatic is Int)
525 {
526 if (this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int)
527 {
528 //Console.WriteLine("setting static field to " + ((Int)addstatic).mValue);
529 Int newi = new Int();
530 newi.mValue = ((Int)addstatic).mValue;
531 this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newi;
532 }
533 }
534 }
535 }
536 else
537 {
538 // a different class
539 }
540 }
541 this._mThread.PC += 2;
542 result = true;
543 break;
544
421 } 545 }
422 546
423 return result; 547 return result;
424 } 548 }
425 } 549 }
426 } 550 }
427} 551} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/OpCodes.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/OpCodes.cs
new file mode 100644
index 0000000..22a9f12
--- /dev/null
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/OpCodes.cs
@@ -0,0 +1,56 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Region.Scripting.EmbeddedJVM
6{
7 public enum OpCode : byte
8 {
9 iconst_m1 = 2,
10 iconst_0 = 3,
11 iconst_1 = 4,
12 iconst_2 = 5,
13 iconst_3 = 6,
14 iconst_4 = 7,
15 iconst_5 = 8,
16 fconst_0 = 11,
17 fconst_1 = 12,
18 fconst_2 = 13,
19 bipush = 16,
20 sipush = 17,
21 fload = 23,
22 iload_0 = 26,
23 iload_1 = 27,
24 fload_0 = 34,
25 fload_1 = 35,
26 fload_2 = 36,
27 fload_3 = 37,
28 istore = 54,
29 fstore = 56,
30 istore_0 = 59,
31 istore_1 = 60,
32 istore_2 = 61,
33 istore_3 = 62,
34 fstore_0 = 67,
35 fstore_1 = 68,
36 fstore_2 = 69,
37 fstore_3 = 70,
38 pop = 87,
39 fadd = 98,
40 fsub = 102,
41 imul = 104,
42 iinc = 132,
43 f2i = 139,
44 fcmpl = 149,
45 fcmpg = 150,
46 ifge = 156,
47 ifgt = 157,
48 ifle = 158,
49 if_icmpge = 162,
50 if_icmpgt = 163,
51 if_icmple = 164,
52 _goto = 167,
53 getstatic = 178,
54 putstatic = 179
55 }
56}
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index f7d9b79..88740c5 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -157,6 +157,7 @@ namespace SimpleApp
157 157
158 public void SendAlertMessage(string message) { } 158 public void SendAlertMessage(string message) { }
159 public void SendAgentAlertMessage(string message, bool modal) { } 159 public void SendAgentAlertMessage(string message, bool modal) { }
160 public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) { }
160 161
161 public virtual void SendRegionHandshake(RegionInfo regionInfo) 162 public virtual void SendRegionHandshake(RegionInfo regionInfo)
162 { 163 {