Update to use the new symbols file.

develop
Petr Mrázek 2012-02-11 19:24:44 +01:00
parent 8527547cbe
commit ed53ee7031
5 changed files with 22 additions and 22 deletions

@ -198,7 +198,7 @@ install(TARGETS dfhack
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION} LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}
RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION}) RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION})
#install the offset file #install the offset file
install(FILES ${dfhack_SOURCE_DIR}/Memory.xml install(FILES xml/symbols.xml
DESTINATION ${DFHACK_DATA_DESTINATION}) #linux: share/dfhack DESTINATION ${DFHACK_DATA_DESTINATION}) #linux: share/dfhack
if(BUILD_DEVEL) if(BUILD_DEVEL)

@ -594,9 +594,9 @@ bool Core::Init()
// find out what we are... // find out what we are...
#ifdef LINUX_BUILD #ifdef LINUX_BUILD
const char * path = "hack/Memory.xml"; const char * path = "hack/symbols.xml";
#else #else
const char * path = "hack\\Memory.xml"; const char * path = "hack\\symbols.xml";
#endif #endif
vif = new DFHack::VersionInfoFactory(); vif = new DFHack::VersionInfoFactory();
cerr << "Identifying DF version.\n"; cerr << "Identifying DF version.\n";
@ -607,7 +607,7 @@ bool Core::Init()
catch(Error::All & err) catch(Error::All & err)
{ {
std::stringstream out; std::stringstream out;
out << "Error while reading Memory.xml:\n"; out << "Error while reading symbols.xml:\n";
out << err.what() << std::endl; out << err.what() << std::endl;
delete vif; delete vif;
vif = NULL; vif = NULL;
@ -849,7 +849,7 @@ bool Core::ncurses_wgetch(int in, int & out)
if(df::global::ui && df::global::gview && g->df_menu_state) if(df::global::ui && df::global::gview && g->df_menu_state)
{ {
df::viewscreen * ws = g->GetCurrentScreen(); df::viewscreen * ws = g->GetCurrentScreen();
// FIXME: put hardcoded values into memory.xml // FIXME: USE ENUMS
if(((t_virtual *)ws)->getClassName() == "viewscreen_dwarfmodest" && *g->df_menu_state == 0x23) if(((t_virtual *)ws)->getClassName() == "viewscreen_dwarfmodest" && *g->df_menu_state == 0x23)
{ {
out = in; out = in;
@ -875,7 +875,7 @@ int Core::SDL_Event(SDL::Event* ev, int orig_return)
if(ev && ev->type == SDL::ET_KEYDOWN || ev->type == SDL::ET_KEYUP) if(ev && ev->type == SDL::ET_KEYDOWN || ev->type == SDL::ET_KEYUP)
{ {
SDL::KeyboardEvent * ke = (SDL::KeyboardEvent *)ev; SDL::KeyboardEvent * ke = (SDL::KeyboardEvent *)ev;
if(ke->state == SDL::BTN_PRESSED && !hotkey_states[ke->ksym.sym]) if(ke->state == SDL::BTN_PRESSED && !hotkey_states[ke->ksym.sym])
{ {
hotkey_states[ke->ksym.sym] = true; hotkey_states[ke->ksym.sym] = true;

@ -86,9 +86,9 @@ void VersionInfoFactory::ParseVersion (TiXmlElement* entry, VersionInfo* mem)
if (!cstr_name) if (!cstr_name)
throw Error::MemoryXmlBadAttribute("name"); throw Error::MemoryXmlBadAttribute("name");
const char *cstr_os = entry->Attribute("os"); const char *cstr_os = entry->Attribute("os-type");
if (!cstr_os) if (!cstr_os)
throw Error::MemoryXmlBadAttribute("os"); throw Error::MemoryXmlBadAttribute("os-type");
string os = cstr_os; string os = cstr_os;
mem->setVersion(cstr_name); mem->setVersion(cstr_name);
@ -107,7 +107,7 @@ void VersionInfoFactory::ParseVersion (TiXmlElement* entry, VersionInfo* mem)
} }
else else
{ {
throw Error::MemoryXmlBadAttribute("os"); throw Error::MemoryXmlBadAttribute("os-type");
} }
// process additional entries // process additional entries
@ -118,9 +118,9 @@ void VersionInfoFactory::ParseVersion (TiXmlElement* entry, VersionInfo* mem)
string type, name, value; string type, name, value;
const char *cstr_type = pMemEntry->Value(); const char *cstr_type = pMemEntry->Value();
type = cstr_type; type = cstr_type;
if(type == "Address") if(type == "global-address")
{ {
const char *cstr_key = pMemEntry->Attribute("key"); const char *cstr_key = pMemEntry->Attribute("name");
if(!cstr_key) if(!cstr_key)
throw Error::MemoryXmlUnderspecifiedEntry(cstr_name); throw Error::MemoryXmlUnderspecifiedEntry(cstr_name);
const char *cstr_value = pMemEntry->Attribute("value"); const char *cstr_value = pMemEntry->Attribute("value");
@ -128,14 +128,14 @@ void VersionInfoFactory::ParseVersion (TiXmlElement* entry, VersionInfo* mem)
throw Error::MemoryXmlUnderspecifiedEntry(cstr_name); throw Error::MemoryXmlUnderspecifiedEntry(cstr_name);
mem->setAddress(cstr_key, strtol(cstr_value, 0, 0)); mem->setAddress(cstr_key, strtol(cstr_value, 0, 0));
} }
else if (type == "MD5") else if (type == "md5-hash")
{ {
const char *cstr_value = pMemEntry->Attribute("value"); const char *cstr_value = pMemEntry->Attribute("value");
if(!cstr_value) if(!cstr_value)
throw Error::MemoryXmlUnderspecifiedEntry(cstr_name); throw Error::MemoryXmlUnderspecifiedEntry(cstr_name);
mem->addMD5(cstr_value); mem->addMD5(cstr_value);
} }
else if (type == "PETimeStamp") else if (type == "binary-timestamp")
{ {
const char *cstr_value = pMemEntry->Attribute("value"); const char *cstr_value = pMemEntry->Attribute("value");
if(!cstr_value) if(!cstr_value)
@ -176,7 +176,7 @@ bool VersionInfoFactory::loadFile(string path_to_xml)
throw Error::MemoryXmlNoRoot(); throw Error::MemoryXmlNoRoot();
} }
string m_name=pElem->Value(); string m_name=pElem->Value();
if(m_name != "DFHack") if(m_name != "data-definition")
{ {
error = true; error = true;
throw Error::MemoryXmlNoRoot(); throw Error::MemoryXmlNoRoot();
@ -188,8 +188,8 @@ bool VersionInfoFactory::loadFile(string path_to_xml)
{ {
clear(); clear();
// For each version // For each version
TiXmlElement * pMemInfo=hRoot.FirstChild( "Version" ).Element(); TiXmlElement * pMemInfo=hRoot.FirstChild( "symbol-table" ).Element();
for( ; pMemInfo; pMemInfo=pMemInfo->NextSiblingElement("Version")) for( ; pMemInfo; pMemInfo=pMemInfo->NextSiblingElement("symbol-table"))
{ {
const char *name = pMemInfo->Attribute("name"); const char *name = pMemInfo->Attribute("name");
if(name) if(name)
@ -201,6 +201,6 @@ bool VersionInfoFactory::loadFile(string path_to_xml)
} }
} }
error = false; error = false;
std::cerr << "Loaded " << versions.size() << " DF versions." << std::endl; std::cerr << "Loaded " << versions.size() << " DF symbol tables." << std::endl;
return true; return true;
} }

@ -260,7 +260,7 @@ namespace DFHack
{ {
return true; return true;
}; };
/// @return true if the process is identified -- has a Memory.xml entry /// @return true if the process is identified -- has a symbol table extension
bool isIdentified() bool isIdentified()
{ {
return identified; return identified;
@ -270,7 +270,7 @@ namespace DFHack
/// get virtual memory ranges of the process (what is mapped where) /// get virtual memory ranges of the process (what is mapped where)
void getMemRanges(std::vector<t_memrange> & ranges ); void getMemRanges(std::vector<t_memrange> & ranges );
/// get the flattened Memory.xml entry of this process /// get the symbol table extension of this process
VersionInfo *getDescriptor() VersionInfo *getDescriptor()
{ {
return my_descriptor; return my_descriptor;
@ -281,8 +281,8 @@ namespace DFHack
/// get the DF Process FilePath /// get the DF Process FilePath
std::string getPath(); std::string getPath();
/// modify permisions of memory range /// modify permisions of memory range
bool setPermisions(const t_memrange & range,const t_memrange &trgrange); bool setPermisions(const t_memrange & range,const t_memrange &trgrange);
private: private:
VersionInfo * my_descriptor; VersionInfo * my_descriptor;
PlatformSpecific *d; PlatformSpecific *d;

@ -1 +1 @@
Subproject commit 3b20ecfbfcb7b801dbe83b1c22f183ca6085af9e Subproject commit b3534e853f99129b1664766f09f461d54be6cbfe