2010-04-02 19:52:46 -06:00
|
|
|
// Just show some position data
|
|
|
|
|
2009-11-02 05:53:39 -07:00
|
|
|
#include <iostream>
|
|
|
|
#include <climits>
|
|
|
|
#include <integers.h>
|
|
|
|
#include <vector>
|
2010-04-02 19:52:46 -06:00
|
|
|
#include <sstream>
|
2009-11-02 05:53:39 -07:00
|
|
|
#include <ctime>
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
#include <DFTypes.h>
|
|
|
|
#include <DFHackAPI.h>
|
2010-04-02 19:52:46 -06:00
|
|
|
#include <DFProcess.h>
|
|
|
|
#include <DFMemInfo.h>
|
|
|
|
#include <DFVector.h>
|
2010-04-04 16:48:19 -06:00
|
|
|
#include <modules/Materials.h>
|
2009-11-02 05:53:39 -07:00
|
|
|
|
2010-04-02 19:52:46 -06:00
|
|
|
void DumpObjStr0Vector (const char * name, DFHack::Process *p, uint32_t addr)
|
2009-11-02 05:53:39 -07:00
|
|
|
{
|
2010-04-02 19:52:46 -06:00
|
|
|
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)
|
|
|
|
{
|
|
|
|
uint32_t addr;
|
|
|
|
if (numargs == 2)
|
|
|
|
{
|
|
|
|
istringstream input (args[1],istringstream::in);
|
|
|
|
input >> std::hex >> addr;
|
|
|
|
}
|
2009-11-10 20:37:28 -07:00
|
|
|
DFHack::API DF("Memory.xml");
|
2010-03-26 06:01:46 -06:00
|
|
|
try
|
2009-11-02 05:53:39 -07:00
|
|
|
{
|
2010-03-26 06:01:46 -06:00
|
|
|
DF.Attach();
|
|
|
|
}
|
|
|
|
catch (exception& e)
|
|
|
|
{
|
|
|
|
cerr << e.what() << endl;
|
|
|
|
#ifndef LINUX_BUILD
|
|
|
|
cin.ignore();
|
|
|
|
#endif
|
2009-11-02 05:53:39 -07:00
|
|
|
return 1;
|
|
|
|
}
|
2010-03-26 06:01:46 -06:00
|
|
|
|
2010-04-02 19:52:46 -06:00
|
|
|
DFHack::Process* p = DF.getProcess();
|
|
|
|
DFHack::memory_info* mem = DF.getMemoryInfo();
|
2010-04-04 16:48:19 -06:00
|
|
|
DFHack::Materials *Materials = DF.getMaterials();
|
|
|
|
|
2010-04-02 19:52:46 -06:00
|
|
|
//const vector<string> * names = mem->getClassIDMapping();
|
2010-04-04 02:10:00 -06:00
|
|
|
/*
|
2010-04-02 19:52:46 -06:00
|
|
|
DumpObjStr0Vector("Material templates",p, mem->getAddress("mat_templates"));
|
2010-02-10 19:03:22 -07:00
|
|
|
|
2010-04-02 19:52:46 -06:00
|
|
|
DumpObjStr0Vector("Inorganics",p, mem->getAddress("mat_inorganics"));
|
2009-11-02 05:53:39 -07:00
|
|
|
|
2010-04-02 19:52:46 -06:00
|
|
|
DumpObjStr0Vector("Organics - all",p, mem->getAddress("mat_organics_all"));
|
2009-11-02 05:53:39 -07:00
|
|
|
|
2010-04-02 19:52:46 -06:00
|
|
|
DumpObjStr0Vector("Organics - plants",p, mem->getAddress("mat_organics_plants"));
|
2009-11-02 05:53:39 -07:00
|
|
|
|
2010-04-02 19:52:46 -06:00
|
|
|
DumpDWordVector("Maybe map between all organics and plants",p, mem->getAddress("mat_unk1_numbers"));
|
|
|
|
|
|
|
|
DumpObjStr0Vector("Trees/wood",p, mem->getAddress("mat_organics_trees"));
|
|
|
|
|
|
|
|
DumpDWordVector("Maybe map between all organics and trees",p, mem->getAddress("mat_unk2_numbers"));
|
|
|
|
|
|
|
|
DumpObjStr0Vector("Body material templates",p, mem->getAddress("mat_body_material_templates"));
|
|
|
|
|
|
|
|
DumpObjStr0Vector("Body detail plans",p, mem->getAddress("mat_body_detail_plans"));
|
|
|
|
|
|
|
|
DumpObjStr0Vector("Bodies",p, mem->getAddress("mat_bodies"));
|
|
|
|
|
|
|
|
DumpObjStr0Vector("Bodygloss",p, mem->getAddress("mat_bodygloss"));
|
|
|
|
|
|
|
|
DumpObjStr0Vector("Creature variations",p, mem->getAddress("mat_creature_variations"));
|
2010-04-04 02:10:00 -06:00
|
|
|
*/
|
2010-04-02 19:52:46 -06:00
|
|
|
|
2010-04-04 02:10:00 -06:00
|
|
|
cout << "----==== Inorganic ====----" << endl;
|
|
|
|
vector<DFHack::t_matgloss> matgloss;
|
2010-04-04 16:48:19 -06:00
|
|
|
Materials->ReadInorganicMaterials (matgloss);
|
2010-04-04 02:10:00 -06:00
|
|
|
for(int i = 0; i < matgloss.size();i++)
|
|
|
|
{
|
|
|
|
cout << matgloss[i].id << endl;
|
|
|
|
}
|
2009-11-02 05:53:39 -07:00
|
|
|
|
2010-04-04 02:10:00 -06:00
|
|
|
cout << endl << "----==== Organic ====----" << endl;
|
|
|
|
vector<DFHack::t_matgloss> organic;
|
2010-04-04 16:48:19 -06:00
|
|
|
Materials->ReadOrganicMaterials (matgloss);
|
2010-04-04 02:10:00 -06:00
|
|
|
for(int i = 0; i < matgloss.size();i++)
|
|
|
|
{
|
|
|
|
cout << matgloss[i].id << endl;
|
|
|
|
}
|
|
|
|
cout << endl << "----==== Creature types ====----" << endl;
|
|
|
|
vector<DFHack::t_matgloss> creature;
|
2010-04-04 16:48:19 -06:00
|
|
|
Materials->ReadCreatureTypes (matgloss);
|
2010-04-04 02:10:00 -06:00
|
|
|
for(int i = 0; i < matgloss.size();i++)
|
|
|
|
{
|
|
|
|
cout << matgloss[i].id << endl;
|
|
|
|
}
|
2009-11-05 18:04:17 -07:00
|
|
|
#ifndef LINUX_BUILD
|
|
|
|
cout << "Done. Press any key to continue" << endl;
|
2009-11-02 05:53:39 -07:00
|
|
|
cin.ignore();
|
2009-11-05 18:04:17 -07:00
|
|
|
#endif
|
2009-11-02 05:53:39 -07:00
|
|
|
return 0;
|
2009-12-13 14:03:19 -07:00
|
|
|
}
|