CR/LF?
parent
f91720c97e
commit
157deb85af
@ -1,6 +1,6 @@
|
|||||||
#ifndef CONFIG_H
|
#ifndef CONFIG_H
|
||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
#define MEMXML_DATA_PATH .
|
#define MEMXML_DATA_PATH .
|
||||||
|
|
||||||
#endif // CONFIG_H
|
#endif // CONFIG_H
|
||||||
|
@ -1,142 +1,142 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <integers.h>
|
#include <integers.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include <DFGlobal.h>
|
#include <DFGlobal.h>
|
||||||
#include <DFError.h>
|
#include <DFError.h>
|
||||||
#include <DFTypes.h>
|
#include <DFTypes.h>
|
||||||
#include <DFHackAPI.h>
|
#include <DFHackAPI.h>
|
||||||
#include <DFMemInfo.h>
|
#include <DFMemInfo.h>
|
||||||
#include <DFProcess.h>
|
#include <DFProcess.h>
|
||||||
#include <modules/Materials.h>
|
#include <modules/Materials.h>
|
||||||
#include <modules/Creatures.h>
|
#include <modules/Creatures.h>
|
||||||
#include <modules/Translation.h>
|
#include <modules/Translation.h>
|
||||||
|
|
||||||
struct matGlosses
|
struct matGlosses
|
||||||
{
|
{
|
||||||
vector<DFHack::t_matglossPlant> plantMat;
|
vector<DFHack::t_matglossPlant> plantMat;
|
||||||
vector<DFHack::t_matgloss> woodMat;
|
vector<DFHack::t_matgloss> woodMat;
|
||||||
vector<DFHack::t_matgloss> stoneMat;
|
vector<DFHack::t_matgloss> stoneMat;
|
||||||
vector<DFHack::t_matgloss> metalMat;
|
vector<DFHack::t_matgloss> metalMat;
|
||||||
vector<DFHack::t_matgloss> creatureMat;
|
vector<DFHack::t_matgloss> creatureMat;
|
||||||
};
|
};
|
||||||
|
|
||||||
vector<DFHack::t_creaturetype> creaturestypes;
|
vector<DFHack::t_creaturetype> creaturestypes;
|
||||||
matGlosses mat;
|
matGlosses mat;
|
||||||
vector< vector <DFHack::t_itemType> > itemTypes;
|
vector< vector <DFHack::t_itemType> > itemTypes;
|
||||||
DFHack::memory_info *mem;
|
DFHack::memory_info *mem;
|
||||||
vector< vector<string> > englishWords;
|
vector< vector<string> > englishWords;
|
||||||
vector< vector<string> > foreignWords;
|
vector< vector<string> > foreignWords;
|
||||||
|
|
||||||
int main (int numargs, char ** args)
|
int main (int numargs, char ** args)
|
||||||
{
|
{
|
||||||
DFHack::API DF("Memory.xml");
|
DFHack::API DF("Memory.xml");
|
||||||
DFHack::Process * p;
|
DFHack::Process * p;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DF.Attach();
|
DF.Attach();
|
||||||
}
|
}
|
||||||
catch (exception& e)
|
catch (exception& e)
|
||||||
{
|
{
|
||||||
cerr << e.what() << endl;
|
cerr << e.what() << endl;
|
||||||
#ifndef LINUX_BUILD
|
#ifndef LINUX_BUILD
|
||||||
cin.ignore();
|
cin.ignore();
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
p = DF.getProcess();
|
p = DF.getProcess();
|
||||||
string check = "";
|
string check = "";
|
||||||
if(numargs == 2)
|
if(numargs == 2)
|
||||||
check = args[1];
|
check = args[1];
|
||||||
|
|
||||||
DFHack::Creatures * Creatures = DF.getCreatures();
|
DFHack::Creatures * Creatures = DF.getCreatures();
|
||||||
DFHack::Materials * Materials = DF.getMaterials();
|
DFHack::Materials * Materials = DF.getMaterials();
|
||||||
DFHack::Translation * Tran = DF.getTranslation();
|
DFHack::Translation * Tran = DF.getTranslation();
|
||||||
|
|
||||||
uint32_t numCreatures;
|
uint32_t numCreatures;
|
||||||
if(!Creatures->Start(numCreatures))
|
if(!Creatures->Start(numCreatures))
|
||||||
{
|
{
|
||||||
cerr << "Can't get creatures" << endl;
|
cerr << "Can't get creatures" << endl;
|
||||||
#ifndef LINUX_BUILD
|
#ifndef LINUX_BUILD
|
||||||
cin.ignore();
|
cin.ignore();
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(!numCreatures)
|
if(!numCreatures)
|
||||||
{
|
{
|
||||||
cerr << "No creatures to print" << endl;
|
cerr << "No creatures to print" << endl;
|
||||||
#ifndef LINUX_BUILD
|
#ifndef LINUX_BUILD
|
||||||
cin.ignore();
|
cin.ignore();
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
mem = DF.getMemoryInfo();
|
mem = DF.getMemoryInfo();
|
||||||
|
|
||||||
if(!Materials->ReadInorganicMaterials(mat.metalMat))
|
if(!Materials->ReadInorganicMaterials(mat.metalMat))
|
||||||
{
|
{
|
||||||
cerr << "Can't get the inorganics types." << endl;
|
cerr << "Can't get the inorganics types." << endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Materials->ReadCreatureTypesEx(creaturestypes))
|
if(!Materials->ReadCreatureTypesEx(creaturestypes))
|
||||||
{
|
{
|
||||||
cerr << "Can't get the creature types." << endl;
|
cerr << "Can't get the creature types." << endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Tran->Start())
|
if(!Tran->Start())
|
||||||
{
|
{
|
||||||
cerr << "Can't get name tables" << endl;
|
cerr << "Can't get name tables" << endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
vector<uint32_t> addrs;
|
vector<uint32_t> addrs;
|
||||||
//DF.InitViewAndCursor();
|
//DF.InitViewAndCursor();
|
||||||
for(uint32_t i = 0; i < numCreatures; i++)
|
for(uint32_t i = 0; i < numCreatures; i++)
|
||||||
{
|
{
|
||||||
DFHack::t_creature temp;
|
DFHack::t_creature temp;
|
||||||
unsigned int current_job;
|
unsigned int current_job;
|
||||||
unsigned int mat_start;
|
unsigned int mat_start;
|
||||||
unsigned int mat_end;
|
unsigned int mat_end;
|
||||||
unsigned int j,k;
|
unsigned int j,k;
|
||||||
unsigned int matptr;
|
unsigned int matptr;
|
||||||
unsigned int tmp;
|
unsigned int tmp;
|
||||||
|
|
||||||
Creatures->ReadCreature(i,temp);
|
Creatures->ReadCreature(i,temp);
|
||||||
if(temp.mood>=0)
|
if(temp.mood>=0)
|
||||||
{
|
{
|
||||||
current_job = p->readDWord(temp.origin + 0x390);
|
current_job = p->readDWord(temp.origin + 0x390);
|
||||||
if(current_job == 0)
|
if(current_job == 0)
|
||||||
continue;
|
continue;
|
||||||
mat_start = p->readDWord(current_job + 0xa4 + 4*3);
|
mat_start = p->readDWord(current_job + 0xa4 + 4*3);
|
||||||
mat_end = p->readDWord(current_job + 0xa4 + 4*4);
|
mat_end = p->readDWord(current_job + 0xa4 + 4*4);
|
||||||
for(j=mat_start;j<mat_end;j+=4)
|
for(j=mat_start;j<mat_end;j+=4)
|
||||||
{
|
{
|
||||||
matptr = p->readDWord(j);
|
matptr = p->readDWord(j);
|
||||||
for(k=0;k<4;k++)
|
for(k=0;k<4;k++)
|
||||||
printf("%.4X ", p->readWord(matptr + k*2));
|
printf("%.4X ", p->readWord(matptr + k*2));
|
||||||
for(k=0;k<3;k++)
|
for(k=0;k<3;k++)
|
||||||
printf("%.8X ", p->readDWord(matptr + k*4 + 0x8));
|
printf("%.8X ", p->readDWord(matptr + k*4 + 0x8));
|
||||||
for(k=0;k<2;k++)
|
for(k=0;k<2;k++)
|
||||||
printf("%.4X ", p->readWord(matptr + k*2 + 0x14));
|
printf("%.4X ", p->readWord(matptr + k*2 + 0x14));
|
||||||
for(k=0;k<3;k++)
|
for(k=0;k<3;k++)
|
||||||
printf("%.8X ", p->readDWord(matptr + k*4 + 0x18));
|
printf("%.8X ", p->readDWord(matptr + k*4 + 0x18));
|
||||||
for(k=0;k<4;k++)
|
for(k=0;k<4;k++)
|
||||||
printf("%.2X ", p->readByte(matptr + k + 0x24));
|
printf("%.2X ", p->readByte(matptr + k + 0x24));
|
||||||
for(k=0;k<6;k++)
|
for(k=0;k<6;k++)
|
||||||
printf("%.8X ", p->readDWord(matptr + k*4 + 0x28));
|
printf("%.8X ", p->readDWord(matptr + k*4 + 0x28));
|
||||||
for(k=0;k<4;k++)
|
for(k=0;k<4;k++)
|
||||||
printf("%.2X ", p->readByte(matptr + k + 0x40));
|
printf("%.2X ", p->readByte(matptr + k + 0x40));
|
||||||
for(k=0;k<9;k++)
|
for(k=0;k<9;k++)
|
||||||
printf("%.8X ", p->readDWord(matptr + k*4 + 0x44));
|
printf("%.8X ", p->readDWord(matptr + k*4 + 0x44));
|
||||||
printf(" [%p]\n", matptr);
|
printf(" [%p]\n", matptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Creatures->Finish();
|
Creatures->Finish();
|
||||||
DF.Detach();
|
DF.Detach();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue