diff options
author | Sean Dague | 2007-07-16 15:40:11 +0000 |
---|---|---|
committer | Sean Dague | 2007-07-16 15:40:11 +0000 |
commit | 2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6 (patch) | |
tree | e3f80ad51736cf17e856547b1bcf956010927434 /OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine | |
parent | *Trunk compiles now (diff) | |
download | opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.zip opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.gz opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.bz2 opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.xz |
changed to native line ending encoding
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine')
5 files changed, 1389 insertions, 1389 deletions
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs index 8b957d3..012a00e 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs | |||
@@ -1,140 +1,140 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Reflection; | 2 | using System.Reflection; |
3 | using System.Reflection.Emit; | 3 | using System.Reflection.Emit; |
4 | using System.Threading; | 4 | using System.Threading; |
5 | 5 | ||
6 | using OpenSim.Region.Scripting; | 6 | using OpenSim.Region.Scripting; |
7 | 7 | ||
8 | namespace OpenSim.ScriptEngines.LSL | 8 | namespace OpenSim.ScriptEngines.LSL |
9 | { | 9 | { |
10 | 10 | ||
11 | 11 | ||
12 | public class Engine | 12 | public class Engine |
13 | { | 13 | { |
14 | public void Start(ScriptInfo WorldAPI) | 14 | public void Start(ScriptInfo WorldAPI) |
15 | { | 15 | { |
16 | 16 | ||
17 | 17 | ||
18 | 18 | ||
19 | // Create Assembly Name | 19 | // Create Assembly Name |
20 | AssemblyName asmName = new AssemblyName(); | 20 | AssemblyName asmName = new AssemblyName(); |
21 | asmName.Name = "TestAssembly"; | 21 | asmName.Name = "TestAssembly"; |
22 | 22 | ||
23 | // Create Assembly | 23 | // Create Assembly |
24 | AssemblyBuilder asmBuilder = | 24 | AssemblyBuilder asmBuilder = |
25 | Thread.GetDomain().DefineDynamicAssembly | 25 | Thread.GetDomain().DefineDynamicAssembly |
26 | (asmName, AssemblyBuilderAccess.RunAndSave); | 26 | (asmName, AssemblyBuilderAccess.RunAndSave); |
27 | 27 | ||
28 | // Create a module (and save to disk) | 28 | // Create a module (and save to disk) |
29 | ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule | 29 | ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule |
30 | (asmName.Name, asmName.Name + ".dll"); | 30 | (asmName.Name, asmName.Name + ".dll"); |
31 | 31 | ||
32 | // Create a Class (/Type) | 32 | // Create a Class (/Type) |
33 | TypeBuilder typeBuilder = modBuilder.DefineType( | 33 | TypeBuilder typeBuilder = modBuilder.DefineType( |
34 | "MyClass", | 34 | "MyClass", |
35 | TypeAttributes.Public, | 35 | TypeAttributes.Public, |
36 | typeof(object), | 36 | typeof(object), |
37 | new Type[] { typeof(LSL_CLRInterface.LSLScript) }); | 37 | new Type[] { typeof(LSL_CLRInterface.LSLScript) }); |
38 | 38 | ||
39 | 39 | ||
40 | 40 | ||
41 | /* | 41 | /* |
42 | * Generate the IL itself | 42 | * Generate the IL itself |
43 | */ | 43 | */ |
44 | 44 | ||
45 | GenerateIL(WorldAPI, typeBuilder); | 45 | GenerateIL(WorldAPI, typeBuilder); |
46 | 46 | ||
47 | 47 | ||
48 | /* | 48 | /* |
49 | * Done generating, create a type and run it. | 49 | * Done generating, create a type and run it. |
50 | */ | 50 | */ |
51 | 51 | ||
52 | // Create type object for the class (after defining fields and methods) | 52 | // Create type object for the class (after defining fields and methods) |
53 | Type type = typeBuilder.CreateType(); | 53 | Type type = typeBuilder.CreateType(); |
54 | 54 | ||
55 | asmBuilder.Save("TestAssembly.dll"); | 55 | asmBuilder.Save("TestAssembly.dll"); |
56 | 56 | ||
57 | // Create an instance we can play with | 57 | // Create an instance we can play with |
58 | //LSLScript hello = (LSLScript)Activator.CreateInstance(type); | 58 | //LSLScript hello = (LSLScript)Activator.CreateInstance(type); |
59 | LSL_CLRInterface.LSLScript MyScript = (LSL_CLRInterface.LSLScript)Activator.CreateInstance(type); | 59 | LSL_CLRInterface.LSLScript MyScript = (LSL_CLRInterface.LSLScript)Activator.CreateInstance(type); |
60 | 60 | ||
61 | // Play with it | 61 | // Play with it |
62 | MyScript.event_state_entry("Test"); | 62 | MyScript.event_state_entry("Test"); |
63 | } | 63 | } |
64 | 64 | ||
65 | private void GenerateIL(ScriptInfo WorldAPI, TypeBuilder typeBuilder) | 65 | private void GenerateIL(ScriptInfo WorldAPI, TypeBuilder typeBuilder) |
66 | { | 66 | { |
67 | 67 | ||
68 | 68 | ||
69 | // For debug | 69 | // For debug |
70 | LSO_Parser LSOP = new LSO_Parser(); | 70 | LSO_Parser LSOP = new LSO_Parser(); |
71 | LSOP.ParseFile("LSO\\CloseToDefault.lso", WorldAPI, ref typeBuilder); | 71 | LSOP.ParseFile("LSO\\CloseToDefault.lso", WorldAPI, ref typeBuilder); |
72 | return; | 72 | return; |
73 | 73 | ||
74 | 74 | ||
75 | // Override a Method / Function | 75 | // Override a Method / Function |
76 | MethodBuilder methodBuilder = typeBuilder.DefineMethod("event_state_entry", | 76 | MethodBuilder methodBuilder = typeBuilder.DefineMethod("event_state_entry", |
77 | MethodAttributes.Private | MethodAttributes.Virtual, | 77 | MethodAttributes.Private | MethodAttributes.Virtual, |
78 | typeof(void), | 78 | typeof(void), |
79 | new Type[] { typeof(object) }); | 79 | new Type[] { typeof(object) }); |
80 | 80 | ||
81 | typeBuilder.DefineMethodOverride(methodBuilder, | 81 | typeBuilder.DefineMethodOverride(methodBuilder, |
82 | typeof(LSL_CLRInterface.LSLScript).GetMethod("event_state_entry")); | 82 | typeof(LSL_CLRInterface.LSLScript).GetMethod("event_state_entry")); |
83 | 83 | ||
84 | // Create the IL generator | 84 | // Create the IL generator |
85 | ILGenerator il = methodBuilder.GetILGenerator(); | 85 | ILGenerator il = methodBuilder.GetILGenerator(); |
86 | 86 | ||
87 | 87 | ||
88 | /* | 88 | /* |
89 | * TRY | 89 | * TRY |
90 | */ | 90 | */ |
91 | il.BeginExceptionBlock(); | 91 | il.BeginExceptionBlock(); |
92 | 92 | ||
93 | // Push "Hello World!" string to stack | 93 | // Push "Hello World!" string to stack |
94 | il.Emit(OpCodes.Ldstr, "Hello World!"); | 94 | il.Emit(OpCodes.Ldstr, "Hello World!"); |
95 | 95 | ||
96 | // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); | 96 | // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); |
97 | il.Emit(OpCodes.Call, typeof(Console).GetMethod | 97 | il.Emit(OpCodes.Call, typeof(Console).GetMethod |
98 | ("WriteLine", new Type[] { typeof(string) })); | 98 | ("WriteLine", new Type[] { typeof(string) })); |
99 | 99 | ||
100 | //il.EmitCall(OpCodes.Callvirt | 100 | //il.EmitCall(OpCodes.Callvirt |
101 | //il.Emit(OpCodes.Call, typeof(WorldAPI).GetMethod | 101 | //il.Emit(OpCodes.Call, typeof(WorldAPI).GetMethod |
102 | //("TestFunction")); | 102 | //("TestFunction")); |
103 | 103 | ||
104 | 104 | ||
105 | //il.ThrowException(typeof(NotSupportedException)); | 105 | //il.ThrowException(typeof(NotSupportedException)); |
106 | 106 | ||
107 | 107 | ||
108 | /* | 108 | /* |
109 | * CATCH | 109 | * CATCH |
110 | */ | 110 | */ |
111 | il.BeginCatchBlock(typeof(Exception)); | 111 | il.BeginCatchBlock(typeof(Exception)); |
112 | 112 | ||
113 | // Push "Hello World!" string to stack | 113 | // Push "Hello World!" string to stack |
114 | il.Emit(OpCodes.Ldstr, "Something went wrong: "); | 114 | il.Emit(OpCodes.Ldstr, "Something went wrong: "); |
115 | 115 | ||
116 | //call void [mscorlib]System.Console::WriteLine(string) | 116 | //call void [mscorlib]System.Console::WriteLine(string) |
117 | il.Emit(OpCodes.Call, typeof(Console).GetMethod | 117 | il.Emit(OpCodes.Call, typeof(Console).GetMethod |
118 | ("Write", new Type[] { typeof(string) })); | 118 | ("Write", new Type[] { typeof(string) })); |
119 | 119 | ||
120 | //callvirt instance string [mscorlib]System.Exception::get_Message() | 120 | //callvirt instance string [mscorlib]System.Exception::get_Message() |
121 | il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod | 121 | il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod |
122 | ("get_Message")); | 122 | ("get_Message")); |
123 | 123 | ||
124 | //call void [mscorlib]System.Console::WriteLine(string) | 124 | //call void [mscorlib]System.Console::WriteLine(string) |
125 | il.Emit(OpCodes.Call, typeof(Console).GetMethod | 125 | il.Emit(OpCodes.Call, typeof(Console).GetMethod |
126 | ("WriteLine", new Type[] { typeof(string) })); | 126 | ("WriteLine", new Type[] { typeof(string) })); |
127 | 127 | ||
128 | /* | 128 | /* |
129 | * END TRY | 129 | * END TRY |
130 | */ | 130 | */ |
131 | il.EndExceptionBlock(); | 131 | il.EndExceptionBlock(); |
132 | 132 | ||
133 | 133 | ||
134 | // Push "Return from current method, with return value if present" to stack | 134 | // Push "Return from current method, with return value if present" to stack |
135 | il.Emit(OpCodes.Ret); | 135 | il.Emit(OpCodes.Ret); |
136 | 136 | ||
137 | 137 | ||
138 | } | 138 | } |
139 | } | 139 | } |
140 | } | 140 | } |
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_CLRInterface.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_CLRInterface.cs index dc612ff..57bbf11 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_CLRInterface.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_CLRInterface.cs | |||
@@ -1,51 +1,51 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.ScriptEngines.LSL | 5 | namespace OpenSim.ScriptEngines.LSL |
6 | { | 6 | { |
7 | public class LSL_CLRInterface | 7 | public class LSL_CLRInterface |
8 | { | 8 | { |
9 | public interface LSLScript | 9 | public interface LSLScript |
10 | { | 10 | { |
11 | //public virtual void Run(object arg) | 11 | //public virtual void Run(object arg) |
12 | //{ | 12 | //{ |
13 | //} | 13 | //} |
14 | //void Run(object arg); | 14 | //void Run(object arg); |
15 | 15 | ||
16 | void event_state_entry(object arg); | 16 | void event_state_entry(object arg); |
17 | //void event_state_exit(); | 17 | //void event_state_exit(); |
18 | void event_touch_start(object arg); | 18 | void event_touch_start(object arg); |
19 | //void event_touch(); | 19 | //void event_touch(); |
20 | //void event_touch_end(); | 20 | //void event_touch_end(); |
21 | //void event_collision_start(); | 21 | //void event_collision_start(); |
22 | //void event_collision(); | 22 | //void event_collision(); |
23 | //void event_collision_end(); | 23 | //void event_collision_end(); |
24 | //void event_land_collision_start(); | 24 | //void event_land_collision_start(); |
25 | //void event_land_collision(); | 25 | //void event_land_collision(); |
26 | //void event_land_collision_end(); | 26 | //void event_land_collision_end(); |
27 | //void event_timer(); | 27 | //void event_timer(); |
28 | //void event_listen(); | 28 | //void event_listen(); |
29 | //void event_on_rez(); | 29 | //void event_on_rez(); |
30 | //void event_sensor(); | 30 | //void event_sensor(); |
31 | //void event_no_sensor(); | 31 | //void event_no_sensor(); |
32 | //void event_control(); | 32 | //void event_control(); |
33 | //void event_money(); | 33 | //void event_money(); |
34 | //void event_email(); | 34 | //void event_email(); |
35 | //void event_at_target(); | 35 | //void event_at_target(); |
36 | //void event_not_at_target(); | 36 | //void event_not_at_target(); |
37 | //void event_at_rot_target(); | 37 | //void event_at_rot_target(); |
38 | //void event_not_at_rot_target(); | 38 | //void event_not_at_rot_target(); |
39 | //void event_run_time_permissions(); | 39 | //void event_run_time_permissions(); |
40 | //void event_changed(); | 40 | //void event_changed(); |
41 | //void event_attach(); | 41 | //void event_attach(); |
42 | //void event_dataserver(); | 42 | //void event_dataserver(); |
43 | //void event_link_message(); | 43 | //void event_link_message(); |
44 | //void event_moving_start(); | 44 | //void event_moving_start(); |
45 | //void event_moving_end(); | 45 | //void event_moving_end(); |
46 | //void event_object_rez(); | 46 | //void event_object_rez(); |
47 | //void event_remote_data(); | 47 | //void event_remote_data(); |
48 | //void event_http_response(); | 48 | //void event_http_response(); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | } | 51 | } |
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Enums.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Enums.cs index edeccdd..b45abe0 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Enums.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Enums.cs | |||
@@ -1,485 +1,485 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.ScriptEngines.LSL | 5 | namespace OpenSim.ScriptEngines.LSL |
6 | { | 6 | { |
7 | static class LSO_Enums | 7 | static class LSO_Enums |
8 | { | 8 | { |
9 | 9 | ||
10 | public enum Variable_Type_Codes | 10 | public enum Variable_Type_Codes |
11 | { | 11 | { |
12 | Void = 0, | 12 | Void = 0, |
13 | Integer = 1, | 13 | Integer = 1, |
14 | Float = 2, | 14 | Float = 2, |
15 | String = 3, | 15 | String = 3, |
16 | Key = 4, | 16 | Key = 4, |
17 | Vector = 5, | 17 | Vector = 5, |
18 | Rotation = 6, | 18 | Rotation = 6, |
19 | List = 7 | 19 | List = 7 |
20 | } | 20 | } |
21 | public enum Event_Mask_Values | 21 | public enum Event_Mask_Values |
22 | { | 22 | { |
23 | state_entry = 0, | 23 | state_entry = 0, |
24 | state_exit = 1, | 24 | state_exit = 1, |
25 | touch_start = 2, | 25 | touch_start = 2, |
26 | touch = 3, | 26 | touch = 3, |
27 | touch_end = 4, | 27 | touch_end = 4, |
28 | collision_start = 5, | 28 | collision_start = 5, |
29 | collision = 6, | 29 | collision = 6, |
30 | collision_end = 7, | 30 | collision_end = 7, |
31 | land_collision_start = 8, | 31 | land_collision_start = 8, |
32 | land_collision = 9, | 32 | land_collision = 9, |
33 | land_collision_end = 10, | 33 | land_collision_end = 10, |
34 | timer = 11, | 34 | timer = 11, |
35 | listen = 12, | 35 | listen = 12, |
36 | on_rez = 13, | 36 | on_rez = 13, |
37 | sensor = 14, | 37 | sensor = 14, |
38 | no_sensor = 15, | 38 | no_sensor = 15, |
39 | control = 16, | 39 | control = 16, |
40 | money = 17, | 40 | money = 17, |
41 | email = 18, | 41 | email = 18, |
42 | at_target = 19, | 42 | at_target = 19, |
43 | not_at_target = 20, | 43 | not_at_target = 20, |
44 | at_rot_target = 21, | 44 | at_rot_target = 21, |
45 | not_at_rot_target = 22, | 45 | not_at_rot_target = 22, |
46 | run_time_permissions = 23, | 46 | run_time_permissions = 23, |
47 | changed = 24, | 47 | changed = 24, |
48 | attach = 25, | 48 | attach = 25, |
49 | dataserver = 26, | 49 | dataserver = 26, |
50 | link_message = 27, | 50 | link_message = 27, |
51 | moving_start = 28, | 51 | moving_start = 28, |
52 | moving_end = 29, | 52 | moving_end = 29, |
53 | object_rez = 30, | 53 | object_rez = 30, |
54 | remote_data = 31, | 54 | remote_data = 31, |
55 | http_response = 32 | 55 | http_response = 32 |
56 | } | 56 | } |
57 | public enum Operation_Table | 57 | public enum Operation_Table |
58 | { | 58 | { |
59 | NOOP = 0x0, | 59 | NOOP = 0x0, |
60 | POP = 0x1, | 60 | POP = 0x1, |
61 | POPS = 0x2, | 61 | POPS = 0x2, |
62 | POPL = 0x3, | 62 | POPL = 0x3, |
63 | POPV = 0x4, | 63 | POPV = 0x4, |
64 | POPQ = 0x5, | 64 | POPQ = 0x5, |
65 | POPARG = 0x6, | 65 | POPARG = 0x6, |
66 | POPIP = 0x7, | 66 | POPIP = 0x7, |
67 | POPBP = 0x8, | 67 | POPBP = 0x8, |
68 | POPSP = 0x9, | 68 | POPSP = 0x9, |
69 | POPSLR = 0xa, | 69 | POPSLR = 0xa, |
70 | DUP = 0x20, | 70 | DUP = 0x20, |
71 | DUPS = 0x21, | 71 | DUPS = 0x21, |
72 | DUPL = 0x22, | 72 | DUPL = 0x22, |
73 | DUPV = 0x23, | 73 | DUPV = 0x23, |
74 | DUPQ = 0x24, | 74 | DUPQ = 0x24, |
75 | STORE = 0x30, | 75 | STORE = 0x30, |
76 | STORES = 0x31, | 76 | STORES = 0x31, |
77 | STOREL = 0x32, | 77 | STOREL = 0x32, |
78 | STOREV = 0x33, | 78 | STOREV = 0x33, |
79 | STOREQ = 0x34, | 79 | STOREQ = 0x34, |
80 | STOREG = 0x35, | 80 | STOREG = 0x35, |
81 | STOREGS = 0x36, | 81 | STOREGS = 0x36, |
82 | STOREGL = 0x37, | 82 | STOREGL = 0x37, |
83 | STOREGV = 0x38, | 83 | STOREGV = 0x38, |
84 | STOREGQ = 0x39, | 84 | STOREGQ = 0x39, |
85 | LOADP = 0x3a, | 85 | LOADP = 0x3a, |
86 | LOADSP = 0x3b, | 86 | LOADSP = 0x3b, |
87 | LOADLP = 0x3c, | 87 | LOADLP = 0x3c, |
88 | LOADVP = 0x3d, | 88 | LOADVP = 0x3d, |
89 | LOADQP = 0x3e, | 89 | LOADQP = 0x3e, |
90 | LOADGP = 0x3f, | 90 | LOADGP = 0x3f, |
91 | LOADGSP = 0x40, | 91 | LOADGSP = 0x40, |
92 | LOADGLP = 0x41, | 92 | LOADGLP = 0x41, |
93 | LOADGVP = 0x42, | 93 | LOADGVP = 0x42, |
94 | LOADGQP = 0x43, | 94 | LOADGQP = 0x43, |
95 | PUSH = 0x50, | 95 | PUSH = 0x50, |
96 | PUSHS = 0x51, | 96 | PUSHS = 0x51, |
97 | PUSHL = 0x52, | 97 | PUSHL = 0x52, |
98 | PUSHV = 0x53, | 98 | PUSHV = 0x53, |
99 | PUSHQ = 0x54, | 99 | PUSHQ = 0x54, |
100 | PUSHG = 0x55, | 100 | PUSHG = 0x55, |
101 | PUSHGS = 0x56, | 101 | PUSHGS = 0x56, |
102 | PUSHGL = 0x57, | 102 | PUSHGL = 0x57, |
103 | PUSHGV = 0x58, | 103 | PUSHGV = 0x58, |
104 | PUSHGQ = 0x59, | 104 | PUSHGQ = 0x59, |
105 | PUSHIP = 0x5a, | 105 | PUSHIP = 0x5a, |
106 | PUSHBP = 0x5b, | 106 | PUSHBP = 0x5b, |
107 | PUSHSP = 0x5c, | 107 | PUSHSP = 0x5c, |
108 | PUSHARGB = 0x5d, | 108 | PUSHARGB = 0x5d, |
109 | PUSHARGI = 0x5e, | 109 | PUSHARGI = 0x5e, |
110 | PUSHARGF = 0x5f, | 110 | PUSHARGF = 0x5f, |
111 | PUSHARGS = 0x60, | 111 | PUSHARGS = 0x60, |
112 | PUSHARGV = 0x61, | 112 | PUSHARGV = 0x61, |
113 | PUSHARGQ = 0x62, | 113 | PUSHARGQ = 0x62, |
114 | PUSHE = 0x63, | 114 | PUSHE = 0x63, |
115 | PUSHEV = 0x64, | 115 | PUSHEV = 0x64, |
116 | PUSHEQ = 0x65, | 116 | PUSHEQ = 0x65, |
117 | PUSHARGE = 0x66, | 117 | PUSHARGE = 0x66, |
118 | ADD = 0x70, | 118 | ADD = 0x70, |
119 | SUB = 0x71, | 119 | SUB = 0x71, |
120 | MUL = 0x72, | 120 | MUL = 0x72, |
121 | DIV = 0x73, | 121 | DIV = 0x73, |
122 | MOD = 0x74, | 122 | MOD = 0x74, |
123 | EQ = 0x75, | 123 | EQ = 0x75, |
124 | NEQ = 0x76, | 124 | NEQ = 0x76, |
125 | LEQ = 0x77, | 125 | LEQ = 0x77, |
126 | GEQ = 0x78, | 126 | GEQ = 0x78, |
127 | LESS = 0x79, | 127 | LESS = 0x79, |
128 | GREATER = 0x7a, | 128 | GREATER = 0x7a, |
129 | BITAND = 0x7b, | 129 | BITAND = 0x7b, |
130 | BITOR = 0x7c, | 130 | BITOR = 0x7c, |
131 | BITXOR = 0x7d, | 131 | BITXOR = 0x7d, |
132 | BOOLAND = 0x7e, | 132 | BOOLAND = 0x7e, |
133 | BOOLOR = 0x7f, | 133 | BOOLOR = 0x7f, |
134 | NEG = 0x80, | 134 | NEG = 0x80, |
135 | BITNOT = 0x81, | 135 | BITNOT = 0x81, |
136 | BOOLNOT = 0x82, | 136 | BOOLNOT = 0x82, |
137 | JUMP = 0x90, | 137 | JUMP = 0x90, |
138 | JUMPIF = 0x91, | 138 | JUMPIF = 0x91, |
139 | JUMPNIF = 0x92, | 139 | JUMPNIF = 0x92, |
140 | STATE = 0x93, | 140 | STATE = 0x93, |
141 | CALL = 0x94, | 141 | CALL = 0x94, |
142 | RETURN = 0x95, | 142 | RETURN = 0x95, |
143 | CAST = 0xa0, | 143 | CAST = 0xa0, |
144 | STACKTOS = 0xb0, | 144 | STACKTOS = 0xb0, |
145 | STACKTOL = 0xb1, | 145 | STACKTOL = 0xb1, |
146 | PRINT = 0xc0, | 146 | PRINT = 0xc0, |
147 | CALLLIB = 0xd0, | 147 | CALLLIB = 0xd0, |
148 | CALLLIB_TWO_BYTE = 0xd1, | 148 | CALLLIB_TWO_BYTE = 0xd1, |
149 | SHL = 0xe0, | 149 | SHL = 0xe0, |
150 | SHR = 0xe1 | 150 | SHR = 0xe1 |
151 | } | 151 | } |
152 | public enum BuiltIn_Functions | 152 | public enum BuiltIn_Functions |
153 | { | 153 | { |
154 | llSin = 0, | 154 | llSin = 0, |
155 | llCos = 1, | 155 | llCos = 1, |
156 | llTan = 2, | 156 | llTan = 2, |
157 | llAtan2 = 3, | 157 | llAtan2 = 3, |
158 | llSqrt = 4, | 158 | llSqrt = 4, |
159 | llPow = 5, | 159 | llPow = 5, |
160 | llAbs = 6, | 160 | llAbs = 6, |
161 | llFabs = 7, | 161 | llFabs = 7, |
162 | llFrand = 8, | 162 | llFrand = 8, |
163 | llFloor = 9, | 163 | llFloor = 9, |
164 | llCeil = 10, | 164 | llCeil = 10, |
165 | llRound = 11, | 165 | llRound = 11, |
166 | llVecMag = 12, | 166 | llVecMag = 12, |
167 | llVecNorm = 13, | 167 | llVecNorm = 13, |
168 | llVecDist = 14, | 168 | llVecDist = 14, |
169 | llRot2Euler = 15, | 169 | llRot2Euler = 15, |
170 | llEuler2Rot = 16, | 170 | llEuler2Rot = 16, |
171 | llAxes2Rot = 17, | 171 | llAxes2Rot = 17, |
172 | llRot2Fwd = 18, | 172 | llRot2Fwd = 18, |
173 | llRot2Left = 19, | 173 | llRot2Left = 19, |
174 | llRot2Up = 20, | 174 | llRot2Up = 20, |
175 | llRotBetween = 21, | 175 | llRotBetween = 21, |
176 | llWhisper = 22, | 176 | llWhisper = 22, |
177 | llSay = 23, | 177 | llSay = 23, |
178 | llShout = 24, | 178 | llShout = 24, |
179 | llListen = 25, | 179 | llListen = 25, |
180 | llListenControl = 26, | 180 | llListenControl = 26, |
181 | llListenRemove = 27, | 181 | llListenRemove = 27, |
182 | llSensor = 28, | 182 | llSensor = 28, |
183 | llSensorRepeat = 29, | 183 | llSensorRepeat = 29, |
184 | llSensorRemove = 30, | 184 | llSensorRemove = 30, |
185 | llDetectedName = 31, | 185 | llDetectedName = 31, |
186 | llDetectedKey = 32, | 186 | llDetectedKey = 32, |
187 | llDetectedOwner = 33, | 187 | llDetectedOwner = 33, |
188 | llDetectedType = 34, | 188 | llDetectedType = 34, |
189 | llDetectedPos = 35, | 189 | llDetectedPos = 35, |
190 | llDetectedVel = 36, | 190 | llDetectedVel = 36, |
191 | llDetectedGrab = 37, | 191 | llDetectedGrab = 37, |
192 | llDetectedRot = 38, | 192 | llDetectedRot = 38, |
193 | llDetectedGroup = 39, | 193 | llDetectedGroup = 39, |
194 | llDetectedLinkNumber = 40, | 194 | llDetectedLinkNumber = 40, |
195 | llDie = 41, | 195 | llDie = 41, |
196 | llGround = 42, | 196 | llGround = 42, |
197 | llCloud = 43, | 197 | llCloud = 43, |
198 | llWind = 44, | 198 | llWind = 44, |
199 | llSetStatus = 45, | 199 | llSetStatus = 45, |
200 | llGetStatus = 46, | 200 | llGetStatus = 46, |
201 | llSetScale = 47, | 201 | llSetScale = 47, |
202 | llGetScale = 48, | 202 | llGetScale = 48, |
203 | llSetColor = 49, | 203 | llSetColor = 49, |
204 | llGetAlpha = 50, | 204 | llGetAlpha = 50, |
205 | llSetAlpha = 51, | 205 | llSetAlpha = 51, |
206 | llGetColor = 52, | 206 | llGetColor = 52, |
207 | llSetTexture = 53, | 207 | llSetTexture = 53, |
208 | llScaleTexture = 54, | 208 | llScaleTexture = 54, |
209 | llOffsetTexture = 55, | 209 | llOffsetTexture = 55, |
210 | llRotateTexture = 56, | 210 | llRotateTexture = 56, |
211 | llGetTexture = 57, | 211 | llGetTexture = 57, |
212 | llSetPos = 58, | 212 | llSetPos = 58, |
213 | llGetPos = 59, | 213 | llGetPos = 59, |
214 | llGetLocalPos = 60, | 214 | llGetLocalPos = 60, |
215 | llSetRot = 61, | 215 | llSetRot = 61, |
216 | llGetRot = 62, | 216 | llGetRot = 62, |
217 | llGetLocalRot = 63, | 217 | llGetLocalRot = 63, |
218 | llSetForce = 64, | 218 | llSetForce = 64, |
219 | llGetForce = 65, | 219 | llGetForce = 65, |
220 | llTarget = 66, | 220 | llTarget = 66, |
221 | llTargetRemove = 67, | 221 | llTargetRemove = 67, |
222 | llRotTarget = 68, | 222 | llRotTarget = 68, |
223 | llRotTargetRemove = 69, | 223 | llRotTargetRemove = 69, |
224 | llMoveToTarget = 70, | 224 | llMoveToTarget = 70, |
225 | llStopMoveToTarget = 71, | 225 | llStopMoveToTarget = 71, |
226 | llApplyImpulse = 72, | 226 | llApplyImpulse = 72, |
227 | llApplyRotationalImpulse = 73, | 227 | llApplyRotationalImpulse = 73, |
228 | llSetTorque = 74, | 228 | llSetTorque = 74, |
229 | llGetTorque = 75, | 229 | llGetTorque = 75, |
230 | llSetForceAndTorque = 76, | 230 | llSetForceAndTorque = 76, |
231 | llGetVel = 77, | 231 | llGetVel = 77, |
232 | llGetAccel = 78, | 232 | llGetAccel = 78, |
233 | llGetOmega = 79, | 233 | llGetOmega = 79, |
234 | llGetTimeOfDay = 80, | 234 | llGetTimeOfDay = 80, |
235 | llGetWallclock = 81, | 235 | llGetWallclock = 81, |
236 | llGetTime = 82, | 236 | llGetTime = 82, |
237 | llResetTime = 83, | 237 | llResetTime = 83, |
238 | llGetAndResetTime = 84, | 238 | llGetAndResetTime = 84, |
239 | llSound = 85, | 239 | llSound = 85, |
240 | llPlaySound = 86, | 240 | llPlaySound = 86, |
241 | llLoopSound = 87, | 241 | llLoopSound = 87, |
242 | llLoopSoundMaster = 88, | 242 | llLoopSoundMaster = 88, |
243 | llLoopSoundSlave = 89, | 243 | llLoopSoundSlave = 89, |
244 | llPlaySoundSlave = 90, | 244 | llPlaySoundSlave = 90, |
245 | llTriggerSound = 91, | 245 | llTriggerSound = 91, |
246 | llStopSound = 92, | 246 | llStopSound = 92, |
247 | llPreloadSound = 93, | 247 | llPreloadSound = 93, |
248 | llGetSubString = 94, | 248 | llGetSubString = 94, |
249 | llDeleteSubString = 95, | 249 | llDeleteSubString = 95, |
250 | llInsertString = 96, | 250 | llInsertString = 96, |
251 | llToUpper = 97, | 251 | llToUpper = 97, |
252 | llToLower = 98, | 252 | llToLower = 98, |
253 | llGiveMoney = 99, | 253 | llGiveMoney = 99, |
254 | llMakeExplosion = 100, | 254 | llMakeExplosion = 100, |
255 | llMakeFountain = 101, | 255 | llMakeFountain = 101, |
256 | llMakeSmoke = 102, | 256 | llMakeSmoke = 102, |
257 | llMakeFire = 103, | 257 | llMakeFire = 103, |
258 | llRezObject = 104, | 258 | llRezObject = 104, |
259 | llLookAt = 105, | 259 | llLookAt = 105, |
260 | llStopLookAt = 106, | 260 | llStopLookAt = 106, |
261 | llSetTimerEvent = 107, | 261 | llSetTimerEvent = 107, |
262 | llSleep = 108, | 262 | llSleep = 108, |
263 | llGetMass = 109, | 263 | llGetMass = 109, |
264 | llCollisionFilter = 110, | 264 | llCollisionFilter = 110, |
265 | llTakeControls = 111, | 265 | llTakeControls = 111, |
266 | llReleaseControls = 112, | 266 | llReleaseControls = 112, |
267 | llAttachToAvatar = 113, | 267 | llAttachToAvatar = 113, |
268 | llDetachFromAvatar = 114, | 268 | llDetachFromAvatar = 114, |
269 | llTakeCamera = 115, | 269 | llTakeCamera = 115, |
270 | llReleaseCamera = 116, | 270 | llReleaseCamera = 116, |
271 | llGetOwner = 117, | 271 | llGetOwner = 117, |
272 | llInstantMessage = 118, | 272 | llInstantMessage = 118, |
273 | llEmail = 119, | 273 | llEmail = 119, |
274 | llGetNextEmail = 120, | 274 | llGetNextEmail = 120, |
275 | llGetKey = 121, | 275 | llGetKey = 121, |
276 | llSetBuoyancy = 122, | 276 | llSetBuoyancy = 122, |
277 | llSetHoverHeight = 123, | 277 | llSetHoverHeight = 123, |
278 | llStopHover = 124, | 278 | llStopHover = 124, |
279 | llMinEventDelay = 125, | 279 | llMinEventDelay = 125, |
280 | llSoundPreload = 126, | 280 | llSoundPreload = 126, |
281 | llRotLookAt = 127, | 281 | llRotLookAt = 127, |
282 | llStringLength = 128, | 282 | llStringLength = 128, |
283 | llStartAnimation = 129, | 283 | llStartAnimation = 129, |
284 | llStopAnimation = 130, | 284 | llStopAnimation = 130, |
285 | llPointAt = 131, | 285 | llPointAt = 131, |
286 | llStopPointAt = 132, | 286 | llStopPointAt = 132, |
287 | llTargetOmega = 133, | 287 | llTargetOmega = 133, |
288 | llGetStartParameter = 134, | 288 | llGetStartParameter = 134, |
289 | llGodLikeRezObject = 135, | 289 | llGodLikeRezObject = 135, |
290 | llRequestPermissions = 136, | 290 | llRequestPermissions = 136, |
291 | llGetPermissionsKey = 137, | 291 | llGetPermissionsKey = 137, |
292 | llGetPermissions = 138, | 292 | llGetPermissions = 138, |
293 | llGetLinkNumber = 139, | 293 | llGetLinkNumber = 139, |
294 | llSetLinkColor = 140, | 294 | llSetLinkColor = 140, |
295 | llCreateLink = 141, | 295 | llCreateLink = 141, |
296 | llBreakLink = 142, | 296 | llBreakLink = 142, |
297 | llBreakAllLinks = 143, | 297 | llBreakAllLinks = 143, |
298 | llGetLinkKey = 144, | 298 | llGetLinkKey = 144, |
299 | llGetLinkName = 145, | 299 | llGetLinkName = 145, |
300 | llGetInventoryNumber = 146, | 300 | llGetInventoryNumber = 146, |
301 | llGetInventoryName = 147, | 301 | llGetInventoryName = 147, |
302 | llSetScriptState = 148, | 302 | llSetScriptState = 148, |
303 | llGetEnergy = 149, | 303 | llGetEnergy = 149, |
304 | llGiveInventory = 150, | 304 | llGiveInventory = 150, |
305 | llRemoveInventory = 151, | 305 | llRemoveInventory = 151, |
306 | llSetText = 152, | 306 | llSetText = 152, |
307 | llWater = 153, | 307 | llWater = 153, |
308 | llPassTouches = 154, | 308 | llPassTouches = 154, |
309 | llRequestAgentData = 155, | 309 | llRequestAgentData = 155, |
310 | llRequestInventoryData = 156, | 310 | llRequestInventoryData = 156, |
311 | llSetDamage = 157, | 311 | llSetDamage = 157, |
312 | llTeleportAgentHome = 158, | 312 | llTeleportAgentHome = 158, |
313 | llModifyLand = 159, | 313 | llModifyLand = 159, |
314 | llCollisionSound = 160, | 314 | llCollisionSound = 160, |
315 | llCollisionSprite = 161, | 315 | llCollisionSprite = 161, |
316 | llGetAnimation = 162, | 316 | llGetAnimation = 162, |
317 | llResetScript = 163, | 317 | llResetScript = 163, |
318 | llMessageLinked = 164, | 318 | llMessageLinked = 164, |
319 | llPushObject = 165, | 319 | llPushObject = 165, |
320 | llPassCollisions = 166, | 320 | llPassCollisions = 166, |
321 | llGetScriptName = 167, | 321 | llGetScriptName = 167, |
322 | llGetNumberOfSides = 168, | 322 | llGetNumberOfSides = 168, |
323 | llAxisAngle2Rot = 169, | 323 | llAxisAngle2Rot = 169, |
324 | llRot2Axis = 170, | 324 | llRot2Axis = 170, |
325 | llRot2Angle = 171, | 325 | llRot2Angle = 171, |
326 | llAcos = 172, | 326 | llAcos = 172, |
327 | llAsin = 173, | 327 | llAsin = 173, |
328 | llAngleBetween = 174, | 328 | llAngleBetween = 174, |
329 | llGetInventoryKey = 175, | 329 | llGetInventoryKey = 175, |
330 | llAllowInventoryDrop = 176, | 330 | llAllowInventoryDrop = 176, |
331 | llGetSunDirection = 177, | 331 | llGetSunDirection = 177, |
332 | llGetTextureOffset = 178, | 332 | llGetTextureOffset = 178, |
333 | llGetTextureScale = 179, | 333 | llGetTextureScale = 179, |
334 | llGetTextureRot = 180, | 334 | llGetTextureRot = 180, |
335 | llSubStringIndex = 181, | 335 | llSubStringIndex = 181, |
336 | llGetOwnerKey = 182, | 336 | llGetOwnerKey = 182, |
337 | llGetCenterOfMass = 183, | 337 | llGetCenterOfMass = 183, |
338 | llListSort = 184, | 338 | llListSort = 184, |
339 | llGetListLength = 185, | 339 | llGetListLength = 185, |
340 | llList2Integer = 186, | 340 | llList2Integer = 186, |
341 | llList2Float = 187, | 341 | llList2Float = 187, |
342 | llList2String = 188, | 342 | llList2String = 188, |
343 | llList2Key = 189, | 343 | llList2Key = 189, |
344 | llList2Vector = 190, | 344 | llList2Vector = 190, |
345 | llList2Rot = 191, | 345 | llList2Rot = 191, |
346 | llList2List = 192, | 346 | llList2List = 192, |
347 | llDeleteSubList = 193, | 347 | llDeleteSubList = 193, |
348 | llGetListEntryType = 194, | 348 | llGetListEntryType = 194, |
349 | llList2CSV = 195, | 349 | llList2CSV = 195, |
350 | llCSV2List = 196, | 350 | llCSV2List = 196, |
351 | llListRandomize = 197, | 351 | llListRandomize = 197, |
352 | llList2ListStrided = 198, | 352 | llList2ListStrided = 198, |
353 | llGetRegionCorner = 199, | 353 | llGetRegionCorner = 199, |
354 | llListInsertList = 200, | 354 | llListInsertList = 200, |
355 | llListFindList = 201, | 355 | llListFindList = 201, |
356 | llGetObjectName = 202, | 356 | llGetObjectName = 202, |
357 | llSetObjectName = 203, | 357 | llSetObjectName = 203, |
358 | llGetDate = 204, | 358 | llGetDate = 204, |
359 | llEdgeOfWorld = 205, | 359 | llEdgeOfWorld = 205, |
360 | llGetAgentInfo = 206, | 360 | llGetAgentInfo = 206, |
361 | llAdjustSoundVolume = 207, | 361 | llAdjustSoundVolume = 207, |
362 | llSetSoundQueueing = 208, | 362 | llSetSoundQueueing = 208, |
363 | llSetSoundRadius = 209, | 363 | llSetSoundRadius = 209, |
364 | llKey2Name = 210, | 364 | llKey2Name = 210, |
365 | llSetTextureAnim = 211, | 365 | llSetTextureAnim = 211, |
366 | llTriggerSoundLimited = 212, | 366 | llTriggerSoundLimited = 212, |
367 | llEjectFromLand = 213, | 367 | llEjectFromLand = 213, |
368 | llParseString2List = 214, | 368 | llParseString2List = 214, |
369 | llOverMyLand = 215, | 369 | llOverMyLand = 215, |
370 | llGetLandOwnerAt = 216, | 370 | llGetLandOwnerAt = 216, |
371 | llGetNotecardLine = 217, | 371 | llGetNotecardLine = 217, |
372 | llGetAgentSize = 218, | 372 | llGetAgentSize = 218, |
373 | llSameGroup = 219, | 373 | llSameGroup = 219, |
374 | llUnSit = 220, | 374 | llUnSit = 220, |
375 | llGroundSlope = 221, | 375 | llGroundSlope = 221, |
376 | llGroundNormal = 222, | 376 | llGroundNormal = 222, |
377 | llGroundContour = 223, | 377 | llGroundContour = 223, |
378 | llGetAttached = 224, | 378 | llGetAttached = 224, |
379 | llGetFreeMemory = 225, | 379 | llGetFreeMemory = 225, |
380 | llGetRegionName = 226, | 380 | llGetRegionName = 226, |
381 | llGetRegionTimeDilation = 227, | 381 | llGetRegionTimeDilation = 227, |
382 | llGetRegionFPS = 228, | 382 | llGetRegionFPS = 228, |
383 | llParticleSystem = 229, | 383 | llParticleSystem = 229, |
384 | llGroundRepel = 230, | 384 | llGroundRepel = 230, |
385 | llGiveInventoryList = 231, | 385 | llGiveInventoryList = 231, |
386 | llSetVehicleType = 232, | 386 | llSetVehicleType = 232, |
387 | llSetVehicleFloatParam = 233, | 387 | llSetVehicleFloatParam = 233, |
388 | llSetVehicleVectorParam = 234, | 388 | llSetVehicleVectorParam = 234, |
389 | llSetVehicleRotationParam = 235, | 389 | llSetVehicleRotationParam = 235, |
390 | llSetVehicleFlags = 236, | 390 | llSetVehicleFlags = 236, |
391 | llRemoveVehicleFlags = 237, | 391 | llRemoveVehicleFlags = 237, |
392 | llSitTarget = 238, | 392 | llSitTarget = 238, |
393 | llAvatarOnSitTarget = 239, | 393 | llAvatarOnSitTarget = 239, |
394 | llAddToLandPassList = 240, | 394 | llAddToLandPassList = 240, |
395 | llSetTouchText = 241, | 395 | llSetTouchText = 241, |
396 | llSetSitText = 242, | 396 | llSetSitText = 242, |
397 | llSetCameraEyeOffset = 243, | 397 | llSetCameraEyeOffset = 243, |
398 | llSetCameraAtOffset = 244, | 398 | llSetCameraAtOffset = 244, |
399 | llDumpList2String = 245, | 399 | llDumpList2String = 245, |
400 | llScriptDanger = 246, | 400 | llScriptDanger = 246, |
401 | llDialog = 247, | 401 | llDialog = 247, |
402 | llVolumeDetect = 248, | 402 | llVolumeDetect = 248, |
403 | llResetOtherScript = 249, | 403 | llResetOtherScript = 249, |
404 | llGetScriptState = 250, | 404 | llGetScriptState = 250, |
405 | llRemoteLoadScript = 251, | 405 | llRemoteLoadScript = 251, |
406 | llSetRemoteScriptAccessPin = 252, | 406 | llSetRemoteScriptAccessPin = 252, |
407 | llRemoteLoadScriptPin = 253, | 407 | llRemoteLoadScriptPin = 253, |
408 | llOpenRemoteDataChannel = 254, | 408 | llOpenRemoteDataChannel = 254, |
409 | llSendRemoteData = 255, | 409 | llSendRemoteData = 255, |
410 | llRemoteDataReply = 256, | 410 | llRemoteDataReply = 256, |
411 | llCloseRemoteDataChannel = 257, | 411 | llCloseRemoteDataChannel = 257, |
412 | llMD5String = 258, | 412 | llMD5String = 258, |
413 | llSetPrimitiveParams = 259, | 413 | llSetPrimitiveParams = 259, |
414 | llStringToBase64 = 260, | 414 | llStringToBase64 = 260, |
415 | llBase64ToString = 261, | 415 | llBase64ToString = 261, |
416 | llXorBase64Strings = 262, | 416 | llXorBase64Strings = 262, |
417 | llRemoteDataSetRegion = 263, | 417 | llRemoteDataSetRegion = 263, |
418 | llLog10 = 264, | 418 | llLog10 = 264, |
419 | llLog = 265, | 419 | llLog = 265, |
420 | llGetAnimationList = 266, | 420 | llGetAnimationList = 266, |
421 | llSetParcelMusicURL = 267, | 421 | llSetParcelMusicURL = 267, |
422 | llGetRootPosition = 268, | 422 | llGetRootPosition = 268, |
423 | llGetRootRotation = 269, | 423 | llGetRootRotation = 269, |
424 | llGetObjectDesc = 270, | 424 | llGetObjectDesc = 270, |
425 | llSetObjectDesc = 271, | 425 | llSetObjectDesc = 271, |
426 | llGetCreator = 272, | 426 | llGetCreator = 272, |
427 | llGetTimestamp = 273, | 427 | llGetTimestamp = 273, |
428 | llSetLinkAlpha = 274, | 428 | llSetLinkAlpha = 274, |
429 | llGetNumberOfPrims = 275, | 429 | llGetNumberOfPrims = 275, |
430 | llGetNumberOfNotecardLines = 276, | 430 | llGetNumberOfNotecardLines = 276, |
431 | llGetBoundingBox = 277, | 431 | llGetBoundingBox = 277, |
432 | llGetGeometricCenter = 278, | 432 | llGetGeometricCenter = 278, |
433 | llGetPrimitiveParams = 279, | 433 | llGetPrimitiveParams = 279, |
434 | llIntegerToBase64 = 280, | 434 | llIntegerToBase64 = 280, |
435 | llBase64ToInteger = 281, | 435 | llBase64ToInteger = 281, |
436 | llGetGMTclock = 282, | 436 | llGetGMTclock = 282, |
437 | llGetSimulatorHostname = 283, | 437 | llGetSimulatorHostname = 283, |
438 | llSetLocalRot = 284, | 438 | llSetLocalRot = 284, |
439 | llParseStringKeepNulls = 285, | 439 | llParseStringKeepNulls = 285, |
440 | llRezAtRoot = 286, | 440 | llRezAtRoot = 286, |
441 | llGetObjectPermMask = 287, | 441 | llGetObjectPermMask = 287, |
442 | llSetObjectPermMask = 288, | 442 | llSetObjectPermMask = 288, |
443 | llGetInventoryPermMask = 289, | 443 | llGetInventoryPermMask = 289, |
444 | llSetInventoryPermMask = 290, | 444 | llSetInventoryPermMask = 290, |
445 | llGetInventoryCreator = 291, | 445 | llGetInventoryCreator = 291, |
446 | llOwnerSay = 292, | 446 | llOwnerSay = 292, |
447 | llRequestSimulatorData = 293, | 447 | llRequestSimulatorData = 293, |
448 | llForceMouselook = 294, | 448 | llForceMouselook = 294, |
449 | llGetObjectMass = 295, | 449 | llGetObjectMass = 295, |
450 | llListReplaceList = 296, | 450 | llListReplaceList = 296, |
451 | llLoadURL = 297, | 451 | llLoadURL = 297, |
452 | llParcelMediaCommandList = 298, | 452 | llParcelMediaCommandList = 298, |
453 | llParcelMediaQuery = 299, | 453 | llParcelMediaQuery = 299, |
454 | llModPow = 300, | 454 | llModPow = 300, |
455 | llGetInventoryType = 301, | 455 | llGetInventoryType = 301, |
456 | llSetPayPrice = 302, | 456 | llSetPayPrice = 302, |
457 | llGetCameraPos = 303, | 457 | llGetCameraPos = 303, |
458 | llGetCameraRot = 304, | 458 | llGetCameraRot = 304, |
459 | llSetPrimURL = 305, | 459 | llSetPrimURL = 305, |
460 | llRefreshPrimURL = 306, | 460 | llRefreshPrimURL = 306, |
461 | llEscapeURL = 307, | 461 | llEscapeURL = 307, |
462 | llUnescapeURL = 308, | 462 | llUnescapeURL = 308, |
463 | llMapDestination = 309, | 463 | llMapDestination = 309, |
464 | llAddToLandBanList = 310, | 464 | llAddToLandBanList = 310, |
465 | llRemoveFromLandPassList = 311, | 465 | llRemoveFromLandPassList = 311, |
466 | llRemoveFromLandBanList = 312, | 466 | llRemoveFromLandBanList = 312, |
467 | llSetCameraParams = 313, | 467 | llSetCameraParams = 313, |
468 | llClearCameraParams = 314, | 468 | llClearCameraParams = 314, |
469 | llListStatistics = 315, | 469 | llListStatistics = 315, |
470 | llGetUnixTime = 316, | 470 | llGetUnixTime = 316, |
471 | llGetParcelFlags = 317, | 471 | llGetParcelFlags = 317, |
472 | llGetRegionFlags = 318, | 472 | llGetRegionFlags = 318, |
473 | llXorBase64StringsCorrect = 319, | 473 | llXorBase64StringsCorrect = 319, |
474 | llHTTPRequest = 320, | 474 | llHTTPRequest = 320, |
475 | llResetLandBanList = 321, | 475 | llResetLandBanList = 321, |
476 | llResetLandPassList = 322, | 476 | llResetLandPassList = 322, |
477 | llGetParcelPrimCount = 323, | 477 | llGetParcelPrimCount = 323, |
478 | llGetParcelPrimOwners = 324, | 478 | llGetParcelPrimOwners = 324, |
479 | llGetObjectPrimCount = 325, | 479 | llGetObjectPrimCount = 325, |
480 | llGetParcelMaxPrims = 326, | 480 | llGetParcelMaxPrims = 326, |
481 | llGetParcelDetails = 327 | 481 | llGetParcelDetails = 327 |
482 | } | 482 | } |
483 | 483 | ||
484 | } | 484 | } |
485 | } | 485 | } |
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Parser.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Parser.cs index 2da1189..ebe4465 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Parser.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Parser.cs | |||
@@ -1,608 +1,608 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using System.IO; | 4 | using System.IO; |
5 | using System.Reflection; | 5 | using System.Reflection; |
6 | using System.Reflection.Emit; | 6 | using System.Reflection.Emit; |
7 | using OpenSim.Region.Scripting; | 7 | using OpenSim.Region.Scripting; |
8 | 8 | ||
9 | namespace OpenSim.ScriptEngines.LSL | 9 | namespace OpenSim.ScriptEngines.LSL |
10 | { | 10 | { |
11 | class LSO_Parser | 11 | class LSO_Parser |
12 | { | 12 | { |
13 | private bool Debug = true; | 13 | private bool Debug = true; |
14 | private FileStream fs; | 14 | private FileStream fs; |
15 | private BinaryReader br; | 15 | private BinaryReader br; |
16 | private LSO_Struct.Header myHeader; | 16 | private LSO_Struct.Header myHeader; |
17 | 17 | ||
18 | private TypeBuilder typeBuilder; | 18 | private TypeBuilder typeBuilder; |
19 | private ScriptInfo WorldAPI; | 19 | private ScriptInfo WorldAPI; |
20 | 20 | ||
21 | /// <summary> | 21 | /// <summary> |
22 | /// Parse LSO file. | 22 | /// Parse LSO file. |
23 | /// Reads LSO ByteCode into memory structures. | 23 | /// Reads LSO ByteCode into memory structures. |
24 | /// TODO: What else does it do? | 24 | /// TODO: What else does it do? |
25 | /// </summary> | 25 | /// </summary> |
26 | /// <param name="FileName">FileName of LSO ByteCode file</param> | 26 | /// <param name="FileName">FileName of LSO ByteCode file</param> |
27 | public void ParseFile(string FileName, ScriptInfo _WorldAPI, ref TypeBuilder _typeBuilder) | 27 | public void ParseFile(string FileName, ScriptInfo _WorldAPI, ref TypeBuilder _typeBuilder) |
28 | { | 28 | { |
29 | typeBuilder = _typeBuilder; | 29 | typeBuilder = _typeBuilder; |
30 | WorldAPI = _WorldAPI; | 30 | WorldAPI = _WorldAPI; |
31 | // Open | 31 | // Open |
32 | SendToDebug("Opening filename: " + FileName); | 32 | SendToDebug("Opening filename: " + FileName); |
33 | fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read); | 33 | fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read); |
34 | br = new BinaryReader(fs, Encoding.BigEndianUnicode); | 34 | br = new BinaryReader(fs, Encoding.BigEndianUnicode); |
35 | 35 | ||
36 | 36 | ||
37 | // The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack. | 37 | // The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack. |
38 | 38 | ||
39 | 39 | ||
40 | // HEADER BLOCK | 40 | // HEADER BLOCK |
41 | SendToDebug("Reading HEADER BLOCK at: 0"); | 41 | SendToDebug("Reading HEADER BLOCK at: 0"); |
42 | fs.Seek(0, SeekOrigin.Begin); | 42 | fs.Seek(0, SeekOrigin.Begin); |
43 | myHeader = new LSO_Struct.Header(); | 43 | myHeader = new LSO_Struct.Header(); |
44 | myHeader.TM = BitConverter.ToUInt32(br_read(4), 0); | 44 | myHeader.TM = BitConverter.ToUInt32(br_read(4), 0); |
45 | myHeader.IP = BitConverter.ToUInt32(br_read(4), 0); | 45 | myHeader.IP = BitConverter.ToUInt32(br_read(4), 0); |
46 | myHeader.VN = BitConverter.ToUInt32(br_read(4), 0); | 46 | myHeader.VN = BitConverter.ToUInt32(br_read(4), 0); |
47 | myHeader.BP = BitConverter.ToUInt32(br_read(4), 0); | 47 | myHeader.BP = BitConverter.ToUInt32(br_read(4), 0); |
48 | myHeader.SP = BitConverter.ToUInt32(br_read(4), 0); | 48 | myHeader.SP = BitConverter.ToUInt32(br_read(4), 0); |
49 | myHeader.HR = BitConverter.ToUInt32(br_read(4), 0); | 49 | myHeader.HR = BitConverter.ToUInt32(br_read(4), 0); |
50 | myHeader.HP = BitConverter.ToUInt32(br_read(4), 0); | 50 | myHeader.HP = BitConverter.ToUInt32(br_read(4), 0); |
51 | myHeader.CS = BitConverter.ToUInt32(br_read(4), 0); | 51 | myHeader.CS = BitConverter.ToUInt32(br_read(4), 0); |
52 | myHeader.NS = BitConverter.ToUInt32(br_read(4), 0); | 52 | myHeader.NS = BitConverter.ToUInt32(br_read(4), 0); |
53 | myHeader.CE = BitConverter.ToUInt32(br_read(4), 0); | 53 | myHeader.CE = BitConverter.ToUInt32(br_read(4), 0); |
54 | myHeader.IE = BitConverter.ToUInt32(br_read(4), 0); | 54 | myHeader.IE = BitConverter.ToUInt32(br_read(4), 0); |
55 | myHeader.ER = BitConverter.ToUInt32(br_read(4), 0); | 55 | myHeader.ER = BitConverter.ToUInt32(br_read(4), 0); |
56 | myHeader.FR = BitConverter.ToUInt32(br_read(4), 0); | 56 | myHeader.FR = BitConverter.ToUInt32(br_read(4), 0); |
57 | myHeader.SLR = BitConverter.ToUInt32(br_read(4), 0); | 57 | myHeader.SLR = BitConverter.ToUInt32(br_read(4), 0); |
58 | myHeader.GVR = BitConverter.ToUInt32(br_read(4), 0); | 58 | myHeader.GVR = BitConverter.ToUInt32(br_read(4), 0); |
59 | myHeader.GFR = BitConverter.ToUInt32(br_read(4), 0); | 59 | myHeader.GFR = BitConverter.ToUInt32(br_read(4), 0); |
60 | myHeader.PR = BitConverter.ToUInt32(br_read(4), 0); | 60 | myHeader.PR = BitConverter.ToUInt32(br_read(4), 0); |
61 | myHeader.ESR = BitConverter.ToUInt32(br_read(4), 0); | 61 | myHeader.ESR = BitConverter.ToUInt32(br_read(4), 0); |
62 | myHeader.SR = BitConverter.ToUInt32(br_read(4), 0); | 62 | myHeader.SR = BitConverter.ToUInt32(br_read(4), 0); |
63 | myHeader.NCE = BitConverter.ToUInt64(br_read(8), 0); | 63 | myHeader.NCE = BitConverter.ToUInt64(br_read(8), 0); |
64 | myHeader.NIE = BitConverter.ToUInt64(br_read(8), 0); | 64 | myHeader.NIE = BitConverter.ToUInt64(br_read(8), 0); |
65 | myHeader.NER = BitConverter.ToUInt64(br_read(8), 0); | 65 | myHeader.NER = BitConverter.ToUInt64(br_read(8), 0); |
66 | 66 | ||
67 | // Print Header Block to debug | 67 | // Print Header Block to debug |
68 | SendToDebug("TM - Top of memory (size): " + myHeader.TM); | 68 | SendToDebug("TM - Top of memory (size): " + myHeader.TM); |
69 | SendToDebug("IP - Instruction Pointer (0=not running): " + myHeader.IP); | 69 | SendToDebug("IP - Instruction Pointer (0=not running): " + myHeader.IP); |
70 | SendToDebug("VN - Version number: " + myHeader.VN); | 70 | SendToDebug("VN - Version number: " + myHeader.VN); |
71 | SendToDebug("BP - Local Frame Pointer: " + myHeader.BP); | 71 | SendToDebug("BP - Local Frame Pointer: " + myHeader.BP); |
72 | SendToDebug("SP - Stack Pointer: " + myHeader.SP); | 72 | SendToDebug("SP - Stack Pointer: " + myHeader.SP); |
73 | SendToDebug("HR - Heap Register: " + myHeader.HR); | 73 | SendToDebug("HR - Heap Register: " + myHeader.HR); |
74 | SendToDebug("HP - Heap Pointer: " + myHeader.HP); | 74 | SendToDebug("HP - Heap Pointer: " + myHeader.HP); |
75 | SendToDebug("CS - Current State: " + myHeader.CS); | 75 | SendToDebug("CS - Current State: " + myHeader.CS); |
76 | SendToDebug("NS - Next State: " + myHeader.NS); | 76 | SendToDebug("NS - Next State: " + myHeader.NS); |
77 | SendToDebug("CE - Current Events: " + myHeader.CE); | 77 | SendToDebug("CE - Current Events: " + myHeader.CE); |
78 | SendToDebug("IE - In Event: " + myHeader.IE); | 78 | SendToDebug("IE - In Event: " + myHeader.IE); |
79 | SendToDebug("ER - Event Register: " + myHeader.ER); | 79 | SendToDebug("ER - Event Register: " + myHeader.ER); |
80 | SendToDebug("FR - Fault Register: " + myHeader.FR); | 80 | SendToDebug("FR - Fault Register: " + myHeader.FR); |
81 | SendToDebug("SLR - Sleep Register: " + myHeader.SLR); | 81 | SendToDebug("SLR - Sleep Register: " + myHeader.SLR); |
82 | SendToDebug("GVR - Global Variable Register: " + myHeader.GVR); | 82 | SendToDebug("GVR - Global Variable Register: " + myHeader.GVR); |
83 | SendToDebug("GFR - Global Function Register: " + myHeader.GFR); | 83 | SendToDebug("GFR - Global Function Register: " + myHeader.GFR); |
84 | SendToDebug("PR - Parameter Register: " + myHeader.PR); | 84 | SendToDebug("PR - Parameter Register: " + myHeader.PR); |
85 | SendToDebug("ESR - Energy Supply Register: " + myHeader.ESR); | 85 | SendToDebug("ESR - Energy Supply Register: " + myHeader.ESR); |
86 | SendToDebug("SR - State Register: " + myHeader.SR); | 86 | SendToDebug("SR - State Register: " + myHeader.SR); |
87 | SendToDebug("NCE - 64-bit Current Events: " + myHeader.NCE); | 87 | SendToDebug("NCE - 64-bit Current Events: " + myHeader.NCE); |
88 | SendToDebug("NIE - 64-bit In Events: " + myHeader.NIE); | 88 | SendToDebug("NIE - 64-bit In Events: " + myHeader.NIE); |
89 | SendToDebug("NER - 64-bit Event Register: " + myHeader.NER); | 89 | SendToDebug("NER - 64-bit Event Register: " + myHeader.NER); |
90 | SendToDebug("Read position when exiting HEADER BLOCK: " + fs.Position); | 90 | SendToDebug("Read position when exiting HEADER BLOCK: " + fs.Position); |
91 | 91 | ||
92 | // STATIC BLOCK | 92 | // STATIC BLOCK |
93 | SendToDebug("Reading STATIC BLOCK at: " + myHeader.GVR); | 93 | SendToDebug("Reading STATIC BLOCK at: " + myHeader.GVR); |
94 | fs.Seek(myHeader.GVR, SeekOrigin.Begin); | 94 | fs.Seek(myHeader.GVR, SeekOrigin.Begin); |
95 | int StaticBlockCount = 0; | 95 | int StaticBlockCount = 0; |
96 | // Read function blocks until we hit GFR | 96 | // Read function blocks until we hit GFR |
97 | while (fs.Position < myHeader.GFR) | 97 | while (fs.Position < myHeader.GFR) |
98 | { | 98 | { |
99 | StaticBlockCount++; | 99 | StaticBlockCount++; |
100 | SendToDebug("Reading Static Block " + StaticBlockCount + " at: " + fs.Position); | 100 | SendToDebug("Reading Static Block " + StaticBlockCount + " at: " + fs.Position); |
101 | //fs.Seek(myHeader.GVR, SeekOrigin.Begin); | 101 | //fs.Seek(myHeader.GVR, SeekOrigin.Begin); |
102 | LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); | 102 | LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); |
103 | myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); | 103 | myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); |
104 | myStaticBlock.ObjectType = br_read(1)[0]; | 104 | myStaticBlock.ObjectType = br_read(1)[0]; |
105 | SendToDebug("Static Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myStaticBlock.ObjectType).ToString()); | 105 | SendToDebug("Static Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myStaticBlock.ObjectType).ToString()); |
106 | myStaticBlock.Unknown = br_read(1)[0]; | 106 | myStaticBlock.Unknown = br_read(1)[0]; |
107 | // Size of datatype varies | 107 | // Size of datatype varies |
108 | if (myStaticBlock.ObjectType != 0) | 108 | if (myStaticBlock.ObjectType != 0) |
109 | myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType)); | 109 | myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType)); |
110 | } | 110 | } |
111 | SendToDebug("Number of Static Blocks read: " + StaticBlockCount); | 111 | SendToDebug("Number of Static Blocks read: " + StaticBlockCount); |
112 | 112 | ||
113 | 113 | ||
114 | // FUNCTION BLOCK | 114 | // FUNCTION BLOCK |
115 | // Always right after STATIC BLOCK | 115 | // Always right after STATIC BLOCK |
116 | LSO_Struct.FunctionBlock myFunctionBlock = new LSO_Struct.FunctionBlock(); | 116 | LSO_Struct.FunctionBlock myFunctionBlock = new LSO_Struct.FunctionBlock(); |
117 | if (myHeader.GFR == myHeader.SR) | 117 | if (myHeader.GFR == myHeader.SR) |
118 | { | 118 | { |
119 | // If GFR and SR are at same position then there is no fuction block | 119 | // If GFR and SR are at same position then there is no fuction block |
120 | SendToDebug("No FUNCTION BLOCK found"); | 120 | SendToDebug("No FUNCTION BLOCK found"); |
121 | } else { | 121 | } else { |
122 | SendToDebug("Reading FUNCTION BLOCK at: " + myHeader.GFR); | 122 | SendToDebug("Reading FUNCTION BLOCK at: " + myHeader.GFR); |
123 | fs.Seek(myHeader.GFR, SeekOrigin.Begin); | 123 | fs.Seek(myHeader.GFR, SeekOrigin.Begin); |
124 | myFunctionBlock.FunctionCount = BitConverter.ToUInt32(br_read(4), 0); | 124 | myFunctionBlock.FunctionCount = BitConverter.ToUInt32(br_read(4), 0); |
125 | SendToDebug("Number of functions in Fuction Block: " + myFunctionBlock.FunctionCount); | 125 | SendToDebug("Number of functions in Fuction Block: " + myFunctionBlock.FunctionCount); |
126 | if (myFunctionBlock.FunctionCount > 0) | 126 | if (myFunctionBlock.FunctionCount > 0) |
127 | { | 127 | { |
128 | myFunctionBlock.CodeChunkPointer = new UInt32[myFunctionBlock.FunctionCount]; | 128 | myFunctionBlock.CodeChunkPointer = new UInt32[myFunctionBlock.FunctionCount]; |
129 | for (int i = 0; i < myFunctionBlock.FunctionCount; i++) | 129 | for (int i = 0; i < myFunctionBlock.FunctionCount; i++) |
130 | { | 130 | { |
131 | SendToDebug("Reading function " + i + " at: " + fs.Position); | 131 | SendToDebug("Reading function " + i + " at: " + fs.Position); |
132 | // TODO: ADD TO FUNCTION LIST (How do we identify it later?) | 132 | // TODO: ADD TO FUNCTION LIST (How do we identify it later?) |
133 | // Note! Absolute position | 133 | // Note! Absolute position |
134 | myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR; | 134 | myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR; |
135 | SendToDebug("Fuction " + i + " code chunk position: " + myFunctionBlock.CodeChunkPointer[i]); | 135 | SendToDebug("Fuction " + i + " code chunk position: " + myFunctionBlock.CodeChunkPointer[i]); |
136 | } | 136 | } |
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | 140 | ||
141 | // STATE FRAME BLOCK | 141 | // STATE FRAME BLOCK |
142 | // Always right after FUNCTION BLOCK | 142 | // Always right after FUNCTION BLOCK |
143 | SendToDebug("Reading STATE BLOCK at: " + myHeader.SR); | 143 | SendToDebug("Reading STATE BLOCK at: " + myHeader.SR); |
144 | fs.Seek(myHeader.SR, SeekOrigin.Begin); | 144 | fs.Seek(myHeader.SR, SeekOrigin.Begin); |
145 | LSO_Struct.StateFrameBlock myStateFrameBlock = new LSO_Struct.StateFrameBlock(); | 145 | LSO_Struct.StateFrameBlock myStateFrameBlock = new LSO_Struct.StateFrameBlock(); |
146 | myStateFrameBlock.StateCount = BitConverter.ToUInt32(br_read(4), 0); | 146 | myStateFrameBlock.StateCount = BitConverter.ToUInt32(br_read(4), 0); |
147 | if (myStateFrameBlock.StateCount > 0) | 147 | if (myStateFrameBlock.StateCount > 0) |
148 | { | 148 | { |
149 | // Initialize array | 149 | // Initialize array |
150 | myStateFrameBlock.StatePointer = new LSO_Struct.StatePointerBlock[myStateFrameBlock.StateCount]; | 150 | myStateFrameBlock.StatePointer = new LSO_Struct.StatePointerBlock[myStateFrameBlock.StateCount]; |
151 | for (int i = 0; i < myStateFrameBlock.StateCount; i++) | 151 | for (int i = 0; i < myStateFrameBlock.StateCount; i++) |
152 | { | 152 | { |
153 | SendToDebug("Reading STATE POINTER BLOCK " + (i+1) + " at: " + fs.Position); | 153 | SendToDebug("Reading STATE POINTER BLOCK " + (i+1) + " at: " + fs.Position); |
154 | // Position is relative to state frame | 154 | // Position is relative to state frame |
155 | myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0); | 155 | myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0); |
156 | myStateFrameBlock.StatePointer[i].EventMask = new System.Collections.BitArray(br_read(8)); | 156 | myStateFrameBlock.StatePointer[i].EventMask = new System.Collections.BitArray(br_read(8)); |
157 | SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location); | 157 | SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location); |
158 | SendToDebug("Total potential EventMask bits: " + myStateFrameBlock.StatePointer[i].EventMask.Count); | 158 | SendToDebug("Total potential EventMask bits: " + myStateFrameBlock.StatePointer[i].EventMask.Count); |
159 | 159 | ||
160 | //// Read STATE BLOCK | 160 | //// Read STATE BLOCK |
161 | //long CurPos = fs.Position; | 161 | //long CurPos = fs.Position; |
162 | //fs.Seek(CurPos, SeekOrigin.Begin); | 162 | //fs.Seek(CurPos, SeekOrigin.Begin); |
163 | 163 | ||
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
167 | 167 | ||
168 | // STATE BLOCK | 168 | // STATE BLOCK |
169 | // For each StateFrameBlock there is one StateBlock with multiple event handlers | 169 | // For each StateFrameBlock there is one StateBlock with multiple event handlers |
170 | 170 | ||
171 | if (myStateFrameBlock.StateCount > 0) | 171 | if (myStateFrameBlock.StateCount > 0) |
172 | { | 172 | { |
173 | // Go through all State Frame Pointers found | 173 | // Go through all State Frame Pointers found |
174 | for (int i = 0; i < myStateFrameBlock.StateCount; i++) | 174 | for (int i = 0; i < myStateFrameBlock.StateCount; i++) |
175 | { | 175 | { |
176 | 176 | ||
177 | fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin); | 177 | fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin); |
178 | SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position); | 178 | SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position); |
179 | 179 | ||
180 | // READ: STATE BLOCK HEADER | 180 | // READ: STATE BLOCK HEADER |
181 | myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock(); | 181 | myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock(); |
182 | myStateFrameBlock.StatePointer[i].StateBlock.StartPos = (UInt32)fs.Position; // Note | 182 | myStateFrameBlock.StatePointer[i].StateBlock.StartPos = (UInt32)fs.Position; // Note |
183 | myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0); | 183 | myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0); |
184 | myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0]; | 184 | myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0]; |
185 | myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32)fs.Position; // Note | 185 | myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32)fs.Position; // Note |
186 | SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos); | 186 | SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos); |
187 | SendToDebug("State block Header Size: " + myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize); | 187 | SendToDebug("State block Header Size: " + myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize); |
188 | SendToDebug("State block Header End Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.EndPos); | 188 | SendToDebug("State block Header End Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.EndPos); |
189 | 189 | ||
190 | // We need to count number of bits flagged in EventMask? | 190 | // We need to count number of bits flagged in EventMask? |
191 | 191 | ||
192 | 192 | ||
193 | // for each bit in myStateFrameBlock.StatePointer[i].EventMask | 193 | // for each bit in myStateFrameBlock.StatePointer[i].EventMask |
194 | 194 | ||
195 | // ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE | 195 | // ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE |
196 | //TODO: Create event hooks | 196 | //TODO: Create event hooks |
197 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers = new LSO_Struct.StateBlockHandler[myStateFrameBlock.StatePointer[i].EventMask.Count - 1]; | 197 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers = new LSO_Struct.StateBlockHandler[myStateFrameBlock.StatePointer[i].EventMask.Count - 1]; |
198 | for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) | 198 | for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) |
199 | { | 199 | { |
200 | 200 | ||
201 | if (myStateFrameBlock.StatePointer[i].EventMask.Get(ii) == true) | 201 | if (myStateFrameBlock.StatePointer[i].EventMask.Get(ii) == true) |
202 | { | 202 | { |
203 | // We got an event | 203 | // We got an event |
204 | // READ: STATE BLOCK HANDLER | 204 | // READ: STATE BLOCK HANDLER |
205 | SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") at: " + fs.Position); | 205 | SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") at: " + fs.Position); |
206 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer = myStateFrameBlock.StatePointer[i].StateBlock.EndPos + BitConverter.ToUInt32(br_read(4), 0); | 206 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer = myStateFrameBlock.StatePointer[i].StateBlock.EndPos + BitConverter.ToUInt32(br_read(4), 0); |
207 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize = BitConverter.ToUInt32(br_read(4), 0); | 207 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize = BitConverter.ToUInt32(br_read(4), 0); |
208 | SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Code Chunk Pointer: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer); | 208 | SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Code Chunk Pointer: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer); |
209 | SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Call Frame Size: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize ); | 209 | SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Call Frame Size: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize ); |
210 | } | 210 | } |
211 | } | 211 | } |
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
215 | 215 | ||
216 | 216 | ||
217 | 217 | ||
218 | //// READ FUNCTION CODE CHUNKS | 218 | //// READ FUNCTION CODE CHUNKS |
219 | //// Functions + Function start pos (GFR) | 219 | //// Functions + Function start pos (GFR) |
220 | //// TODO: Somehow be able to identify and reference this | 220 | //// TODO: Somehow be able to identify and reference this |
221 | //LSO_Struct.CodeChunk[] myFunctionCodeChunk; | 221 | //LSO_Struct.CodeChunk[] myFunctionCodeChunk; |
222 | //if (myFunctionBlock.FunctionCount > 0) | 222 | //if (myFunctionBlock.FunctionCount > 0) |
223 | //{ | 223 | //{ |
224 | // myFunctionCodeChunk = new LSO_Struct.CodeChunk[myFunctionBlock.FunctionCount]; | 224 | // myFunctionCodeChunk = new LSO_Struct.CodeChunk[myFunctionBlock.FunctionCount]; |
225 | // for (int i = 0; i < myFunctionBlock.FunctionCount; i++) | 225 | // for (int i = 0; i < myFunctionBlock.FunctionCount; i++) |
226 | // { | 226 | // { |
227 | // SendToDebug("Reading Function Code Chunk " + i); | 227 | // SendToDebug("Reading Function Code Chunk " + i); |
228 | // myFunctionCodeChunk[i] = GetCodeChunk((UInt32)myFunctionBlock.CodeChunkPointer[i]); | 228 | // myFunctionCodeChunk[i] = GetCodeChunk((UInt32)myFunctionBlock.CodeChunkPointer[i]); |
229 | // } | 229 | // } |
230 | 230 | ||
231 | //} | 231 | //} |
232 | // READ EVENT CODE CHUNKS | 232 | // READ EVENT CODE CHUNKS |
233 | LSO_Struct.CodeChunk[] myEventCodeChunk; | 233 | LSO_Struct.CodeChunk[] myEventCodeChunk; |
234 | if (myStateFrameBlock.StateCount > 0) | 234 | if (myStateFrameBlock.StateCount > 0) |
235 | { | 235 | { |
236 | myEventCodeChunk = new LSO_Struct.CodeChunk[myStateFrameBlock.StateCount]; | 236 | myEventCodeChunk = new LSO_Struct.CodeChunk[myStateFrameBlock.StateCount]; |
237 | for (int i = 0; i < myStateFrameBlock.StateCount; i++) | 237 | for (int i = 0; i < myStateFrameBlock.StateCount; i++) |
238 | { | 238 | { |
239 | // TODO: Somehow organize events and functions so they can be found again, | 239 | // TODO: Somehow organize events and functions so they can be found again, |
240 | // two level search ain't no good | 240 | // two level search ain't no good |
241 | for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) | 241 | for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) |
242 | { | 242 | { |
243 | 243 | ||
244 | 244 | ||
245 | if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0) | 245 | if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0) |
246 | { | 246 | { |
247 | SendToDebug("Reading Event Code Chunk state " + i + ", event " + (LSO_Enums.Event_Mask_Values)ii); | 247 | SendToDebug("Reading Event Code Chunk state " + i + ", event " + (LSO_Enums.Event_Mask_Values)ii); |
248 | 248 | ||
249 | 249 | ||
250 | // Override a Method / Function | 250 | // Override a Method / Function |
251 | string eventname = "event_" + (LSO_Enums.Event_Mask_Values)ii; | 251 | string eventname = "event_" + (LSO_Enums.Event_Mask_Values)ii; |
252 | SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod..."); | 252 | SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod..."); |
253 | MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, | 253 | MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, |
254 | MethodAttributes.Private | MethodAttributes.Virtual, | 254 | MethodAttributes.Private | MethodAttributes.Virtual, |
255 | typeof(void), | 255 | typeof(void), |
256 | new Type[] { typeof(object) }); | 256 | new Type[] { typeof(object) }); |
257 | 257 | ||
258 | SendToDebug("CLR:" + eventname + ":typeBuilder.DefineMethodOverride(methodBuilder..."); | 258 | SendToDebug("CLR:" + eventname + ":typeBuilder.DefineMethodOverride(methodBuilder..."); |
259 | typeBuilder.DefineMethodOverride(methodBuilder, | 259 | typeBuilder.DefineMethodOverride(methodBuilder, |
260 | typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname)); | 260 | typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname)); |
261 | 261 | ||
262 | // Create the IL generator | 262 | // Create the IL generator |
263 | 263 | ||
264 | SendToDebug("CLR:" + eventname + ":ILGenerator il = methodBuilder.GetILGenerator();"); | 264 | SendToDebug("CLR:" + eventname + ":ILGenerator il = methodBuilder.GetILGenerator();"); |
265 | ILGenerator il = methodBuilder.GetILGenerator(); | 265 | ILGenerator il = methodBuilder.GetILGenerator(); |
266 | 266 | ||
267 | 267 | ||
268 | LSO_Struct.CodeChunk myECC = | 268 | LSO_Struct.CodeChunk myECC = |
269 | GetCodeChunk(myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer, il, eventname); | 269 | GetCodeChunk(myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer, il, eventname); |
270 | } | 270 | } |
271 | 271 | ||
272 | } | 272 | } |
273 | } | 273 | } |
274 | 274 | ||
275 | } | 275 | } |
276 | 276 | ||
277 | 277 | ||
278 | // Close | 278 | // Close |
279 | br.Close(); | 279 | br.Close(); |
280 | fs.Close(); | 280 | fs.Close(); |
281 | 281 | ||
282 | } | 282 | } |
283 | 283 | ||
284 | private LSO_Struct.HeapBlock GetHeap(UInt32 pos) | 284 | private LSO_Struct.HeapBlock GetHeap(UInt32 pos) |
285 | { | 285 | { |
286 | // HEAP BLOCK | 286 | // HEAP BLOCK |
287 | // TODO:? Special read for strings/keys (null terminated) and lists (pointers to other HEAP entries) | 287 | // TODO:? Special read for strings/keys (null terminated) and lists (pointers to other HEAP entries) |
288 | SendToDebug("Reading HEAP BLOCK at: " + pos); | 288 | SendToDebug("Reading HEAP BLOCK at: " + pos); |
289 | fs.Seek(pos, SeekOrigin.Begin); | 289 | fs.Seek(pos, SeekOrigin.Begin); |
290 | 290 | ||
291 | LSO_Struct.HeapBlock myHeapBlock = new LSO_Struct.HeapBlock(); | 291 | LSO_Struct.HeapBlock myHeapBlock = new LSO_Struct.HeapBlock(); |
292 | myHeapBlock.DataBlockSize = BitConverter.ToUInt32(br_read(4), 0); | 292 | myHeapBlock.DataBlockSize = BitConverter.ToUInt32(br_read(4), 0); |
293 | myHeapBlock.ObjectType = br_read(1)[0]; | 293 | myHeapBlock.ObjectType = br_read(1)[0]; |
294 | myHeapBlock.ReferenceCount = BitConverter.ToUInt16(br_read(2), 0); | 294 | myHeapBlock.ReferenceCount = BitConverter.ToUInt16(br_read(2), 0); |
295 | myHeapBlock.Data = br_read(getObjectSize(myHeapBlock.ObjectType)); | 295 | myHeapBlock.Data = br_read(getObjectSize(myHeapBlock.ObjectType)); |
296 | 296 | ||
297 | SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize); | 297 | SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize); |
298 | SendToDebug("Heap Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myHeapBlock.ObjectType).ToString()); | 298 | SendToDebug("Heap Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myHeapBlock.ObjectType).ToString()); |
299 | SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount); | 299 | SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount); |
300 | 300 | ||
301 | return myHeapBlock; | 301 | return myHeapBlock; |
302 | } | 302 | } |
303 | 303 | ||
304 | 304 | ||
305 | 305 | ||
306 | private byte[] br_read(int len) | 306 | private byte[] br_read(int len) |
307 | { | 307 | { |
308 | if (len <= 0) | 308 | if (len <= 0) |
309 | return null; | 309 | return null; |
310 | 310 | ||
311 | try | 311 | try |
312 | { | 312 | { |
313 | byte[] bytes = new byte[len]; | 313 | byte[] bytes = new byte[len]; |
314 | for (int i = len - 1; i > -1; i--) | 314 | for (int i = len - 1; i > -1; i--) |
315 | bytes[i] = br.ReadByte(); | 315 | bytes[i] = br.ReadByte(); |
316 | return bytes; | 316 | return bytes; |
317 | } | 317 | } |
318 | catch (Exception e) | 318 | catch (Exception e) |
319 | { | 319 | { |
320 | SendToDebug("Exception: " + e.ToString()); | 320 | SendToDebug("Exception: " + e.ToString()); |
321 | throw (e); | 321 | throw (e); |
322 | } | 322 | } |
323 | } | 323 | } |
324 | //private byte[] br_read_smallendian(int len) | 324 | //private byte[] br_read_smallendian(int len) |
325 | //{ | 325 | //{ |
326 | // byte[] bytes = new byte[len]; | 326 | // byte[] bytes = new byte[len]; |
327 | // br.Read(bytes,0, len); | 327 | // br.Read(bytes,0, len); |
328 | // return bytes; | 328 | // return bytes; |
329 | //} | 329 | //} |
330 | 330 | ||
331 | private int getObjectSize(byte ObjectType) | 331 | private int getObjectSize(byte ObjectType) |
332 | { | 332 | { |
333 | switch (ObjectType) | 333 | switch (ObjectType) |
334 | { | 334 | { |
335 | case 1: | 335 | case 1: |
336 | case 2: | 336 | case 2: |
337 | case 3: | 337 | case 3: |
338 | case 4: | 338 | case 4: |
339 | case 7: | 339 | case 7: |
340 | return 4; | 340 | return 4; |
341 | case 5: | 341 | case 5: |
342 | return 12; | 342 | return 12; |
343 | case 6: | 343 | case 6: |
344 | return 16; | 344 | return 16; |
345 | default: | 345 | default: |
346 | return 0; | 346 | return 0; |
347 | } | 347 | } |
348 | } | 348 | } |
349 | private void SendToDebug(string Message) | 349 | private void SendToDebug(string Message) |
350 | { | 350 | { |
351 | if (Debug == true) | 351 | if (Debug == true) |
352 | Console.WriteLine("Debug: " + Message); | 352 | Console.WriteLine("Debug: " + Message); |
353 | } | 353 | } |
354 | 354 | ||
355 | 355 | ||
356 | private string Read_String() | 356 | private string Read_String() |
357 | { | 357 | { |
358 | string ret = ""; | 358 | string ret = ""; |
359 | byte reader = br_read(1)[0]; | 359 | byte reader = br_read(1)[0]; |
360 | while (reader != 0x000) | 360 | while (reader != 0x000) |
361 | { | 361 | { |
362 | ret += (char)reader; | 362 | ret += (char)reader; |
363 | reader = br_read(1)[0]; | 363 | reader = br_read(1)[0]; |
364 | } | 364 | } |
365 | return ret; | 365 | return ret; |
366 | } | 366 | } |
367 | 367 | ||
368 | /// <summary> | 368 | /// <summary> |
369 | /// Reads a code chunk into structure and returns it. | 369 | /// Reads a code chunk into structure and returns it. |
370 | /// </summary> | 370 | /// </summary> |
371 | /// <param name="pos">Absolute position in file. REMEMBER TO ADD myHeader.GFR!</param> | 371 | /// <param name="pos">Absolute position in file. REMEMBER TO ADD myHeader.GFR!</param> |
372 | /// <returns></returns> | 372 | /// <returns></returns> |
373 | private LSO_Struct.CodeChunk GetCodeChunk(UInt32 pos, ILGenerator il, string eventname) | 373 | private LSO_Struct.CodeChunk GetCodeChunk(UInt32 pos, ILGenerator il, string eventname) |
374 | { | 374 | { |
375 | 375 | ||
376 | /* | 376 | /* |
377 | * CLR TRY | 377 | * CLR TRY |
378 | */ | 378 | */ |
379 | //SendToDebug("CLR:" + eventname + ":il.BeginExceptionBlock()"); | 379 | //SendToDebug("CLR:" + eventname + ":il.BeginExceptionBlock()"); |
380 | il.BeginExceptionBlock(); | 380 | il.BeginExceptionBlock(); |
381 | 381 | ||
382 | // Push "Hello World!" string to stack | 382 | // Push "Hello World!" string to stack |
383 | //SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); | 383 | //SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); |
384 | il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname); | 384 | il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname); |
385 | 385 | ||
386 | // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); | 386 | // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); |
387 | //SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); | 387 | //SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); |
388 | il.Emit(OpCodes.Call, typeof(Console).GetMethod | 388 | il.Emit(OpCodes.Call, typeof(Console).GetMethod |
389 | ("WriteLine", new Type[] { typeof(string) })); | 389 | ("WriteLine", new Type[] { typeof(string) })); |
390 | 390 | ||
391 | 391 | ||
392 | LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk(); | 392 | LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk(); |
393 | 393 | ||
394 | SendToDebug("Reading Function Code Chunk at: " + pos); | 394 | SendToDebug("Reading Function Code Chunk at: " + pos); |
395 | fs.Seek(pos, SeekOrigin.Begin); | 395 | fs.Seek(pos, SeekOrigin.Begin); |
396 | myCodeChunk.CodeChunkHeaderSize = BitConverter.ToUInt32(br_read(4), 0); | 396 | myCodeChunk.CodeChunkHeaderSize = BitConverter.ToUInt32(br_read(4), 0); |
397 | SendToDebug("CodeChunk Header Size: " + myCodeChunk.CodeChunkHeaderSize ); | 397 | SendToDebug("CodeChunk Header Size: " + myCodeChunk.CodeChunkHeaderSize ); |
398 | // Read until null | 398 | // Read until null |
399 | myCodeChunk.Comment = Read_String(); | 399 | myCodeChunk.Comment = Read_String(); |
400 | SendToDebug("Function comment: " + myCodeChunk.Comment); | 400 | SendToDebug("Function comment: " + myCodeChunk.Comment); |
401 | myCodeChunk.ReturnType = br_read(1)[0]; | 401 | myCodeChunk.ReturnType = br_read(1)[0]; |
402 | SendToDebug("Return type: " + (LSO_Enums.Variable_Type_Codes)myCodeChunk.ReturnType); | 402 | SendToDebug("Return type: " + (LSO_Enums.Variable_Type_Codes)myCodeChunk.ReturnType); |
403 | // TODO: How to determine number of codechunks -- does this method work? | 403 | // TODO: How to determine number of codechunks -- does this method work? |
404 | myCodeChunk.CodeChunkArguments = new System.Collections.Generic.List<LSO_Struct.CodeChunkArgument>(); | 404 | myCodeChunk.CodeChunkArguments = new System.Collections.Generic.List<LSO_Struct.CodeChunkArgument>(); |
405 | byte reader = br_read(1)[0]; | 405 | byte reader = br_read(1)[0]; |
406 | reader = br_read(1)[0]; | 406 | reader = br_read(1)[0]; |
407 | int ccount = 0; | 407 | int ccount = 0; |
408 | while (reader != 0x000) | 408 | while (reader != 0x000) |
409 | { | 409 | { |
410 | ccount++; | 410 | ccount++; |
411 | SendToDebug("Reading Code Chunk Argument " + ccount); | 411 | SendToDebug("Reading Code Chunk Argument " + ccount); |
412 | LSO_Struct.CodeChunkArgument CCA = new LSO_Struct.CodeChunkArgument(); | 412 | LSO_Struct.CodeChunkArgument CCA = new LSO_Struct.CodeChunkArgument(); |
413 | CCA.FunctionReturnType = reader; | 413 | CCA.FunctionReturnType = reader; |
414 | reader = br_read(1)[0]; | 414 | reader = br_read(1)[0]; |
415 | CCA.NullString = reader; | 415 | CCA.NullString = reader; |
416 | myCodeChunk.CodeChunkArguments.Add(CCA); | 416 | myCodeChunk.CodeChunkArguments.Add(CCA); |
417 | SendToDebug("Code Chunk Argument " + ccount + " return type: " + (LSO_Enums.Variable_Type_Codes)CCA.FunctionReturnType); | 417 | SendToDebug("Code Chunk Argument " + ccount + " return type: " + (LSO_Enums.Variable_Type_Codes)CCA.FunctionReturnType); |
418 | } | 418 | } |
419 | // End marker is 0x000 | 419 | // End marker is 0x000 |
420 | myCodeChunk.EndMarker = reader; | 420 | myCodeChunk.EndMarker = reader; |
421 | // TODO: How to read and identify following code | 421 | // TODO: How to read and identify following code |
422 | // TODO: Code is read until a return of some sort is found | 422 | // TODO: Code is read until a return of some sort is found |
423 | bool FoundRet = false; | 423 | bool FoundRet = false; |
424 | while (FoundRet == false) | 424 | while (FoundRet == false) |
425 | { | 425 | { |
426 | //reader = br_read(1)[0]; | 426 | //reader = br_read(1)[0]; |
427 | //UInt16 opcode = BitConverter.ToUInt16(br_read(1),0); | 427 | //UInt16 opcode = BitConverter.ToUInt16(br_read(1),0); |
428 | UInt16 opcode = br_read(1)[0]; | 428 | UInt16 opcode = br_read(1)[0]; |
429 | //long rPos = fs.Position; | 429 | //long rPos = fs.Position; |
430 | SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table)opcode).ToString()); | 430 | SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table)opcode).ToString()); |
431 | switch (opcode) | 431 | switch (opcode) |
432 | { | 432 | { |
433 | // LONG | 433 | // LONG |
434 | case (UInt16)LSO_Enums.Operation_Table.POPARG: | 434 | case (UInt16)LSO_Enums.Operation_Table.POPARG: |
435 | case (UInt16)LSO_Enums.Operation_Table.STORE: | 435 | case (UInt16)LSO_Enums.Operation_Table.STORE: |
436 | case (UInt16)LSO_Enums.Operation_Table.STORES: | 436 | case (UInt16)LSO_Enums.Operation_Table.STORES: |
437 | case (UInt16)LSO_Enums.Operation_Table.STOREL: | 437 | case (UInt16)LSO_Enums.Operation_Table.STOREL: |
438 | case (UInt16)LSO_Enums.Operation_Table.STOREV: | 438 | case (UInt16)LSO_Enums.Operation_Table.STOREV: |
439 | case (UInt16)LSO_Enums.Operation_Table.STOREQ: | 439 | case (UInt16)LSO_Enums.Operation_Table.STOREQ: |
440 | case (UInt16)LSO_Enums.Operation_Table.STOREG: | 440 | case (UInt16)LSO_Enums.Operation_Table.STOREG: |
441 | case (UInt16)LSO_Enums.Operation_Table.STOREGS: | 441 | case (UInt16)LSO_Enums.Operation_Table.STOREGS: |
442 | case (UInt16)LSO_Enums.Operation_Table.STOREGL: | 442 | case (UInt16)LSO_Enums.Operation_Table.STOREGL: |
443 | case (UInt16)LSO_Enums.Operation_Table.STOREGV: | 443 | case (UInt16)LSO_Enums.Operation_Table.STOREGV: |
444 | case (UInt16)LSO_Enums.Operation_Table.STOREGQ: | 444 | case (UInt16)LSO_Enums.Operation_Table.STOREGQ: |
445 | case (UInt16)LSO_Enums.Operation_Table.LOADP: | 445 | case (UInt16)LSO_Enums.Operation_Table.LOADP: |
446 | case (UInt16)LSO_Enums.Operation_Table.LOADSP: | 446 | case (UInt16)LSO_Enums.Operation_Table.LOADSP: |
447 | case (UInt16)LSO_Enums.Operation_Table.LOADLP: | 447 | case (UInt16)LSO_Enums.Operation_Table.LOADLP: |
448 | case (UInt16)LSO_Enums.Operation_Table.LOADVP: | 448 | case (UInt16)LSO_Enums.Operation_Table.LOADVP: |
449 | case (UInt16)LSO_Enums.Operation_Table.LOADQP: | 449 | case (UInt16)LSO_Enums.Operation_Table.LOADQP: |
450 | case (UInt16)LSO_Enums.Operation_Table.PUSH: | 450 | case (UInt16)LSO_Enums.Operation_Table.PUSH: |
451 | case (UInt16)LSO_Enums.Operation_Table.PUSHS: | 451 | case (UInt16)LSO_Enums.Operation_Table.PUSHS: |
452 | case (UInt16)LSO_Enums.Operation_Table.PUSHL: | 452 | case (UInt16)LSO_Enums.Operation_Table.PUSHL: |
453 | case (UInt16)LSO_Enums.Operation_Table.PUSHV: | 453 | case (UInt16)LSO_Enums.Operation_Table.PUSHV: |
454 | case (UInt16)LSO_Enums.Operation_Table.PUSHQ: | 454 | case (UInt16)LSO_Enums.Operation_Table.PUSHQ: |
455 | case (UInt16)LSO_Enums.Operation_Table.PUSHG: | 455 | case (UInt16)LSO_Enums.Operation_Table.PUSHG: |
456 | case (UInt16)LSO_Enums.Operation_Table.PUSHGS: | 456 | case (UInt16)LSO_Enums.Operation_Table.PUSHGS: |
457 | case (UInt16)LSO_Enums.Operation_Table.PUSHGL: | 457 | case (UInt16)LSO_Enums.Operation_Table.PUSHGL: |
458 | case (UInt16)LSO_Enums.Operation_Table.PUSHGV: | 458 | case (UInt16)LSO_Enums.Operation_Table.PUSHGV: |
459 | case (UInt16)LSO_Enums.Operation_Table.PUSHGQ: | 459 | case (UInt16)LSO_Enums.Operation_Table.PUSHGQ: |
460 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); | 460 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); |
461 | break; | 461 | break; |
462 | // BYTE | 462 | // BYTE |
463 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGB: | 463 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGB: |
464 | SendToDebug("Param1: " + br_read(1)[0]); | 464 | SendToDebug("Param1: " + br_read(1)[0]); |
465 | break; | 465 | break; |
466 | // INTEGER | 466 | // INTEGER |
467 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGI: | 467 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGI: |
468 | // TODO: What is size of integer? | 468 | // TODO: What is size of integer? |
469 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); | 469 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); |
470 | break; | 470 | break; |
471 | // FLOAT | 471 | // FLOAT |
472 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGF: | 472 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGF: |
473 | // TODO: What is size of float? | 473 | // TODO: What is size of float? |
474 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); | 474 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); |
475 | break; | 475 | break; |
476 | // STRING | 476 | // STRING |
477 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGS: | 477 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGS: |
478 | string s = Read_String(); | 478 | string s = Read_String(); |
479 | SendToDebug("Param1: " + s); | 479 | SendToDebug("Param1: " + s); |
480 | il.Emit(OpCodes.Ldstr, s); | 480 | il.Emit(OpCodes.Ldstr, s); |
481 | break; | 481 | break; |
482 | // VECTOR z,y,x | 482 | // VECTOR z,y,x |
483 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGV: | 483 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGV: |
484 | SendToDebug("Param1 Z: " + BitConverter.ToUInt32(br_read(4),0)); | 484 | SendToDebug("Param1 Z: " + BitConverter.ToUInt32(br_read(4),0)); |
485 | SendToDebug("Param1 Y: " + BitConverter.ToUInt32(br_read(4),0)); | 485 | SendToDebug("Param1 Y: " + BitConverter.ToUInt32(br_read(4),0)); |
486 | SendToDebug("Param1 X: " + BitConverter.ToUInt32(br_read(4),0)); | 486 | SendToDebug("Param1 X: " + BitConverter.ToUInt32(br_read(4),0)); |
487 | break; | 487 | break; |
488 | // ROTATION s,z,y,x | 488 | // ROTATION s,z,y,x |
489 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGQ: | 489 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGQ: |
490 | SendToDebug("Param1 S: " + BitConverter.ToUInt32(br_read(4),0)); | 490 | SendToDebug("Param1 S: " + BitConverter.ToUInt32(br_read(4),0)); |
491 | SendToDebug("Param1 Z: " + BitConverter.ToUInt32(br_read(4),0)); | 491 | SendToDebug("Param1 Z: " + BitConverter.ToUInt32(br_read(4),0)); |
492 | SendToDebug("Param1 Y: " + BitConverter.ToUInt32(br_read(4),0)); | 492 | SendToDebug("Param1 Y: " + BitConverter.ToUInt32(br_read(4),0)); |
493 | SendToDebug("Param1 X: " + BitConverter.ToUInt32(br_read(4),0)); | 493 | SendToDebug("Param1 X: " + BitConverter.ToUInt32(br_read(4),0)); |
494 | break; | 494 | break; |
495 | // LONG | 495 | // LONG |
496 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGE: | 496 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGE: |
497 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); | 497 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); |
498 | break; | 498 | break; |
499 | // BYTE | 499 | // BYTE |
500 | case (UInt16)LSO_Enums.Operation_Table.ADD: | 500 | case (UInt16)LSO_Enums.Operation_Table.ADD: |
501 | case (UInt16)LSO_Enums.Operation_Table.SUB: | 501 | case (UInt16)LSO_Enums.Operation_Table.SUB: |
502 | case (UInt16)LSO_Enums.Operation_Table.MUL: | 502 | case (UInt16)LSO_Enums.Operation_Table.MUL: |
503 | case (UInt16)LSO_Enums.Operation_Table.DIV: | 503 | case (UInt16)LSO_Enums.Operation_Table.DIV: |
504 | case (UInt16)LSO_Enums.Operation_Table.MOD: | 504 | case (UInt16)LSO_Enums.Operation_Table.MOD: |
505 | case (UInt16)LSO_Enums.Operation_Table.EQ: | 505 | case (UInt16)LSO_Enums.Operation_Table.EQ: |
506 | case (UInt16)LSO_Enums.Operation_Table.NEQ: | 506 | case (UInt16)LSO_Enums.Operation_Table.NEQ: |
507 | case (UInt16)LSO_Enums.Operation_Table.LEQ: | 507 | case (UInt16)LSO_Enums.Operation_Table.LEQ: |
508 | case (UInt16)LSO_Enums.Operation_Table.GEQ: | 508 | case (UInt16)LSO_Enums.Operation_Table.GEQ: |
509 | case (UInt16)LSO_Enums.Operation_Table.LESS: | 509 | case (UInt16)LSO_Enums.Operation_Table.LESS: |
510 | case (UInt16)LSO_Enums.Operation_Table.GREATER: | 510 | case (UInt16)LSO_Enums.Operation_Table.GREATER: |
511 | case (UInt16)LSO_Enums.Operation_Table.BOOLOR: | 511 | case (UInt16)LSO_Enums.Operation_Table.BOOLOR: |
512 | SendToDebug("Param1: " + br_read(1)[0]); | 512 | SendToDebug("Param1: " + br_read(1)[0]); |
513 | break; | 513 | break; |
514 | // LONG | 514 | // LONG |
515 | case (UInt16)LSO_Enums.Operation_Table.JUMP: | 515 | case (UInt16)LSO_Enums.Operation_Table.JUMP: |
516 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); | 516 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); |
517 | break; | 517 | break; |
518 | // BYTE, LONG | 518 | // BYTE, LONG |
519 | case (UInt16)LSO_Enums.Operation_Table.JUMPIF: | 519 | case (UInt16)LSO_Enums.Operation_Table.JUMPIF: |
520 | case (UInt16)LSO_Enums.Operation_Table.JUMPNIF: | 520 | case (UInt16)LSO_Enums.Operation_Table.JUMPNIF: |
521 | SendToDebug("Param1: " + br_read(1)[0]); | 521 | SendToDebug("Param1: " + br_read(1)[0]); |
522 | SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4),0)); | 522 | SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4),0)); |
523 | break; | 523 | break; |
524 | // LONG | 524 | // LONG |
525 | case (UInt16)LSO_Enums.Operation_Table.STATE: | 525 | case (UInt16)LSO_Enums.Operation_Table.STATE: |
526 | case (UInt16)LSO_Enums.Operation_Table.CALL: | 526 | case (UInt16)LSO_Enums.Operation_Table.CALL: |
527 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); | 527 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); |
528 | break; | 528 | break; |
529 | // BYTE | 529 | // BYTE |
530 | case (UInt16)LSO_Enums.Operation_Table.CAST: | 530 | case (UInt16)LSO_Enums.Operation_Table.CAST: |
531 | SendToDebug("Param1: " + br_read(1)[0]); | 531 | SendToDebug("Param1: " + br_read(1)[0]); |
532 | break; | 532 | break; |
533 | // LONG | 533 | // LONG |
534 | case (UInt16)LSO_Enums.Operation_Table.STACKTOS: | 534 | case (UInt16)LSO_Enums.Operation_Table.STACKTOS: |
535 | case (UInt16)LSO_Enums.Operation_Table.STACKTOL: | 535 | case (UInt16)LSO_Enums.Operation_Table.STACKTOL: |
536 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); | 536 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); |
537 | break; | 537 | break; |
538 | // BYTE | 538 | // BYTE |
539 | case (UInt16)LSO_Enums.Operation_Table.PRINT: | 539 | case (UInt16)LSO_Enums.Operation_Table.PRINT: |
540 | case (UInt16)LSO_Enums.Operation_Table.CALLLIB: | 540 | case (UInt16)LSO_Enums.Operation_Table.CALLLIB: |
541 | SendToDebug("Param1: " + br_read(1)[0]); | 541 | SendToDebug("Param1: " + br_read(1)[0]); |
542 | break; | 542 | break; |
543 | // SHORT | 543 | // SHORT |
544 | case (UInt16)LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE: | 544 | case (UInt16)LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE: |
545 | // TODO: What is size of short? | 545 | // TODO: What is size of short? |
546 | UInt16 _i = BitConverter.ToUInt16(br_read(2), 0); | 546 | UInt16 _i = BitConverter.ToUInt16(br_read(2), 0); |
547 | SendToDebug("Param1: " + _i); | 547 | SendToDebug("Param1: " + _i); |
548 | switch (_i) | 548 | switch (_i) |
549 | { | 549 | { |
550 | case (UInt16)LSO_Enums.BuiltIn_Functions.llSay: | 550 | case (UInt16)LSO_Enums.BuiltIn_Functions.llSay: |
551 | il.Emit(OpCodes.Call, typeof(Console).GetMethod | 551 | il.Emit(OpCodes.Call, typeof(Console).GetMethod |
552 | ("WriteLine", new Type[] { typeof(string) })); | 552 | ("WriteLine", new Type[] { typeof(string) })); |
553 | break; | 553 | break; |
554 | } | 554 | } |
555 | break; | 555 | break; |
556 | 556 | ||
557 | 557 | ||
558 | // RETURN | 558 | // RETURN |
559 | case (UInt16)LSO_Enums.Operation_Table.RETURN: | 559 | case (UInt16)LSO_Enums.Operation_Table.RETURN: |
560 | SendToDebug("Last OPCODE was return command. Code chunk execution complete."); | 560 | SendToDebug("Last OPCODE was return command. Code chunk execution complete."); |
561 | FoundRet = true; | 561 | FoundRet = true; |
562 | break; | 562 | break; |
563 | } | 563 | } |
564 | //fs.Seek(rPos, SeekOrigin.Begin); | 564 | //fs.Seek(rPos, SeekOrigin.Begin); |
565 | 565 | ||
566 | } | 566 | } |
567 | 567 | ||
568 | 568 | ||
569 | /* | 569 | /* |
570 | * CATCH | 570 | * CATCH |
571 | */ | 571 | */ |
572 | SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));"); | 572 | SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));"); |
573 | il.BeginCatchBlock(typeof(Exception)); | 573 | il.BeginCatchBlock(typeof(Exception)); |
574 | 574 | ||
575 | // Push "Hello World!" string to stack | 575 | // Push "Hello World!" string to stack |
576 | SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); | 576 | SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); |
577 | il.Emit(OpCodes.Ldstr, "Execption executing dynamic CLR function " + eventname + ": "); | 577 | il.Emit(OpCodes.Ldstr, "Execption executing dynamic CLR function " + eventname + ": "); |
578 | 578 | ||
579 | //call void [mscorlib]System.Console::WriteLine(string) | 579 | //call void [mscorlib]System.Console::WriteLine(string) |
580 | SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); | 580 | SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); |
581 | il.Emit(OpCodes.Call, typeof(Console).GetMethod | 581 | il.Emit(OpCodes.Call, typeof(Console).GetMethod |
582 | ("Write", new Type[] { typeof(string) })); | 582 | ("Write", new Type[] { typeof(string) })); |
583 | 583 | ||
584 | //callvirt instance string [mscorlib]System.Exception::get_Message() | 584 | //callvirt instance string [mscorlib]System.Exception::get_Message() |
585 | SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt..."); | 585 | SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt..."); |
586 | il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod | 586 | il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod |
587 | ("get_Message")); | 587 | ("get_Message")); |
588 | 588 | ||
589 | //call void [mscorlib]System.Console::WriteLine(string) | 589 | //call void [mscorlib]System.Console::WriteLine(string) |
590 | SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); | 590 | SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); |
591 | il.Emit(OpCodes.Call, typeof(Console).GetMethod | 591 | il.Emit(OpCodes.Call, typeof(Console).GetMethod |
592 | ("WriteLine", new Type[] { typeof(string) })); | 592 | ("WriteLine", new Type[] { typeof(string) })); |
593 | 593 | ||
594 | /* | 594 | /* |
595 | * CLR END TRY | 595 | * CLR END TRY |
596 | */ | 596 | */ |
597 | //SendToDebug("CLR:" + eventname + ":il.EndExceptionBlock();"); | 597 | //SendToDebug("CLR:" + eventname + ":il.EndExceptionBlock();"); |
598 | il.EndExceptionBlock(); | 598 | il.EndExceptionBlock(); |
599 | // Push "Return from current method, with return value if present" to stack | 599 | // Push "Return from current method, with return value if present" to stack |
600 | il.Emit(OpCodes.Ret); | 600 | il.Emit(OpCodes.Ret); |
601 | 601 | ||
602 | 602 | ||
603 | 603 | ||
604 | return myCodeChunk; | 604 | return myCodeChunk; |
605 | 605 | ||
606 | } | 606 | } |
607 | } | 607 | } |
608 | } | 608 | } |
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Struct.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Struct.cs index 3b91e9f..66c6c5e 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Struct.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Struct.cs | |||
@@ -1,105 +1,105 @@ | |||
1 | 1 | ||
2 | using System; | 2 | using System; |
3 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
4 | using System.Text; | 4 | using System.Text; |
5 | 5 | ||
6 | namespace OpenSim.ScriptEngines.LSL | 6 | namespace OpenSim.ScriptEngines.LSL |
7 | { | 7 | { |
8 | static class LSO_Struct | 8 | static class LSO_Struct |
9 | { | 9 | { |
10 | 10 | ||
11 | public struct Header | 11 | public struct Header |
12 | { | 12 | { |
13 | public UInt32 TM; | 13 | public UInt32 TM; |
14 | public UInt32 IP; | 14 | public UInt32 IP; |
15 | public UInt32 VN; | 15 | public UInt32 VN; |
16 | public UInt32 BP; | 16 | public UInt32 BP; |
17 | public UInt32 SP; | 17 | public UInt32 SP; |
18 | public UInt32 HR; | 18 | public UInt32 HR; |
19 | public UInt32 HP; | 19 | public UInt32 HP; |
20 | public UInt32 CS; | 20 | public UInt32 CS; |
21 | public UInt32 NS; | 21 | public UInt32 NS; |
22 | public UInt32 CE; | 22 | public UInt32 CE; |
23 | public UInt32 IE; | 23 | public UInt32 IE; |
24 | public UInt32 ER; | 24 | public UInt32 ER; |
25 | public UInt32 FR; | 25 | public UInt32 FR; |
26 | public UInt32 SLR; | 26 | public UInt32 SLR; |
27 | public UInt32 GVR; | 27 | public UInt32 GVR; |
28 | public UInt32 GFR; | 28 | public UInt32 GFR; |
29 | public UInt32 PR; | 29 | public UInt32 PR; |
30 | public UInt32 ESR; | 30 | public UInt32 ESR; |
31 | public UInt32 SR; | 31 | public UInt32 SR; |
32 | public UInt64 NCE; | 32 | public UInt64 NCE; |
33 | public UInt64 NIE; | 33 | public UInt64 NIE; |
34 | public UInt64 NER; | 34 | public UInt64 NER; |
35 | } | 35 | } |
36 | 36 | ||
37 | public struct StaticBlock | 37 | public struct StaticBlock |
38 | { | 38 | { |
39 | public UInt32 Static_Chunk_Header_Size; | 39 | public UInt32 Static_Chunk_Header_Size; |
40 | public byte ObjectType; | 40 | public byte ObjectType; |
41 | public byte Unknown; | 41 | public byte Unknown; |
42 | public byte[] BlockVariable; | 42 | public byte[] BlockVariable; |
43 | } | 43 | } |
44 | /* Not actually a structure | 44 | /* Not actually a structure |
45 | public struct StaticBlockVariable | 45 | public struct StaticBlockVariable |
46 | { | 46 | { |
47 | public UInt32 Integer1; | 47 | public UInt32 Integer1; |
48 | public UInt32 Float1; | 48 | public UInt32 Float1; |
49 | public UInt32 HeapPointer_String; | 49 | public UInt32 HeapPointer_String; |
50 | public UInt32 HeapPointer_Key; | 50 | public UInt32 HeapPointer_Key; |
51 | public byte[] Vector_12; | 51 | public byte[] Vector_12; |
52 | public byte[] Rotation_16; | 52 | public byte[] Rotation_16; |
53 | public UInt32 Pointer_List_Structure; | 53 | public UInt32 Pointer_List_Structure; |
54 | } */ | 54 | } */ |
55 | public struct HeapBlock | 55 | public struct HeapBlock |
56 | { | 56 | { |
57 | public UInt32 DataBlockSize; | 57 | public UInt32 DataBlockSize; |
58 | public byte ObjectType; | 58 | public byte ObjectType; |
59 | public UInt16 ReferenceCount; | 59 | public UInt16 ReferenceCount; |
60 | public byte[] Data; | 60 | public byte[] Data; |
61 | } | 61 | } |
62 | public struct StateFrameBlock | 62 | public struct StateFrameBlock |
63 | { | 63 | { |
64 | public UInt32 StateCount; | 64 | public UInt32 StateCount; |
65 | public StatePointerBlock[] StatePointer; | 65 | public StatePointerBlock[] StatePointer; |
66 | } | 66 | } |
67 | public struct StatePointerBlock | 67 | public struct StatePointerBlock |
68 | { | 68 | { |
69 | public UInt32 Location; | 69 | public UInt32 Location; |
70 | public System.Collections.BitArray EventMask; | 70 | public System.Collections.BitArray EventMask; |
71 | public StateBlock StateBlock; | 71 | public StateBlock StateBlock; |
72 | } | 72 | } |
73 | public struct StateBlock | 73 | public struct StateBlock |
74 | { | 74 | { |
75 | public UInt32 StartPos; | 75 | public UInt32 StartPos; |
76 | public UInt32 EndPos; | 76 | public UInt32 EndPos; |
77 | public UInt32 HeaderSize; | 77 | public UInt32 HeaderSize; |
78 | public byte Unknown; | 78 | public byte Unknown; |
79 | public StateBlockHandler[] StateBlockHandlers; | 79 | public StateBlockHandler[] StateBlockHandlers; |
80 | } | 80 | } |
81 | public struct StateBlockHandler | 81 | public struct StateBlockHandler |
82 | { | 82 | { |
83 | public UInt32 CodeChunkPointer; | 83 | public UInt32 CodeChunkPointer; |
84 | public UInt32 CallFrameSize; | 84 | public UInt32 CallFrameSize; |
85 | } | 85 | } |
86 | public struct FunctionBlock | 86 | public struct FunctionBlock |
87 | { | 87 | { |
88 | public UInt32 FunctionCount; | 88 | public UInt32 FunctionCount; |
89 | public UInt32[] CodeChunkPointer; | 89 | public UInt32[] CodeChunkPointer; |
90 | } | 90 | } |
91 | public struct CodeChunk | 91 | public struct CodeChunk |
92 | { | 92 | { |
93 | public UInt32 CodeChunkHeaderSize; | 93 | public UInt32 CodeChunkHeaderSize; |
94 | public string Comment; | 94 | public string Comment; |
95 | public System.Collections.Generic.List<CodeChunkArgument> CodeChunkArguments; | 95 | public System.Collections.Generic.List<CodeChunkArgument> CodeChunkArguments; |
96 | public byte EndMarker; | 96 | public byte EndMarker; |
97 | public byte ReturnType; | 97 | public byte ReturnType; |
98 | } | 98 | } |
99 | public struct CodeChunkArgument | 99 | public struct CodeChunkArgument |
100 | { | 100 | { |
101 | public byte FunctionReturnType; | 101 | public byte FunctionReturnType; |
102 | public byte NullString; | 102 | public byte NullString; |
103 | } | 103 | } |
104 | } | 104 | } |
105 | } | 105 | } |