Tabs to spaces

develop
Petr Mrázek 2010-02-18 18:06:32 +01:00
parent 6b92ea274d
commit e9e1d2b8b9
5 changed files with 86 additions and 86 deletions

@ -1,5 +1,5 @@
// Hotkey and Note Dump // Hotkey and Note Dump
// Or Hot Keynote Dump? :P
#include <iostream> #include <iostream>
#include <climits> #include <climits>
#include <integers.h> #include <integers.h>
@ -21,38 +21,38 @@ int main (void)
return 1; return 1;
} }
DFHack::memory_info mem = DF.getMemoryInfo(); DFHack::memory_info mem = DF.getMemoryInfo();
// get stone matgloss mapping // get stone matgloss mapping
uint32_t numNotes; uint32_t numNotes;
if(!DF.InitReadNotes(numNotes)) if(!DF.InitReadNotes(numNotes))
{ {
cerr << "Can't get notes" << endl; cerr << "Can't get notes" << endl;
return 1; return 1;
} }
if(!DF.InitReadHotkeys()) if(!DF.InitReadHotkeys())
{ {
cerr << "Can't get hotkeys" << endl; cerr << "Can't get hotkeys" << endl;
return 1; return 1;
} }
cout << "Notes" << endl; cout << "Notes" << endl;
for(uint32_t i = 0; i < numNotes; i++) for(uint32_t i = 0; i < numNotes; i++)
{ {
DFHack::t_note temp; DFHack::t_note temp;
DF.ReadNote(i,temp); DF.ReadNote(i,temp);
cout << "x: " << temp.x << "\ty: " << temp.y << "\tz: " << temp.z << cout << "x: " << temp.x << "\ty: " << temp.y << "\tz: " << temp.z <<
"\tsymbol: " << temp.symbol << "\tfg: " << temp.foreground << "\tbg: " << temp.background << "\tsymbol: " << temp.symbol << "\tfg: " << temp.foreground << "\tbg: " << temp.background <<
"\ttext: " << temp.name << endl; "\ttext: " << temp.name << endl;
} }
cout << "Hotkeys" << endl; cout << "Hotkeys" << endl;
DFHack::t_hotkey hotkeys[NUM_HOTKEYS]; DFHack::t_hotkey hotkeys[NUM_HOTKEYS];
DF.ReadHotkeys(hotkeys); DF.ReadHotkeys(hotkeys);
for(uint32_t i =0;i< NUM_HOTKEYS;i++) for(uint32_t i =0;i< NUM_HOTKEYS;i++)
{ {
cout << "x: " << hotkeys[i].x << "\ty: " << hotkeys[i].y << "\tz: " << hotkeys[i].z << cout << "x: " << hotkeys[i].x << "\ty: " << hotkeys[i].y << "\tz: " << hotkeys[i].z <<
"\ttext: " << hotkeys[i].name << endl; "\ttext: " << hotkeys[i].name << endl;
} }
DF.FinishReadNotes(); DF.FinishReadNotes();
DF.Detach(); DF.Detach();
#ifndef LINUX_BUILD #ifndef LINUX_BUILD
cout << "Done. Press any key to continue" << endl; cout << "Done. Press any key to continue" << endl;
cin.ignore(); cin.ignore();

@ -83,14 +83,14 @@ public:
uint32_t item_material_offset; uint32_t item_material_offset;
uint32_t note_foreground_offset; uint32_t note_foreground_offset;
uint32_t note_background_offset; uint32_t note_background_offset;
uint32_t note_name_offset; uint32_t note_name_offset;
uint32_t note_xyz_offset; uint32_t note_xyz_offset;
uint32_t hotkey_start; uint32_t hotkey_start;
uint32_t hotkey_mode_offset; uint32_t hotkey_mode_offset;
uint32_t hotkey_xyz_offset; uint32_t hotkey_xyz_offset;
uint32_t hotkey_size; uint32_t hotkey_size;
uint32_t dwarf_lang_table_offset; uint32_t dwarf_lang_table_offset;
@ -107,8 +107,8 @@ public:
bool cursorWindowInited; bool cursorWindowInited;
bool viewSizeInited; bool viewSizeInited;
bool itemsInited; bool itemsInited;
bool notesInited; bool notesInited;
bool hotkeyInited; bool hotkeyInited;
bool nameTablesInited; bool nameTablesInited;
@ -118,7 +118,7 @@ public:
DfVector *p_bld; DfVector *p_bld;
DfVector *p_veg; DfVector *p_veg;
DfVector *p_itm; DfVector *p_itm;
DfVector *p_notes; DfVector *p_notes;
}; };
API::API (const string path_to_xml) API::API (const string path_to_xml)
@ -134,8 +134,8 @@ API::API (const string path_to_xml)
d->cursorWindowInited = false; d->cursorWindowInited = false;
d->viewSizeInited = false; d->viewSizeInited = false;
d->itemsInited = false; d->itemsInited = false;
d->notesInited = false; d->notesInited = false;
d->hotkeyInited = false; d->hotkeyInited = false;
d->pm = NULL; d->pm = NULL;
} }
@ -860,7 +860,7 @@ bool API::InitReadCreatures( uint32_t &numcreatures )
&& d->creature_labors_offset && d->creature_labors_offset
&& d->creature_happiness_offset && d->creature_happiness_offset
&& d->creature_traits_offset && d->creature_traits_offset
// && d->creature_likes_offset // && d->creature_likes_offset
) )
{ {
d->p_cre = new DfVector (d->p->readVector (creatures, 4)); d->p_cre = new DfVector (d->p->readVector (creatures, 4));
@ -881,9 +881,9 @@ bool API::InitReadNotes( uint32_t &numnotes )
memory_info * minfo = d->offset_descriptor; memory_info * minfo = d->offset_descriptor;
int notes = d->offset_descriptor->getAddress ("notes"); int notes = d->offset_descriptor->getAddress ("notes");
d->note_foreground_offset = minfo->getOffset ("note_foreground"); d->note_foreground_offset = minfo->getOffset ("note_foreground");
d->note_background_offset = minfo->getOffset ("note_background"); d->note_background_offset = minfo->getOffset ("note_background");
d->note_name_offset = minfo->getOffset ("note_name"); d->note_name_offset = minfo->getOffset ("note_name");
d->note_xyz_offset = minfo->getOffset ("note_xyz"); d->note_xyz_offset = minfo->getOffset ("note_xyz");
if (notes if (notes
&& d->note_foreground_offset && d->note_foreground_offset
@ -910,25 +910,25 @@ bool API::ReadNote (const int32_t &index, t_note & note)
assert (d->notesInited); assert (d->notesInited);
// read pointer from vector at position // read pointer from vector at position
uint32_t temp = * (uint32_t *) d->p_notes->at (index); uint32_t temp = * (uint32_t *) d->p_notes->at (index);
note.symbol = g_pProcess->readByte(temp); note.symbol = g_pProcess->readByte(temp);
note.foreground = g_pProcess->readWord(temp + d->note_foreground_offset); note.foreground = g_pProcess->readWord(temp + d->note_foreground_offset);
note.background = g_pProcess->readWord(temp + d->note_background_offset); note.background = g_pProcess->readWord(temp + d->note_background_offset);
d->p->readSTLString (temp + d->note_name_offset, note.name, 128); d->p->readSTLString (temp + d->note_name_offset, note.name, 128);
g_pProcess->read (temp + d->note_xyz_offset, 3*sizeof (uint16_t), (uint8_t *) &note.x); g_pProcess->read (temp + d->note_xyz_offset, 3*sizeof (uint16_t), (uint8_t *) &note.x);
return true; return true;
} }
bool API::InitReadHotkeys( ) bool API::InitReadHotkeys( )
{ {
memory_info * minfo = d->offset_descriptor; memory_info * minfo = d->offset_descriptor;
d->hotkey_start = minfo->getAddress("hotkey_start"); d->hotkey_start = minfo->getAddress("hotkey_start");
d->hotkey_mode_offset = minfo->getOffset ("hotkey_mode"); d->hotkey_mode_offset = minfo->getOffset ("hotkey_mode");
d->hotkey_xyz_offset = minfo->getOffset("hotkey_xyz"); d->hotkey_xyz_offset = minfo->getOffset("hotkey_xyz");
d->hotkey_size = minfo->getHexValue("hotkey_size"); d->hotkey_size = minfo->getHexValue("hotkey_size");
if (d->hotkey_start && d->hotkey_mode_offset && d->hotkey_size) if (d->hotkey_start && d->hotkey_mode_offset && d->hotkey_size)
{ {
d->hotkeyInited = true; d->hotkeyInited = true;
return true; return true;
} }
else else
{ {
@ -939,15 +939,15 @@ bool API::InitReadHotkeys( )
bool API::ReadHotkeys(t_hotkey hotkeys[]) bool API::ReadHotkeys(t_hotkey hotkeys[])
{ {
assert (d->hotkeyInited); assert (d->hotkeyInited);
uint32_t currHotkey = d->hotkey_start; uint32_t currHotkey = d->hotkey_start;
for(uint32_t i = 0 ; i < NUM_HOTKEYS ;i++) for(uint32_t i = 0 ; i < NUM_HOTKEYS ;i++)
{ {
d->p->readSTLString(currHotkey,hotkeys[i].name,10); d->p->readSTLString(currHotkey,hotkeys[i].name,10);
hotkeys[i].mode = g_pProcess->readWord(currHotkey+d->hotkey_mode_offset); hotkeys[i].mode = g_pProcess->readWord(currHotkey+d->hotkey_mode_offset);
g_pProcess->read (currHotkey + d->hotkey_xyz_offset, 3*sizeof (int32_t), (uint8_t *) &hotkeys[i].x); g_pProcess->read (currHotkey + d->hotkey_xyz_offset, 3*sizeof (int32_t), (uint8_t *) &hotkeys[i].x);
currHotkey+=d->hotkey_size; currHotkey+=d->hotkey_size;
} }
return true; return true;
} }
// returns index of creature actually read or -1 if no creature can be found // returns index of creature actually read or -1 if no creature can be found
int32_t API::ReadCreatureInBox (int32_t index, t_creature & furball, int32_t API::ReadCreatureInBox (int32_t index, t_creature & furball,

@ -176,12 +176,12 @@ namespace DFHack
bool InitViewAndCursor(); bool InitViewAndCursor();
bool InitReadNotes( uint32_t & numnotes ); bool InitReadNotes( uint32_t & numnotes );
bool ReadNote(const int32_t &index, t_note & note); bool ReadNote(const int32_t &index, t_note & note);
void FinishReadNotes(); void FinishReadNotes();
bool InitReadHotkeys( ); bool InitReadHotkeys( );
bool ReadHotkeys(t_hotkey hotkeys[]); bool ReadHotkeys(t_hotkey hotkeys[]);
bool getViewCoords (int32_t &x, int32_t &y, int32_t &z); bool getViewCoords (int32_t &x, int32_t &y, int32_t &z);
bool setViewCoords (const int32_t &x, const int32_t &y, const int32_t &z); bool setViewCoords (const int32_t &x, const int32_t &y, const int32_t &z);

@ -73,7 +73,7 @@ bool ProcessEnumerator::findProcessess()
if(p->isIdentified()) if(p->isIdentified())
{ {
d->processes.push_back(p); d->processes.push_back(p);
return true; return true;
} }
else else
{ {
@ -103,7 +103,7 @@ bool ProcessEnumerator::findProcessess()
else else
{ {
//FIXME delete q; //FIXME delete q;
q = 0; q = 0;
} }
} }
if(d->processes.size()) if(d->processes.size())

@ -756,22 +756,22 @@ struct t_viewscreen
struct t_note struct t_note
{ {
char symbol; char symbol;
uint16_t foreground; uint16_t foreground;
uint16_t background; uint16_t background;
char name[128]; char name[128];
uint16_t x; uint16_t x;
uint16_t y; uint16_t y;
uint16_t z; uint16_t z;
}; };
#define NUM_HOTKEYS 16 #define NUM_HOTKEYS 16
struct t_hotkey struct t_hotkey
{ {
char name[10]; char name[10];
int16_t mode; int16_t mode;
int32_t x; int32_t x;
int32_t y; int32_t y;
int32_t z; int32_t z;
}; };
}// namespace DFHack }// namespace DFHack