diff --git a/README.md b/README.md index 32db081a..a4a15b70 100644 --- a/README.md +++ b/README.md @@ -32,11 +32,12 @@ This file contains the following sections: 8. [Getting the Source Code ](#source) 9. [Compiling on Windows](#compile_windows) 10. [Compiling on Linux](#compile_linux) -11. [Installation, Getting the Game Data, Running the Game](#installation) -12. [New Console Variables](#console) -13. [Known Issues](#issues) -14. [Bug Reports](#reports) -15. [FAQ](#faq) +11. [Compiling on macOS](#compile_macos) +12. [Installation, Getting the Game Data, Running the Game](#installation) +13. [New Console Variables](#console) +14. [Known Issues](#issues) +15. [Bug Reports](#reports) +16. [FAQ](#faq) @@ -446,7 +447,7 @@ This project's GitHub.net Git repository can be checked out through Git with the > git clone --recursive https://github.com/RobertBeckebans/RBDOOM-3-BFG.git -The paramter --recursive is only required if you want to build RBDOOM-3-BFG with Vulkan support. +The parameter --recursive is only required if you want to build RBDOOM-3-BFG with Vulkan support. Existing repositories can be updated manually: @@ -501,18 +502,48 @@ Recommended in this case is `cmake-vs2017-64bit-windows10.bat` > sudo zypper install cmake libSDL2-devel openal-soft-devel - You don't need FFmpeg to be installed. You can also turn it off by add -DFFMPEG=OFF to the CMake options. + You don't need FFmpeg to be installed. You can turn it off by adding -DFFMPEG=OFF to the CMake options. It is enabled by default because the bundled libbinkdec is slow during development if compiled for Debug mode. 2. Generate the Makefiles using CMake: - > cd neo/ - > ./cmake-eclipse-linux-profile.sh + > cd neo/ + > ./cmake-eclipse-linux-profile.sh 3. Compile RBDOOM-3-BFG targets with - > cd ../build - > make + > cd ../build + > make + +--- +# Compiling on macOS + +1. Download and install Homebrew (https://brew.sh) + +2. You need the following dependencies in order to compile RBDoom3BFG with all features: + + > brew install cmake sdl2 openal-soft ffmpeg + +3. Generate the Makefiles using CMake: + + For command line builds: + + > cd neo/ + > ./cmake-macos-opengl-release.sh + + For Xcode builds: + + > cd neo/ + > ./cmake-xcode-opengl-release.sh + +4. Compile RBDOOM-3-BFG targets: + + For command line builds: + + > cd ../build + > make + + For Xcode builds double click on RBDOOM-3-BFG/xcode-opengl-release/RBDoom3BFG.xcodeproj and start the build. The generated Xcode project file is pre-configured with the correct targets and build settings. --- # Installation, Getting the Game Data, Running the Game @@ -539,12 +570,12 @@ Currently this requires a Windows installer, whether that be the GOG installer o Note: the original DVD release of Doom 3 BFG contains encrypted data that is decoded by Steam on install. -On Linux and OSX the easiest way to install is with SteamCMD: https://developer.valvesoftware.com/wiki/SteamCMD -See the description on https://developer.valvesoftware.com/wiki/SteamCMD#Linux (OS X is directly below that) on how to install SteamCMD on your system. You won't have to create a new user. +On Linux and macOS the easiest way to install is with SteamCMD: https://developer.valvesoftware.com/wiki/SteamCMD. +See the description on https://developer.valvesoftware.com/wiki/SteamCMD#Linux (macOS is directly below that) on how to install SteamCMD on your system. You won't have to create a new user. Then you can download Doom 3 BFG with -> ./steamcmd.sh +@sSteamCmdForcePlatformType windows +login +force_install_dir ./doom3bfg/ +app_update 208200 validate +quit + > ./steamcmd.sh +@sSteamCmdForcePlatformType windows +login +force_install_dir ./doom3bfg/ +app_update 208200 validate +quit (replace with your steam login name) When it's done you should have the normal windows installation of Doom 3 BFG in ./doom3bfg/ and the needed files in ./doom3bfg/base/ @@ -552,11 +583,11 @@ That number is the "AppID" of Doom 3 BFG; if you wanna use this to get the data NOTE that we've previously recommended using download_depot in the Steam console to install the game data. That turned out to be unreliable and result in broken, unusable game data. So use SteamCMD instead, as described above. -Alternatively with the GOG installer, you can use Wine to install the game. See https://winehq.org/download for details on how to install wine for Linux and Mac. +Alternatively with the GOG installer, you can use Wine to install the game. See https://winehq.org/download for details on how to install wine for Linux and macOS. Once Wine is installed and configured on your system install Doom 3 BFG edition using the downloaded installers from gog.com: -> wine setup_doom_3_bfg_1.14_\(13452\)_\(g\).exe + > wine setup_doom_3_bfg_1.14_\(13452\)_\(g\).exe (there will be several .exe files from GOG, make sure all of them are in the same directory) @@ -564,16 +595,16 @@ Once this is complete, by default you can find your Doom 3 BFG "base/" directory Note that you may want to add the following line to the bottom of the default.cfg in whatever "base/" directory you use: -> set sys_lang "english" +* set sys_lang "english" This will ensure the game and its menus are in english and don't default to something else. Alternatives include: -set sys_lang "english" -set sys_lang "french" -set sys_lang "german" -set sys_lang "italian" -set sys_lang "japanese" -set sys_lang "spanish" +* set sys_lang "english" +* set sys_lang "french" +* set sys_lang "german" +* set sys_lang "italian" +* set sys_lang "japanese" +* set sys_lang "spanish" Anyway: @@ -587,30 +618,33 @@ Anyway: /your/path/to/Steam/steamapps/common/DOOM 3 BFG Edition/base/ or, if you used SteamCMD or GOG installer with Wine, in the path you used above. -4. Copy your RBDoom3BFG executable that you created in 5) or 6) and the FFmpeg DLLs to your own - Doom 3 BFG directory (/path/to/Doom3BFG). +4. Copy your RBDoom3BFG executable and the FFmpeg DLLs (Windows only) to your own + Doom 3 BFG directory (/path/to/Doom3BFG). Your Doom 3 BFG directory now should look like: - Your own Doom 3 BFG directory now should look like: /path/to/Doom3BFG/ - -> RBDoom3BFG (or RBDoom3BFG.exe on Windows) - -> avcodec-58.dll - -> avdevice-58.dll - -> avfilter-7.dll - -> avformat-58.dll - -> avutil-56.dll - -> postproc-55.dll - -> swresample-5.dll - -> swscale-5.dll - -> base/ - -> classicmusic/ - -> _common.crc - -> (etc) + * RBDoom3BFG (or RBDoom3BFG.exe on Windows) + * avcodec-58.dll (Windows only) + * avdevice-58.dll (Windows only) + * avfilter-7.dll (Windows only) + * avformat-58.dll (Windows only) + * avutil-56.dll (Windows only) + * postproc-55.dll (Windows only) + * swresample-3.dll (Windows only) + * swscale-5.dll (Windows only) + * base/ + * classicmusic/ + * _common.crc + * (etc) + +5. On macOS the RBDoom3BFG executable will also search for game data within the Contents/Resources/base directory as part of a macOS app bundle. In addition, if you want the game to be standalone without dependencies on pre-installed dynamic libs, you can use macdylibbundler to bundle all external lib dependencies into the app bundle (see https://github.com/auriamg/macdylibbundler or simply install via "brew install dylibbundler"). For example, the following command will copy all external dynamic lib dependencies to the Contents/libs directory of the app bundle and adjust the rpaths within the RBDoom3BFG executable and copied libs. -5. Run the game by executing the RBDoom3BFG executable. + > dylibbundler -od -b -x ./Doom3BFG.app/Contents/MacOS/RBDoom3BFG -d ./Doom3BFG.app/Contents/libs/ -6. Enjoy +6. Run the game by executing the RBDoom3BFG executable. -7. If you run into bugs, please report them, see [Bug Reports](#reports) +7. Enjoy + +8. If you run into bugs, please report them, see [Bug Reports](#reports) --- # New Console Variables and Commands diff --git a/doomclassic/doom/vars.h b/doomclassic/doom/vars.h index 8fde42d7..e2e72990 100644 --- a/doomclassic/doom/vars.h +++ b/doomclassic/doom/vars.h @@ -374,7 +374,7 @@ menuitem_t LoadExpMenu[2]; menu_t LoadExpDef; menuitem_t SaveMenu[6]; menu_t SaveDef; -char tempstring[80]; +char tempstring[128]; // SRS - extended from 80 to 128 to handle worst case string length (gcc 11 error checking) int epi; int exp; int quitsounds[8]; diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt index 77ff1cb7..4d23fee6 100644 --- a/neo/CMakeLists.txt +++ b/neo/CMakeLists.txt @@ -184,17 +184,21 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # SRS - Also add -fasm-blocks otherwise Xcode complains add_definitions(-fasm-blocks) + if(CMAKE_OSX_SYSROOT) + add_definitions(-isysroot "${CMAKE_OSX_SYSROOT}") + message(STATUS "Using macOS sysroot: " ${CMAKE_OSX_SYSROOT}) + endif() if(CMAKE_OSX_DEPLOYMENT_TARGET) - add_definitions(-isysroot "${CMAKE_OSX_SYSROOT}" -mmacosx-version-min="${CMAKE_OSX_DEPLOYMENT_TARGET}") + add_definitions(-mmacosx-version-min="${CMAKE_OSX_DEPLOYMENT_TARGET}") endif() endif() set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -D_DEBUG -O0") #set(CMAKE_C_FLAGS_DEBUGALL "${CMAKE_C_FLAGS_DEBUGALL} -g -ggdb -D_DEBUG") #set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE} -g -ggdb -D_DEBUG -O1 -fno-omit-frame-pointer") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -ffp-contract=off -fno-unsafe-math-optimizations -fomit-frame-pointer -fno-math-errno -fno-trapping-math") - set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -g -O3 -ffp-contract=off -fno-unsafe-math-optimizations -fomit-frame-pointer -fno-math-errno -fno-trapping-math") - set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -Os -ffp-contract=off -fno-unsafe-math-optimizations -fomit-frame-pointer -fno-math-errno -fno-trapping-math") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -ffp-contract=off -fomit-frame-pointer -fno-math-errno -fno-trapping-math") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -g -O3 -ffp-contract=off -fomit-frame-pointer -fno-math-errno -fno-trapping-math") + set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -Os -ffp-contract=off -fomit-frame-pointer -fno-math-errno -fno-trapping-math") set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG}) #set(CMAKE_CXX_FLAGS_DEBUGALL ${CMAKE_C_FLAGS_DEBUGALL}) diff --git a/neo/cmake-macos-opengl-debug.sh b/neo/cmake-macos-opengl-debug.sh deleted file mode 100755 index 72eb8b98..00000000 --- a/neo/cmake-macos-opengl-debug.sh +++ /dev/null @@ -1,5 +0,0 @@ -cd .. -rm -rf build -mkdir build -cd build -cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DSDL2=ON -DOPENAL_LIBRARY=/usr/local/opt/openal-soft/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=/usr/local/opt/openal-soft/include ../neo -Wno-dev diff --git a/neo/cmake-macos-vulkan-debug.sh b/neo/cmake-macos-vulkan-debug.sh deleted file mode 100755 index ea382737..00000000 --- a/neo/cmake-macos-vulkan-debug.sh +++ /dev/null @@ -1,6 +0,0 @@ -cd .. -rm -rf build -mkdir build -cd build -cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DSDL2=ON -DUSE_VULKAN=ON -DSPIRV_SHADERC=OFF -DOPENAL_LIBRARY=/usr/local/opt/openal-soft/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=/usr/local/opt/openal-soft/include ../neo -Wno-dev -echo "** NOTE: For this build type must set environment variable MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE=1 at runtime **" diff --git a/neo/cmake-xcode-vulkan-debug.sh b/neo/cmake-xcode-vulkan-debug.sh index 93b7a847..21a37918 100755 --- a/neo/cmake-xcode-vulkan-debug.sh +++ b/neo/cmake-xcode-vulkan-debug.sh @@ -2,4 +2,6 @@ cd .. rm -rf xcode-vulkan-debug mkdir xcode-vulkan-debug cd xcode-vulkan-debug +# remove or set -DCMAKE_SUPPRESS_REGENERATION=OFF to reenable ZERO_CHECK target which checks for CMakeLists.txt changes and re-runs CMake before builds +# however, if ZERO_CHECK is reenabled **must** add VULKAN_SDK location to Xcode Custom Paths (under Prefs/Locations) otherwise build failures may occur cmake -G Xcode -DCMAKE_BUILD_TYPE=Debug -DSDL2=ON -DUSE_VULKAN=ON -DSPIRV_SHADERC=OFF -DCMAKE_XCODE_GENERATE_SCHEME=ON -DCMAKE_XCODE_SCHEME_ENVIRONMENT="MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE=1" -DCMAKE_SUPPRESS_REGENERATION=ON -DOPENAL_LIBRARY=/usr/local/opt/openal-soft/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=/usr/local/opt/openal-soft/include ../neo -Wno-dev diff --git a/neo/cmake-xcode-vulkan-release.sh b/neo/cmake-xcode-vulkan-release.sh index 1547ef8f..eeb02eae 100755 --- a/neo/cmake-xcode-vulkan-release.sh +++ b/neo/cmake-xcode-vulkan-release.sh @@ -2,4 +2,6 @@ cd .. rm -rf xcode-vulkan-release mkdir xcode-vulkan-release cd xcode-vulkan-release +# remove or set -DCMAKE_SUPPRESS_REGENERATION=OFF to reenable ZERO_CHECK target which checks for CMakeLists.txt changes and re-runs CMake before builds +# however, if ZERO_CHECK is reenabled **must** add VULKAN_SDK location to Xcode Custom Paths (under Prefs/Locations) otherwise build failures may occur cmake -G Xcode -DCMAKE_BUILD_TYPE=Release -DCMAKE_CONFIGURATION_TYPES="Release;MinSizeRel;RelWithDebInfo" -DSDL2=ON -DUSE_VULKAN=ON -DSPIRV_SHADERC=OFF -DUSE_MoltenVK=ON -DCMAKE_XCODE_GENERATE_SCHEME=ON -DCMAKE_SUPPRESS_REGENERATION=ON -DOPENAL_LIBRARY=/usr/local/opt/openal-soft/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=/usr/local/opt/openal-soft/include ../neo -Wno-dev diff --git a/neo/sys/sdl/sdl_glimp.cpp b/neo/sys/sdl/sdl_glimp.cpp index d004ff50..384a3baa 100644 --- a/neo/sys/sdl/sdl_glimp.cpp +++ b/neo/sys/sdl/sdl_glimp.cpp @@ -366,6 +366,11 @@ bool GLimp_Init( glimpParms_t parms ) { common->Printf( "Using GLEW %s\n", glewGetString( GLEW_VERSION ) ); } + +#if defined(__APPLE__) && SDL_VERSION_ATLEAST(2, 0, 2) + // SRS - On OSX enable SDL2 relative mouse mode warping to capture mouse properly if outside of window + SDL_SetHintWithPriority( SDL_HINT_MOUSE_RELATIVE_MODE_WARP, "1", SDL_HINT_OVERRIDE ); +#endif // DG: disable cursor, we have two cursors in menu (because mouse isn't grabbed in menu) SDL_ShowCursor( SDL_DISABLE ); diff --git a/neo/sys/sdl/sdl_vkimp.cpp b/neo/sys/sdl/sdl_vkimp.cpp index 9a59eb19..e6935ff9 100644 --- a/neo/sys/sdl/sdl_vkimp.cpp +++ b/neo/sys/sdl/sdl_vkimp.cpp @@ -317,6 +317,11 @@ bool VKimp_Init( glimpParms_t parms ) common->Printf( "No usable VK mode found: %s", SDL_GetError() ); return false; } + +#if defined(__APPLE__) && SDL_VERSION_ATLEAST(2, 0, 2) + // SRS - On OSX enable SDL2 relative mouse mode warping to capture mouse properly if outside of window + SDL_SetHintWithPriority( SDL_HINT_MOUSE_RELATIVE_MODE_WARP, "1", SDL_HINT_OVERRIDE ); +#endif // DG: disable cursor, we have two cursors in menu (because mouse isn't grabbed in menu) SDL_ShowCursor( SDL_DISABLE );