Closed Fancy2209 closed 1 week ago
Took a quick look and it actually looks like all the reading is done with read_ui32 which does the swap... so I'm not sure what's up.
A quick test (we could maybe add this to MojoShader CI?):
git clone https://github.com/icculus/mojoshader
mkdir mojoshader/flibitBuild
cd mojoshader/flibitBuild
cmake ..
make
curl -LO https://github.com/FNA-XNA/FNA/raw/refs/heads/master/src/Graphics/Effect/StockEffects/FXB/SpriteEffect.fxb
./testparse glsl120 SpriteEffect.fxb
Pushed a couple fixes to the header and string readers. My guess is the magic number checks in effects.c still need swapping but otherwise reading should work better now (maybe even entirely?).
Fixed by #76
I originally noticed this by trying to use FNA on ArchPOWER Wii-Linux. It seems for a very long time now the PowerPC support for MojoShader has been broken (I tested the last commit made in 2016 and it was already broken by then). It seems MojoShader fails to parse Effects on Big Endian Platforms, throws
ERROR: Unsupported shader type or not a shader at all
on a valid shader. I tested with SpriteEffect.xfb and SpriteEffect.xfb from FNA with the testparse util. I was trying to fix this issue but no longer have any lead on why it's failing, current issue is that it's trying to parse the magic as the version token for some reason. Here's a patch file with what I could fix, (gcc only defines powerpc lowercase and testparse doesn't check the right magic on powerpc).