Some offsets for 0.31.04, bugfixes

develop
Petr Mrázek 2010-06-06 00:56:09 +02:00
parent 6b7f3e1816
commit 1645df7088
11 changed files with 372 additions and 156 deletions

@ -714,7 +714,7 @@ float SHMProcess::readFloat (const uint32_t offset)
D_SHMHDR->address = offset;
gcc_barrier
d->SetAndWait(CORE_READ_DWORD);
return D_SHMHDR->value;
return reinterpret_cast<float&> (D_SHMHDR->value);
}
void SHMProcess::readFloat (const uint32_t offset, float &val)
{
@ -723,7 +723,7 @@ void SHMProcess::readFloat (const uint32_t offset, float &val)
D_SHMHDR->address = offset;
gcc_barrier
d->SetAndWait(CORE_READ_DWORD);
val = D_SHMHDR->value;
val = reinterpret_cast<float&> (D_SHMHDR->value);
}
/*

@ -367,9 +367,11 @@ void WineProcess::read (const uint32_t offset, const uint32_t size, uint8_t *tar
if(size == 0) return;
ssize_t result;
result = pread(d->memFileHandle, target,size,offset);
if(result != size)
ssize_t total = 0;
ssize_t remaining = size;
while (total != size)
{
result = pread(d->memFileHandle, target + total ,remaining,offset + total);
if(result == -1)
{
cerr << "pread failed: can't read " << size << " bytes at addres " << offset << endl;
@ -379,7 +381,8 @@ void WineProcess::read (const uint32_t offset, const uint32_t size, uint8_t *tar
}
else
{
read(offset + result, size - result, target + result);
total += result;
remaining -= result;
}
}
}

@ -86,7 +86,7 @@ NormalProcess::NormalProcess(uint32_t pid, vector< memory_info* >& known_version
target_name[target_result] = 0;
// is this the regular linux DF?
if (strstr(target_name, "dwarfort.exe") != NULL)
if (strstr(target_name, "dwarfort.exe") != 0 || strstr(target_name,"Dwarf_Fortress") != 0)
{
// create linux process, add it to the vector
d->identified = d->validate(target_name,pid,mem_name,known_versions );

@ -756,7 +756,7 @@ float SHMProcess::readFloat (const uint32_t offset)
D_SHMHDR->address = offset;
full_barrier
d->SetAndWait(CORE_READ_DWORD);
return (float) D_SHMHDR->value;
return reinterpret_cast<float&> (D_SHMHDR->value);
}
void SHMProcess::readFloat (const uint32_t offset, float &val)
{
@ -765,7 +765,7 @@ void SHMProcess::readFloat (const uint32_t offset, float &val)
D_SHMHDR->address = offset;
full_barrier
d->SetAndWait(CORE_READ_DWORD);
val = (float) D_SHMHDR->value;
val = reinterpret_cast<float&> (D_SHMHDR->value);
}
uint64_t SHMProcess::readQuad (const uint32_t offset)
{

@ -23,9 +23,15 @@
#include "dfhack/modules/Vegetation.h"
#include "dfhack/modules/Maps.h"
/*
* This is a header full of ugly, volatile things.
* Only for use of official DFHack tools!
*/
#ifdef DFHACK_WANT_MISCUTILS
#include "dfhack/DFMiscUtils.h"
#endif
// define this to get the static tiletype->properties mapping
#ifdef DFHACK_WANT_TILETYPES
#include "dfhack/DFTileTypes.h"
#endif

@ -8,17 +8,13 @@
#include <sstream>
#include <ctime>
#include <cstdio>
using namespace std;
#include <dfhack/DFProcess.h>
#include <dfhack/DFMemInfo.h>
#include <dfhack/DFVector.h>
/*
* This is a header full of ugly, volatile things.
* Only for use of official DFHack tools!
*/
void DumpObjStr0Vector (const char * name, DFHack::Process *p, uint32_t addr)
{
cout << "----==== " << name << " ====----" << endl;

@ -72,6 +72,7 @@ bool Translation::Start()
if(!d->Inited)
return false;
Process * p = d->d->p;
Finish();
DfVector <uint32_t> genericVec (p, d->genericAddress);
DfVector <uint32_t> transVec (p, d->transAddress);
DFDict & translations = d->dicts.translations;
@ -92,7 +93,6 @@ bool Translation::Start()
for (uint32_t i = 0; i < transVec.size();i++)
{
uint32_t transPtr = transVec.at(i);
DfVector <uint32_t> trans_names_vec (p, transPtr + d->word_table_offset);
for (uint32_t j = 0;j < trans_names_vec.size();j++)
{

@ -95,12 +95,22 @@ uint32_t World::ReadCurrentTick()
return 0;
}
// FIX'D according to this:
/*
World::ReadCurrentMonth and World::ReadCurrentDay
« Sent to: peterix on: June 04, 2010, 04:44:30 »
« You have forwarded or responded to this message. »
ReplyQuoteRemove
Shouldn't these be /28 and %28 instead of 24? There're 28 days in a DF month.
Using 28 and doing the calculation on the value stored at the memory location
specified by memory.xml gets me the current month/date.
*/
uint32_t World::ReadCurrentMonth()
{
return this->ReadCurrentTick() / 1200 / 24;
return this->ReadCurrentTick() / 1200 / 28;
}
uint32_t World::ReadCurrentDay()
{
return ((this->ReadCurrentTick() / 1200) % 24) + 1;
return ((this->ReadCurrentTick() / 1200) % 28) + 1;
}

@ -1621,115 +1621,52 @@ map_data_1b60_offset 0x1B9c
<!-- Windows logo by Microsoft -->
<!-- Tux logo by the Linux guys :) -->
<Entry version="v0.30_04" os="linux" id="30_04lin" base="meta-2010">
<String name="md5">1d759a11af258263ef5c139d6d9a3e15</String>
<Entry version="linux-offsets-2010" os="all" id="linux-offsets-2010" base="meta-2010">
Basic things
============
<HexValue name="sizeof_vector">0xC</HexValue>
<Offset name="vector_triplet">0x0</Offset>
<HexValue name="sizeof_string">0x4</HexValue>
<!-- MAYBE
<HexValue name="sizeof_string">0x4</HexValue>
<HexValue name="sizeof_vector">0x10</HexValue>
<Offset name="vector_triplet">0x4</Offset>
-->
<!-- most probably a static object, because its parts are often
referenced as offset to this address *and* as addresses -->
<Address name="WORLD">0x92D00C0</Address> 0x0165B188
Position and window dimensions
==============================
<Address name="window_x">0x8cd3b18</Address> 0xe32798
<Address name="window_y">0x8cd3b1c</Address> 0xe60838
<Address name="window_z">0x8cd3b20</Address> 0xe60814
<Address name="cursor_xyz">0x8b17370</Address> 0xae82cc
<Address name="window_dims">0x9464d6c</Address> 0x17f5ab8
GUI State
=========
<Address name="pause_state">0x92c971c</Address> 0x146e45f
<!--
Bogus: <Address name="current_cursor_creature">0xae82cc</Address>
<Address name="current_menu_state">0x017f6f38</Address>
Bogus: <Address name="view_screen">0xae82cc</Address>
-->
Map stuff
=========
<Address name="map_data">0x9322d20</Address> WORLD + 0x52C60
<Offset name="map_data_vein_vector">0x08</Offset>
<Offset name="map_data_feature_local">0x20</Offset>
<Offset name="map_data_feature_global">0x24</Offset>
<Offset name="map_data_type">0x006A</Offset>
<Offset name="map_data_designation">0x026C</Offset>
<Offset name="map_data_occupancy">0x066c</Offset>
<Offset name="map_data_temperature1_offset">0x156c</Offset>
<Offset name="map_data_temperature2_offset">0x176c</Offset>
<Offset name="map_data_biome_stuffs">0x1D6C</Offset>
<Offset name="map_data_pathfinding_offset">0x0D6c</Offset>
Map Features
============
WORLD + 0x5487C
<Address name="global_feature_vector">0x932493C</Address>
<Offset name= "global_feature_funcptr_">0x94</Offset>
<Offset name="global_feature_mat">0x28</Offset>
<Offset name="global_feature_submat">0x2C</Offset>
WORLD + 0x548F4
<Address name="local_feature_start_ptr">0x93249B4</Address>
<Offset name="local_feature_mat">0x24</Offset>
<Offset name="local_feature_submat">0x28</Offset>
<HexValue name="sizeof_vector">0xC</HexValue> VERIFIED
<Offset name="vector_triplet">0x0</Offset> VERIFIED
<HexValue name="sizeof_string">0x4</HexValue> VERIFIED
* map size in blocks *
<Address name="x_count_block">0x9322d34</Address> 0x016ad738
<Address name="y_count_block">0x9322d38</Address>0x016ad73C
<Address name="z_count_block">0x9322d3C</Address>0x016ad740
* map size in tiles *
<Address name="x_count">0x9322d40</Address> 0x016ad744
<Address name="y_count">0x9322d44</Address> 0x016ad748
<Address name="z_count">0x9322d48</Address> 0x016ad74C
* region coords *
WORLD + 0x525C8
<Address name="region_x">0x9322d4C</Address> 0x016ad750
WORLD + 0x525CC
<Address name="region_y">0x9322d50</Address> 0x016ad754
WORLD + 0x525D0
<Address name="region_z">0x9322d54</Address> 0x016ad758
* World size * (WORDs)
WORLD + 0x542E0
<Address name="world_size_x">0x93243A0</Address> 0x016AEDD4
WORLD + 0x542E2
<Address name="world_size_y">0x93243A2</Address> 0x016AEDD6
WORLD + 0x54894
<Address name="geoblock_vector">0x9324954</Address> FIX 0x16AF52C
WORLD + 0x548B8
<Address name="ptr2_region_array">0x9324978</Address> FIX 0x16AF574
MAP BLOCK OFFSETS
=================
<Offset name="map_data_vein_vector">0x08</Offset> VERIFIED
<Offset name="map_data_feature_local">0x20</Offset> VERIFIED
<Offset name="map_data_feature_global">0x24</Offset> VERIFIED
<Offset name="map_data_type">0x006A</Offset> VERIFIED
<Offset name="map_data_designation">0x026C</Offset> VERIFIED
<Offset name="map_data_occupancy">0x066c</Offset> VERIFIED
<Offset name="map_data_temperature1_offset">0x156c</Offset> VERIFIED
<Offset name="map_data_temperature2_offset">0x176c</Offset> VERIFIED
<Offset name="map_data_biome_stuffs">0x1D6C</Offset> VERIFIED
<Offset name="map_data_pathfinding_offset">0x0D6c</Offset> VERIFIED
MAP FEATURE OFFSETS
===================
<Offset name= "global_feature_funcptr_">0x94</Offset> VERIFIED
<Offset name="global_feature_mat">0x28</Offset> VERIFIED
<Offset name="global_feature_submat">0x2C</Offset> VERIFIED
<Offset name="local_feature_mat">0x24</Offset> VERIFIED
<Offset name="local_feature_submat">0x28</Offset> VERIFIED
values for the region structure
===============================
<HexValue name="region_size">0x58</HexValue> 0x64 FIX
<Offset name="region_geo_index_off">0x54</Offset> 0x60 FIX
<HexValue name="region_size">0x58</HexValue> VERIFIED
<Offset name="region_geo_index_off">0x54</Offset> VERIFIED
geoblock offsets
================
<Offset name="geolayer_geoblock_offset">0x4</Offset> vector
<Offset name="type_inside_geolayer">0x4</Offset> vector
<Offset name="geolayer_geoblock_offset">0x4</Offset> VERIFIED
<Offset name="type_inside_geolayer">0x4</Offset> VERIFIED
Name struct
===========
<Offset name="name_firstname">0x0</Offset>
<Offset name="name_nickname">0x4</Offset>
<Offset name="name_words">0x8</Offset>
<Offset name="name_firstname">0x0</Offset> VERIFIED
<Offset name="name_nickname">0x4</Offset> VERIFIED
<Offset name="name_words">0x8</Offset> VERIFIED
Creatures
=========
<Address name="creature_vector">0x092E3AA0</Address>
<Address name="dwarf_race_index">0x092CB608</Address>
<Address name="dwarf_civ_id">0x092CB5FC</Address>
Creature offsets
================
<Offset name="creature_name">0x0</Offset>
<Offset name="creature_custom_profession">0x6c</Offset>
<Offset name="creature_profession">0x3c</Offset> *
@ -1795,6 +1732,102 @@ map_data_1b60_offset 0x1B9c
<Offset name="job_material_sectype3">0x8</Offset> index of material (for example, 2 is for silver)
<Offset name="job_material_flags">0x18</Offset> set only for shell / bone mood requirements ?
Creature type offsets
=====================
<Offset name="creature_type_caste_vector">0x138</Offset>
<Offset name="creature_type_extract_vector">0x1A14</Offset>
<Offset name="creature_tile">0xE0</Offset>
<Offset name="creature_tile_color">0xF6</Offset>
<!--
struct CreatureType
{
Vector<CreatureCasteType*> creature_type_caste_vector (0x138);
Vector<CreatureExtractType*> creature_type_extract_vector (0x1A14);
Offset creature_tile (0xE0);
Offset creature_tile_color (0xF6);
}
-->
Color descriptors
=================
<Offset name="descriptor_rawname">0x0</Offset> VERIFIED
<Offset name="descriptor_name">0x1C</Offset> VERIFIED
<Offset name="descriptor_color_r">0x24</Offset> VERIFIED
<Offset name="descriptor_color_v">0x28</Offset> VERIFIED
<Offset name="descriptor_color_b">0x2C</Offset> VERIFIED
Language tables
===============
<Offset name="word_table">0x1C</Offset>
Constructions
=============
<Offset name="sizeof_construction">0x14</Offset>
</Entry>
<Entry version="v0.30_04" os="linux" id="30_04lin" base="linux-offsets-2010">
<String name="md5">1d759a11af258263ef5c139d6d9a3e15</String>
<!-- most probably a static object, because its parts are often
referenced as offset to this address *and* as addresses -->
<Address name="WORLD">0x92D00C0</Address>
Position and window dimensions
==============================
<Address name="window_x">0x8cd3b18</Address>
<Address name="window_y">0x8cd3b1c</Address>
<Address name="window_z">0x8cd3b20</Address>
<Address name="cursor_xyz">0x8b17370</Address>
<Address name="window_dims">0x9464d6c</Address>
GUI State
=========
<Address name="pause_state">0x92c971c</Address>
Map data
=========
<Address name="map_data">0x9322d20</Address> WORLD + 0x52C60
Map Features
============
WORLD + 0x5487C
<Address name="global_feature_vector">0x932493C</Address>
WORLD + 0x548F4
<Address name="local_feature_start_ptr">0x93249B4</Address>
* map size in blocks *
<Address name="x_count_block">0x9322d34</Address>
<Address name="y_count_block">0x9322d38</Address>
<Address name="z_count_block">0x9322d3C</Address>
* map size in tiles *
<Address name="x_count">0x9322d40</Address>
<Address name="y_count">0x9322d44</Address>
<Address name="z_count">0x9322d48</Address>
* region coords *
WORLD + 0x525C8
<Address name="region_x">0x9322d4C</Address>
WORLD + 0x525CC
<Address name="region_y">0x9322d50</Address>
WORLD + 0x525D0
<Address name="region_z">0x9322d54</Address>
* World size * (WORDs)
WORLD + 0x542E0
<Address name="world_size_x">0x93243A0</Address>
WORLD + 0x542E2
<Address name="world_size_y">0x93243A2</Address>
WORLD + 0x54894
<Address name="geoblock_vector">0x9324954</Address>
WORLD + 0x548B8
<Address name="ptr2_region_array">0x9324978</Address>
Creatures
=========
<Address name="creature_vector">0x092E3AA0</Address>
<Address name="dwarf_race_index">0x092CB608</Address>
<Address name="dwarf_civ_id">0x092CB5FC</Address>
Materials
=========
soil, stone, metal
@ -1812,42 +1845,30 @@ map_data_1b60_offset 0x1B9c
creature types actually used for creatures,
<Address name="creature_type_vector">0x09324F14</Address>
<Offset name="creature_type_caste_vector">0x138</Offset>
<Offset name="creature_type_extract_vector">0x1A14</Offset>
<Offset name="creature_tile">0xE0</Offset>
<Offset name="creature_tile_color">0xF6</Offset>
<!--
struct CreatureCasteType
{
?
};
struct CreatureExtractType
{
?
};
struct CreatureType
{
Vector<CreatureCasteType*> creature_type_caste_vector (0x138);
Vector<CreatureExtractType*> creature_type_extract_vector (0x1A14);
Offset creature_tile (0xE0);
Offset creature_tile_color (0xF6);
}
Vector<CreatureType*> creature_type_vector (0x09324F14);
-->
Color descriptors
=================
<Address name="descriptor_colors_vector">0x9329378</Address> VERIFIED
<Address name="descriptor_all_colors">0x9329390</Address> VERIFIED
Translations
============
WORLD + 0x54E50
<Address name="language_vector">0x9324fd4</Address>
WORLD + 0x54E80
<Address name="translation_vector">0x9324fec</Address>
<Offset name="word_table">0x1C</Offset>
Constructions
=============
WORLD + 0x84
<Address name="construction_vector">0x92D0144</Address> 0x165b290
<Offset name="sizeof_construction">0x14</Offset>
Time
====
<Address name="current_year">0x92C9680</Address>
<Address name="current_tick">0x92C9688</Address>
<!--
Vegetation
@ -1951,10 +1972,9 @@ map_data_1b60_offset 0x1B9c
<Offset name="item_improvement_quality">0x14</Offset>
<Offset name="item_type_accessor">0x14</Offset> (in the vtable)
-->
Time
====
<Address name="current_tick">0x92C9688</Address>
<Address name="current_year">0x92C9680</Address>
</Entry>
<Entry version="v0.31.05" os="linux" id="30_05lin" base="linux-offsets-2010">
<String name="md5">fea3801a26538b1741f3cc9294139fca</String>
</Entry>
</MemoryDescriptors>
</DFExtractor>

@ -88,15 +88,16 @@ int main (void)
}
// next test ContextManager and BadContexts
{
cout << "Testing ProcessEnumerator" << endl;
cout << "Testing ContextManager" << endl;
ContextManager Cman("Memory.xml");
memory_info * mem;
do
{
// make the ProcessEnumerator update its list of Processes
// make the ContextManager update its list of Contexts
// by passing the pointer to 'inval', we make it export expired
// processes instead of destroying them outright
// (processes expire when the OS kills them for whatever reason)
// contexts instead of destroying them outright
// (contexts expire when the OS kills their process for whatever
// reason)
BadContexts inval;
Cman.Refresh(&inval);
int nCont = Cman.size();

@ -26,6 +26,31 @@ inline void printRange(DFHack::t_memrange * tpr)
std::cout << std::hex << tpr->start << " - " << tpr->end << "|" << (tpr->read ? "r" : "-") << (tpr->write ? "w" : "-") << (tpr->execute ? "x" : "-") << "|" << tpr->name << std::endl;
}
string rdWinString( char * offset, SegmentedFinder & sf )
{
char * start_offset = offset + 4;
uint32_t length = *(uint32_t *)(offset + 20);
uint32_t capacity = *(uint32_t *)(offset + 24);
char * temp = new char[capacity+1];
// read data from inside the string structure
if(capacity < 16)
{
memcpy(temp, start_offset,capacity);
//read(start_offset, capacity, (uint8_t *)temp);
}
else // read data from what the offset + 4 dword points to
{
start_offset = sf.Translate<char>(*(uint32_t*)start_offset);
memcpy(temp, start_offset,capacity);
}
temp[length] = 0;
string ret = temp;
delete temp;
return ret;
}
bool getRanges(DFHack::Process * p, vector <DFHack::t_memrange>& selected_ranges)
{
vector <DFHack::t_memrange> ranges;
@ -79,10 +104,17 @@ bool getRanges(DFHack::Process * p, vector <DFHack::t_memrange>& selected_ranges
}
end++;
cout << "selected ranges:" <<endl;
selected_ranges.insert(selected_ranges.begin(),ranges.begin() + start, ranges.begin() + end);
for(int i = 0; i< selected_ranges.size();i++)
vector <DFHack::t_memrange>::iterator it;
it = ranges.begin() + start;
while (it != ranges.begin() + end)
{
printRange(&(selected_ranges[i]));
// check if readable
if((*it).read)
{
selected_ranges.push_back(*it);
printRange(&*it);
}
it++;
}
}
@ -357,31 +389,109 @@ void FindStrings(DFHack::ContextManager & DFMgr, vector <DFHack::t_memrange>& ra
}
}
void printFound(vector <uint64_t> &found, const char * what)
{
cout << what << ":" << endl;
for(int i = 0; i < found.size();i++)
{
cout << hex << "0x" << found[i] << endl;
}
}
void printFoundStrVec(vector <uint64_t> &found, const char * what, SegmentedFinder & s)
{
cout << what << ":" << endl;
for(int i = 0; i < found.size();i++)
{
cout << hex << "0x" << found[i] << endl;
cout << "--------------------------" << endl;
vecTriplet * vt = s.Translate<vecTriplet>(found[i]);
if(vt)
{
int j = 0;
for(uint32_t idx = vt->start; idx < vt->finish; idx += sizeof(uint32_t))
{
uint32_t object_ptr;
// deref ptr idx, get ptr to object
if(!s.Read(idx,object_ptr))
{
cout << "BAD!" << endl;
break;
}
// deref ptr to first object, get ptr to string
uint32_t string_ptr;
if(!s.Read(object_ptr,string_ptr))
{
cout << "BAD!" << endl;
break;
}
// get string location in our local cache
char * str = s.Translate<char>(string_ptr);
if(!str)
{
cout << "BAD!" << endl;
break;
}
cout << dec << j << ": " << str << endl;
j++;
}
}
else
{
cout << "BAD!" << endl;
break;
}
cout << "--------------------------" << endl;
}
}
void automatedLangtables(DFHack::Context * DF, vector <DFHack::t_memrange>& ranges)
{
vector <uint64_t> allVectors;
vector <uint64_t> filtVectors;
vector <uint64_t> to_filter;
cout << "stealing memory..." << endl;
SegmentedFinder sf(ranges, DF);
cout << "looking for vectors..." << endl;
sf.Find<int ,vecTriplet>(0,4,allVectors, vectorAll);
// trim vectors. anything with > 10000 entries is not interesting
for(uint64_t i = 0; i < allVectors.size();i++)
{
vecTriplet* vtrip = sf.Translate<vecTriplet>(allVectors[i]);
if(vtrip)
{
uint64_t length = (vtrip->finish - vtrip->start) / 4;
if(length < 10000 )
{
filtVectors.push_back(allVectors[i]);
}
}
}
cout << "-------------------" << endl;
cout << "!!LANGUAGE TABLES!!" << endl;
cout << "-------------------" << endl;
uint64_t kulet_vector;
uint64_t word_table_offset;
uint64_t DWARF_vector;
uint64_t DWARF_object;
SegmentedFinder sf(ranges, DF);
// enumerate all vectors
sf.Find<int ,vecTriplet>(0,4,allVectors, vectorAll);
// find lang vector (neutral word table)
to_filter = allVectors;
to_filter = filtVectors;
sf.Find<const char * ,vecTriplet>("ABBEY",4,to_filter, vectorStringFirst);
uint64_t lang_addr = to_filter[0];
// find dwarven language word table
to_filter = allVectors;
to_filter = filtVectors;
sf.Find<const char * ,vecTriplet>("kulet",4,to_filter, vectorStringFirst);
kulet_vector = to_filter[0];
// find vector of languages
to_filter = allVectors;
to_filter = filtVectors;
sf.Find<const char * ,vecTriplet>("DWARF",4,to_filter, vectorStringFirst);
// verify
@ -400,6 +510,76 @@ void automatedLangtables(DFHack::Context * DF, vector <DFHack::t_memrange>& rang
cout << "translation vector: " << hex << "0x" << DWARF_vector << endl;
cout << "lang vector: " << hex << "0x" << lang_addr << endl;
cout << "word table offset: " << hex << "0x" << word_table_offset << endl;
cout << "-------------" << endl;
cout << "!!MATERIALS!!" << endl;
cout << "-------------" << endl;
// inorganics vector
to_filter = filtVectors;
//sf.Find<uint32_t,vecTriplet>(257 * 4,4,to_filter,vectorLength<uint32_t>);
sf.Find<const char * ,vecTriplet>("IRON",4,to_filter, vectorStringFirst);
sf.Find<const char * ,vecTriplet>("RAW_ADAMANTINE",4,to_filter, vectorString);
sf.Find<const char * ,vecTriplet>("BLOODSTONE",4,to_filter, vectorString);
printFound(to_filter,"inorganics");
// organics vector
to_filter = filtVectors;
sf.Find<uint32_t,vecTriplet>(52 * 4,4,to_filter,vectorLength<uint32_t>);
sf.Find<const char * ,vecTriplet>("MUSHROOM_HELMET_PLUMP",4,to_filter, vectorStringFirst);
printFound(to_filter,"organics");
// tree vector
to_filter = filtVectors;
sf.Find<uint32_t,vecTriplet>(31 * 4,4,to_filter,vectorLength<uint32_t>);
sf.Find<const char * ,vecTriplet>("MANGROVE",4,to_filter, vectorStringFirst);
printFound(to_filter,"trees");
// plant vector
to_filter = filtVectors;
sf.Find<uint32_t,vecTriplet>(21 * 4,4,to_filter,vectorLength<uint32_t>);
sf.Find<const char * ,vecTriplet>("MUSHROOM_HELMET_PLUMP",4,to_filter, vectorStringFirst);
printFound(to_filter,"plants");
// color descriptors
//AMBER, 112
to_filter = filtVectors;
sf.Find<uint32_t,vecTriplet>(112 * 4,4,to_filter,vectorLength<uint32_t>);
sf.Find<const char * ,vecTriplet>("AMBER",4,to_filter, vectorStringFirst);
printFound(to_filter,"color descriptors");
if(!to_filter.empty())
{
uint64_t vec = to_filter[0];
vecTriplet *vtColors = sf.Translate<vecTriplet>(vec);
uint32_t colorObj = sf.Read<uint32_t>(vtColors->start);
cout << "Amber color:" << hex << "0x" << colorObj << endl;
// TODO: find string 'amber', the floats
}
// all descriptors
//AMBER, 338
to_filter = filtVectors;
sf.Find<uint32_t,vecTriplet>(338 * 4,4,to_filter,vectorLength<uint32_t>);
sf.Find<const char * ,vecTriplet>("AMBER",4,to_filter, vectorStringFirst);
printFound(to_filter,"all descriptors");
// creature type
//ELEPHANT, ?? (demons abound)
to_filter = filtVectors;
//sf.Find<uint32_t,vecTriplet>(338 * 4,4,to_filter,vectorLength<uint32_t>);
sf.Find<const char * ,vecTriplet>("ELEPHANT",4,to_filter, vectorString);
sf.Find<const char * ,vecTriplet>("CAT",4,to_filter, vectorString);
sf.Find<const char * ,vecTriplet>("DWARF",4,to_filter, vectorString);
sf.Find<const char * ,vecTriplet>("WAMBLER_FLUFFY",4,to_filter, vectorString);
sf.Find<const char * ,vecTriplet>("TOAD",4,to_filter, vectorString);
sf.Find<const char * ,vecTriplet>("DEMON_1",4,to_filter, vectorString);
vector <uint64_t> toad_first = to_filter;
vector <uint64_t> elephant_first = to_filter;
sf.Find<const char * ,vecTriplet>("TOAD",4,toad_first, vectorStringFirst);
sf.Find<const char * ,vecTriplet>("ELEPHANT",4,elephant_first, vectorStringFirst);
printFound(toad_first,"toad-first creature types");
printFound(elephant_first,"elephant-first creature types");
printFound(to_filter,"all creature types");
}
int main (void)
@ -425,7 +605,7 @@ int main (void)
string prompt =
"Select search type: 1=number(default), 2=vector by length, 3=vector>object>string,\n"
" 4=string, 5=automated lang tables, 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";
int mode;
do