Beginning DF2010 support

develop
Petr Mrázek 2010-04-02 15:47:08 +02:00
parent d540f4cbd7
commit 8137c73b98
5 changed files with 145 additions and 22 deletions

@ -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

@ -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);

@ -12,6 +12,31 @@ using namespace std;
#include <DFHackAPI.h>
#include <DFProcess.h>
#include <DFMemInfo.h>
#include <DFVector.h>
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,22 +62,32 @@ int main (int numargs, const char ** args)
DFHack::Process* p = DF.getProcess();
DFHack::memory_info* mem = DF.getMemoryInfo();
const vector<string> * 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<string> * 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;

@ -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)

@ -1986,5 +1986,91 @@
<Address name="z_count">0x09048d18</Address>
</Entry>
<!-- Windows logo by M$, spiderweb by jgs -->
<Entry version="v0.31.01" os="windows" id="0.31.01" model="2010">
<String name="md5">851c1190b6a7b42f2463967623d18575</String>
<HexValue name="pe_timestamp">0x4BB45F99</HexValue>
<!-- basic stuff -->
<Offset name="hacked_vector_start">0x0</Offset>
<Offset name="hacked_vector_triplet">0xC</Offset>
<!-- dfposition -->
<Address name="window_x">0xe32798</Address>
<Address name="window_y">0xe60838</Address>
<Address name="window_z">0xe60814</Address>
<Address name="cursor_xyz">0xae82cc</Address>
<Address name="window_dims">0x17f5ab8</Address>
Found addresses: (next to each other!)
0x17f5ab8
0x17f5ac0
0x17f5ac8
0x17f5ad0
<Address name="pause_state">0x146e45f</Address>
Found addresses:
0x146e45f <!-- looks like a dword -->
0x185b677 <!-- looks like a word -->
<Address name="current_cursor_creature">0xae82cc bogus</Address>
<Address name="current_menu_state">0xae82cc bogus</Address>
<Address name="view_screen">0xae82cc bogus</Address>
<!-- map stuff -->
<!-- map size in blocks -->
<Address name="x_count_block">0x016ad738</Address>
<Address name="y_count_block">0x016ad73C</Address>
<Address name="z_count_block">0x016ad740</Address>
<!-- map size in tiles -->
<Address name="x_count">0x016ad744</Address>
<Address name="y_count">0x016ad748</Address>
<Address name="z_count">0x016ad74C</Address>
<!-- suspected region coords -->
<Address name="region_x">0x016ad750</Address>
<Address name="region_y">0x016ad754</Address>
<Address name="region_z">0x016ad758</Address>
<Address name="map_data">0x016AD718</Address>
<Offset name="v_vein">0x10</Offset>
<Offset name="type">0x0092</Offset>
<Offset name="designation">0x029C</Offset>
<!--
No idea if those are still relevant
<Offset name="occupancy">0x0684</Offset>
<Offset name="biome_stuffs">0x1D84</Offset>
-->
<!--
<Address name="buildings">0x09008880</Address>
<Address name="constructions">0x08ff4a58</Address>
<Address name="creatures">0x0900839C</Address>
<Address name="current_cursor_creature">0x08fe3908</Address>
<Address name="current_menu_state">0x08ff4900</Address>
<Address name="cursor_xyz">0x08832328</Address>
<Address name="effects_vector">0x089ed3f8</Address>
<Address name="hotkey_start">0x08ff47ac</Address>
<Address name="items">0x0900840c</Address>
<Address name="language_vector">0x0904accc</Address>
<Address name="map_data">0x09048cfc</Address>
<Address name="matgloss">0x0904abc4</Address>
<Address name="notes">0x08ff4784</Address>
<Address name="pause_state">0xc60008fe</Address>
<Address name="region_x">0x09048d28</Address>
<Address name="region_y">0x09048d2c</Address>
<Address name="region_z">0x09048d30</Address>
<Address name="settlement_current">0x0904a908</Address>
<Address name="settlements">0x0904a89c</Address>
<Address name="translation_vector">0x0904ace4</Address>
<Address name="vegetation">0x0900b9d0</Address>
<Address name="view_screen">0x08832a60</Address>
<Address name="window_dims">0x091995fc</Address>
<Address name="window_x">0x089edd14</Address>
<Address name="window_y">0x089edd18</Address>
<Address name="window_z">0x089edd1c</Address>
<Address name="world">0x0904a328</Address>
<Address name="x_count">0x09048d10</Address>
<Address name="y_count">0x09048d14</Address>
<Address name="z_count">0x09048d18</Address>
-->
</Entry>
</MemoryDescriptors>
</DFExtractor>