diff --git a/examples/veinlook.cpp b/examples/veinlook.cpp index 5d1e7bbda..91a21f566 100644 --- a/examples/veinlook.cpp +++ b/examples/veinlook.cpp @@ -337,6 +337,7 @@ main(int argc, char *argv[]) int filenum = 0; bool dirtybit = false; uint32_t blockaddr = 0; + uint32_t blockaddr2 = 0; // walk the map! for (;;) { @@ -437,6 +438,7 @@ main(int argc, char *argv[]) if(i == 0 && j == 0) { blockaddr = DF.getBlockPtr(cursorX+i,cursorY+j,cursorZ); + blockaddr2 = Block.origin; if(dump) { hexdump(DF,blockaddr,0x1E00/*0x1DB8*/,filenum); @@ -516,7 +518,7 @@ main(int argc, char *argv[]) } } gotoxy (0,52); - cprintf("block address 0x%x",blockaddr); + cprintf("block address 0x%x 0x%x",blockaddr, blockaddr2); gotoxy (0,53); cprintf("dirty bit: %d",dirtybit); gotoxy (0,54); diff --git a/library/DFHackAPI.cpp b/library/DFHackAPI.cpp index 0dc311609..88cde1396 100644 --- a/library/DFHackAPI.cpp +++ b/library/DFHackAPI.cpp @@ -316,6 +316,7 @@ bool API::ReadBlock40d(uint32_t x, uint32_t y, uint32_t z, mapblock40d * buffer) g_pProcess->read (addr + d->occupancy_offset, sizeof (buffer->occupancy), (uint8_t *) buffer->occupancy); g_pProcess->read (addr + d->designation_offset, sizeof (buffer->designaton), (uint8_t *) buffer->designaton); g_pProcess->read (addr + d->biome_stuffs, sizeof (buffer->biome_indices), (uint8_t *) buffer->biome_indices); + buffer->origin = addr; uint32_t addr_of_struct = g_pProcess->readDWord(addr); buffer->dirty_dword = g_pProcess->readDWord(addr_of_struct); return true; diff --git a/library/DFTypes.h b/library/DFTypes.h index db47c23fc..6b9e467a5 100644 --- a/library/DFTypes.h +++ b/library/DFTypes.h @@ -769,7 +769,9 @@ typedef struct int16_t tiletypes [16][16]; DFHack::t_designation designaton [16][16]; DFHack::t_occupancy occupancy [16][16]; - uint8_t biome_indices [7]; + // really a '7', but I use 8 to make it neater :) + uint8_t biome_indices [8]; + uint32_t origin; // the address where it came from uint32_t dirty_dword; // bit 1 set means that the block is to be included in job checks } mapblock40d; diff --git a/shmserver/CMakeLists.txt b/shmserver/CMakeLists.txt index 75c007678..cc4b8cc57 100644 --- a/shmserver/CMakeLists.txt +++ b/shmserver/CMakeLists.txt @@ -38,15 +38,16 @@ SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE ) LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS}) -IF(UNIX) - add_definitions(-DLINUX_BUILD) - SET(PROJECT_LIBS rt) - SET(CMAKE_CXX_FLAGS "-fvisibility=hidden") - ADD_LIBRARY(dfconnect SHARED ${PROJECT_SRCS}) - TARGET_LINK_LIBRARIES(dfconnect ${PROJECT_LIBS}) -ELSE(UNIX) - # SET(PROJECT_LIBS psapi) - ADD_LIBRARY(SDL SHARED ${PROJECT_SRCS}) - TARGET_LINK_LIBRARIES(SDL ${PROJECT_LIBS}) -ENDIF(UNIX) - +IF(CMAKE_SIZEOF_VOID_P EQUAL 4) + IF(UNIX) + add_definitions(-DLINUX_BUILD) + SET(PROJECT_LIBS rt) + SET(CMAKE_CXX_FLAGS "-fvisibility=hidden") + ADD_LIBRARY(dfconnect SHARED ${PROJECT_SRCS}) + TARGET_LINK_LIBRARIES(dfconnect ${PROJECT_LIBS}) + ELSE(UNIX) + # SET(PROJECT_LIBS psapi) + ADD_LIBRARY(SDL SHARED ${PROJECT_SRCS}) + TARGET_LINK_LIBRARIES(SDL ${PROJECT_LIBS}) + ENDIF(UNIX) +ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4) diff --git a/shmserver/mod-maps.cpp b/shmserver/mod-maps.cpp index a67d040db..a34f01975 100644 --- a/shmserver/mod-maps.cpp +++ b/shmserver/mod-maps.cpp @@ -77,6 +77,8 @@ void ReadBlockByCoords (void * data) memcpy(&(SHMBLOCK->occupancy), block + offsets.occupancy_offset, sizeof(SHMBLOCK->occupancy)); memcpy(&(SHMBLOCK->biome_indices), block + offsets.biome_stuffs, sizeof(SHMBLOCK->biome_indices)); SHMBLOCK->dirty_dword = *block->ptr_to_dirty; + + SHMBLOCK->origin = reinterpret_cast(block); SHMHDR->error = false; } else