|
Aug
17
Written by:
Jeremiah Morrill
8/17/2008 6:34 AM
I have been toiling more with the XNA libs, trying to get the IDirect3DDevice9Ex injected in...And boy, its not easy! Specially since there is so much unmanaged code in the XNA libs and the unmanaged code it's calling isn't so obvious via Reflector. I started off with the ILDASM tool to find the byte patterns of the IL I wanted to change. Then with my trusty hex editor, I searched for the bytes and replaced them. So far I have been replacing the hard-coded D3DPOOL_MANAGED to D3DPOOL_DEFAULT where applicable. This involves changing the IL command "ldc.i4.1" (byte value 0x17) with the IL command "ldc.i4.0" (byte value 0x16). Though I have to be careful because the XNA content manager seems to also use the D3DPOOL_SYSTEMMEM. For some reason using the content manager seems to make it crash right now, but if I don't use it, things seem to be fine so far! The screenshot (though not perfect yet) is XNA running a 9Ex device! I think if I can get the content manager to work, I should be a step closer.
Tags:
16 comment(s) so far...
Re: XNA Quest of IDirect3DDevice9Ex
It would be interesting to know if Microsoft intends to change this behaviour in some future update to the XNA framework so this could be done without your magic hackery...
By Neo on
8/17/2008 7:12 AM
|
Re: XNA Quest of IDirect3DDevice9Ex
You and me both!
By Jeremiah Morrill on
8/17/2008 7:19 AM
|
Re: XNA Quest of IDirect3DDevice9Ex
Why don't you add a request on connect site for XNA?
By Me on
8/18/2008 8:04 PM
|
Re: XNA Quest of IDirect3DDevice9Ex
I hope you will achieve success. Without IDirect3DDevice9Ex performance is very poor.
By daVinci on
8/22/2008 11:13 AM
|
Re: XNA Quest of IDirect3DDevice9Ex
I did hack the XNA dlls enough to get IDirect3DDevice9Ex working with XNA, and peformance was great! Though I did still have issues that I could not fix with the ContentManager. It seems as if the ContentManager loads textures into the system memory pool and creates a bunch of mip levels for it (I think) and it has problems when it gets to a level 7 or 8. Odd.
By Jeremiah Morrill on
8/22/2008 11:22 AM
|
Re: XNA Quest of IDirect3DDevice9Ex
I don't use ContentManager, give me your dll's to test it with my system! daVinci{at}mail.ru
By daVinci on
8/23/2008 3:26 AM
|
Re: XNA Quest of IDirect3DDevice9Ex
How is your work with improving XNA going along?
By daVinci on
9/5/2008 12:34 PM
|
Re: XNA Quest of IDirect3DDevice9Ex
Have you considered just using reflector to decompile the entire Microsoft.Xna.Framework.Game assembly, change the code and recompile? There's a plugin for reflector: http://www.denisbauer.com/NETTools/FileDisassembler.aspx
It even creates a vsproj which compiles the library with only a few minor modifications, seems to run great. I'm considering what it would mean to rewrite it to be D3DImage based rather than Winforms based -- remove the entire orphaned window and present a clean API.
By Greg Hermann on
10/20/2008 10:19 PM
|
Re: XNA Quest of IDirect3DDevice9Ex
Wish it was that easy. XNA is written in CLI/C++ so there some IL and some machine code in there.
By Jeremiah Morrill on
10/20/2008 10:25 PM
|
Re: XNA Quest of IDirect3DDevice9Ex
Have you considered just using reflector to decompile the entire Microsoft.Xna.Framework.Game assembly, change the code and recompile? There's a plugin for reflector: http://www.denisbauer.com/NETTools/FileDisassembler.aspx
It even creates a vsproj which compiles the library with only a few minor modifications, seems to run great. I'm considering what it would mean to rewrite it to be D3DImage based rather than Winforms based -- remove the entire orphaned window and present a clean API.
By Greg Hermann on
10/21/2008 12:03 AM
|
Re: XNA Quest of IDirect3DDevice9Ex
Odd double post, sorry about that. Actually, it is that easy. As long as you work only in Microsoft.Xna.Framework.Game, that assembly doesn't seem to have any of the C++/CLIisms.
Here's what I did to get good results -- I decompiled that assembly, changed over the winforms infrastructure to listen to WPF window events and such, use pinvoke to a private dll which creates a custom 9Ex device on Vista which has overrides for the CreateTexture/VB/IB/etc function calls to convert D3DPOOL_MANAGED to D3DPOOL_DEFAULT for just that 9Ex device. Voila, no more winforms, 9Ex and 9 are handled seamlessly, and the rest of the platform just works.
Fun stuff.
By Greg Hermann on
10/24/2008 12:34 AM
|
Re: XNA Quest of IDirect3DDevice9Ex
Looks like this might not be an issue for much longer, at least come .NET 4.0. Microsoft showed off a demo of XNA integration with WPF at PDC on Tuesday. If you want to see it in action, you can see the session video at the PDC site:
https://sessions.microsoftpdc.com/public/timeline.aspx
The session is PC46 (WPF Roadmap), XNA demo is around the 38 minute mark. I'm hoping they'll go into more details during the WPF Graphics Futures talk today (Session PC07). Might be a bit down the road, but it's encouraging that they're working on it.
By Matt Rudder on
10/30/2008 9:59 AM
|
Re: XNA Quest of IDirect3DDevice9Ex
this is something i have been very interested in lately. thanks.
By replica fendi scarf on
1/5/2010 11:24 PM
|
|
ed hardy
ED Hardy Hoodies ED Hardy Hoodies Ed Hardy Swimwear Ed Hardy Swimwear ed hardy tops ed hardy tops ed hardy shoes ed hardy shoes ed hardy t shirt ed hardy t shirt ed hardy shirts ed hardy shirts christian audigier christian audigier ed hardy kids ed hardy kids Ed Hardy Sunglasses Ed Hardy Sunglasses ED Hardy belts ED Hardy belts ed hardy Bags ed hardy Bags ed hardy purse ed hardy purse ed hardy mens ed hardy mens ed hardy womens d hardy womens ed hardy mens shirts ed hardy mens shirts ed hardy mens tops ed hardy mens tops ed hardy mens hoodies d hardy mens hoodies ed hardy mens swim trunks ed hardy mens swim trunks ed hardy mens shoes ed hardy mens shoes ed hardy womens swimwear ed hardy womens swimwear ed hardy womens t shirt ed hardy womens t shirt ed hardy womens tops ed hardy womens tops ed hardy womens pants ed hardy womens pants ed hardy womens hoodies ed hardy womens hoodies ed hardy womens shoes ed hardy womens shoes ed hardy womens clothing ed hardy womens clothing
By ed hardy on
3/15/2010 9:24 PM
|
cheap nike shox
There are wide variety of Nike Shox for both men and women's selection.The Nike Shox Sale are best selling nowadays.Get your own Cheap Nike Shox now.It's definitely time for you to buy womens nike shox and wens nike shox, Wearing them will keep you in a perfect condition.
By nike shox on
3/16/2010 10:11 PM
|
|
|
|