From 8137c73b983d3c9e9bbb7bc6309c42a6ce5203a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Fri, 2 Apr 2010 15:47:08 +0200 Subject: [PATCH] Beginning DF2010 support --- examples/CMakeLists.txt | 4 +- examples/creaturedump.cpp | 2 +- examples/veccheck.cpp | 69 +++++++++++++++++++++++-------- examples/veinlook.cpp | 6 ++- output/Memory.xml | 86 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 145 insertions(+), 22 deletions(-) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 71a8d6bb8..2e3be5a4b 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -54,8 +54,8 @@ ADD_EXECUTABLE(dfsettlementdump settlementdump.cpp) TARGET_LINK_LIBRARIES(dfsettlementdump dfhack) # veccheck - read vector values at address -#ADD_EXECUTABLE(dfvecc veccheck.cpp) -#TARGET_LINK_LIBRARIES(dfvecc dfhack) +ADD_EXECUTABLE(dfvecc veccheck.cpp) +TARGET_LINK_LIBRARIES(dfvecc dfhack) # catsplosion - Makes every cat pregnant, and almost due... # Author: Zhentar diff --git a/examples/creaturedump.cpp b/examples/creaturedump.cpp index ebeaccd3c..125f802dc 100644 --- a/examples/creaturedump.cpp +++ b/examples/creaturedump.cpp @@ -355,7 +355,7 @@ int main (void) { DFHack::t_creature temp; DF.ReadCreature(i,temp); - if(string(creaturestypes[temp.type].id) == "DWARF") + //if(string(creaturestypes[temp.type].id) == "DWARF") { cout << "index " << i << " "; printCreature(DF,temp); diff --git a/examples/veccheck.cpp b/examples/veccheck.cpp index 06244e793..66c6431c5 100644 --- a/examples/veccheck.cpp +++ b/examples/veccheck.cpp @@ -12,6 +12,31 @@ using namespace std; #include #include #include +#include + +void DumpObjStr0Vector (const char * name, DFHack::Process *p, uint32_t addr) +{ + cout << "----==== " << name << " ====----" << endl; + DFHack::DfVector vect(p,addr,4); + for(int i = 0; i < vect.getSize();i++) + { + uint32_t addr = *(uint32_t *) vect[i]; + cout << p->readSTLString(addr) << endl; + } + cout << endl; +} + +void DumpDWordVector (const char * name, DFHack::Process *p, uint32_t addr) +{ + cout << "----==== " << name << " ====----" << endl; + DFHack::DfVector vect(p,addr,4); + for(int i = 0; i < vect.getSize();i++) + { + uint32_t number = *(uint32_t *) vect[i]; + cout << number << endl; + } + cout << endl; +} int main (int numargs, const char ** args) { @@ -37,23 +62,33 @@ int main (int numargs, const char ** args) DFHack::Process* p = DF.getProcess(); DFHack::memory_info* mem = DF.getMemoryInfo(); - const vector * names = mem->getClassIDMapping(); - for(int i = 0; i < names->size();i++) - { - cout << i << " " << names->at(i) << endl; - } - /* - #ifdef LINUX_BUILD - cout << "start 0x" << hex << p->readDWord(addr+0x0) << endl; - cout << "end 0x" << hex << p->readDWord(addr+0x4) << endl; - cout << "cap 0x" << hex << p->readDWord(addr+0x8) << endl; - #else - cout << "start 0x" << hex << p->readDWord(addr+0x4) << endl; - cout << "end 0x" << hex << p->readDWord(addr+0x8) << endl; - cout << "cap 0x" << hex << p->readDWord(addr+0xC) << endl; - #endif - */ - + //const vector * names = mem->getClassIDMapping(); + + DumpObjStr0Vector("Inorganics",p,0x16afd04); + + DumpObjStr0Vector("Organics - all",p,0x16afd1C); + + DumpObjStr0Vector("Organics - filtered",p,0x16afd34); + + DumpDWordVector("Some weird numbers",p,0x16afd4C); + + DumpObjStr0Vector("Trees/wood",p,0x16afd64); + + DumpDWordVector("More weird numbers",p,0x16afd7C); + + DumpObjStr0Vector("WTF",p,0x16afd7C + 0x18 ); + + DumpObjStr0Vector("WTF2",p,0x16afd7C + 0x18 + 0x18); + + DumpObjStr0Vector("WTF3",p,0x16afd7C + 0x18 + 0x18 + 0x18 ); + + DumpObjStr0Vector("WTF4",p,0x16afd7C + 0x18 + 0x18 + 0x18 + 0x18); + + DumpObjStr0Vector("WTF5",p,0x16afd7C + 0x18 + 0x18 + 0x18 + 0x18 + 0x18); + + DumpObjStr0Vector("Creature types",p,0x16afd7C + 0x18 + 0x18 + 0x18 + 0x18 + 0x18 + 0x18); + + #ifndef LINUX_BUILD cout << "Done. Press any key to continue" << endl; cin.ignore(); diff --git a/examples/veinlook.cpp b/examples/veinlook.cpp index c39dc2b65..32980fa40 100644 --- a/examples/veinlook.cpp +++ b/examples/veinlook.cpp @@ -507,7 +507,7 @@ main(int argc, char *argv[]) { int color = COLOR_BLACK; color = pickColor(Block->tiletypes[x][y]); - if(!Block->designation[x][y].bits.hidden) + //if(!Block->designation[x][y].bits.hidden) /*{ puttile(x+(i+1)*16,y+(j+1)*16,Block->tiletypes[x][y], color); } @@ -524,7 +524,7 @@ main(int argc, char *argv[]) { for(uint zz = 0; zz < effects.size();zz++) { - if(effects[zz].z == cursorZ && !effects[zz].isHidden) + if(effects[zz].z == cursorZ /*&& !effects[zz].isHidden*/) { // block coords to tile coords uint16_t x = effects[zz].x - (cursorX * 16); @@ -564,8 +564,10 @@ main(int argc, char *argv[]) { if(tileTypeTable[blocks[1][1].tiletypes[k][j]].m != VEIN) continue; + /* if(blocks[1][1].designation[k][j].bits.hidden) continue; + */ // and the bit array with a one-bit mask, check if the bit is set bool set = !!(((1 << k) & veinVector[realvein].assignment[j]) >> k); if(set) diff --git a/output/Memory.xml b/output/Memory.xml index 6675cceb7..abcef55fd 100644 --- a/output/Memory.xml +++ b/output/Memory.xml @@ -1986,5 +1986,91 @@
0x09048d18
+ + 851c1190b6a7b42f2463967623d18575 + 0x4BB45F99 + + + 0x0 + 0xC + + +
0xe32798
+
0xe60838
+
0xe60814
+
0xae82cc
+ +
0x17f5ab8
+ Found addresses: (next to each other!) + 0x17f5ab8 + 0x17f5ac0 + 0x17f5ac8 + 0x17f5ad0 + +
0x146e45f
+ Found addresses: + 0x146e45f + 0x185b677 + +
0xae82cc bogus
+
0xae82cc bogus
+
0xae82cc bogus
+ + + +
0x016ad738
+
0x016ad73C
+
0x016ad740
+ +
0x016ad744
+
0x016ad748
+
0x016ad74C
+ +
0x016ad750
+
0x016ad754
+
0x016ad758
+ +
0x016AD718
+ 0x10 + 0x0092 + 0x029C + + +