RobertBeckebans / RBDOOM-3-BFG

Doom 3 BFG Edition source port with updated DX12 / Vulkan renderer and modern game engine features
https://www.moddb.com/mods/rbdoom-3-bfg
GNU General Public License v3.0
1.38k stars 247 forks source link

x86 compilation error in File.cpp.o #88

Closed orderorder closed 10 years ago

orderorder commented 10 years ago

/RBDOOM-3-BFG/neo/framework/File.cpp: En la función miembro ‘virtual int idFileMemory::Write(const void, int)’: /RBDOOM-3-BFG/neo/framework/File.cpp:847:78: error: formato ‘%lu’ espera un argumento de tipo ‘long unsigned int’, pero el argumento 3 es de tipo ‘size_t {aka unsigned int}’ [-Werror=format] /RBDOOM-3-BFG/neo/framework/File.cpp: En la función miembro ‘void idFile_Memory::PreAllocate(size_t)’: /RBDOOM-3-BFG/neo/framework/File.cpp:933:81: error: formato ‘%lu’ espera un argumento de tipo ‘long unsigned int’, pero el argumento 2 es de tipo ‘size_t {aka unsigned int}’ [-Werror=format] /RBDOOM-3-BFG/neo/framework/File.cpp: En la función miembro ‘void idFile_Memory::TruncateData(size_t)’: /RBDOOM-3-BFG/neo/framework/File.cpp:1119:104: error: formato ‘%lu’ espera un argumento de tipo ‘long unsigned int’, pero el argumento 2 es de tipo ‘size_t {aka unsigned int}’ [-Werror=format] /RBDOOM-3-BFG/neo/framework/File.cpp:1119:104: error: formato ‘%lu’ espera un argumento de tipo ‘long unsigned int’, pero el argumento 3 es de tipo ‘sizet {aka unsigned int}’ [-Werror=format] cc1plus: algunos avisos se tratan como errores make[2]: ** [CMakeFiles/RBDoom3BFG.dir/framework/File.cpp.o] Error 1 make[1]: * [CMakeFiles/RBDoom3BFG.dir/all] Error 2 make: * [all] Error 2

RobertBeckebans commented 10 years ago

Which Linux distribution are you using?

orderorder commented 10 years ago

I'm using x86 gentoo. In my amd64 gentoo the code compiles without problem. In another past version it compiles without problem in my x86 version.

DanielGibson commented 10 years ago

Maybe we should use %zu instead which is specifically for size_t. Does Windows support that?

slacka commented 10 years ago

With i686(32 bit) mint 16, I ran into 2 of these errors in Zip.cpp and 3 in File.cpp.

RBDOOM-3-BFG/neo/framework/Zip.cpp:507:74: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘size_t {aka unsigned int}’ [-Werror=format=]

After changing the %lu to %zu, it compiled perfectly.

http://stackoverflow.com/questions/2524611/how-to-print-size-t-variable-portably

RobertBeckebans commented 10 years ago

Ok Windows does not support %zu ...

RobertBeckebans commented 10 years ago

I ditched the previous commit and added a special case for the MSVC compiler:

http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx

After all I think -Werror=format is not really a good idea.

orderorder commented 10 years ago

Now it works. Thank you :) great job.

Now i have another problem. I have installed ffmpeg 1.2.6 version, when i try to play a video disk (for example: MARS Mission Goals & Safety, in The Resurrection of Evil Expansion). The game shutdown with the following output.

------------- Warnings --------------- during game/phobos1... WARNING: Original Doom 3 RoQ Cinematic not found: 'sound/vo/video/deployment.roq'

WARNING: New filename: 'sound/vo/video/deployment.bik'

WARNING: idCinematic: Cannot open FFMPEG video file: 'sound/vo/video/deployment.bik', 0

WARNING: Original Doom 3 RoQ Cinematic not found: 'sound/vo/video/generator.roq'

WARNING: New filename: 'sound/vo/video/generator.bik'

WARNING: idCinematic: Cannot open FFMPEG video file: 'sound/vo/video/generator.bik', 0

WARNING: Original Doom 3 RoQ Cinematic not found: 'sound/vo/video/grabber.roq'

WARNING: New filename: 'sound/vo/video/grabber.bik'

WARNING: idCinematic: Cannot open FFMPEG video file: 'sound/vo/video/grabber.bik', 0

WARNING: Original Doom 3 RoQ Cinematic not found: 'sound/VO/video/video_marine_sops.roq'

WARNING: New filename: 'sound/VO/video/video_marine_sops.bik'

WARNING: Loaded FFMPEG file: 'sound/VO/video/video_marine_sops.bik', looping=0

WARNING: 256x256, 30.000000 FPS, 72.866669 sec WARNING: file , line 2: unknown token '5.' WARNING: Couldn't load image: _emptyname : _emptyname#0200 WARNING: Couldn't load image: } : }#0200 WARNING: Couldn't load image: guis/assets/movies/generator : guis/assets/movies/generator#0200 WARNING: Couldn't load image: guis/assets/movies/grabber : guis/assets/movies/grabber#0200 WARNING: Couldn't load image: guis/assets/hud/items/armor_shard : guis/assets/hud/items/armor_shard#__0200 19 warnings 4850 msec to load game/phobos1 Sending networkSync cvars: pm_staminathreshold = 4 pm_noclipspeed = 300 pm_runspeed = 275 pm_walkspeed = 175 pm_crouchspeed = 100 double fault Segmentation fault, bailing out shutdown terminal support signal caught: Segmentation fault si_code 1 Trying to exit gracefully.. session->GetSaveGameManager().CancelToTerminate(); soundSystem->StopAllSounds(); Stop(); --------- Game Map Shutdown ---------- Violación de segmento

Thank you.

RobertBeckebans commented 10 years ago

Is it possible that your libavcodec does not support Bink videos?

RobertBeckebans commented 10 years ago

However you can try to ignore Bink video support by compiling the engine with the cmake argument -DUSE_FFMPEG=OFF

orderorder commented 10 years ago

Seems that "fullscreen videos" like Bethesda intro or the planet rotation work. The problem is only with de videodisk bink videos. I will try to update my ffmpeg version manually from the source code of the official site to the last version.

orderorder commented 10 years ago

The same error with the last git version of ffmpeg. I can play de videos out of the game with the command ffplay video.bik.

DanielGibson commented 10 years ago

It's quite obviously a problem with case sensitivity in the filesystem:

WARNING: idCinematic: Cannot open FFMPEG video file: 'sound/vo/video/deployment.bik', 0
...
WARNING: Loaded FFMPEG file: 'sound/VO/video/video_marine_sops.bik', looping=0

sounds/vo/ vs sounds/VO/ (the latter is the correct path).

On Windows that doesn't matter because it sucks is case insensitive. Not sure how to best fix this particular issue, but "/vo/" is hardcoded in several places in the code, changing those to "/VO/" would be a start.

If however those video paths are set somewhere in the data files, we'd need something else.. I have code for a case-insensitive fopen() somewhere (and also a function that just takes a path and returns a version with correct case, if any), we could use that.

orderorder commented 10 years ago

Yeah, :). I rename "VO" to "vo" and now the videos are working. Thanks, thanks, thanks...

DanielGibson commented 10 years ago

But probably now other files don't load anymore

orderorder commented 10 years ago

But in that directory there are only bink videos.

base/sound/vo/video

deployment.bik
hydrocon.bik
video_bfg.bik
video_ipn_news.bik
video_recycling.bik epd.bik
mfs.bik
video_chaingun.bik
video_marine_sops.bik
video_soulcube.bik generator.bik
video_alphalabs_intro.bik
video_demon_museum.bik
video_meyers_report.bik
video_tablets.bik grabber.bik video_ancient_civ.bik
video_ian_report.bik
video_plasmagun.bik
video_uac_welcome.bik

Do you think that rename VO/vo directory is a bad idea?

DanielGibson commented 10 years ago

Well, from the output you posted above I gathered that the game uses the file 'sound/VO/video/video_marine_sops.bik' which uses the uppercase version.

As a workaround you could probably create a symlink, so you have both versions of the path

orderorder commented 10 years ago

Good idea :)

davidfoerster commented 10 years ago

The solution in e61eae4 is kind of verbose. See issue #94.