TommyBear wrote:I think you are forgetting that you cannot run managed C++ on XNA at the moment.
You can (Well, not Managed C++, that's deprecated, but C++/CLR). MS just doesn't make it as easy as with C#, but compiled down the bytecode is identical.
Okay, I'll bite. How would I make this compile and then deploy on the 360?
I can develop C++/CLR code C++ express, but then I need a way to deploy it and C# express is the only thing that deploy at the moment. Perhaps I'll hunt around the command line tools for a bit. Hmmmmm
That is awesome... I tried this a while back and had some issues calling the class library I compiled... but perhaps I was doing something wrong... Going to take a look at this soon.
Ok I've managed to build ScummVM in C++ CLR... I'm now hunting for bits and pieces of code that force native compilation. After this I will write the C# wrapper and reference the new ScummVM-CLR assembly via gse.
If all goes well I'll just need to modify scummVM slightly to allow the ScummVM update loop to be ticked from within C# and it's XNA game framework and then I'll be writing the backend!
This is, of course, if I can get gse abd the xbox360 to accept the assembly We'll see. Thanks again for the advice.
You might have some problems with the game loop though, since each engine in ScummVM uses its own. The easiest solution might be to just run the actual ScummVM in a thread of its own, with a shared buffer for the screen updates (If Microsoft would've just allowed us to override the Game.Run method, things would've been so much simpler...).
Okay... I've got ScummVM compiled totally to MSIL (using /clr:pure), and I've got a small XNA wrapper, that instantiates the class in the assembly and calls a method. It does deploy to the console, but running the assembly I get:
An unhandled exception of type 'System.TypeLoadException' occurred in ScummVM-XNA.exe
Which makes me think that the two are not using the same framework etc etc.
Anyway I'm off to get some sleep I'll take a look at this tomorrow.
Well I've taken I good long look at the problem, which basically seems to boil down to that the ScummVM classes end up looking like this in the assembly:
With that in mind, it appears that the C++ code in ScummVM is still being compiled as native x86 code in clr mode. Even when pure mode is used, I imagine the absence on both the CompilerServices and VisualC namespaces on the framework running on the XBox360, can't make this a better situation. The code simply cannot be in PPC format. So it looks like it's C# or bust... note that managed c++ segments work fine, it's just trying to call the native bits that blows up. If anyone has any suggestions, then I'm all ears.
At a guess, the above might be compiled to native code because packing of structs isn't supported in MSIL? There should be ways around that, as well as the lack of varargs.
I'm less sure about the missing namespaces though, I haven't seen the 360 framework in a lot of detail (what exactly is being called in those namespaces?).
I'll try to spare some time to look at this before new years .
Also note that I took the packing out of the structs, by #define-ing out the packing explicitly. I also tried to force include a header with "#pragma managed" into each compiled file. I haven't removed all the varargs instances, but surely I'd expect to see some managed code somewhere even with those in there.
I'm currently committing the entire group of CLR work into the repository. I expect it to be finished committing in about 40 minutes. You can get it here when it's done:
Cool. Please note that the all scummvm code is included in the repository as I have actually made changes to it to get it to compile... at the moment this is all a hack... this is my disclaimer If this actually works, I'll do a proper diff of this tree against the 0.9.1 branch and include only the changes blah blah blah.