Commit Graph

375 Commits (6c9c44c71a97075dc9fef3886062fe6081bdcf57)

Author SHA1 Message Date
myk002 f94cc3fda0
add backtick to keybinding's hardcoded docs 2022-10-19 16:24:21 -07:00
myk002 9817106c30
add --exclude option for ls 2022-10-05 13:30:14 -07:00
myk002 bb52e7bac8 list tools in categories with tags builtin 2022-09-13 23:17:19 -07:00
myk002 a053cce444
update the "requires interactive terminal" message
to make it more user friendly
2022-07-27 16:30:14 -07:00
pre-commit-ci[bot] a567665ab2 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-07-24 05:41:41 +00:00
myk002 5f56d79235
move dfhack.history to dfhack-config/dfhack.history 2022-07-23 21:55:49 -07:00
myk002 cb3e537b38
fix help message when trying to run a plugin name 2022-07-22 20:57:19 -07:00
myk002 0858b95c40
print help from helpdb on CR_WRONG_USAGE 2022-07-22 17:45:48 -07:00
myk002 8173f6dd02
Merge remote-tracking branch 'upstream/develop' into docs 2022-07-18 10:59:00 -07:00
myk002 e926e1116e
replace more Core cpp code with calls to helpdb
also document devel/dump-rpc builtin
2022-07-14 13:19:30 -07:00
lethosor 4cdb0ff138
Merge branch 'rm-old-modules' into develop 2022-07-12 11:23:10 -04:00
myk002 328d839f19
support backtick as a keybinding
and bind it to gui/launcher
2022-07-11 17:23:56 -07:00
Myk e899510b8b
Use helpdb to implement help and ls built-in commands and dfhack.script_help() (#2242)
* use helpdb to implement the help and ls builtins

* use helpdb to implement dfhack.script_help()
2022-07-10 20:17:54 -07:00
Myk 28e15162a5
reorganize init scripts into dfhack-config (#2232)
* reorganize init scripts into dfhack-config

allows player init scripts to build on defaults instead of replace them
this also moves the init scripts out of the main df directory

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* escape asterisks in docs

* remove unneeded dfhack.init file creation for test

* write the test init script to the new init dir

* create the init dir before trying to write a file

* rename default init files for clarity

* Update changelog

* Update docs/changelog.txt

Co-authored-by: Alan <lethosor@users.noreply.github.com>

* Try to get buildmaster to work with old branches

* Update changelog

* get keybindings from all init scripts

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix spacing in changelog

* split default loading into its own file

* update docs with new changes

* update help text wording in default init files

* Apply suggestions from code review

Co-authored-by: Alan <lethosor@users.noreply.github.com>

* Alphabetize changelog

* Update onMapLoad.default.init

* Update onMapLoad.init

* Update Core.rst

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Alan <lethosor@users.noreply.github.com>
2022-07-10 08:54:55 -07:00
lethosor 739871bc0f
Remove Hooks-egg.cpp and related code and configuration options 2022-06-29 23:35:14 -04:00
lethosor 4c7caa2658
Remove unneeded dependencies on modules/Graphic.h 2022-06-29 23:35:13 -04:00
lethosor 8bb047fcc6
Remove Notes module
Only used in a devel plugin that prints notes, and can be easily replaced
with `ui.waypoints.points`
2022-06-29 23:35:13 -04:00
Myk 257e7a3dfd
[core] Debug logging facelift (#2060)
* route 'Loading script...' messages through the debug logging framework
  * they are now controllable via debugfilter. to turn off, add this to your dfhack.init file: debugfilter set Warning core script
* clarify debug logging docs
* prevent DEBUG messages from being compiled out of the binary
* recolor INFO messages so they blend into existing console output
* add configuration interface for log message header elements so they are individually configurable. all default to off
2022-03-30 14:46:09 -07:00
myk002 a7085ea36b report to the console and stderr when we run inits 2022-02-25 12:59:38 -08:00
myk002 192dfd51ee
clear modstate on window focus
this fixes the issue where the alt modstate was getting stuck on systems
that don't send standard keyup events after alt-tab. for example, in KDE
Plasma (on Gentoo, at least), the keyup event when alt is released after
alt-tab contains an incorrect keycode (NUMLOCK instead of L_ALT), which
was preventing us from correctly clearing the alt modstate.
2021-08-06 07:10:42 -07:00
lethosor 2332009825
Merge remote-tracking branch 'myk002/myk_enable_luacov' into develop 2021-03-28 00:38:36 -04:00
myk002 916a10d717
exempt lua test files from docstring requirements
and don't display them with 'ls'
2021-03-07 08:52:45 -08:00
myk002 49b34b52f5
update docs 2021-03-07 08:16:25 -08:00
myk002 418a8c5d21
propagate luacov debug hook through coroutines 2021-03-07 08:16:24 -08:00
lethosor ce7772a1c2
Add Filesystem::restorecwd()
This allows restoring the working directory to its original value, which may not actually be the DF root. See #1671, dfhack/scripts#152
2020-10-14 21:22:53 -04:00
Myk Taylor 48d4013bcb don't list subdirectories named 'internal'
instead of just specifically for lua files with a '-internal.lua' suffix
2020-07-24 22:07:16 -07:00
Myk Taylor b200219967 support for splitting lua scripts into parts
without polluting the output of #DFHack ls
2020-07-20 23:04:23 -07:00
Myk Taylor 16cfd34678 recurs-ify default config copying logic
I refactored Filesystem::listdir_recursive to support removing the path
prefix from the returned files list. There are no current calls that
make use of the prefix parameter, so I converted it into a boolean.
Current usages will use the new default parameter and will not see any
changed behavior.
2020-07-18 22:22:37 -07:00
lethosor 24cebbda58 Fix segfault when setting DFHACK_HEADLESS but not PRINT_MODE:TEXT
endwin() is unhappy if initscr() wasn't called
2020-04-28 21:38:47 -04:00
Ben Lubar fa574cfbec
allow dfhack-run to output colors.
refactor Console-posix to avoid having a parameter equivalent to not calling the function at all.
2020-03-06 15:02:03 -06:00
Ben Lubar 69611ab325
exit if a fatal startup error is encountered while in headless mode (#1491) 2020-02-09 18:05:09 -06:00
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
lethosor 9f541481ea Fix some warnings with GCC -Wall 2016-10-15 00:37:18 -04:00
lethosor f6a91c2f30 Log architecture on startup 2016-10-08 16:58:08 -04:00
lethosor de731b0299 Move save_dir back into cur_savegame and update submodules 2016-08-14 12:41:09 -04:00
Vitaly Pronkin fe18f176f7 More 64-bit fixes
Cherry-picked from 7eb3ba6
- Lua update already done in e2c6350, 4dd411e
- Excluded library/modules/Buildings.cpp
2016-07-26 23:47:53 -04:00
lethosor 163207e362 Give more feedback for DF detection failures with mismatched XML versions
This may help address issues where people forget to read the documentation,
don't run "git submodule update", and end up with a df-structures version
that's too old (which is somewhat common, it turns out).
2016-06-30 20:42:27 -04:00
lethosor 022a1bf9e8 Wrap script descriptions in `ls` output and remove description length cap 2016-06-14 21:24:27 -04:00
lethosor b115fdc73f Load script paths from dfhack-config/script-paths.txt 2016-03-27 15:56:23 -04:00
lethosor c23ac50250 Always run dfhack.init-example if dfhack.init doesn't exist
This previously only happened if no files matching *dfhack*.init
existed
2015-12-27 16:39:10 -05:00
lethosor 5263d425a2 Merge remote-tracking branch 'BenLubar/benlubar-init-args' into develop 2015-12-26 13:47:58 -05:00
Ben Lubar 106891f6e0 vim-style +-args. for example, "./dfhack +echo foo" would be equivalent to running ./dfhack and then typing "echo foo" into the console. uses shell argument splitting, so "./dfhack +somecommand 'foo bar' baz" does the right thing. See DFHack#755. 2015-12-26 12:10:44 -06:00
lethosor 9a82f59518 Merge remote-tracking branch 'BenLubar/benlubar-init-args' into develop 2015-12-26 11:49:45 -05:00
lethosor 14f1e6b06c Improve prerelease warning somewhat 2015-12-22 19:34:54 -05:00
Ben Lubar 9bccf457c5 Check for ui_sidebar_menus being null before using it. 2015-12-17 10:54:19 -06:00
Ben Lubar 80ec5ab043 vim-style +-args. for example, "./dfhack +echo foo" would be equivalent to running ./dfhack and then typing "echo foo" into the console. uses shell argument splitting, so "./dfhack +somecommand 'foo bar' baz" does the right thing. See DFHack#755. 2015-12-13 14:03:25 -06:00
lethosor 83603fcf45 Add prerelease build flag and warning script 2015-12-11 20:27:46 -05:00
lethosor df4fb70be2 Provide more suggestions for unrecognized commands 2015-11-25 20:22:14 -05:00
lethosor 875ecf7827 Update Core::top_viewscreen before calling state change handlers
This was previously done right before SC_VIEWSCREEN_CHANGED events
were handled, meaning that code handling earlier events that used
top_viewscreen (rather than getCurViewscreen()) could refer to an
invalid viewscreen, i.e. in the tick after it was deleted.

Fixes #747
2015-11-14 21:48:51 -05:00
lethosor 2882422a3e Don't require short script help to start with a space
Ref #742
2015-11-09 22:58:46 -05:00
lethosor 8412a496dd Remove extra check for "type" command 2015-11-05 19:09:14 -05:00