Commit graph

154 commits

Author SHA1 Message Date
Chris Taylor bde055a6a1 Fix 'declaration shadows a field of 'dcx::ogl_sync'' warning
Replace fence with fence_func in implementation of ogl_sync::sync_deleter::operator().
2017-01-13 12:30:09 +08:00
Kp 85338cba5e Fix memory corruption starting multiplayer game
Various points in the game code call `hide_menus()`, then later use
`show_menus()` to reverse the effect.  If the forcibly hidden window is
deleted before `show_menus()` is called, the attempt to show it would
write to freed memory.  Add a hook to forget those windows when they are
deleted, so that `show_menus()` does not try to make them visible later.
2016-11-19 18:09:26 +00:00
Kp 2dd4b574c7 Use virtual function to dispatch window events 2016-11-19 17:24:52 +00:00
Kp 61c11ec4d4 Use d_enumerate for SDL joystick loops 2016-11-19 17:24:52 +00:00
Kp 8c4668179e Merge refs/pull/264/head into master 2016-11-13 17:02:26 +00:00
Chris Taylor e597f159e9 In event_process, handle the case of a window deleted in drawing loop with no previous window correctly, preventing possible crash 2016-11-13 11:47:59 +08:00
Chris Taylor 709a2c3d2a Fixes freeze when starting new game or editor
Fixes freeze introduced by 9511f65 where event_process wouldn't go to the next window if it's hidden.
2016-11-07 09:32:06 +08:00
Kp 1cb04cb64b Merge branch derhass:patches/GLES_GL_extension_unification into master 2016-11-06 19:24:52 +00:00
Chris Taylor 143ed30fee Merging in unification/master, resolving conflict in similar/main/kmatrix.cpp 2016-11-06 14:20:18 +08:00
Kp e33f298b5f Fix build with max_hats_per_joystick=0
Reported-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/258>
2016-11-05 21:22:43 +00:00
derhass 1fe4f1ed67 clean up ogl_extensions.cpp as suggested by vLKp 2016-11-05 19:16:30 +01:00
derhass 551570d29b Unify OpenGL extension handling between OpenGL and OpenGL ES code paths.
Split ogl_get_verinfo() into ogl_tune_for_current() and
ogl_extensions_init(), and consolidate all the OpenGL extension handling
into ogl_extensions.cpp. Unify the code paths for texture anisotropy and
GPU synchronization for OpenGL and OpenGL ES.

Currently, our renderer only uses GLES 1.0, so no real world implementation
will support sync objects for such an old context, but the logic is valid,
and this way, the GLES specific code paths are reduced.

This patch also fixes an issue where the old ogl_get_verinfo() did modify
the texture filtering mode if no anisotropic filter was available. This
was some leftover from the time when the anisotropic filter was a just
a specific CGameConfig.TexFilt mode, and not a separate, orthogonal setting
CGameCfg.TexAnisotropy that it is now.
2016-11-03 21:59:11 +01:00
Chris Taylor ca0a012ecb Remove window_exists - can get back from an earlier commit if needed 2016-10-31 16:17:39 +08:00
Chris Taylor 9511f65a90 Declare some local window_event_result vars later (clarity) 2016-10-31 14:58:34 +08:00
Kp 3fc3cfecf1 Use range_for in key_handler 2016-10-29 23:16:17 +00:00
Kp 538b6e23fd Convert check_warn_joy_support_limit to non-template 2016-10-29 23:16:15 +00:00
Chris Taylor 7845446e97 Disable window_exists function
This function is problematic in that another window could open with the same pointer value, causing a false positive to be returned.
2016-10-28 17:01:02 +08:00
Chris Taylor a62ca93498 Use a tracking variable for newmenu_do2 (and simpler) polling loop
Add 'track' method to dcx::window, which takes a bool and will set it to 'false' when the window closes. Use for newmenu_do2 and simpler newmenu_do's, since there's the possibility of another window without its own polling loop opening on top - meaning window_event_result::deleted would be returned for that window, not the one we're polling on.
2016-10-28 16:49:53 +08:00
Chris Taylor 21b0a7a48d Pass the most significant window_event_result to the caller of event_process
This will allow checking for window_event_result::deleted, instead of relying on window_exists, which could return a false positive if a new window was allocated with the same pointer value as the deleted one.
2016-10-28 14:43:20 +08:00
Chris Taylor 57585171de Check for window_event_result::deleted in event_process drawing loop
This is instead of using window_exists, which could give a false positive if a new window was allocated with the same pointer value as a deleted one.
2016-10-28 08:35:40 +08:00
Chris Taylor 9fbd86b0ce Check for window_event_result::deleted in event_send
This is instead of using window_exists, which could give a false positive if a new window was allocated with the same pointer value as a deleted one.
2016-10-28 08:27:02 +08:00
Chris Taylor 2d587de8dc Make call_default_handler return a window_event_result
Make call_default_handler return a window_event_result to inform the event system in future, particularly if a window was closed.
2016-10-27 16:36:24 +08:00
Kp 5e8bcb853d Move window creation events out of window::window
Avoid running arbitrary creation handlers while a constructor is
in-progress.
2016-10-15 00:53:21 +00:00
Kp 01f2932824 Pass grs_canvas &to window_create 2016-10-15 00:53:20 +00:00
Chris Taylor bc1c9ebd97 Merge branch 'unification/master' into allow_dialog_subclass
Conflicts:
	common/arch/sdl/window.cpp - Remove unused EVENT_WINDOW_CLOSED and w_callback local var
	common/ui/dialog.cpp - Remove unused EVENT_WINDOW_CLOSED
2016-10-10 14:40:11 +08:00
Kp 1af65071d7 Remove unused EVENT_WINDOW_CLOSED
Every callee that recognized EVENT_WINDOW_CLOSED did so only to
explicitly ignore it.  Remove the code to send it and all sites that
ignored it.
2016-10-10 00:25:15 +00:00
Chris Taylor 60ac1eaad3 Replace delete dcx::window kludge with a better solution
Replace delete dcx::window kludge with a better solution: instead of requiring every handler to delete the window, add a window_event_result::deleted, which gets returned if the window was deleted by the handler, so window_close knows not to attempt to delete it again.
2016-10-04 14:05:44 +08:00
Chris Taylor 708cd027f0 Use member initialisation list for dcx::window constructor in response to feedback. 2016-10-03 11:10:11 +08:00
Chris Taylor 87617e8ac9 Allow dcx::window struct to be subclassed - step 3
Allow dcx::window struct to be subclassed step 3. This step adds the window destructor and both requires and implements the window to be deleted by the event handler/client in all cases.
2016-10-02 17:49:19 +08:00
Chris Taylor f117df9eee Allow dcx::window struct to be subclassed - step 2
Allow dcx::window struct to be subclassed step 2. This step renames and reconfigures window_create in window.cpp to be the main constructor. Also add a template constructor that allows an event handler that takes a subclass of window.
2016-10-02 14:49:22 +08:00
Chris Taylor 15e9f4a383 Allow dcx::window struct to be subclassed - step 1
Allow dcx::window struct to be subclassed step 1. This step moves the definition for the window struct into window.h, keeping all member variables private and declaring the window related functions as 'friends'. This avoids changes to source files that use the window struct at this stage. Also moving some of the simpler functions in window.cpp into the struct definition to inline them. I would prefer to use class methods, so changing some of these to class methods as well.
2016-10-02 14:32:30 +08:00
Kp 4894117d70 Rename MAX_HATS_PER_JOYSTICK to DXX_MAX_HATS_PER_JOYSTICK
Rename symbol MAX_HATS_PER_JOYSTICK to DXX_MAX_HATS_PER_JOYSTICK
to show that it is a DXX symbol, not one inherited from a library.

git grep -lzw MAX_HATS_PER_JOYSTICK -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_HATS_PER_JOYSTICK\>/DXX_&/g'
2016-09-25 04:52:49 +00:00
Kp 94937de128 Rename MAX_BUTTONS_PER_JOYSTICK to DXX_MAX_BUTTONS_PER_JOYSTICK
Rename symbol MAX_BUTTONS_PER_JOYSTICK to DXX_MAX_BUTTONS_PER_JOYSTICK
to show that it is a DXX symbol, not one inherited from a library.

git grep -lzw MAX_BUTTONS_PER_JOYSTICK -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_BUTTONS_PER_JOYSTICK\>/DXX_&/g'
2016-09-25 04:52:49 +00:00
Kp 7d38a9f0be Rename MAX_AXES_PER_JOYSTICK to DXX_MAX_AXES_PER_JOYSTICK
Rename symbol MAX_AXES_PER_JOYSTICK to DXX_MAX_AXES_PER_JOYSTICK to show
that it is a DXX symbol, not one inherited from a library.

git grep -lzw MAX_AXES_PER_JOYSTICK -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_AXES_PER_JOYSTICK\>/DXX_&/g'
2016-09-25 04:52:49 +00:00
Kp f24e9f836c Rename MAX_JOYSTICKS to DXX_MAX_JOYSTICKS
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'
2016-09-25 04:52:48 +00:00
Kp 62b58e9890 Move OGL to dxxsconf.h; rename to DXX_USE_OGL
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/'
2016-09-24 18:06:11 +00:00
Kp fcb0b4fa66 Replace SDL CD_INDRIVE with equivalent that uses C++ static_cast
<=gcc-5 with -Wold-style-cast warn when expansions of SDL macro
CD_INDRIVE produce an old style cast, even though the cast comes from a
system header.  Undefine it and define an equivalent that uses a C++
cast, so that uses do not provoke a warning.
2016-09-04 19:10:43 +00:00
Kp a09dce6ead Remove char[N] overload for PHYSFSX_getRealPath 2016-08-06 19:55:25 +00:00
zico a8ed0aaa9c Added breaks in event.cpp to prevent unwanted events if -nomouse and/or -nojoystick is given; Added automap_apply_input() to prevent multiple inputs per frame causing multiple movement applications. 2016-05-30 13:17:42 +02:00
Kp ae722cbb8b Shorten maybe_send_z_move 2016-04-03 17:50:42 +00:00
Kp 27cef20eb3 Move namespace dsx handling to dsx-ns.h 2016-03-19 19:08:10 +00:00
Kp b57f08c798 Use partial_const_range 2016-02-12 04:02:28 +00:00
Kp 455ab60c4a Switch OGL extension include to <SDL.h>
The new OGL extension code included <SDL/SDL.h>, which works when the
SDL headers are installed in a directory named SDL and that directory is
in a system search directory.  Those conditions usually hold on Linux,
both for /usr/include and /usr/local/include.  However, non-Linux users
sometimes install SDL in other places.  Kreator reports that the OGL
build on OS X failed because his SDL headers were on the search path,
but not in a directory named SDL on the search path.  Switch the
include directive to an unqualified name to match other SDL includes.

Reported-by: kreatordxx <private mail>
Fixes: db267af6f2 ("add basic OpenGL extension handling")
2016-02-11 03:25:52 +00:00
Kp 16c754f3a2 Split key_toggle_repeat paths at compile time
Every caller passes a literal truth value.  Split the implementation by
the truth value.  This saves loading the value before the call and
testing it inside the call.
2016-01-09 16:38:10 +00:00
Kp dc8c0323d8 Uninline namespace dcx 2015-12-13 18:00:49 +00:00
Kp 2445c8457c Use inline namespace dcx for common/arch/win32 2015-12-05 22:57:24 +00:00
Kp dbe4918f27 Use inline namespace dcx for common/arch/sdl 2015-12-05 22:57:24 +00:00
Kp de6c2b3982 Use inline namespace dcx for common/arch/ogl 2015-12-05 22:57:24 +00:00
Kp 6210d1008b Add if !OGL to SDL-only functions 2015-12-04 03:36:31 +00:00
Kp 40588aaa0a Remove unnecessary key.cpp Installed 2015-11-26 02:56:55 +00:00