diff --git a/tools/playground/SegmentedFinder.h b/tools/playground/SegmentedFinder.h index 6dcfe3f2a..c20805b3e 100644 --- a/tools/playground/SegmentedFinder.h +++ b/tools/playground/SegmentedFinder.h @@ -33,8 +33,7 @@ class SegmentFinder template < class needleType, class hayType, typename comparator > uint64_t FindInRange (needleType needle, comparator oper, uint64_t start, uint64_t length) { - mr_.buffer + start - mr_.start; - uint64_t stopper = min((mr_.end - mr_.start) - sizeof(hayType), (start - mr_.start) - sizeof(hayType)); + uint64_t stopper = min((mr_.end - mr_.start) - sizeof(hayType), (start - mr_.start) - sizeof(hayType) + length); //loop for(uint64_t offset = start - mr_.start; offset < stopper; offset +=1) { @@ -287,6 +286,19 @@ bool vectorAll (SegmentedFinder* s, vecTriplet *x, int ) return false; } +struct Bytestream +{ + uint32_t length; + void * object; +}; + +bool findBytestream (SegmentedFinder* s, uint32_t *addr, Bytestream * compare ) +{ + if(memcmp(addr, compare->object, compare->length) == 0) + return true; + return false; +} + bool findString (SegmentedFinder* s, uint32_t *addr, const char * compare ) { // read string pointer, translate to local scheme diff --git a/tools/playground/incrementalsearch.cpp b/tools/playground/incrementalsearch.cpp index 80e928f20..13c86e7e6 100644 --- a/tools/playground/incrementalsearch.cpp +++ b/tools/playground/incrementalsearch.cpp @@ -690,6 +690,36 @@ void automatedLangtables(DFHack::Context * DF, vector & rang printFoundStrVec(toad_first,"toad-first creature types",sf); printFound(elephant_first,"elephant-first 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(to_use); + uint32_t elephant = sf.Read(vtCretypes->start); + uint64_t Eoffset; + cout << "Elephant: rawname = 0x0" << endl; + Eoffset = sf.FindInRange ('E',equalityP, elephant, 0x300 ); + if(Eoffset) + { + cout << "Elephant: big E = 0x" << hex << Eoffset - elephant << endl; + } + Eoffset = sf.FindInRange ("FEMALE",vectorStringFirst, elephant, 0x300 ); + if(Eoffset) + { + cout << "Elephant: caste vector = 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]; + } + if(to_use) + { + + } } int main (void)