Commit graph

220 commits

Author SHA1 Message Date
Kp 3d5de92058 Fix OS X clang build
OS X still uses clang-14, which lacks sufficient std::ranges support for
recent Rebirth changes.

- Rewrite uses of std::ranges::SYMBOL to ranges::SYMBOL
- Add a stub header that, on gcc, provides for each SYMBOL a statement
  `using std::ranges::SYMBOL;`, to delegate back to the standard library
  implementation.
- On clang, define a minimal implementation of the required symbols,
  without constraint enforcement.  Compile-testing with gcc will catch
  constraint violations.

Once OS X clang ships a standard library with the required features,
this stub header will be removed and the uses changed back to their full
names.
2022-10-31 00:51:32 +00:00
Kp 515e0abe11 Pass std::ranges::subrange to PHYSFSX_findFiles 2022-10-09 23:15:21 +00:00
Kp 2c7ed3cfce Pass std::ranges::subrange to PHYSFSX_findabsoluteFiles 2022-10-09 23:15:21 +00:00
Kp 57de180a2e Pass std::ranges::subrange to PHYSFSX_checkMatchingExtension 2022-10-09 23:15:21 +00:00
Kp 90d3d82d8e Default disable VR side-by-side for OpenGL ES
VR requires glDrawBuffer, which Mesa OpenGL ES does not offer.  Default
VR to disabled for OpenGL ES users.  Users who want to try it anyway can
still set use_stereo_render=1 in the SCons environment.
2022-10-09 23:15:20 +00:00
Kp f0d118ed42 Use std::span for PHYSFSX_fgets 2022-10-02 19:51:35 +00:00
Kp 8f1055ca6b Use std::span for poison helper functions 2022-09-24 17:47:51 +00:00
AlumiuN da0b746037 Set console output priority to highest given option rather than most recently specified 2022-05-16 20:03:34 +12:00
Kp 9cdf9152bc Always check return value of PHYSFSX_getRealPath
The contents of the output buffer are undefined if PHYSFSX_getRealPath
fails, so mark the function as [[nodiscard]] and modify all callers to
check that the function succeeded.
2022-03-19 22:55:58 +00:00
Kp 7f51fa3ac5 Use enum class for VR StereoFormat 2021-09-12 16:20:52 +00:00
Kp 56c98f5345 Improve error reporting for PHYSFSX_openWriteBuffered
Return the PHYSFS error code on failure, so that callers can report why
the open failed.
2021-07-25 23:00:56 +00:00
Kp 1c13d3c8d3 Improve error reporting for PHYSFSX_openReadBuffered
Return the PHYSFS error code on failure, so that callers can report why
the open failed.
2021-07-25 23:00:56 +00:00
Kp b814301120 Pass PhysFS error code to callers of PHYSFSX_addRelToSearchPath
Use PHYSFS_getLastErrorCode on the result.  This allows init_movie to
report the reason a movie was unavailable.
2021-07-25 23:00:56 +00:00
Kp 1227625e7c Remove unused return code of PHYSFSX_removeRelFromSearchPath 2021-07-25 23:00:56 +00:00
Kp 76a7361786 Close descent.hog on exit
Add RAII wrappers for unmounting PHYSFS paths.  Use them in places that
previously handled unmounting explicitly.  Also, use it for descent.hog
/ descent2.hog, which previously were left mounted indefinitely.
2021-06-28 03:37:49 +00:00
Kp 1dba8e40ec Move PHYSFSX_addRelToSearchPath pathname to caller
Some callers will need access to the computed path.  Change the callers
to pass in a buffer for this path, and have PHYSFSX_addRelToSearchPath
fill that buffer directly.
2021-06-28 03:37:49 +00:00
Kp c98c412fbb Remove template indirection around PHYSFSX_getRealPath
All callers use a std::array<char, PATH_MAX>, so update the definition
to use that.
2021-06-28 03:37:49 +00:00
Kp 391a539ad2 Use enum class for PHYSFSX_addRelToSearchPath append/prepend parameter 2021-06-28 03:37:49 +00:00
Dave Milici f51e7b86b9 Reorganize & consolidate stereo vars per PR suggestions. 2021-03-15 11:32:10 -07:00
Dave Milici 509da82ee8 Add -gl_stereoview option for selecting stereo viewport modes. 2021-03-12 10:07:45 -08:00
Dave Milici 4169183342 Initial stereo rendering test in side-by-side format.
OGL layer used for rendering surfaces, so using left/right viewports absent stereo quad buffers.
Using legacy Descent +/- eye offset method for left/right stereo perspective rendering passes.
2021-03-11 12:32:01 -08:00
Dmitry Grigoryev fbd05a1592 optimize include files (include what you use) 2021-02-06 21:38:50 +01:00
Kp 0c77bee1d9 Change PHYSFS_removeFromSearchPath to PHYSFS_unmount
Per the documentation, PHYSFS_removeFromSearchPath is a deprecated
wrapper for PHYSFS_unmount.  Call PHYSFS_unmount directly.
2020-12-27 22:03:09 +00:00
Kp fa648075a9 Change PHYSFS_addToSearchPath to PHYSFS_mount
Per the documentation, PHYSFS_addToSearchPath is a deprecated wrapper
for PHYSFS_mount.  Call PHYSFS_mount directly.
2020-12-27 22:03:09 +00:00
Kp 0c53d3a34f Replace PHYSFSX_isNewPath with !PHYSFS_getMountPoint
PHYSFSX_isNewPath retrieves from PhysFS a list of all paths, then
searches them, and frees them at the end.  PhysFS can search its own
list without needing the allocations, so delegate the work to it.
2020-12-27 22:03:09 +00:00
Kp fc63029833 Move more symbols into namespaces 2020-12-26 21:17:29 +00:00
Kp 665713f315 Remove static inline declarations from fwd-partial_range.h
A declaration is useful if it declares an external function.  A static
inline declaration, if not followed by the definition later in the same
translation unit, will not be useful.  Remove such declarations, and
rely on using the definition as a declaration for those files that
actually call partial_range() or similar functions.
2020-06-10 02:25:32 +00:00
Kp d06ad449b8 Always ignore from_hog_only
This fixes PCX loading in the non-editor build.  PCX loading broke in
3114874713 because it switched from PHYSFSX_openReadBuffered to a call
which did not handle the presence of the marker byte in the filename.

The from_hog_only flag has not been properly supported since the
introduction of PHYSFSX_openReadBuffered in
8b323e7214.  Editor builds ignored it on
purpose, and non-editor builds pretended to respect it, only to then
ignore it down inside PHYSFSX_openReadBuffered.  For consistency with
code paths that do not use PHYSFSX_openReadBuffered, disable the bypass
in PHYSFSX_openReadBuffered and remove the code in show_title_screen
that applied the flag.

Reported-by: Jayman2000 <https://github.com/dxx-rebirth/dxx-rebirth/issues/510>
Fixes: 3114874713 ("Delegate PCX loading to SDL_image")
2020-05-28 03:21:22 +00:00
Kp 53761500f1 Qualify uses of std::array 2020-05-02 21:18:42 +00:00
Kp 705f15161f Simplify argument error reporting 2020-04-26 17:26:23 +00:00
Kp 15b0ec7f42 Fix externally reported Mac OS X build break
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:10:9: fatal error:
	  'CoreGraphics/CGBase.h' file not found
    #import <CoreGraphics/CGBase.h>
	    ^~~~~~~~~~~~~~~~~~~~~~~
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:10:9: note: did not
	  find header 'CGBase.h' in framework 'CoreGraphics' (loaded from
	  '/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks')
    similar/misc/physfsx.cpp:20:10: fatal error: 'HIServices/Processes.h' file not found
    #include <HIServices/Processes.h>

Since this is an OS X problem, this has only been tested by the original
reporter.

Reported-by: Sottises <https://github.com/dxx-rebirth/dxx-rebirth/issues/455>
Suggested-by: MaddTheSane <https://github.com/dxx-rebirth/dxx-rebirth/issues/455#issuecomment-536164089> # SConstruct part
2019-10-23 03:02:16 +00:00
Kp 2c91eda5bc Fix various gcc-9 -Wformat-truncation warnings 2019-05-06 00:36:16 +00:00
Kp 7558795edd Fix sharepath confusion when building both targets
Processing sharepath in SConf is incorrect, because targets can share a
build directory (and therefore an SConf run), but not share a sharepath.
Move sharepath handling out of SConf.  Move DXX_USE_SHAREPATH handling
from CGameArg to GameArg, since one game can be built with a sharepath
while the other is built without.
2019-01-20 05:36:56 +00:00
Kp 027cdaf568 Add debug log when sharepath is not used 2018-12-30 00:43:58 +00:00
Kp a705104e84 Check PHYSFS_init return value
PHYSFS_init is not guaranteed to succeed.  Using PHYSFS functions after
PHYSFS_init fails is likely to fail badly.  On Windows, failure may take
the form of a crash in ntdll.  Avoid this by exiting gracefully.
2018-12-08 23:36:18 +00:00
Kp 56d44459d4 Enable SHAREPATH for non-LinuxPlatformSettings 2018-09-14 02:20:55 +00:00
Kp 12b57e84e6 Switch most in-tree http:// links to https://
For each link given as http://, verify that the site is accessible over
https:// and, if so, switch to it.  These domains were converted:

* llvm.org
* clang.llvm.org
* en.cppreference.com
* www.dxx-rebirth.com
* www.libsdl.org
* www.scons.org
2018-09-02 00:57:29 +00:00
Kp 6a96e30495 Merge commit 'Quiet FSRef warnings' into master 2018-08-26 16:14:02 +00:00
C.W. Betts b9c6d59f11 Remove the forcing of null-termination of fullPath on OS X:
CFURLGetFileSystemRepresentation should already null-terminate its buffer.
2018-08-23 22:12:56 -06:00
C.W. Betts 0c48d99d2b Match the coding style of the rest of the document. 2018-08-23 21:29:03 -06:00
C.W. Betts 9cfa12c0fe Use sizeof(fullPath), as suggested by @vLKp. 2018-08-23 21:28:04 -06:00
C.W. Betts 746b61da8d Wrap the gobbler up in a preprocessor guard. 2018-08-22 12:10:33 -06:00
C.W. Betts e2a33dc81f Replace FSRef-dependant calls to CoreFoundation equivalents. 2018-08-21 13:40:25 -06:00
C.W. Betts fdf5a37c35 gobble up -psn command line options.
Should fix #387.
2018-08-21 13:04:21 -06:00
Kp f491059ed7 Enable building with SDL2
This commit enables Rebirth to build with SDL2, but the result is not
perfect.

- SDL2 removed some sticky key support.  Rebirth may behave differently
  now in this area.
- SDL2 removed some key-repeat related support.  Rebirth may behave
  differently now in this area.
- SDL2 gained the ability to make a window fullscreen by sizing it to
  the desktop instead of by changing the desktop resolution.  Rebirth
  uses this, and it mostly works.
  - Resizing while in the automap does not notify the automap code, so
    the view is wrong until the player switches out of automap mode and
    back in.
- SDL2 changed how to enumerate available resolutions.  Since
  fitting the window to the desktop is generally more useful than
  fitting the desktop to the window, I chose to drop support for
  enumerating resolutions instead of porting to the new API.  Users can
  now enter an arbitrary window dimension and Rebirth will make an
  attempt to use it.
  - It might be useful to cap the window dimension at the desktop
    dimension, but that is not done yet.
  - Entering fullscreen mode through the Controls->Graphics submenu
    failed to notify the relevant subsystems, causing the rendered
    content not to rescale.  For now, compile out the option to toggle
    full screen through that menu.  Toggling through Alt+Enter works
    properly.

Despite these quirks, this is a substantial improvement over the prior
commit, where SDL2 cannot be used at all.  The remaining issues can be
resolved in future work.

References: <https://github.com/dxx-rebirth/dxx-rebirth/issues/82>
2018-07-28 23:22:58 +00:00
Kp 5526de4c10 Simplify case insensitive lookups 2018-06-13 02:02:58 +00:00
Kp 09cebc080c Undefine blank SHAREPATH
If user_settings.sharepath is configured to be blank in SConstruct, omit
the C preprocessor macro SHAREPATH instead of defining it to expand to
an empty string.  Adjust the C++ code that uses the macro SHAREPATH to
handle its absence:
- Clearer output in help text
- Skip adding blank SHAREPATH to the PhysFS search path.

As a nice side effect, this enables SHAREPATH on Windows, which could be
helpful for builds shipped with an installer that places game files in a
well-known location (such as "C:\Games\Descent").  Previously,
!defined(__unix__) systems did not add SHAREPATH to the PhysFS search
path, even when one was defined.
2018-05-17 02:49:15 +00:00
Kp 01e1b28d71 Replace useless printf with puts 2017-12-05 05:29:55 +00:00
Kp 3fbc710ec5 Move various SDL-only scanline functions to !DXX_USE_OGL
The OGL build compiles, but does not use, various scanline functions.
Move these to be built only for the SDL build.
2017-11-01 02:01:20 +00:00
Kp 88832e3679 Use constexpr integral_constant for various magic numbers 2017-10-14 17:10:30 +00:00