Played with xna4 development.
First, install the two laptops. It is very troublesome to download a complete package. I have installed it six times ......
The desktop computer in the home cannot be installed, and window7 can be reinstalled. It may be related to the installation of vs2010.
I tested the development of the windows and Windows phone7 simulators and made a simple graphical operation. Basically, it was still the interfaces of DX, which seemed familiar and did not encounter any difficulties. That is, the C # syntax is entangled for a long time. Speaking of C ++ and C #, # Is to overlap the two +, but it is still a lot worse. Although the system has learned a little about DOTNET, it has been a long time, but it still took a lot of effort.
1. References.
Ii. About Resources
3. pleasant places
My research record on the effect file.
I. fx_2_0 generated by fxc
The binary comparison shows that the xNb clear Code directly inserts the fx_2_0 file compiled by fxc.
2. Unique File Header
Public effect (graphicsdeviceGraphicsdevice, Byte []Effectcode)
Effectcode, which does not have any description. It looks like code. Put a string in it. An exception gives the answer and the code that needs to be compiled.
Find the header of the compiled fx_2_0 file in xNb and put it in. The exception too occurs.
This is hard for us, hey. I expected you could add something useless before and try it one by one.
For (int A = 0; A <100; A ++)
{
System. Io. Stream S = system. Io. file. Open ("content \ glow. xNb", system. Io. filemode. Open );
Int n = (INT) S. length;
Byte [] B = new byte [N];
S. Seek (A * 4, system. Io. seekorigin. Begin );
S. Read (B, 0, N );
// Byte [] fg = B + 12;
S. Close ();
Try
{
E = new effect (graphicsdevice, B );
NPOs =;
}
Catch (exception)
{
}
}
When NPOs = 42, it passed. I found some more tests and the conclusion was stable.
The first 168 is the xNb file header, as long as it is opened from 168, It is the effectcode format used in xna4.
Now we start to build some DX effect files to compile with fxc, load the test, and fail. In
Create a default effect file in xNa content, compile it with fxc, and add the file header consistent with that in xNb
Cf0bf0bc 0c000000 00000000 load test, passed.
It seems that there are still many names in these 12 bytes.
After more tests, more information is obtained. Although fx_2_0 is used, some FX cannot be compiled in xNa content.
Colodrop [0] = selectarg2;
The prompt is as follows:
Error 1 errors compiling E: userslightsdocumentsvisual studio 2010projectsxnashaderxnashaderxnashadercontentglow. FX:
Error: The effect State 'drop' is obsolete and can no longer be used. E: userslightsdocumentsvisual studio 2010projectsxnashaderxnashaderxnashadercontentglow. FX xnashader
I don't know how to set fxc to get the same compiling environment as xNa content.
In short, the effect file of a single pass of technique can be loaded after being compiled by fxc.
But when there are multiple passes, different file headers ......
Cf0bf0bc is the same. 0c000000: one pass 10000000: Two Pass 14000000: three pass
In four increments, the subsequent 00000000 random write data test is irrelevant, one pass 4 bytes, two pass 8 bytes, three pass 12 bytes
Increase too by four.
Write a paragraphProgramAs follows:
Int passsize = 2; // number of passes
{
System. Io. Stream S = system. Io. file. Open ("content \ glow. fxo", system. Io. filemode. Open );
Int n = (INT) S. length;
Int headlen = 8 + passsize * 4;
Byte [] B = new byte [n + headlen];
B [0] = 0xcf;
B [1] = 0x0b;
B [2] = 0xf0;
B [3] = 0xbc;
Int tag = 0x0c + (passsize-1) * 4;
B [4] = (byte) Tag;
S. Read (B, headlen, N );
S. Close ();
E2 = new effect (graphicsdevice, B );
}