File tree Expand file tree Collapse file tree 3 files changed +25
-3
lines changed Expand file tree Collapse file tree 3 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ LibWrapper::LibWrapper(const string& fname) {
4040 if (!handle)
4141 return ;
4242
43- int * priority_sym = (int *)load_sym (handle, " dfhooks_priority" );
43+ int32_t * priority_sym = (int *)load_sym (handle, " dfhooks_priority" );
4444 if (priority_sym) priority = *priority_sym;
4545
4646 init = (dfhooks_init_fn)load_sym (handle, " dfhooks_init" );
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ typedef bool (*dfhooks_ncurses_key_fn)(int key);
1313
1414struct LibWrapper {
1515 void * handle = nullptr ;
16- int priority = 0 ;
16+ int32_t priority = 0 ;
1717 dfhooks_init_fn init = nullptr ;
1818 dfhooks_shutdown_fn shutdown = nullptr ;
1919 dfhooks_update_fn update = nullptr ;
Original file line number Diff line number Diff line change 11# dfhooks
2- Dwarf Fortress dfhooks API chainloader
2+ Dwarf Fortress dfhooks API chainloader.
3+
4+ This library implements the dfhooks API as (defacto) defined in the DF
5+ [ g\_ src] ( https://github.com/Putnam3145/Dwarf-Fortress--libgraphics--/blob/master/g_src/dfhooks.cpp )
6+ sources and propagates the calls to other libraries that similarly implement
7+ the API.
8+
9+ Those libraries must also be installed in the top-level Dwarf Fortress game
10+ directory and conform to the following per-platform naming scheme:
11+
12+ - Windows: ` dfhooks_{name}.dll ` (e.g. ` dfhooks_mylib.dll ` )
13+ - Linux: ` libdfhooks_{name}.so `
14+ - MacOS: ` libdfhooks_{name}.dylib `
15+
16+ In addition to the symbols required by the dfhooks API, a library can also
17+ export a ` dfhooks_priority ` symbol, which must be of type ` int32_t ` . Libraries
18+ with lower values in the exported ` dfhooks_priority ` will be called first when
19+ callbacks are propagated, except for shutdown, for which libraries with lower
20+ values will be called last. If a library does not export a priority, the value
21+ 0 is used.
22+
23+ If you need to position yourself relative to DFHack, DFHack exports a priority
24+ of 100.
You can’t perform that action at this time.
0 commit comments