|
|
@ -12,7 +12,9 @@ using namespace std;
|
|
|
|
#include <DFTileTypes.h>
|
|
|
|
#include <DFTileTypes.h>
|
|
|
|
#include <DFHackAPI.h>
|
|
|
|
#include <DFHackAPI.h>
|
|
|
|
#include <DFProcess.h>
|
|
|
|
#include <DFProcess.h>
|
|
|
|
|
|
|
|
#include <DFMemInfo.h>
|
|
|
|
using namespace DFHack;
|
|
|
|
using namespace DFHack;
|
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
#include <curses.h>
|
|
|
|
#include <curses.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <signal.h>
|
|
|
@ -200,9 +202,9 @@ void hexdump (DFHack::API& DF, uint32_t address, uint32_t length, int filenum)
|
|
|
|
char *buf = new char[reallength];
|
|
|
|
char *buf = new char[reallength];
|
|
|
|
ofstream myfile;
|
|
|
|
ofstream myfile;
|
|
|
|
|
|
|
|
|
|
|
|
string name = "hexdump";
|
|
|
|
stringstream ss;
|
|
|
|
name += filenum;
|
|
|
|
ss << "hexdump" << filenum << ".txt";
|
|
|
|
name+= ".txt";
|
|
|
|
string name = ss.str();
|
|
|
|
|
|
|
|
|
|
|
|
myfile.open (name.c_str());
|
|
|
|
myfile.open (name.c_str());
|
|
|
|
|
|
|
|
|
|
|
@ -297,6 +299,7 @@ main(int argc, char *argv[])
|
|
|
|
error = "Can't find a map to look at.";
|
|
|
|
error = "Can't find a map to look at.";
|
|
|
|
pDF = 0;
|
|
|
|
pDF = 0;
|
|
|
|
finish(0);
|
|
|
|
finish(0);
|
|
|
|
|
|
|
|
#include <DFMemInfo.h>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DF.getSize(x_max_a,y_max_a,z_max_a);
|
|
|
|
DF.getSize(x_max_a,y_max_a,z_max_a);
|
|
|
@ -328,14 +331,17 @@ main(int argc, char *argv[])
|
|
|
|
|
|
|
|
|
|
|
|
bool dig = false;
|
|
|
|
bool dig = false;
|
|
|
|
bool dump = false;
|
|
|
|
bool dump = false;
|
|
|
|
|
|
|
|
bool digbit = false;
|
|
|
|
int vein = 0;
|
|
|
|
int vein = 0;
|
|
|
|
int filenum = 0;
|
|
|
|
int filenum = 0;
|
|
|
|
|
|
|
|
bool dirtybit = false;
|
|
|
|
uint32_t blockaddr = 0;
|
|
|
|
uint32_t blockaddr = 0;
|
|
|
|
// walk the map!
|
|
|
|
// walk the map!
|
|
|
|
for (;;)
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dig = false;
|
|
|
|
dig = false;
|
|
|
|
dump = false;
|
|
|
|
dump = false;
|
|
|
|
|
|
|
|
digbit = false;
|
|
|
|
DF.Resume();
|
|
|
|
DF.Resume();
|
|
|
|
int c = getch(); /* refresh, accept single keystroke of input */
|
|
|
|
int c = getch(); /* refresh, accept single keystroke of input */
|
|
|
|
clrscr();
|
|
|
|
clrscr();
|
|
|
@ -372,6 +378,9 @@ main(int argc, char *argv[])
|
|
|
|
case '-':
|
|
|
|
case '-':
|
|
|
|
vein --;
|
|
|
|
vein --;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'z':
|
|
|
|
|
|
|
|
digbit = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -425,11 +434,17 @@ main(int argc, char *argv[])
|
|
|
|
blockaddr = DF.getBlockPtr(cursorX+i,cursorY+j,cursorZ);
|
|
|
|
blockaddr = DF.getBlockPtr(cursorX+i,cursorY+j,cursorZ);
|
|
|
|
if(dump)
|
|
|
|
if(dump)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
hexdump(DF,blockaddr,0x1DB8,filenum);
|
|
|
|
hexdump(DF,blockaddr,0x1E00/*0x1DB8*/,filenum);
|
|
|
|
filenum++;
|
|
|
|
filenum++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(dig)
|
|
|
|
if(dig)
|
|
|
|
DF.WriteDesignations(cursorX+i,cursorY+j,cursorZ, (uint32_t *) designations);
|
|
|
|
DF.WriteDesignations(cursorX+i,cursorY+j,cursorZ, (uint32_t *) designations);
|
|
|
|
|
|
|
|
DF.ReadDirtyBit(cursorX+i,cursorY+j,cursorZ,dirtybit);
|
|
|
|
|
|
|
|
if(digbit)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
dirtybit = !dirtybit;
|
|
|
|
|
|
|
|
DF.WriteDirtyBit(cursorX+i,cursorY+j,cursorZ,dirtybit);
|
|
|
|
|
|
|
|
}
|
|
|
|
veinVector.clear();
|
|
|
|
veinVector.clear();
|
|
|
|
DF.ReadVeins(cursorX+i,cursorY+j,cursorZ,veinVector);
|
|
|
|
DF.ReadVeins(cursorX+i,cursorY+j,cursorZ,veinVector);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -493,8 +508,12 @@ main(int argc, char *argv[])
|
|
|
|
cprintf("%s, address 0x%x",className.c_str(),veinVector[vein].address_of);
|
|
|
|
cprintf("%s, address 0x%x",className.c_str(),veinVector[vein].address_of);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t sptr = blockaddr + p->getDescriptor()->getOffset("block_flags");
|
|
|
|
|
|
|
|
|
|
|
|
gotoxy (0,53);
|
|
|
|
gotoxy (0,53);
|
|
|
|
cprintf("block address 0x%x",blockaddr);
|
|
|
|
cprintf("block address 0x%x",blockaddr);
|
|
|
|
|
|
|
|
gotoxy (0,54);
|
|
|
|
|
|
|
|
cprintf("dirty bit: %d",dirtybit);
|
|
|
|
wrefresh(stdscr);
|
|
|
|
wrefresh(stdscr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pDF = 0;
|
|
|
|
pDF = 0;
|
|
|
|