Skip to content

Commit 03d294f

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into fmtlib
2 parents c6914c2 + 3ca35c6 commit 03d294f

38 files changed

+1799
-1330
lines changed

.github/workflows/build-windows.yml

Lines changed: 60 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,15 @@ on:
6666
jobs:
6767
build-win64:
6868
name: Build win64
69-
runs-on: ubuntu-22.04
69+
runs-on: windows-2022
7070
steps:
71-
- name: Install dependencies
71+
- name: Install build dependencies
7272
run: |
73-
sudo apt-get update
74-
sudo apt-get install ccache
73+
choco install sccache
74+
- name: Install doc dependencies
75+
if: inputs.docs
76+
run: |
77+
pip install sphinx
7578
- name: Clone DFHack
7679
uses: actions/checkout@v4
7780
with:
@@ -108,49 +111,82 @@ jobs:
108111
ref: main
109112
ssh-key: ${{ secrets.DFHACK_3RDPARTY_TOKEN }}
110113
path: depends/steam
114+
- name: Prepare output directories
115+
run: |
116+
mkdir output
117+
mkdir pdb
118+
- name: Get sccache path
119+
run: echo ("SCCACHE_DIR=" + $env:LOCALAPPDATA + "\Mozilla\sccache\cache") >> $env:GITHUB_ENV
111120
- name: Fetch ccache
112121
if: inputs.platform-files
113122
uses: actions/cache/restore@v4
114123
with:
115-
path: build/win64-cross/ccache
124+
path: ${{ env.SCCACHE_DIR }}
116125
key: win-msvc-${{ inputs.cache-id }}-${{ github.sha }}
117126
restore-keys: |
118127
win-msvc-${{ inputs.cache-id }}
119128
win-msvc
120-
- name: Cross-compile
129+
- uses: ilammy/msvc-dev-cmd@v1
130+
- name: Configure DFHack
131+
run: |
132+
cmake `
133+
-S . `
134+
-B build `
135+
-GNinja `
136+
-DDFHACK_BUILD_ARCH=64 `
137+
-DCMAKE_BUILD_TYPE=Release `
138+
-DCMAKE_INSTALL_PREFIX=output `
139+
-DCMAKE_C_COMPILER_LAUNCHER=sccache `
140+
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache `
141+
-DBUILD_PDBS:BOOL=${{ inputs.cache-id == 'release' }} `
142+
-DDFHACK_RUN_URL='https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' `
143+
-DBUILD_LIBRARY=${{ inputs.platform-files }} `
144+
-DBUILD_PLUGINS:BOOL=${{ inputs.platform-files && inputs.plugins }} `
145+
-DBUILD_STONESENSE:BOOL=${{ inputs.stonesense }} `
146+
-DBUILD_DOCS:BOOL=${{ inputs.docs }} `
147+
-DBUILD_DOCS_NO_HTML:BOOL=${{ !inputs.html }} `
148+
-DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} `
149+
-DBUILD_DFLAUNCH:BOOL=${{ inputs.launchdf }} `
150+
-DBUILD_TESTS:BOOL=${{ inputs.tests }} `
151+
-DBUILD_XMLDUMP:BOOL=${{ inputs.xml-dump-type-sizes }} `
152+
${{ inputs.xml-dump-type-sizes && '-DINSTALL_XMLDUMP:BOOL=1' || '' }}
153+
- name: Build DFHack
121154
env:
122-
CMAKE_EXTRA_ARGS: -DBUILD_PDBS:BOOL=${{ inputs.cache-id == 'release' }} -DDFHACK_RUN_URL='https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' -DBUILD_LIBRARY=${{ inputs.platform-files }} -DBUILD_PLUGINS:BOOL=${{ inputs.platform-files && inputs.plugins }} -DBUILD_STONESENSE:BOOL=${{ inputs.stonesense }} -DBUILD_DOCS:BOOL=${{ inputs.docs }} -DBUILD_DOCS_NO_HTML:BOOL=${{ !inputs.html }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} -DBUILD_DFLAUNCH:BOOL=${{ inputs.launchdf }} -DBUILD_TESTS:BOOL=${{ inputs.tests }} -DBUILD_XMLDUMP:BOOL=${{ inputs.xml-dump-type-sizes }} ${{ inputs.xml-dump-type-sizes && '-DINSTALL_XMLDUMP:BOOL=1' || '' }}
155+
SCCACHE_CACHE_SIZE: 500M
123156
run: |
124-
cd build
125-
bash -x build-win64-from-linux.sh
157+
ninja install -C build
126158
- name: Finalize cache
127159
run: |
128160
cd build
129-
ccache -d win64-cross/ccache --show-stats --verbose
130-
ccache -d win64-cross/ccache --max-size ${{ inputs.cache-id == 'release' && '500M' || '150M' }}
131-
ccache -d win64-cross/ccache --cleanup
132-
ccache -d win64-cross/ccache --max-size ${{ inputs.cache-id == 'release' && '2G' || '500M' }}
133-
ccache -d win64-cross/ccache --zero-stats
161+
sccache --show-stats
162+
sccache --zero-stats
134163
- name: Save ccache
135164
if: inputs.platform-files && !inputs.cache-readonly
136165
uses: actions/cache/save@v4
137166
with:
138-
path: build/win64-cross/ccache
167+
path: ${{ env.SCCACHE_DIR }}
139168
key: win-msvc-${{ inputs.cache-id }}-${{ github.sha }}
140169
- name: Format artifact name
141170
if: inputs.artifact-name
142171
id: artifactname
143172
run: |
144-
if test "false" = "${{ inputs.append-date-and-hash }}"; then
145-
echo name=${{ inputs.artifact-name }} >> $GITHUB_OUTPUT
146-
else
147-
echo name=${{ inputs.artifact-name }}-$(date +%Y%m%d)-$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT
148-
fi
173+
if ("${{ inputs.append-date-and-hash }}" -eq "false") {
174+
"name=${{ inputs.artifact-name }}" | Out-File -Append $env:GITHUB_OUTPUT
175+
} else {
176+
$date = Get-Date -Format "yyyMMdd"
177+
$hash = git rev-parse --short HEAD
178+
"name=${{ inputs.artifact-name}}-$date-$hash" | Out-File -Append $env:GITHUB_OUTPUT
179+
}
180+
- name: Prep pdbs
181+
if: inputs.artifact-name && inputs.cache-id == 'release'
182+
run: |
183+
Get-ChildItem -Recurse -File -Path "build" -Filter *.pdb |
184+
Copy-Item -Destination "pdb"
149185
- name: Prep artifact
150-
if: inputs.artifact-name
151186
run: |
152-
cd build/win64-cross/output
153-
tar cjf ../../../${{ steps.artifactname.outputs.name }}.tar.bz2 .
187+
cd output
188+
7z a -ttar -so -an . |
189+
7z a -si -tbzip2 ../${{ steps.artifactname.outputs.name }}.tar.bz2
154190
- name: Upload artifact
155191
if: inputs.artifact-name
156192
uses: actions/upload-artifact@v4
@@ -162,4 +198,4 @@ jobs:
162198
uses: actions/upload-artifact@v4
163199
with:
164200
name: ${{ steps.artifactname.outputs.name }}_pdb
165-
path: build/win64-cross/pdb
201+
path: pdb

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ repos:
2020
args: ['--fix=lf']
2121
- id: trailing-whitespace
2222
- repo: https://github.com/python-jsonschema/check-jsonschema
23-
rev: 0.34.1
23+
rev: 0.35.0
2424
hooks:
2525
- id: check-github-workflows
2626
- repo: https://github.com/Lucas-C/pre-commit-hooks

docs/builtins/keybinding.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Like any other command, it can be used at any time from the console, but
99
bindings are not remembered between runs of the game unless re-created in
1010
:file:`dfhack-config/init/dfhack.init`.
1111

12-
Hotkeys can be any combinations of Ctrl/Alt/Shift with A-Z, 0-9, F1-F12, or `
13-
(the key below the :kbd:`Esc` key on most keyboards). You can also represent
14-
mouse buttons beyond the first three with ``MOUSE4`` through ``MOUSE15``.
12+
Hotkeys can be any combinations of Ctrl/Alt/Super/Shift with any key recognized by SDL.
13+
You can also represent mouse buttons beyond the first three with ``MOUSE4``
14+
through ``MOUSE15``.
1515

1616
Usage
1717
-----
@@ -27,12 +27,13 @@ Usage
2727
``keybinding set <key> "<cmdline>" ["<cmdline>" ...]``
2828
Clear, and then add bindings for the specified key.
2929

30-
The ``<key>`` parameter above has the following **case-sensitive** syntax::
30+
The ``<key>`` parameter above has the following case-insensitive syntax::
3131

32-
[Ctrl-][Alt-][Shift-]KEY[@context[|context...]]
32+
[Ctrl-][Alt-][Super-][Shift-]KEY[@context[|context...]]
3333

3434
where the ``KEY`` part can be any recognized key and :kbd:`[`:kbd:`]` denote
35-
optional parts.
35+
optional parts. It is important to note that the key is the non-shifted version
36+
of the key. For example ``!`` would be defined as ``Shift-0``.
3637

3738
DFHack commands can advertise the contexts in which they can be usefully run.
3839
For example, a command that acts on a selected unit can tell `keybinding` that

docs/changelog.txt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,33 @@ Template for new versions:
5555
# Future
5656

5757
## New Tools
58+
- ``edgescroll``: Introduced plugin to pan the view automatically when the mouse reaches the screen border.
5859

5960
## New Features
61+
- `sort`: Places search widget can search "Siege engines" subtab by name, loaded status, and operator status
6062

6163
## Fixes
64+
- `sort`: Using the squad unit selector will no longer cause Dwarf Fortress to crash on exit
65+
- `sort`: Places search widget moved to account for DF's new "Siege engines" subtab
6266

6367
## Misc Improvements
68+
- `createitem`: created items can now be placed onto/into tables, nests, bookcases, display cases, and altars
69+
- `keybinding`: keybinds may now include the super key, and are no longer limited to particular keys ranges of keys, allowing any recognized by SDL.
70+
- The ``fpause`` console command can now be used to force world generation to pause (as it did prior to version 50).
6471

6572
## Documentation
6673

6774
## API
75+
- ``Hotkey``: New module for hotkey functionality
6876

6977
## Lua
78+
- The ``Lua interactive interpreter`` banner now documents keywords such as ``unit`` and ``item`` which reference the currently-selected object in the DF UI.
79+
- ``dfhack.hotkey.addKeybind``: Creates new keybindings
80+
- ``dfhack.hotkey.removeKeybind``: Removes existing keybindings
81+
- ``dfhack.hotkey.listActiveKeybinds``: Lists all keybinds for the current context
82+
- ``dfhack.hotkey.listAllKeybinds``: Lists all keybinds for all contexts
83+
- ``dfhack.hotkey.requestKeybindingInput``: Requests the next keybind-compatible input is saved
84+
- ``dfhack.hotkey.getKeybindingInput``: Reads the input saved in response to a request.
7085

7186
## Removed
7287

@@ -77,7 +92,6 @@ Template for new versions:
7792
## New Features
7893

7994
## Fixes
80-
- `sort`: Using the squad unit selector will no longer cause Dwarf Fortress to crash on exit
8195

8296
## Misc Improvements
8397

@@ -98,6 +112,7 @@ Template for new versions:
98112
- compatibility with 53.05
99113

100114
## Fixes
115+
- `sort`: Using the squad unit selector will no longer cause Dwarf Fortress to crash on exit
101116

102117
## Misc Improvements
103118

docs/dev/Lua API.rst

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1430,6 +1430,53 @@ Job module
14301430

14311431
Returns the job's description, as seen in the Units and Jobs screens.
14321432

1433+
Hotkey module
1434+
-------------
1435+
1436+
* ``dfhack.hotkey.addKeybind(keyspec, command)``
1437+
1438+
Creates a new keybind with the provided keyspec (see the `keybinding` documentation
1439+
for details on format).
1440+
Returns false on failure to create keybind.
1441+
1442+
* ``dfhack.hotkey.removeKeybind(keyspec, [match_focus=true, command])``
1443+
1444+
Removes keybinds matching the provided keyspec.
1445+
If match_focus is set, the focus portion of the keyspec is matched against.
1446+
If command is provided and not an empty string, the command is matched against.
1447+
Returns false if no keybinds were removed.
1448+
1449+
* ``dfhack.hotkey.listActiveKeybinds()``
1450+
1451+
Returns a list of keybinds active within the current context.
1452+
The items are tables with the following attributes:
1453+
:spec: The keyspec for the hotkey
1454+
:command: The command the hotkey runs when pressed
1455+
1456+
* ``dfhack.hotkey.listAllKeybinds()``
1457+
1458+
Returns a list of all keybinds currently registered.
1459+
The items are tables with the following attributes:
1460+
:spec: The keyspec for the hotkey
1461+
:command: The command the hotkey runs when pressed
1462+
1463+
* ``dfhack.hotkey.requestKeybindingInput([cancel=false])``
1464+
1465+
Enqueues or cancels a request that the next hotkey-compatible input is saved
1466+
and not processed, retrievable with ``dfhack.hotkey.getKeybindingInput()``.
1467+
If cancel is true, any current request is cancelled.
1468+
1469+
* ``dfhack.hotkey.getKeybindingInput()``
1470+
1471+
Reads the latest saved keybind input that was requested.
1472+
Returns a keyspec string for the input, or nil if no input has been saved.
1473+
1474+
* ``dfhack.hotkey.isDisruptiveKeybind(keyspec)``
1475+
1476+
Determines if the provided keyspec could be disruptive to the game experience.
1477+
This includes the majority of standard characters and special keys such as escape,
1478+
backspace, and return when lacking modifiers other than Shift.
1479+
14331480
Units module
14341481
------------
14351482

@@ -3494,7 +3541,7 @@ and are only documented here for completeness:
34943541
* ``dfhack.internal.getModifiers()``
34953542

34963543
Returns the state of the keyboard modifier keys in a table of string ->
3497-
boolean. The keys are ``ctrl``, ``shift``, and ``alt``.
3544+
boolean. The keys are ``ctrl``, ``shift``, ``super``, and ``alt``.
34983545

34993546
* ``dfhack.internal.getSuppressDuplicateKeyboardEvents()``
35003547
* ``dfhack.internal.setSuppressDuplicateKeyboardEvents(suppress)``
@@ -7468,6 +7515,15 @@ Importing scripts
74687515

74697516
--@ module = true
74707517

7518+
In order to be recognized, this line **must** begin with ``--@`` with no
7519+
whitespace characters before it::
7520+
7521+
--@ module = true OK
7522+
--@module = true OK
7523+
-- @module = true NOT OK (no --@ found due to space after --)
7524+
--@module = true NOT OK (leading space, --@ is not at the beginning of the line)
7525+
---@module = true NOT OK (leading dash, --@ is not at the beginning of the line)
7526+
74717527
2. Include a check for ``dfhack_flags.module``, and avoid running any code
74727528
that has side-effects if this flag is true. For instance::
74737529

docs/plugins/edgescroll.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
edgescroll
2+
==========
3+
4+
.. dfhack-tool::
5+
:summary: Scroll the game world and region maps when the mouse reaches the window border.
6+
:tags: interface
7+
8+
Usage
9+
-----
10+
11+
::
12+
13+
enable edgescroll

library/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ set(MAIN_HEADERS
4848
include/DFHackVersion.h
4949
include/BitArray.h
5050
include/ColorText.h
51+
include/Commands.h
5152
include/Console.h
5253
include/Core.h
5354
include/CoreDefs.h
@@ -67,6 +68,7 @@ set(MAIN_HEADERS
6768
include/MiscUtils.h
6869
include/Module.h
6970
include/MemAccess.h
71+
include/MemoryPatcher.h
7072
include/ModuleFactory.h
7173
include/PluginLua.h
7274
include/PluginManager.h
@@ -89,6 +91,7 @@ set(MAIN_HEADERS_WINDOWS
8991
set(MAIN_SOURCES
9092
Core.cpp
9193
ColorText.cpp
94+
Commands.cpp
9295
CompilerWorkAround.cpp
9396
DataDefs.cpp
9497
DataIdentity.cpp
@@ -101,6 +104,7 @@ set(MAIN_SOURCES
101104
LuaApi.cpp
102105
DataStatics.cpp
103106
DataStaticsCtor.cpp
107+
MemoryPatcher.cpp
104108
MiscUtils.cpp
105109
Types.cpp
106110
PluginManager.cpp
@@ -157,6 +161,7 @@ set(MODULE_HEADERS
157161
include/modules/Graphic.h
158162
include/modules/Gui.h
159163
include/modules/GuiHooks.h
164+
include/modules/Hotkey.h
160165
include/modules/Items.h
161166
include/modules/Job.h
162167
include/modules/Kitchen.h
@@ -187,6 +192,7 @@ set(MODULE_SOURCES
187192
modules/Filesystem.cpp
188193
modules/Graphic.cpp
189194
modules/Gui.cpp
195+
modules/Hotkey.cpp
190196
modules/Items.cpp
191197
modules/Job.cpp
192198
modules/Kitchen.cpp

0 commit comments

Comments
 (0)