dfhack/tools/supported/unstuck.cpp

41 lines
728 B
C++

2010-04-11 05:20:15 -06:00
// Make stuck DF run again.
#include <iostream>
#include <climits>
#include <vector>
#include <ctime>
#include <string>
using namespace std;
2010-05-25 22:48:23 -06:00
#include <DFHack.h>
2010-04-11 05:20:15 -06:00
int main (void)
{
string blah;
2010-05-23 15:06:10 -06:00
DFHack::ContextManager DFMgr("Memory.xml");
DFHack::Context *DF;
2010-04-11 05:20:15 -06:00
try
{
2010-05-23 15:06:10 -06:00
DF = DFMgr.getSingleContext();
DF->Attach();
2010-04-11 05:20:15 -06:00
}
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
cin.ignore();
#endif
return 1;
}
2010-05-23 15:06:10 -06:00
DF->ForceResume();
2010-04-11 05:20:15 -06:00
cout << "DF should be running again :)" << endl;
getline(cin, blah);
2010-05-23 15:06:10 -06:00
if(!DF->Detach())
2010-04-11 05:20:15 -06:00
{
cerr << "Can't detach from DF" << endl;
return 1;
}
return 0;
}