Crud removal: Context is gone. Added missing FakeSDL.h
parent
4da11927af
commit
e0fb8f7c81
@ -1,181 +0,0 @@
|
||||
/*
|
||||
https://github.com/peterix/dfhack
|
||||
Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com)
|
||||
|
||||
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 "Internal.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cstring>
|
||||
using namespace std;
|
||||
|
||||
#include "dfhack/Process.h"
|
||||
#include "dfhack/Context.h"
|
||||
#include "dfhack/Error.h"
|
||||
#include "dfhack/Module.h"
|
||||
|
||||
#include "private/ContextShared.h"
|
||||
#include "private/ModuleFactory.h"
|
||||
|
||||
using namespace DFHack;
|
||||
|
||||
Context::Context (Process* p) : d (new DFContextShared())
|
||||
{
|
||||
d->p = p;
|
||||
d->offset_descriptor = p->getDescriptor();
|
||||
d->shm_start = 0;
|
||||
}
|
||||
|
||||
Context::~Context()
|
||||
{
|
||||
//Detach();
|
||||
delete d;
|
||||
}
|
||||
|
||||
bool Context::isValid()
|
||||
{
|
||||
//FIXME: check for error states here
|
||||
if(d->p->isIdentified())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
bool Context::Attach()
|
||||
{
|
||||
if (!d->p->attach())
|
||||
{
|
||||
//throw Error::CantAttach();
|
||||
return false;
|
||||
}
|
||||
d->shm_start = d->p->getSHMStart();
|
||||
// process is attached, everything went just fine... hopefully
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Context::Detach()
|
||||
{
|
||||
if (!d->p->detach())
|
||||
{
|
||||
cerr << "Context::Detach failed!" << endl;
|
||||
return false;
|
||||
}
|
||||
d->shm_start = 0;
|
||||
// invalidate all modules
|
||||
for(unsigned int i = 0 ; i < d->allModules.size(); i++)
|
||||
{
|
||||
delete d->allModules[i];
|
||||
}
|
||||
d->allModules.clear();
|
||||
memset(&(d->s_mods), 0, sizeof(d->s_mods));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Context::isAttached()
|
||||
{
|
||||
return d->p->isAttached();
|
||||
}
|
||||
*/
|
||||
bool Context::Suspend()
|
||||
{
|
||||
// return d->p->suspend();
|
||||
return true;
|
||||
}
|
||||
bool Context::AsyncSuspend()
|
||||
{
|
||||
// return d->p->asyncSuspend();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Context::Resume()
|
||||
{
|
||||
for(unsigned int i = 0 ; i < d->allModules.size(); i++)
|
||||
{
|
||||
d->allModules[i]->OnResume();
|
||||
}
|
||||
//return d->p->resume();
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
bool Context::ForceResume()
|
||||
{
|
||||
for(unsigned int i = 0 ; i < d->allModules.size(); i++)
|
||||
{
|
||||
d->allModules[i]->OnResume();
|
||||
}
|
||||
return d->p->forceresume();
|
||||
}
|
||||
*/
|
||||
bool Context::isSuspended()
|
||||
{
|
||||
return d->p->isSuspended();
|
||||
}
|
||||
/*
|
||||
void Context::ReadRaw (const uint32_t offset, const uint32_t size, uint8_t *target)
|
||||
{
|
||||
d->p->read (offset, size, target);
|
||||
}
|
||||
|
||||
void Context::WriteRaw (const uint32_t offset, const uint32_t size, uint8_t *source)
|
||||
{
|
||||
d->p->write (offset, size, source);
|
||||
}
|
||||
*/
|
||||
VersionInfo *Context::getMemoryInfo()
|
||||
{
|
||||
return d->offset_descriptor;
|
||||
}
|
||||
|
||||
Process * Context::getProcess()
|
||||
{
|
||||
return d->p;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
M O D U L E S
|
||||
*******************************************************************************/
|
||||
|
||||
#define MODULE_GETTER(TYPE) \
|
||||
TYPE * Context::get##TYPE() \
|
||||
{ \
|
||||
if(!d->s_mods.p##TYPE)\
|
||||
{\
|
||||
Module * mod = create##TYPE(d);\
|
||||
d->s_mods.p##TYPE = (TYPE *) mod;\
|
||||
d->allModules.push_back(mod);\
|
||||
}\
|
||||
return d->s_mods.p##TYPE;\
|
||||
}
|
||||
|
||||
MODULE_GETTER(Creatures);
|
||||
MODULE_GETTER(Engravings);
|
||||
MODULE_GETTER(Maps);
|
||||
MODULE_GETTER(Gui);
|
||||
MODULE_GETTER(World);
|
||||
MODULE_GETTER(Materials);
|
||||
MODULE_GETTER(Items);
|
||||
MODULE_GETTER(Translation);
|
||||
MODULE_GETTER(Vegetation);
|
||||
MODULE_GETTER(Buildings);
|
||||
MODULE_GETTER(Constructions);
|
@ -1,112 +0,0 @@
|
||||
/*
|
||||
https://github.com/peterix/dfhack
|
||||
Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com)
|
||||
|
||||
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 "Internal.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <cstring>
|
||||
using namespace std;
|
||||
|
||||
#include "private/ContextShared.h"
|
||||
#include "dfhack/VersionInfo.h"
|
||||
#include "dfhack/Process.h"
|
||||
#include "dfhack/Module.h"
|
||||
using namespace DFHack;
|
||||
|
||||
DFContextShared::DFContextShared()
|
||||
{
|
||||
// init modules
|
||||
allModules.clear();
|
||||
memset(&(s_mods), 0, sizeof(s_mods));
|
||||
namesInited = false;
|
||||
namesFailed = false;
|
||||
}
|
||||
|
||||
DFContextShared::~DFContextShared()
|
||||
{
|
||||
// invalidate all modules
|
||||
for(unsigned int i = 0 ; i < allModules.size(); i++)
|
||||
{
|
||||
delete allModules[i];
|
||||
}
|
||||
allModules.clear();
|
||||
}
|
||||
|
||||
bool DFContextShared::InitReadNames()
|
||||
{
|
||||
try
|
||||
{
|
||||
OffsetGroup * OG = offset_descriptor->getGroup("name");
|
||||
name_firstname_offset = OG->getOffset("first");
|
||||
name_nickname_offset = OG->getOffset("nick");
|
||||
name_words_offset = OG->getOffset("second_words");
|
||||
name_parts_offset = OG->getOffset("parts_of_speech");
|
||||
name_language_offset = OG->getOffset("language");
|
||||
name_set_offset = OG->getOffset("has_name");
|
||||
}
|
||||
catch(exception &)
|
||||
{
|
||||
namesFailed = true;
|
||||
return false;
|
||||
}
|
||||
namesInited = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void DFContextShared::readName(t_name & name, uint32_t address)
|
||||
{
|
||||
if(namesFailed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(!namesInited)
|
||||
{
|
||||
if(!InitReadNames()) return;
|
||||
}
|
||||
p->readSTLString(address + name_firstname_offset , name.first_name, 128);
|
||||
p->readSTLString(address + name_nickname_offset , name.nickname, 128);
|
||||
p->read(address + name_words_offset, 7*4, (uint8_t *)name.words);
|
||||
p->read(address + name_parts_offset, 7*2, (uint8_t *)name.parts_of_speech);
|
||||
name.language = p->readDWord(address + name_language_offset);
|
||||
name.has_name = p->readByte(address + name_set_offset);
|
||||
}
|
||||
|
||||
void DFContextShared::copyName(uint32_t address, uint32_t target)
|
||||
{
|
||||
uint8_t buf[28];
|
||||
|
||||
if (address == target)
|
||||
return;
|
||||
|
||||
p->copySTLString(address + name_firstname_offset, target + name_firstname_offset);
|
||||
p->copySTLString(address + name_nickname_offset, target + name_nickname_offset);
|
||||
p->read(address + name_words_offset, 7*4, buf);
|
||||
p->write(target + name_words_offset, 7*4, buf);
|
||||
p->read(address + name_parts_offset, 7*2, buf);
|
||||
p->write(target + name_parts_offset, 7*2, buf);
|
||||
p->writeDWord(target + name_language_offset, p->readDWord(address + name_language_offset));
|
||||
p->writeByte(target + name_set_offset, p->readByte(address + name_set_offset));
|
||||
}
|
@ -1,169 +0,0 @@
|
||||
/*
|
||||
https://github.com/peterix/dfhack
|
||||
Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com)
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef CONTEXT_H_INCLUDED
|
||||
#define CONTEXT_H_INCLUDED
|
||||
|
||||
#include "dfhack/Export.h"
|
||||
namespace DFHack
|
||||
{
|
||||
class Creatures;
|
||||
class Engravings;
|
||||
class Maps;
|
||||
class Gui;
|
||||
class World;
|
||||
class Materials;
|
||||
class Items;
|
||||
class Translation;
|
||||
class Vegetation;
|
||||
class Buildings;
|
||||
class Constructions;
|
||||
class VersionInfo;
|
||||
class DFContextShared;
|
||||
class Process;
|
||||
/**
|
||||
* This class wraps all the different related objects for a particular Process
|
||||
* \ingroup grp_context
|
||||
*/
|
||||
class DFHACK_EXPORT Context
|
||||
{
|
||||
public:
|
||||
Context(Process * p);
|
||||
~Context();
|
||||
|
||||
/// @return true if there's version information for the associated Process
|
||||
bool isValid();
|
||||
/// attach to the related process. Claims OS debugging resources
|
||||
bool Attach();
|
||||
/// detach from the related process. Releases OS debugging resources
|
||||
bool Detach();
|
||||
/// @return true if the process is attached.
|
||||
bool isAttached();
|
||||
|
||||
/// stop the tracked process
|
||||
bool Suspend();
|
||||
/// @return true if the process is stopped
|
||||
bool isSuspended();
|
||||
|
||||
/// stop the tracked process, asynchronous
|
||||
bool AsyncSuspend();
|
||||
|
||||
/// resume the tracked process
|
||||
bool Resume();
|
||||
|
||||
/// forces resume on Windows. This can be a bad thing with multiple tools running!
|
||||
bool ForceResume();
|
||||
|
||||
VersionInfo *getMemoryInfo();
|
||||
Process* getProcess();
|
||||
|
||||
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);
|
||||
|
||||
/// get the creatures module
|
||||
Creatures * getCreatures();
|
||||
|
||||
/// get the engravings module
|
||||
Engravings * getEngravings();
|
||||
|
||||
/// get the maps module
|
||||
Maps * getMaps();
|
||||
|
||||
/// get the gui module
|
||||
Gui * getGui();
|
||||
|
||||
/// get the world module
|
||||
World * getWorld();
|
||||
|
||||
/// get the materials module
|
||||
Materials * getMaterials();
|
||||
|
||||
/// get the items module
|
||||
Items * getItems();
|
||||
|
||||
/// get the translation module
|
||||
Translation * getTranslation();
|
||||
|
||||
/// get the vegetation module
|
||||
Vegetation * getVegetation();
|
||||
|
||||
/// get the buildings module
|
||||
Buildings * getBuildings();
|
||||
|
||||
/// get the constructions module
|
||||
Constructions * getConstructions();
|
||||
|
||||
// DEAD CODE, WAITING TO BE UPDATED TO DF2010
|
||||
/*
|
||||
* Effects like mist, dragonfire or dust
|
||||
*/
|
||||
/*
|
||||
bool InitReadEffects ( uint32_t & numeffects );
|
||||
bool ReadEffect(const uint32_t index, t_effect_df40d & effect);
|
||||
bool WriteEffect(const uint32_t index, const t_effect_df40d & effect);
|
||||
void FinishReadEffects();
|
||||
*/
|
||||
/*
|
||||
* Notes placed by the player
|
||||
*/
|
||||
/*
|
||||
/// start reading notes. numnotes is an output - total notes present
|
||||
bool InitReadNotes( uint32_t & numnotes );
|
||||
/// read note from the note vector at index
|
||||
bool ReadNote(const int32_t index, t_note & note);
|
||||
/// free the note vector
|
||||
void FinishReadNotes();
|
||||
*/
|
||||
/*
|
||||
* Settlements
|
||||
*/
|
||||
/*
|
||||
bool InitReadSettlements( uint32_t & numsettlements );
|
||||
bool ReadSettlement(const int32_t index, t_settlement & settlement);
|
||||
bool ReadCurrentSettlement(t_settlement & settlement);
|
||||
void FinishReadSettlements();
|
||||
*/
|
||||
/*
|
||||
* Item reading
|
||||
*/
|
||||
/*
|
||||
bool InitReadItems(uint32_t & numitems);
|
||||
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 ReadItem(const uint32_t index, t_item & item);
|
||||
void FinishReadItems();
|
||||
*/
|
||||
/*
|
||||
* Get the other API parts for raw access
|
||||
*/
|
||||
private:
|
||||
DFContextShared * d;
|
||||
};
|
||||
}
|
||||
#endif //CONTEXT_H_INCLUDED
|
||||
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
https://github.com/peterix/dfhack
|
||||
Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com)
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
* Some much needed SDL fakery.
|
||||
*/
|
||||
|
||||
#include "dfhack/Pragma.h"
|
||||
#include "dfhack/Export.h"
|
||||
|
||||
#ifdef LINUX_BUILD
|
||||
#define DFhackCExport extern "C" __attribute__ ((visibility("default")))
|
||||
#else
|
||||
#define DFhackCExport extern "C" __declspec(dllexport)
|
||||
#endif
|
||||
|
||||
// function and variable pointer... we don't try to understand what SDL does here
|
||||
typedef void * fPtr;
|
||||
typedef void * vPtr;
|
||||
struct DFMutex;
|
||||
struct DFThread;
|
||||
|
||||
// mutex and thread functions. We can call these.
|
||||
DFhackCExport DFMutex * SDL_CreateMutex(void);
|
||||
DFhackCExport int SDL_mutexP(DFMutex *);
|
||||
DFhackCExport int SDL_mutexV(DFMutex *);
|
||||
DFhackCExport void SDL_DestroyMutex(DFMutex *);
|
||||
DFhackCExport DFThread *SDL_CreateThread(int (*fn)(void *), void *data);
|
||||
|
||||
// these functions are here because they call into DFHack::Core and therefore need to
|
||||
// be declared as friend functions/known
|
||||
DFhackCExport int SDL_NumJoysticks(void);
|
||||
DFhackCExport void SDL_Quit(void);
|
||||
/*
|
||||
// not yet.
|
||||
DFhackCExport int SDL_Init(uint32_t flags);
|
||||
DFhackCExport int SDL_PollEvent(vPtr event);
|
||||
*/
|
||||
|
||||
// Other crud is in the OS-specific core files.
|
@ -1,120 +0,0 @@
|
||||
/*
|
||||
https://github.com/peterix/dfhack
|
||||
Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com)
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef KEYS_H_INCLUDED
|
||||
#define KEYS_H_INCLUDED
|
||||
|
||||
/**
|
||||
* \defgroup grp_windowio WindowIO: Send events to DF's window
|
||||
* @ingroup grp_modules
|
||||
*/
|
||||
|
||||
|
||||
#include "dfhack/Pragma.h"
|
||||
#include "dfhack/Export.h"
|
||||
#include "dfhack/Module.h"
|
||||
|
||||
namespace DFHack
|
||||
{
|
||||
class Process;
|
||||
/**
|
||||
* enum of all possible special keys
|
||||
* \ingroup grp_windowio
|
||||
*/
|
||||
enum t_special
|
||||
{
|
||||
ENTER,
|
||||
SPACE,
|
||||
BACK_SPACE,
|
||||
TAB,
|
||||
CAPS_LOCK,
|
||||
LEFT_SHIFT,
|
||||
RIGHT_SHIFT,
|
||||
LEFT_CONTROL,
|
||||
RIGHT_CONTROL,
|
||||
ALT,
|
||||
WAIT,
|
||||
ESCAPE,
|
||||
UP,
|
||||
DOWN,
|
||||
LEFT,
|
||||
RIGHT,
|
||||
F1,
|
||||
F2,
|
||||
F3,
|
||||
F4,
|
||||
F5,
|
||||
F6,
|
||||
F7,
|
||||
F8,
|
||||
F9,
|
||||
F10,
|
||||
F11,
|
||||
F12,
|
||||
PAGE_UP,
|
||||
PAGE_DOWN,
|
||||
INSERT,
|
||||
DFK_DELETE, // stupid windows fails here
|
||||
HOME,
|
||||
END,
|
||||
KEYPAD_DIVIDE,
|
||||
KEYPAD_MULTIPLY,
|
||||
KEYPAD_SUBTRACT,
|
||||
KEYPAD_ADD,
|
||||
KEYPAD_ENTER,
|
||||
KEYPAD_0,
|
||||
KEYPAD_1,
|
||||
KEYPAD_2,
|
||||
KEYPAD_3,
|
||||
KEYPAD_4,
|
||||
KEYPAD_5,
|
||||
KEYPAD_6,
|
||||
KEYPAD_7,
|
||||
KEYPAD_8,
|
||||
KEYPAD_9,
|
||||
KEYPAD_DECIMAL_POINT,
|
||||
NUM_SPECIALS
|
||||
};
|
||||
class DFContextShared;
|
||||
/**
|
||||
* The WindowIO module
|
||||
* \ingroup grp_windowio
|
||||
* \ingroup grp_modules
|
||||
*/
|
||||
class DFHACK_EXPORT WindowIO : public Module
|
||||
{
|
||||
class Private;
|
||||
private:
|
||||
Private * d;
|
||||
public:
|
||||
bool Finish(){return true;};
|
||||
WindowIO(DFHack::DFContextShared * d);
|
||||
~WindowIO();
|
||||
void TypeStr (const char *input, int delay = 0, bool useShift = false);
|
||||
void TypeSpecial (t_special command, int count = 1, int delay = 0);
|
||||
};
|
||||
|
||||
}
|
||||
#endif // KEYS_H_INCLUDED
|
@ -1,118 +0,0 @@
|
||||
/*
|
||||
https://github.com/peterix/dfhack
|
||||
Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com)
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef APIPRIVATE_H_INCLUDED
|
||||
#define APIPRIVATE_H_INCLUDED
|
||||
|
||||
namespace DFHack
|
||||
{
|
||||
class Module;
|
||||
|
||||
class Creatures;
|
||||
class Engravings;
|
||||
class Maps;
|
||||
class Gui;
|
||||
class World;
|
||||
class Materials;
|
||||
class Items;
|
||||
class Translation;
|
||||
class Vegetation;
|
||||
class Buildings;
|
||||
class Constructions;
|
||||
class WindowIO;
|
||||
|
||||
class ProcessEnumerator;
|
||||
class Process;
|
||||
class VersionInfo;
|
||||
struct t_name;
|
||||
class DFContextShared
|
||||
{
|
||||
public:
|
||||
DFContextShared();
|
||||
~DFContextShared();
|
||||
|
||||
// names, used by a few other modules.
|
||||
void readName(t_name & name, uint32_t address);
|
||||
void copyName(uint32_t address, uint32_t target);
|
||||
// get the name offsets
|
||||
bool InitReadNames();
|
||||
uint32_t name_firstname_offset;
|
||||
uint32_t name_nickname_offset;
|
||||
uint32_t name_words_offset;
|
||||
uint32_t name_parts_offset;
|
||||
uint32_t name_language_offset;
|
||||
uint32_t name_set_offset;
|
||||
bool namesInited;
|
||||
bool namesFailed;
|
||||
|
||||
ProcessEnumerator* pm;
|
||||
Process* p;
|
||||
char * shm_start;
|
||||
VersionInfo* offset_descriptor;
|
||||
string xml;
|
||||
|
||||
// Modules
|
||||
struct
|
||||
{
|
||||
Creatures * pCreatures;
|
||||
Engravings * pEngravings;
|
||||
Maps * pMaps;
|
||||
Gui * pPosition; // blerp
|
||||
Gui * pGui;
|
||||
World * pWorld;
|
||||
Materials * pMaterials;
|
||||
Items * pItems;
|
||||
Translation * pTranslation;
|
||||
Vegetation * pVegetation;
|
||||
Buildings * pBuildings;
|
||||
Constructions * pConstructions;
|
||||
WindowIO * pWindowIO;
|
||||
} s_mods;
|
||||
std::vector <Module *> allModules;
|
||||
/*
|
||||
uint32_t item_material_offset;
|
||||
|
||||
uint32_t note_foreground_offset;
|
||||
uint32_t note_background_offset;
|
||||
uint32_t note_name_offset;
|
||||
uint32_t note_xyz_offset;
|
||||
|
||||
uint32_t settlement_name_offset;
|
||||
uint32_t settlement_world_xy_offset;
|
||||
uint32_t settlement_local_xy_offset;
|
||||
|
||||
uint32_t dwarf_lang_table_offset;
|
||||
|
||||
DfVector *p_effect;
|
||||
DfVector *p_itm;
|
||||
DfVector *p_notes;
|
||||
DfVector *p_settlements;
|
||||
DfVector *p_current_settlement;
|
||||
*/
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue