Esempio n. 1
0
        public static void Decompile(string sFileName)
        {
            Initialize();

            ID3DXEffect *pD3DEffect    = null;
            ID3DXBuffer *pD3DError     = null;
            ID3DXBuffer *pDisassembler = null;

            D3DXCreateEffectFromFile(g_D3DDevice, sFileName, IntPtr.Zero, IntPtr.Zero, 0, IntPtr.Zero, &pD3DEffect, &pD3DError);
            D3DXDisassembleEffect(pD3DEffect, false, &pDisassembler);

            var sShaderSource = Marshal.PtrToStringAnsi(ID3DXBuffer_GetBufferPointer(pDisassembler));

            var sOutFile = Common.OutputPath + "/Shaders/mb.fx";

            if (!Directory.Exists(Common.OutputPath + "/Shaders"))
            {
                Directory.CreateDirectory(Common.OutputPath + "/Shaders");
            }
            Win32FileWriter.WriteAllText(sOutFile, Header.Shaders + sShaderSource);

            Release();
        }