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.
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")
/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
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.
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.
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
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>
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.
Rename symbol MAX_JOYSTICKS to DXX_MAX_JOYSTICKS to show that it is a DXX
symbol, not one inherited from a library.
git grep -lzw MAX_JOYSTICKS -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_JOYSTICKS\>/DXX_&/g'
Rename symbol OGL to DXX_USE_OGL to show that it is a DXX
symbol, not one inherited from a library. Move it to dxxsconf.h to
shorten the command line.
This is a mostly automated transform, but the changes to SConstruct were
manual.
git grep -lzw OGL -- '*.h' '*.cpp' | xargs -0 sed -i -e 's/\(\s*#\s*if\)def\s*OGL/\1 DXX_USE_OGL/' -e 's/\(\s*#\s*if\)ndef OGL/\1 !DXX_USE_OGL/' -e 's/\(\s*#\s*if !\?\)defined(OGL)/\1DXX_USE_OGL/'
Rename symbol EDITOR to DXX_USE_EDITOR to show that it is a DXX
symbol, not one inherited from a library. Move it to dxxsconf.h to
shorten the command line.
This is a mostly automated transform, but the changes to SConstruct were
manual.
git grep -wl EDITOR -- '*.h' '*.cpp' | xargs sed -i -e 's/^\s*#ifdef \(EDITOR\)\>/#if DXX_USE_\1/' -e 's/\s*#\(el\)\?if \(.*\)defined(\(EDITOR\))/#\1if \2DXX_USE_\3/' -e 's/^\s*#ifndef \(EDITOR\)\>/#if !DXX_USE_\1/'
Rename symbol USE_UDP to DXX_USE_UDP to show that it is a DXX
symbol, not one inherited from a library. Move it to dxxsconf.h to
shorten the command line.
This is a mostly automated transform, but the changes to SConstruct were
manual.
git grep -l USE_UDP -- '*.h' '*.cpp' | xargs sed -i -e 's/^\s*#ifdef \(USE_UDP\)$/#if DXX_\1/' -e 's/\s*#\(el\)\?if \(.*\)defined(\(USE_UDP\))/#\1if \2DXX_\3/'
Rename symbol USE_TRACKER to DXX_USE_TRACKER to show that it is a DXX
symbol, not one inherited from a library. Move it to dxxsconf.h to
shorten the command line.
This is a mostly automated transform, but the changes to SConstruct were
manual.
git grep -l USE_TRACKER -- '*.h' '*.cpp' | xargs sed -i -e 's/^#ifdef \(USE_TRACKER\)$/#if DXX_\1/' -e 's/#\(el\)\?if \(.*\)defined(\(USE_TRACKER\))/#\1if \2DXX_\3/'
Rename symbol USE_SDLMIXER to DXX_USE_SDLMIXER to show that it is a DXX
symbol, not one inherited from a library. Move it to dxxsconf.h to
shorten the command line.
This is a mostly automated transform, but the changes to SConstruct and
inferno.cpp were manual.
git grep -l USE_SDLMIXER -- '*.h' '*.cpp' | xargs sed -i -e 's/^#ifdef \(USE_SDLMIXER\)$/#if DXX_\1/' -e 's/#\(el\)\?if \(.*\)defined(\(USE_SDLMIXER\))/#\1if \2DXX_\3/'
This pass only targets commonly used standard types.
s/(\(\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\s*\*\)\s*)\s*(/reinterpret_cast<\1>(/g
C casts do not require parentheses. C++ casts require grouping around
the target. Prepare for conversion to C++ casts by adding otherwise
unnecessary parentheses around the target of simple C casts.
This pass does not attempt to process expressions that involve
any subexpression that can nest arbitrarily, such as parentheses or
brackets. It also works only on commonly used standard types.
(int) a->b; // changed
(int) a[b]; // not changed
s/\((\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\s*\**\s*)\s*\)\([&+-]\?\)\([[:alnum:]_.]\+\s*->\s*\)*\([[:alnum:]_.]\+\)\(\s*\([];+>)*\/^%,|&<>]\)\|$\|\(\s*-\s*[^>]\)\)/\1(\5\6\7)\8/g
Both callers of ReadIniArgs need the string removed afterward. Prior to
8fb9a0f, only the parser for `-ini` needed the string removed. The
caller for the automatic ini file ended and destroyed the container. As
of 8fb9a0f, the container persists. Leaving the string in the container
causes a bad error message if the command line is rejected.
It is bad form to have ReadIniArgs pop, but the caller push. However,
the two callers use different signatures for emplace_back(), so unifying
the push would require calling a suboptimal emplace_back. Choose the
lesser evil of unbalanced push/pop.
Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/198>