|
|
@ -179,10 +179,14 @@ bool Incremental ( vector <uint64_t> &found, const char * what, T& output,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
goto incremental_more;
|
|
|
|
goto incremental_more;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(select.empty())
|
|
|
|
else if(select == "q")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(select.empty())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
goto incremental_more;
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(numberz)
|
|
|
|
if(numberz)
|
|
|
@ -399,29 +403,91 @@ void FindData(DFHack::ContextManager & DFMgr, vector <DFHack::t_memrange>& range
|
|
|
|
DF->Detach();
|
|
|
|
DF->Detach();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
|
|
|
|
while(Incremental(found, "integer",test1))
|
|
|
|
bool TriggerIncremental ( vector <uint64_t> &found )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
string select;
|
|
|
|
|
|
|
|
if(found.empty())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "search ready - position the DF cursor and hit enter when ready" << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if( found.size() == 1 )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "Found single coord!" << endl;
|
|
|
|
|
|
|
|
cout << hex << "0x" << found[0] << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "Found " << dec << found.size() << " coords." << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
incremental_more:
|
|
|
|
|
|
|
|
cout << ">>";
|
|
|
|
|
|
|
|
std::getline(cin, select);
|
|
|
|
|
|
|
|
size_t num = 0;
|
|
|
|
|
|
|
|
if( sscanf(select.c_str(),"p %d", &num) && num > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "Found coords:" << endl;
|
|
|
|
|
|
|
|
for(int i = 0; i < min(found.size(), num);i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << hex << "0x" << found[i] << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
goto incremental_more;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(select == "p")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "Found coords:" << endl;
|
|
|
|
|
|
|
|
for(int i = 0; i < found.size();i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << hex << "0x" << found[i] << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
goto incremental_more;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(select == "q")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FindCoords(DFHack::ContextManager & DFMgr, vector <DFHack::t_memrange>& ranges)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
vector <uint64_t> found;
|
|
|
|
|
|
|
|
int size = 4;
|
|
|
|
|
|
|
|
do
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
getNumber("Select coord size (2,4 bytes)",size, 4);
|
|
|
|
|
|
|
|
} while (size != 2 && size != 4);
|
|
|
|
|
|
|
|
while (TriggerIncremental(found))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DFMgr.Refresh();
|
|
|
|
DFMgr.Refresh();
|
|
|
|
DFHack::Context * DF = DFMgr.getSingleContext();
|
|
|
|
DFHack::Context * DF = DFMgr.getSingleContext();
|
|
|
|
DF->Attach();
|
|
|
|
DF->Attach();
|
|
|
|
SegmentedFinder sf(ranges,DF);
|
|
|
|
DFHack::Position * pos = DF->getPosition();
|
|
|
|
switch(size)
|
|
|
|
pos->Start();
|
|
|
|
|
|
|
|
int32_t x, y, z;
|
|
|
|
|
|
|
|
pos->getCursorCoords(x,y,z);
|
|
|
|
|
|
|
|
cout << "Searching for: " << dec << x << ":" << y << ":" << z << endl;
|
|
|
|
|
|
|
|
Bytestream select;
|
|
|
|
|
|
|
|
if(size == 2)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
select.insert<uint16_t>(x);
|
|
|
|
sf.Incremental<uint8_t,uint8_t>(test1,alignment,found, equalityP<uint8_t>);
|
|
|
|
select.insert<uint16_t>(y);
|
|
|
|
break;
|
|
|
|
select.insert<uint16_t>(z);
|
|
|
|
case 2:
|
|
|
|
}
|
|
|
|
sf.Incremental<uint16_t,uint16_t>(test1,alignment,found, equalityP<uint16_t>);
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
{
|
|
|
|
case 4:
|
|
|
|
select.insert<uint32_t>(x);
|
|
|
|
sf.Incremental<uint32_t,uint32_t>(test1,alignment,found, equalityP<uint32_t>);
|
|
|
|
select.insert<uint32_t>(y);
|
|
|
|
break;
|
|
|
|
select.insert<uint32_t>(z);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cout << select << endl;
|
|
|
|
|
|
|
|
SegmentedFinder sf(ranges,DF);
|
|
|
|
|
|
|
|
sf.Incremental< Bytestream ,uint32_t>(select,1,found, findBytestream);
|
|
|
|
DF->Detach();
|
|
|
|
DF->Detach();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
void PtrTrace(DFHack::ContextManager & DFMgr, vector <DFHack::t_memrange>& ranges)
|
|
|
|
void PtrTrace(DFHack::ContextManager & DFMgr, vector <DFHack::t_memrange>& ranges)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int element_size;
|
|
|
|
int element_size;
|
|
|
@ -841,12 +907,12 @@ int main (void)
|
|
|
|
"Select search type: 1=number(default), 2=vector by length, 3=vector>object>string,\n"
|
|
|
|
"Select search type: 1=number(default), 2=vector by length, 3=vector>object>string,\n"
|
|
|
|
" 4=string, 5=automated offset search, 6=vector by address in its array,\n"
|
|
|
|
" 4=string, 5=automated offset search, 6=vector by address in its array,\n"
|
|
|
|
" 7=pointer vector by address of an object, 8=vector>first object>string\n"
|
|
|
|
" 7=pointer vector by address of an object, 8=vector>first object>string\n"
|
|
|
|
" 9=string buffers, 10=known data, 11=backpointers, 12=data+backpointers\n";
|
|
|
|
" 9=string buffers, 10=known data, 11=backpointers, 12=data+backpointers\n"
|
|
|
|
|
|
|
|
" 13=coord lookup\n";
|
|
|
|
int mode;
|
|
|
|
int mode;
|
|
|
|
do
|
|
|
|
do
|
|
|
|
{
|
|
|
|
{
|
|
|
|
getNumber(prompt,mode, 1, false);
|
|
|
|
getNumber(prompt,mode, 1, false);
|
|
|
|
} while (mode < 1 || mode > 12 );
|
|
|
|
|
|
|
|
switch (mode)
|
|
|
|
switch (mode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
case 1:
|
|
|
@ -896,9 +962,14 @@ int main (void)
|
|
|
|
DF->Detach();
|
|
|
|
DF->Detach();
|
|
|
|
DataPtrTrace(DFMgr, selected_ranges);
|
|
|
|
DataPtrTrace(DFMgr, selected_ranges);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 13:
|
|
|
|
|
|
|
|
DF->Detach();
|
|
|
|
|
|
|
|
FindCoords(DFMgr, selected_ranges);
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
cout << "not implemented :(" << endl;
|
|
|
|
cout << "not implemented :(" << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} while (mode < 1 || mode > 12 );
|
|
|
|
#ifndef LINUX_BUILD
|
|
|
|
#ifndef LINUX_BUILD
|
|
|
|
cout << "Done. Press any key to continue" << endl;
|
|
|
|
cout << "Done. Press any key to continue" << endl;
|
|
|
|
cin.ignore();
|
|
|
|
cin.ignore();
|
|
|
|