diff --git a/data/Memory-ng.xml b/data/Memory-ng.xml index e0528d4b0..9941440b4 100644 --- a/data/Memory-ng.xml +++ b/data/Memory-ng.xml @@ -1874,6 +1874,10 @@ + + +
+
diff --git a/library/include/DFHack.h b/library/include/DFHack.h index 57e11ad50..95f39729a 100644 --- a/library/include/DFHack.h +++ b/library/include/DFHack.h @@ -32,6 +32,7 @@ #include "dfhack/modules/Items.h" #include "dfhack/modules/Vegetation.h" #include "dfhack/modules/Maps.h" +#include "dfhack/modules/Gui.h" /* * This is a header full of ugly, volatile things. diff --git a/library/include/dfhack/modules/Gui.h b/library/include/dfhack/modules/Gui.h index 0ef170d3f..6ac91f35c 100644 --- a/library/include/dfhack/modules/Gui.h +++ b/library/include/dfhack/modules/Gui.h @@ -21,7 +21,9 @@ namespace DFHack bool Finish(); ///true if paused, false if not - bool ReadPauseState(); + bool ReadPauseState(); + ///true if paused, false if not + void SetPauseState(bool paused); /// read the DF menu view state (stock screen, unit screen, other screens bool ReadViewScreen(t_viewscreen &); /// read the DF menu state (designation menu ect) diff --git a/library/modules/Gui.cpp b/library/modules/Gui.cpp index 37d027495..177a00467 100644 --- a/library/modules/Gui.cpp +++ b/library/modules/Gui.cpp @@ -93,13 +93,19 @@ bool Gui::Finish() bool Gui::ReadPauseState() { - // replace with an exception if(!d->PauseInited) return false; uint32_t pauseState = d->owner->readDWord (d->pause_state_offset); return pauseState & 1; } +void Gui::SetPauseState(bool paused) +{ + if(!d->PauseInited) return; + cout << "pause set" << endl; + d->owner->writeDWord (d->pause_state_offset, paused); +} + uint32_t Gui::ReadMenuState() { if(d->MenuStateInited) diff --git a/library/modules/Maps.cpp b/library/modules/Maps.cpp index eab61faf9..124e9bea9 100644 --- a/library/modules/Maps.cpp +++ b/library/modules/Maps.cpp @@ -70,6 +70,7 @@ Maps::Maps(DFContextShared* _d) d->d = _d; Process *p = d->owner = _d->p; d->Inited = d->Started = false; + d->block = NULL; DFHack::VersionInfo * mem = p->getDescriptor(); Server::Maps::maps_offsets &off = d->offsets; diff --git a/tools/supported/reveal.cpp b/tools/supported/reveal.cpp index 66ec3d92f..4233be189 100644 --- a/tools/supported/reveal.cpp +++ b/tools/supported/reveal.cpp @@ -6,6 +6,7 @@ using namespace std; #include +#include struct hideblock { @@ -37,6 +38,16 @@ int main (void) } DFHack::Maps *Maps =DF->getMaps(); + DFHack::Gui *Gui =DF->getGui(); + // walk the map, save the hide bits, reveal. + cout << "Pausing..." << endl; + + // horrible hack to make sure the pause is really set + Gui->SetPauseState(true); + DF->Resume(); + usleep(100); + DF->Suspend(); + // init the map if(!Maps->Start()) { @@ -46,11 +57,12 @@ int main (void) #endif return 1; } - + + cout << "Revealing, please wait..." << endl; + Maps->getSize(x_max,y_max,z_max); vector hidesaved; - // walk the map, save the hide bits, reveal. - cout << "Revealing... please wait." << endl; + for(uint32_t x = 0; x< x_max;x++) { for(uint32_t y = 0; y< y_max;y++) @@ -80,8 +92,10 @@ int main (void) } // FIXME: force game pause here! DF->Detach(); - cout << "Map revealed. Close window/force exit to keep it that way." << endl; - cout << "Press any key to unreveal. Don't close DF or unpause in that case!" << endl; + cout << "Map revealed. The game has been paused for you." << endl; + cout << "Unpausing can unleash the forces of hell!" << endl << endl; + cout << "Press any key to unreveal." << endl; + cout << "Close to keep the map revealed." << endl; cin.ignore(); cout << "Unrevealing... please wait." << endl; // FIXME: do some consistency checks here!