diff --git a/.gitignore b/.gitignore index 4d3986c67..1c47520cd 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,4 @@ tags #VS is annoying about this one. /build/win64/DF_PATH.txt /build/win32/DF_PATH.txt +/.vs diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d6118c65..b2fb036fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,8 +44,8 @@ if(UNIX) endif() if(WIN32) - if((NOT MSVC) OR (NOT MSVC_VERSION STREQUAL 1900)) - message(SEND_ERROR "MSVC 2015 is required") + if((NOT MSVC) OR (MSVC_VERSION LESS 1900) OR (MSVC_VERSION GREATER 1919)) + message(SEND_ERROR "MSVC 2015 or 2017 is required") endif() endif() diff --git a/CMakeSettings.json b/CMakeSettings.json new file mode 100644 index 000000000..eef8fdb2e --- /dev/null +++ b/CMakeSettings.json @@ -0,0 +1,305 @@ +{ + // See https://go.microsoft.com//fwlink/?linkid=834763 for more information about this file. + "configurations": [ + { + "name": "MSVC 32 Debug", + "generator": "Visual Studio 14 2015", + "configurationType": "RelWithDebInfo", + "intelliSenseMode": "windows-msvc-x86", + "variables": [ + { + "name": "DFHACK_BUILD_ARCH", + "value": "32" + }, + { + "name": "BUILD_STONESENSE", + "value": "1" + }, + { + "name": "REMOVE_SYMBOLS_FROM_DF_STUBS", + "value": "0" + } + ], + "installRoot": "${thisFileDir}/build/win32/DF" + }, + { + "name": "MSVC 32 Release", + "generator": "Visual Studio 14 2015", + "configurationType": "Release", + "intelliSenseMode": "windows-msvc-x86", + "variables": [ + { + "name": "DFHACK_BUILD_ARCH", + "value": "32" + }, + { + "name": "BUILD_STONESENSE", + "value": "1" + } + ], + "installRoot": "${thisFileDir}/build/win32/DF" + }, + { + "name": "MSVC 64 Debug", + "generator": "Visual Studio 14 2015 Win64", + "configurationType": "RelWithDebInfo", + "intelliSenseMode": "windows-msvc-x64", + "variables": [ + { + "name": "DFHACK_BUILD_ARCH", + "value": "64" + }, + { + "name": "BUILD_STONESENSE", + "value": "1" + }, + { + "name": "REMOVE_SYMBOLS_FROM_DF_STUBS", + "value": "0" + } + ], + "installRoot": "${thisFileDir}/build/win64/DF" + }, + { + "name": "MSVC 64 Release", + "generator": "Visual Studio 14 2015 Win64", + "configurationType": "Release", + "intelliSenseMode": "windows-msvc-x64", + "variables": [ + { + "name": "DFHACK_BUILD_ARCH", + "value": "64" + }, + { + "name": "BUILD_STONESENSE", + "value": "1" + } + ], + "installRoot": "${thisFileDir}/build/win64/DF" + }, + { + "name": "GCC 32 Debug", + "remoteMachineName": "${defaultRemoteMachineName}", + "remoteCMakeListsRoot": "/tmp/dfhack-${workspaceHash}/src", + "remoteBuildRoot": "/tmp/dfhack-${workspaceHash}/debug-32", + "rsyncCommandArgs": "--exclude=build --include=.git", + "remoteCopySources": true, + "cmakeExecutable": "$(which cmake)/..", + "generator": "Unix Makefiles", + "configurationType": "RelWithDebInfo", + "intelliSenseMode": "linux-gcc-x86", + "variables": [ + { + "name": "DFHACK_BUILD_ARCH", + "value": "32" + }, + { + "name": "BUILD_STONESENSE", + "value": "1" + }, + { + "name": "REMOVE_SYMBOLS_FROM_DF_STUBS", + "value": "0" + } + ] + }, + { + "name": "GCC 32 Release", + "remoteMachineName": "${defaultRemoteMachineName}", + "remoteCMakeListsRoot": "/tmp/dfhack-${workspaceHash}/src", + "remoteBuildRoot": "/tmp/dfhack-${workspaceHash}/release-32", + "rsyncCommandArgs": "--exclude=build --include=.git", + "remoteCopySources": true, + "cmakeExecutable": "$(which cmake)/..", + "generator": "Unix Makefiles", + "configurationType": "Release", + "intelliSenseMode": "linux-gcc-x86", + "variables": [ + { + "name": "DFHACK_BUILD_ARCH", + "value": "32" + }, + { + "name": "BUILD_STONESENSE", + "value": "1" + } + ] + }, + { + "name": "GCC 64 Debug", + "remoteMachineName": "${defaultRemoteMachineName}", + "remoteCMakeListsRoot": "/tmp/dfhack-${workspaceHash}/src", + "remoteBuildRoot": "/tmp/dfhack-${workspaceHash}/debug-64", + "rsyncCommandArgs": "--exclude=build --include=.git", + "remoteCopySources": true, + "cmakeExecutable": "$(which cmake)/..", + "generator": "Unix Makefiles", + "configurationType": "RelWithDebInfo", + "intelliSenseMode": "linux-gcc-x64", + "variables": [ + { + "name": "DFHACK_BUILD_ARCH", + "value": "64" + }, + { + "name": "BUILD_STONESENSE", + "value": "1" + }, + { + "name": "REMOVE_SYMBOLS_FROM_DF_STUBS", + "value": "0" + } + ] + }, + { + "name": "GCC 64 Release", + "remoteMachineName": "${defaultRemoteMachineName}", + "remoteCMakeListsRoot": "/tmp/dfhack-${workspaceHash}/src", + "remoteBuildRoot": "/tmp/dfhack-${workspaceHash}/release-64", + "rsyncCommandArgs": "--exclude=build --include=.git", + "remoteCopySources": true, + "cmakeExecutable": "$(which cmake)/..", + "generator": "Unix Makefiles", + "configurationType": "Release", + "intelliSenseMode": "linux-gcc-x64", + "variables": [ + { + "name": "DFHACK_BUILD_ARCH", + "value": "64" + }, + { + "name": "BUILD_STONESENSE", + "value": "1" + } + ] + }, + { + "name": "GCC 4.8 32 Debug", + "remoteMachineName": "${defaultRemoteMachineName}", + "remoteCMakeListsRoot": "/tmp/dfhack-${workspaceHash}/src", + "remoteBuildRoot": "/tmp/dfhack-${workspaceHash}/debug-32-48", + "rsyncCommandArgs": "--exclude=build --include=.git", + "remoteCopySources": true, + "cmakeExecutable": "$(which cmake)/..", + "generator": "Unix Makefiles", + "configurationType": "RelWithDebInfo", + "intelliSenseMode": "linux-gcc-x86", + "variables": [ + { + "name": "CMAKE_C_COMPILER", + "value": "gcc-4.8" + }, + { + "name": "CMAKE_CXX_COMPILER", + "value": "g++-4.8" + }, + { + "name": "DFHACK_BUILD_ARCH", + "value": "32" + }, + { + "name": "BUILD_STONESENSE", + "value": "1" + }, + { + "name": "REMOVE_SYMBOLS_FROM_DF_STUBS", + "value": "0" + } + ] + }, + { + "name": "GCC 4.8 32 Release", + "remoteMachineName": "${defaultRemoteMachineName}", + "remoteCMakeListsRoot": "/tmp/dfhack-${workspaceHash}/src", + "remoteBuildRoot": "/tmp/dfhack-${workspaceHash}/release-32-48", + "rsyncCommandArgs": "--exclude=build --include=.git", + "remoteCopySources": true, + "cmakeExecutable": "$(which cmake)/..", + "generator": "Unix Makefiles", + "configurationType": "Release", + "intelliSenseMode": "linux-gcc-x86", + "variables": [ + { + "name": "CMAKE_C_COMPILER", + "value": "gcc-4.8" + }, + { + "name": "CMAKE_CXX_COMPILER", + "value": "g++-4.8" + }, + { + "name": "DFHACK_BUILD_ARCH", + "value": "32" + }, + { + "name": "BUILD_STONESENSE", + "value": "1" + } + ] + }, + { + "name": "GCC 4.8 64 Debug", + "remoteMachineName": "${defaultRemoteMachineName}", + "remoteCMakeListsRoot": "/tmp/dfhack-${workspaceHash}/src", + "remoteBuildRoot": "/tmp/dfhack-${workspaceHash}/debug-64-48", + "rsyncCommandArgs": "--exclude=build --include=.git", + "remoteCopySources": true, + "cmakeExecutable": "$(which cmake)/..", + "generator": "Unix Makefiles", + "configurationType": "RelWithDebInfo", + "intelliSenseMode": "linux-gcc-x64", + "variables": [ + { + "name": "CMAKE_C_COMPILER", + "value": "gcc-4.8" + }, + { + "name": "CMAKE_CXX_COMPILER", + "value": "g++-4.8" + }, + { + "name": "DFHACK_BUILD_ARCH", + "value": "64" + }, + { + "name": "BUILD_STONESENSE", + "value": "1" + }, + { + "name": "REMOVE_SYMBOLS_FROM_DF_STUBS", + "value": "0" + } + ] + }, + { + "name": "GCC 4.8 64 Release", + "remoteMachineName": "${defaultRemoteMachineName}", + "remoteCMakeListsRoot": "/tmp/dfhack-${workspaceHash}/src", + "remoteBuildRoot": "/tmp/dfhack-${workspaceHash}/release-64-48", + "rsyncCommandArgs": "--exclude=build --include=.git", + "remoteCopySources": true, + "cmakeExecutable": "$(which cmake)/..", + "generator": "Unix Makefiles", + "configurationType": "Release", + "intelliSenseMode": "linux-gcc-x64", + "variables": [ + { + "name": "CMAKE_C_COMPILER", + "value": "gcc-4.8" + }, + { + "name": "CMAKE_CXX_COMPILER", + "value": "g++-4.8" + }, + { + "name": "DFHACK_BUILD_ARCH", + "value": "64" + }, + { + "name": "BUILD_STONESENSE", + "value": "1" + } + ] + } + ] +} diff --git a/docs/Compile.rst b/docs/Compile.rst index c392cdc49..36d5550d4 100644 --- a/docs/Compile.rst +++ b/docs/Compile.rst @@ -33,13 +33,16 @@ To get the latest development code (develop branch), clone as above and then:: Generally, you should only need to clone DFHack once. -**Important note regarding submodule update and changing branches**: - -You must run ``git submodule update`` every time you change branches, -such as when switching between the master and develop branches or vice versa. -If a submodule only exists on the newer branch, you also need to run -``git submodule update --init``. Failure to do this may result in strange -build errors or "not a known DF version" errors. +**Important note regarding submodule update after pulling or changing branches**: + +You must run ``git submodule update`` every time you change branches, such as +when switching between the master and develop branches or vice versa. You also +must run it after pulling any changes to submodules from the DFHack repo. If a +submodule only exists on the newer branch, or if a commit you just pulled +contains a new submodule, you need to run ``git submodule update --init``. +Failure to do this may result in a variety of errors, including ``fatal: +does not exist`` when using Git, errors when building DFHack, and ``not a known +DF version`` when starting DF. **More notes**: diff --git a/docs/changelog.txt b/docs/changelog.txt index a048b1df1..d3abf3414 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -43,6 +43,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - Fixed special characters in `command-prompt` and other non-console in-game outputs on Linux/macOS (in tools using ``df2console``) - `die`: fixed windows crash in exit handling - `dwarfmonitor`, `manipulator`: fixed stress cutoffs +- `ruby`: fixed calling conventions for vmethods that return strings (currently ``enabler.GetKeyDisplay()``) - `startdwarf`: fixed on 64-bit Linux ## Misc Improvements @@ -51,6 +52,10 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - Switched to standard scrolling keys, improved spacing slightly - Introduced scrolling of Finder search criteria, removing requirement for 46 lines to work properly (Help/Info still formatted for 46 lines). - Added Freezing search criterion, allowing searches for NA/Frozen/At_Least_Partial/Partial/At_Most_Partial/Never Freezing embarks. +- `rejuvenate`: + - Added ``-all`` argument to apply to all citizens + - Added ``-force`` to include units under 20 years old + - Clarified documentation ## API - Added to ``Units`` module: diff --git a/plugins/ruby/codegen.pl b/plugins/ruby/codegen.pl index ad5f4b239..2a12a1bea 100755 --- a/plugins/ruby/codegen.pl +++ b/plugins/ruby/codegen.pl @@ -462,8 +462,13 @@ sub render_class_vmethods { push @lines_rb, "def $name(" . join(', ', @argnames) . ')'; indent_rb { my $args = join('', map { ", $_" } @argargs); - my $call = "DFHack.vmethod_call(self, $voff$args)"; my $ret = $meth->findnodes('child::ret-type')->[0]; + my $call; + if (!$ret or $ret->getAttribute('ld:meta') ne 'primitive') { + $call = "DFHack.vmethod_call(self, $voff$args)"; + } else { + $call = "DFHack.vmethod_call_mem_return(self, $voff, rv$args)"; + } render_class_vmethod_ret($call, $ret); }; push @lines_rb, 'end'; @@ -534,6 +539,18 @@ sub render_class_vmethod_ret { }; push @lines_rb, "end._at(ptr) if ptr != 0"; } + elsif ($retmeta eq 'primitive') + { + my $subtype = $ret->getAttribute('ld:subtype'); + if ($subtype eq 'stl-string') { + push @lines_rb, "rv = DFHack::StlString.cpp_new"; + push @lines_rb, $call; + push @lines_rb, "rv"; + } else { + print "Unknown return subtype for $call\n"; + push @lines_rb, "nil"; + } + } else { print "vmethod unkret $call\n"; diff --git a/plugins/ruby/ruby-autogen-defs.rb b/plugins/ruby/ruby-autogen-defs.rb index ca5d82393..10727894d 100644 --- a/plugins/ruby/ruby-autogen-defs.rb +++ b/plugins/ruby/ruby-autogen-defs.rb @@ -994,6 +994,14 @@ module DFHack vmethod_arg(a3), vmethod_arg(a4), vmethod_arg(a5)) end + def self.vmethod_call_mem_return(obj, voff, r0=0, a0=0, a1=0, a2=0, a3=0, a4=0) + this = obj._memaddr + vt = df.get_vtable_ptr(this) + fptr = df.memory_read_ptr(vt + voff) + vmethod_do_call(vmethod_arg(r0), fptr, this, vmethod_arg(a0), vmethod_arg(a1), vmethod_arg(a2), + vmethod_arg(a3), vmethod_arg(a4)) + end + def self.vmethod_arg(arg) case arg when nil, false; 0 diff --git a/scripts b/scripts index 6849148e8..801499ab6 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 6849148e8694f5da415cd6920dd9094c352110de +Subproject commit 801499ab67e28bc017e72397ce3c9fddad1829a2