diff --git a/dfhack/DFHackAPI_C.cpp b/dfhack/DFHackAPI_C.cpp index e7bf624b0..fb6f7c932 100644 --- a/dfhack/DFHackAPI_C.cpp +++ b/dfhack/DFHackAPI_C.cpp @@ -140,6 +140,128 @@ int API_AsyncSuspend(DFHackObject* api) return -1; } +//module getters + +DFHackObject* API_getMemoryInfo(DFHackObject* api) +{ + if(api != NULL) + { + return (DFHackObject*)((DFHack::API*)api)->getMemoryInfo(); + } + + return NULL; +} + +DFHackObject* API_getProcess(DFHackObject* api) +{ + if(api != NULL) + { + return (DFHackObject*)((DFHack::API*)api)->getProcess(); + } + + return NULL; +} + +DFHackObject* API_getWindow(DFHackObject* api) +{ + if(api != NULL) + { + return (DFHackObject*)((DFHack::API*)api)->getWindow(); + } + + return NULL; +} + +DFHackObject* API_getCreatures(DFHackObject* api) +{ + if(api != NULL) + { + return (DFHackObject*)((DFHack::API*)api)->getCreatures(); + } + + return NULL; +} + +DFHackObject* API_getMaps(DFHackObject* api) +{ + if(api != NULL) + { + return (DFHackObject*)((DFHack::API*)api)->getMaps(); + } + + return NULL; +} + +DFHackObject* API_getGui(DFHackObject* api) +{ + if(api != NULL) + { + return (DFHackObject*)((DFHack::API*)api)->getGui(); + } + + return NULL; +} + +DFHackObject* API_getPosition(DFHackObject* api) +{ + if(api != NULL) + { + return (DFHackObject*)((DFHack::API*)api)->getPosition(); + } + + return NULL; +} + +DFHackObject* API_getMaterials(DFHackObject* api) +{ + if(api != NULL) + { + return (DFHackObject*)((DFHack::API*)api)->getMaterials(); + } + + return NULL; +} + +DFHackObject* API_getTranslation(DFHackObject* api) +{ + if(api != NULL) + { + return (DFHackObject*)((DFHack::API*)api)->getTranslation(); + } + + return NULL; +} + +DFHackObject* API_getVegetation(DFHackObject* api) +{ + if(api != NULL) + { + return (DFHackObject*)((DFHack::API*)api)->getVegetation(); + } + + return NULL; +} + +DFHackObject* API_getBuildings(DFHackObject* api) +{ + if(api != NULL) + { + return (DFHackObject*)((DFHack::API*)api)->getBuildings(); + } + + return NULL; +} + +DFHackObject* API_getConstructions(DFHackObject* api) +{ + if(api != NULL) + { + return (DFHackObject*)((DFHack::API*)api)->getConstructions(); + } + + return NULL; +} + void API_ReadRaw(DFHackObject* api, const uint32_t offset, const uint32_t size, uint8_t* target) { if(api != NULL) diff --git a/dfhack/include/DFHackAPI_C.h b/dfhack/include/DFHackAPI_C.h index 88e7a3f2e..6c49aa35a 100644 --- a/dfhack/include/DFHackAPI_C.h +++ b/dfhack/include/DFHackAPI_C.h @@ -47,6 +47,21 @@ 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); + +//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);