A bit of offset work on linux, uprated README and COMPILE, screen reading code (untested).

develop
Petr Mrázek 2010-07-19 21:42:17 +02:00
parent 0cb5e99a44
commit 3afff27f03
5 changed files with 100 additions and 87 deletions

@ -99,10 +99,6 @@ There are others, but they aren't really that useful.
Have fun.
--------------------------------------------------------------------------------
**Deprecated*Deprecated*Deprecated*Deprecated*Deprecated*Deprecated*Deprecated**
--------------------------------------------------------------------------------
Building the shared memory hook library (SHM)
---------------------------------------------
@ -110,7 +106,7 @@ Unlike the rest of DFHack, The SHM needs special treatment when it comes to
compilation. Because it shares the memory space with DF itself, it has to be
built with the same tools as DF and use the same C and C++/STL libraries.
For DF 40d15 - 40d19_2 on Windows, use MSVC 2008. You can get the Express
For DF 31.01 - 31.10 on Windows, use MSVC 2008. You can get the Express
edition for free from Microsoft.
Windows dependencies can be determined by a tool like depends.exe (google it).

@ -33,10 +33,10 @@ OSX is also not supported due to lack of developers with a Mac.
Currently supported Dwarf Fortress versions:
* Windows
0.31.01 - 0.31.03 legacy
0.31.04 - 0.31.08 SDL
0.31.04 - 0.31.10 SDL
* Linux
0.31.04 - 0.31.08 native.
0.31.04 - 0.31.10 native.
There are missing offsets but Map tools should be OK. Linux support is a bit lacking, I'm working on it.
All supported Windows versions running in wine can be used with DFHack.
@ -119,7 +119,7 @@ External : linked as dynamic loaded libraries (.dll, .so, etc.)
If you want to add dependencies, think twice about it. All internal dependencies
for core dfhack should be either public domain or require attribution at most.
Internal dependencies for tools can be either that, or any Free Software
External dependencies for tools can be either that, or any Free Software
licenses.
** Current internal dependencies **
@ -132,7 +132,7 @@ argstream: Allows reading terminal application arguments. GPL!
** Current external dependencies **
wide-character ncurses : used for the veinlook tool on Linux.
python 2.6 : required for building and using the python bindings.
x11 libraries : used for sending key events on linux
** Build-time dependencies **
cmake: you need cmake to generate the build system and some configuration

@ -17,6 +17,16 @@ namespace DFHack
int32_t z;
};
struct t_screen
{
uint8_t symbol;
uint8_t foreground;
uint8_t background;
uint8_t bright;
uint8_t gtile;
uint8_t grayscale;
};
class DFContextShared;
class DFHACK_EXPORT Position : public Module
{
@ -44,6 +54,11 @@ namespace DFHack
*/
bool getWindowSize(int32_t & width, int32_t & height);
/*
* Screen tiles
*/
bool getScreenTiles(int32_t width, int32_t height, t_screen screen[]);
private:
struct Private;
Private *d;

@ -170,27 +170,29 @@ bool Position::getWindowSize (int32_t &width, int32_t &height)
return true;
}
/*
bool Position::getScreenTiles (int32_t width, int32_t height, t_screen screen[])
{
if(!d->Inited) return false;
if(!d->StartedScreen) return false;
uint32_t screen_addr;
d->owner->read (d->screen_tiles_ptr_offset, sizeof(uint32_t), (uint8_t *) screen_addr);
uint8_t* tiles = new uint8_t[width*height*4 + 80 + width*height*4];
uint8_t* tiles = new uint8_t[width*height*4/* + 80 + width*height*4*/];
d->owner->read (screen_addr, (width*height*4 + 80 + width*height*4), (uint8_t *) tiles);
d->owner->read (screen_addr, (width*height*4/* + 80 + width*height*4*/), (uint8_t *) tiles);
for(int32_t iy=0; iy<height; iy++)
{
for(int32_t ix=0; ix<width; ix++)
{
screen[ix + iy*width].symbol = tiles[iy + ix*height +0];
screen[ix + iy*width].foreground = tiles[iy + ix*height +1];
screen[ix + iy*width].background = tiles[iy + ix*height +2];
screen[ix + iy*width].bright = tiles[iy + ix*height +3];
screen[ix + iy*width].gtile = tiles[width*height*4 + 80 + iy + ix*height +0];
screen[ix + iy*width].grayscale = tiles[width*height*4 + 80 + iy + ix*height +1];
screen[ix + iy*width].symbol = tiles[iy + ix*height*4 +0];
screen[ix + iy*width].foreground = tiles[iy + ix*height*4 +1];
screen[ix + iy*width].background = tiles[iy + ix*height*4 +2];
screen[ix + iy*width].bright = tiles[iy + ix*height*4 +3];
//screen[ix + iy*width].gtile = tiles[width*height*4 + 80 + iy + ix*height +0];
//screen[ix + iy*width].grayscale = tiles[width*height*4 + 80 + iy + ix*height +1];
}
}
@ -198,4 +200,3 @@ bool Position::getScreenTiles (int32_t width, int32_t height, t_screen screen[])
return true;
}
*/

@ -1485,20 +1485,23 @@ map_data_1b60_offset 0x1B9c
Castes
======
<Offset name="color_modifier_part">0x70</Offset>
<Offset name="color_modifier_startdate">0x64</Offset>
<Offset name="color_modifier_enddate">0x68</Offset>
<Offset name="caste_bodypart_vector">0x51C</Offset>
<Offset name="caste_color_modifiers">0xACC</Offset>
<Offset name="caste_attributes">0x654</Offset>
<Offset name="caste_color_modifiers">0xACC</Offset>
Body Parts
==========
<Offset name="bodypart_id">0x0</Offset>
<Offset name="bodypart_category">0x1C</Offset>
<Offset name="bodypart_layers_vector">0x44</Offset>
<Offset name="bodypart_singular_vector">0x78</Offset>
<Offset name="bodypart_plural_vector">0x90</Offset>
Color Mods
==========
<Offset name="color_modifier_part">0x70</Offset>
<Offset name="color_modifier_startdate">0x64</Offset>
<Offset name="color_modifier_enddate">0x68</Offset>
Body Parts
==========
<Offset name="bodypart_id">0x0</Offset>
<Offset name="bodypart_category">0x1C</Offset>
<Offset name="bodypart_layers_vector">0x44</Offset>
<Offset name="bodypart_singular_vector">0x78</Offset>
<Offset name="bodypart_plural_vector">0x90</Offset>
Materials
=========
@ -1777,48 +1780,38 @@ map_data_1b60_offset 0x1B9c
Creature offsets
================
<Offset name="creature_name">0x0</Offset>
<Offset name="creature_custom_profession">0x6c</Offset>
<Offset name="creature_profession">0x3c</Offset> *
<Offset name="creature_race">0x44</Offset> *
<Offset name="creature_position">0x90</Offset>
<Offset name="creature_flags1">0x8C</Offset> *
<Offset name="creature_flags2">0x90</Offset> *
<Offset name="creature_caste">0x110</Offset>
<Offset name="creature_sex">0xA6</Offset> *
<Offset name="creature_id">0x114</Offset>
<Offset name="creature_civ">0XB4</Offset> *
<Offset name="creature_soulskill_vector">0X1F4</Offset>
<Offset name="creature_pickup_equipment_bit">0X21C</Offset>
<Offset name="creature_mood">0x18C</Offset> *
<Offset name="creature_birth_year">0x19C</Offset> *
<Offset name="creature_birth_time">0x1A0</Offset> *
<Offset name="creature_physical">0x464</Offset>
<Offset name="creature_current_job">0x390</Offset> from chmod
<Offset name="creature_mood_skill">0x394</Offset> the skill that will be increased at the end of the mood (or not)
<Offset name="creature_appearance_vector">0x604</Offset>
<Offset name="creature_artifact_name">0x6D4</Offset>
<Offset name="creature_labors">0x774</Offset>
<Offset name="creature_soul_vector">0x0740</Offset>
<Offset name="creature_default_soul">0x0758</Offset>
<Offset name="creature_happiness">0x834</Offset>
<Offset name="creature_name">0x0</Offset> VERIFIED
<Offset name="creature_custom_profession">0x3c</Offset> CHMOD
<Offset name="creature_profession">0x40</Offset> CHMOD
<Offset name="creature_race">0x44</Offset> CHMOD
<Offset name="creature_position">0x90</Offset> BAD!!
<Offset name="creature_flags1">0x8C</Offset> CHMOD
<Offset name="creature_flags2">0x90</Offset> CHMOD
<Offset name="creature_caste">0xA4</Offset> VERIFY
<Offset name="creature_sex">0xA6</Offset> CHMOD
<Offset name="creature_id">0xA8</Offset> CHMOD
<Offset name="creature_civ">0xB4</Offset> VERIFY!
<Offset name="creature_pickup_equipment_bit">0X144</Offset> CHMOD
<Offset name="creature_mood">0x18C</Offset> VERIFY!
<Offset name="creature_birth_year">0x19C</Offset> VERIFY!
<Offset name="creature_birth_time">0x1A0</Offset> VERIFY!
<Offset name="creature_physical">0x464</Offset> BAD!
<Offset name="creature_current_job">0x258</Offset> CHMOD
<Offset name="creature_mood_skill">0x394</Offset> VERIFY!
the skill that will be increased at the end of the mood (or not)
<Offset name="creature_appearance_vector">0x604</Offset> BAD!
<Offset name="creature_artifact_name">0x6D4</Offset> BAD!
<Offset name="creature_labors">0x51C</Offset> CHMOD
<Offset name="creature_soul_vector">0x0500</Offset> CHMOD
<Offset name="creature_default_soul">0x0758</Offset> BAD!
<Offset name="creature_happiness">0x5AC</Offset> CHMOD
Souls
=====
<Offset name="soul_name">0x0</Offset>
<Offset name="soul_skills_vector">0x1F4</Offset>
<Offset name="soul_traits">0x224</Offset>
<Offset name="soul_mental">0x88</Offset>
Castes
======
<Offset name="color_modifier_part">0x70</Offset>
<Offset name="color_modifier_startdate">0x64</Offset>
<Offset name="color_modifier_enddate">0x68</Offset>
<Offset name="caste_bodypart_vector">0x51C</Offset>
<Offset name="caste_color_modifiers">0xACC</Offset>
<Offset name="caste_attributes">0x654</Offset>
<Offset name="soul_skills_vector">0x1C4</Offset> CHMOD
<Offset name="soul_traits">0x1DC</Offset> CHMOD
<Offset name="soul_mental">0x88</Offset> BAD!
Body Parts
==========
@ -1856,6 +1849,14 @@ map_data_1b60_offset 0x1B9c
<Offset name="creature_tile">0x20</Offset> VERIFIED
<Offset name="creature_tile_color">0x36</Offset> LOOKS OK
Castes
======
<Offset name="color_modifier_part">0x70</Offset>
<Offset name="color_modifier_startdate">0x64</Offset>
<Offset name="color_modifier_enddate">0x68</Offset>
<Offset name="caste_bodypart_vector">0x51C</Offset>
<Offset name="caste_color_modifiers">0xACC</Offset>
<Offset name="caste_attributes">0x654</Offset>
<!--
<Offset name="creature_type_caste_vector">0x138</Offset>
<Offset name="creature_type_extract_vector">0x1A14</Offset>