Saving compiled bytecode
asCModule::globalMem is dynamic memory for holding global script variables. If you call @init after loading the bytecode I think you don't have to save the content of the array (just the size).
cleanCode is in fact used by the exception handler to clean up each function in case of exceptions. Thus you should definitely save this code as well.
I will give you all the support I can in the form of answering questions.
Regards,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
I'm still writing the code so I can't test to see if it works or not. I'll report back when I have done some tests.
[edit]The union in asCProperty always seems to use index for script variables. Can I safely assume this to always be the case?
[edit2]I'm running into some problems with calling system functions. I'll debug it some more tomorrow and see if I can fix this up. System functions are registered in the engine and not the module, so I have no idea why it errors out...
[Edited by - Gyrbo on July 16, 2004 2:45:19 PM]
It could be that you are running into the same bug reported by Dentoid in the following thread:
http://www.gamedev.net/community/forums/topic.asp?topic_id=257373
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
I'll see if that's the same bug I'm having problems with. If this doesn't fix my problems I might try another approach.
Thank you for your advice.
[edit]Thanks to the wonderful debugger that comes with MSVC6.0, I found the problem. paramSize contained a bogus value and thus a crash in the ASM code. This was because this variable is being calculated by running asCScriptEngine::PrepareEngine(), which in turn is being called by (surpize surprize) asCModule::Build().
I still have to do some more tests and clean up the code a bit before I can show you guys anything. I'll probably place it all in a nice class and friend it in the needed classes so it has access to protected variables.
[edit2]My addition is almost done. Because I have no real-life code to work with, I'm not sure all functionality works. If someone can send me some example code I can test to see if it all works. I'd hate to send buggy code to WitchLord.
[Edited by - Gyrbo on July 17, 2004 10:42:21 AM]
Perhaps you can use the test framework available from the AngelScript site for your tests. You could even write your own tests as needed and send them to me.
I hope that I will be able to include your contribution in my library, but even if I can't do it at this moment I don't want your work to go to waste. It is too valuable for that and there are many developers asking for this feature. I promise you that I will upload your work to the AngelScript site as a stand alone improvement on AS, at least until I will have the time to include it in the official library.
I hope you don't feel bad about that. Your efforts are appreciated and I can assure you that they will be included in the library one day. I'm just not sure that this is the right moment to do it.
Regards,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
I'll have to perform some tests with global variables to see how to solve this, but it shouldn't be much of a problem.
The problem with making it an external add-on is that the new class uses some methods in asCScriptEngine and it has to friend with asCModule to be able to access protected variables.
It's good that you've made it a separate class, that should be much easier for me to import and maintain for future releases.
How have you designed the interface for this functionality?
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
This class is much like the asIOutputStream, but instead it's fully binary and supports reading and writing.
It's up to the user to implement code for checking if it should use the bytecode or the sourcecode. You can't pass both to the engine.
I'm downloading the latest version and I'll use that to do my further testing. Once everything work to my liking, I'll send the changes to you.
From what you tell me, I should be able to include your implementation already in version 1.9.0 (the next interface change).
Regards,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game