From 341c0dacf373c8f21b47d30522ee754aff4f69d8 Mon Sep 17 00:00:00 2001 From: Japa Date: Sat, 27 Jan 2018 12:44:51 +0530 Subject: [PATCH 1/2] updated function definition for win64. --- plugins/remotefortressreader/item_reader.cpp | 2 +- plugins/remotefortressreader/item_reader.h | 7 ++++++- .../remotefortressreader.cpp | 16 ++++++++++------ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/plugins/remotefortressreader/item_reader.cpp b/plugins/remotefortressreader/item_reader.cpp index c57b90d7d..2acda8aef 100644 --- a/plugins/remotefortressreader/item_reader.cpp +++ b/plugins/remotefortressreader/item_reader.cpp @@ -109,7 +109,7 @@ void CopyImage(df::art_image_ref imageRef, ArtImage * netImage) GET_IMAGE getImage = reinterpret_cast(Core::getInstance().vinfo->getAddress("rfr_get_art_image")); if (getImage) { - int subid = -1; + int16_t subid = -1; CopyImage(getImage(world, &imageRef, &subid), netImage); } else diff --git a/plugins/remotefortressreader/item_reader.h b/plugins/remotefortressreader/item_reader.h index 332280982..df25d5655 100644 --- a/plugins/remotefortressreader/item_reader.h +++ b/plugins/remotefortressreader/item_reader.h @@ -25,6 +25,11 @@ DFHack::command_result GetItemList(DFHack::color_ostream &stream, const DFHack:: void CopyItem(RemoteFortressReader::Item * NetItem, df::item * DfItem); void ConvertDFColorDescriptor(int16_t index, RemoteFortressReader::ColorDefinition * out); -typedef df::art_image * (__thiscall *GET_IMAGE)(df::world*, df::art_image_ref *, int *); +#if(defined(WIN32) && !defined(_WIN64)) +typedef df::art_image * (__thiscall *GET_IMAGE)(df::world*, df::art_image_ref *, int16_t *); +#else +typedef df::art_image *(__fastcall *GET_IMAGE)(df::world *, df::art_image_ref *, int16_t *); +#endif + #endif // !ITEM_READER_H diff --git a/plugins/remotefortressreader/remotefortressreader.cpp b/plugins/remotefortressreader/remotefortressreader.cpp index 928b7a396..22b836bb7 100644 --- a/plugins/remotefortressreader/remotefortressreader.cpp +++ b/plugins/remotefortressreader/remotefortressreader.cpp @@ -192,11 +192,11 @@ command_result generate_image(color_ostream &out, vector & parameters) imageRef.site_id = -1; imageRef.subid = -1; - GET_IMAGE getImage = reinterpret_cast(Core::getInstance().vinfo->getAddress("rfr_get_art_image")); - if (getImage) - { - int subid = -1; - auto image = getImage(world,&imageRef, &subid); + GET_IMAGE getImage = reinterpret_cast(Core::getInstance().vinfo->getAddress("rfr_get_art_image")); + if (getImage) + { + int16_t subid = -1; + auto image = getImage(world, &imageRef, &subid); out.print("Id: %d, subid: %d\n", image->id, image->subid); } return CR_OK; @@ -272,7 +272,11 @@ DFhackCExport command_result plugin_init(color_ostream &out, std::vector Date: Sat, 27 Jan 2018 19:26:30 +0530 Subject: [PATCH 2/2] fix compiling on gcc. --- plugins/remotefortressreader/item_reader.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/remotefortressreader/item_reader.h b/plugins/remotefortressreader/item_reader.h index df25d5655..59e097ca0 100644 --- a/plugins/remotefortressreader/item_reader.h +++ b/plugins/remotefortressreader/item_reader.h @@ -26,9 +26,9 @@ void CopyItem(RemoteFortressReader::Item * NetItem, df::item * DfItem); void ConvertDFColorDescriptor(int16_t index, RemoteFortressReader::ColorDefinition * out); #if(defined(WIN32) && !defined(_WIN64)) -typedef df::art_image * (__thiscall *GET_IMAGE)(df::world*, df::art_image_ref *, int16_t *); +typedef df::art_image * (__thiscall *GET_IMAGE)(df::world *, df::art_image_ref *, int16_t *); #else -typedef df::art_image *(__fastcall *GET_IMAGE)(df::world *, df::art_image_ref *, int16_t *); +typedef df::art_image * (*GET_IMAGE)(df::world *, df::art_image_ref *, int16_t *); #endif