Commit Graph

294 Commits (5b56125ad63c22ba66dabc009c0e216e16291d97)

Author SHA1 Message Date
lethosor 2ef46562c8 Avoid calling doSaveData twice when unloading a world
This was happening because of a switch to viewscreen_game_cleanerst and back to
viewscreen_savegamest when saving
2019-08-23 20:45:35 -04:00
lethosor 100e584c34 Fix saving persistent data on regular save 2019-08-23 20:30:06 -04:00
lethosor 07575095fd Merge branch 'develop' into persist 2019-08-22 22:00:50 -04:00
Pauli 49f3de979f Make ServerMain and ServerConnection data race free
RemoteServer and PluginManager side would need complete redesign to be
data race free and concurrent. But as that would be unlikely to be
required from DFHack I decided simpler solution that is fixing data
ownership to a thread and all ServerConnection share a single lock which
allows access to PluginManager and Core.
2019-07-18 23:05:11 -04:00
Pauli 0605b9601c Make Core::started thread safe 2019-07-18 23:05:11 -04:00
Pauli 0ed5c8db39 Fix data race between threaded init and EventManager
The initial run_dfhack_init loads shared state information that is used
by EventManager when state changes. There is a small risk that
EventManager can handle events while run_dfhack_init is still running.
2019-07-18 23:04:40 -04:00
lethosor 5b11d14c6c Rename save/load to "save data"/"load data" 2019-05-29 19:52:03 -04:00
lethosor ceebef5fe2 Merge branch 'develop' into persist 2019-05-28 21:08:16 -04:00
lethosor 13c6bfc1b2 Merge remote-tracking branch 'sgayda2/memory_fixes' into develop 2018-12-22 11:54:31 -05:00
Ben Lubar 10267f3e70
Only save on the first frame of the save screen. 2018-08-26 19:11:41 -05:00
Ben Lubar a672ffcb95
Use viewscreen_savegamest instead of viewscreen_optionst 2018-08-26 19:05:44 -05:00
Ben Lubar 4e690df96a
Add Persistence module.
Alter World to use Persistence instead of storing data in historical figures.

Fake historical figures will be converted to the new format when a world is loaded.

Added plugin_save and plugin_load functions to the plugin API.

Made the weird int7/int28 code that was in the old persistence API slightly safer.
2018-08-26 18:27:58 -05:00
lethosor 063602349c Add a basic test library and a couple GUI module tests (squashed)
Also modified Core/Console a bit to get this to actually produce output on
Travis (DFHACK_DISABLE_CONSOLE now allows console output, just not input)

Squashed merge from lethosor/tests
2018-07-18 14:29:13 -04:00
Stoyan Gaydarov 38cccdb0f4 Update the module create calls to return unique_ptrs 2018-07-14 19:55:25 -07:00
Stoyan Gaydarov 6f90273bb6 More usage of smart pointers throughout core and version info. 2018-07-14 19:55:25 -07:00
Stoyan Gaydarov 699f864110 use dts::make_unique instead of new 2018-07-14 19:51:46 -07:00
Stoyan Gaydarov 12c8046f90 Some memory management changes for Core 2018-07-14 19:51:46 -07:00
lethosor 7afa3690bf Add support for DFHACK_BUILD_ID
Used for BuildMaster builds, for example
2018-07-11 11:47:55 -04:00
lethosor fa8c6724f6 Merge remote-tracking branch 'suokko/dlsym_libgraphics' into develop 2018-07-10 12:25:11 -04:00
lethosor dd3c04eb26 Merge remote-tracking branch 'suokko/windows_crash_after_die' into develop 2018-07-10 11:57:10 -04:00
lethosor 06511340ab Merge remote-tracking branch 'BenLubar/proto-docs' into develop 2018-07-10 11:26:31 -04:00
Pauli 7d92d3f48f Fix the class vs struct warning 2018-07-10 18:24:34 +03:00
Pauli 5eea7198a9 Make Core::~Core safe to call after die
Fixes #1356
2018-07-10 18:24:34 +03:00
Pauli ce6af3d649 Use c++ standard std::_Exit instead of _exit
_exit seems to run dll unloading code which calls static destructors.
Standrd requires std::_Exit not to call destructors which makes using it
attractive in case MSVC actually follows the standard.
2018-07-10 18:21:09 +03:00
Pauli ca5c11603f Support dlsym loading from libgraphics vtables 2018-07-10 17:08:23 +03:00
lethosor 480907259c Rename ui_sidebar_menus.command_line field
Ref dfhack/df-structures#277
2018-07-07 23:51:20 -04:00
lethosor aa76b92662 Merge remote-tracking branch 'suokko/main_thread_ownership_for_df_ai' into develop 2018-07-06 16:37:06 -04:00
Ben Lubar 3b6a0738a0
Add check-rpc.py for Travis. 2018-07-04 15:32:06 -05:00
Pauli d1a3f1a738 Allow canceling lineedit with ctrl+c 2018-07-04 15:21:25 +03:00
Pauli a550e112c3 Allow temporary transfer of main logic thread ownership
Dependency to fix df-ai to work with the new CoreSuspender
2018-07-04 00:02:03 +03:00
Pauli 320e94a1eb Avoid locking CoreSuspender second time in main thread 2018-07-04 00:00:06 +03:00
Pauli f6b0ac7819 Refactor CoreSuspender to fix Console::lineedit exit hangs
The old CoreSuspender requires processing from Core::Update to allow
commands execute. But that causes issues if Core::Shutdown wants
quarentee cleanup order with std:🧵:join. Fixing shutdown ordering
adds too many branches to already fairly complex code.

I decided to try to refactor CoreSuspender to use simpler locking
locking using a std::recusive_muted as primary synchronization
primitive.
To help control when Core::Update unlocks the primary mutex there is
std::contition_variable_any and std::atomic<size_t> queue lenght
counter.
The last state variable is std::atomic<std:🧵:id> that is used to
keep track of owner thread for Core::IsSuspended query.

This should be merged only just after a release to make sure that it
gets maximum testing in develop branch before next release.

Fixes #1066
2018-06-22 17:57:37 +03:00
Pauli 0bc1db4f07 Make sure hotkeythread exits before cleanup 2018-06-22 17:57:37 +03:00
Pauli 1acb60daa2 Prevent data races during console/init thread shutdown
There is a minor chance that console or init thread would access already
freed memory when core is shutting down and cleaning up state. To avoid
any danger of having random bugs caused by the potential data race I
decided to make sure the shutdown code waits for the thread to exit
first.

Windows change is completely untested. It is purely based on msdn
documentation.
2018-06-22 17:57:37 +03:00
Pauli 19a169ba65 Convert Core.cpp to use c++11 thread
I noticed that tthread is missing some c++11 features that make thread
handling code a bit easier. To be able to use those features I decided
to convert Core.cpp to use equivalent standard classes.

This patch has no functional changes.
2018-06-22 17:57:37 +03:00
Pauli 8f2cf3ad26 Fix printf format warnings 2018-06-11 19:57:06 +03:00
lethosor b266c7322f Make fpause pause worldgen
Closes #1256
2018-05-05 16:08:06 -04:00
lethosor 638f0ab35a Add "headless" mode, use in travis 2018-02-03 23:59:01 -05:00
lethosor c3bf14a300 Correct bad os-type attributes in symbols.xml 2018-01-14 22:56:35 -05:00
Phillip Spiess bbdf157a52 Fixup autocomplete built ins per IRC 2017-11-27 13:45:58 -08:00
Phillip Spiess 7e55efa3f7 Autocomplete built in commands (die, etc.) 2017-11-27 13:15:16 -08:00
lethosor 08656a3ca7 Strip DF folder from Ruby script paths
Fixes #1146 (temporarily, see #1147)
2017-08-08 20:08:07 -04:00
lethosor e3cd820fb1 Limit recursive runCommand() calls to 20
Addresses an issue with recursive aliases crashing (#701)
2017-07-12 16:28:21 -04:00
lethosor 7a7f1df908 Redirect stdout and stderr again on Windows
DF appears to redirect them itself at an inconvenient point.

Fixes #1124 (hopefully)
2017-06-30 13:29:05 -04:00
lethosor 0796fafb2a Add new built-in "alias" command
Closes #701
2017-06-19 00:15:20 -04:00
lethosor da98a5054d Make sc-script help more helpful 2017-06-04 19:24:26 -04:00
lethosor b28742cbd0 Respect script path when running ruby scripts
Fixes #1099
2017-06-01 16:20:26 -04:00
lethosor 15759808e5 Fix "plug" output width for generated-creature-renamer 2017-03-02 14:04:20 -05:00
lethosor f2164d27c9 ls: List scripts outside of hack/scripts
Closes #412
2017-02-05 22:11:35 -05:00
lethosor 34988e53b9 Update supported keys in keybinding help text 2017-02-05 22:03:06 -05:00