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

Mac OS X port #87

Closed kode54 closed 3 years ago

kode54 commented 10 years ago

It would be really neat if this could also be ported to Mac OS X. I'm not sure what help I could be in that effort, though.

jeremiah-sypult commented 10 years ago

I did some work in an attempt to move this forward, thanks to RBDOOM-3-BFG:

https://github.com/jeremiah-sypult/DOOM-3-BFG

It compiles and launches, but audio & video rendering do not work. Based on blind input control after launching, the console output appears to load the game data and run. The audio is merely stubbed out at the moment. The OpenGL rendering is incompatible on OS X mainly due to the fact that DOOM-3-BFG uses a OpenGL 3.2 compatibility profile, which is not supported at all on OS X (only the Core profile is supported). In order for it to ever run on OS X, the compatibility bits of the renderer would have to be rewritten to use core profile (including the GLSL shaders, which produce errors during compilation).

Unfortunately, the required renderer changes are outside of my programming skills...

JanSimek commented 10 years ago

Oh man, I don't know how to use Github. I wanted to link my pull request to this issue, but it created another one instead - #117

Works only with SDL 2 obviously.

RobertBeckebans commented 10 years ago

Nice I'm going to test this at the weekend.

JanSimek commented 10 years ago

I am not sure if I should submit a new ticket for the following error, but since no one else is complaining, it is probably OS X specific.

When taking the elevator from Mars City to Underground, game throws me back into the main menu with the following error:

idSoundSample_OpenAL::CreateOpenALBuffer: error loading data into OpenAL hardware buffer

As a temporary workaround I changed that error in AL_SoundSample.cpp into a warning and was able to play further without any problems.

https://gist.github.com/JanSimek/5e2fa26f7d4771236f29

DanielGibson commented 10 years ago

Apple's OpenAL is known to suck, you should try openal-soft: http://kcat.strangesoft.net/openal.html (but turning that into a warning still makes sense IMHO)

kode54 commented 10 years ago

And now, with this latest commit, I get this error while attempting to compile:

[ 12%] Building CXX object CMakeFiles/RBDoom3BFG.dir/framework/Common.cpp.o
In file included from /Users/Chris/Source/Repos/RBDOOM-3-BFG/neo/framework/Common.cpp:41:
In file included from /Users/Chris/Source/Repos/RBDOOM-3-BFG/neo/idlib/../framework/../../doomclassic/doom/doomlib.h:35:
In file included from /Users/Chris/Source/Repos/RBDOOM-3-BFG/neo/idlib/../framework/../../doomclassic/doom/doominterface.h:35:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/string:437:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/cstdio:143:9: error: 
      no member named 'use_idStr_snPrintf' in the global namespace
using ::snprintf;
      ~~^
/Users/Chris/Source/Repos/RBDOOM-3-BFG/neo/idlib/Str.h:86:19: note: expanded
      from macro 'snprintf'
#define snprintf                use_idStr_snPrintf
                                ^
In file included from /Users/Chris/Source/Repos/RBDOOM-3-BFG/neo/framework/Common.cpp:41:
In file included from /Users/Chris/Source/Repos/RBDOOM-3-BFG/neo/idlib/../framework/../../doomclassic/doom/doomlib.h:35:
In file included from /Users/Chris/Source/Repos/RBDOOM-3-BFG/neo/idlib/../framework/../../doomclassic/doom/doominterface.h:35:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/string:437:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/cstdio:153:9: error: 
      no member named 'use_idStr_vsnPrintf' in the global namespace
using ::vsnprintf;
      ~~^
/Users/Chris/Source/Repos/RBDOOM-3-BFG/neo/idlib/Str.h:88:20: note: expanded
      from macro 'vsnprintf'
#define vsnprintf               use_idStr_vsnPrintf
                                ^
2 errors generated.
make[2]: *** [CMakeFiles/RBDoom3BFG.dir/framework/Common.cpp.o] Error 1
make[1]: *** [CMakeFiles/RBDoom3BFG.dir/all] Error 2
make: *** [all] Error 2
JanSimek commented 10 years ago

Just to clarify, you were able to compile it before commit b8676a5?

JanSimek commented 10 years ago

OK, this happens when building with clang instead of gcc. There is no such thing as use_idStr_snPrintf or use_idStr_vsnPrintf, so removing those four lines from Str.h fixes the problem.

DanielGibson commented 10 years ago

I think the purpose of those lines is to tell people not to use snprintf but to use idStr::snprintf() instead (on Windows snprintf() is broken/insecure)

JanSimek commented 10 years ago

I added some objective-c code to replace those functions in linux_main.cpp which rely on procfs and it compiles fine with gcc, but when compiling this source file with clang I get this error:

error: Objective-C 1 was disabled in PCH file but is currently enabled

I have never seen it before and I can't google any useful info about it. Any ideas?

DanielGibson commented 10 years ago

PCH could be precompiled header

ghost commented 9 years ago

i've tried to compile it on os x 10.9.4 and got the following errors:

[ 99%] Building CXX object CMakeFiles/RBDoom3BFG.dir/Users/ozenbaken/RBDOOM-3-BFG/doomclassic/doom/i_sound_openal.cpp.o Linking CXX executable RBDoom3BFG Undefined symbols for architecture x86_64: "_SDL_GetPrefPath", referenced from: Sys_DefaultSavePath() in posix_main.cpp.o "_SDL_free", referenced from: Sys_DefaultSavePath() in posix_main.cpp.o "_SDL_strdup", referenced from: Sys_DefaultSavePath() in posix_main.cpp.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: * [RBDoom3BFG] Error 1 make[1]: * [CMakeFiles/RBDoom3BFG.dir/all] Error 2 make: *\ [all] Error 2

full log here: http://pastebin.com/vWCdC712

am i doing something wrong?

JanSimek commented 9 years ago

My fault. Compile it with SDL 2

ghost commented 9 years ago

with SDL2 it failed to compile too:

[ 99%] Building CXX object CMakeFiles/RBDoom3BFG.dir/Users/ozenbaken/RBDOOM-3-BFG/doomclassic/doom/i_sound_openal.cpp.o Linking CXX executable RBDoom3BFG Undefined symbols for architecture x86_64: "_SDL_EnableKeyRepeat", referenced from: Sys_InitInput() in sdl_events.cpp.o "_SDL_EnableUNICODE", referenced from: Sys_InitInput() in sdl_events.cpp.o "_SDL_GL_SwapBuffers", referenced from: GLimp_SwapBuffers() in sdl_glimp.cpp.o "_SDL_GetVideoInfo", referenced from: R_GetModeListForDisplay(int, idList<vidMode_t, (memTag_t)40>&) in sdl_glimp.cpp.o "_SDL_GetVideoSurface", referenced from: GLimp_SetScreenParms(glimpParms_t) in sdl_glimp.cpp.o "_SDL_ListModes", referenced from: R_GetModeListForDisplay(int, idList<vidMode_t, (memTag_t)40>&) in sdl_glimp.cpp.o "_SDL_SetGammaRamp", referenced from: GLimpSetGamma(unsigned short, unsigned short, unsigned short) in sdl_glimp.cpp.o "_SDL_SetVideoMode", referenced from: GLimp_Init(glimpParms_t) in sdl_glimp.cpp.o GLimp_SetScreenParms(glimpParms_t) in sdl_glimp.cpp.o "_SDL_WM_GrabInput", referenced from: GLimp_GrabInput(int) in sdl_glimp.cpp.o "_SDL_WM_SetCaption", referenced from: GLimp_Init(glimpParms_t) in sdl_glimp.cpp.o ld: symbol(s) not found for architecture x8664 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: ** [RBDoom3BFG] Error 1 make[1]: * [CMakeFiles/RBDoom3BFG.dir/all] Error 2 make: * [all] Error 2

full log here: http://pastebin.com/FuqSDueg

JanSimek commented 9 years ago

Set SDL 2 include directory in CMake to /Library/Frameworks/SDL2.framework/Headers

ghost commented 9 years ago

now it compiles successfully, but the game runs without sound. game log says that sound system initialzed:

----- Initializing Sound System ------ Setup OpenAL device and context... Done. OpenAL vendor: Apple Computer Inc. OpenAL renderer: Software OpenAL version: 1.1 OpenAL extensions: AL_EXT_OFFSET AL_EXT_LINEAR_DISTANCE AL_EXT_EXPONENT_DISTANCE AL_EXT_float32 AL_EXT_STATIC_BUFFER AL_EXT_SOURCE_NOTIFICATIONS sound system initialized.

see the game log here: http://pastebin.com/qWK1DsKS

ghost commented 9 years ago

i've compiled game with openal-soft instead of apple's openal but with no luck. game log still says that sound system initialized:

----- Initializing Sound System ------ AL lib: (WW) UpdateDeviceParams: SSE performs best with multiple of 4 update sizes (1114) Setup OpenAL device and context... Done. OpenAL vendor: OpenAL Community OpenAL renderer: OpenAL Soft OpenAL version: 1.1 ALSOFT 1.15.1 OpenAL extensions: AL_EXT_ALAW AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data AL_SOFTX_deferred_updates AL_SOFT_direct_channels AL_SOFT_loop_points AL_SOFT_source_latency sound system initialised.

see the game log here: http://pastebin.com/6U6dVcFR

ghost commented 9 years ago

i launched game with "+set developer 1 +set log file 2" params, game log here: http://pastebin.com/DxysUKap

can someone tell me what is wrong with the sound? does anyone got the same problem? is there any workaround?

ghost commented 9 years ago

my sound issue appears only if i launch the game as a root, not by other user. seems like there is a mess with some environment variables or something.

DanielGibson commented 9 years ago

Why would you launch the game as root? Don't do that..

ghost commented 9 years ago

it's because of my old habit, nevermind. thanks to everyone who make it possible to run the game on osx and everyone on this thread.

tnull commented 7 years ago

I experience the same error on macOS which @JanSimek described above:

When taking the elevator from Mars City to Underground, game throws me back into the main menu with the following error:

idSoundSample_OpenAL::CreateOpenALBuffer: error loading data into OpenAL hardware buffer

This error still crashes the game. How do I fix that? I installed openal-soft via homebrew and even manually force-linked it. However, CMake does not seem to pick it up: -- Found OpenGL: /System/Library/Frameworks/OpenGL.framework

I also manually changed the Error into a Warning as temporary workaround, but this is not the only (but the only crashing) openal error I get.