Petr Mrázek 2009-11-06 01:04:17 +00:00
parent d3b62a7672
commit 41475d1918
16 changed files with 273 additions and 11 deletions

@ -0,0 +1,81 @@
0x00cdfd950
0x0000 e8 69 6c 08
0x0004 90 00 00 00
0x0008 8f 00 00 00
0x000c 90 00 00 00
0x0010 90 00 00 00
0x0014 8f 00 00 00
0x0018 8f 00 00 00
0x001c 0f 00 00 00
0x0020 01 00 00 00
0x0024 01 00 87 00
0x0028 00 00 00 00
0x002c f8 dc 0d 10
0x0030 f8 c6 0d 10
0x0034 78 c2 0d 10
0x0038 b0 7c 0d 10
0x003c fe 52 01 00
0x0040 a6 00 df 0a
0x0044 1b ee 00 00
0x0048 30 96 a7 10
0x004c 30 96 a7 10
0x0050 34 96 a7 10
0x0054 00 00 00 00
0x0058 00 00 00 00
0x005c 00 00 00 00
0x0060 00 00 00 00
0x0064 00 00 00 00
0x0068 00 00 00 00
0x006c 00 00 00 00
0x0070 00 00 00 00
0x0074 00 00 00 00
0x0078 00 00 00 00
0x007c 00 00 00 00
0x0080 00 00 00 00
0x0084 00 00 00 00
0x0088 00 00 00 00
0x008c 00 00 00 00
0x0090 00 00 00 00
0x0094 00 00 00 00
0x0098 01 00 00 00
0x009c 00 47 e4 0d
0x00a0 18 47 e4 0d
0x00a4 18 47 e4 0d
0x00a8 00 00 00 00
0x00ac 00 00 00 00
0x00b0 00 00 00 00
0x00b4 00 00 00 00
0x00b8 80 47 e4 0d
0x00bc 94 47 e4 0d
0x00c0 94 47 e4 0d
0x00c4 00 00 00 00
0x00c8 00 00 00 00
0x00cc 00 00 00 00
0x00d0 00 00 00 00
0x00d4 00 00 00 00
0x00d8 00 00 00 00
0x00dc 00 00 00 00
0x00e0 c0 c6 2d 00
0x00e4 05 00 00 00
0x00e8 14 00 00 00
0x00ec 01 07 01 07
0x00f0 10 00 00 00
0x00f4 b9 00 00 00
0x00f8 68 59 6c 08
0x00fc 98 00 00 00
Done. Press any key to continue

@ -0,0 +1,81 @@
0x00cdfd950
0x0000 e8 69 6c 08
0x0004 90 00 00 00
0x0008 8f 00 00 00
0x000c 90 00 00 00
0x0010 90 00 00 00
0x0014 8f 00 00 00
0x0018 8f 00 00 00
0x001c 0f 00 00 00
0x0020 01 00 00 00
0x0024 01 00 87 00
0x0028 00 00 00 00
0x002c f8 dc 0d 10
0x0030 f8 c6 0d 10
0x0034 78 c2 0d 10
0x0038 b0 7c 0d 10
0x003c 34 51 01 00
0x0040 a6 00 df 0a
0x0044 1b ee 00 00
0x0048 00 00 00 00
0x004c 00 00 00 00
0x0050 00 00 00 00
0x0054 00 00 00 00
0x0058 00 00 00 00
0x005c 00 00 00 00
0x0060 00 00 00 00
0x0064 00 00 00 00
0x0068 00 00 00 00
0x006c 00 00 00 00
0x0070 00 00 00 00
0x0074 00 00 00 00
0x0078 00 00 00 00
0x007c 00 00 00 00
0x0080 00 00 00 00
0x0084 00 00 00 00
0x0088 00 00 00 00
0x008c 00 00 00 00
0x0090 00 00 00 00
0x0094 00 00 00 00
0x0098 01 00 00 00
0x009c 00 47 e4 0d
0x00a0 18 47 e4 0d
0x00a4 18 47 e4 0d
0x00a8 00 00 00 00
0x00ac 00 00 01 00
0x00b0 00 00 00 00
0x00b4 00 00 00 00
0x00b8 80 47 e4 0d
0x00bc 94 47 e4 0d
0x00c0 94 47 e4 0d
0x00c4 00 00 00 00
0x00c8 00 00 00 00
0x00cc 00 00 00 00
0x00d0 00 00 00 00
0x00d4 00 00 00 00
0x00d8 00 00 00 00
0x00dc 00 00 00 00
0x00e0 c0 c6 2d 00
0x00e4 05 00 00 00
0x00e8 14 00 00 00
0x00ec 01 07 01 07
0x00f0 10 00 00 00
0x00f4 b9 00 00 00
0x00f8 68 59 6c 08
0x00fc 98 00 00 00
Done. Press any key to continue

@ -0,0 +1,23 @@
< OFF
> ON
20c20
< 15 0x003c 1c 53 01 00
---
> 15 0x003c 39 55 01 00
28,30c28,30
< 21 0x0054 00 00 00 00
< 22 0x0058 00 00 00 00
< 23 0x005c 00 00 00 00
---
> 21 0x0054 e0 53 a1 01
> 22 0x0058 e0 53 a1 01
> 23 0x005c e4 53 a1 01
this is a good candidate for lever state
82c82
< 64 0x0100 00 00 00 00
---
> 64 0x0100 00 00 01 00

@ -647,7 +647,10 @@ uint32_t DFHackAPIImpl::InitReadCreatures()
creature_type_offset = offset_descriptor->getOffset("creature_type");
creature_flags1_offset = offset_descriptor->getOffset("creature_flags1");
creature_flags2_offset = offset_descriptor->getOffset("creature_flags2");
assert(creatures && creature_pos_offset && creature_type_offset && creature_flags1_offset && creature_flags2_offset);
creature_first_name_offset = offset_descriptor->getOffset("first_name");
creature_nick_name_offset = offset_descriptor->getOffset("nick_name");
assert(creatures && creature_pos_offset && creature_type_offset &&
creature_flags1_offset && creature_flags2_offset && creature_nick_name_offset);
p_cre = new DfVector(dm->readVector(creatures, 4));
return p_cre->getSize();
}
@ -664,6 +667,9 @@ bool DFHackAPIImpl::ReadCreature(const uint32_t &index, t_creature & furball)
Mread(temp + creature_type_offset, sizeof(uint32_t), (uint8_t *) &furball.type);
Mread(temp + creature_flags1_offset, sizeof(uint32_t), (uint8_t *) &furball.flags1);
Mread(temp + creature_flags2_offset, sizeof(uint32_t), (uint8_t *) &furball.flags2);
// names.
furball.first_name = dm->readSTLString(temp+creature_first_name_offset);
furball.nick_name = dm->readSTLString(temp+creature_nick_name_offset);
return true;
}

@ -41,6 +41,8 @@ distribution.
# endif
#endif
#define BUILD_DFHACK_LIB
#include <string>
#include <vector>
#include "integers.h"
@ -190,6 +192,8 @@ private:
uint32_t creature_type_offset;
uint32_t creature_flags1_offset;
uint32_t creature_flags2_offset;
uint32_t creature_first_name_offset;
uint32_t creature_nick_name_offset;
ProcessManager* pm;
Process* p;

@ -388,6 +388,8 @@ struct t_creature
uint32_t type;
t_creaturflags1 flags1;
t_creaturflags2 flags2;
string first_name;
string nick_name;
};
// TODO: research this further? consult DF hacker wizards?

@ -86,6 +86,8 @@
<Offset name="biome_stuffs">0x1D64</Offset>
<!-- creature offsets -->
<Offset name="first_name">0x00</Offset>
<Offset name="nick_name">0x1C</Offset>
<Offset name="creature_position">0x94</Offset>
<Offset name="creature_profession">0x88</Offset>
<Offset name="creature_type">0x8C</Offset>
@ -136,7 +138,7 @@
<class vtable="0x0097beac" name="floor_bars"/>
<class vtable="0x0097b0ec" name="cabinet"/>
<class vtable="0x0097af8c" name="container"/>
<class vtable="0x0097d60c" name="shop"/>
<class vtable="0x0097d60c" name="shop"/>
<multiclass vtable="0x0097e10c" name="workshop" typeoffset="0xC8">
<class name="alchemists_laboratory" type="0x0"/>
<class name="carpenters_workshop" type="0x1"/>
@ -378,6 +380,8 @@
<Address name="creatures">0x093326AC</Address>
<!-- creature offsets -->
<Offset name="first_name">0x00</Offset>
<Offset name="nick_name">0x04</Offset>
<Offset name="creature_position">0x4C</Offset>
<Offset name="creature_type">0x44</Offset>
<Offset name="creature_flags1">0x90</Offset>

@ -40,5 +40,17 @@ TARGET_LINK_LIBRARIES(dfmaterialtest dfhack)
IF(UNIX)
install(TARGETS dfexpbench dfreveal dfreveal dfprospector dfcleanmap dfcreaturedump dfattachtest dfmaterialtest RUNTIME DESTINATION bin)
install(TARGETS
dfexpbench
dfreveal
dfreveal
dfprospector
dfcleanmap
dfcreaturedump
dfattachtest
dfmaterialtest
dfbuildingsdump
RUNTIME DESTINATION bin
)
ENDIF(UNIX)

@ -65,8 +65,10 @@ int main (void)
time_diff = difftime(end, start);
cout << "attach tests done in " << time_diff << " seconds." << endl;
cout << "Press any key to continue" << endl;
#ifndef LINUX_BUILD
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
delete pDF;
return 0;

@ -2,6 +2,7 @@
#include <iostream>
#include <iomanip>
#include <sstream>
#include <climits>
#include <integers.h>
#include <vector>
@ -62,7 +63,7 @@ void interleave_hex (DFHackAPI& DF, vector < uint32_t > & addresses, uint32_t le
cout << setfill('0');
// output a header
cout << " ";
cout << "line offset ";
for (int obj = 0; obj < addresses.size(); obj++)
{
cout << "0x" << hex << setw(9) << addresses[obj] << " ";
@ -75,6 +76,9 @@ void interleave_hex (DFHackAPI& DF, vector < uint32_t > & addresses, uint32_t le
{
cout << endl;
}
cout << setfill(' ');
cout << dec << setw(4) << offs/4 << " ";
cout << setfill('0');
cout << "0x" << hex << setw(4) << offs << " ";
for (int object = 0; object < bufs.size(); object++)
{
@ -108,7 +112,21 @@ void print_bits ( T val, std::ostream& out )
int main (int argc,const char* argv[])
{
if (argc != 2) return 1;
if (argc < 2 || argc > 3)
{
cout << "usage:" << endl;
cout << argv[0] << " object_name [number of lines]" << endl;
return 0;
}
int lines = 16;
if(argc == 3)
{
string s = argv[2]; //blah. I don't care
istringstream ins; // Declare an input string stream.
ins.str(s); // Specify string to read.
ins >> lines; // Reads the integers from the string.
}
vector<t_matgloss> creaturestypes;
DFHackAPI *pDF = CreateDFHackAPI("Memory.xml");
@ -133,11 +151,13 @@ int main (int argc,const char* argv[])
addresses.push_back(temp.origin);
}
}
interleave_hex(DF,addresses,16);
interleave_hex(DF,addresses,lines / 4);
DF.FinishReadBuildings();
DF.Detach();
delete pDF;
#ifndef LINUX_BUILD
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
return 0;
}

@ -49,7 +49,9 @@ int main (void)
}
DF.Detach();
delete pDF;
#ifndef LINUX_BUILD
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
return 0;
}

@ -46,7 +46,21 @@ int main (void)
t_creature temp;
DF.ReadCreature(i, temp);
cout << "creature type " << creaturestypes[temp.type].id << ", position:" << temp.x << " " << temp.y << " "<< temp.z << endl;
bool addendl = false;
if(!temp.first_name.empty())
{
cout << "first name: " << temp.first_name;
addendl = true;
}
if(!temp.nick_name.empty())
{
cout << ", nick name: " << temp.nick_name;
addendl = true;
}
if(addendl)
{
cout << endl;
}
/*
* FLAGS 1
*/
@ -112,7 +126,9 @@ int main (void)
DF.FinishReadCreatures();
DF.Detach();
delete pDF;
#ifndef LINUX_BUILD
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
return 0;
}

@ -63,8 +63,10 @@ int main (void)
cout << num_blocks << " blocks read" << endl;
cout << bytes_read / (1024 * 1024) << " MB" << endl;
cout << "map export tests done in " << time_diff << " seconds." << endl;
cout << "Press any key to continue" << endl;
#ifndef LINUX_BUILD
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
delete pDF;
return 0;
}

@ -39,8 +39,10 @@ int main (void)
DF.Detach();
delete pDF;
#ifndef LINUX_BUILD
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
return 0;
}

@ -159,7 +159,7 @@ int main (int argc, const char* argv[])
{
materials[tempvein[xi][yi]] = 1;
}
}
}
}
}
}
@ -171,7 +171,10 @@ int main (int argc, const char* argv[])
cout << stonetypes[p->first].id << " : " << p->second << endl;
}
DF.Detach();
#ifndef LINUX_BUILD
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
delete pDF;
return 0;
}

@ -49,7 +49,9 @@ int main (void)
}
DF.Detach();
delete pDF;
#ifndef LINUX_BUILD
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
return 0;
}