Fix probe utility, Position module

develop
Petr Mrázek 2010-08-28 22:07:31 +02:00
parent 97eb0b8de0
commit 85240c78b5
2 changed files with 44 additions and 37 deletions

@ -59,34 +59,36 @@ Position::Position(DFContextShared * d_)
d->owner = d_->p; d->owner = d_->p;
d->Inited = true; d->Inited = true;
d->StartedHotkeys = d->Started = d->StartedScreen = false; d->StartedHotkeys = d->Started = d->StartedScreen = false;
VersionInfo * mem; OffsetGroup * OG_Position;
VersionInfo * mem = d->d->offset_descriptor;
try try
{ {
mem = d->d->offset_descriptor; OG_Position = mem->getGroup("Position");
d->window_x_offset = mem->getAddress ("window_x"); d->window_x_offset = OG_Position->getAddress ("window_x");
d->window_y_offset = mem->getAddress ("window_y"); d->window_y_offset = OG_Position->getAddress ("window_y");
d->window_z_offset = mem->getAddress ("window_z"); d->window_z_offset = OG_Position->getAddress ("window_z");
d->cursor_xyz_offset = mem->getAddress ("cursor_xyz"); d->cursor_xyz_offset = OG_Position->getAddress ("cursor_xyz");
d->window_dims_offset = mem->getAddress ("window_dims"); d->window_dims_offset = OG_Position->getAddress ("window_dims");
d->Started = true; d->Started = true;
}
catch(exception &){};
try try
{ {
d->hotkey_start = mem->getAddress("hotkey_start"); OffsetGroup * OG_Hotkeys = mem->getGroup("Hotkeys");
d->hotkey_mode_offset = mem->getOffset ("hotkey_mode"); d->hotkey_start = OG_Hotkeys->getAddress("start");
d->hotkey_xyz_offset = mem->getOffset("hotkey_xyz"); d->hotkey_mode_offset = OG_Hotkeys->getOffset ("mode");
d->hotkey_size = mem->getHexValue("hotkey_size"); d->hotkey_xyz_offset = OG_Hotkeys->getOffset("coords");
d->hotkey_size = OG_Hotkeys->getHexValue("size");
d->StartedHotkeys = true; d->StartedHotkeys = true;
} }
catch(exception &){}; catch(exception &){};
try try
{ {
d->screen_tiles_ptr_offset = mem->getAddress ("screen_tiles_pointer"); d->screen_tiles_ptr_offset = OG_Position->getAddress ("screen_tiles_pointer");
d->StartedScreen = true; d->StartedScreen = true;
} }
catch(exception &){}; catch(exception &){};
} }
catch(exception &){};
}
Position::~Position() Position::~Position()
{ {

@ -35,13 +35,19 @@ int main (int numargs, const char ** args)
DFHack::VersionInfo* mem = DF->getMemoryInfo(); DFHack::VersionInfo* mem = DF->getMemoryInfo();
DFHack::Maps *Maps = DF->getMaps(); DFHack::Maps *Maps = DF->getMaps();
DFHack::Process * p = DF->getProcess(); DFHack::Process * p = DF->getProcess();
uint32_t designatus = mem->getOffset("map_data_designation"); OffsetGroup *mapsg = mem->getGroup("Maps");
uint32_t block_feature1 = mem->getOffset("map_data_feature_local"); OffsetGroup *mapblockg = mapsg->getGroup("block");
uint32_t block_feature2 = mem->getOffset("map_data_feature_global"); OffsetGroup *localfeatg = mapsg->getGroup("features")->getGroup("local");
uint32_t region_x_offset = mem->getAddress("region_x");
uint32_t region_y_offset = mem->getAddress("region_y"); uint32_t region_x_offset = mapsg->getAddress("region_x");
uint32_t region_z_offset = mem->getAddress("region_z"); uint32_t region_y_offset = mapsg->getAddress("region_y");
uint32_t feature1_start_ptr = mem->getAddress("local_feature_start_ptr"); uint32_t region_z_offset = mapsg->getAddress("region_z");
uint32_t designatus = mapblockg->getOffset("designation");
uint32_t block_feature1 = mapblockg->getOffset("feature_local");
uint32_t block_feature2 = mapblockg->getOffset("feature_global");
uint32_t feature1_start_ptr = localfeatg->getAddress("start_ptr");
int32_t regionX, regionY, regionZ; int32_t regionX, regionY, regionZ;
// read position of the region inside DF world // read position of the region inside DF world
@ -78,14 +84,13 @@ int main (int numargs, const char ** args)
if(tileTypeTable[tiletype].name) if(tileTypeTable[tiletype].name)
std::cout << " = " << tileTypeTable[tiletype].name; std::cout << " = " << tileTypeTable[tiletype].name;
std::cout << std::endl; std::cout << std::endl;
std::cout <<"temperature1: " << tmpb1[tileX][tileY] << " U" << std::endl; std::cout <<"temperature1: " << tmpb1[tileX][tileY] << " U" << std::endl;
std::cout <<"temperature2: " << tmpb2[tileX][tileY] << " U" << std::endl; std::cout <<"temperature2: " << tmpb2[tileX][tileY] << " U" << std::endl;
// biome, geolayer // biome, geolayer
std::cout << "biome: " << des.biome << std::endl; std::cout << "biome: " << des.biome << std::endl;
std::cout << "geolayer: " << des.geolayer_index << std::endl; std::cout << "geolayer: " << des.geolayer_index << std::endl;
// liquids // liquids
if(des.flow_size) if(des.flow_size)
{ {