From 07dedfb3334db220defb4b1ef215404732e6a648 Mon Sep 17 00:00:00 2001 From: PatrikLundell Date: Sun, 24 Nov 2019 21:32:07 +0100 Subject: [PATCH 01/12] Fixed/improved river tile detection --- docs/changelog.txt | 2 ++ plugins/embark-assistant/matcher.cpp | 2 +- plugins/embark-assistant/survey.cpp | 49 ++++++++++++++++++++++++++-- 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index c1d7bae72..818f60d3c 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -52,6 +52,8 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - `embark-assistant`: - fixed bug causing crash on worlds without generated metals (as well as pruning vectors as originally intended). - fixed bug causing mineral matching to fail to cut off at the magma sea, reporting presence of things that aren't (like DF does currently). + - fixed bug causing half of the river tiles not to be recognized. + - added logic to detect some river tiles DF doesn't generate data for (but are definitely present). - `gui/autogems`: fixed error when no world is loaded - `gui/companion-order`: - fixed error when resetting group leaders diff --git a/plugins/embark-assistant/matcher.cpp b/plugins/embark-assistant/matcher.cpp index c013a695e..715453551 100644 --- a/plugins/embark-assistant/matcher.cpp +++ b/plugins/embark-assistant/matcher.cpp @@ -2076,7 +2076,7 @@ namespace embark_assist { uint32_t preliminary_world_match(embark_assist::defs::world_tile_data *survey_results, embark_assist::defs::finders *finder, embark_assist::defs::match_results *match_results) { - // color_ostream_proxy out(Core::getInstance().getConsole()); +// color_ostream_proxy out(Core::getInstance().getConsole()); uint32_t count = 0; for (uint16_t i = 0; i < world->worldgen.worldgen_parms.dim_x; i++) { for (uint16_t k = 0; k < world->worldgen.worldgen_parms.dim_y; k++) { diff --git a/plugins/embark-assistant/survey.cpp b/plugins/embark-assistant/survey.cpp index 5e9e44b5f..a2fb648f2 100644 --- a/plugins/embark-assistant/survey.cpp +++ b/plugins/embark-assistant/survey.cpp @@ -1043,11 +1043,11 @@ void embark_assist::survey::survey_mid_level_tile(embark_assist::defs::geo_data mlt->at(i).at(k).river_present = false; mlt->at(i).at(k).river_elevation = 100; - if (details->rivers_vertical.active[i][k] == 1) { + if (details->rivers_vertical.active[i][k] != 0) { mlt->at(i).at(k).river_present = true; mlt->at(i).at(k).river_elevation = details->rivers_vertical.elevation[i][k]; } - else if (details->rivers_horizontal.active[i][k] == 1) { + else if (details->rivers_horizontal.active[i][k] != 0) { mlt->at(i).at(k).river_present = true; mlt->at(i).at(k).river_elevation = details->rivers_horizontal.elevation[i][k]; } @@ -1179,6 +1179,51 @@ void embark_assist::survey::survey_mid_level_tile(embark_assist::defs::geo_data } } + // This is messy. DF has some weird logic to leave out river bends with a South and an East connection, as well + // as river sources (and presumably sinks) that are to the North or the West of the connecting river. + // Experiments indicate these implicit river bends inherit their River Elevation from the lower of the two + // "parents", and it's assumed river sources and sinks similarly inherit it from their sole "parent". + // Two issues are known: + // - Lake and Ocean tiles may be marked as having a river when DF doesn't. However, DF does allow for rivers to + // exist in Ocean/Lake tiles, as well as sources/sinks. + // - DF generates rivers on/under glaciers, but does not display them (as they're frozen), nor are their names + // displayed. + // + for (uint8_t i = 1; i < 16; i++) { + for (uint8_t k = 0; k < 15; k++) { + if (details->rivers_horizontal.active[i][k] != 0 && + details->rivers_vertical.active[i - 1][k + 1] != 0 && + !mlt->at(i - 1).at(k).river_present) { // Probably never true + mlt->at(i - 1).at(k).river_present = true; + mlt->at(i - 1).at(k).river_elevation = mlt->at(i).at(k).river_elevation; + + if (mlt->at(i - 1).at(k).river_elevation > mlt->at(i - 1).at(k + 1).river_elevation) { + mlt->at(i - 1).at(k).river_elevation = mlt->at(i - 1).at(k + 1).river_elevation; + } + } + } + } + + for (uint8_t i = 0; i < 16; i++) { + for (uint8_t k = 1; k < 16; k++) { + if (details->rivers_vertical.active[i][k] != 0 && + !mlt->at(i).at(k - 1).river_present) { + mlt->at(i).at(k - 1).river_present = true; + mlt->at(i).at(k - 1).river_elevation = mlt->at(i).at(k).river_elevation; + } + } + } + + for (uint8_t i = 1; i < 16; i++) { + for (uint8_t k = 0; k < 16; k++) { + if (details->rivers_horizontal.active[i][k] != 0 && + !mlt->at(i - 1).at(k).river_present) { + mlt->at(i - 1).at(k).river_present = true; + mlt->at(i - 1).at(k).river_elevation = mlt->at(i).at(k).river_elevation; + } + } + } + survey_results->at(x).at(y).aquifer_count = 0; survey_results->at(x).at(y).clay_count = 0; survey_results->at(x).at(y).sand_count = 0; From 910f9658389f8dccd0183428af4797a27202384f Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Sat, 7 Dec 2019 19:27:35 -0800 Subject: [PATCH 02/12] wip --- library/LuaApi.cpp | 1 + library/include/modules/Units.h | 1 + library/modules/Units.cpp | 10 ++++++++++ plugins/proto/RemoteFortressReader.proto | 1 + plugins/remotefortressreader/remotefortressreader.cpp | 2 ++ 5 files changed, 15 insertions(+) diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index 2840aa5b9..5dc881926 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -1611,6 +1611,7 @@ static const LuaWrapper::FunctionReg dfhack_units_module[] = { WRAPM(Units, isOwnCiv), WRAPM(Units, isOwnGroup), WRAPM(Units, isOwnRace), + WRAPM(Units, getDescription), WRAPM(Units, getRaceName), WRAPM(Units, getRaceNamePlural), WRAPM(Units, getRaceBabyName), diff --git a/library/include/modules/Units.h b/library/include/modules/Units.h index 09c39be55..49565960d 100644 --- a/library/include/modules/Units.h +++ b/library/include/modules/Units.h @@ -120,6 +120,7 @@ DFHACK_EXPORT bool isVisible(df::unit* unit); DFHACK_EXPORT std::string getRaceNameById(int32_t race_id); DFHACK_EXPORT std::string getRaceName(df::unit* unit); +DFHACK_EXPORT std::string getDescription(df::unit* unit); DFHACK_EXPORT std::string getRaceNamePluralById(int32_t race_id); DFHACK_EXPORT std::string getRaceNamePlural(df::unit* unit); DFHACK_EXPORT std::string getRaceBabyNameById(int32_t race_id); diff --git a/library/modules/Units.cpp b/library/modules/Units.cpp index 861c25ce9..5fec1c0a3 100644 --- a/library/modules/Units.cpp +++ b/library/modules/Units.cpp @@ -541,6 +541,16 @@ string Units::getRaceName(df::unit* unit) return getRaceNameById(unit->race); } +typedef void (*df_unit_desc_fn)(df::unit*, std::string*); +static df_unit_desc_fn df_unit_desc = reinterpret_cast(0x100cbb890); +string Units::getDescription(df::unit* unit) +{ + CHECK_NULL_POINTER(unit); + std::string str; + df_unit_desc(unit, &str); + return str; +} + // get plural of race name (used for display in autobutcher UI and for sorting the watchlist) string Units::getRaceNamePluralById(int32_t id) { diff --git a/plugins/proto/RemoteFortressReader.proto b/plugins/proto/RemoteFortressReader.proto index af971d55d..6b70a48cb 100644 --- a/plugins/proto/RemoteFortressReader.proto +++ b/plugins/proto/RemoteFortressReader.proto @@ -420,6 +420,7 @@ message UnitAppearance optional Hair beard = 6; optional Hair moustache = 7; optional Hair sideburns = 8; + optional string description = 9; } message InventoryItem diff --git a/plugins/remotefortressreader/remotefortressreader.cpp b/plugins/remotefortressreader/remotefortressreader.cpp index 7dced3b9f..3efcd80a5 100644 --- a/plugins/remotefortressreader/remotefortressreader.cpp +++ b/plugins/remotefortressreader/remotefortressreader.cpp @@ -1750,6 +1750,8 @@ static command_result GetUnitListInside(color_ostream &stream, const BlockReques appearance->add_colors(unit->appearance.colors[j]); appearance->set_size_modifier(unit->appearance.size_modifier); + appearance->set_description(Units::getDescription(unit)); + send_unit->set_profession_id(unit->profession); std::vector pvec; From 9a378496038d15f391148e863054bfc9af4d8de1 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Sat, 7 Dec 2019 22:41:55 -0800 Subject: [PATCH 03/12] use symbols.xml --- library/modules/Units.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/library/modules/Units.cpp b/library/modules/Units.cpp index 5fec1c0a3..5a50d4069 100644 --- a/library/modules/Units.cpp +++ b/library/modules/Units.cpp @@ -541,13 +541,21 @@ string Units::getRaceName(df::unit* unit) return getRaceNameById(unit->race); } -typedef void (*df_unit_desc_fn)(df::unit*, std::string*); -static df_unit_desc_fn df_unit_desc = reinterpret_cast(0x100cbb890); +typedef void (*df_unit_physical_description_fn)(df::unit*, string*); +void df_unit_physical_description(df::unit* unit, string* out_str) +{ + static df_unit_physical_description_fn fn = + reinterpret_cast( + Core::getInstance().vinfo->getAddress("unit_physical_description")); + if (fn) + fn(unit, out_str); +} + string Units::getDescription(df::unit* unit) { CHECK_NULL_POINTER(unit); - std::string str; - df_unit_desc(unit, &str); + string str; + df_unit_physical_description(unit, &str); return str; } From dfab521a71eb83087a29383216f9cb0f56766dbd Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Thu, 12 Dec 2019 17:51:41 -0800 Subject: [PATCH 04/12] specify __thiscall According to https://docs.microsoft.com/en-us/cpp/cpp/thiscall?view=vs-2019, "on ARM and x64 machines, __thiscall is accepted and ignored by the compiler.". So it should be OK to specify this for all win32 --- library/modules/Units.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/library/modules/Units.cpp b/library/modules/Units.cpp index 5a50d4069..b16d8e4bd 100644 --- a/library/modules/Units.cpp +++ b/library/modules/Units.cpp @@ -541,7 +541,13 @@ string Units::getRaceName(df::unit* unit) return getRaceNameById(unit->race); } -typedef void (*df_unit_physical_description_fn)(df::unit*, string*); +#ifdef _WIN32 +#define THISCALL __thiscall +#else +#define THISCALL +#endif + +typedef void (THISCALL *df_unit_physical_description_fn)(df::unit*, string*); void df_unit_physical_description(df::unit* unit, string* out_str) { static df_unit_physical_description_fn fn = From 7fce6fe0b029b91991aa26ca969308539da088fa Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Fri, 13 Dec 2019 23:54:27 -0800 Subject: [PATCH 05/12] move THISCALL define to header, clean up code a little --- library/include/MiscUtils.h | 11 +++++++++++ library/modules/Units.cpp | 15 ++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/library/include/MiscUtils.h b/library/include/MiscUtils.h index ec2c7be58..35f8be73b 100644 --- a/library/include/MiscUtils.h +++ b/library/include/MiscUtils.h @@ -45,6 +45,17 @@ using std::endl; #define DFHACK_FUNCTION_SIG __func__ #endif +#ifdef _WIN32 +// On x86 MSVC, __thiscall passes |this| in ECX. On x86_64, __thiscall is the +// same as the standard calling convention. +// See https://docs.microsoft.com/en-us/cpp/cpp/thiscall for more info. +#define THISCALL __thiscall +#else +// On other platforms, there's no special calling convention for calling member +// functions. +#define THISCALL +#endif + namespace DFHack { class color_ostream; } diff --git a/library/modules/Units.cpp b/library/modules/Units.cpp index b16d8e4bd..82d5e04d2 100644 --- a/library/modules/Units.cpp +++ b/library/modules/Units.cpp @@ -541,20 +541,13 @@ string Units::getRaceName(df::unit* unit) return getRaceNameById(unit->race); } -#ifdef _WIN32 -#define THISCALL __thiscall -#else -#define THISCALL -#endif - -typedef void (THISCALL *df_unit_physical_description_fn)(df::unit*, string*); void df_unit_physical_description(df::unit* unit, string* out_str) { - static df_unit_physical_description_fn fn = - reinterpret_cast( + static auto* const fn = + reinterpret_cast( Core::getInstance().vinfo->getAddress("unit_physical_description")); - if (fn) - fn(unit, out_str); + CHECK_NULL_POINTER(fn); + fn(unit, out_str); } string Units::getDescription(df::unit* unit) From 50e696acf68fb05a7d28b3a01872668facc3307c Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Sat, 14 Dec 2019 09:34:46 -0800 Subject: [PATCH 06/12] getDescription => getPhysicalDescription --- library/LuaApi.cpp | 2 +- library/include/modules/Units.h | 2 +- library/modules/Units.cpp | 2 +- plugins/proto/RemoteFortressReader.proto | 2 +- plugins/remotefortressreader/remotefortressreader.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index 5dc881926..7c3ef965d 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -1611,7 +1611,7 @@ static const LuaWrapper::FunctionReg dfhack_units_module[] = { WRAPM(Units, isOwnCiv), WRAPM(Units, isOwnGroup), WRAPM(Units, isOwnRace), - WRAPM(Units, getDescription), + WRAPM(Units, getPhysicalDescription), WRAPM(Units, getRaceName), WRAPM(Units, getRaceNamePlural), WRAPM(Units, getRaceBabyName), diff --git a/library/include/modules/Units.h b/library/include/modules/Units.h index 49565960d..f5995583b 100644 --- a/library/include/modules/Units.h +++ b/library/include/modules/Units.h @@ -120,7 +120,7 @@ DFHACK_EXPORT bool isVisible(df::unit* unit); DFHACK_EXPORT std::string getRaceNameById(int32_t race_id); DFHACK_EXPORT std::string getRaceName(df::unit* unit); -DFHACK_EXPORT std::string getDescription(df::unit* unit); +DFHACK_EXPORT std::string getPhysicalDescription(df::unit* unit); DFHACK_EXPORT std::string getRaceNamePluralById(int32_t race_id); DFHACK_EXPORT std::string getRaceNamePlural(df::unit* unit); DFHACK_EXPORT std::string getRaceBabyNameById(int32_t race_id); diff --git a/library/modules/Units.cpp b/library/modules/Units.cpp index 82d5e04d2..2b7243f05 100644 --- a/library/modules/Units.cpp +++ b/library/modules/Units.cpp @@ -550,7 +550,7 @@ void df_unit_physical_description(df::unit* unit, string* out_str) fn(unit, out_str); } -string Units::getDescription(df::unit* unit) +string Units::getPhysicalDescription(df::unit* unit) { CHECK_NULL_POINTER(unit); string str; diff --git a/plugins/proto/RemoteFortressReader.proto b/plugins/proto/RemoteFortressReader.proto index 6b70a48cb..a61bfbe21 100644 --- a/plugins/proto/RemoteFortressReader.proto +++ b/plugins/proto/RemoteFortressReader.proto @@ -420,7 +420,7 @@ message UnitAppearance optional Hair beard = 6; optional Hair moustache = 7; optional Hair sideburns = 8; - optional string description = 9; + optional string physical_description = 9; } message InventoryItem diff --git a/plugins/remotefortressreader/remotefortressreader.cpp b/plugins/remotefortressreader/remotefortressreader.cpp index 3efcd80a5..dd338c705 100644 --- a/plugins/remotefortressreader/remotefortressreader.cpp +++ b/plugins/remotefortressreader/remotefortressreader.cpp @@ -1750,7 +1750,7 @@ static command_result GetUnitListInside(color_ostream &stream, const BlockReques appearance->add_colors(unit->appearance.colors[j]); appearance->set_size_modifier(unit->appearance.size_modifier); - appearance->set_description(Units::getDescription(unit)); + appearance->set_physical_description(Units::getPhysicalDescription(unit)); send_unit->set_profession_id(unit->profession); From 7644dde9e4f0e010081203a1ffc97d8f51b0eb97 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Sat, 14 Dec 2019 12:01:13 -0800 Subject: [PATCH 07/12] default to empty description if symbol unavailable --- library/modules/Units.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/modules/Units.cpp b/library/modules/Units.cpp index 2b7243f05..09912ef56 100644 --- a/library/modules/Units.cpp +++ b/library/modules/Units.cpp @@ -546,8 +546,10 @@ void df_unit_physical_description(df::unit* unit, string* out_str) static auto* const fn = reinterpret_cast( Core::getInstance().vinfo->getAddress("unit_physical_description")); - CHECK_NULL_POINTER(fn); - fn(unit, out_str); + if (fn) + fn(unit, out_str); + else + *out_str = ""; } string Units::getPhysicalDescription(df::unit* unit) From 5de368a1ede318359ac14b468a99663cf8b868fe Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Sat, 4 Jan 2020 22:17:03 +1100 Subject: [PATCH 08/12] unit_{=> get_}physical_description --- library/modules/Units.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/modules/Units.cpp b/library/modules/Units.cpp index 09912ef56..3e56e79df 100644 --- a/library/modules/Units.cpp +++ b/library/modules/Units.cpp @@ -541,11 +541,11 @@ string Units::getRaceName(df::unit* unit) return getRaceNameById(unit->race); } -void df_unit_physical_description(df::unit* unit, string* out_str) +void df_unit_get_physical_description(df::unit* unit, string* out_str) { static auto* const fn = reinterpret_cast( - Core::getInstance().vinfo->getAddress("unit_physical_description")); + Core::getInstance().vinfo->getAddress("unit_get_physical_description")); if (fn) fn(unit, out_str); else @@ -556,7 +556,7 @@ string Units::getPhysicalDescription(df::unit* unit) { CHECK_NULL_POINTER(unit); string str; - df_unit_physical_description(unit, &str); + df_unit_get_physical_description(unit, &str); return str; } From be5dc2d4a4511335b3e1e07e6a69c9a8418bf8da Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Thu, 9 Jan 2020 14:48:30 -0600 Subject: [PATCH 09/12] Make Units::isGay act consistently when called on an asexual unit. The function appears to be used to determine whether heterosexual relationships are possible, so asexual units will always return true for isGay. Old behavior was to treat asexual units as male. --- library/modules/Units.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/modules/Units.cpp b/library/modules/Units.cpp index 861c25ce9..b2dd7b679 100644 --- a/library/modules/Units.cpp +++ b/library/modules/Units.cpp @@ -1549,8 +1549,8 @@ bool Units::isGay(df::unit* unit) if (!unit->status.current_soul) return false; df::orientation_flags orientation = unit->status.current_soul->orientation_flags; - return (Units::isFemale(unit) && ! (orientation.whole & (orientation.mask_marry_male | orientation.mask_romance_male))) - || (!Units::isFemale(unit) && ! (orientation.whole & (orientation.mask_marry_female | orientation.mask_romance_female))); + return (!Units::isFemale(unit) || !(orientation.whole & (orientation.mask_marry_male | orientation.mask_romance_male))) + && (!Units::isMale(unit) || !(orientation.whole & (orientation.mask_marry_female | orientation.mask_romance_female))); } bool Units::isNaked(df::unit* unit) From 47fa9e1159c983f6b3b04e329fcfae8a176b4fad Mon Sep 17 00:00:00 2001 From: lethosor Date: Mon, 13 Jan 2020 23:35:31 -0500 Subject: [PATCH 10/12] Update authors, submodules --- docs/Authors.rst | 2 ++ library/xml | 2 +- scripts | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/Authors.rst b/docs/Authors.rst index dd0f691f3..fa315677a 100644 --- a/docs/Authors.rst +++ b/docs/Authors.rst @@ -56,7 +56,9 @@ IndigoFenix James Logsdon jlogsdon Japa JapaMala Jared Adams +Jeremy Apthorp nornagon Jim Lisi stonetoad +Jimbo Whales jimbowhales jimcarreer jimcarreer jj jjyg jj`` Joel Meador janxious diff --git a/library/xml b/library/xml index abdcb2e17..779de2311 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit abdcb2e17ff29e754a8a7661b697035a0ee702ba +Subproject commit 779de23111409635b5644daae5338ba0199945e4 diff --git a/scripts b/scripts index abcb0cffb..5d0f00eae 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit abcb0cffbbcaaeefc7effca25ff947ab8ea91c43 +Subproject commit 5d0f00eae3bd8eef41c860369550e05f95a1282a From 96d8dffd325dd002a2adb93951df61d24bcab740 Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Tue, 14 Jan 2020 17:53:52 -0600 Subject: [PATCH 11/12] Make dfhack.run_command return the command_result value. Rename local variables to match dfhack.run_command_silent for clarity. --- library/lua/dfhack.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/library/lua/dfhack.lua b/library/lua/dfhack.lua index 93ab48dca..049297385 100644 --- a/library/lua/dfhack.lua +++ b/library/lua/dfhack.lua @@ -765,14 +765,15 @@ function dfhack.run_command_silent(...) end function dfhack.run_command(...) - local output, status = _run_command(...) - for i, fragment in pairs(output) do - if type(fragment) == 'table' then - dfhack.color(fragment[1]) - dfhack.print(fragment[2]) + local result = _run_command(...) + for i, f in pairs(result) do + if type(f) == 'table' then + dfhack.color(f[1]) + dfhack.print(f[2]) end end dfhack.color(COLOR_RESET) + return result.status end -- Per-save init file From 045d8bfd1e01cac8d964b6aad5166f451ec23f4e Mon Sep 17 00:00:00 2001 From: lethosor Date: Tue, 14 Jan 2020 23:54:51 -0500 Subject: [PATCH 12/12] Linux launcher: attempt to fall back to a working architecture for setarch Also include directions if this fails Closes #1466 --- package/linux/dfhack | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/package/linux/dfhack b/package/linux/dfhack index d0c70765b..1bd3e8d92 100755 --- a/package/linux/dfhack +++ b/package/linux/dfhack @@ -69,6 +69,16 @@ fi PRELOAD_LIB="${PRELOAD_LIB:+$PRELOAD_LIB:}${LIBSAN}${LIB}" setarch_arch=$(cat hack/dfhack_setarch.txt || printf i386) +if ! setarch "$setarch_arch" -R true 2>/dev/null; then + echo "warn: architecture '$setarch_arch' not supported by setarch" >&2 + if [ "$setarch_arch" = "i386" ]; then + setarch_arch=linux32 + else + setarch_arch=linux64 + fi + echo "using '$setarch_arch' instead. To silence this warning, edit" >&2 + echo "hack/dfhack_setarch.txt to contain an architecture that works on your system." >&2 +fi case "$1" in -g | --gdb)