Commit graph

435 commits

Author SHA1 Message Date
Jaime Moreira
6a10a4b84c SDL joystick events now work while in menus
- DirectInput axes are now X first, Y second.
- Menu axes controls swapped/fixed.
- Added SDL DualShock3 buttons in menu actions.
- Fixed SDL mouse system cursor; it could appear in-game.

# Conflicts:
#	src/common/console/keydef.h

# Conflicts:
#	src/win32/i_dijoy.cpp
2020-09-28 19:41:45 +02:00
alexey.lysiuk
95f4f38695 - moved showing of start window banner to proper location in Cocoa backend 2020-02-02 13:58:07 +01:00
alexey.lysiuk
8b5131eeaa - fixed I_FindAttr() to handle symlinks on POSIX platforms 2020-01-28 20:18:27 +01:00
alexey.lysiuk
3b89c2fd34 - put common POSIX system code to a separate file
# Conflicts:
#	src/posix/sdl/i_system.cpp

# Conflicts:
#	src/posix/cocoa/i_system.mm
#	src/posix/sdl/i_system.cpp
2020-01-28 20:18:13 +01:00
alexey.lysiuk
8a0581481b - fixed Linux and macOS implementations of I_FindAttr()
At the moment, we assume that dirent struct has d_type member, and DT_DIR is defined
This is true for supported versions of macOS, and Linux with glibc

https://forum.zdoom.org/viewtopic.php?t=66945
2020-01-12 22:26:09 +01:00
alexey.lysiuk
79b39648d7 - fixed compilation of Cocoa backend with 10.9 SDK
src/posix/cocoa/i_video.mm:68:31: error: property 'delegate' not found on object of type 'id'
src/posix/cocoa/st_console.mm:464:37: error: property 'delegate' not found on object of type 'id'
2020-01-06 01:30:50 +01:00
alexey.lysiuk
af321b36a1 - updated Cocoa backend to follow single exit point workflow 2020-01-06 01:11:06 +01:00
alexey.lysiuk
2b4a071b81 - deleted leftovers of exit refactoring 2020-01-06 01:11:04 +01:00
alexey.lysiuk
14b07ee45f - cleanup SDL fatal error reporting
Output error text to terminal if SDL message box cannot be shown
Removed wrong "No IWAD found" message
2020-01-06 01:10:59 +01:00
alexey.lysiuk
ad07c6fcdb - fixed potential crashes in Linux crash reporter
Do not access various global objects at early stage of initialization and late stage of shutdown

# Conflicts:
#	src/posix/sdl/i_main.cpp

# Conflicts:
#	src/posix/sdl/i_main.cpp
2020-01-06 01:08:16 +01:00
alexey.lysiuk
b5d2cc4778 - call SDL_Quit() from main() instead of atexit()
This should help with crash reporting during SDL shutdown
2020-01-06 00:55:51 +01:00
alexey.lysiuk
6c78556c09 - restored command line arguments initialization in SDL backend 2020-01-06 00:55:47 +01:00
drfrag
cfeacc485b - Try to fix compilation on non windows platforms.
# Conflicts:
#	src/d_main.cpp
2020-01-06 00:51:04 +01:00
alexey.lysiuk
f334400d48 - fixed compilation of POSIX targets
src/posix/cocoa/i_main.mm:152:2: error: use of undeclared identifier 'ShutdownJoysticks'
src/posix/sdl/i_system.cpp:128:3: error: ‘I_FatalError_Gtk’ was not declared in this scope
src/posix/sdl/st_start.cpp:329:8: error: ‘CExitEvent’ was not declared in this scope
2020-01-06 00:48:14 +01:00
drfrag
bda11c6401 - Fixed compilation.
# Conflicts:
#	src/win32/win32video.cpp
2020-01-06 00:46:30 +01:00
Christoph Oelckers
191b958791 - the big cleanup of the exit cleanup is done!
atterm is gone and only a few system-side functions use atexit.
All game side cleanup is performed in D_DoomMain now.

# Conflicts:
#	src/CMakeLists.txt
#	src/atterm.cpp
#	src/atterm.h
#	src/d_main.cpp
#	src/dobjtype.cpp
#	src/g_mapinfo.cpp
#	src/g_statusbar/sbarinfo.cpp
#	src/gamedata/g_mapinfo.h
#	src/i_net.cpp
#	src/p_setup.cpp
#	src/posix/cocoa/i_video.mm
#	src/posix/sdl/hardware.cpp
#	src/posix/sdl/i_main.cpp
#	src/r_utility.cpp
#	src/rendering/v_video.cpp
#	src/sound/s_advsound.cpp
#	src/sound/s_sound.cpp
#	src/swrenderer/r_swcolormaps.cpp
#	src/win32/hardware.cpp
#	src/win32/i_input.cpp

# Conflicts:
#	src/CMakeLists.txt
#	src/i_net.cpp
#	src/posix/sdl/i_system.cpp
#	src/r_utility.cpp
#	src/win32/i_system.cpp
2020-01-05 23:57:44 +01:00
Christoph Oelckers
9ee1c88760 replaced all 'exit's with an ExitEvent exception
The main exits are initiated from code that cannot filter this back to D_DoomMain easily so the exception is the only way to get there.

The 3 main points of exit are:

* quit/exit CCMD
* quitting the menu through ST_Endoom
* receiving a quit message on the main window.

# Conflicts:
#	src/posix/cocoa/st_start.mm
2020-01-05 21:13:56 +01:00
Christoph Oelckers
f52c217234 - moved all exception handling out of the backends
The main catch is now in D_DoomMain, only calling platform specific functions to handle the output for the error.

As a nice side effect, -norun can now be done without an exception, just by exiting D_DoomMain with a special exit code.

# Conflicts:
#	src/win32/i_main.cpp
2020-01-05 21:12:16 +01:00
Christoph Oelckers
e8332b299e - consolidated I_FatalError functions
This also removes the handling from thr Posix backend and will not compile on non-Windows.
2020-01-05 21:09:36 +01:00
Christoph Oelckers
f84c0790ea - consolidated the 3 I_Error implementations
Debug output is now being handled by the respective interface functions, not by the Windows I_Error itself.
2020-01-05 21:09:34 +01:00
alexey.lysiuk
875a136b34 - fixed compilation of Cocoa backend
src/posix/cocoa/st_start.mm:63:7: error: redefinition of 'FBasicStartupScreen'
2020-01-05 21:04:42 +01:00
Christoph Oelckers
89d7330ba9 - cleanup of the sound init/exit code.
Now there is only one single entry point for both, instead of previously 2 entry and 4 exit points.
This also eliminates the explicit shutdown of ZMusic. Timidity++'s two buffers have been put in containers that self-destruct on shutdown and calling dumb_exit is not necessary because the only feature requiring it is not used by any code in the music library.
2020-01-05 21:04:09 +01:00
Christoph Oelckers
55831a264a - some reformatting on exit code, mainly to make searching for the content easier.
# Conflicts:
#	libraries/asmjit/asmjit/core/compiler.h
#	libraries/glslang/spirv/SpvBuilder.h
#	src/posix/sdl/hardware.cpp
#	src/rendering/v_video.cpp
#	src/win32/hardware.cpp
#	src/win32/i_main.cpp
2020-01-05 21:03:41 +01:00
Christoph Oelckers
fcfff6f6f6 - sanitized exit code a bit
Instead of trying a homegrown way to avoid recursive exceptions, let's do it with the defined procedure C++ has for this case: call std::terminate.

This allowed removing some old hackery inherited from Boom and will now hopefully allow sanitizing the exit procedure to the point that it can be done without depending on exit handlers.

# Conflicts:
#	src/files_decompress.cpp

# Conflicts:
#	src/d_main.cpp
2020-01-05 21:03:07 +01:00
Christoph Oelckers
1f15bc5b0d - moced I_DetectOS call into D_DoomMain
This requires the console and was the reason for this strange setup.

# Conflicts:
#	src/posix/cocoa/i_main.mm
2020-01-05 21:00:19 +01:00
Christoph Oelckers
5293b8b281 - moved the initial C_InitConsole call into D_DoomMain
The only difference here were the size values on Windows but for this initial call they have been useless for a long time. When this code was written the console buffer still had a fixed width that needed to be set before adding any text.
2020-01-05 21:00:16 +01:00
Christoph Oelckers
818302e02f - put SDL_Quit into the atexit queue instead of atterm
System exit procedures should not go in there.
2020-01-05 21:00:12 +01:00
drfrag
ce31c46d60 Revert "Use signal handler to invoke call_terms() before exit when possible"
This reverts commit 457dc8b5a9.
2020-01-05 19:56:24 +01:00
Christoph Oelckers
d7db010217 - moved the CD Audio code to ZMusic, too.
This was the last player class.
This code was also cleaned up for non-Windows systems where CD Audio is not implemented.
Instead of providing an empty implementation, all related code is now explicitly deactivated.

# Conflicts:
#	src/CMakeLists.txt
2020-01-05 14:38:27 +01:00
Fabian Greffrath
78ace538a6 do not expect user input if stdin is redirected
If GZDoom is built on a POSIX system without the GTK frontend and not
run from a KDE session, an IWAD picker is presented on the terminal
and expects the user to select a game wad. However, if stdin is
redirected, this won't work, so start with the default IWAD instead.
2019-12-12 11:44:06 +01:00
drfrag
0228a596de - Allow joystick input in the background by default. It's always allowed for XInput controllers and they work as DInput ones with DInput support disabled.
Besides on SDL1 they always worked like that.
2019-11-22 19:44:22 +01:00
Christoph Oelckers
bd3e8c0a99 - split off all music code from s_sound.cpp
# Conflicts:
#	src/CMakeLists.txt
#	src/fragglescript/t_func.cpp
#	src/fragglescript/t_load.cpp
#	src/g_level.cpp
#	src/g_levellocals.h
#	src/g_shared/a_dynlight.cpp
#	src/intermission/intermission.cpp
#	src/p_saveg.cpp
#	src/posix/cocoa/i_main.mm
#	src/s_sound.cpp
#	src/win32/st_start.cpp

# Conflicts:
#	src/win32/st_start.cpp
2019-09-28 14:20:21 +02:00
drfrag
9a3d87cafb - Added PrtSc key support for Linux and MacOS, at least in theory. 2019-09-22 22:55:44 +02:00
Conn O'Griofa
457dc8b5a9 Use signal handler to invoke call_terms() before exit when possible
It's not advisable to rely on atexit() to invoke SDL_Quit(), as it
causes a segmentation fault on exit for the SDL2 KMSDRM driver due to
a conflict with the Mesa drivers* which upstream Mesa may not elect to fix.

The issue can be resolved by replacing the atexit() call with a signal
handler that will interrupt the D_DoomMain() and D_DoomLoop()
functions, then invoke call_terms() within the main thread before exiting.

We can leave the atexit() hook intact to handle edge cases such as abnormal
process exit, or exit methods which do not produce signals such as Alt+F4 or
window close via GUI (neither of which are possible in a KMS context, so
should not affect KMSDRM sessions).

Fixes a segmentation fault/uninterruptible application hang on exit
for all KMS targets, including Raspberry Pi 4B, 3B and Intel i965.

* See: https://bugzilla.libsdl.org/show_bug.cgi?id=4530 and
https://lists.freedesktop.org/archives/mesa-users/2019-March/001519.html
2019-09-12 23:34:17 +02:00
alexey.lysiuk
95f0f7eadd - cleaned up language detection leftovers
# Conflicts:
#	src/posix/sdl/i_system.cpp
2019-07-17 18:14:53 +02:00
drfrag
c3482b75fc - Make joystick input in the background CVAR controlled. 2019-07-03 20:52:03 +02:00
drfrag
29264b764b - Allow background gamepad input on linux as well. 2019-07-02 13:54:05 +02:00
alexey.lysiuk
d90d590484 - added detection of macOS Catalina 2019-06-29 13:09:27 +02:00
alexey.lysiuk
1e496d2d6f - fixed compilation of Cocoa backend
src/posix/cocoa/i_main.mm:225:12: error: Objective-C declarations may only appear in global scope
src/posix/cocoa/i_main.mm:247:17: error: Objective-C declarations may only appear in global scope
src/posix/cocoa/i_main.mm:545:2: error: expected '}'
2019-06-10 20:52:50 +02:00
Christoph Oelckers
b473fc936c - consolidated the 3 atterm implementations.
Each platform had its own copy. Why?

# Conflicts:
#	src/CMakeLists.txt
#	src/dobjtype.cpp
#	src/g_mapinfo.cpp
#	src/g_statusbar/sbarinfo.cpp
#	src/i_net.cpp
#	src/menu/menudef.cpp
#	src/p_setup.cpp
#	src/posix/cocoa/i_video.mm
#	src/posix/i_system.h
#	src/posix/sdl/i_main.cpp
#	src/r_utility.cpp
#	src/s_advsound.cpp
#	src/s_sound.cpp
#	src/v_video.cpp
#	src/win32/i_input.cpp
#	src/win32/i_system.h

# Conflicts:
#	src/CMakeLists.txt
#	src/doomtype.h
#	src/i_net.cpp
#	src/posix/sdl/i_system.cpp
#	src/win32/i_system.cpp
#	src/win32/win32video.cpp
2019-06-10 20:52:02 +02:00
Gutawer
9df4683056 - cleaned up SDL mouse event handling
* Right/middle clicking no longer cancels out the mouse motion events
* The events for the side mouse buttons (EV_GUI_BackButtonDown/Up, EV_GUI_FwdButtonDown/Up) were never fired
* The EV_GUI_WheelRight/Left events were never fired
* The key bindings for mouse buttons above 3 (from 4-8) were broken - pressing MOUSE4 would bind to MOUSE6, for example
2019-06-08 13:11:00 +02:00
alexey.lysiuk
279bac7fe9 - fixed access to wrong event data in SDL backend
Wrong button state event data were read on mouse motion

https://forum.zdoom.org/viewtopic.php?t=64950
2019-06-08 13:10:55 +02:00
drfrag
dd4807a6ee - Added new great icons by Tormentor667. 2019-05-30 00:05:02 +02:00
Christoph Oelckers
c7877388a9 - made the console Unicode-capable.
This also necessitated some character remapping in the console font to move the Windows-1252 extra characters to their proper Unicode code points.

# Conflicts:
#	src/CMakeLists.txt
#	src/posix/sdl/i_input.cpp
#	src/scripting/backend/codegen.cpp
#	src/v_font.cpp

# Conflicts:
#	src/c_console.cpp
2019-05-14 17:12:18 +02:00
Christoph Oelckers
8626dd665c pass full Unicode characters to EV_GUI_Char for Linux and macOS.
The Linux backend looked like it didn't handle anything non-ASCII at all, but this all needs to be tested.
Windows will be a bit more work because it requires using the Unicode API for creating the main window.
2019-05-14 13:30:52 +02:00
alexey.lysiuk
6efd03bbcd - fixed compilation of Cocoa backend
src/posix/cocoa/i_input.mm:487:30: error: no member named 'GetTrueHeight' in 'DFrameBuffer'
2019-05-09 11:01:51 +03:00
Christoph Oelckers
3158826ec0 - removed the automatic system language detection for Windows.
Default language is now always American English, just like on Linux and macOS.

# Conflicts:
#	src/g_cvars.cpp
#	src/gamedata/stringtable.cpp
#	src/textures/texturemanager.cpp

# Conflicts:
#	src/win32/i_system.cpp
2019-04-29 17:42:54 +02:00
alexey.lysiuk
0d968d0943 - replaced all usages of insecure vsprintf() function 2019-04-28 22:58:48 +02:00
Christoph Oelckers
e245852bff - removed FCriticalSection and replaced all of its uses with std::mutex.
There's really no need for a non-standard solution here anymore with C++11.
This also fixes an unreleased lock in the WildMidi code.

# Conflicts:
#	src/posix/sdl/critsec.cpp
2019-04-28 22:13:36 +02:00
Robert Cochran
88e1711ff5 Add handling of left and right mousewheel events to the SDL2 input path 2019-04-28 20:34:35 +02:00