dfhack/tools/unstuck.cpp

45 lines
805 B
C++

2010-04-11 05:20:15 -06:00
// Make stuck DF run again.
#include <iostream>
#include <climits>
#include <integers.h>
#include <vector>
#include <ctime>
#include <string>
using namespace std;
#include <DFTypes.h>
2010-05-23 15:06:10 -06:00
#include <DFContextManager.h>
#include <DFContext.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;
}