Changeset View
Changeset View
Standalone View
Standalone View
source/ps/XML/XeroXMB.h
Show All 31 Lines | * Tries to avoid using strings - you usually have to load the | ||||
numeric IDs and use them instead. | numeric IDs and use them instead. | ||||
Theoretical file structure: | Theoretical file structure: | ||||
XMB_File { | XMB_File { | ||||
char Header[4]; // because everyone has one; currently "XMB0" | char Header[4]; // because everyone has one; currently "XMB0" | ||||
u32 Version; | u32 Version; | ||||
u32 NumberOfDependencies; | |||||
ZStr8 DependenciesPath[]; | |||||
int ElementNameCount; | int ElementNameCount; | ||||
ZStr8 ElementNames[]; | ZStr8 ElementNames[]; | ||||
int AttributeNameCount; | int AttributeNameCount; | ||||
ZStr8 AttributeNames[]; | ZStr8 AttributeNames[]; | ||||
XMB_Node Root; | XMB_Node Root; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | public: | ||||
// load a partially valid XMB file (e.g. if the game was interrupted | // load a partially valid XMB file (e.g. if the game was interrupted | ||||
// while writing it), which we detect by checking the magic string. | // while writing it), which we detect by checking the magic string. | ||||
// It also fails when trying to load an XMB file with a different version. | // It also fails when trying to load an XMB file with a different version. | ||||
bool Initialise(const char* FileData); | bool Initialise(const char* FileData); | ||||
// Returns the root element | // Returns the root element | ||||
XMBElement GetRoot() const; | XMBElement GetRoot() const; | ||||
// Returns internal ID for a given element/attribute string. | // Returns internal ID for a given element/attribute string. | ||||
int GetElementID(const char* Name) const; | int GetElementID(const char* Name) const; | ||||
int GetAttributeID(const char* Name) const; | int GetAttributeID(const char* Name) const; | ||||
// For lazy people (e.g. me) when speed isn't vital: | // For lazy people (e.g. me) when speed isn't vital: | ||||
// Returns element/attribute string for a given internal ID | // Returns element/attribute string for a given internal ID | ||||
std::string GetElementString(const int ID) const; | std::string GetElementString(const int ID) const; | ||||
std::string GetAttributeString(const int ID) const; | std::string GetAttributeString(const int ID) const; | ||||
protected: | |||||
std::set<std::string> m_Dependencies; | |||||
private: | private: | ||||
const char* m_Pointer; | const char* m_Pointer; | ||||
#ifdef XERO_USEMAP | #ifdef XERO_USEMAP | ||||
std::map<std::string, int> m_ElementNames; | std::map<std::string, int> m_ElementNames; | ||||
std::map<std::string, int> m_AttributeNames; | std::map<std::string, int> m_AttributeNames; | ||||
#else | #else | ||||
int m_ElementNameCount; | int m_ElementNameCount; | ||||
▲ Show 20 Lines • Show All 160 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator