Arbitrary data search, some toad and elephant values, tiny little amount of valid offsets

develop
Petr Mrázek 2010-06-21 02:59:39 +02:00
parent c5a4172a36
commit 706769f96d
3 changed files with 62 additions and 6 deletions

@ -1817,9 +1817,16 @@ map_data_1b60_offset 0x1B9c
Creature type offsets Creature type offsets
===================== =====================
<Offset name="creature_type_caste_vector">0x60</Offset> VERIFIED <Offset name="creature_type_caste_vector">0x60</Offset> VERIFIED
<Offset name="creature_type_extract_vector">0x1A14</Offset> from 0.31.08
<Offset name="creature_tile">0xE0</Offset> Toad: 0xaf75b68
<Offset name="creature_tile_color">0xF6</Offset> Toad: rawname = 0x0
Toad: character (not reliable) = 0x20
Toad: caste vector = 0x60
Toad: extract? vector = 0x18f4
Toad: colors = 0x36
<Offset name="creature_type_extract_vector">0x18f4</Offset> VERIFIED
<Offset name="creature_tile">0x20</Offset> VERIFIED
<Offset name="creature_tile_color">0x36</Offset> LOOKS OK
<!-- <!--
<Offset name="creature_type_caste_vector">0x138</Offset> <Offset name="creature_type_caste_vector">0x138</Offset>

@ -292,9 +292,9 @@ struct Bytestream
void * object; void * object;
}; };
bool findBytestream (SegmentedFinder* s, uint32_t *addr, Bytestream * compare ) bool findBytestream (SegmentedFinder* s, void *addr, Bytestream compare )
{ {
if(memcmp(addr, compare->object, compare->length) == 0) if(memcmp(addr, compare.object, compare.length) == 0)
return true; return true;
return false; return false;
} }

@ -553,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)
{ {
@ -698,6 +707,7 @@ void automatedLangtables(DFHack::Context * DF, vector <DFHack::t_memrange>& rang
vecTriplet *vtCretypes = sf.Translate<vecTriplet>(to_use); vecTriplet *vtCretypes = sf.Translate<vecTriplet>(to_use);
uint32_t elephant = sf.Read<uint32_t>(vtCretypes->start); uint32_t elephant = sf.Read<uint32_t>(vtCretypes->start);
uint64_t Eoffset; uint64_t Eoffset;
cout << "Elephant: 0x" << hex << elephant << endl;
cout << "Elephant: rawname = 0x0" << endl; cout << "Elephant: rawname = 0x0" << endl;
Eoffset = sf.FindInRange<uint8_t,uint8_t> ('E',equalityP<uint8_t>, elephant, 0x300 ); Eoffset = sf.FindInRange<uint8_t,uint8_t> ('E',equalityP<uint8_t>, elephant, 0x300 );
if(Eoffset) if(Eoffset)
@ -709,12 +719,51 @@ void automatedLangtables(DFHack::Context * DF, vector <DFHack::t_memrange>& rang
{ {
cout << "Elephant: caste vector = 0x" << hex << Eoffset - elephant << endl; cout << "Elephant: caste vector = 0x" << hex << Eoffset - elephant << endl;
} }
Eoffset = sf.FindInRange<const char *,vecTriplet> ("SKIN",vectorStringFirst, elephant, 0x1500 );
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; //cout << "Amber color:" << hex << "0x" << colorObj << endl;
// TODO: find string 'amber', the floats // TODO: find string 'amber', the floats
} }
if(!toad_first.empty()) if(!toad_first.empty())
{ {
to_use = toad_first[0]; 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) if(to_use)
{ {