[SOLVED] mgfxo with pipeline tool

I’m trying to make .mgfxo files with the GUI Pipeline tool.

But when they load there’s an exception in Effects.cs:129 that “This does not appear to be a MonoGame MGFX file!”
It’s expecting MGFXSignature to be 0x5846474D but the file has 0x64424e58

What am I doing wrong?

When you build effects with the Pipeline Tool you need to load them using a ContentManager like all other content you build with the Pipeline Tool. To load effects with the constructor yourself, you have to build them by running 2MGFX manually from the command line. See also http://www.monogame.net/documentation/?page=2MGFX
EDIT: Seems the link doesn’t work, but in the docs page navigate to Tools > 2MGFX.

Sorry I wasn’t clear. The Pipeline Tool makes .xnb files, how are those different from .mgfxo files that the 2MGFX tool makes?

It looks like the ContentManger EffectReader.cs is just reading the bytes and passing it to the Effect constructor.

Passing the bytes from the 2MGFX tool’s .mgfxo file to the Effects constructor works, and passing bytes from the Pipeline Tool’s .xnb files causes the above exception.

1 Like

Note that the doc page I linked before says the following: NOTE: The generated file is not an XNB file for use with the ContentManager.
.xnb files have a special header, different from the effect header. A .xnb file looks like this (you can see the code that reads the header here):

{Platform byte}
{Compression flags}
{Actual content}

The {Actual Content} is what gets passed to the Readers, so in the case of an effect it will start with the MGFX header. You could read past the .xnb header yourself and pass the rest of the file to the Effect constructor if you want to use the Pipeline Tool.

1 Like

Ha ha, thanks, I clicked the link and it was broken so I just gave up. Sorry. After drilling through the nav I see that. Thanks for the explanation! That really helps.

1 Like

What was the solution to this? Is it possible to get an .mgfxo using the Monogame Pipeline tool, or do I have to build it separately? Thanks in advanced.

You need to use 2mgfx directly. Like I said above, if you build an effect with the Pipeline Tool, the built file will have an additional header.

Thanks for the quick response! I’ll try 2mgfx.