Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
FriskTheFallenHuman committed Dec 11, 2024
2 parents 565fe07 + ce4e6f0 commit 5efac3d
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 59 deletions.
14 changes: 13 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ Note: Numbers starting with a "#" like #330 refer to the bugreport with that num

* Enable/disable Soft Particles when **loading** a graphics quality preset (only enabled in Ultra preset,
though you can still configure it independently as before; #604)
* Support SDL3 (SDL2 and, to some degree, SDL1.2 are also still supported)
* Fix bugs on 64bit Big Endian platforms (#472, #625)
* Fixes for high-poly models (use heap allocation instead of `alloca()` for big buffers; #528)
* Fix building dhewm3ded with newer OpenAL Soft headers (#633)
* Better support for High-DPI mice:
- Don't ignore mouse input on fast movement ("ridiculous mouse delta"), #616
- Allow setting sensitivity to values `< 1` in the dhewm3 settings menu to allow sane speeds
for looking around with High-DPI mice (otherwise it might be way too fast)
* Fix a crash (assertion) on start with ImGui if `SDL_GetWindowDisplayIndex()`
or `SDL_GetDisplayDPI()` failed and the `imgui_scale` CVar was set to the default value of `-1`
(setting it to `1` worked around the bug; #632)
* Updated Dear ImGui to 1.91.4

1.5.4 (2024-08-03)
------------------------------------------------------------------------
Expand Down Expand Up @@ -230,7 +242,7 @@ Note: Numbers starting with a "#" like #330 refer to the bugreport with that num
(it did so if one of the paths, like `fs_cdpath`, was empty)
* Don't use translation in Autosave filenames (#305)
- In the Spanish translation all the Alpha Lab autosaves got the same name,
now the autosave name is based on the mapename instead which is distinct
now the autosave name is based on the mapname instead which is distinct


1.5.0 (2018-12-15)
Expand Down
12 changes: 0 additions & 12 deletions neo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,6 @@ if( NOT MSVC )
endif()
endif() # NOT WIN32

# check if our SDL2/SDL3 supports X11 in SDL_syswm so we can use it for DPI scaling ImGui
# TODO: SDL3? Or just kick this feature?
set( CMAKE_REQUIRED_LIBRARIES SDL2 )
check_c_source_compiles( "#include <SDL_syswm.h>
int main() { SDL_SysWMinfo wmInfo = {}; wmInfo.info.x11.display = NULL; return 0; }" HAVE_SDL_X11 )
unset( CMAKE_REQUIRED_LIBRARIES )

if ( HAVE_SDL_X11 )
message( STATUS "This SDL2 has X11 support" )
add_definitions( -DD3_SDL_X11 )
endif()

# check if this is some kind of clang (Clang, AppleClang, whatever)
# (convert compiler ID to lowercase so we match Clang, clang, AppleClang etc, regardless of case)
string( TOLOWER ${CMAKE_CXX_COMPILER_ID} compiler_id_lower )
Expand Down
2 changes: 1 addition & 1 deletion neo/framework/Dhewm3SettingsMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1546,7 +1546,7 @@ static void DrawOptions(CVarOption options[], int numOptions)
static CVarOption controlOptions[] = {

CVarOption("Mouse Settings"),
CVarOption("sensitivity", "Sensitivity", OT_FLOAT, 1.0f, 30.0f),
CVarOption("sensitivity", "Sensitivity", OT_FLOAT, 0.01f, 30.0f),
CVarOption("m_smooth", "Smoothing Samples", OT_INT, 1, 8),
CVarOption("in_nograb", "Don't grab Mouse Cursor (for debugging/testing)", OT_BOOL),
CVarOption("m_invertLook", [](idCVar& cvar) {
Expand Down
13 changes: 11 additions & 2 deletions neo/framework/UsercmdGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,8 +673,17 @@ void idUsercmdGenLocal::MouseMove( void ) {
historyCounter++;

if ( idMath::Fabs( mx ) > 1000 || idMath::Fabs( my ) > 1000 ) {
Sys_DebugPrintf( "idUsercmdGenLocal::MouseMove: Ignoring ridiculous mouse delta.\n" );
mx = my = 0;
// DG: This caused problems with High-DPI mice - there those values can legitimately happen.
// If it turns out that spurious big values happen for other reasons, we'll
// need a smarter check. Leaving the Sys_DebugPrintf() here to make detecting
// those cases easier, but added a static bool so High DPI mice don't spam the log.
static bool warningShown = false;
if ( !warningShown ) {
warningShown = true;
Sys_DebugPrintf( "idUsercmdGenLocal::MouseMove: Detected ridiculous mouse delta (expected with High DPI mice, though!).\n" );
}

//mx = my = 0;
}

mx *= sensitivity.GetFloat();
Expand Down
3 changes: 3 additions & 0 deletions neo/sound/snd_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ If you have questions concerning this license or the applicable additional terms
// because the implemenations are in openal_stub.cpp
// this is ensured by defining AL_LIBTYPE_STATIC before including the AL headers
#define AL_LIBTYPE_STATIC
// newer versions of openal-soft set the noexcept attribute to functions, older ones didn't
// just disable that so the stub functions continue to match the prototypes in the header
#define AL_DISABLE_NOEXCEPT
#endif

#include <AL/al.h>
Expand Down
52 changes: 9 additions & 43 deletions neo/sys/sys_imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#endif


#include "sys_imgui.h"

#ifdef D3_SDL_X11
#include <dlfcn.h>
#include <SDL_syswm.h>
Expand Down Expand Up @@ -165,48 +167,6 @@ void ShowWarningOverlay( const char* text )
warningOverlayStartPos = ImGui::GetMousePos();
}

#if SDL_MAJOR_VERSION == 2 // not used with SDL3
static float GetDefaultDPI()
{
SDL_Window* win = sdlWindow;
float dpi = -1.0f;
#ifdef D3_SDL_X11
SDL_SysWMinfo wmInfo = {};
SDL_VERSION(&wmInfo.version)
if(SDL_GetWindowWMInfo(win, &wmInfo) && wmInfo.subsystem == SDL_SYSWM_X11) {
Display* display = wmInfo.info.x11.display;

static void* libX11 = NULL;
if(libX11 == NULL) {
libX11 = dlopen("libX11.so.6", RTLD_LAZY);
}
if(libX11 == NULL) {
libX11 = dlopen("libX11.so", RTLD_LAZY);
}
if(libX11 != NULL) {
MY_XGETDEFAULTFUN my_xgetdefault = (MY_XGETDEFAULTFUN)dlsym(libX11, "XGetDefault");
if(my_xgetdefault != NULL) {
//char *XGetDefault(Display* display, const char* program, const char* option)
const char* dpiStr = my_xgetdefault(display, "Xft", "dpi");
printf("XX dpistr = '%s'\n", dpiStr);
if(dpiStr != NULL) {
dpi = atof(dpiStr);
}
}
}
}
if (dpi == -1.0f)
#endif
{
int winIdx = SDL_GetWindowDisplayIndex( win );
if (winIdx >= 0) {
SDL_GetDisplayDPI(winIdx, NULL, &dpi, NULL);
}
}
return dpi;
}
#endif // SDL2-only

static float GetDefaultScale()
{
if ( glConfig.winWidth != glConfig.vidWidth ) {
Expand All @@ -217,9 +177,15 @@ static float GetDefaultScale()
#if SDL_VERSION_ATLEAST(3, 0, 0)
float ret = SDL_GetWindowDisplayScale( sdlWindow );
#else
float dpi = 0.0f;
int winIdx = SDL_GetWindowDisplayIndex( sdlWindow );
SDL_GetDisplayDPI((winIdx >= 0) ? winIdx : 0, NULL, &dpi, NULL);
// TODO: different reference DPI on mac? also, doesn't work that well on my laptop..
float ret = GetDefaultDPI() / 96.0f;
float ret = dpi / 96.0f;
#endif
if ( ret <= 0.0f ) {
return 1.0f;
}
ret = round(ret*2.0)*0.5; // round to .0 or .5
return ret;
}
Expand Down

0 comments on commit 5efac3d

Please sign in to comment.