dfhack/tools/unstuck.cpp

45 lines
805 B
C++

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