I need to execute Angelscript bytecode in my own Virtual Machine as I need to perform tasks as part of the execution that the AngelScript VM is incapable of. Currently, I am using SaveByteCode on the module, and then trying to parse the resultant bytecode. The problem so far is that I am unsure what the format of this bytecode is... it's not straight bytecodes going straight in.
I wrote a very simple AS script:
void run ()
{
print("RUN CALLED");
}
Which results in the following output:
01 00 00 00 00 00 01 66 6E 03 ? ? ? ? ? ? ? f n ? 72 75 6E 40 4E 00 00 00 00 01 r u n @ N ? ? ? ? ? 00 00 00 0C 3F 3C 00 3D 00 3B ? ? ? ? ? < ? = ? ; 04 01 3D 01 04 01 3D 02 04 01 ? ? = ? ? ? = ? ? ? 3D 03 3F 0A 00 01 01 6F 6E 06 = ? ? ? ? ? ? o n ? 73 74 72 69 6E 67 00 04 01 00 s t r i n g ? ? ? ? 02 06 01 01 0A 01 00 00 00 01 ? ? ? ? ? ? ? ? ? ? 72 00 00 00 00 05 61 6E 10 5F r ? ? ? ? ? a n ? _ 73 74 72 69 6E 67 5F 66 61 63 s t r i n g _ f a c 74 6F 72 79 5F 05 6F 72 01 00 t o r y _ ? o r ? ? 00 00 01 01 02 40 42 00 01 40 ? ? ? ? ? @ B ? ? @ 4A 01 01 00 00 00 00 00 61 6E J ? ? ? ? ? ? ? a n 07 5F 62 65 68 5F 30 5F 00 00 ? _ b e h _ 0 _ ? ? 01 00 01 01 01 00 00 6F 72 01 ? ? ? ? ? ? ? o r ? 00 00 61 6E 05 70 72 69 6E 74 ? ? a n ? p r i n t 00 00 01 00 01 01 01 00 00 00 ? ? ? ? ? ? ? ? ? ? 00 61 6E 07 5F 62 65 68 5F 31 ? a n ? _ b e h _ 1 5F 00 00 00 00 00 00 6F 72 01 _ ? ? ? ? ? ? o r ? 00 00 6E 00 01 6E 0A 52 55 4E ? ? n ? ? n ? R U N 20 43 41 4C 4C 45 44 00 00 00 C A L L E D ? ? ?
How would I go about loading this and other scripts? The AngelScript documentation doesn't go into detail about the specifics of precompiled bytecode, only the API side of things.
Edited by Ameise, 15 February 2013 - 12:34 AM.






