Warning-squashing

develop
Petr Mrázek 2010-05-02 02:38:18 +02:00
parent bae9939e50
commit 5b57a71ac4
30 changed files with 376 additions and 377 deletions

@ -101,7 +101,7 @@ IF(UNIX)
add_definitions(-DLINUX_BUILD) add_definitions(-DLINUX_BUILD)
add_definitions(-DUSE_CONFIG_H) add_definitions(-DUSE_CONFIG_H)
find_library(X11_LIBRARY X11) find_library(X11_LIBRARY X11)
SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -pedantic") SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall")
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden") SET(CMAKE_CXX_FLAGS "-fvisibility=hidden")
SET(PROJECT_LIBS ${X11_LIBRARY} rt ) #dfhack-md5 dfhack-tixml SET(PROJECT_LIBS ${X11_LIBRARY} rt ) #dfhack-md5 dfhack-tixml

@ -589,3 +589,4 @@ bool API::ReadItemTypes(vector< vector< t_itemType > > & itemTypes)
return true; return true;
} }
*/ */

@ -44,137 +44,113 @@ extern "C" {
DFHackObject* API_Alloc(const char* path_to_xml) DFHackObject* API_Alloc(const char* path_to_xml)
{ {
DFHack::API* api = new DFHack::API(std::string(path_to_xml)); DFHack::API* api = new DFHack::API(std::string(path_to_xml));
return (DFHackObject*)api; return (DFHackObject*)api;
} }
//FIXME: X:\dfhack\DFHackAPI_C.cpp:56: warning: deleting `DFHackObject* ' is undefined
void API_Free(DFHackObject* api) void API_Free(DFHackObject* api)
{ {
if(api != NULL) if(api != NULL)
{ {
delete api; delete api;
api = NULL; api = NULL;
} }
} }
int API_Attach(DFHackObject* api) int API_Attach(DFHackObject* api)
{ {
if(api != NULL) if(api != NULL)
{ {
if(((DFHack::API*)api)->Attach()) return ((DFHack::API*)api)->Attach();
return 1; }
else return -1;
return 0;
}
return -1;
} }
int API_Detach(DFHackObject* api) int API_Detach(DFHackObject* api)
{ {
if(api != NULL) if(api != NULL)
{ {
if(((DFHack::API*)api)->Detach()) return ((DFHack::API*)api)->Detach();
return 1; }
else
return 0; return -1;
}
return -1;
} }
int API_isAttached(DFHackObject* api) int API_isAttached(DFHackObject* api)
{ {
if(api != NULL) if(api != NULL)
{ {
if(((DFHack::API*)api)->isAttached()) return ((DFHack::API*)api)->isAttached();
return 1; }
else
return 0; return -1;
}
return -1;
} }
int API_Suspend(DFHackObject* api) int API_Suspend(DFHackObject* api)
{ {
if(api != NULL) if(api != NULL)
{ {
if(((DFHack::API*)api)->Suspend()) return ((DFHack::API*)api)->Suspend();
return 1; }
else
return 0; return -1;
}
return -1;
} }
int API_Resume(DFHackObject* api) int API_Resume(DFHackObject* api)
{ {
if(api != NULL) if(api != NULL)
{ {
if(((DFHack::API*)api)->Resume()) return ((DFHack::API*)api)->Resume();
return 1; }
else
return 0; return -1;
}
return -1;
} }
int API_isSuspended(DFHackObject* api) int API_isSuspended(DFHackObject* api)
{ {
if(api != NULL) if(api != NULL)
{ {
if(((DFHack::API*)api)->isSuspended()) return ((DFHack::API*)api)->isSuspended();
return 1; }
else
return 0; return -1;
}
return -1;
} }
int API_ForceResume(DFHackObject* api) int API_ForceResume(DFHackObject* api)
{ {
if(api != NULL) if(api != NULL)
{ {
if(((DFHack::API*)api)->ForceResume()) return ((DFHack::API*)api)->ForceResume();
return 1; }
else
return 0; return -1;
}
return -1;
} }
int API_AsyncSuspend(DFHackObject* api) int API_AsyncSuspend(DFHackObject* api)
{ {
if(api != NULL) if(api != NULL)
{ {
if(((DFHack::API*)api)->AsyncSuspend()) return ((DFHack::API*)api)->AsyncSuspend();
return 1; }
else
return 0; return -1;
}
return -1;
} }
void API_ReadRaw(DFHackObject* api, const uint32_t offset, const uint32_t size, uint8_t* target) void API_ReadRaw(DFHackObject* api, const uint32_t offset, const uint32_t size, uint8_t* target)
{ {
if(api != NULL) if(api != NULL)
{ {
((DFHack::API*)api)->ReadRaw(offset, size, target); ((DFHack::API*)api)->ReadRaw(offset, size, target);
} }
} }
void API_WriteRaw(DFHackObject* api, const uint32_t offset, const uint32_t size, uint8_t* source) void API_WriteRaw(DFHackObject* api, const uint32_t offset, const uint32_t size, uint8_t* source)
{ {
if(api != NULL) if(api != NULL)
{ {
((DFHack::API*)api)->WriteRaw(offset, size, source); ((DFHack::API*)api)->WriteRaw(offset, size, source);
} }
} }
#ifdef __cplusplus #ifdef __cplusplus

@ -629,3 +629,4 @@ string memory_info::getLabor (const uint32_t laborIdx)
} }
throw Error::MissingMemoryDefinition("labor", laborIdx); throw Error::MissingMemoryDefinition("labor", laborIdx);
} }

@ -96,3 +96,4 @@ using namespace std;
*/ */
#endif // DFCOMMONINTERNAL_H_INCLUDED #endif // DFCOMMONINTERNAL_H_INCLUDED

@ -14,6 +14,11 @@ using namespace std;
#include <DFMemInfo.h> #include <DFMemInfo.h>
#include <DFVector.h> #include <DFVector.h>
/*
* This is a header full of ugly, volatile things.
* Only for use of official DFHack tools!
*/
void DumpObjStr0Vector (const char * name, DFHack::Process *p, uint32_t addr) void DumpObjStr0Vector (const char * name, DFHack::Process *p, uint32_t addr)
{ {
cout << "----==== " << name << " ====----" << endl; cout << "----==== " << name << " ====----" << endl;
@ -216,6 +221,5 @@ std::string PrintSplatterType (int16_t mat1, int32_t mat2, vector<DFHack::t_matg
break; break;
} }
} }
#endif #endif

@ -32,3 +32,4 @@ namespace DFHack
}; };
} }
#endif #endif

@ -169,3 +169,4 @@ int32_t Buildings::GetCustomWorkshopType(t_building & building)
} }
return ret; return ret;
} }

@ -98,3 +98,4 @@ bool Constructions::Finish()
d->Started = false; d->Started = false;
return true; return true;
} }

@ -834,3 +834,4 @@ bool Maps::ReadGlobalFeatures( std::vector <t_feature> & features)
} }
return true; return true;
} }

@ -156,3 +156,4 @@ bool Position::getWindowSize (int32_t &width, int32_t &height)
height = coords[1]; height = coords[1];
return true; return true;
} }

@ -1,6 +1,6 @@
/* /*
www.sourceforge.net/projects/dfhack www.sourceforge.net/projects/dfhack
Copyright (c) 2009 Petr Mrázek (peterix), Kenneth Ferland (Impaler[WrG]), dorf, doomchild Copyright (c) 2009 Petr Mrázek (peterix), Kenneth Ferland (Impaler[WrG]), dorf, doomchild
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any warranty. In no event will the authors be held liable for any
@ -36,91 +36,91 @@ extern "C" {
int Position_getViewCoords(DFHackObject* pos, int32_t* x, int32_t* y, int32_t* z) int Position_getViewCoords(DFHackObject* pos, int32_t* x, int32_t* y, int32_t* z)
{ {
if(pos != NULL) if(pos != NULL)
{ {
int32_t tx, ty, tz; int32_t tx, ty, tz;
if(((DFHack::Position*)pos)->getViewCoords(tx, ty, tz)) if(((DFHack::Position*)pos)->getViewCoords(tx, ty, tz))
{ {
*x = tx; *x = tx;
*y = ty; *y = ty;
*z = tz; *z = tz;
return 1; return 1;
} }
else else
return 0; return 0;
} }
return -1; return -1;
} }
int Position_setViewCoords(DFHackObject* pos, int32_t x, int32_t y, int32_t z) int Position_setViewCoords(DFHackObject* pos, int32_t x, int32_t y, int32_t z)
{ {
if(pos != NULL) if(pos != NULL)
{ {
if(((DFHack::Position*)pos)->setViewCoords(x, y, z)) if(((DFHack::Position*)pos)->setViewCoords(x, y, z))
return 1; return 1;
else else
return 0; return 0;
} }
return -1; return -1;
} }
int Position_getCursorCoords(DFHackObject* pos, int32_t* x, int32_t* y, int32_t* z) int Position_getCursorCoords(DFHackObject* pos, int32_t* x, int32_t* y, int32_t* z)
{ {
if(pos != NULL) if(pos != NULL)
{ {
int32_t tx, ty, tz; int32_t tx, ty, tz;
if(((DFHack::Position*)pos)->getCursorCoords(tx, ty, tz)) if(((DFHack::Position*)pos)->getCursorCoords(tx, ty, tz))
{ {
*x = tx; *x = tx;
*y = ty; *y = ty;
*z = tz; *z = tz;
return 1; return 1;
} }
else else
return 0; return 0;
} }
return -1; return -1;
} }
int Position_setCursorCoords(DFHackObject* pos, int32_t x, int32_t y, int32_t z) int Position_setCursorCoords(DFHackObject* pos, int32_t x, int32_t y, int32_t z)
{ {
if(pos != NULL) if(pos != NULL)
{ {
if(((DFHack::Position*)pos)->setCursorCoords(x, y, z)) if(((DFHack::Position*)pos)->setCursorCoords(x, y, z))
return 1; return 1;
else else
return 0; return 0;
} }
return -1; return -1;
} }
int Position_getWindowSize(DFHackObject* pos, int32_t* width, int32_t* height) int Position_getWindowSize(DFHackObject* pos, int32_t* width, int32_t* height)
{ {
if(pos != NULL) if(pos != NULL)
{ {
int32_t tw, th; int32_t tw, th;
if(((DFHack::Position*)pos)->getWindowSize(tw, th)) if(((DFHack::Position*)pos)->getWindowSize(tw, th))
{ {
*width = tw; *width = tw;
*height = th; *height = th;
return 1; return 1;
} }
else else
return 0; return 0;
} }
return -1; return -1;
} }
#ifdef __cplusplus #ifdef __cplusplus

@ -195,3 +195,4 @@ string Translation::TranslateName(const t_name &name, bool inEnglish)
} }
return out; return out;
} }

@ -96,3 +96,4 @@ bool Vegetation::Finish()
d->Started = false; d->Started = false;
return true; return true;
} }

@ -99,3 +99,4 @@ namespace DFHack
}; };
} }
#endif #endif

@ -8,7 +8,7 @@ SET(PROJECT_LIBS ${PYTHON_LIBRARIES} dfhack )
IF(UNIX) IF(UNIX)
add_definitions(-DLINUX_BUILD) add_definitions(-DLINUX_BUILD)
add_definitions(-DUSE_CONFIG_H) add_definitions(-DUSE_CONFIG_H)
SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -pedantic") SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall")
SET(PYTHON_MODULE_SUFFIX ".so") SET(PYTHON_MODULE_SUFFIX ".so")
ENDIF(UNIX) ENDIF(UNIX)
IF(WIN32) IF(WIN32)

@ -26,7 +26,7 @@ distribution.
#define __DFCREATURES__ #define __DFCREATURES__
#include <string> #include <string>
#include "Python.h" #include <Python.h>
#include "stdio.h" #include "stdio.h"
#include <vector> #include <vector>
#include "integers.h" #include "integers.h"

@ -135,6 +135,8 @@ static void DF_Creature_Base_dealloc(DF_Creature_Base* self)
} }
} }
#pragma GCC diagnostic ignored "-Wwrite-strings"
static PyMemberDef DF_Creature_Base_members[] = static PyMemberDef DF_Creature_Base_members[] =
{ {
{"origin", T_UINT, offsetof(DF_Creature_Base, origin), 0, ""}, {"origin", T_UINT, offsetof(DF_Creature_Base, origin), 0, ""},

@ -24,6 +24,7 @@ distribution.
#ifndef __DFGUI__ #ifndef __DFGUI__
#define __DFGUI__ #define __DFGUI__
#pragma GCC diagnostic ignored "-Wwrite-strings"
#include "Python.h" #include "Python.h"
#include "integers.h" #include "integers.h"

@ -24,6 +24,7 @@ distribution.
#ifndef __DFMAPS__ #ifndef __DFMAPS__
#define __DFMAPS__ #define __DFMAPS__
#pragma GCC diagnostic ignored "-Wwrite-strings"
#include "Python.h" #include "Python.h"
#include <vector> #include <vector>

@ -24,6 +24,7 @@ distribution.
#ifndef __DF_MEMINFO__ #ifndef __DF_MEMINFO__
#define __DF_MEMINFO__ #define __DF_MEMINFO__
#pragma GCC diagnostic ignored "-Wwrite-strings"
#include "Python.h" #include "Python.h"
#include <string> #include <string>
@ -31,7 +32,6 @@ distribution.
using namespace std; using namespace std;
#include "Export.h" #include "Export.h"
//#include "DFCommonInternal.h"
#include "DFMemInfo.h" #include "DFMemInfo.h"
using namespace DFHack; using namespace DFHack;

@ -24,6 +24,7 @@ distribution.
#ifndef __DFPOSITION__ #ifndef __DFPOSITION__
#define __DFPOSITION__ #define __DFPOSITION__
#pragma GCC diagnostic ignored "-Wwrite-strings"
#include "Python.h" #include "Python.h"
#include "integers.h" #include "integers.h"

@ -24,6 +24,7 @@ distribution.
#ifndef __DFTRANSLATE__ #ifndef __DFTRANSLATE__
#define __DFTRANSLATE__ #define __DFTRANSLATE__
#pragma GCC diagnostic ignored "-Wwrite-strings"
#include "Python.h" #include "Python.h"
#include <vector> #include <vector>

@ -97,3 +97,4 @@ enum CORE_COMMAND
NUM_CORE_CMDS NUM_CORE_CMDS
}; };
#endif #endif

@ -105,5 +105,5 @@ DFPP_module Init(void);
} }
} }
} }
#endif #endif

@ -112,5 +112,5 @@ DFPP_module Init(void);
} }
} }
} }
#endif #endif

@ -24,209 +24,209 @@ DFHack::Materials * Materials;
std::string getMatDesc(int32_t typeB, int32_t typeC, int32_t typeD) std::string getMatDesc(int32_t typeB, int32_t typeC, int32_t typeD)
{ {
if( (typeC<419) || (typeC>618) ) if ( (typeC<419) || (typeC>618) )
{ {
if( (typeC<19) || (typeC>218) ) if ( (typeC<19) || (typeC>218) )
{ {
if(typeC) if (typeC)
if(typeC>0x292) if (typeC>0x292)
return "?"; return "?";
else else
{ {
if(typeC>=Materials->other.size()) if (typeC>=Materials->other.size())
return "stuff"; return "stuff";
else else
{ {
if(typeD==-1) if (typeD==-1)
return std::string(Materials->other[typeC].rawname); return std::string(Materials->other[typeC].rawname);
else else
return std::string(Materials->other[typeC].rawname) + " derivate"; return std::string(Materials->other[typeC].rawname) + " derivate";
} }
} }
else else
return Materials->inorganic[typeD].id; return Materials->inorganic[typeD].id;
} }
else else
{ {
if(typeD>=Materials->raceEx.size()) if (typeD>=Materials->raceEx.size())
return "unknown race"; return "unknown race";
typeC-=19; typeC-=19;
if((typeC<0) || (typeC>=Materials->raceEx[typeD].extract.size())) if ((typeC<0) || (typeC>=Materials->raceEx[typeD].extract.size()))
{ {
return string(Materials->raceEx[typeD].rawname).append(" extract"); return string(Materials->raceEx[typeD].rawname).append(" extract");
} }
return std::string(Materials->raceEx[typeD].rawname).append(" ").append(Materials->raceEx[typeD].extract[typeC].rawname); return std::string(Materials->raceEx[typeD].rawname).append(" ").append(Materials->raceEx[typeD].extract[typeC].rawname);
} }
} }
else else
{ {
return Materials->organic[typeD].id; return Materials->organic[typeD].id;
} }
} }
int main () int main ()
{ {
DFHack::API DF("Memory.xml"); DFHack::API DF("Memory.xml");
DFHack::Process * p; DFHack::Process * p;
unsigned int i,j; unsigned int i,j;
try try
{ {
DF.Attach(); DF.Attach();
} }
catch (exception& e) catch (exception& e)
{ {
cerr << e.what() << endl; cerr << e.what() << endl;
#ifndef LINUX_BUILD #ifndef LINUX_BUILD
cin.ignore(); cin.ignore();
#endif #endif
return 1; return 1;
} }
DFHack::memory_info * mem = DF.getMemoryInfo(); DFHack::memory_info * mem = DF.getMemoryInfo();
Materials = DF.getMaterials(); Materials = DF.getMaterials();
Materials->ReadAllMaterials(); Materials->ReadAllMaterials();
p = DF.getProcess(); p = DF.getProcess();
DFHack::DfVector <uint32_t> p_items (p, p->getDescriptor()->getAddress ("items_vector")); DFHack::DfVector <uint32_t> p_items (p, p->getDescriptor()->getAddress ("items_vector"));
uint32_t size = p_items.size(); uint32_t size = p_items.size();
printf("type\tvtable\tname\tquality\tdecorate\n"); printf("type\tvtable\tname\tquality\tdecorate\n");
for(i=0;i<size;i++) for (i=0;i<size;i++)
{ {
uint32_t vtable = p->readDWord(p_items[i]); uint32_t vtable = p->readDWord(p_items[i]);
uint32_t func0 = p->readDWord(vtable); uint32_t func0 = p->readDWord(vtable);
uint64_t funct0 = p->readQuad(func0); uint64_t funct0 = p->readQuad(func0);
uint32_t func1 = p->readDWord(vtable+0x238); uint32_t func1 = p->readDWord(vtable+0x238);
uint64_t funct1 = p->readQuad(func1); uint64_t funct1 = p->readQuad(func1);
uint32_t func2 = p->readDWord(vtable+0x288); uint32_t func2 = p->readDWord(vtable+0x288);
uint64_t funct2 = p->readQuad(func2); uint64_t funct2 = p->readQuad(func2);
uint32_t type = (funct0>>8)&0xffff; uint32_t type = (funct0>>8)&0xffff;
uint32_t funcB = p->readDWord(vtable + 4); uint32_t funcB = p->readDWord(vtable + 4);
uint32_t funcC = p->readDWord(vtable + 8); uint32_t funcC = p->readDWord(vtable + 8);
uint32_t funcD = p->readDWord(vtable + 12); uint32_t funcD = p->readDWord(vtable + 12);
uint64_t funcBt = p->readQuad(funcB); uint64_t funcBt = p->readQuad(funcB);
uint64_t funcCt = p->readQuad(funcC); uint64_t funcCt = p->readQuad(funcC);
uint64_t funcDt = p->readQuad(funcD); uint64_t funcDt = p->readQuad(funcD);
int16_t typeB = -1; int16_t typeB = -1;
int16_t typeC = -1; int16_t typeC = -1;
int32_t typeD = -1; int32_t typeD = -1;
uint32_t quality = 0; uint32_t quality = 0;
bool hasDecorations; bool hasDecorations;
string desc = p->readClassName(vtable); string desc = p->readClassName(vtable);
if( (funct0&0xFFFFFFFFFF000000LL) != 0xCCCCC30000000000LL ) if ( (funct0&0xFFFFFFFFFF000000LL) != 0xCCCCC30000000000LL )
{ {
if(funct0 == 0xCCCCCCCCCCC3C033LL) if (funct0 == 0xCCCCCCCCCCC3C033LL)
type = 0; type = 0;
else else
printf("bad type function address=%p", (void*)func0); printf("bad type function address=%p", (void*)func0);
} }
if(funct1 == 0xC300000092818B66LL) if (funct1 == 0xC300000092818B66LL)
quality = p->readWord(p_items[i]+0x92); quality = p->readWord(p_items[i]+0x92);
else if(funct1 == 0xCCCCCCCCCCC3C033) else if (funct1 == 0xCCCCCCCCCCC3C033LL)
quality = 0; quality = 0;
else else
printf("bad quality function address=%p\n", (void*) func1); printf("bad quality function address=%p\n", (void*) func1);
if(funct2 == 0xCCCCCCCCCCC3C032LL) if (funct2 == 0xCCCCCCCCCCC3C032LL)
hasDecorations = false; hasDecorations = false;
else if(funct2 == 0xCCCCCCCCCCC301B0) else if (funct2 == 0xCCCCCCCCCCC301B0LL)
hasDecorations = true; hasDecorations = true;
else else
printf("bad decoration function address=%p\n", (void*) func2); printf("bad decoration function address=%p\n", (void*) func2);
if(funcBt == 0xCCCCCCCCC3FFC883LL) if (funcBt == 0xCCCCCCCCC3FFC883LL)
typeB = -1; typeB = -1;
else else
{ {
uint64_t funcBtEnd = p->readQuad(funcB+8); uint64_t funcBtEnd = p->readQuad(funcB+8);
if( if (
((funcBt&0xFFFFFFFF0000FFFFLL) == 0x8B6600000000818BLL) && ((funcBt&0xFFFFFFFF0000FFFFLL) == 0x8B6600000000818BLL) &&
((funcBtEnd&0xFFFFFFFFFFFF00FFLL) == 0xCCCCCCCCCCC30040LL) ) ((funcBtEnd&0xFFFFFFFFFFFF00FFLL) == 0xCCCCCCCCCCC30040LL) )
{ {
uint32_t off1 = (funcBt>>16) & 0xffff; uint32_t off1 = (funcBt>>16) & 0xffff;
uint32_t off2 = (funcBtEnd>>8) & 0xff; uint32_t off2 = (funcBtEnd>>8) & 0xff;
uint32_t pt1 = p->readDWord(p_items[i] + off1); uint32_t pt1 = p->readDWord(p_items[i] + off1);
typeB = p->readWord(pt1 + off2); typeB = p->readWord(pt1 + off2);
} }
else if((funcBt&0xFFFFFF0000FFFFFFLL)==0xC300000000818B66LL) else if ((funcBt&0xFFFFFF0000FFFFFFLL)==0xC300000000818B66LL)
{ {
uint32_t off1 = (funcBt>>24) & 0xffff; uint32_t off1 = (funcBt>>24) & 0xffff;
typeB = p->readWord(p_items[i] + off1); typeB = p->readWord(p_items[i] + off1);
} }
else else
printf("bad typeB func @%p\n", (void*) funcB); printf("bad typeB func @%p\n", (void*) funcB);
} }
if(funcCt == 0xCCCCCCCCC3FFC883LL) if (funcCt == 0xCCCCCCCCC3FFC883LL)
typeC = -1; typeC = -1;
else if( (funcCt&0xFFFFFF0000FFFFFFLL) == 0xC300000000818B66 ) else if ( (funcCt&0xFFFFFF0000FFFFFFLL) == 0xC300000000818B66LL )
{ {
uint32_t off1 = (funcCt>>24)&0xffff; uint32_t off1 = (funcCt>>24)&0xffff;
typeC = p->readWord(p_items[i] + off1); typeC = p->readWord(p_items[i] + off1);
} }
else else
printf("bad typeC func @%p\n", (void*) funcC); printf("bad typeC func @%p\n", (void*) funcC);
if(funcDt == 0xCCCCCCCCC3FFC883LL) if (funcDt == 0xCCCCCCCCC3FFC883LL)
typeD = -1; typeD = -1;
else if( (funcDt&0xFFFFFFFF0000FFFFLL) == 0xCCC300000000818BLL ) else if ( (funcDt&0xFFFFFFFF0000FFFFLL) == 0xCCC300000000818BLL )
{ {
uint32_t off1 = (funcDt>>16) & 0xffff; uint32_t off1 = (funcDt>>16) & 0xffff;
typeD = p->readDWord(p_items[i] + off1); typeD = p->readDWord(p_items[i] + off1);
} }
else if ( (funcDt&0xFFFFFF0000FFFFFFLL) == 0xC30000000081BF0FLL ) else if ( (funcDt&0xFFFFFF0000FFFFFFLL) == 0xC30000000081BF0FLL )
{ {
uint32_t off1 = (funcDt>>24) & 0xffff; uint32_t off1 = (funcDt>>24) & 0xffff;
typeD = (int16_t) p->readWord(p_items[i] + off1); typeD = (int16_t) p->readWord(p_items[i] + off1);
} }
else else
printf("bad typeD func @%p\n", (void*) funcD); printf("bad typeD func @%p\n", (void*) funcD);
// printf("%p\t%.16LX\t", (void*) func2, funct2); // printf("%p\t%.16LX\t", (void*) func2, funct2);
printf("%d\t%p\t%s\t%d\t[%d,%d,%d -> %s]", type, (void*)vtable, desc.c_str(), quality, printf("%d\t%p\t%s\t%d\t[%d,%d,%d -> %s]", type, (void*)vtable, desc.c_str(), quality,
typeB, typeC, typeD, getMatDesc(typeB, typeC, typeD).c_str()); typeB, typeC, typeD, getMatDesc(typeB, typeC, typeD).c_str());
// printf("\t%p\t%.16LX", (void *) funcD, funcDt); // printf("\t%p\t%.16LX", (void *) funcD, funcDt);
if(hasDecorations) if (hasDecorations)
{ {
bool sep = false; bool sep = false;
printf("\tdeco=["); printf("\tdeco=[");
uint32_t decStart = p->readDWord(p_items[i] + 0xAC); uint32_t decStart = p->readDWord(p_items[i] + 0xAC);
uint32_t decEnd = p->readDWord(p_items[i] + 0xB0); uint32_t decEnd = p->readDWord(p_items[i] + 0xB0);
if(decStart != decEnd) if (decStart != decEnd)
{ {
for(j=decStart;j<decEnd;j+=4) for (j=decStart;j<decEnd;j+=4)
{ {
uint32_t decoration = p->readDWord(j); uint32_t decoration = p->readDWord(j);
uint32_t dvtable = p->readDWord(decoration); uint32_t dvtable = p->readDWord(decoration);
string ddesc = p->readClassName(dvtable); string ddesc = p->readClassName(dvtable);
uint32_t dtypefunc = p->readDWord(dvtable + 20); uint32_t dtypefunc = p->readDWord(dvtable + 20);
uint64_t dtypefunct = p->readQuad(dtypefunc); uint64_t dtypefunct = p->readQuad(dtypefunc);
uint32_t dtypeC = p->readWord(decoration + 0x4); uint32_t dtypeC = p->readWord(decoration + 0x4);
uint32_t dtypeD = p->readDWord(decoration + 0x8); uint32_t dtypeD = p->readDWord(decoration + 0x8);
uint32_t dtype = 0; uint32_t dtype = 0;
uint32_t dqual = p->readWord(decoration + 20); uint32_t dqual = p->readWord(decoration + 20);
if( (dtypefunct&0xFFFFFFFFFFFF00FFLL) == 0xCCCCC300000000B8LL) if ( (dtypefunct&0xFFFFFFFFFFFF00FFLL) == 0xCCCCC300000000B8LL)
dtype = (dtypefunct>>8)&0xfffffff; dtype = (dtypefunct>>8)&0xfffffff;
else else
printf("bad decoration type function, address=%p\n", (void*) dtypefunc); printf("bad decoration type function, address=%p\n", (void*) dtypefunc);
if(sep) if (sep)
printf(","); printf(",");
printf("%s[t=%d,q=%d,%s{%d,%d}]", ddesc.c_str(), dtype, dqual, getMatDesc(-1, dtypeC, dtypeD).c_str(), dtypeC, dtypeD); printf("%s[t=%d,q=%d,%s{%d,%d}]", ddesc.c_str(), dtype, dqual, getMatDesc(-1, dtypeC, dtypeD).c_str(), dtypeC, dtypeD);
sep = true; sep = true;
} }
} }
printf("]"); printf("]");
} }
printf("\n"); printf("\n");
} }
#ifndef LINUX_BUILD #ifndef LINUX_BUILD
cout << "Done. Press any key to continue" << endl; cout << "Done. Press any key to continue" << endl;
cin.ignore(); cin.ignore();
#endif #endif
return 0; return 0;
} }

@ -66,3 +66,4 @@ int main (void)
#endif #endif
return 0; return 0;
} }

@ -162,7 +162,7 @@ int puttile(int x, int y, int tiletype, int color)
attroff(COLOR_PAIR(color)); attroff(COLOR_PAIR(color));
} }
int cprintf(char *fmt, ...) int cprintf(const char *fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
@ -440,7 +440,7 @@ void do_features(API& DF, mapblock40d * block, uint32_t blockX, uint32_t blockY,
cprintf("You've discovered it already!"); cprintf("You've discovered it already!");
} }
char * matname = "unknown"; char * matname = (char *) "unknown";
// is stone? // is stone?
if(ftr.main_material == 0) if(ftr.main_material == 0)
{ {
@ -468,7 +468,7 @@ void do_features(API& DF, mapblock40d * block, uint32_t blockX, uint32_t blockY,
gotoxy(printX,printY+ 5); gotoxy(printX,printY+ 5);
cprintf("You've discovered it already!"); cprintf("You've discovered it already!");
} }
char * matname = "unknown"; char * matname = (char *) "unknown";
// is stone? // is stone?
if(ftr.main_material == 0) if(ftr.main_material == 0)
{ {