0

I'm using SDL for a little game and since I need a map in this game I was using SDLMappy to do that. Now on Windows everything worked perfectly fine, I had an example map designed, saved as a .FMP file and the program was loading and showing it perfectly.

Recently I switched to Linux (Manjaro). I am using CLion with Cmake now and the program compiles fine (after a lot of other stuff I had to change for linux), but the map can't load anymore. With debugging I found out, that the error occurs here:

if (mapfilesize!=static_cast<long int>(mapbyteswapl(mapgenheader.headsize) + 8)) maperror = MER_MAPLOADERROR;

mapfilesize is 3698985 and the other side of the inequality evaluates to 1179468120

I googled quite a while about this, but it seems like SDLMappy isn't used very much. Also the link to the linux version on the SDLMappy Site seems to be outdated, at least for me it's going nowhere.

Something else that may have to do with this is, that at some point in the SDLMappy code there is a fopen_s call which isn't working under linux. I used the define

#define fopen_s(fp, fmt, mode)          *(fp)=fopen( (fmt), (mode))

to fix this, but I don't know if there are any differences in reading a file with fopen and fopen_s in Windows/Linux that may be causing the issue. I couldn't find anything.

genpfault
  • 51,148
  • 11
  • 85
  • 139
Rubydragon
  • 31
  • 1
  • 2
  • Forgot to mention that CLion tells me in the Toolchain window that it does only support Cmake versions 2.8.11-3.9.x while I have 3.10.1 installed. But I can't figure out how to downgrade and another thread I found said that everything is working fine even with 3.10.1 – Rubydragon Jan 17 '18 at 10:54
  • Try to remove the `mapbyteswapl(x)` call and replace it with just `x`. – HolyBlackCat Jan 17 '18 at 12:33
  • Did that, but now it evaluates to 4920270885891427662 which seems a lot more ridiculous than before... – Rubydragon Jan 17 '18 at 18:16

0 Answers0