|
|
@ -20,6 +20,115 @@ using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
#include <DFHack.h>
|
|
|
|
#include <DFHack.h>
|
|
|
|
#include "SegmentedFinder.h"
|
|
|
|
#include "SegmentedFinder.h"
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
|
|
|
|
class holder
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
vector <T> values;
|
|
|
|
|
|
|
|
SegmentedFinder & sf;
|
|
|
|
|
|
|
|
holder(SegmentedFinder& sff):sf(sff){};
|
|
|
|
|
|
|
|
bool isValid(size_t idx)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class address
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
uint64_t addr_;
|
|
|
|
|
|
|
|
unsigned int valid : 1;
|
|
|
|
|
|
|
|
virtual void print(SegmentedFinder& sff)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << hex << "0x" << addr_ << endl;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
address(const uint64_t addr)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
addr_ = addr;
|
|
|
|
|
|
|
|
valid = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual address & operator=(const uint64_t in)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
addr_ = in;
|
|
|
|
|
|
|
|
valid = false;
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool isValid(SegmentedFinder& sff)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(valid) return true;
|
|
|
|
|
|
|
|
if(sff.getSegmentForAddress(addr_))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
valid = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool equals (SegmentedFinder & sf, address & rhs)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return rhs.addr_ == addr_;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// pointer to a null-terminated byte string
|
|
|
|
|
|
|
|
class Cstr: public address
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
void print(SegmentedFinder & sf)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << hex << "0x" << addr_ << ": \"" << sf.Translate<char>(addr_) << "\"" << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool equals(SegmentedFinder & sf,const char * rhs)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
uint32_t addr2 = *(sf.Translate<uint32_t>(addr_));
|
|
|
|
|
|
|
|
return strcmp(sf.Translate<const char>(addr2), rhs) == 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Predicate, class inType>
|
|
|
|
|
|
|
|
bool equalsP(SegmentedFinder & sf,inType rhs)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return Predicate(addr_, sf, rhs);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isValid(SegmentedFinder& sf)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (address::isValid(sf))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// read the pointer
|
|
|
|
|
|
|
|
uint32_t addr2 = *(sf.Translate<uint32_t>(addr_));
|
|
|
|
|
|
|
|
// is it a real pointer? a pretty weak test, but whatever.
|
|
|
|
|
|
|
|
if(sf.getSegmentForAddress(addr2))
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// STL STRING
|
|
|
|
|
|
|
|
#ifdef LINUX_BUILD
|
|
|
|
|
|
|
|
class STLstr: public address
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef LINUX_BUILD
|
|
|
|
|
|
|
|
class STLstr: public address
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// STL VECTOR
|
|
|
|
|
|
|
|
#ifdef LINUX_BUILD
|
|
|
|
|
|
|
|
class Vector: public address
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef LINUX_BUILD
|
|
|
|
|
|
|
|
class Vector: public address
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class Int64: public address{};
|
|
|
|
|
|
|
|
class Int32: public address{};
|
|
|
|
|
|
|
|
class Int16: public address{};
|
|
|
|
|
|
|
|
class Int8: public address{};
|
|
|
|
|
|
|
|
|
|
|
|
inline void printRange(DFHack::t_memrange * tpr)
|
|
|
|
inline void printRange(DFHack::t_memrange * tpr)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -79,8 +188,8 @@ bool getRanges(DFHack::Process * p, vector <DFHack::t_memrange>& selected_ranges
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(p->getDescriptor()->getOS() == DFHack::memory_info::OS_LINUX)
|
|
|
|
else if(p->getDescriptor()->getOS() == DFHack::memory_info::OS_LINUX)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
start = min(11, (int)ranges.size());
|
|
|
|
start = min(2, (int)ranges.size());
|
|
|
|
end = min(14, (int)ranges.size());
|
|
|
|
end = min(4, (int)ranges.size());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -258,13 +367,13 @@ void FindIntegers(DFHack::ContextManager & DFMgr, vector <DFHack::t_memrange>& r
|
|
|
|
switch(size)
|
|
|
|
switch(size)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
case 1:
|
|
|
|
sf.Find<uint8_t,uint8_t>(test1,alignment,found, equalityP<uint8_t>);
|
|
|
|
sf.Incremental<uint8_t,uint8_t>(test1,alignment,found, equalityP<uint8_t>);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
case 2:
|
|
|
|
sf.Find<uint16_t,uint16_t>(test1,alignment,found, equalityP<uint16_t>);
|
|
|
|
sf.Incremental<uint16_t,uint16_t>(test1,alignment,found, equalityP<uint16_t>);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
case 4:
|
|
|
|
sf.Find<uint32_t,uint32_t>(test1,alignment,found, equalityP<uint32_t>);
|
|
|
|
sf.Incremental<uint32_t,uint32_t>(test1,alignment,found, equalityP<uint32_t>);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DF->Detach();
|
|
|
|
DF->Detach();
|
|
|
@ -288,8 +397,8 @@ void FindVectorByLength(DFHack::ContextManager & DFMgr, vector <DFHack::t_memran
|
|
|
|
DFHack::Context * DF = DFMgr.getSingleContext();
|
|
|
|
DFHack::Context * DF = DFMgr.getSingleContext();
|
|
|
|
DF->Attach();
|
|
|
|
DF->Attach();
|
|
|
|
SegmentedFinder sf(ranges,DF);
|
|
|
|
SegmentedFinder sf(ranges,DF);
|
|
|
|
sf.Find<int ,vecTriplet>(0,4,found,vectorAll);
|
|
|
|
sf.Incremental<int ,vecTriplet>(0,4,found,vectorAll);
|
|
|
|
sf.Find<uint32_t,vecTriplet>(length * element_size,4,found,vectorLength<uint32_t>);
|
|
|
|
sf.Filter<uint32_t,vecTriplet>(length * element_size,found,vectorLength<uint32_t>);
|
|
|
|
DF->Detach();
|
|
|
|
DF->Detach();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -300,14 +409,12 @@ void FindVectorByObjectRawname(DFHack::ContextManager & DFMgr, vector <DFHack::t
|
|
|
|
string select;
|
|
|
|
string select;
|
|
|
|
while (Incremental(found, "raw name",select,"vector","vectors"))
|
|
|
|
while (Incremental(found, "raw name",select,"vector","vectors"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// clear the list of found addresses -- this is a one-shot
|
|
|
|
|
|
|
|
found.clear();
|
|
|
|
|
|
|
|
DFMgr.Refresh();
|
|
|
|
DFMgr.Refresh();
|
|
|
|
DFHack::Context * DF = DFMgr.getSingleContext();
|
|
|
|
DFHack::Context * DF = DFMgr.getSingleContext();
|
|
|
|
DF->Attach();
|
|
|
|
DF->Attach();
|
|
|
|
SegmentedFinder sf(ranges,DF);
|
|
|
|
SegmentedFinder sf(ranges,DF);
|
|
|
|
sf.Find<int ,vecTriplet>(0,4,found, vectorAll);
|
|
|
|
sf.Find<int ,vecTriplet>(0,4,found, vectorAll);
|
|
|
|
sf.Find<const char * ,vecTriplet>(select.c_str(),4,found, vectorString);
|
|
|
|
sf.Filter<const char * ,vecTriplet>(select.c_str(),found, vectorString);
|
|
|
|
DF->Detach();
|
|
|
|
DF->Detach();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -318,14 +425,12 @@ void FindVectorByFirstObjectRawname(DFHack::ContextManager & DFMgr, vector <DFHa
|
|
|
|
string select;
|
|
|
|
string select;
|
|
|
|
while (Incremental(found, "raw name",select,"vector","vectors"))
|
|
|
|
while (Incremental(found, "raw name",select,"vector","vectors"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// clear the list of found addresses -- this is a one-shot
|
|
|
|
|
|
|
|
found.clear();
|
|
|
|
|
|
|
|
DFMgr.Refresh();
|
|
|
|
DFMgr.Refresh();
|
|
|
|
DFHack::Context * DF = DFMgr.getSingleContext();
|
|
|
|
DFHack::Context * DF = DFMgr.getSingleContext();
|
|
|
|
DF->Attach();
|
|
|
|
DF->Attach();
|
|
|
|
SegmentedFinder sf(ranges,DF);
|
|
|
|
SegmentedFinder sf(ranges,DF);
|
|
|
|
sf.Find<int ,vecTriplet>(0,4,found, vectorAll);
|
|
|
|
sf.Find<int ,vecTriplet>(0,4,found, vectorAll);
|
|
|
|
sf.Find<const char * ,vecTriplet>(select.c_str(),4,found, vectorStringFirst);
|
|
|
|
sf.Filter<const char * ,vecTriplet>(select.c_str(),found, vectorStringFirst);
|
|
|
|
DF->Detach();
|
|
|
|
DF->Detach();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -348,14 +453,12 @@ void FindVectorByBounds(DFHack::ContextManager & DFMgr, vector <DFHack::t_memran
|
|
|
|
uint32_t select;
|
|
|
|
uint32_t select;
|
|
|
|
while (Incremental(found, "address between vector.start and vector.end",select,"vector","vectors"))
|
|
|
|
while (Incremental(found, "address between vector.start and vector.end",select,"vector","vectors"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// clear the list of found addresses -- this is a one-shot
|
|
|
|
|
|
|
|
found.clear();
|
|
|
|
|
|
|
|
DFMgr.Refresh();
|
|
|
|
DFMgr.Refresh();
|
|
|
|
DFHack::Context * DF = DFMgr.getSingleContext();
|
|
|
|
DFHack::Context * DF = DFMgr.getSingleContext();
|
|
|
|
DF->Attach();
|
|
|
|
DF->Attach();
|
|
|
|
SegmentedFinder sf(ranges,DF);
|
|
|
|
SegmentedFinder sf(ranges,DF);
|
|
|
|
sf.Find<int ,vecTriplet>(0,4,found, vectorAll);
|
|
|
|
sf.Find<int ,vecTriplet>(0,4,found, vectorAll);
|
|
|
|
sf.Find<uint32_t ,vecTriplet>(select,4,found, vectorAddrWithin);
|
|
|
|
sf.Filter<uint32_t ,vecTriplet>(select,found, vectorAddrWithin);
|
|
|
|
// sort by size of vector
|
|
|
|
// sort by size of vector
|
|
|
|
std::sort(found.begin(), found.end(), VectorSizeFunctor(sf));
|
|
|
|
std::sort(found.begin(), found.end(), VectorSizeFunctor(sf));
|
|
|
|
DF->Detach();
|
|
|
|
DF->Detach();
|
|
|
@ -368,14 +471,12 @@ void FindPtrVectorsByObjectAddress(DFHack::ContextManager & DFMgr, vector <DFHac
|
|
|
|
uint32_t select;
|
|
|
|
uint32_t select;
|
|
|
|
while (Incremental(found, "object address",select,"vector","vectors"))
|
|
|
|
while (Incremental(found, "object address",select,"vector","vectors"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// clear the list of found addresses -- this is a one-shot
|
|
|
|
|
|
|
|
found.clear();
|
|
|
|
|
|
|
|
DFMgr.Refresh();
|
|
|
|
DFMgr.Refresh();
|
|
|
|
DFHack::Context * DF = DFMgr.getSingleContext();
|
|
|
|
DFHack::Context * DF = DFMgr.getSingleContext();
|
|
|
|
DF->Attach();
|
|
|
|
DF->Attach();
|
|
|
|
SegmentedFinder sf(ranges,DF);
|
|
|
|
SegmentedFinder sf(ranges,DF);
|
|
|
|
sf.Find<int ,vecTriplet>(0,4,found, vectorAll);
|
|
|
|
sf.Find<int ,vecTriplet>(0,4,found, vectorAll);
|
|
|
|
sf.Find<uint32_t ,vecTriplet>(select,4,found, vectorOfPtrWithin);
|
|
|
|
sf.Filter<uint32_t ,vecTriplet>(select,found, vectorOfPtrWithin);
|
|
|
|
DF->Detach();
|
|
|
|
DF->Detach();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -391,7 +492,7 @@ void FindStrings(DFHack::ContextManager & DFMgr, vector <DFHack::t_memrange>& ra
|
|
|
|
DFHack::Context * DF = DFMgr.getSingleContext();
|
|
|
|
DFHack::Context * DF = DFMgr.getSingleContext();
|
|
|
|
DF->Attach();
|
|
|
|
DF->Attach();
|
|
|
|
SegmentedFinder sf(ranges,DF);
|
|
|
|
SegmentedFinder sf(ranges,DF);
|
|
|
|
sf.Find< const char * ,uint32_t>(select.c_str(),1,found, findString);
|
|
|
|
sf.Incremental< const char * ,uint32_t>(select.c_str(),1,found, findString);
|
|
|
|
DF->Detach();
|
|
|
|
DF->Detach();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -452,6 +553,15 @@ void printFoundStrVec(vector <uint64_t> &found, const char * what, SegmentedFind
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// meh
|
|
|
|
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
struct tilecolors
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
uint16_t fore;
|
|
|
|
|
|
|
|
uint16_t back;
|
|
|
|
|
|
|
|
uint16_t bright;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#pragma pack()
|
|
|
|
|
|
|
|
|
|
|
|
void automatedLangtables(DFHack::Context * DF, vector <DFHack::t_memrange>& ranges)
|
|
|
|
void automatedLangtables(DFHack::Context * DF, vector <DFHack::t_memrange>& ranges)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -490,17 +600,17 @@ void automatedLangtables(DFHack::Context * DF, vector <DFHack::t_memrange>& rang
|
|
|
|
|
|
|
|
|
|
|
|
// find lang vector (neutral word table)
|
|
|
|
// find lang vector (neutral word table)
|
|
|
|
to_filter = filtVectors;
|
|
|
|
to_filter = filtVectors;
|
|
|
|
sf.Find<const char * ,vecTriplet>("ABBEY",4,to_filter, vectorStringFirst);
|
|
|
|
sf.Filter<const char * ,vecTriplet>("ABBEY",to_filter, vectorStringFirst);
|
|
|
|
uint64_t lang_addr = to_filter[0];
|
|
|
|
uint64_t lang_addr = to_filter[0];
|
|
|
|
|
|
|
|
|
|
|
|
// find dwarven language word table
|
|
|
|
// find dwarven language word table
|
|
|
|
to_filter = filtVectors;
|
|
|
|
to_filter = filtVectors;
|
|
|
|
sf.Find<const char * ,vecTriplet>("kulet",4,to_filter, vectorStringFirst);
|
|
|
|
sf.Filter<const char * ,vecTriplet>("kulet",to_filter, vectorStringFirst);
|
|
|
|
kulet_vector = to_filter[0];
|
|
|
|
kulet_vector = to_filter[0];
|
|
|
|
|
|
|
|
|
|
|
|
// find vector of languages
|
|
|
|
// find vector of languages
|
|
|
|
to_filter = filtVectors;
|
|
|
|
to_filter = filtVectors;
|
|
|
|
sf.Find<const char * ,vecTriplet>("DWARF",4,to_filter, vectorStringFirst);
|
|
|
|
sf.Filter<const char * ,vecTriplet>("DWARF",to_filter, vectorStringFirst);
|
|
|
|
|
|
|
|
|
|
|
|
// verify
|
|
|
|
// verify
|
|
|
|
for(int i = 0; i < to_filter.size(); i++)
|
|
|
|
for(int i = 0; i < to_filter.size(); i++)
|
|
|
@ -525,35 +635,35 @@ void automatedLangtables(DFHack::Context * DF, vector <DFHack::t_memrange>& rang
|
|
|
|
// inorganics vector
|
|
|
|
// inorganics vector
|
|
|
|
to_filter = filtVectors;
|
|
|
|
to_filter = filtVectors;
|
|
|
|
//sf.Find<uint32_t,vecTriplet>(257 * 4,4,to_filter,vectorLength<uint32_t>);
|
|
|
|
//sf.Find<uint32_t,vecTriplet>(257 * 4,4,to_filter,vectorLength<uint32_t>);
|
|
|
|
sf.Find<const char * ,vecTriplet>("IRON",4,to_filter, vectorString);
|
|
|
|
sf.Filter<const char * ,vecTriplet>("IRON",to_filter, vectorString);
|
|
|
|
sf.Find<const char * ,vecTriplet>("ONYX",4,to_filter, vectorString);
|
|
|
|
sf.Filter<const char * ,vecTriplet>("ONYX",to_filter, vectorString);
|
|
|
|
sf.Find<const char * ,vecTriplet>("RAW_ADAMANTINE",4,to_filter, vectorString);
|
|
|
|
sf.Filter<const char * ,vecTriplet>("RAW_ADAMANTINE",to_filter, vectorString);
|
|
|
|
sf.Find<const char * ,vecTriplet>("BLOODSTONE",4,to_filter, vectorString);
|
|
|
|
sf.Filter<const char * ,vecTriplet>("BLOODSTONE",to_filter, vectorString);
|
|
|
|
printFound(to_filter,"inorganics");
|
|
|
|
printFound(to_filter,"inorganics");
|
|
|
|
|
|
|
|
|
|
|
|
// organics vector
|
|
|
|
// organics vector
|
|
|
|
to_filter = filtVectors;
|
|
|
|
to_filter = filtVectors;
|
|
|
|
sf.Find<uint32_t,vecTriplet>(52 * 4,4,to_filter,vectorLength<uint32_t>);
|
|
|
|
sf.Filter<uint32_t,vecTriplet>(52 * 4,to_filter,vectorLength<uint32_t>);
|
|
|
|
sf.Find<const char * ,vecTriplet>("MUSHROOM_HELMET_PLUMP",4,to_filter, vectorStringFirst);
|
|
|
|
sf.Filter<const char * ,vecTriplet>("MUSHROOM_HELMET_PLUMP",to_filter, vectorStringFirst);
|
|
|
|
printFound(to_filter,"organics");
|
|
|
|
printFound(to_filter,"organics");
|
|
|
|
|
|
|
|
|
|
|
|
// tree vector
|
|
|
|
// tree vector
|
|
|
|
to_filter = filtVectors;
|
|
|
|
to_filter = filtVectors;
|
|
|
|
sf.Find<uint32_t,vecTriplet>(31 * 4,4,to_filter,vectorLength<uint32_t>);
|
|
|
|
sf.Filter<uint32_t,vecTriplet>(31 * 4,to_filter,vectorLength<uint32_t>);
|
|
|
|
sf.Find<const char * ,vecTriplet>("MANGROVE",4,to_filter, vectorStringFirst);
|
|
|
|
sf.Filter<const char * ,vecTriplet>("MANGROVE",to_filter, vectorStringFirst);
|
|
|
|
printFound(to_filter,"trees");
|
|
|
|
printFound(to_filter,"trees");
|
|
|
|
|
|
|
|
|
|
|
|
// plant vector
|
|
|
|
// plant vector
|
|
|
|
to_filter = filtVectors;
|
|
|
|
to_filter = filtVectors;
|
|
|
|
sf.Find<uint32_t,vecTriplet>(21 * 4,4,to_filter,vectorLength<uint32_t>);
|
|
|
|
sf.Filter<uint32_t,vecTriplet>(21 * 4,to_filter,vectorLength<uint32_t>);
|
|
|
|
sf.Find<const char * ,vecTriplet>("MUSHROOM_HELMET_PLUMP",4,to_filter, vectorStringFirst);
|
|
|
|
sf.Filter<const char * ,vecTriplet>("MUSHROOM_HELMET_PLUMP",to_filter, vectorStringFirst);
|
|
|
|
printFound(to_filter,"plants");
|
|
|
|
printFound(to_filter,"plants");
|
|
|
|
|
|
|
|
|
|
|
|
// color descriptors
|
|
|
|
// color descriptors
|
|
|
|
//AMBER, 112
|
|
|
|
//AMBER, 112
|
|
|
|
to_filter = filtVectors;
|
|
|
|
to_filter = filtVectors;
|
|
|
|
sf.Find<uint32_t,vecTriplet>(112 * 4,4,to_filter,vectorLength<uint32_t>);
|
|
|
|
sf.Filter<uint32_t,vecTriplet>(112 * 4,to_filter,vectorLength<uint32_t>);
|
|
|
|
sf.Find<const char * ,vecTriplet>("AMBER",4,to_filter, vectorStringFirst);
|
|
|
|
sf.Filter<const char * ,vecTriplet>("AMBER",to_filter, vectorStringFirst);
|
|
|
|
printFound(to_filter,"color descriptors");
|
|
|
|
printFound(to_filter,"color descriptors");
|
|
|
|
if(!to_filter.empty())
|
|
|
|
if(!to_filter.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -567,28 +677,98 @@ void automatedLangtables(DFHack::Context * DF, vector <DFHack::t_memrange>& rang
|
|
|
|
// all descriptors
|
|
|
|
// all descriptors
|
|
|
|
//AMBER, 338
|
|
|
|
//AMBER, 338
|
|
|
|
to_filter = filtVectors;
|
|
|
|
to_filter = filtVectors;
|
|
|
|
sf.Find<uint32_t,vecTriplet>(338 * 4,4,to_filter,vectorLength<uint32_t>);
|
|
|
|
sf.Filter<uint32_t,vecTriplet>(338 * 4,to_filter,vectorLength<uint32_t>);
|
|
|
|
sf.Find<const char * ,vecTriplet>("AMBER",4,to_filter, vectorStringFirst);
|
|
|
|
sf.Filter<const char * ,vecTriplet>("AMBER",to_filter, vectorStringFirst);
|
|
|
|
printFound(to_filter,"all descriptors");
|
|
|
|
printFound(to_filter,"all descriptors");
|
|
|
|
|
|
|
|
|
|
|
|
// creature type
|
|
|
|
// creature type
|
|
|
|
//ELEPHANT, ?? (demons abound)
|
|
|
|
//ELEPHANT, ?? (demons abound)
|
|
|
|
to_filter = filtVectors;
|
|
|
|
to_filter = filtVectors;
|
|
|
|
//sf.Find<uint32_t,vecTriplet>(338 * 4,4,to_filter,vectorLength<uint32_t>);
|
|
|
|
//sf.Find<uint32_t,vecTriplet>(338 * 4,4,to_filter,vectorLength<uint32_t>);
|
|
|
|
sf.Find<const char * ,vecTriplet>("ELEPHANT",4,to_filter, vectorString);
|
|
|
|
sf.Filter<const char * ,vecTriplet>("ELEPHANT",to_filter, vectorString);
|
|
|
|
sf.Find<const char * ,vecTriplet>("CAT",4,to_filter, vectorString);
|
|
|
|
sf.Filter<const char * ,vecTriplet>("CAT",to_filter, vectorString);
|
|
|
|
sf.Find<const char * ,vecTriplet>("DWARF",4,to_filter, vectorString);
|
|
|
|
sf.Filter<const char * ,vecTriplet>("DWARF",to_filter, vectorString);
|
|
|
|
sf.Find<const char * ,vecTriplet>("WAMBLER_FLUFFY",4,to_filter, vectorString);
|
|
|
|
sf.Filter<const char * ,vecTriplet>("WAMBLER_FLUFFY",to_filter, vectorString);
|
|
|
|
sf.Find<const char * ,vecTriplet>("TOAD",4,to_filter, vectorString);
|
|
|
|
sf.Filter<const char * ,vecTriplet>("TOAD",to_filter, vectorString);
|
|
|
|
sf.Find<const char * ,vecTriplet>("DEMON_1",4,to_filter, vectorString);
|
|
|
|
sf.Filter<const char * ,vecTriplet>("DEMON_1",to_filter, vectorString);
|
|
|
|
|
|
|
|
|
|
|
|
vector <uint64_t> toad_first = to_filter;
|
|
|
|
vector <uint64_t> toad_first = to_filter;
|
|
|
|
vector <uint64_t> elephant_first = to_filter;
|
|
|
|
vector <uint64_t> elephant_first = to_filter;
|
|
|
|
sf.Find<const char * ,vecTriplet>("TOAD",4,toad_first, vectorStringFirst);
|
|
|
|
sf.Filter<const char * ,vecTriplet>("TOAD",toad_first, vectorStringFirst);
|
|
|
|
sf.Find<const char * ,vecTriplet>("ELEPHANT",4,elephant_first, vectorStringFirst);
|
|
|
|
sf.Filter<const char * ,vecTriplet>("ELEPHANT",elephant_first, vectorStringFirst);
|
|
|
|
printFoundStrVec(toad_first,"toad-first creature types",sf);
|
|
|
|
printFoundStrVec(toad_first,"toad-first creature types",sf);
|
|
|
|
printFound(elephant_first,"elephant-first creature types");
|
|
|
|
printFound(elephant_first,"elephant-first creature types");
|
|
|
|
printFound(to_filter,"all creature types");
|
|
|
|
printFound(to_filter,"all creature types");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint64_t to_use = 0;
|
|
|
|
|
|
|
|
if(!elephant_first.empty())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
to_use = elephant_first[0];
|
|
|
|
|
|
|
|
vecTriplet *vtCretypes = sf.Translate<vecTriplet>(to_use);
|
|
|
|
|
|
|
|
uint32_t elephant = sf.Read<uint32_t>(vtCretypes->start);
|
|
|
|
|
|
|
|
uint64_t Eoffset;
|
|
|
|
|
|
|
|
cout << "Elephant: 0x" << hex << elephant << endl;
|
|
|
|
|
|
|
|
cout << "Elephant: rawname = 0x0" << endl;
|
|
|
|
|
|
|
|
Eoffset = sf.FindInRange<uint8_t,uint8_t> ('E',equalityP<uint8_t>, elephant, 0x300 );
|
|
|
|
|
|
|
|
if(Eoffset)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "Elephant: big E = 0x" << hex << Eoffset - elephant << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Eoffset = sf.FindInRange<const char *,vecTriplet> ("FEMALE",vectorStringFirst, elephant, 0x300 );
|
|
|
|
|
|
|
|
if(Eoffset)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "Elephant: caste vector = 0x" << hex << Eoffset - elephant << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Eoffset = sf.FindInRange<const char *,vecTriplet> ("SKIN",vectorStringFirst, elephant, 0x2000 );
|
|
|
|
|
|
|
|
if(Eoffset)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "Elephant: extract? vector = 0x" << hex << Eoffset - elephant << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
tilecolors eletc = {7,0,0};
|
|
|
|
|
|
|
|
Bytestream bs_eletc = {sizeof(tilecolors), &eletc};
|
|
|
|
|
|
|
|
Eoffset = sf.FindInRange<Bytestream,tilecolors> (bs_eletc, findBytestream, elephant, 0x300 );
|
|
|
|
|
|
|
|
if(Eoffset)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "Elephant: colors = 0x" << hex << Eoffset - elephant << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//cout << "Amber color:" << hex << "0x" << colorObj << endl;
|
|
|
|
|
|
|
|
// TODO: find string 'amber', the floats
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!toad_first.empty())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
to_use = toad_first[0];
|
|
|
|
|
|
|
|
vecTriplet *vtCretypes = sf.Translate<vecTriplet>(to_use);
|
|
|
|
|
|
|
|
uint32_t toad = sf.Read<uint32_t>(vtCretypes->start);
|
|
|
|
|
|
|
|
uint64_t Eoffset;
|
|
|
|
|
|
|
|
cout << "Toad: 0x" << hex << toad << endl;
|
|
|
|
|
|
|
|
cout << "Toad: rawname = 0x0" << endl;
|
|
|
|
|
|
|
|
Eoffset = sf.FindInRange<uint8_t,uint8_t> (0xF9,equalityP<uint8_t>, toad, 0x300 );
|
|
|
|
|
|
|
|
if(Eoffset)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "Toad: character (not reliable) = 0x" << hex << Eoffset - toad << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Eoffset = sf.FindInRange<const char *,vecTriplet> ("FEMALE",vectorStringFirst, toad, 0x300 );
|
|
|
|
|
|
|
|
if(Eoffset)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "Toad: caste vector = 0x" << hex << Eoffset - toad << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Eoffset = sf.FindInRange<const char *,vecTriplet> ("SKIN",vectorStringFirst, toad, 0x2000 );
|
|
|
|
|
|
|
|
if(Eoffset)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "Toad: extract? vector = 0x" << hex << Eoffset - toad << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
tilecolors toadtc = {2,0,0};
|
|
|
|
|
|
|
|
Bytestream bs_toadc = {sizeof(tilecolors), &toadtc};
|
|
|
|
|
|
|
|
Eoffset = sf.FindInRange<Bytestream,tilecolors> (bs_toadc, findBytestream, toad, 0x300 );
|
|
|
|
|
|
|
|
if(Eoffset)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "Toad: colors = 0x" << hex << Eoffset - toad << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(to_use)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int main (void)
|
|
|
|
int main (void)
|
|
|
|