2010-04-26 10:23:47 -06:00
|
|
|
#include <iostream>
|
|
|
|
#include <climits>
|
|
|
|
#include <vector>
|
|
|
|
#include <stdio.h>
|
|
|
|
using namespace std;
|
2010-05-25 22:48:23 -06:00
|
|
|
#include <DFHack.h>
|
2010-04-26 10:23:47 -06:00
|
|
|
|
2010-04-28 10:09:32 -06:00
|
|
|
DFHack::Materials * Materials;
|
2010-08-20 06:10:05 -06:00
|
|
|
DFHack::VersionInfo *mem;
|
2010-04-26 10:23:47 -06:00
|
|
|
vector< vector<string> > englishWords;
|
|
|
|
vector< vector<string> > foreignWords;
|
|
|
|
|
|
|
|
int main (int numargs, char ** args)
|
|
|
|
{
|
2010-05-23 15:06:10 -06:00
|
|
|
DFHack::ContextManager DFMgr("Memory.xml");
|
|
|
|
DFHack::Context *DF = DFMgr.getSingleContext();
|
2010-04-26 10:23:47 -06:00
|
|
|
DFHack::Process * p;
|
|
|
|
try
|
|
|
|
{
|
2010-05-23 15:06:10 -06:00
|
|
|
DF->Attach();
|
2010-04-26 10:23:47 -06:00
|
|
|
}
|
|
|
|
catch (exception& e)
|
|
|
|
{
|
|
|
|
cerr << e.what() << endl;
|
|
|
|
#ifndef LINUX_BUILD
|
|
|
|
cin.ignore();
|
|
|
|
#endif
|
|
|
|
return 1;
|
|
|
|
}
|
2010-05-23 15:06:10 -06:00
|
|
|
p = DF->getProcess();
|
2010-04-26 10:23:47 -06:00
|
|
|
string check = "";
|
|
|
|
if(numargs == 2)
|
|
|
|
check = args[1];
|
2010-05-23 15:06:10 -06:00
|
|
|
|
|
|
|
DFHack::Creatures * Creatures = DF->getCreatures();
|
|
|
|
Materials = DF->getMaterials();
|
|
|
|
DFHack::Translation * Tran = DF->getTranslation();
|
|
|
|
|
2010-04-26 10:23:47 -06:00
|
|
|
uint32_t numCreatures;
|
|
|
|
if(!Creatures->Start(numCreatures))
|
|
|
|
{
|
|
|
|
cerr << "Can't get creatures" << endl;
|
|
|
|
#ifndef LINUX_BUILD
|
|
|
|
cin.ignore();
|
|
|
|
#endif
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if(!numCreatures)
|
|
|
|
{
|
|
|
|
cerr << "No creatures to print" << endl;
|
|
|
|
#ifndef LINUX_BUILD
|
|
|
|
cin.ignore();
|
|
|
|
#endif
|
|
|
|
return 1;
|
|
|
|
}
|
2010-05-23 15:06:10 -06:00
|
|
|
mem = DF->getMemoryInfo();
|
2010-04-26 10:23:47 -06:00
|
|
|
|
2010-04-28 10:09:32 -06:00
|
|
|
if(!Materials->ReadInorganicMaterials())
|
|
|
|
{
|
2010-05-23 15:06:10 -06:00
|
|
|
cerr << "Can't get the inorganics types." << endl;
|
|
|
|
return 1;
|
2010-04-28 10:09:32 -06:00
|
|
|
}
|
|
|
|
if(!Materials->ReadCreatureTypesEx())
|
2010-04-26 10:23:47 -06:00
|
|
|
{
|
|
|
|
cerr << "Can't get the creature types." << endl;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if(!Tran->Start())
|
|
|
|
{
|
|
|
|
cerr << "Can't get name tables" << endl;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
vector<uint32_t> addrs;
|
|
|
|
//DF.InitViewAndCursor();
|
|
|
|
for(uint32_t i = 0; i < numCreatures; i++)
|
|
|
|
{
|
|
|
|
DFHack::t_creature temp;
|
2010-05-23 15:06:10 -06:00
|
|
|
unsigned int current_job;
|
|
|
|
unsigned int mat_start;
|
|
|
|
unsigned int mat_end;
|
|
|
|
unsigned int j,k;
|
|
|
|
unsigned int matptr;
|
2010-04-26 10:23:47 -06:00
|
|
|
|
2010-05-23 15:06:10 -06:00
|
|
|
Creatures->ReadCreature(i,temp);
|
|
|
|
if(temp.mood>=0)
|
|
|
|
{
|
|
|
|
current_job = p->readDWord(temp.origin + 0x390);
|
|
|
|
if(current_job == 0)
|
|
|
|
continue;
|
|
|
|
mat_start = p->readDWord(current_job + 0xa4 + 4*3);
|
|
|
|
mat_end = p->readDWord(current_job + 0xa4 + 4*4);
|
|
|
|
for(j=mat_start;j<mat_end;j+=4)
|
|
|
|
{
|
|
|
|
matptr = p->readDWord(j);
|
|
|
|
for(k=0;k<4;k++)
|
|
|
|
printf("%.4X ", p->readWord(matptr + k*2));
|
|
|
|
for(k=0;k<3;k++)
|
|
|
|
printf("%.8X ", p->readDWord(matptr + k*4 + 0x8));
|
|
|
|
for(k=0;k<2;k++)
|
|
|
|
printf("%.4X ", p->readWord(matptr + k*2 + 0x14));
|
|
|
|
for(k=0;k<3;k++)
|
|
|
|
printf("%.8X ", p->readDWord(matptr + k*4 + 0x18));
|
|
|
|
for(k=0;k<4;k++)
|
|
|
|
printf("%.2X ", p->readByte(matptr + k + 0x24));
|
|
|
|
for(k=0;k<6;k++)
|
|
|
|
printf("%.8X ", p->readDWord(matptr + k*4 + 0x28));
|
|
|
|
for(k=0;k<4;k++)
|
|
|
|
printf("%.2X ", p->readByte(matptr + k + 0x40));
|
|
|
|
for(k=0;k<9;k++)
|
|
|
|
printf("%.8X ", p->readDWord(matptr + k*4 + 0x44));
|
|
|
|
printf(" [%p]\n", matptr);
|
|
|
|
}
|
|
|
|
}
|
2010-04-26 10:23:47 -06:00
|
|
|
}
|
|
|
|
Creatures->Finish();
|
2010-05-23 15:06:10 -06:00
|
|
|
DF->Detach();
|
2010-04-26 10:23:47 -06:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|