Fun and games. Also turning old DFWindow class into a module tracked by Context.

develop
Petr Mrázek 2010-05-26 12:24:45 +02:00
parent 966a145b3e
commit 04b71f154c
68 changed files with 221 additions and 648 deletions

@ -8,16 +8,16 @@ if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW) cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy) endif(COMMAND cmake_policy)
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(SEND_ERROR "In-source builds are not allowed.") message(SEND_ERROR "In-source builds are not allowed.")
endif("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") endif("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
IF(NOT DEFINED CMAKE_BUILD_TYPE) IF(NOT DEFINED CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.") SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
ENDIF(NOT DEFINED CMAKE_BUILD_TYPE) ENDIF(NOT DEFINED CMAKE_BUILD_TYPE)
SET( LIBRARY_OUTPUT_PATH ${dfhack_SOURCE_DIR}/output CACHE PATH "Output directory for the dfhack library" ) SET( LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/output CACHE PATH "Output directory for the dfhack library" )
SET( EXECUTABLE_OUTPUT_PATH ${dfhack_SOURCE_DIR}/output CACHE PATH "Output directory for the dfhack tools" ) SET( EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/output CACHE PATH "Output directory for the dfhack tools" )
include_directories (${CMAKE_SOURCE_DIR}/library/include/) include_directories (${CMAKE_SOURCE_DIR}/library/include/)
include_directories (${CMAKE_SOURCE_DIR}/library/shm/) include_directories (${CMAKE_SOURCE_DIR}/library/shm/)

@ -1,7 +1,32 @@
# don't use this file directly. use the one in the root folder of the project # don't use this file directly. use the one in the root folder of the project
PROJECT (dfhack-library)
cmake_minimum_required(VERSION 2.6)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
# disable warning, autosearch
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(SEND_ERROR "In-source builds are not allowed.")
endif("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
IF(NOT DEFINED CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
ENDIF(NOT DEFINED CMAKE_BUILD_TYPE)
SET( LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/output CACHE PATH "Output directory for the dfhack library" )
SET( EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/output CACHE PATH "Output directory for the dfhack tools" )
include_directories (${CMAKE_SOURCE_DIR}/library/include/)
include_directories (${CMAKE_SOURCE_DIR}/library/shm/)
include_directories (${CMAKE_SOURCE_DIR}/library/depends/md5/)
include_directories (${CMAKE_SOURCE_DIR}/library/depends/tinyxml/)
include_directories (${CMAKE_SOURCE_DIR}/library/depends/argstream/)
include_directories (${CMAKE_SOURCE_DIR}/library/private/)
SET(PROJECT_HDRS SET(PROJECT_HDRS
include/dfhack/DFCommonInternal.h
include/dfhack/DFError.h include/dfhack/DFError.h
include/dfhack/DFMemInfo.h include/dfhack/DFMemInfo.h
include/dfhack/DFMemInfoManager.h include/dfhack/DFMemInfoManager.h
@ -10,11 +35,21 @@ include/dfhack/DFProcess.h
include/dfhack/DFTileTypes.h include/dfhack/DFTileTypes.h
include/dfhack/DFTypes.h include/dfhack/DFTypes.h
include/dfhack/DFVector.h include/dfhack/DFVector.h
include/dfhack/DFWindow.h
include/dfhack-c/DFTypes_C.h include/dfhack-c/DFTypes_C.h
include/dfhack-c/DFContext_C.h include/dfhack-c/DFContext_C.h
include/dfhack/DFIntegers.h include/dfhack/DFIntegers.h
shm/shms.h include/dfhack/modules/Buildings.h
include/dfhack/modules/Constructions.h
include/dfhack/modules/Creatures.h
include/dfhack/modules/Gui.h
include/dfhack/modules/Items.h
include/dfhack/modules/Maps.h
include/dfhack/modules/Materials.h
include/dfhack/modules/Position.h
include/dfhack/modules/Translation.h
include/dfhack/modules/Vegetation.h
include/dfhack/modules/WindowIO.h
include/dfhack/modules/World.h
) )
SET(PROJECT_SRCS SET(PROJECT_SRCS
@ -22,9 +57,7 @@ DFMemInfo.cpp
DFMemInfoManager.cpp DFMemInfoManager.cpp
DFContextManager.cpp DFContextManager.cpp
DFContext.cpp DFContext.cpp
APIPrivate.cpp ContextShared.cpp
DFTileTypes.cpp
DFVector.cpp
DFContext_C.cpp DFContext_C.cpp
DFTypes_C.cpp DFTypes_C.cpp
@ -36,28 +69,28 @@ depends/tinyxml/tinyxml.cpp
depends/tinyxml/tinyxmlerror.cpp depends/tinyxml/tinyxmlerror.cpp
depends/tinyxml/tinyxmlparser.cpp depends/tinyxml/tinyxmlparser.cpp
modules/Buildings.cpp
modules/Constructions.cpp
modules/Creatures.cpp modules/Creatures.cpp
modules/Gui.cpp modules/Gui.cpp
modules/World.cpp
modules/Items.cpp modules/Items.cpp
modules/Maps.cpp modules/Maps.cpp
modules/Materials.cpp modules/Materials.cpp
modules/Position.cpp modules/Position.cpp
modules/Translation.cpp modules/Translation.cpp
modules/Vegetation.cpp modules/Vegetation.cpp
modules/Buildings.cpp modules/World.cpp
modules/Constructions.cpp
modules/Position_C.cpp
modules/Gui_C.cpp
modules/Materials_C.cpp
modules/Buildings_C.cpp modules/Buildings_C.cpp
modules/Constructions_C.cpp modules/Constructions_C.cpp
modules/Maps_C.cpp
modules/Vegetation_C.cpp
modules/Creatures_C.cpp modules/Creatures_C.cpp
modules/Translation_C.cpp modules/Gui_C.cpp
modules/Items_C.cpp modules/Items_C.cpp
modules/Maps_C.cpp
modules/Position_C.cpp
modules/Materials_C.cpp
modules/Translation_C.cpp
modules/Vegetation_C.cpp
) )
SET(PROJECT_HDRS_LINUX SET(PROJECT_HDRS_LINUX
@ -71,14 +104,14 @@ SET(PROJECT_SRCS_LINUX
DFProcess-linux.cpp DFProcess-linux.cpp
DFProcess-linux-SHM.cpp DFProcess-linux-SHM.cpp
DFProcess-linux-wine.cpp DFProcess-linux-wine.cpp
DFWindow-linux.cpp modules/WindowIO-linux.cpp
DFProcessEnumerator-linux.cpp DFProcessEnumerator-linux.cpp
) )
SET(PROJECT_SRCS_WINDOWS SET(PROJECT_SRCS_WINDOWS
DFProcess-windows.cpp DFProcess-windows.cpp
DFProcess-windows-SHM.cpp DFProcess-windows-SHM.cpp
DFWindow-windows.cpp modules/WindowIO-windows.cpp
DFProcessEnumerator-windows.cpp DFProcessEnumerator-windows.cpp
) )
@ -106,7 +139,7 @@ ELSE( CMAKE_SIZEOF_VOID_P MATCHES 4 )
SET( HAVE_64_BIT 1 ) SET( HAVE_64_BIT 1 )
ENDIF( CMAKE_SIZEOF_VOID_P MATCHES 4 ) ENDIF( CMAKE_SIZEOF_VOID_P MATCHES 4 )
CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/library/config.h.cmake ${CMAKE_SOURCE_DIR}/library/include/config.h ) CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/library/config.h.cmake ${CMAKE_SOURCE_DIR}/library/private/config.h )
ADD_DEFINITIONS(-DBUILD_DFHACK_LIB) ADD_DEFINITIONS(-DBUILD_DFHACK_LIB)

@ -1,9 +1,9 @@
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include <shms.h> #include <shms.h>
#include <mod-core.h> #include <mod-core.h>
#include <mod-maps.h> #include <mod-maps.h>
#include <mod-creature40d.h> #include <mod-creature40d.h>
#include "private/APIPrivate.h" #include "private/ContextShared.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
@ -20,7 +20,7 @@
using namespace DFHack; using namespace DFHack;
DFContextPrivate::DFContextPrivate() DFContextShared::DFContextShared()
{ {
// init modules // init modules
creatures = 0; creatures = 0;
@ -34,9 +34,10 @@ DFContextPrivate::DFContextPrivate()
buildings = 0; buildings = 0;
constructions = 0; constructions = 0;
items = 0; items = 0;
windowio = 0;
} }
DFContextPrivate::~DFContextPrivate() DFContextShared::~DFContextShared()
{ {
if(creatures) delete creatures; if(creatures) delete creatures;
if(maps) delete maps; if(maps) delete maps;
@ -48,9 +49,10 @@ DFContextPrivate::~DFContextPrivate()
if(buildings) delete buildings; if(buildings) delete buildings;
if(constructions) delete constructions; if(constructions) delete constructions;
if(world) delete world; if(world) delete world;
if(windowio) delete windowio;
} }
bool DFContextPrivate::InitReadNames() bool DFContextShared::InitReadNames()
{ {
name_firstname_offset = offset_descriptor->getOffset("name_firstname"); name_firstname_offset = offset_descriptor->getOffset("name_firstname");
name_nickname_offset = offset_descriptor->getOffset("name_nickname"); name_nickname_offset = offset_descriptor->getOffset("name_nickname");
@ -58,7 +60,7 @@ bool DFContextPrivate::InitReadNames()
return true; return true;
} }
void DFContextPrivate::readName(t_name & name, uint32_t address) void DFContextShared::readName(t_name & name, uint32_t address)
{ {
p->readSTLString(address + name_firstname_offset , name.first_name, 128); p->readSTLString(address + name_firstname_offset , name.first_name, 128);
p->readSTLString(address + name_nickname_offset , name.nickname, 128); p->readSTLString(address + name_nickname_offset , name.nickname, 128);

@ -22,7 +22,7 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
#include "dfhack/DFProcessEnumerator.h" #include "dfhack/DFProcessEnumerator.h"
@ -34,7 +34,7 @@ distribution.
#include <mod-core.h> #include <mod-core.h>
#include <mod-maps.h> #include <mod-maps.h>
#include <mod-creature40d.h> #include <mod-creature40d.h>
#include "private/APIPrivate.h" #include "private/ContextShared.h"
#include "dfhack/modules/Maps.h" #include "dfhack/modules/Maps.h"
#include "dfhack/modules/Materials.h" #include "dfhack/modules/Materials.h"
@ -47,10 +47,11 @@ distribution.
#include "dfhack/modules/Vegetation.h" #include "dfhack/modules/Vegetation.h"
#include "dfhack/modules/Buildings.h" #include "dfhack/modules/Buildings.h"
#include "dfhack/modules/Constructions.h" #include "dfhack/modules/Constructions.h"
#include "dfhack/modules/WindowIO.h"
using namespace DFHack; using namespace DFHack;
Context::Context (Process* p) : d (new DFContextPrivate()) Context::Context (Process* p) : d (new DFContextShared())
{ {
d->p = p; d->p = p;
d->offset_descriptor = p->getDescriptor(); d->offset_descriptor = p->getDescriptor();
@ -191,16 +192,12 @@ memory_info *Context::getMemoryInfo()
{ {
return d->offset_descriptor; return d->offset_descriptor;
} }
Process * Context::getProcess() Process * Context::getProcess()
{ {
return d->p; return d->p;
} }
DFWindow * Context::getWindow()
{
return d->p->getWindow();
}
/******************************************************************************* /*******************************************************************************
M O D U L E S M O D U L E S
*******************************************************************************/ *******************************************************************************/
@ -225,6 +222,13 @@ Gui * Context::getGui()
return d->gui; return d->gui;
} }
WindowIO * Context::getWindow()
{
if(!d->windowio)
d->windowio = new WindowIO(d);
return d->windowio;
}
World * Context::getWorld() World * Context::getWorld()
{ {
if(!d->world) if(!d->world)

@ -22,7 +22,7 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
#include "dfhack/DFProcessEnumerator.h" #include "dfhack/DFProcessEnumerator.h"
@ -36,7 +36,7 @@ distribution.
#include <mod-core.h> #include <mod-core.h>
#include <mod-maps.h> #include <mod-maps.h>
#include <mod-creature40d.h> #include <mod-creature40d.h>
#include "private/APIPrivate.h" #include "private/ContextShared.h"
using namespace DFHack; using namespace DFHack;
namespace DFHack namespace DFHack

@ -30,7 +30,7 @@ distribution.
#include "dfhack/DFIntegers.h" #include "dfhack/DFIntegers.h"
#include "dfhack/DFTileTypes.h" #include "dfhack/DFTileTypes.h"
#include "dfhack/DFTypes.h" #include "dfhack/DFTypes.h"
#include "dfhack/DFWindow.h" //#include "dfhack/modules/WindowIO.h"
#include "dfhack/DFContextManager.h" #include "dfhack/DFContextManager.h"
#include "dfhack/DFContext.h" #include "dfhack/DFContext.h"

@ -1,293 +0,0 @@
/*
www.sourceforge.net/projects/dfhack
Copyright (c) 2009 Petr Mrázek (peterix), Kenneth Ferland (Impaler[WrG]), dorf, doomchild
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#include "DFPragma.h"
#include "DFExport.h"
#include <string>
#include <vector>
#include <map>
#include "DFIntegers.h"
#include "DFTileTypes.h"
#include "DFTypes.h"
#include "DFWindow.h"
#include "DFHackAPI.h"
using namespace std;
using namespace DFHack;
#include "DFHackAPI_C.h"
#ifdef __cplusplus
extern "C" {
#endif
DFHackObject* API_Alloc(const char* path_to_xml)
{
DFHack::ContextManager* api = new DFHack::ContextManager(std::string(path_to_xml));
return (DFHackObject*)api;
}
//FIXME: X:\dfhack\DFHackAPI_C.cpp:56: warning: deleting `DFHackObject* ' is undefined
//DC: Yeah, I forgot that trying to delete a void pointer might be a bad idea. This works now.
void API_Free(DFHackObject* api)
{
if(api != NULL)
{
DFHack::ContextManager* a = (DFHack::ContextManager*)api;
delete a;
api = NULL;
}
}
int API_Attach(DFHackObject* api)
{
if(api != NULL)
{
return ((DFHack::ContextManager*)api)->Attach();
}
return -1;
}
int API_Detach(DFHackObject* api)
{
if(api != NULL)
{
return ((DFHack::ContextManager*)api)->Detach();
}
return -1;
}
int API_isAttached(DFHackObject* api)
{
if(api != NULL)
{
return ((DFHack::ContextManager*)api)->isAttached();
}
return -1;
}
int API_Suspend(DFHackObject* api)
{
if(api != NULL)
{
return ((DFHack::ContextManager*)api)->Suspend();
}
return -1;
}
int API_Resume(DFHackObject* api)
{
if(api != NULL)
{
return ((DFHack::ContextManager*)api)->Resume();
}
return -1;
}
int API_isSuspended(DFHackObject* api)
{
if(api != NULL)
{
return ((DFHack::ContextManager*)api)->isSuspended();
}
return -1;
}
int API_ForceResume(DFHackObject* api)
{
if(api != NULL)
{
return ((DFHack::ContextManager*)api)->ForceResume();
}
return -1;
}
int API_AsyncSuspend(DFHackObject* api)
{
if(api != NULL)
{
return ((DFHack::ContextManager*)api)->AsyncSuspend();
}
return -1;
}
//module getters
DFHackObject* API_getMemoryInfo(DFHackObject* api)
{
if(api != NULL)
{
return (DFHackObject*)((DFHack::ContextManager*)api)->getMemoryInfo();
}
return NULL;
}
DFHackObject* API_getProcess(DFHackObject* api)
{
if(api != NULL)
{
return (DFHackObject*)((DFHack::ContextManager*)api)->getProcess();
}
return NULL;
}
DFHackObject* API_getWindow(DFHackObject* api)
{
if(api != NULL)
{
return (DFHackObject*)((DFHack::ContextManager*)api)->getWindow();
}
return NULL;
}
DFHackObject* API_getCreatures(DFHackObject* api)
{
if(api != NULL)
{
return (DFHackObject*)((DFHack::ContextManager*)api)->getCreatures();
}
return NULL;
}
DFHackObject* API_getMaps(DFHackObject* api)
{
if(api != NULL)
{
return (DFHackObject*)((DFHack::ContextManager*)api)->getMaps();
}
return NULL;
}
DFHackObject* API_getGui(DFHackObject* api)
{
if(api != NULL)
{
return (DFHackObject*)((DFHack::ContextManager*)api)->getGui();
}
return NULL;
}
DFHackObject* API_getPosition(DFHackObject* api)
{
if(api != NULL)
{
return (DFHackObject*)((DFHack::ContextManager*)api)->getPosition();
}
return NULL;
}
DFHackObject* API_getMaterials(DFHackObject* api)
{
if(api != NULL)
{
return (DFHackObject*)((DFHack::ContextManager*)api)->getMaterials();
}
return NULL;
}
DFHackObject* API_getTranslation(DFHackObject* api)
{
if(api != NULL)
{
return (DFHackObject*)((DFHack::ContextManager*)api)->getTranslation();
}
return NULL;
}
DFHackObject* API_getVegetation(DFHackObject* api)
{
if(api != NULL)
{
return (DFHackObject*)((DFHack::ContextManager*)api)->getVegetation();
}
return NULL;
}
DFHackObject* API_getBuildings(DFHackObject* api)
{
if(api != NULL)
{
return (DFHackObject*)((DFHack::ContextManager*)api)->getBuildings();
}
return NULL;
}
DFHackObject* API_getConstructions(DFHackObject* api)
{
if(api != NULL)
{
return (DFHackObject*)((DFHack::ContextManager*)api)->getConstructions();
}
return NULL;
}
DFHackObject* API_getItems(DFHackObject* api)
{
if(api != NULL)
{
return (DFHackObject*)((DFHack::ContextManager*)api)->getItems();
}
return NULL;
}
void API_ReadRaw(DFHackObject* api, const uint32_t offset, const uint32_t size, uint8_t* target)
{
if(api != NULL)
{
((DFHack::ContextManager*)api)->ReadRaw(offset, size, target);
}
}
void API_WriteRaw(DFHackObject* api, const uint32_t offset, const uint32_t size, uint8_t* source)
{
if(api != NULL)
{
((DFHack::ContextManager*)api)->WriteRaw(offset, size, source);
}
}
#ifdef __cplusplus
}
#endif

@ -22,7 +22,7 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"
#include "dfhack/DFError.h" #include "dfhack/DFError.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"

@ -22,7 +22,7 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"
#include "dfhack/DFMemInfoManager.h" #include "dfhack/DFMemInfoManager.h"
#include "dfhack/DFError.h" #include "dfhack/DFError.h"

@ -21,9 +21,8 @@ must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source 3. This notice may not be removed or altered from any source
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
#include "dfhack/DFWindow.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"
#include "dfhack/DFError.h" #include "dfhack/DFError.h"
@ -53,7 +52,6 @@ class SHMProcess::Private
shm_addr = 0; shm_addr = 0;
//shm_addr_with_cl_idx = 0; //shm_addr_with_cl_idx = 0;
shm_ID = -1; shm_ID = -1;
window = NULL;
attached = false; attached = false;
identified = false; identified = false;
useYield = false; useYield = false;
@ -66,7 +64,6 @@ class SHMProcess::Private
}; };
~Private(){}; ~Private(){};
memory_info * memdescriptor; memory_info * memdescriptor;
DFWindow * window;
Process * self; Process * self;
pid_t process_ID; pid_t process_ID;
char *shm_addr; char *shm_addr;
@ -77,8 +74,6 @@ class SHMProcess::Private
int suspend_lock; int suspend_lock;
int attachmentIdx; int attachmentIdx;
bool attached; bool attached;
bool locked; bool locked;
bool identified; bool identified;
@ -290,8 +285,6 @@ SHMProcess::SHMProcess(uint32_t PID, vector< memory_info* >& known_versions)
// try to identify the DF version (md5 the binary, compare with known versions) // try to identify the DF version (md5 the binary, compare with known versions)
d->validate(known_versions); d->validate(known_versions);
d->window = new DFWindow(this);
// detach // detach
detach(); detach();
} }
@ -362,10 +355,6 @@ SHMProcess::~SHMProcess()
} }
if(d->memdescriptor) if(d->memdescriptor)
delete d->memdescriptor; delete d->memdescriptor;
if(d->window)
{
delete d->window;
}
delete d; delete d;
} }
@ -374,11 +363,6 @@ memory_info * SHMProcess::getDescriptor()
return d->memdescriptor; return d->memdescriptor;
} }
DFWindow * SHMProcess::getWindow()
{
return d->window;
}
int SHMProcess::getPID() int SHMProcess::getPID()
{ {
return d->process_ID; return d->process_ID;

@ -21,9 +21,8 @@ must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source 3. This notice may not be removed or altered from any source
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
#include "dfhack/DFWindow.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"
#include "dfhack/DFError.h" #include "dfhack/DFError.h"
#include <errno.h> #include <errno.h>
@ -38,7 +37,6 @@ class WineProcess::Private
{ {
my_descriptor = NULL; my_descriptor = NULL;
my_handle = NULL; my_handle = NULL;
my_window = NULL;
my_pid = 0; my_pid = 0;
attached = false; attached = false;
suspended = false; suspended = false;
@ -46,7 +44,6 @@ class WineProcess::Private
self = self_; self = self_;
}; };
~Private(){}; ~Private(){};
DFWindow* my_window;
memory_info * my_descriptor; memory_info * my_descriptor;
Process * self; Process * self;
pid_t my_handle; pid_t my_handle;
@ -108,7 +105,6 @@ WineProcess::WineProcess(uint32_t pid, vector <memory_info *> & known_versions)
// create wine process, add it to the vector // create wine process, add it to the vector
d->identified = d->validate(exe_link,pid,mem_name,known_versions); d->identified = d->validate(exe_link,pid,mem_name,known_versions);
d->my_window = new DFWindow(this);
return; return;
} }
} }
@ -174,8 +170,6 @@ WineProcess::~WineProcess()
// destroy our copy of the memory descriptor // destroy our copy of the memory descriptor
if(d->my_descriptor) if(d->my_descriptor)
delete d->my_descriptor; delete d->my_descriptor;
if(d->my_window)
delete d->my_window;
delete d; delete d;
} }
@ -184,11 +178,6 @@ memory_info * WineProcess::getDescriptor()
return d->my_descriptor; return d->my_descriptor;
} }
DFWindow * WineProcess::getWindow()
{
return d->my_window;
}
int WineProcess::getPID() int WineProcess::getPID()
{ {
return d->my_pid; return d->my_pid;
@ -513,7 +502,6 @@ void WineProcess::writeByte (uint32_t offset, uint8_t data)
// blah. I hate the kernel devs for crippling /proc/PID/mem. THIS IS RIDICULOUS // blah. I hate the kernel devs for crippling /proc/PID/mem. THIS IS RIDICULOUS
void WineProcess::write (uint32_t offset, uint32_t size, uint8_t *source) void WineProcess::write (uint32_t offset, uint32_t size, uint8_t *source)
{ {
uint32_t count = 0;
uint32_t indexptr = 0; uint32_t indexptr = 0;
while (size > 0) while (size > 0)
{ {

@ -21,9 +21,8 @@ must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source 3. This notice may not be removed or altered from any source
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
#include "dfhack/DFWindow.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"
#include "dfhack/DFError.h" #include "dfhack/DFError.h"
#include <errno.h> #include <errno.h>
@ -37,7 +36,6 @@ class NormalProcess::Private
{ {
my_descriptor = NULL; my_descriptor = NULL;
my_handle = NULL; my_handle = NULL;
my_window = NULL;
my_pid = 0; my_pid = 0;
attached = false; attached = false;
suspended = false; suspended = false;
@ -45,7 +43,7 @@ class NormalProcess::Private
self = self_; self = self_;
}; };
~Private(){}; ~Private(){};
DFWindow* my_window; Window* my_window;
memory_info * my_descriptor; memory_info * my_descriptor;
pid_t my_handle; pid_t my_handle;
uint32_t my_pid; uint32_t my_pid;
@ -92,7 +90,6 @@ NormalProcess::NormalProcess(uint32_t pid, vector< memory_info* >& known_version
{ {
// create linux process, add it to the vector // create linux process, add it to the vector
d->identified = d->validate(target_name,pid,mem_name,known_versions ); d->identified = d->validate(target_name,pid,mem_name,known_versions );
d->my_window = new DFWindow(this);
return; return;
} }
} }
@ -161,9 +158,6 @@ NormalProcess::~NormalProcess()
// destroy our copy of the memory descriptor // destroy our copy of the memory descriptor
if(d->my_descriptor) if(d->my_descriptor)
delete d->my_descriptor; delete d->my_descriptor;
// destroy data model. this is assigned by processmanager
if(d->my_window)
delete d->my_window;
delete d; delete d;
} }
@ -172,11 +166,6 @@ memory_info * NormalProcess::getDescriptor()
return d->my_descriptor; return d->my_descriptor;
} }
DFWindow * NormalProcess::getWindow()
{
return d->my_window;
}
int NormalProcess::getPID() int NormalProcess::getPID()
{ {
return d->my_pid; return d->my_pid;
@ -498,7 +487,6 @@ void NormalProcess::writeByte (uint32_t offset, uint8_t data)
// blah. I hate the kernel devs for crippling /proc/PID/mem. THIS IS RIDICULOUS // blah. I hate the kernel devs for crippling /proc/PID/mem. THIS IS RIDICULOUS
void NormalProcess::write (uint32_t offset, uint32_t size, uint8_t *source) void NormalProcess::write (uint32_t offset, uint32_t size, uint8_t *source)
{ {
uint32_t count = 0;
uint32_t indexptr = 0; uint32_t indexptr = 0;
while (size > 0) while (size > 0)
{ {

@ -21,7 +21,7 @@ must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source 3. This notice may not be removed or altered from any source
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
#include "dfhack/DFWindow.h" #include "dfhack/DFWindow.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"
@ -39,7 +39,6 @@ class SHMProcess::Private
memdescriptor = NULL; memdescriptor = NULL;
process_ID = 0; process_ID = 0;
shm_addr = 0; shm_addr = 0;
window = NULL;
attached = false; attached = false;
locked = false; locked = false;
identified = false; identified = false;
@ -51,7 +50,6 @@ class SHMProcess::Private
}; };
~Private(){}; ~Private(){};
memory_info * memdescriptor; memory_info * memdescriptor;
DFWindow * window;
SHMProcess * self; SHMProcess * self;
uint32_t process_ID; uint32_t process_ID;
char *shm_addr; char *shm_addr;
@ -300,7 +298,6 @@ SHMProcess::SHMProcess(uint32_t PID, vector <memory_info *> & known_versions)
throw Error::SHMVersionMismatch(); throw Error::SHMVersionMismatch();
} }
d->validate(known_versions); d->validate(known_versions);
d->window = new DFWindow(this);
// at this point, DF is attached and suspended, make it run // at this point, DF is attached and suspended, make it run
detach(); detach();
} }
@ -386,10 +383,6 @@ SHMProcess::~SHMProcess()
{ {
delete d->memdescriptor; delete d->memdescriptor;
} }
if(d->window)
{
delete d->window;
}
delete d; delete d;
} }
@ -398,11 +391,6 @@ memory_info * SHMProcess::getDescriptor()
return d->memdescriptor; return d->memdescriptor;
} }
DFWindow * SHMProcess::getWindow()
{
return d->window;
}
int SHMProcess::getPID() int SHMProcess::getPID()
{ {
return d->process_ID; return d->process_ID;

@ -21,7 +21,7 @@ must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source 3. This notice may not be removed or altered from any source
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
#include "dfhack/DFWindow.h" #include "dfhack/DFWindow.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"
@ -36,14 +36,12 @@ class NormalProcess::Private
my_descriptor = NULL; my_descriptor = NULL;
my_handle = NULL; my_handle = NULL;
my_main_thread = NULL; my_main_thread = NULL;
my_window = NULL;
my_pid = 0; my_pid = 0;
attached = false; attached = false;
suspended = false; suspended = false;
}; };
~Private(){}; ~Private(){};
memory_info * my_descriptor; memory_info * my_descriptor;
DFWindow * my_window;
HANDLE my_handle; HANDLE my_handle;
HANDLE my_main_thread; HANDLE my_main_thread;
uint32_t my_pid; uint32_t my_pid;
@ -147,10 +145,6 @@ NormalProcess::NormalProcess(uint32_t pid, vector <memory_info *> & known_versio
{ {
CloseHandle(hProcess); CloseHandle(hProcess);
} }
else
{
d->my_window = new DFWindow(this);
}
} }
/* /*
*/ */
@ -171,10 +165,6 @@ NormalProcess::~NormalProcess()
{ {
CloseHandle(d->my_main_thread); CloseHandle(d->my_main_thread);
} }
if(d->my_window)
{
delete d->my_window;
}
delete d; delete d;
} }
@ -183,11 +173,6 @@ memory_info * NormalProcess::getDescriptor()
return d->my_descriptor; return d->my_descriptor;
} }
DFWindow * NormalProcess::getWindow()
{
return d->my_window;
}
int NormalProcess::getPID() int NormalProcess::getPID()
{ {
return d->my_pid; return d->my_pid;

@ -22,7 +22,7 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/DFProcessEnumerator.h" #include "dfhack/DFProcessEnumerator.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"

@ -22,7 +22,7 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/DFProcessEnumerator.h" #include "dfhack/DFProcessEnumerator.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"

@ -1,29 +0,0 @@
/*
www.sourceforge.net/projects/dfhack
Copyright (c) 2009 Petr Mrázek (peterix), Kenneth Ferland (Impaler[WrG]), dorf
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#include "dfhack/DFCommonInternal.h"
#include "dfhack/DFTileTypes.h"
using namespace DFHack;

@ -30,7 +30,7 @@ distribution.
using namespace std; using namespace std;
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/DFTypes.h" #include "dfhack/DFTypes.h"
#include "dfhack-c/DFTypes_C.h" #include "dfhack-c/DFTypes_C.h"
#include "dfhack/modules/Materials.h" #include "dfhack/modules/Materials.h"

@ -1,31 +0,0 @@
/*
www.sourceforge.net/projects/dfhack
Copyright (c) 2009 Petr Mrázek (peterix), Kenneth Ferland (Impaler[WrG]), dorf
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#include "dfhack/DFPragma.h"
#include "dfhack/DFCommonInternal.h"
#include "dfhack/DFMemInfo.h"
#include "dfhack/DFProcess.h"
#include "dfhack/DFVector.h"
using namespace DFHack;

@ -4,7 +4,6 @@
#include "dfhack/DFIntegers.h" #include "dfhack/DFIntegers.h"
#include "dfhack/DFGlobal.h" #include "dfhack/DFGlobal.h"
#include "dfhack/DFError.h" #include "dfhack/DFError.h"
#include "dfhack/DFTypes.h"
#include "dfhack/DFContextManager.h" #include "dfhack/DFContextManager.h"
#include "dfhack/DFContext.h" #include "dfhack/DFContext.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"

@ -27,7 +27,7 @@ distribution.
#include "dfhack/DFExport.h" #include "dfhack/DFExport.h"
#include "dfhack/DFIntegers.h" #include "dfhack/DFIntegers.h"
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
using namespace DFHack; using namespace DFHack;

@ -41,7 +41,9 @@ namespace DFHack
class Buildings; class Buildings;
class Constructions; class Constructions;
class memory_info; class memory_info;
class DFContextPrivate; class DFContextShared;
class WindowIO;
class Process;
class DFHACK_EXPORT Context class DFHACK_EXPORT Context
{ {
@ -69,7 +71,6 @@ namespace DFHack
bool ForceResume(); bool ForceResume();
memory_info *getMemoryInfo(); memory_info *getMemoryInfo();
DFWindow * getWindow();
Process* getProcess(); Process* getProcess();
void ReadRaw (const uint32_t offset, const uint32_t size, uint8_t *target); void ReadRaw (const uint32_t offset, const uint32_t size, uint8_t *target);
@ -108,6 +109,9 @@ namespace DFHack
// get the constructions module // get the constructions module
Constructions * getConstructions(); Constructions * getConstructions();
// get the Window management and I/O module
WindowIO * getWindow();
/* /*
* Effects like mist, dragonfire or dust * Effects like mist, dragonfire or dust
*/ */
@ -167,7 +171,7 @@ namespace DFHack
*/ */
//bool ReadItemTypes(std::vector< std::vector< t_itemType > > & itemTypes); //bool ReadItemTypes(std::vector< std::vector< t_itemType > > & itemTypes);
private: private:
DFContextPrivate * d; DFContextShared * d;
}; };
} }
#endif //CONTEXT_H_INCLUDED #endif //CONTEXT_H_INCLUDED

@ -25,15 +25,12 @@ distribution.
#ifndef CONTEXTMANAGER_H_INCLUDED #ifndef CONTEXTMANAGER_H_INCLUDED
#define CONTEXTMANAGER_H_INCLUDED #define CONTEXTMANAGER_H_INCLUDED
#include "DFPragma.h" #include "DFPragma.h"
#include "DFExport.h" #include "DFExport.h"
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>
#include "DFIntegers.h"
#include "DFTileTypes.h"
#include "DFTypes.h"
#include "DFWindow.h"
namespace DFHack namespace DFHack
{ {

@ -33,7 +33,7 @@ namespace DFHack
{ {
class memory_info; class memory_info;
class Process; class Process;
class DFWindow; class Window;
// structure describing a memory range // structure describing a memory range
struct DFHACK_EXPORT t_memrange struct DFHACK_EXPORT t_memrange
@ -122,8 +122,6 @@ namespace DFHack
// get the flattened Memory.xml entry of this process // get the flattened Memory.xml entry of this process
virtual memory_info *getDescriptor() = 0; virtual memory_info *getDescriptor() = 0;
// get the DF's window (first that can be found ~_~)
virtual DFWindow * getWindow() = 0;
// get the DF Process ID // get the DF Process ID
virtual int getPID() = 0; virtual int getPID() = 0;
// get module index by name and version. bool 1 = error // get module index by name and version. bool 1 = error
@ -195,7 +193,6 @@ namespace DFHack
bool getThreadIDs(vector<uint32_t> & threads ); bool getThreadIDs(vector<uint32_t> & threads );
void getMemRanges( vector<t_memrange> & ranges ); void getMemRanges( vector<t_memrange> & ranges );
memory_info *getDescriptor(); memory_info *getDescriptor();
DFWindow * getWindow();
int getPID(); int getPID();
// get module index by name and version. bool 1 = error // get module index by name and version. bool 1 = error
bool getModuleIndex (const char * name, const uint32_t version, uint32_t & OUTPUT) { OUTPUT=0; return false;}; bool getModuleIndex (const char * name, const uint32_t version, uint32_t & OUTPUT) { OUTPUT=0; return false;};
@ -267,7 +264,6 @@ namespace DFHack
bool getThreadIDs(vector<uint32_t> & threads ); bool getThreadIDs(vector<uint32_t> & threads );
void getMemRanges( vector<t_memrange> & ranges ); void getMemRanges( vector<t_memrange> & ranges );
memory_info *getDescriptor(); memory_info *getDescriptor();
DFWindow * getWindow();
int getPID(); int getPID();
// get module index by name and version. bool 1 = error // get module index by name and version. bool 1 = error
bool getModuleIndex (const char * name, const uint32_t version, uint32_t & OUTPUT); bool getModuleIndex (const char * name, const uint32_t version, uint32_t & OUTPUT);
@ -338,7 +334,6 @@ namespace DFHack
bool getThreadIDs(vector<uint32_t> & threads ); bool getThreadIDs(vector<uint32_t> & threads );
void getMemRanges( vector<t_memrange> & ranges ); void getMemRanges( vector<t_memrange> & ranges );
memory_info *getDescriptor(); memory_info *getDescriptor();
DFWindow * getWindow();
int getPID(); int getPID();
// get module index by name and version. bool 1 = error // get module index by name and version. bool 1 = error
bool getModuleIndex (const char * name, const uint32_t version, uint32_t & OUTPUT) {OUTPUT=0; return false;}; bool getModuleIndex (const char * name, const uint32_t version, uint32_t & OUTPUT) {OUTPUT=0; return false;};

@ -25,11 +25,11 @@ namespace DFHack
// FIXME: not complete, we need building presence bitmaps for stuff like farm plots and stockpiles, orientation (N,E,S,W) and state (open/closed) // FIXME: not complete, we need building presence bitmaps for stuff like farm plots and stockpiles, orientation (N,E,S,W) and state (open/closed)
}; };
class DFContextPrivate; class DFContextShared;
class DFHACK_EXPORT Buildings class DFHACK_EXPORT Buildings
{ {
public: public:
Buildings(DFContextPrivate * d); Buildings(DFContextShared * d);
~Buildings(); ~Buildings();
bool Start(uint32_t & numBuildings); bool Start(uint32_t & numBuildings);
// read one building at offset // read one building at offset

@ -39,11 +39,11 @@ namespace DFHack
uint32_t origin; uint32_t origin;
}; };
#pragma pack (pop) #pragma pack (pop)
class DFContextPrivate; class DFContextShared;
class DFHACK_EXPORT Constructions class DFHACK_EXPORT Constructions
{ {
public: public:
Constructions(DFContextPrivate * d); Constructions(DFContextShared * d);
~Constructions(); ~Constructions();
bool Start(uint32_t & numConstructions); bool Start(uint32_t & numConstructions);
bool Read (const uint32_t index, t_construction & constr); bool Read (const uint32_t index, t_construction & constr);

@ -353,12 +353,12 @@ namespace DFHack
uint32_t birth_time; uint32_t birth_time;
}; };
class DFContextPrivate; class DFContextShared;
struct t_creature; struct t_creature;
class DFHACK_EXPORT Creatures class DFHACK_EXPORT Creatures
{ {
public: public:
Creatures(DFHack::DFContextPrivate * d); Creatures(DFHack::DFContextShared * d);
~Creatures(); ~Creatures();
bool Start( uint32_t & numCreatures); bool Start( uint32_t & numCreatures);
bool Finish(); bool Finish();

@ -8,13 +8,13 @@
namespace DFHack namespace DFHack
{ {
class DFContextPrivate; class DFContextShared;
struct t_viewscreen; struct t_viewscreen;
class DFHACK_EXPORT Gui class DFHACK_EXPORT Gui
{ {
public: public:
Gui(DFHack::DFContextPrivate * d); Gui(DFHack::DFContextShared * d);
~Gui(); ~Gui();
bool Start(); bool Start();
bool Finish(); bool Finish();

@ -8,7 +8,7 @@ namespace DFHack
{ {
class Context; class Context;
class DFContextPrivate; class DFContextShared;
enum accessor_type {ACCESSOR_CONSTANT, ACCESSOR_INDIRECT, ACCESSOR_DOUBLE_INDIRECT}; enum accessor_type {ACCESSOR_CONSTANT, ACCESSOR_INDIRECT, ACCESSOR_DOUBLE_INDIRECT};
@ -77,7 +77,7 @@ public:
class DFHACK_EXPORT Items class DFHACK_EXPORT Items
{ {
public: public:
Items(DFContextPrivate * _d); Items(DFContextShared * _d);
~Items(); ~Items();
std::string getItemDescription(uint32_t itemptr, Materials * Materials); std::string getItemDescription(uint32_t itemptr, Materials * Materials);
std::string getItemClass(int32_t index); std::string getItemClass(int32_t index);

@ -255,13 +255,13 @@ namespace DFHack
C L I E N T M O D U L E C L I E N T M O D U L E
***************************************************************************/ ***************************************************************************/
class DFContextPrivate; class DFContextShared;
struct t_viewscreen; struct t_viewscreen;
class DFHACK_EXPORT Maps class DFHACK_EXPORT Maps
{ {
public: public:
Maps(DFHack::DFContextPrivate * d); Maps(DFHack::DFContextShared * d);
~Maps(); ~Maps();
bool Start(); bool Start();
bool Finish(); bool Finish();

@ -6,7 +6,7 @@
#include "dfhack/DFExport.h" #include "dfhack/DFExport.h"
namespace DFHack namespace DFHack
{ {
class DFContextPrivate; class DFContextShared;
struct t_matgloss struct t_matgloss
{ {
@ -119,7 +119,7 @@ namespace DFHack
class DFHACK_EXPORT Materials class DFHACK_EXPORT Materials
{ {
public: public:
Materials(DFHack::DFContextPrivate * _d); Materials(DFHack::DFContextShared * _d);
~Materials(); ~Materials();
std::vector<t_matgloss> inorganic; std::vector<t_matgloss> inorganic;

@ -16,12 +16,12 @@ namespace DFHack
int32_t z; int32_t z;
}; };
class DFContextPrivate; class DFContextShared;
class DFHACK_EXPORT Position class DFHACK_EXPORT Position
{ {
public: public:
Position(DFContextPrivate * d); Position(DFContextShared * d);
~Position(); ~Position();
/* /*
* Cursor and window coords * Cursor and window coords

@ -6,7 +6,7 @@
#include "dfhack/DFExport.h" #include "dfhack/DFExport.h"
namespace DFHack namespace DFHack
{ {
class DFContextPrivate; class DFContextShared;
typedef std::vector< std::vector<std::string> > DFDict; typedef std::vector< std::vector<std::string> > DFDict;
typedef struct typedef struct
{ {
@ -17,7 +17,7 @@ namespace DFHack
class DFHACK_EXPORT Translation class DFHACK_EXPORT Translation
{ {
public: public:
Translation(DFContextPrivate * d); Translation(DFContextShared * d);
~Translation(); ~Translation();
bool Start(); bool Start();
bool Finish(); bool Finish();

@ -27,11 +27,11 @@ namespace DFHack
uint32_t address; uint32_t address;
}; };
class DFContextPrivate; class DFContextShared;
class DFHACK_EXPORT Vegetation class DFHACK_EXPORT Vegetation
{ {
public: public:
Vegetation(DFContextPrivate * d); Vegetation(DFContextShared * d);
~Vegetation(); ~Vegetation();
bool Start(uint32_t & numTrees); bool Start(uint32_t & numTrees);
bool Read (const uint32_t index, t_tree & shrubbery); bool Read (const uint32_t index, t_tree & shrubbery);

@ -25,8 +25,8 @@ distribution.
#ifndef KEYS_H_INCLUDED #ifndef KEYS_H_INCLUDED
#define KEYS_H_INCLUDED #define KEYS_H_INCLUDED
#include "DFPragma.h" #include "dfhack/DFPragma.h"
#include "DFExport.h" #include "dfhack/DFExport.h"
namespace DFHack namespace DFHack
{ {
@ -87,15 +87,15 @@ enum t_special
KEYPAD_DECIMAL_POINT, KEYPAD_DECIMAL_POINT,
NUM_SPECIALS NUM_SPECIALS
}; };
class DFContextShared;
class DFHACK_EXPORT DFWindow class DFHACK_EXPORT WindowIO
{ {
class Private; class Private;
private: private:
Private * d; Private * d;
public: public:
DFWindow(Process * p); WindowIO(DFHack::DFContextShared * d);
~DFWindow(); ~WindowIO();
void TypeStr (const char *input, int delay = 0, bool useShift = false); void TypeStr (const char *input, int delay = 0, bool useShift = false);
void TypeSpecial (t_special command, int count = 1, int delay = 0); void TypeSpecial (t_special command, int count = 1, int delay = 0);
}; };

@ -8,12 +8,12 @@
namespace DFHack namespace DFHack
{ {
class DFContextPrivate; class DFContextShared;
class DFHACK_EXPORT World class DFHACK_EXPORT World
{ {
public: public:
World(DFHack::DFContextPrivate * d); World(DFHack::DFContextShared * d);
~World(); ~World();
bool Start(); bool Start();
bool Finish(); bool Finish();

@ -22,8 +22,8 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "../private/APIPrivate.h" #include "ContextShared.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
@ -59,13 +59,13 @@ struct Buildings::Private
uint32_t custom_workshop_name; uint32_t custom_workshop_name;
int32_t custom_workshop_id; int32_t custom_workshop_id;
DfVector <uint32_t> * p_bld; DfVector <uint32_t> * p_bld;
DFContextPrivate *d; DFContextShared *d;
Process * owner; Process * owner;
bool Inited; bool Inited;
bool Started; bool Started;
}; };
Buildings::Buildings(DFContextPrivate * d_) Buildings::Buildings(DFContextShared * d_)
{ {
d = new Private; d = new Private;
d->d = d_; d->d = d_;

@ -29,7 +29,7 @@ distribution.
using namespace std; using namespace std;
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/DFTypes.h" #include "dfhack/DFTypes.h"
#include "dfhack/modules/Buildings.h" #include "dfhack/modules/Buildings.h"
#include "dfhack-c/modules/Buildings_C.h" #include "dfhack-c/modules/Buildings_C.h"

@ -22,9 +22,9 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "../private/APIPrivate.h" #include "ContextShared.h"
//#include "modules/Translation.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
#include "dfhack/DFVector.h" #include "dfhack/DFVector.h"
@ -39,13 +39,13 @@ struct Constructions::Private
// translation // translation
DfVector <uint32_t> * p_cons; DfVector <uint32_t> * p_cons;
DFContextPrivate *d; DFContextShared *d;
Process * owner; Process * owner;
bool Inited; bool Inited;
bool Started; bool Started;
}; };
Constructions::Constructions(DFContextPrivate * d_) Constructions::Constructions(DFContextShared * d_)
{ {
d = new Private; d = new Private;
d->d = d_; d->d = d_;

@ -24,7 +24,7 @@ distribution.
#include "dfhack/DFIntegers.h" #include "dfhack/DFIntegers.h"
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/DFTypes.h" #include "dfhack/DFTypes.h"
#include "dfhack/modules/Constructions.h" #include "dfhack/modules/Constructions.h"
#include "dfhack-c/modules/Constructions_C.h" #include "dfhack-c/modules/Constructions_C.h"

@ -22,8 +22,8 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "../private/APIPrivate.h" #include "ContextShared.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
@ -55,11 +55,11 @@ struct Creatures::Private
uint32_t dwarf_race_index_addr; uint32_t dwarf_race_index_addr;
uint32_t dwarf_civ_id_addr; uint32_t dwarf_civ_id_addr;
DfVector <uint32_t> *p_cre; DfVector <uint32_t> *p_cre;
DFContextPrivate *d; DFContextShared *d;
Process *owner; Process *owner;
}; };
Creatures::Creatures(DFContextPrivate* _d) Creatures::Creatures(DFContextShared* _d)
{ {
d = new Private; d = new Private;
d->d = _d; d->d = _d;

@ -22,8 +22,8 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "../private/APIPrivate.h" #include "ContextShared.h"
#include "dfhack/modules/Gui.h" #include "dfhack/modules/Gui.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"
@ -39,11 +39,11 @@ struct Gui::Private
uint32_t view_screen_offset; uint32_t view_screen_offset;
uint32_t current_cursor_creature_offset; uint32_t current_cursor_creature_offset;
uint32_t current_menu_state_offset; uint32_t current_menu_state_offset;
DFContextPrivate *d; DFContextShared *d;
Process * owner; Process * owner;
}; };
Gui::Gui(DFContextPrivate * _d) Gui::Gui(DFContextShared * _d)
{ {
d = new Private; d = new Private;

@ -27,7 +27,7 @@ distribution.
#include "dfhack-c/modules/Gui_C.h" #include "dfhack-c/modules/Gui_C.h"
#include "dfhack/DFIntegers.h" #include "dfhack/DFIntegers.h"
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/modules/Gui.h" #include "dfhack/modules/Gui.h"
using namespace DFHack; using namespace DFHack;
@ -68,7 +68,7 @@ int Gui_ReadPauseState(DFHackObject* gui)
int Gui_ReadViewScreen(DFHackObject* gui, t_viewscreen* viewscreen) int Gui_ReadViewScreen(DFHackObject* gui, t_viewscreen* viewscreen)
{ {
int result; //int result;
if(gui != NULL) if(gui != NULL)
{ {

@ -22,8 +22,8 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "../private/APIPrivate.h" #include "ContextShared.h"
#include "dfhack/DFTypes.h" #include "dfhack/DFTypes.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
@ -36,7 +36,7 @@ using namespace DFHack;
class Items::Private class Items::Private
{ {
public: public:
DFContextPrivate *d; DFContextShared *d;
Process * owner; Process * owner;
/* /*
bool Inited; bool Inited;
@ -44,7 +44,7 @@ class Items::Private
*/ */
}; };
Items::Items(DFContextPrivate * d_) Items::Items(DFContextShared * d_)
{ {
d = new Private; d = new Private;
d->d = d_; d->d = d_;

@ -22,11 +22,11 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include <shms.h> #include <shms.h>
#include <mod-core.h> #include <mod-core.h>
#include <mod-maps.h> #include <mod-maps.h>
#include "../private/APIPrivate.h" #include "ContextShared.h"
#include "dfhack/modules/Maps.h" #include "dfhack/modules/Maps.h"
#include "dfhack/DFError.h" #include "dfhack/DFError.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"
@ -50,7 +50,7 @@ struct Maps::Private
uint32_t maps_module; uint32_t maps_module;
Server::Maps::maps_offsets offsets; Server::Maps::maps_offsets offsets;
DFContextPrivate *d; DFContextShared *d;
Process * owner; Process * owner;
bool Inited; bool Inited;
bool Started; bool Started;
@ -61,7 +61,7 @@ struct Maps::Private
vector<uint16_t> v_geology[eBiomeCount]; vector<uint16_t> v_geology[eBiomeCount];
}; };
Maps::Maps(DFContextPrivate* _d) Maps::Maps(DFContextShared* _d)
{ {
d = new Private; d = new Private;
d->d = _d; d->d = _d;

@ -29,7 +29,7 @@ distribution.
using namespace std; using namespace std;
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/DFTypes.h" #include "dfhack/DFTypes.h"
#include "dfhack/modules/Maps.h" #include "dfhack/modules/Maps.h"
#include "dfhack-c/modules/Maps_C.h" #include "dfhack-c/modules/Maps_C.h"

@ -22,8 +22,8 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "../private/APIPrivate.h" #include "ContextShared.h"
#include "dfhack/DFTypes.h" #include "dfhack/DFTypes.h"
#include "dfhack/modules/Materials.h" #include "dfhack/modules/Materials.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"
@ -35,7 +35,7 @@ using namespace DFHack;
class Materials::Private class Materials::Private
{ {
public: public:
DFContextPrivate *d; DFContextShared *d;
Process * owner; Process * owner;
/* /*
bool Inited; bool Inited;
@ -43,7 +43,7 @@ class Materials::Private
*/ */
}; };
Materials::Materials(DFContextPrivate * d_) Materials::Materials(DFContextShared * d_)
{ {
d = new Private; d = new Private;
d->d = d_; d->d = d_;

@ -29,7 +29,7 @@ distribution.
using namespace std; using namespace std;
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/DFTypes.h" #include "dfhack/DFTypes.h"
#include "dfhack/modules/Materials.h" #include "dfhack/modules/Materials.h"
#include "dfhack-c/DFTypes_C.h" #include "dfhack-c/DFTypes_C.h"

@ -22,8 +22,8 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "../private/APIPrivate.h" #include "ContextShared.h"
#include "dfhack/modules/Position.h" #include "dfhack/modules/Position.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
@ -42,14 +42,14 @@ struct Position::Private
uint32_t hotkey_xyz_offset; uint32_t hotkey_xyz_offset;
uint32_t hotkey_size; uint32_t hotkey_size;
DFContextPrivate *d; DFContextShared *d;
Process * owner; Process * owner;
bool Inited; bool Inited;
bool Started; bool Started;
bool StartedHotkeys; bool StartedHotkeys;
}; };
Position::Position(DFContextPrivate * d_) Position::Position(DFContextShared * d_)
{ {
d = new Private; d = new Private;
d->d = d_; d->d = d_;

@ -27,7 +27,7 @@ distribution.
#include "dfhack-c/modules/Position_C.h" #include "dfhack-c/modules/Position_C.h"
#include "dfhack/DFIntegers.h" #include "dfhack/DFIntegers.h"
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/modules/Position.h" #include "dfhack/modules/Position.h"
using namespace DFHack; using namespace DFHack;

@ -22,8 +22,8 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "../private/APIPrivate.h" #include "ContextShared.h"
#include "dfhack/modules/Translation.h" #include "dfhack/modules/Translation.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
@ -42,12 +42,12 @@ struct Translation::Private
// translation // translation
Dicts dicts; Dicts dicts;
DFContextPrivate *d; DFContextShared *d;
bool Inited; bool Inited;
bool Started; bool Started;
}; };
Translation::Translation(DFContextPrivate * d_) Translation::Translation(DFContextShared * d_)
{ {
d = new Private; d = new Private;
d->d = d_; d->d = d_;

@ -27,7 +27,7 @@ distribution.
using namespace std; using namespace std;
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/DFTypes.h" #include "dfhack/DFTypes.h"
#include "dfhack/modules/Translation.h" #include "dfhack/modules/Translation.h"
#include "dfhack-c/modules/Translation_C.h" #include "dfhack-c/modules/Translation_C.h"

@ -22,8 +22,8 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "../private/APIPrivate.h" #include "ContextShared.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
@ -41,13 +41,13 @@ struct Vegetation::Private
// translation // translation
DfVector <uint32_t> * p_veg; DfVector <uint32_t> * p_veg;
DFContextPrivate *d; DFContextShared *d;
Process * owner; Process * owner;
bool Inited; bool Inited;
bool Started; bool Started;
}; };
Vegetation::Vegetation(DFContextPrivate * d_) Vegetation::Vegetation(DFContextShared * d_)
{ {
d = new Private; d = new Private;
d->owner = d_->p; d->owner = d_->p;

@ -23,7 +23,7 @@ distribution.
*/ */
#include "dfhack/DFIntegers.h" #include "dfhack/DFIntegers.h"
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/DFTypes.h" #include "dfhack/DFTypes.h"
#include "dfhack/modules/Vegetation.h" #include "dfhack/modules/Vegetation.h"
#include "dfhack-c/modules/Vegetation_C.h" #include "dfhack-c/modules/Vegetation_C.h"

@ -21,11 +21,12 @@ must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source 3. This notice may not be removed or altered from any source
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/DFWindow.h" #include "dfhack/modules/WindowIO.h"
#include <X11/Xlib.h> //need for X11 functions #include <X11/Xlib.h> //need for X11 functions
#include <X11/keysym.h> #include <X11/keysym.h>
#include <ContextShared.h>
using namespace DFHack; using namespace DFHack;
@ -84,7 +85,7 @@ const static KeySym ksTable[NUM_SPECIALS]=
XK_KP_Decimal XK_KP_Decimal
}; };
class DFWindow::Private class WindowIO::Private
{ {
public: public:
Private(Process * _p) Private(Process * _p)
@ -111,18 +112,18 @@ class DFWindow::Private
}; };
// ctor // ctor
DFWindow::DFWindow (Process * p) WindowIO::WindowIO (DFContextShared * csh)
{ {
d = new Private(p); d = new Private(csh->p);
} }
// dtor // dtor
DFWindow::~DFWindow () WindowIO::~WindowIO ()
{ {
delete d; delete d;
} }
Window DFWindow::Private::EnumerateWindows (Display *display, Window rootWindow, const char *searchString) Window WindowIO::Private::EnumerateWindows (Display *display, Window rootWindow, const char *searchString)
{ {
Window parent; Window parent;
Window *children; Window *children;
@ -161,7 +162,7 @@ Window DFWindow::Private::EnumerateWindows (Display *display, Window rootWindow,
return retWindow; return retWindow;
} }
bool DFWindow::Private::getDFWindow (Display *dpy, Window& dfWindow, Window & rootWindow) bool WindowIO::Private::getDFWindow (Display *dpy, Window& dfWindow, Window & rootWindow)
{ {
// int numScreeens = ScreenCount(dpy); // int numScreeens = ScreenCount(dpy);
for (int i = 0;i < ScreenCount (dpy);i++) for (int i = 0;i < ScreenCount (dpy);i++)
@ -177,7 +178,7 @@ bool DFWindow::Private::getDFWindow (Display *dpy, Window& dfWindow, Window & ro
return false; return false;
} }
void DFWindow::Private::send_xkeyevent(Display *display, Window dfW,Window rootW, int keycode, int modstate, int is_press, useconds_t delay) void WindowIO::Private::send_xkeyevent(Display *display, Window dfW,Window rootW, int keycode, int modstate, int is_press, useconds_t delay)
{ {
XKeyEvent event; XKeyEvent event;
@ -199,7 +200,7 @@ void DFWindow::Private::send_xkeyevent(Display *display, Window dfW,Window rootW
usleep(delay); usleep(delay);
} }
void DFWindow::TypeStr (const char *input, int delay, bool useShift) void WindowIO::TypeStr (const char *input, int delay, bool useShift)
{ {
Display *dpy = XOpenDisplay (NULL); // null opens the display in $DISPLAY Display *dpy = XOpenDisplay (NULL); // null opens the display in $DISPLAY
Window dfWin; Window dfWin;
@ -234,7 +235,7 @@ void DFWindow::TypeStr (const char *input, int delay, bool useShift)
} }
} }
void DFWindow::TypeSpecial (t_special command, int count, int delay) void WindowIO::TypeSpecial (t_special command, int count, int delay)
{ {
if (command != WAIT) if (command != WAIT)
{ {

@ -22,8 +22,9 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "dfhack/DFWindow.h" #include "ContextShared.h"
#include "dfhack/modules/WindowIO.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
using namespace DFHack; using namespace DFHack;
@ -101,7 +102,7 @@ BOOL CALLBACK EnumWindowsProc (HWND hwnd, LPARAM lParam)
return TRUE; return TRUE;
} }
class DFWindow::Private class WindowIO::Private
{ {
public: public:
Private(Process * _p) Private(Process * _p)
@ -114,19 +115,19 @@ class DFWindow::Private
}; };
// ctor // ctor
DFWindow::DFWindow (Process * p) WindowIO::WindowIO (DFContextShared * schr)
{ {
d = new Private(p); d = new Private(schr->p);
} }
// dtor // dtor
DFWindow::~DFWindow () WindowIO::~WindowIO ()
{ {
delete d; delete d;
} }
// TODO: also investigate possible problems with UIPI on Vista and 7 // TODO: also investigate possible problems with UIPI on Vista and 7
void DFWindow::TypeStr (const char *input, int delay, bool useShift) void WindowIO::TypeStr (const char *input, int delay, bool useShift)
{ {
//sendmessage needs a window handle HWND, so have to get that from the process HANDLE //sendmessage needs a window handle HWND, so have to get that from the process HANDLE
HWND currentWindow = GetForegroundWindow(); HWND currentWindow = GetForegroundWindow();
@ -163,7 +164,7 @@ void DFWindow::TypeStr (const char *input, int delay, bool useShift)
Sleep (delay); Sleep (delay);
} }
void DFWindow::TypeSpecial (t_special command, int count, int delay) void WindowIO::TypeSpecial (t_special command, int count, int delay)
{ {
if (command != WAIT) if (command != WAIT)
{ {

@ -34,8 +34,8 @@ FIXME: Japa said that he had to do this with the time stuff he got from here
currentTickRel = (currentTick+9)-(((((currentMonth*28)+currentDay)*24)+currentHour)*50); currentTickRel = (currentTick+9)-(((((currentMonth*28)+currentDay)*24)+currentHour)*50);
*/ */
#include "dfhack/DFCommonInternal.h" #include "Internal.h"
#include "../private/APIPrivate.h" #include "ContextShared.h"
#include "dfhack/modules/World.h" #include "dfhack/modules/World.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
#include "dfhack/DFMemInfo.h" #include "dfhack/DFMemInfo.h"
@ -49,11 +49,11 @@ struct World::Private
bool Started; bool Started;
uint32_t year_offset; uint32_t year_offset;
uint32_t tick_offset; uint32_t tick_offset;
DFContextPrivate *d; DFContextShared *d;
Process * owner; Process * owner;
}; };
World::World(DFContextPrivate * _d) World::World(DFContextShared * _d)
{ {
d = new Private; d = new Private;

@ -42,15 +42,16 @@ namespace DFHack
class Buildings; class Buildings;
class ProcessEnumerator; class ProcessEnumerator;
class Process; class Process;
class WindowIO;
class Vegetation; class Vegetation;
class Constructions; class Constructions;
class memory_info; class memory_info;
struct t_name; struct t_name;
class DFContextPrivate class DFContextShared
{ {
public: public:
DFContextPrivate(); DFContextShared();
~DFContextPrivate(); ~DFContextShared();
// names, used by a few other modules. // names, used by a few other modules.
void readName(t_name & name, uint32_t address); void readName(t_name & name, uint32_t address);
@ -79,6 +80,7 @@ namespace DFHack
Vegetation * vegetation; Vegetation * vegetation;
Buildings * buildings; Buildings * buildings;
Constructions * constructions; Constructions * constructions;
WindowIO * windowio;
/* /*
uint32_t item_material_offset; uint32_t item_material_offset;

@ -41,10 +41,10 @@ distribution.
#endif #endif
// one file for globals // one file for globals
#include "DFGlobal.h" #include "dfhack/DFGlobal.h"
// one file for telling the MSVC compiler where it can shove its pointless warnings // one file for telling the MSVC compiler where it can shove its pointless warnings
#include "DFPragma.h" #include "dfhack/DFPragma.h"
// basic stl containers and IO stuff // basic stl containers and IO stuff
#include <string> #include <string>
@ -55,7 +55,7 @@ distribution.
using namespace std; using namespace std;
// C99 integer types // C99 integer types
#include "DFIntegers.h" #include "dfhack/DFIntegers.h"
// C includes // C includes
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>

@ -1,54 +0,0 @@
# don't use this file directly. use the one in the root folder of the project
SET(PROJECT_HDRS
shms.h
mod-core.h
mod-maps.h
)
SET(PROJECT_SRCS
mod-core.cpp
mod-maps.cpp
#mod-creature40d.cpp
)
SET(PROJECT_HDRS_LINUX
)
SET(PROJECT_HDRS_WINDOWS
)
SET(PROJECT_SRCS_LINUX
shms-linux.cpp
)
SET(PROJECT_SRCS_WINDOWS
shms-windows.cpp
)
IF(UNIX)
LIST(APPEND PROJECT_HDRS ${PROJECT_HDRS_LINUX})
LIST(APPEND PROJECT_SRCS ${PROJECT_SRCS_LINUX})
ELSE(UNIX)
LIST(APPEND PROJECT_HDRS ${PROJECT_HDRS_WINDOWS})
LIST(APPEND PROJECT_SRCS ${PROJECT_SRCS_WINDOWS})
ENDIF(UNIX)
SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE )
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS})
#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)

@ -16,6 +16,8 @@ using namespace std;
#include <math.h> #include <math.h>
#include <DFHack.h> #include <DFHack.h>
#include <dfhack/DFTileTypes.h>
using namespace DFHack; using namespace DFHack;

@ -13,6 +13,7 @@
using namespace std; using namespace std;
#include <DFHack.h> #include <DFHack.h>
#include <dfhack/DFTileTypes.h>
#include <argstream.h> #include <argstream.h>
// counts the occurances of a certain element in a vector // counts the occurances of a certain element in a vector

@ -20,8 +20,10 @@
#include <algorithm> #include <algorithm>
#include <assert.h> #include <assert.h>
using namespace std; using namespace std;
#include <argstream.h> #include <argstream.h>
#include <DFHack.h> #include <DFHack.h>
#include <dfhack/DFTileTypes.h>
#define BLOCK_SIZE 16 #define BLOCK_SIZE 16

@ -7,6 +7,7 @@
using namespace std; using namespace std;
#include <DFHack.h> #include <DFHack.h>
#include <dfhack/DFTileTypes.h>
int main (void) int main (void)
{ {

@ -10,6 +10,7 @@
using namespace std; using namespace std;
#include <DFHack.h> #include <DFHack.h>
#include <dfhack/DFTileTypes.h>
using namespace DFHack; using namespace DFHack;
int main (int numargs, const char ** args) int main (int numargs, const char ** args)

@ -16,6 +16,7 @@
using namespace std; using namespace std;
#include <DFHack.h> #include <DFHack.h>
#include <dfhack/DFTileTypes.h>
int main (int argc, const char* argv[]) int main (int argc, const char* argv[])
{ {

@ -9,6 +9,7 @@
using namespace std; using namespace std;
#include <DFHack.h> #include <DFHack.h>
#include <dfhack/DFTileTypes.h>
#include <argstream.h> #include <argstream.h>
#define MAX_DIM 0x300 #define MAX_DIM 0x300