updated function definition for win64.

develop
Japa 2018-01-27 12:44:51 +05:30
parent c0c80b626d
commit 341c0dacf3
3 changed files with 17 additions and 8 deletions

@ -109,7 +109,7 @@ void CopyImage(df::art_image_ref imageRef, ArtImage * netImage)
GET_IMAGE getImage = reinterpret_cast<GET_IMAGE>(Core::getInstance().vinfo->getAddress("rfr_get_art_image")); GET_IMAGE getImage = reinterpret_cast<GET_IMAGE>(Core::getInstance().vinfo->getAddress("rfr_get_art_image"));
if (getImage) if (getImage)
{ {
int subid = -1; int16_t subid = -1;
CopyImage(getImage(world, &imageRef, &subid), netImage); CopyImage(getImage(world, &imageRef, &subid), netImage);
} }
else else

@ -25,6 +25,11 @@ DFHack::command_result GetItemList(DFHack::color_ostream &stream, const DFHack::
void CopyItem(RemoteFortressReader::Item * NetItem, df::item * DfItem); void CopyItem(RemoteFortressReader::Item * NetItem, df::item * DfItem);
void ConvertDFColorDescriptor(int16_t index, RemoteFortressReader::ColorDefinition * out); 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 #endif // !ITEM_READER_H

@ -195,7 +195,7 @@ command_result generate_image(color_ostream &out, vector <string> & parameters)
GET_IMAGE getImage = reinterpret_cast<GET_IMAGE>(Core::getInstance().vinfo->getAddress("rfr_get_art_image")); GET_IMAGE getImage = reinterpret_cast<GET_IMAGE>(Core::getInstance().vinfo->getAddress("rfr_get_art_image"));
if (getImage) if (getImage)
{ {
int subid = -1; int16_t subid = -1;
auto image = getImage(world, &imageRef, &subid); auto image = getImage(world, &imageRef, &subid);
out.print("Id: %d, subid: %d\n", image->id, image->subid); out.print("Id: %d, subid: %d\n", image->id, image->subid);
} }
@ -272,7 +272,11 @@ DFhackCExport command_result plugin_init(color_ostream &out, std::vector <Plugin
" Does nothing.\n" " Does nothing.\n"
)); ));
commands.push_back(PluginCommand("RemoteFortressReader_version", "List the loaded RemoteFortressReader version", RemoteFortressReader_version, false, "This is used for plugin version checking.")); commands.push_back(PluginCommand("RemoteFortressReader_version", "List the loaded RemoteFortressReader version", RemoteFortressReader_version, false, "This is used for plugin version checking."));
commands.push_back(PluginCommand("generate_image", "make a random image struct.", generate_image, false, "...")); commands.push_back(PluginCommand(
"generate_image",
"make a blank art image using inbuilt DF functions.",
generate_image, false,
"used to test the function pointer being correct. If everything works, the subid should increment each time."));
enableUpdates = true; enableUpdates = true;
return CR_OK; return CR_OK;
} }