Moving stuff around, part 2
parent
9bd6bb5b2d
commit
b710ed687a
@ -1,73 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef DFHACK_C_API
|
|
||||||
#define DFHACK_C_API
|
|
||||||
|
|
||||||
#include "Export.h"
|
|
||||||
#include "integers.h"
|
|
||||||
|
|
||||||
typedef void DFHackObject;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DFHACK_EXPORT DFHackObject* API_Alloc(const char* path_to_xml);
|
|
||||||
DFHACK_EXPORT void API_Free(DFHackObject* api);
|
|
||||||
|
|
||||||
DFHACK_EXPORT int API_Attach(DFHackObject* api);
|
|
||||||
DFHACK_EXPORT int API_Detach(DFHackObject* api);
|
|
||||||
DFHACK_EXPORT int API_isAttached(DFHackObject* api);
|
|
||||||
|
|
||||||
DFHACK_EXPORT int API_Suspend(DFHackObject* api);
|
|
||||||
DFHACK_EXPORT int API_Resume(DFHackObject* api);
|
|
||||||
DFHACK_EXPORT int API_isSuspended(DFHackObject* api);
|
|
||||||
DFHACK_EXPORT int API_ForceResume(DFHackObject* api);
|
|
||||||
DFHACK_EXPORT int API_AsyncSuspend(DFHackObject* api);
|
|
||||||
|
|
||||||
DFHACK_EXPORT DFHackObject* API_getMemoryInfo(DFHackObject* api);
|
|
||||||
DFHACK_EXPORT DFHackObject* API_getProcess(DFHackObject* api);
|
|
||||||
DFHACK_EXPORT DFHackObject* API_getWindow(DFHackObject* api);
|
|
||||||
|
|
||||||
DFHACK_EXPORT DFHackObject* API_getCreatures(DFHackObject* api);
|
|
||||||
DFHACK_EXPORT DFHackObject* API_getMaps(DFHackObject* api);
|
|
||||||
DFHACK_EXPORT DFHackObject* API_getGui(DFHackObject* api);
|
|
||||||
DFHACK_EXPORT DFHackObject* API_getPosition(DFHackObject* api);
|
|
||||||
DFHACK_EXPORT DFHackObject* API_getMaterials(DFHackObject* api);
|
|
||||||
DFHACK_EXPORT DFHackObject* API_getTranslation(DFHackObject* api);
|
|
||||||
DFHACK_EXPORT DFHackObject* API_getVegetation(DFHackObject* api);
|
|
||||||
DFHACK_EXPORT DFHackObject* API_getBuildings(DFHackObject* api);
|
|
||||||
DFHACK_EXPORT DFHackObject* API_getConstructions(DFHackObject* api);
|
|
||||||
DFHACK_EXPORT DFHackObject* API_getItems(DFHackObject* api);
|
|
||||||
|
|
||||||
//these are DANGEROUS...can crash/segfault DF, turn the seas to blood, call up the Antichrist, etc
|
|
||||||
DFHACK_EXPORT void API_ReadRaw(DFHackObject* api, const uint32_t offset, const uint32_t size, uint8_t* target);
|
|
||||||
DFHACK_EXPORT void API_WriteRaw(DFHackObject* api, const uint32_t offset, const uint32_t size, uint8_t* source);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,219 +0,0 @@
|
|||||||
%module pydfhack
|
|
||||||
%include "std_string.i"
|
|
||||||
%include "std_vector.i"
|
|
||||||
%include "std_map.i"
|
|
||||||
%include "stdint.i"
|
|
||||||
%include "typemaps.i"
|
|
||||||
|
|
||||||
/* This goes to the header of the wrapper code */
|
|
||||||
%{
|
|
||||||
#define LINUX_BUILD
|
|
||||||
#define SWIG_WRAPPER
|
|
||||||
#include "DFTypes.h"
|
|
||||||
#include "DFHackAPI.h"
|
|
||||||
using namespace std;
|
|
||||||
using namespace DFHack;
|
|
||||||
%}
|
|
||||||
|
|
||||||
/* make swig not react to the macro */
|
|
||||||
%define DFHACK_EXPORT
|
|
||||||
|
|
||||||
/* Parse the header file to generate wrappers */
|
|
||||||
%include "DFTypes.h"
|
|
||||||
|
|
||||||
/* templates have to be instantiated for swig */
|
|
||||||
%template(MatglossVector) std::vector<DFHack::t_matgloss>;
|
|
||||||
%template(PlantMatglossVector) std::vector<DFHack::t_matglossPlant>;
|
|
||||||
%template(VeinVector) std::vector <DFHack::t_vein>;
|
|
||||||
%template(IceVeinVector) std::vector <DFHack::t_frozenliquidvein>;
|
|
||||||
|
|
||||||
/*
|
|
||||||
This causes swig to generate BS uncompilable code
|
|
||||||
%template(GeologyAssign) std::vector < std::vector <uint16_t> >;
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
SWIG typemaps recipe
|
|
||||||
%apply double *OUTPUT { double *result }; // 'double *result' is to be treated as OUTPUT
|
|
||||||
%clear double *result; // Remove all typemaps for double *result
|
|
||||||
|
|
||||||
INPUT
|
|
||||||
int *INPUT
|
|
||||||
short *INPUT
|
|
||||||
long *INPUT
|
|
||||||
unsigned int *INPUT
|
|
||||||
unsigned short *INPUT
|
|
||||||
unsigned long *INPUT
|
|
||||||
double *INPUT
|
|
||||||
float *INPUT
|
|
||||||
|
|
||||||
OUTPUT
|
|
||||||
int *OUTPUT
|
|
||||||
short *OUTPUT
|
|
||||||
long *OUTPUT
|
|
||||||
unsigned int *OUTPUT
|
|
||||||
unsigned short *OUTPUT
|
|
||||||
unsigned long *OUTPUT
|
|
||||||
double *OUTPUT
|
|
||||||
float *OUTPUT
|
|
||||||
|
|
||||||
INOUT
|
|
||||||
int *INOUT
|
|
||||||
short *INOUT
|
|
||||||
long *INOUT
|
|
||||||
unsigned int *INOUT
|
|
||||||
unsigned short *INOUT
|
|
||||||
unsigned long *INOUT
|
|
||||||
double *INOUT
|
|
||||||
float *INOUT
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace DFHack
|
|
||||||
{
|
|
||||||
class memory_info;
|
|
||||||
class Process;
|
|
||||||
class API
|
|
||||||
{
|
|
||||||
|
|
||||||
class Private;
|
|
||||||
|
|
||||||
Private * const d;
|
|
||||||
public:
|
|
||||||
API(const std::string path_to_xml);
|
|
||||||
~API();
|
|
||||||
bool Attach();
|
|
||||||
bool Detach();
|
|
||||||
bool isAttached();
|
|
||||||
|
|
||||||
bool ReadPauseState();
|
|
||||||
|
|
||||||
bool ReadViewScreen(t_viewscreen &);
|
|
||||||
|
|
||||||
uint32_t ReadMenuState();
|
|
||||||
|
|
||||||
bool Suspend();
|
|
||||||
bool AsyncSuspend();
|
|
||||||
bool Resume();
|
|
||||||
bool ForceResume();
|
|
||||||
bool isSuspended();
|
|
||||||
bool ReadStoneMatgloss(std::vector<t_matgloss> & OUTPUT);
|
|
||||||
bool ReadWoodMatgloss (std::vector<t_matgloss> & OUTPUT);
|
|
||||||
bool ReadMetalMatgloss(std::vector<t_matgloss> & OUTPUT);
|
|
||||||
bool ReadPlantMatgloss(std::vector<t_matgloss> & OUTPUT);
|
|
||||||
/*
|
|
||||||
* SWIG reports that it can't wrap the second method here
|
|
||||||
*/
|
|
||||||
bool ReadPlantMatgloss (std::vector<t_matglossPlant> & OUTPUT);
|
|
||||||
bool ReadCreatureMatgloss(std::vector<t_matgloss> & OUTPUT);
|
|
||||||
|
|
||||||
bool ReadGeology( std::vector < std::vector <uint16_t> >& OUTPUT );
|
|
||||||
|
|
||||||
bool InitMap();
|
|
||||||
bool DestroyMap();
|
|
||||||
|
|
||||||
%apply uint32_t& OUTPUT { uint32_t& x };
|
|
||||||
%apply uint32_t& OUTPUT { uint32_t& y };
|
|
||||||
%apply uint32_t& OUTPUT { uint32_t& z };
|
|
||||||
void getSize(uint32_t& x, uint32_t& y, uint32_t& z);
|
|
||||||
|
|
||||||
bool isValidBlock(uint32_t blockx, uint32_t blocky, uint32_t blockz);
|
|
||||||
uint32_t getBlockPtr (uint32_t blockx, uint32_t blocky, uint32_t blockz);
|
|
||||||
|
|
||||||
bool ReadBlock40d(uint32_t blockx, uint32_t blocky, uint32_t blockz, mapblock40d * OUTPUT);
|
|
||||||
|
|
||||||
bool ReadTileTypes(uint32_t blockx, uint32_t blocky, uint32_t blockz, tiletypes40d *OUTPUT);
|
|
||||||
bool WriteTileTypes(uint32_t blockx, uint32_t blocky, uint32_t blockz, tiletypes40d *INPUT);
|
|
||||||
|
|
||||||
bool ReadDesignations(uint32_t blockx, uint32_t blocky, uint32_t blockz, designations40d *OUTPUT);
|
|
||||||
bool WriteDesignations (uint32_t blockx, uint32_t blocky, uint32_t blockz, designations40d *INPUT);
|
|
||||||
|
|
||||||
bool ReadOccupancy(uint32_t blockx, uint32_t blocky, uint32_t blockz, occupancies40d *OUTPUT);
|
|
||||||
bool WriteOccupancy(uint32_t blockx, uint32_t blocky, uint32_t blockz, occupancies40d *INPUT);
|
|
||||||
|
|
||||||
bool ReadDirtyBit(uint32_t blockx, uint32_t blocky, uint32_t blockz, bool &OUTPUT);
|
|
||||||
bool WriteDirtyBit(uint32_t blockx, uint32_t blocky, uint32_t blockz, bool dirtybit);
|
|
||||||
|
|
||||||
bool ReadRegionOffsets(uint32_t blockx, uint32_t blocky, uint32_t blockz, biome_indices40d *OUTPUT);
|
|
||||||
|
|
||||||
bool ReadVeins(uint32_t blockx, uint32_t blocky, uint32_t blockz, std::vector <t_vein> & veins, std::vector <t_frozenliquidvein>& ices);
|
|
||||||
|
|
||||||
%apply uint32_t& OUTPUT { uint32_t & numObjs };
|
|
||||||
|
|
||||||
bool InitReadConstructions( uint32_t & numObjs );
|
|
||||||
bool ReadConstruction(const int32_t index, t_construction & OUTPUT);
|
|
||||||
void FinishReadConstructions();
|
|
||||||
|
|
||||||
bool InitReadBuildings ( uint32_t & numObjs );
|
|
||||||
bool ReadBuilding(const int32_t index, t_building & OUTPUT);
|
|
||||||
void FinishReadBuildings();
|
|
||||||
|
|
||||||
bool InitReadVegetation( uint32_t & numObjs );
|
|
||||||
bool ReadVegetation(const int32_t index, t_tree_desc & OUTPUT);
|
|
||||||
void FinishReadVegetation();
|
|
||||||
|
|
||||||
bool InitReadCreatures( uint32_t & numObjs );
|
|
||||||
int32_t ReadCreatureInBox(int32_t index, t_creature & OUTPUT,
|
|
||||||
const uint16_t x1, const uint16_t y1,const uint16_t z1,
|
|
||||||
const uint16_t x2, const uint16_t y2,const uint16_t z2);
|
|
||||||
|
|
||||||
bool ReadCreature(const int32_t index, t_creature & OUTPUT);
|
|
||||||
void FinishReadCreatures();
|
|
||||||
|
|
||||||
/*
|
|
||||||
A conundrum really.
|
|
||||||
*/
|
|
||||||
void ReadRaw (const uint32_t offset, const uint32_t size, uint8_t *target);
|
|
||||||
void WriteRaw (const uint32_t offset, const uint32_t size, uint8_t *source);
|
|
||||||
|
|
||||||
bool InitViewAndCursor();
|
|
||||||
|
|
||||||
bool InitReadNotes( uint32_t & numnotes );
|
|
||||||
bool ReadNote(const int32_t index, t_note & OUTPUT);
|
|
||||||
void FinishReadNotes();
|
|
||||||
|
|
||||||
bool InitReadSettlements( uint32_t & numObjs );
|
|
||||||
bool ReadSettlement(const int32_t index, t_settlement & OUTPUT);
|
|
||||||
bool ReadCurrentSettlement(t_settlement & settlement);
|
|
||||||
void FinishReadSettlements();
|
|
||||||
|
|
||||||
bool InitReadHotkeys( );
|
|
||||||
bool ReadHotkeys(t_hotkey hotkeys[]);
|
|
||||||
|
|
||||||
%apply int32_t& OUTPUT { int32_t& x };
|
|
||||||
%apply int32_t& OUTPUT { int32_t& y };
|
|
||||||
%apply int32_t& OUTPUT { 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 getCursorCoords (int32_t &x, int32_t &y, int32_t &z);
|
|
||||||
bool setCursorCoords (const int32_t x, const int32_t y, const int32_t z);
|
|
||||||
|
|
||||||
bool getCurrentCursorCreature(uint32_t &OUTPUT);
|
|
||||||
|
|
||||||
bool InitViewSize();
|
|
||||||
|
|
||||||
%apply int32_t& OUTPUT { int32_t& width };
|
|
||||||
%apply int32_t& OUTPUT { int32_t& height };
|
|
||||||
bool getWindowSize(int32_t & width, int32_t & height);
|
|
||||||
bool getItemIndexesInBox(std::vector<uint32_t> &indexes,
|
|
||||||
const uint16_t x1, const uint16_t y1, const uint16_t z1,
|
|
||||||
const uint16_t x2, const uint16_t y2, const uint16_t z2);
|
|
||||||
bool InitReadNameTables (std::vector< std::vector<std::string> > & translations , std::vector< std::vector<std::string> > & foreign_languages);
|
|
||||||
void FinishReadNameTables();
|
|
||||||
|
|
||||||
std::string TranslateName(const t_name & name,const std::vector< std::vector<std::string> > & translations ,const std::vector< std::vector<std::string> > & foreign_languages, bool inEnglish=true);
|
|
||||||
|
|
||||||
void WriteLabors(const uint32_t index, uint8_t labors[NUM_CREATURE_LABORS]);
|
|
||||||
|
|
||||||
bool InitReadItems(uint32_t & numitems);
|
|
||||||
bool ReadItem(const uint32_t index, t_item & OUTPUT);
|
|
||||||
void FinishReadItems();
|
|
||||||
|
|
||||||
memory_info *getMemoryInfo();
|
|
||||||
Process * getProcess();
|
|
||||||
DFWindow * getWindow();
|
|
||||||
bool ReadItemTypes(std::vector< std::vector< t_itemType > > & itemTypes);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
%enddef DFHACK_EXPORT
|
|
@ -1,11 +1,11 @@
|
|||||||
#include "DFCommonInternal.h"
|
#include "dfhack/DFCommonInternal.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/APIPrivate.h"
|
||||||
#include "DFMemInfo.h"
|
#include "dfhack/DFMemInfo.h"
|
||||||
#include "DFProcess.h"
|
#include "dfhack/DFProcess.h"
|
||||||
|
|
||||||
#include "modules/Materials.h"
|
#include "modules/Materials.h"
|
||||||
#include "modules/Creatures.h"
|
#include "modules/Creatures.h"
|
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef DFHACK_C_API
|
||||||
|
#define DFHACK_C_API
|
||||||
|
|
||||||
|
typedef void DFHackObject;
|
||||||
|
|
||||||
|
#include "dfhack/DFExport.h"
|
||||||
|
#include "dfhack/DFIntegers.h"
|
||||||
|
#include "dfhack-c/DFContext_C.h"
|
||||||
|
#include "dfhack-c/DFTypes_C.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
// some global stuff here
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
@ -1,6 +1,6 @@
|
|||||||
#ifndef DFHACK_GLOBAL
|
#ifndef DFHACK_GLOBAL
|
||||||
#define DFHACK_GLOBAL
|
#define DFHACK_GLOBAL
|
||||||
#include "Export.h"
|
#include "DFExport.h"
|
||||||
|
|
||||||
// globals, if any, should be placed here.
|
// globals, if any, should be placed here.
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue