Commit Graph

159 Commits (d5c31942b50accc840026182100c48928d76641f)

Author SHA1 Message Date
Alexander Gavrilov dc2805b1f3 Link the renderer vtable from libgraphics on linux. 2012-10-30 10:38:32 +04:00
Alexander Gavrilov 4aa1999347 Add a lua api function for patching multiple individual bytes. 2012-10-28 11:50:28 +04:00
Alexander Gavrilov fdaa2a35a1 Fix name ambiguity in MemoryPatcher constructor. 2012-10-28 09:34:50 +04:00
Alexander Gavrilov 92a3277777 Add a MemoryPatcher class as an optimization of scattered patchMemory.
This class can cache the set of memory regions during its lifetime,
and make them writable only once. This avoids e.g. re-reading
/proc/*/maps once for every modified vtable in interpose code.
2012-10-27 21:58:40 +04:00
Kelly Martin 8fd1dd04bb Display dfhack version number at end of baseline 'help' message. 2012-10-16 19:27:48 -05:00
Alexander Gavrilov 459c69046b Dissolve the World module class into a namespace.
It made accessing persistent data way too cumbersome.
2012-10-06 13:46:20 +04:00
Alexander Gavrilov 7440e80e6c Add an API function to retrieve interface key bindings for display. 2012-10-02 13:49:31 +04:00
Petr Mrázek 8812238bf6 Update license, add contributors file, bump release number 2012-09-30 04:03:37 +02:00
Alexander Gavrilov 627f036830 Implement a special command parsing mode with one verbatim argument.
Intended for script expressions, e.g. rb_eval.
2012-09-24 19:13:33 +04:00
Alexander Gavrilov 8a617edb10 Support "ls -a" to list scripts in subdirs. 2012-08-29 19:03:53 +04:00
Alexander Gavrilov e825dc5ddb Tweak the API for current viewscreen, and dispatch show/dismiss from C++. 2012-08-24 13:20:08 +04:00
Alexander Gavrilov b12b9fa91e Suspend DF around loading and unloading plugins.
This is necessary to improve safety of vtable interposing.
2012-08-23 19:51:55 +04:00
Alexander Gavrilov fd0bf2ef92 Extract the color enum from color_ostream to toplevel. 2012-08-19 09:21:25 +04:00
Alexander Gavrilov 24cc8b5c7a Expose an API to claim the suspend lock from the Core.
Previously it was hard-coded in Core::Update, but interposed
vmethods may need this feature too.
2012-08-18 11:52:38 +04:00
Alexander Gavrilov bcc41c081a Add a utility function for patching read-only memory. 2012-08-17 15:07:48 +04:00
jj 8e17ebbefc add SC_PAUSED / SC_UNPAUSED onStateChange events 2012-07-05 18:03:02 +02:00
jj a7a25b80a0 ruby: use the color_ostream argument from dfhack to output to dfhack-run 2012-07-03 16:13:15 +02:00
jj ccbebdafb0 fix error spam when using Zoom hotkeys 2012-06-28 15:05:00 +02:00
jj 552da8417e ruby: handle .rb files in df/hack/scripts/ 2012-06-24 20:24:46 +02:00
Petr Mrázek 59fb4daa9a Merge https://github.com/angavrilov/dfhack 2012-06-23 00:25:50 +02:00
Petr Mrázek 6199d6915c Nuke some error prints. 2012-06-23 00:25:30 +02:00
Alexander Gavrilov bbc1fb010e Fix TEXT mode support, even making it work somewhat.
- Initialize the global pointers before trying to use init.
- Print a message suggesting the use of dfhack-run.
- Don't start the console thread if there is no console.
- When console is disabled, print anything given to it to stderr.
2012-06-14 13:08:39 +04:00
Alexander Gavrilov 7eb4fc19de Make dfhack.run_script usable from other scripts, and document it. 2012-06-14 12:46:12 +04:00
Petr Mrázek 2781723f7b Linux build works again. 2012-06-14 02:25:15 +02:00
Petr Mrázek 316973c463 Re-add fake SDL headers, get rid of real SDL use. 2012-06-14 02:15:43 +02:00
Timothy Collett 7ec0fd6fc0 Trying to set up an autorelease pool, but not yet succeeding. 2012-05-26 16:08:15 -04:00
Timothy Collett 24d221052b Initial changes to get dfhack building on the Mac 2012-05-24 11:31:20 -04:00
Alexander Gavrilov 1b4a24c827 Support using focus strings to limit keybinding scope. 2012-05-19 21:31:42 +04:00
Alexander Gavrilov f37f708b37 Add a workaround for Planepacked bug in buildings constructed via API.
Buildings hanging in the air cause constructWithFilters to
exhibit the same behavior as a moody dwarf in a burrow excluding
the workshop, i.e. endlessly collecting the same type of reagent.

http://www.bay12games.com/dwarves/mantisbt/view.php?id=1416

The workaround monitors jobs and reclassifies the reagents on the fly.
2012-05-17 20:38:27 +04:00
Alexander Gavrilov e9ef9b87b5 Add central locations for onUpdate and onStateChange handling in core. 2012-05-17 20:04:09 +04:00
Alexander Gavrilov 68c5d9b86c Stop Shift-Enter from being handled as if it was Shift-M. 2012-05-16 18:10:07 +04:00
Alexander Gavrilov 7e01b004e9 Implement timeouts in the core lua context, and quicksave script. 2012-05-04 20:59:06 +04:00
Alexander Gavrilov d4d6349f48 Expose builtin commands to dfhack-run, and add lua script support.
Move builtin command implementation to Core methods, and fall
back to hack/scripts/*.lua for otherwise unrecognized commands.
2012-05-04 19:47:18 +04:00
Petr Mrázek 7946cafc86 Merge https://github.com/jaxad0127/dfhack 2012-04-16 22:37:07 +02:00
Alexander Gavrilov 14709e5d45 Add an official core lua context, and allow plugins to send events to it.
- This context requires core suspend lock and asserts it in a few places.
- Special 'event' objects are introduced. They can be invoked as
  functions, in which case they iterate all their fields and call
  them as functions. Errors are printed and consumed.
- When a plugin is opened by the core context, events registered in
  a special array are linked to it. The system is organized so as to
  avoid even trying to pass the event to lua if the module isn't loaded.
2012-04-15 19:09:25 +04:00
Jared Adams f3c7a685f5 Make tiletypes more useful
* Paint, filter, and brush state is now saved between calls.
 * Added 'all' paint option to set material, shape, special, and variant at
      the same time.
 * Added tiletypes-here (like liquids here, except is uses the saved brush
      settings)
 * Added tiletypes-here-point (like liquids here, always only the tile under
      the cursor)
 * Added tiletypes-command: runs tiletypes commands seperated by ';' tokens
      (affects saved state)
 * Make the internal workings match liquids a bit more
 * Give brush objects a descriptor string
 * Make Core::cheap_tokenise available
2012-04-15 08:40:19 -06:00
Alexander Gavrilov cb49c92b99 Allow plugins to export functions to lua with safe reload support.
- To ensure reload safety functions have to be wrapped. Every call
  checks the loaded state and locks a mutex in Plugin. If the plugin
  is unloaded, calling its functions throws a lua error. Therefore,
  plugins may not create closures or export yieldable functions.

- The set of function argument and return types supported by
  LuaWrapper is severely limited when compared to being compiled
  inside the main library.
  Currently supported types: numbers, bool, std::string, df::foo,
  df::foo*, std::vector<bool>, std::vector<df::foo*>.

- To facilitate postponing initialization until after all plugins
  have been loaded, the core sends a SC_CORE_INITIALIZED event.

- As an example, the burrows plugin now exports its functions.
2012-04-14 19:44:07 +04:00
Alexander Gavrilov 249be0c1a0 Change SC_MAP_LOADED handling: only NULL/not NULL change is meaningful. 2012-04-10 12:11:00 +04:00
Alexander Gavrilov 42a9b0a592 Make Core::Suspend safe in plugin_onupdate by pretending to hold the lock.
It is in essence true that OnUpdate owns the suspend lock, so
expose it officially to the recursive suspend lock mechanics.
2012-04-03 13:29:59 +04:00
Alexander Gavrilov afe4eba957 Improve performance of the persistent data api, and wrap it for lua.
Use an stl table for string keys to avoid linear cost of lookup.

This uncovered a bug in the new luaL_getsubtable function.
2012-04-01 16:43:40 +04:00
Petr Mrázek 7ff728b6fc Track world and map changes separately for plugin_onstatechange 2012-04-01 02:56:54 +02:00
Alexander Gavrilov 0f41608ed4 Pull console output support and REPL out of dfusion into core lib. 2012-03-31 15:40:54 +04:00
Petr Mrázek d82120a3db More fixes
Include unistd.h in linux process file
Fix assert in autolabor
Don't print 'script missing' error on DF start
2012-03-29 02:49:44 +02:00
Alexander Gavrilov fe091de0b2 Fix F keys in keybindings: they obviously don't have unicode symbols. 2012-03-28 17:00:06 +08:00
Alexander Gavrilov 976fa18d72 A number of interface tweaks in RemoteClient.
- Associate a default output stream with the whole connection.
  If not explicitly specified in the constructor, uses stdout.
- Add methods that use this default stream to RemoteFunction.
- Add easily usable wrappers for CoreSuspend and CoreResume.
2012-03-16 14:11:46 +04:00
Quietust 52aca6e05a Rename "interface" to "interfacest" and just avoid all of these MSVC problems 2012-03-15 13:00:47 -05:00
Petr Mrázek e5efbc5895 Merge https://github.com/angavrilov/dfhack 2012-03-15 15:40:35 +01:00
Petr Mrázek 1ac8025025 Merge https://github.com/angavrilov/dfhack
Conflicts:
	plugins/workflow.cpp
2012-03-15 14:43:05 +01:00
Alexander Gavrilov 4eb4811777 Make the DF suspend lock recursive, and add RPC calls for batch suspend.
The idea is that if you have to execute many RPC calls, it is
faster to suspend once. The service class takes care to auto-resume
in the destructor in case the client just disappears.
2012-03-15 15:33:19 +04:00
Alexander Gavrilov 87f925e72e Add support for exporting functions from plugins, with example in rename.
TODO: test by actually calling them remotely.
2012-03-15 13:01:23 +04:00