Jonathan G Rennison
544da99102
Merge branch 'master' into jgrpp-beta
...
# Conflicts:
# src/cargopacket.h
# src/lang/korean.txt
# src/linkgraph/linkgraph.h
# src/linkgraph/linkgraphjob.h
# src/linkgraph/linkgraphschedule.h
# src/network/network_admin.h
# src/network/network_func.h
# src/network/network_server.cpp
# src/network/network_server.h
# src/order_base.h
# src/rail_cmd.cpp
# src/saveload/company_sl.cpp
# src/saveload/depot_sl.cpp
# src/saveload/economy_sl.cpp
# src/saveload/linkgraph_sl.cpp
# src/saveload/map_sl.cpp
# src/saveload/newgrf_sl.cpp
# src/saveload/order_sl.cpp
# src/saveload/saveload.cpp
# src/saveload/saveload.h
# src/saveload/signs_sl.cpp
# src/saveload/station_sl.cpp
# src/saveload/subsidy_sl.cpp
# src/saveload/town_sl.cpp
# src/saveload/vehicle_sl.cpp
# src/script/api/script_object.cpp
# src/settings.cpp
# src/string.cpp
# src/string_func.h
# src/table/CMakeLists.txt
# src/table/settings/settings.ini
# src/viewport_sprite_sorter_sse4.cpp
3 years ago
Charles Pigott
86c295bb3b
Change: Ignore refresh_rate setting when vsync is enabled
3 years ago
Jonathan G Rennison
4042480806
Merge branch 'jgrpp' into jgrpp-beta
...
# Conflicts:
# src/settings.cpp
# src/settings_gui.cpp
# src/settings_internal.h
# src/table/company_settings.ini
# src/table/currency_settings.ini
# src/table/gameopt_settings.ini
# src/table/misc_settings.ini
# src/table/settings.h.preamble
# src/table/settings.ini
# src/table/win32_settings.ini
# src/table/window_settings.ini
3 years ago
Patric Stout
441ff7e436
Fix: thread safety issue during exiting the game ( #9380 )
...
_exit_game is read by the draw-thread to know when to exit, but
most of the time written by the game-thread.
(cherry picked from commit c12a152ec9
)
3 years ago
Patric Stout
0a7a4e06ad
Add: adhere the autosave_on_exit setting for Null videodriver ( #9343 )
...
This is especially useful for automated-testing, to make a save
when the game quits while using "-vnull:ticks=N".
(cherry picked from commit 37ae6b8ae3
)
3 years ago
Danny de Bruijne
753b1d7e15
Feature: Add selected toolbar buttons to MacBook Pro Touch Bar
3 years ago
Jonathan G Rennison
0b0d154788
Merge branch 'master' into jgrpp-beta
...
# Conflicts:
# .github/workflows/ci-build.yml
# src/lang/german.txt
# src/lang/romanian.txt
# src/lang/slovak.txt
# src/lang/turkish.txt
# src/network/core/address.cpp
# src/network/core/tcp.h
# src/network/core/udp.cpp
# src/network/network.cpp
# src/network/network_client.cpp
# src/network/network_server.cpp
# src/network/network_server.h
# src/network/network_udp.cpp
# src/openttd.cpp
# src/saveload/newgrf_sl.cpp
# src/tree_cmd.cpp
# src/video/video_driver.hpp
# src/window.cpp
# src/window_gui.h
3 years ago
embeddedt
883e4ea325
Change: [Emscripten] set default scrolling mode to non-pointer-locking ( #9191 )
3 years ago
Patric Stout
74186998a2
Codechange: use _cur_palette the same in all the drivers
...
It was a bit of a mixed bag. With this change, gfx.cpp is in
control who accesses _cur_palette from the video-drivers.
3 years ago
Michael Lutz
37116a7575
Codechange: [OSX] Remove old code that has no effect on current OSX versions.
3 years ago
Michael Lutz
883e21dbb7
Codechange: [OSX] We use OpenGL even if Apple doesn't like it.
3 years ago
Michael Lutz
0d5d3083bd
Codechange: [OSX] Use more exact enum names where introduced with the 10.12 SDK.
...
The enum values still have the exact same numerical values, but the 10.12
SDK introduced more explicit names (e.g. like NSEventTypeApplicationDefined
instead of NSApplicationDefined) for several enum constants.
Use them when available.
3 years ago
Jonathan G Rennison
87948d8029
Thread: Adjust checks for whether current thread is the game thread
3 years ago
Patric Stout
cf865597f8
Fix: don't propagate shift/ctrl state till next game-tick ( #9381 )
...
When the game-loop is very slow, it was easily possible to start
the loop with _shift_pressed being false, but end with
_shift_pressed being true. This doesn't hurt the game as such,
but for the user this can be very weird: I pressed "Buy Vehicle",
pressed shift a bit later, and I still get a cost indication.
3 years ago
Rubidium
357af686dc
Cleanup: use true/false instead of 1/0 where applicable
3 years ago
Rubidium
f904aef176
Cleanup: use nullptr instead of 0 or NULL
3 years ago
rubidium42
55a11710a6
Codechange: convert printf DEBUG statements to fmt Debug statements
3 years ago
glx22
d485b50813
Fix: [MinGW] Ignore wglGetProcAddress() cast warnings
3 years ago
glx22
744a9e4745
Codechange: [WIN32] Add a wrapper around GetProcAddress()
3 years ago
glx22
2df48a78cc
Fix: [MinGW32] Can't convert lambda to stdcall
3 years ago
glx22
f4c7d5577e
Codechange: [WIN32] Use VersionHelpers where appropriate
3 years ago
Patric Stout
37ae6b8ae3
Add: adhere the autosave_on_exit setting for Null videodriver ( #9343 )
...
This is especially useful for automated-testing, to make a save
when the game quits while using "-vnull:ticks=N".
3 years ago
Michael Lutz
5be60d03a9
Fix: [OpenGL] Increase timeout when waiting for the GPU to be done with the drawing buffer.
...
The old timeout could be too short if v-sync was on on lower refresh rates.
(cherry picked from commit 97722931a9
)
3 years ago
Jonathan G Rennison
bf87578173
Fix #264 : Crash before calling SDL_SetTextInputRect with no window focused
3 years ago
Patric Stout
ca9a7df752
Codechange: rename str_validate to StrMakeValid(InPlace) ( #9304 )
...
This to be more explicit the function changes the value, and not
returns yes/no.
3 years ago
Michael Lutz
97722931a9
Fix: [OpenGL] Increase timeout when waiting for the GPU to be done with the drawing buffer.
...
The old timeout could be too short if v-sync was on on lower refresh rates.
3 years ago
Patric Stout
457b4f80b6
Fix 91b8ce07: dedicated servers could no longer create screenshots ( #9232 )
...
Although most commands are not useful on a dedicated server,
screenshot commands should be dequeued.
(cherry picked from commit 56050fc96f
)
3 years ago
Patric Stout
b136e65cf9
Change: reworked the debug levels for network facility ( #9251 )
...
It now follows very simple rules:
0 - Fatal, user should know about this
1 - Error, but we are recovering
2 - Warning, wrong but okay if you don't know
3 - Info, information you might care about
4 -
5 - Debug #1 - High level debug messages
6 - Debug #2 - Low level debug messages
7 - Trace information
3 years ago
Patric Stout
56050fc96f
Fix 91b8ce07: dedicated servers could no longer create screenshots ( #9232 )
...
Although most commands are not useful on a dedicated server,
screenshot commands should be dequeued.
3 years ago
Milek7
deb2ad8997
Codechange: Acquire video buffer before taking game state lock to prevent erratic fast forward behaviour ( #9140 )
...
(cherry picked from commit 20762f9117
)
3 years ago
Michael Lutz
1b46ef756e
Codechange: Generalise the delayed blitter change to a generic video driver command queue.
...
(cherry picked from commit 91b8ce073f
)
3 years ago
Peter Nelson
a469b4f395
Fix: Recalculate padding and minimum sizes when GUI or Font zoom is changed.
...
(cherry picked from commit 4791ff2862
)
3 years ago
Milek7
20762f9117
Codechange: Acquire video buffer before taking game state lock to prevent erratic fast forward behaviour ( #9140 )
3 years ago
Michael Lutz
91b8ce073f
Codechange: Generalise the delayed blitter change to a generic video driver command queue.
3 years ago
Peter Nelson
4791ff2862
Fix: Recalculate padding and minimum sizes when GUI or Font zoom is changed.
3 years ago
Jonathan G Rennison
8eb27e1ac7
Merge branch 'master' into jgrpp
...
# Conflicts:
# src/company_cmd.cpp
# src/lang/japanese.txt
# src/network/core/config.h
# src/network/core/packet.cpp
# src/network/core/tcp.cpp
# src/network/network_content.cpp
# src/network/network_server.cpp
# src/network/network_udp.cpp
# src/toolbar_gui.cpp
# src/vehicle_gui_base.h
3 years ago
Jonathan G Rennison
253772e9af
Merge branch 'master' into jgrpp
...
# Conflicts:
# CMakeLists.txt
# COMPILING.md
# src/console.cpp
# src/console_cmds.cpp
# src/console_internal.h
# src/rev.cpp.in
3 years ago
Michael Lutz
f4d5c8d99e
Fix: [OpenGL] Main loop expects to start with the video buffer unmapped. ( #9100 )
3 years ago
Michael Lutz
d1dd997f07
Change: [Win32] Limit the OpenGL video driver to OpenGL 3.2 or newer on Windows.
3 years ago
Michael Lutz
ef80baf75c
Codechange: [Win32] Try getting an OpenGL 4.5 context first before aiming at 3.2.
3 years ago
Michael Lutz
e53313391a
Fix: [OpenGL] Check maximum supported texture size against screen resolution.
3 years ago
Jonathan G Rennison
205673715c
MinGW32: Fix EnumDisplayMonitors callback calling convention compile error
4 years ago
Jonathan G Rennison
253d54ce05
Merge branch 'master' into jgrpp
...
# Conflicts:
# src/lang/french.txt
# src/network/network_udp.cpp
4 years ago
Michael Lutz
433602b072
Fix #9028 : [OpenGL] Clear cursor cache on destroying the OpenGL backend.
4 years ago
Rubidium
468b1c6c5d
Fix: [win32] buffer_locked state not initialised, causing _screen.dst_ptr to be potentially not set
4 years ago
Rubidium
8562395413
Fix: [Video] fast forward boolean states not initialised, potentially causing unstoppable fast forward
4 years ago
Rubidium
64e8305874
Fix: [SDL] buffer_locked state not initialised, causing _screen.dst_ptr to be potentially not set
4 years ago
Jonathan G Rennison
272e583478
Merge branch 'master' into jgrpp
...
# Conflicts:
# src/lang/korean.txt
# src/settings.cpp
4 years ago
Michael Lutz
5644c00482
Fix: Check for a validly mapped OpenGL screen buffer during driver init. ( #9007 )
4 years ago
Patric Stout
f0f2073006
Feature: allow a toggle to enable/disable vsync
...
Vsync should be off by default, as for most players it will be
better to play without vsync. Exception exist, mainly people who
play in fullscreen mode.
4 years ago
Jonathan G Rennison
227041008f
Merge branch 'master' into jgrpp
...
# Conflicts:
# src/debug.cpp
# src/lang/russian.txt
# src/misc_gui.cpp
# src/os/windows/crashlog_win.cpp
# src/os/windows/font_win32.cpp
# src/os/windows/win32.cpp
# src/rail_cmd.cpp
# src/window_gui.h
4 years ago
Jonathan G Rennison
edfa04286b
Merge branch 'master' into jgrpp
...
# Conflicts:
# .github/workflows/release.yml
# bin/CMakeLists.txt
# src/dock_gui.cpp
# src/lang/brazilian_portuguese.txt
# src/lang/catalan.txt
# src/lang/czech.txt
# src/lang/dutch.txt
# src/lang/english.txt
# src/lang/english_US.txt
# src/lang/estonian.txt
# src/lang/finnish.txt
# src/lang/french.txt
# src/lang/german.txt
# src/lang/hungarian.txt
# src/lang/indonesian.txt
# src/lang/italian.txt
# src/lang/japanese.txt
# src/lang/korean.txt
# src/lang/lithuanian.txt
# src/lang/luxembourgish.txt
# src/lang/norwegian_bokmal.txt
# src/lang/polish.txt
# src/lang/portuguese.txt
# src/lang/romanian.txt
# src/lang/russian.txt
# src/lang/serbian.txt
# src/lang/simplified_chinese.txt
# src/lang/slovak.txt
# src/lang/spanish.txt
# src/lang/spanish_MX.txt
# src/lang/swedish.txt
# src/lang/tamil.txt
# src/lang/ukrainian.txt
# src/lang/vietnamese.txt
# src/newgrf.cpp
# src/newgrf_gui.cpp
# src/object_gui.cpp
# src/pathfinder/yapf/yapf_costrail.hpp
# src/pathfinder/yapf/yapf_node_rail.hpp
# src/rail_cmd.cpp
# src/roadveh_cmd.cpp
# src/town_cmd.cpp
# src/vehicle.cpp
# src/water_cmd.cpp
4 years ago
Jonathan G Rennison
39b7ef31f8
Fix: Data races on cursor state in OpenGL backends
4 years ago
Jonathan G Rennison
fbd0a2e65a
Fix: Thread unsafe use of sprite cache in OpenGLBackend::DrawMouseCursor
...
See also: #8870
See also: #8977
4 years ago
Michael Lutz
96d33ab46a
Fix #8930 : [Win32] Don't handle printable keys on keydown if an edit box is in focus.
...
Handle printable input only when the matching WM_CHAR message is incoming.
Without an edit box, do the handling in keydown as usual to support hotkeys.
4 years ago
Niels Martin Hansen
e0561dbded
Fix #8713 : Change OTTD2FS and FS2OTTD to return string objects instead of static buffers
4 years ago
Jonathan G Rennison
ef81729dde
Partially fix data race issues around _cur_palette
...
See: https://github.com/OpenTTD/OpenTTD/issues/8712
4 years ago
Jonathan G Rennison
63ddf7f587
Crashlog: Update thread/lock handling to match GameLoop changes
4 years ago
Jonathan G Rennison
0e959a0563
OpenGL: Avoid data races around _cursor
4 years ago
Jonathan G Rennison
59daa573b5
Avoid data races around modifier keys and pause/FF state
4 years ago
Jonathan G Rennison
f2bfcc5524
Partially fix data race issues around _cur_palette
...
See: https://github.com/OpenTTD/OpenTTD/issues/8712
4 years ago
Jonathan G Rennison
e9186308e9
Fix data race in OpenGLBackend::DrawMouseCursor
4 years ago
Jonathan G Rennison
70897c3e5e
Only call InteractiveRandom when game state mutex is held
4 years ago
Jonathan G Rennison
e094b7f1d6
Partially fix thread safety issues around _cur_palette
...
Replaces: 4c59dfb6
See also: https://github.com/OpenTTD/OpenTTD/issues/8712
4 years ago
Jonathan G Rennison
f94eb286f2
Fix missing MinGW thread includes
4 years ago
Jonathan G Rennison
2a13c8623c
Revert: 4c59dfb6
, move DoPaletteAnimations back into GameLoop
...
Race fix to follow
4 years ago
Jonathan G Rennison
2e6dbfee05
Merge branch 'master' into jgrpp
4 years ago
Jonathan G Rennison
5e14b54a0c
Merge branch 'master' into jgrpp
4 years ago
Jonathan G Rennison
297b340697
Revert "OpenGL: Temporarily reduce OpenGL driver priorities"
...
This reverts commit f81c71e15b
.
4 years ago
Michael Lutz
1cd3a3b070
Fix #8935 : [OSX] Crash when clicking 'Save' due to wrongly-threaded OS call. ( #8944 )
4 years ago
Milek7
7a886cb4d4
Change: Do not disallow persistent buffer mapping on AMD GPUs, as it is actually faster.
4 years ago
Michael Lutz
df958dc907
Fix f0f96e31: [OpenGL] Broken window resizing due to invalid buffer pitch on texture creation.
4 years ago
frosch
0230624359
Fix f0f96e31: [OpenGL] warning: comparison of integer expressions of different signedness. ( #8881 )
4 years ago
Michael Lutz
f0f96e3103
Fix #8871 : [OpenGL] Initialize all buffers after resize and clear back buffer. ( #8877 )
4 years ago
Patric Stout
970fedd78c
Add: make modal windows update more smooth
...
Basically, modal windows had their own thread-locking for what
drawing was possible. This is a bit nonsense now we have a
game-thread. And it makes much more sense to do things like
NewGRFScan and GenerateWorld in the game-thread, and not in a
thread next to the game-thread.
This commit changes that: it removes the threads for NewGRFScan
and GenerateWorld, and just runs the code in the game-thread.
On regular intervals it allows the draw-thread to do a tick,
which gives a much smoother look and feel.
It does slow down NewGRFScan and GenerateWorld ever so slightly
as it spends more time on drawing. But the slowdown is not
measureable on my machines (with 700+ NewGRFs / 4kx4k map and
a Debug build).
Running without a game-thread means NewGRFScan and GenerateWorld
are now blocking.
4 years ago
sean
0464a50ab8
Add: Display refresh rate game option ( #8813 )
4 years ago
Michael Lutz
436cdf1fc8
Fix #8825 : [OpenGL] Don't clear cursor cache from the game loop thread.
4 years ago
Patric Stout
8946b41d20
Fix: ensure switching blitter happens in the main thread
...
This because video-drivers might need to make changes to their
context, which for most video-drivers has to be done in the same
thread as the window was created; main thread in our case.
4 years ago
Patric Stout
e56d2c63c3
Add: [Video] move GameLoop into its own thread
...
This allows drawing to happen while the GameLoop is doing an
iteration too.
Sadly, not much drawing currently can be done while the GameLoop
is running, as for example PollEvent() or UpdateWindows() can
influence the game-state. As such, they first need to acquire a
lock on the game-state before they can be called.
Currently, the main advantage is the time spend in Paint(), which
for non-OpenGL drivers can be a few milliseconds. For OpenGL this
is more like 0.05 milliseconds; in these instances this change
doesn't add any benefits for now.
This is an alternative to the former "draw-thread", which moved
the drawing in a thread for some OSes. It has similar performance
gain as this does, although this implementation allows for more
finer control over what suffers when the GameLoop takes too
long: drawing or the next GameLoop. For now they both suffer
equally.
4 years ago
Michael Lutz
3a4a15cc93
Codechange: don't set the window position when changing blitter
...
There really is no need to make an extra call to the OS in
these cases.
4 years ago
Patric Stout
b9eac7c6dc
Codechange: remove the unused lock around Blitter
4 years ago
Patric Stout
4610aa7ae3
Remove: [Video] no longer draw in a thread
...
Drawing in a thread is a bit odd, and often leads to surprising
issues. For example, OpenGL would only allow it if you move the
full context to the thread. Which is not always easily done on
all OSes.
In general, the advise is to handle system events and drawing
from the main thread, and do everything else in other threads.
So, let's be more like other games.
Additionally, putting the drawing routine in a thread was only
done for a few targets.
Upcoming commit will move the GameLoop in a thread, which will
work for all targets.
4 years ago
Patric Stout
04db99749b
Fix #8784 : using alt+enter didn't update the fullscreen toggle visibly ( #8820 )
...
Basically, the window was not invalidated, so it was never redrawn.
This made it look like it wasn't working, but it really was.
4 years ago
Michael Lutz
25656a10cb
Fix #8808 : [OSX, OpenGL] Crash on switching blitters due to double-mapping the video buffer.
4 years ago
Patric Stout
b93d7dd3cb
Add: Option to (dis-)allow accelerated video drivers. ( #8819 )
...
The video drivers using the OpenGL backend are currently our only
accelerated drivers. The options defaults to off for macOS builds and
to on everywhere else.
Co-authored-by: Michael Lutz <michi@icosahedron.de>
4 years ago
Lastorder
f3b850623c
Fix #220 build fail due to missing var
...
Removed from merge commit dfecdf3afb
4 years ago
Jonathan G Rennison
f81c71e15b
OpenGL: Temporarily reduce OpenGL driver priorities
4 years ago
Jonathan G Rennison
84a7ab180e
Merge branch 'master' into jgrpp
...
# Conflicts:
# src/company_cmd.cpp
# src/lang/greek.txt
# src/table/settings.ini
4 years ago
Jonathan G Rennison
f4e29071be
Merge tag '1.11.0-beta2' into jgrpp
...
# Conflicts:
# .github/workflows/ci-build.yml
# .github/workflows/release.yml
# CMakeLists.txt
# src/blitter/32bpp_optimized.cpp
# src/debug.cpp
# src/gfx.cpp
# src/gfx_func.h
# src/lang/czech.txt
# src/lang/english.txt
# src/lang/italian.txt
# src/lang/swedish.txt
# src/lang/ukrainian.txt
# src/network/network_server.cpp
# src/os/windows/crashlog_win.cpp
# src/os/windows/win32.cpp
# src/pathfinder/follow_track.hpp
# src/screenshot.cpp
# src/settings_type.h
# src/spritecache.cpp
# src/vehicle_gui.cpp
# src/video/sdl2_v.cpp
# src/video/video_driver.cpp
# src/video/video_driver.hpp
# src/video/win32_v.cpp
4 years ago
Michael Lutz
c656633bea
Fix #8775 : [Win32] Don't create the main window when alt-tabbing back into fullscreen.
4 years ago
Michael Lutz
b7a44983b4
Fix: [Win32] Original window size was lost when tabbing in and out of fullscreen.
4 years ago
Patric Stout
abac4b1758
Fix c4df0f95: bootstrap was only showing a black screen ( #8788 )
...
The bootstrap has the _switch_mode to SM_MENU, and never leaves
this mode. Neither is it considered a modal window (while in some
sense it really is). So .. we need to add another "draw anyway"
exception, to make sure bootstrap is being drawn.
4 years ago
Owen Rudge
838fd61f29
Fix: [OSX] Hide dock when entering fullscreen
4 years ago
Patric Stout
f183ded9fe
Add: settings to limit your fast-forward game speed
...
By default this setting is set to 2500% normal game speed.
(cherry picked from commit c3dc27e37e
)
# Conflicts:
# src/gfx.cpp
# src/gfx_func.h
# src/settings_type.h
# src/video/cocoa/cocoa_v.mm
# src/video/video_driver.cpp
# src/video/win32_v.cpp
4 years ago
Patric Stout
535fdb5c89
Codechange: remove _realtime_tick variable
...
(cherry picked from commit fe451b8dc7
)
# Conflicts:
# src/debug.cpp
# src/debug.h
# src/video/video_driver.cpp
4 years ago
Patric Stout
c3dc27e37e
Add: settings to limit your fast-forward game speed
...
By default this setting is set to 2500% normal game speed.
4 years ago
Michael Lutz
d79398a1d5
Fix #8763 : [OpenGL] Cursor sprite origin can be negative.
4 years ago
Jonathan G Rennison
d58989f552
Merge branch 'master' into jgrpp
...
# Conflicts:
# src/lang/english_US.txt
4 years ago
Michael Lutz
77854d561b
Fix: [OpenGL] Don't use OpenGL on MESA software renderers.
...
Performance in this case is worse than not using OpenGL, so just let
OTTD fall back to a different video driver.
4 years ago
Patric Stout
1b5d1d074e
Fix: [SDL2] set GL attributes to get the best GL context possible ( #8759 )
4 years ago