|
|
|
@ -179,10 +179,14 @@ bool Incremental ( vector <uint64_t> &found, const char * what, T& output,
|
|
|
|
|
}
|
|
|
|
|
goto incremental_more;
|
|
|
|
|
}
|
|
|
|
|
else if(select.empty())
|
|
|
|
|
else if(select == "q")
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if(select.empty())
|
|
|
|
|
{
|
|
|
|
|
goto incremental_more;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if(numberz)
|
|
|
|
@ -399,29 +403,91 @@ void FindData(DFHack::ContextManager & DFMgr, vector <DFHack::t_memrange>& range
|
|
|
|
|
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();
|
|
|
|
|
DFHack::Context * DF = DFMgr.getSingleContext();
|
|
|
|
|
DF->Attach();
|
|
|
|
|
SegmentedFinder sf(ranges,DF);
|
|
|
|
|
switch(size)
|
|
|
|
|
DFHack::Position * pos = DF->getPosition();
|
|
|
|
|
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:
|
|
|
|
|
sf.Incremental<uint8_t,uint8_t>(test1,alignment,found, equalityP<uint8_t>);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
sf.Incremental<uint16_t,uint16_t>(test1,alignment,found, equalityP<uint16_t>);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
sf.Incremental<uint32_t,uint32_t>(test1,alignment,found, equalityP<uint32_t>);
|
|
|
|
|
break;
|
|
|
|
|
select.insert<uint16_t>(x);
|
|
|
|
|
select.insert<uint16_t>(y);
|
|
|
|
|
select.insert<uint16_t>(z);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
select.insert<uint32_t>(x);
|
|
|
|
|
select.insert<uint32_t>(y);
|
|
|
|
|
select.insert<uint32_t>(z);
|
|
|
|
|
}
|
|
|
|
|
cout << select << endl;
|
|
|
|
|
SegmentedFinder sf(ranges,DF);
|
|
|
|
|
sf.Incremental< Bytestream ,uint32_t>(select,1,found, findBytestream);
|
|
|
|
|
DF->Detach();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
void PtrTrace(DFHack::ContextManager & DFMgr, vector <DFHack::t_memrange>& ranges)
|
|
|
|
|
{
|
|
|
|
|
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"
|
|
|
|
|
" 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"
|
|
|
|
|
" 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;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
getNumber(prompt,mode, 1, false);
|
|
|
|
|
} while (mode < 1 || mode > 12 );
|
|
|
|
|
switch (mode)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
@ -896,9 +962,14 @@ int main (void)
|
|
|
|
|
DF->Detach();
|
|
|
|
|
DataPtrTrace(DFMgr, selected_ranges);
|
|
|
|
|
break;
|
|
|
|
|
case 13:
|
|
|
|
|
DF->Detach();
|
|
|
|
|
FindCoords(DFMgr, selected_ranges);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
cout << "not implemented :(" << endl;
|
|
|
|
|
}
|
|
|
|
|
} while (mode < 1 || mode > 12 );
|
|
|
|
|
#ifndef LINUX_BUILD
|
|
|
|
|
cout << "Done. Press any key to continue" << endl;
|
|
|
|
|
cin.ignore();
|
|
|
|
|