.mdl loading (CAnimatedMeshHalfLife.cpp) on big endian, help

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
kas1e
Posts: 212
Joined: Sun Jan 21, 2018 8:39 am

.mdl loading (CAnimatedMeshHalfLife.cpp) on big endian, help

Post by kas1e »

While working on making proper port to some PPC computer, found the last remain issue about big-endian : loading of the .mdl files crashes (in all the other parts Irrlicht seems already support BIG-Endian cpus very well, still :) )

The file in question to which stack-traces point out are CAnimatedMeshHalfLife.cpp , which didn't have any big-endian fixes as all the other loaders in Irrlicht have. Probabaly that one was added more or less lately, so those who works back in times wasn't worry about adding there ppc fixes.

I start myself to make something, and there is what i got currently (search for "BIG_ENDIAN" ifdefs):

http://kas1e.mikendezign.com/aos4/irrli ... lfLife.cpp

It still crashes, so i probabaly forgot something , or doing something wrong.

I also had to comment out there "const" in few places, so my byteswapping works , but i think it should't cause issues.

Can any expirienced coder have a look at that, maybe found something obviously wrong in my changes , or , maybe something purely forgotten to be byteswapped ?

Also, if anyone willing to help for real with it (even just point me out on what change and what to do remotely, so then i can build it and test on my side), i can pay up to 50$ easy.

Of course those changes can be then merged to trunk once it will works on PPC as well (if CuteAlien doesn't mind of course)

Thanks !
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: .mdl loading (CAnimatedMeshHalfLife.cpp) on big endian,

Post by CuteAlien »

Yeah, different loaders written by different people. And not everyone has a system to test endian-troubles. I think I once had a setup in some VM for basic testing a few years ago ... have to check if I still have that somewhere.

If you want that code in Irrlicht (it should be there) then please don't use SDL_SwapLE32.
Irrlicht seems to have os::Byteswap::byteswap, I haven't worked with that yet myself, but it seems to be used in other loaders.

As for problems - only idea I have is adding printfs for all the numbers and checking if you get same results on both operating systems.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply