mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-22 03:09:15 +01:00
Change TinyXML to pugixml
Thanks to Oddx.
This commit is contained in:
parent
8ab03c4bf9
commit
fbfcba4200
@ -7,17 +7,15 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "FileOperations/fileops.h"
|
#include "FileOperations/fileops.h"
|
||||||
#include "xml/tinyxml2.h"
|
#include "xml/pugixml.hpp"
|
||||||
#include "gecko.h"
|
#include "gecko.h"
|
||||||
|
|
||||||
#include "HomebrewXML.h"
|
#include "HomebrewXML.h"
|
||||||
|
|
||||||
using namespace tinyxml2;
|
#define ENTRIE_SIZE 8192
|
||||||
|
|
||||||
#define ENTRIE_SIZE 8192
|
|
||||||
|
|
||||||
/* qparam filename Filepath of the XML file */
|
/* qparam filename Filepath of the XML file */
|
||||||
int HomebrewXML::LoadHomebrewXMLData(const char* filename)
|
int HomebrewXML::LoadHomebrewXMLData(const char *filename)
|
||||||
{
|
{
|
||||||
Name.clear();
|
Name.clear();
|
||||||
Coder.clear();
|
Coder.clear();
|
||||||
@ -26,121 +24,109 @@ int HomebrewXML::LoadHomebrewXMLData(const char* filename)
|
|||||||
LongDescription.clear();
|
LongDescription.clear();
|
||||||
Releasedate.clear();
|
Releasedate.clear();
|
||||||
|
|
||||||
XMLDocument xmlDoc;
|
pugi::xml_document xmlDoc;
|
||||||
if(xmlDoc.LoadFile(filename) != 0)
|
pugi::xml_parse_result result = xmlDoc.load_file(filename);
|
||||||
return false;
|
if (!result)
|
||||||
|
return 0;
|
||||||
|
|
||||||
XMLElement *appNode = xmlDoc.FirstChildElement("app");
|
Name = xmlDoc.child("app").child_value("name");
|
||||||
if(!appNode)
|
Coder = xmlDoc.child("app").child_value("coder");
|
||||||
return false;
|
Version = xmlDoc.child("app").child_value("version");
|
||||||
|
ShortDescription = xmlDoc.child("app").child_value("short_description");
|
||||||
|
LongDescription = xmlDoc.child("app").child_value("long_description");
|
||||||
|
|
||||||
XMLElement *node = NULL;
|
std::string ReleaseText = xmlDoc.child("app").child_value("release_date");
|
||||||
|
if (ReleaseText.length() >= 6)
|
||||||
node = appNode->FirstChildElement("name");
|
|
||||||
if(node && node->FirstChild() && node->FirstChild()->Value())
|
|
||||||
Name = node->FirstChild()->Value();
|
|
||||||
|
|
||||||
node = appNode->FirstChildElement("coder");
|
|
||||||
if(node && node->FirstChild() && node->FirstChild()->Value())
|
|
||||||
Coder = node->FirstChild()->Value();
|
|
||||||
|
|
||||||
node = appNode->FirstChildElement("version");
|
|
||||||
if(node && node->FirstChild() && node->FirstChild()->Value())
|
|
||||||
Version = node->FirstChild()->Value();
|
|
||||||
|
|
||||||
node = appNode->FirstChildElement("short_description");
|
|
||||||
if(node && node->FirstChild() && node->FirstChild()->Value())
|
|
||||||
ShortDescription = node->FirstChild()->Value();
|
|
||||||
|
|
||||||
node = appNode->FirstChildElement("long_description");
|
|
||||||
if(node && node->FirstChild() && node->FirstChild()->Value())
|
|
||||||
LongDescription = node->FirstChild()->Value();
|
|
||||||
|
|
||||||
char ReleaseText[200];
|
|
||||||
memset(ReleaseText, 0, sizeof(ReleaseText));
|
|
||||||
|
|
||||||
node = appNode->FirstChildElement("release_date");
|
|
||||||
if(node && node->FirstChild() && node->FirstChild()->Value())
|
|
||||||
snprintf(ReleaseText, sizeof(ReleaseText), node->FirstChild()->Value());
|
|
||||||
|
|
||||||
int len = (strlen(ReleaseText) - 6); //length of the date string without the 200000 at the end
|
|
||||||
if (len == 8)
|
|
||||||
snprintf(ReleaseText, sizeof(ReleaseText), "%c%c/%c%c/%c%c%c%c", ReleaseText[4], ReleaseText[5], ReleaseText[6], ReleaseText[7], ReleaseText[0], ReleaseText[1], ReleaseText[2], ReleaseText[3]);
|
|
||||||
else if (len == 6)
|
|
||||||
snprintf(ReleaseText, sizeof(ReleaseText), "%c%c/%c%c%c%c", ReleaseText[4], ReleaseText[5], ReleaseText[0], ReleaseText[1], ReleaseText[2], ReleaseText[3]);
|
|
||||||
|
|
||||||
Releasedate = ReleaseText;
|
|
||||||
|
|
||||||
node = appNode->FirstChildElement("arguments");
|
|
||||||
if(!node)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
XMLElement *argNode = node->FirstChildElement("arg");
|
|
||||||
|
|
||||||
while(argNode)
|
|
||||||
{
|
{
|
||||||
if(argNode->FirstChild() && argNode->FirstChild()->Value())
|
if (ReleaseText.find("/") == std::string::npos)
|
||||||
Arguments.push_back(std::string(argNode->FirstChild()->Value()));
|
{
|
||||||
|
Releasedate = ReleaseText.substr(4, 2);
|
||||||
argNode = argNode->NextSiblingElement();
|
if (ReleaseText.length() >= 8)
|
||||||
|
{
|
||||||
|
Releasedate.append("/");
|
||||||
|
Releasedate.append(ReleaseText.substr(6, 2));
|
||||||
|
}
|
||||||
|
Releasedate.append("/");
|
||||||
|
Releasedate.append(ReleaseText.substr(0, 4));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Releasedate = ReleaseText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (pugi::xml_node arg : xmlDoc.child("app").child("arguments").children("arg"))
|
||||||
|
Arguments.push_back(arg.text().as_string());
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int HomebrewXML::SaveHomebrewXMLData(const char* filename)
|
int HomebrewXML::SaveHomebrewXMLData(const char *filename)
|
||||||
{
|
{
|
||||||
const int max_line_size = 4096;
|
const int max_line_size = 4096;
|
||||||
char *line = new (std::nothrow) char[max_line_size];
|
char *line = new (std::nothrow) char[max_line_size];
|
||||||
if(!line) return 0;
|
if (!line)
|
||||||
|
return 0;
|
||||||
|
|
||||||
FILE *fp = fopen(filename, "wb");
|
FILE *fp = fopen(filename, "wb");
|
||||||
if(!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
delete [] line;
|
delete[] line;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(line, max_line_size,"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"); fputs(line, fp);
|
snprintf(line, max_line_size, "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n");
|
||||||
snprintf(line, max_line_size,"<app version=\"1\">\n"); fputs(line, fp);
|
fputs(line, fp);
|
||||||
snprintf(line, max_line_size," <name>%s</name>\n", GetName()); fputs(line, fp);
|
snprintf(line, max_line_size, "<app version=\"1\">\n");
|
||||||
snprintf(line, max_line_size," <coder>%s</coder>\n", GetCoder()); fputs(line, fp);
|
fputs(line, fp);
|
||||||
snprintf(line, max_line_size," <version>%s</version>\n", GetVersion()); fputs(line, fp);
|
snprintf(line, max_line_size, " <name>%s</name>\n", GetName());
|
||||||
snprintf(line, max_line_size," <release_date>%s</release_date>\n", GetReleasedate()); fputs(line, fp);
|
fputs(line, fp);
|
||||||
|
snprintf(line, max_line_size, " <coder>%s</coder>\n", GetCoder());
|
||||||
|
fputs(line, fp);
|
||||||
|
snprintf(line, max_line_size, " <version>%s</version>\n", GetVersion());
|
||||||
|
fputs(line, fp);
|
||||||
|
snprintf(line, max_line_size, " <release_date>%s</release_date>\n", GetReleasedate());
|
||||||
|
fputs(line, fp);
|
||||||
if (Arguments.size() > 0)
|
if (Arguments.size() > 0)
|
||||||
{
|
{
|
||||||
snprintf(line, max_line_size," <arguments>\n"); fputs(line, fp);
|
snprintf(line, max_line_size, " <arguments>\n");
|
||||||
for(u8 i = 0; i < Arguments.size(); i++)
|
fputs(line, fp);
|
||||||
|
for (u8 i = 0; i < Arguments.size(); i++)
|
||||||
{
|
{
|
||||||
snprintf(line, max_line_size," <arg>%s</arg>\n", Arguments[i].c_str()); fputs(line, fp);
|
snprintf(line, max_line_size, " <arg>%s</arg>\n", Arguments[i].c_str());
|
||||||
|
fputs(line, fp);
|
||||||
}
|
}
|
||||||
snprintf(line, max_line_size," </arguments>\n"); fputs(line, fp);
|
snprintf(line, max_line_size, " </arguments>\n");
|
||||||
|
fputs(line, fp);
|
||||||
}
|
}
|
||||||
snprintf(line, max_line_size," <ahb_access/>\n"); fputs(line, fp);
|
snprintf(line, max_line_size, " <ahb_access/>\n");
|
||||||
snprintf(line, max_line_size," <short_description>%s</short_description>\n", GetShortDescription()); fputs(line, fp);
|
fputs(line, fp);
|
||||||
snprintf(line, max_line_size," <long_description>%s</long_description>\n", GetLongDescription()); fputs(line, fp);
|
snprintf(line, max_line_size, " <short_description>%s</short_description>\n", GetShortDescription());
|
||||||
snprintf(line, max_line_size,"</app>\n"); fputs(line, fp);
|
fputs(line, fp);
|
||||||
|
snprintf(line, max_line_size, " <long_description>%s</long_description>\n", GetLongDescription());
|
||||||
|
fputs(line, fp);
|
||||||
|
snprintf(line, max_line_size, "</app>\n");
|
||||||
|
fputs(line, fp);
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
delete [] line;
|
delete[] line;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set argument */
|
/* Set argument */
|
||||||
void HomebrewXML::SetArgument(const char* argument)
|
void HomebrewXML::SetArgument(const char *argument)
|
||||||
{
|
{
|
||||||
// Crop value from argument, if present
|
// Crop value from argument, if present
|
||||||
char argName[strlen(argument)+1];
|
char argName[strlen(argument) + 1];
|
||||||
strcpy(argName, argument);
|
strcpy(argName, argument);
|
||||||
char *ptr = strrchr(argName, '=');
|
char *ptr = strrchr(argName, '=');
|
||||||
if(ptr) *(ptr+1) = 0;
|
if (ptr)
|
||||||
|
*(ptr + 1) = 0;
|
||||||
|
|
||||||
// Check if argument already exists and edit it
|
// Check if argument already exists and edit it
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for(u8 i=0; i < Arguments.size(); i++)
|
for (u8 i = 0; i < Arguments.size(); i++)
|
||||||
{
|
{
|
||||||
size_t pos = Arguments[i].find(argName);
|
size_t pos = Arguments[i].find(argName);
|
||||||
if(pos != std::string::npos)
|
if (pos != std::string::npos)
|
||||||
{
|
{
|
||||||
Arguments[i] = argument;
|
Arguments[i] = argument;
|
||||||
found = true;
|
found = true;
|
||||||
@ -149,54 +135,54 @@ void HomebrewXML::SetArgument(const char* argument)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if it doesn't exist, add the new argument.
|
// if it doesn't exist, add the new argument.
|
||||||
if(!found)
|
if (!found)
|
||||||
Arguments.push_back(argument);
|
Arguments.push_back(argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get name */
|
/* Get name */
|
||||||
const char * HomebrewXML::GetName() const
|
const char *HomebrewXML::GetName() const
|
||||||
{
|
{
|
||||||
return Name.c_str();
|
return Name.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set Name */
|
/* Set Name */
|
||||||
void HomebrewXML::SetName(char * newName)
|
void HomebrewXML::SetName(char *newName)
|
||||||
{
|
{
|
||||||
Name = newName;
|
Name = newName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get coder */
|
/* Get coder */
|
||||||
const char * HomebrewXML::GetCoder() const
|
const char *HomebrewXML::GetCoder() const
|
||||||
{
|
{
|
||||||
return Coder.c_str();
|
return Coder.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get version */
|
/* Get version */
|
||||||
const char * HomebrewXML::GetVersion() const
|
const char *HomebrewXML::GetVersion() const
|
||||||
{
|
{
|
||||||
return Version.c_str();
|
return Version.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set version */
|
/* Set version */
|
||||||
void HomebrewXML::SetVersion(const char * newVer)
|
void HomebrewXML::SetVersion(const char *newVer)
|
||||||
{
|
{
|
||||||
Version = newVer;
|
Version = newVer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get releasedate */
|
/* Get releasedate */
|
||||||
const char * HomebrewXML::GetReleasedate() const
|
const char *HomebrewXML::GetReleasedate() const
|
||||||
{
|
{
|
||||||
return Releasedate.c_str();
|
return Releasedate.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get shortdescription */
|
/* Get shortdescription */
|
||||||
const char * HomebrewXML::GetShortDescription() const
|
const char *HomebrewXML::GetShortDescription() const
|
||||||
{
|
{
|
||||||
return ShortDescription.c_str();
|
return ShortDescription.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get longdescription */
|
/* Get longdescription */
|
||||||
const char * HomebrewXML::GetLongDescription() const
|
const char *HomebrewXML::GetLongDescription() const
|
||||||
{
|
{
|
||||||
return LongDescription.c_str();
|
return LongDescription.c_str();
|
||||||
}
|
}
|
||||||
|
@ -27,11 +27,9 @@
|
|||||||
#include "network/networkops.h"
|
#include "network/networkops.h"
|
||||||
#include "network/https.h"
|
#include "network/https.h"
|
||||||
#include "utils/StringTools.h"
|
#include "utils/StringTools.h"
|
||||||
#include "xml/tinyxml2.h"
|
#include "xml/pugixml.hpp"
|
||||||
#include "gecko.h"
|
#include "gecko.h"
|
||||||
|
|
||||||
using namespace tinyxml2;
|
|
||||||
|
|
||||||
Wiinnertag::Wiinnertag(const std::string &filepath)
|
Wiinnertag::Wiinnertag(const std::string &filepath)
|
||||||
{
|
{
|
||||||
ReadXML(filepath);
|
ReadXML(filepath);
|
||||||
@ -39,26 +37,27 @@ Wiinnertag::Wiinnertag(const std::string &filepath)
|
|||||||
|
|
||||||
bool Wiinnertag::ReadXML(const std::string &filepath)
|
bool Wiinnertag::ReadXML(const std::string &filepath)
|
||||||
{
|
{
|
||||||
XMLDocument xmlDoc;
|
pugi::xml_document xmlDoc;
|
||||||
if(xmlDoc.LoadFile(filepath.c_str()) != 0)
|
pugi::xml_parse_result result = xmlDoc.load_file(filepath.c_str());
|
||||||
|
if (!result)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
XMLElement * node = xmlDoc.FirstChildElement("Tag");
|
pugi::xml_node node = xmlDoc.child("Tag");
|
||||||
|
|
||||||
while(node != NULL)
|
while (node != NULL)
|
||||||
{
|
{
|
||||||
const char * URL = node->Attribute("URL");
|
const char *URL = node.attribute("URL").value();
|
||||||
const char * Key = node->Attribute("Key");
|
const char *Key = node.attribute("Key").value();
|
||||||
|
|
||||||
if(URL && Key)
|
if (URL && Key)
|
||||||
{
|
{
|
||||||
int size = tagList.size();
|
int size = tagList.size();
|
||||||
tagList.resize(size+1);
|
tagList.resize(size + 1);
|
||||||
tagList[size].first = URL;
|
tagList[size].first = URL;
|
||||||
tagList[size].second = Key;
|
tagList[size].second = Key;
|
||||||
}
|
}
|
||||||
|
|
||||||
node = node->NextSiblingElement();
|
node = node.next_sibling();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -66,12 +65,12 @@ bool Wiinnertag::ReadXML(const std::string &filepath)
|
|||||||
|
|
||||||
bool Wiinnertag::Send(const char *gameID)
|
bool Wiinnertag::Send(const char *gameID)
|
||||||
{
|
{
|
||||||
if(!IsNetworkInit())
|
if (!IsNetworkInit())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char sendURL[1024];
|
char sendURL[1024];
|
||||||
|
|
||||||
for(u32 i = 0; i < tagList.size(); ++i)
|
for (u32 i = 0; i < tagList.size(); ++i)
|
||||||
{
|
{
|
||||||
strcpy(sendURL, tagList[i].first.c_str());
|
strcpy(sendURL, tagList[i].first.c_str());
|
||||||
|
|
||||||
@ -88,11 +87,11 @@ bool Wiinnertag::Send(const char *gameID)
|
|||||||
|
|
||||||
bool Wiinnertag::TagGame(const char *gameID)
|
bool Wiinnertag::TagGame(const char *gameID)
|
||||||
{
|
{
|
||||||
std::string fullpath = Settings.WiinnertagPath;
|
std::string fullpath(Settings.WiinnertagPath);
|
||||||
if(fullpath.size() == 0)
|
if (fullpath.length() == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(fullpath[fullpath.size()-1] != '/')
|
if (fullpath.back() != '/')
|
||||||
fullpath += '/';
|
fullpath += '/';
|
||||||
fullpath += "Wiinnertag.xml";
|
fullpath += "Wiinnertag.xml";
|
||||||
|
|
||||||
@ -102,27 +101,26 @@ bool Wiinnertag::TagGame(const char *gameID)
|
|||||||
|
|
||||||
bool Wiinnertag::CreateExample(const std::string &filepath)
|
bool Wiinnertag::CreateExample(const std::string &filepath)
|
||||||
{
|
{
|
||||||
if(filepath.size() == 0)
|
if (filepath.length() == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
CreateSubfolder(filepath.c_str());
|
CreateSubfolder(filepath.c_str());
|
||||||
|
|
||||||
std::string fullpath = filepath;
|
std::string fullpath = filepath;
|
||||||
if(fullpath[fullpath.size()-1] != '/')
|
if (fullpath.back() != '/')
|
||||||
fullpath += '/';
|
fullpath += '/';
|
||||||
fullpath += "Wiinnertag.xml";
|
fullpath += "Wiinnertag.xml";
|
||||||
|
|
||||||
XMLDocument xmlDoc;
|
pugi::xml_document xmlDoc;
|
||||||
|
pugi::xml_node declaration = xmlDoc.append_child(pugi::node_declaration);
|
||||||
|
declaration.append_attribute("version") = "1.0";
|
||||||
|
declaration.append_attribute("encoding") = "UTF-8";
|
||||||
|
|
||||||
XMLDeclaration * declaration = xmlDoc.NewDeclaration();
|
pugi::xml_node Tag = xmlDoc.append_child("Tag");
|
||||||
xmlDoc.InsertEndChild(declaration);
|
Tag.append_attribute("URL") = "https://tag.rc24.xyz/wii?game={ID6}&key={KEY}";
|
||||||
|
Tag.append_attribute("Key") = "1234567890";
|
||||||
|
|
||||||
XMLElement *Tag = xmlDoc.NewElement("Tag");
|
xmlDoc.save_file(fullpath.c_str());
|
||||||
Tag->SetAttribute("URL", "https://tag.rc24.xyz/wii?game={ID6}&key={KEY}");
|
|
||||||
Tag->SetAttribute("Key", "1234567890");
|
|
||||||
xmlDoc.InsertEndChild(Tag);
|
|
||||||
|
|
||||||
xmlDoc.SaveFile(fullpath.c_str());
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -90,18 +90,18 @@ static bool CheckNewGameTDBVersion(const char *url)
|
|||||||
if (file.gametdbcheck <= 0)
|
if (file.gametdbcheck <= 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string Title;
|
std::string Filepath(Settings.titlestxt_path);
|
||||||
std::string Filepath = Settings.titlestxt_path;
|
if (Filepath.back() != '/')
|
||||||
if (Settings.titlestxt_path[Filepath.size() - 1] != '/')
|
|
||||||
Filepath += '/';
|
Filepath += '/';
|
||||||
Filepath += "wiitdb.xml";
|
Filepath += "wiitdb.xml";
|
||||||
|
|
||||||
GameTDB XML_DB;
|
GameTDB XML_DB;
|
||||||
|
|
||||||
if (!XML_DB.OpenFile((Filepath.c_str())))
|
if (!XML_DB.OpenFile(Filepath.c_str()))
|
||||||
return true; //! If no file exists we need the file
|
return true; //! If no file exists we need the file
|
||||||
|
|
||||||
u64 ExistingVersion = XML_DB.GetGameTDBVersion();
|
u64 ExistingVersion = XML_DB.GetGameTDBVersion();
|
||||||
|
XML_DB.CloseFile();
|
||||||
|
|
||||||
gprintf("Existing GameTDB Version: %llu Online GameTDB Version: %llu\n", ExistingVersion, file.gametdbcheck);
|
gprintf("Existing GameTDB Version: %llu Online GameTDB Version: %llu\n", ExistingVersion, file.gametdbcheck);
|
||||||
|
|
||||||
@ -118,10 +118,9 @@ int UpdateGameTDB()
|
|||||||
|
|
||||||
gprintf("Updating GameTDB...\n");
|
gprintf("Updating GameTDB...\n");
|
||||||
|
|
||||||
std::string ZipPath = Settings.titlestxt_path;
|
std::string ZipPath(Settings.titlestxt_path);
|
||||||
if (Settings.titlestxt_path[ZipPath.size() - 1] != '/')
|
if (ZipPath.back() != '/')
|
||||||
ZipPath += '/';
|
ZipPath += '/';
|
||||||
|
|
||||||
ZipPath += "wiitdb.zip";
|
ZipPath += "wiitdb.zip";
|
||||||
|
|
||||||
int filesize = DownloadFileToPath(Settings.URL_GameTDB, ZipPath.c_str());
|
int filesize = DownloadFileToPath(Settings.URL_GameTDB, ZipPath.c_str());
|
||||||
|
@ -94,6 +94,7 @@ static int InternalShowGameInfo(struct discHdr *header)
|
|||||||
|
|
||||||
if(!XML_DB.GetGameXMLInfo(ID, &GameInfo))
|
if(!XML_DB.GetGameXMLInfo(ID, &GameInfo))
|
||||||
{
|
{
|
||||||
|
XML_DB.CloseFile();
|
||||||
ShowError(tr("Could not find info for this game in the wiitdb.xml."));
|
ShowError(tr("Could not find info for this game in the wiitdb.xml."));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -255,26 +256,26 @@ static int InternalShowGameInfo(struct discHdr *header)
|
|||||||
char linebuf2[100] = "";
|
char linebuf2[100] = "";
|
||||||
|
|
||||||
// enable icons for required accessories
|
// enable icons for required accessories
|
||||||
for (u32 i = 0; i < GameInfo.AccessoirList.size(); ++i)
|
for (u32 i = 0; i < GameInfo.AccessoryList.size(); ++i)
|
||||||
{
|
{
|
||||||
if(!GameInfo.AccessoirList[i].Required)
|
if(!GameInfo.AccessoryList[i].Required)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "classiccontroller") == 0) classiccontroller = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "classiccontroller") == 0) classiccontroller = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "nunchuk") == 0) nunchuk = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "nunchuk") == 0) nunchuk = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "guitar") == 0) guitar = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "guitar") == 0) guitar = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "drums") == 0) drums = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "drums") == 0) drums = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "dancepad") == 0) dancepad = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "dancepad") == 0) dancepad = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "motionplus") == 0) motionplus = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "motionplus") == 0) motionplus = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "wheel") == 0) wheel = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "wheel") == 0) wheel = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "balanceboard") == 0) balanceboard = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "balanceboard") == 0) balanceboard = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "microphone") == 0) microphone = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "microphone") == 0) microphone = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "zapper") == 0) zapper = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "zapper") == 0) zapper = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "nintendods") == 0) nintendods = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "nintendods") == 0) nintendods = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "wiispeak") == 0) wiispeak = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "wiispeak") == 0) wiispeak = 1;
|
||||||
//if (strcmp(GameInfo.AccessoirList[i].Name.c_str(),"vitalitysensor")==0)
|
//if (strcmp(GameInfo.AccessoryList[i].Name.c_str(),"vitalitysensor")==0)
|
||||||
// vitalitysensor=1;
|
// vitalitysensor=1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "gamecube") == 0) gamecube = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "gamecube") == 0) gamecube = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// switch icons
|
// switch icons
|
||||||
@ -331,26 +332,26 @@ static int InternalShowGameInfo(struct discHdr *header)
|
|||||||
else dancepadImgData = Resources::GetImageData("dancepad.png");
|
else dancepadImgData = Resources::GetImageData("dancepad.png");
|
||||||
|
|
||||||
// look for optional accessories
|
// look for optional accessories
|
||||||
for (u32 i = 0; i < GameInfo.AccessoirList.size(); ++i)
|
for (u32 i = 0; i < GameInfo.AccessoryList.size(); ++i)
|
||||||
{
|
{
|
||||||
if(GameInfo.AccessoirList[i].Required)
|
if(GameInfo.AccessoryList[i].Required)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "classiccontroller") == 0) classiccontroller = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "classiccontroller") == 0) classiccontroller = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "nunchuk") == 0) nunchuk = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "nunchuk") == 0) nunchuk = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "guitar") == 0) guitar = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "guitar") == 0) guitar = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "drums") == 0) drums = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "drums") == 0) drums = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "dancepad") == 0) dancepad = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "dancepad") == 0) dancepad = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "motionplus") == 0) motionplus = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "motionplus") == 0) motionplus = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "wheel") == 0) wheel = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "wheel") == 0) wheel = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "balanceboard") == 0) balanceboard = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "balanceboard") == 0) balanceboard = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "microphone") == 0) microphone = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "microphone") == 0) microphone = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "zapper") == 0) zapper = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "zapper") == 0) zapper = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "nintendods") == 0) nintendods = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "nintendods") == 0) nintendods = 1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "wiispeak") == 0) wiispeak = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "wiispeak") == 0) wiispeak = 1;
|
||||||
//if (strcmp(GameInfo.AccessoirList[i].Name.c_str(),"vitalitysensor")==0)
|
//if (strcmp(GameInfo.AccessoryList[i].Name.c_str(),"vitalitysensor")==0)
|
||||||
// vitalitysensor=1;
|
// vitalitysensor=1;
|
||||||
if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "gamecube") == 0) gamecube = 1;
|
if (strcmp(GameInfo.AccessoryList[i].Name.c_str(), "gamecube") == 0) gamecube = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dialogBoxImg1 = new GuiImage(&dialogBox1);
|
dialogBoxImg1 = new GuiImage(&dialogBox1);
|
||||||
|
@ -35,9 +35,7 @@
|
|||||||
#include "utils/StringTools.h"
|
#include "utils/StringTools.h"
|
||||||
#include "svnrev.h"
|
#include "svnrev.h"
|
||||||
|
|
||||||
using namespace tinyxml2;
|
#define VALID_CONFIG_REV 1084
|
||||||
|
|
||||||
#define VALID_CONFIG_REV 1084
|
|
||||||
|
|
||||||
CGameCategories GameCategories;
|
CGameCategories GameCategories;
|
||||||
|
|
||||||
@ -48,11 +46,12 @@ CGameCategories::CGameCategories()
|
|||||||
|
|
||||||
const std::vector<unsigned int> &CGameCategories::operator[](const char *id) const
|
const std::vector<unsigned int> &CGameCategories::operator[](const char *id) const
|
||||||
{
|
{
|
||||||
if(!id) return defaultCategory;
|
if (!id)
|
||||||
|
return defaultCategory;
|
||||||
|
|
||||||
for(std::map<std::string, std::vector<unsigned int> >::const_iterator itr = List.begin(); itr != List.end(); itr++)
|
for (std::map<std::string, std::vector<unsigned int>>::const_iterator itr = List.begin(); itr != List.end(); itr++)
|
||||||
{
|
{
|
||||||
if(strncasecmp(itr->first.c_str(), id, 6) == 0)
|
if (strncasecmp(itr->first.c_str(), id, 6) == 0)
|
||||||
return itr->second;
|
return itr->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,63 +60,55 @@ const std::vector<unsigned int> &CGameCategories::operator[](const char *id) con
|
|||||||
|
|
||||||
bool CGameCategories::Load(std::string filepath)
|
bool CGameCategories::Load(std::string filepath)
|
||||||
{
|
{
|
||||||
if(filepath.size() == 0)
|
if (filepath.length() == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(filepath[filepath.size()-1] != '/')
|
if (filepath.back() != '/')
|
||||||
filepath += '/';
|
filepath += '/';
|
||||||
|
|
||||||
filepath += "GXGameCategories.xml";
|
filepath += "GXGameCategories.xml";
|
||||||
configPath = filepath;
|
configPath = filepath;
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
XMLDocument xmlDoc;
|
pugi::xml_document xmlDoc;
|
||||||
if(xmlDoc.LoadFile(filepath.c_str()) != 0)
|
pugi::xml_parse_result result = xmlDoc.load_file(filepath.c_str());
|
||||||
|
if (!result)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(!ValidVersion(xmlDoc.FirstChildElement("Revision")))
|
pugi::xml_node root = xmlDoc.child("USBLoaderGX");
|
||||||
|
if (!root)
|
||||||
|
root = xmlDoc;
|
||||||
|
|
||||||
|
if (!ValidVersion(root.child("Revision")))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
XMLElement * node = xmlDoc.FirstChildElement("Categories");
|
pugi::xml_node categories = root.child("Categories");
|
||||||
if(!node)
|
if (!categories)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
node = node->FirstChildElement("Category");
|
for (pugi::xml_node category : categories.children("Category"))
|
||||||
|
|
||||||
while(node != NULL)
|
|
||||||
{
|
{
|
||||||
const char * ID = node->Attribute("ID");
|
const char *ID = category.attribute("ID").value();
|
||||||
const char * Name = node->Attribute("Name");
|
const char *Name = category.attribute("Name").value();
|
||||||
|
|
||||||
if(ID && Name)
|
if (ID && Name)
|
||||||
CategoryList.SetCategory(atoi(ID), Name);
|
CategoryList.SetCategory(atoi(ID), Name);
|
||||||
|
|
||||||
node = node->NextSiblingElement();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
node = xmlDoc.FirstChildElement("GameCategories");
|
pugi::xml_node gamecategories = root.child("GameCategories");
|
||||||
if(!node)
|
if (!gamecategories)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
node = node->FirstChildElement("Game");
|
for (pugi::xml_node game : gamecategories.children("Game"))
|
||||||
|
|
||||||
while(node != NULL)
|
|
||||||
{
|
{
|
||||||
const char * gameID = node->Attribute("ID");
|
const char *gameID = game.attribute("ID").value();
|
||||||
|
|
||||||
XMLElement * category = node->FirstChildElement("Category");
|
for (pugi::xml_node category : game.children("Category"))
|
||||||
|
|
||||||
while(category != NULL)
|
|
||||||
{
|
{
|
||||||
const char * categoryID = category->Attribute("ID");
|
const char *categoryID = category.attribute("ID").value();
|
||||||
if(gameID && categoryID)
|
if (gameID && categoryID)
|
||||||
SetCategory(gameID, atoi(categoryID));
|
SetCategory(gameID, atoi(categoryID));
|
||||||
|
|
||||||
category = category->NextSiblingElement();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
node = node->NextSiblingElement();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CategoryList.goToFirst();
|
CategoryList.goToFirst();
|
||||||
@ -130,104 +121,87 @@ bool CGameCategories::Save()
|
|||||||
char filepath[300];
|
char filepath[300];
|
||||||
snprintf(filepath, sizeof(filepath), configPath.c_str());
|
snprintf(filepath, sizeof(filepath), configPath.c_str());
|
||||||
|
|
||||||
char * ptr = strrchr(filepath, '/');
|
char *ptr = strrchr(filepath, '/');
|
||||||
if(ptr)
|
if (ptr)
|
||||||
ptr[0] = 0;
|
ptr[0] = 0;
|
||||||
|
|
||||||
CreateSubfolder(filepath);
|
CreateSubfolder(filepath);
|
||||||
|
|
||||||
StartProgress(tr("Generating GXGameCategories.xml"), tr("Please wait..."), 0, false, true);
|
StartProgress(tr("Generating GXGameCategories.xml"), tr("Please wait..."), 0, false, true);
|
||||||
XMLDocument xmlDoc;
|
|
||||||
|
|
||||||
XMLDeclaration *declaration = xmlDoc.NewDeclaration();
|
pugi::xml_document xmlDoc;
|
||||||
xmlDoc.InsertEndChild(declaration);
|
pugi::xml_node declaration = xmlDoc.append_child(pugi::node_declaration);
|
||||||
XMLElement *Revision = xmlDoc.NewElement("Revision");
|
declaration.append_attribute("version") = "1.0";
|
||||||
XMLText *revText = xmlDoc.NewText(GetRev());
|
declaration.append_attribute("encoding") = "UTF-8";
|
||||||
Revision->InsertEndChild(revText);
|
|
||||||
xmlDoc.InsertEndChild(Revision);
|
pugi::xml_node root = xmlDoc.append_child("USBLoaderGX");
|
||||||
|
pugi::xml_node revision = root.append_child("Revision");
|
||||||
|
revision.append_child(pugi::node_pcdata).set_value(GetRev());
|
||||||
|
|
||||||
int progressSize = CategoryList.size() + List.size();
|
int progressSize = CategoryList.size() + List.size();
|
||||||
int progress = 0;
|
int progress = 0;
|
||||||
|
|
||||||
//! Add all categories as an ID map
|
//! Add all categories as an ID map
|
||||||
|
pugi::xml_node categories = root.append_child("Categories");
|
||||||
|
|
||||||
|
CategoryList.goToFirst();
|
||||||
|
do
|
||||||
{
|
{
|
||||||
//! On LinkEndChild TinyXML owns and deletes the elements allocated here.
|
ShowProgress(progress, progressSize);
|
||||||
//! This is more memory efficient than making another copy of the elements.
|
|
||||||
XMLElement *Categories = xmlDoc.NewElement("Categories");
|
|
||||||
|
|
||||||
CategoryList.goToFirst();
|
pugi::xml_node category = categories.append_child("Category");
|
||||||
do
|
category.append_attribute("ID") = fmt("%02i", CategoryList.getCurrentID());
|
||||||
{
|
category.append_attribute("Name") = CategoryList.getCurrentName().c_str();
|
||||||
ShowProgress(progress, progressSize);
|
|
||||||
|
|
||||||
XMLElement *Category = xmlDoc.NewElement("Category");
|
++progress;
|
||||||
Category->SetAttribute("ID", fmt("%02i", CategoryList.getCurrentID()));
|
} while (CategoryList.goToNext());
|
||||||
Category->SetAttribute("Name", CategoryList.getCurrentName().c_str());
|
|
||||||
|
|
||||||
Categories->LinkEndChild(Category);
|
|
||||||
|
|
||||||
++progress;
|
|
||||||
}
|
|
||||||
while(CategoryList.goToNext());
|
|
||||||
|
|
||||||
xmlDoc.LinkEndChild(Categories);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Add game specific categories now
|
//! Add game specific categories now
|
||||||
|
pugi::xml_node gamecategories = root.append_child("GameCategories");
|
||||||
|
|
||||||
|
for (std::map<std::string, std::vector<unsigned int>>::iterator itr = List.begin(); itr != List.end(); itr++)
|
||||||
{
|
{
|
||||||
//! On LinkEndChild TinyXML owns and deletes the elements allocated here.
|
ShowProgress(progress, progressSize);
|
||||||
//! This is more memory efficient than making another copy of the elements.
|
|
||||||
XMLElement *GameCategories = xmlDoc.NewElement("GameCategories");
|
|
||||||
|
|
||||||
for(std::map<std::string, std::vector<unsigned int> >::iterator itr = List.begin(); itr != List.end(); itr++)
|
pugi::xml_node game = gamecategories.append_child("Game");
|
||||||
|
game.append_attribute("ID") = itr->first.c_str();
|
||||||
|
game.append_attribute("Title") = GameTitles.GetTitle(itr->first.c_str());
|
||||||
|
|
||||||
|
for (u32 i = 0; i < itr->second.size(); ++i)
|
||||||
{
|
{
|
||||||
ShowProgress(progress, progressSize);
|
const char *CatName = CategoryList[itr->second[i]];
|
||||||
|
if (!CatName)
|
||||||
|
CatName = "";
|
||||||
|
|
||||||
XMLElement *Game = xmlDoc.NewElement("Game");
|
pugi::xml_node category = game.append_child("Category");
|
||||||
Game->SetAttribute("ID", itr->first.c_str());
|
category.append_attribute("ID") = fmt("%02i", itr->second[i]);
|
||||||
Game->SetAttribute("Title", GameTitles.GetTitle(itr->first.c_str()));
|
category.append_attribute("Name") = CatName;
|
||||||
|
|
||||||
for(u32 i = 0; i < itr->second.size(); ++i)
|
|
||||||
{
|
|
||||||
const char *CatName = CategoryList[itr->second[i]];
|
|
||||||
if(!CatName)
|
|
||||||
CatName = "";
|
|
||||||
|
|
||||||
XMLElement *Category = xmlDoc.NewElement("Category");
|
|
||||||
Category->SetAttribute("ID", fmt("%02i", itr->second[i]));
|
|
||||||
Category->SetAttribute("Name", CatName);
|
|
||||||
|
|
||||||
Game->LinkEndChild(Category);
|
|
||||||
}
|
|
||||||
|
|
||||||
GameCategories->LinkEndChild(Game);
|
|
||||||
++progress;
|
|
||||||
}
|
}
|
||||||
|
++progress;
|
||||||
xmlDoc.LinkEndChild(GameCategories);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowProgress(tr("Writing GXGameCategories.xml"), tr("Please wait..."), 0, progressSize, progressSize, false, true);
|
ShowProgress(tr("Writing GXGameCategories.xml"), tr("Please wait..."), 0, progressSize, progressSize, false, true);
|
||||||
|
|
||||||
xmlDoc.SaveFile(configPath.c_str());
|
xmlDoc.save_file(configPath.c_str());
|
||||||
ProgressStop();
|
ProgressStop();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGameCategories::ValidVersion(XMLElement *revisionNode)
|
bool CGameCategories::ValidVersion(pugi::xml_node revisionNode)
|
||||||
{
|
{
|
||||||
if(!revisionNode) return false;
|
if (!revisionNode)
|
||||||
|
|
||||||
if(!revisionNode->FirstChild() || !revisionNode->FirstChild()->Value())
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return atoi(revisionNode->FirstChild()->Value()) >= VALID_CONFIG_REV;
|
if (!revisionNode.first_child() || !revisionNode.first_child().value())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return atoi(revisionNode.first_child().value()) >= VALID_CONFIG_REV;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGameCategories::SetCategory(const char *gameID, unsigned int id)
|
bool CGameCategories::SetCategory(const char *gameID, unsigned int id)
|
||||||
{
|
{
|
||||||
if(!gameID) return false;
|
if (!gameID)
|
||||||
|
return false;
|
||||||
|
|
||||||
char gameID6[7];
|
char gameID6[7];
|
||||||
snprintf(gameID6, sizeof(gameID6), gameID);
|
snprintf(gameID6, sizeof(gameID6), gameID);
|
||||||
@ -239,14 +213,14 @@ bool CGameCategories::SetCategory(const char *gameID, unsigned int id)
|
|||||||
|
|
||||||
bool CGameCategories::SetCategory(const std::string &gameID, unsigned int id)
|
bool CGameCategories::SetCategory(const std::string &gameID, unsigned int id)
|
||||||
{
|
{
|
||||||
if(List[gameID].empty())
|
if (List[gameID].empty())
|
||||||
List[gameID] = defaultCategory;
|
List[gameID] = defaultCategory;
|
||||||
|
|
||||||
std::vector<unsigned int> tmpVect(List[gameID]);
|
std::vector<unsigned int> tmpVect(List[gameID]);
|
||||||
|
|
||||||
for(u32 i = 0; i < tmpVect.size(); ++i)
|
for (u32 i = 0; i < tmpVect.size(); ++i)
|
||||||
{
|
{
|
||||||
if(tmpVect[i] == id)
|
if (tmpVect[i] == id)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,7 +230,8 @@ bool CGameCategories::SetCategory(const std::string &gameID, unsigned int id)
|
|||||||
|
|
||||||
bool CGameCategories::ReplaceCategory(const char *gameID, unsigned int id)
|
bool CGameCategories::ReplaceCategory(const char *gameID, unsigned int id)
|
||||||
{
|
{
|
||||||
if(!gameID) return false;
|
if (!gameID)
|
||||||
|
return false;
|
||||||
|
|
||||||
char gameID6[7];
|
char gameID6[7];
|
||||||
snprintf(gameID6, sizeof(gameID6), gameID);
|
snprintf(gameID6, sizeof(gameID6), gameID);
|
||||||
@ -266,7 +241,6 @@ bool CGameCategories::ReplaceCategory(const char *gameID, unsigned int id)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CGameCategories::ReplaceCategory(const std::string &gameID, unsigned int id)
|
bool CGameCategories::ReplaceCategory(const std::string &gameID, unsigned int id)
|
||||||
{
|
{
|
||||||
List[gameID] = defaultCategory;
|
List[gameID] = defaultCategory;
|
||||||
@ -276,13 +250,13 @@ bool CGameCategories::ReplaceCategory(const std::string &gameID, unsigned int id
|
|||||||
|
|
||||||
void CGameCategories::RemoveCategory(unsigned int id)
|
void CGameCategories::RemoveCategory(unsigned int id)
|
||||||
{
|
{
|
||||||
for(std::map<std::string, std::vector<unsigned int> >::iterator itr = List.begin(); itr != List.end(); itr++)
|
for (std::map<std::string, std::vector<unsigned int>>::iterator itr = List.begin(); itr != List.end(); itr++)
|
||||||
{
|
{
|
||||||
for(u32 i = 0; i < itr->second.size(); ++i)
|
for (u32 i = 0; i < itr->second.size(); ++i)
|
||||||
{
|
{
|
||||||
if(itr->second[i] == id)
|
if (itr->second[i] == id)
|
||||||
{
|
{
|
||||||
itr->second.erase(itr->second.begin()+ i);
|
itr->second.erase(itr->second.begin() + i);
|
||||||
--i;
|
--i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -291,21 +265,20 @@ void CGameCategories::RemoveCategory(unsigned int id)
|
|||||||
|
|
||||||
void CGameCategories::RemoveGameCategories(const std::string &gameID)
|
void CGameCategories::RemoveGameCategories(const std::string &gameID)
|
||||||
{
|
{
|
||||||
for (std::map<std::string, std::vector<unsigned int> >::iterator itr = List.begin(); itr != List.end(); itr++)
|
for (std::map<std::string, std::vector<unsigned int>>::iterator itr = List.begin(); itr != List.end(); itr++)
|
||||||
{
|
{
|
||||||
if(gameID == itr->first)
|
if (gameID == itr->first)
|
||||||
{
|
|
||||||
List.erase(itr);
|
List.erase(itr);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameCategories::RemoveCategory(const char *gameID, unsigned int id)
|
void CGameCategories::RemoveCategory(const char *gameID, unsigned int id)
|
||||||
{
|
{
|
||||||
if(!gameID) return;
|
if (!gameID)
|
||||||
|
return;
|
||||||
|
|
||||||
std::string gameID6;
|
std::string gameID6;
|
||||||
for(int i = 0; i < 6 && gameID[i] != 0; ++i)
|
for (int i = 0; i < 6 && gameID[i] != 0; ++i)
|
||||||
gameID6.push_back(gameID[i]);
|
gameID6.push_back(gameID[i]);
|
||||||
|
|
||||||
RemoveCategory(gameID6, id);
|
RemoveCategory(gameID6, id);
|
||||||
@ -313,15 +286,15 @@ void CGameCategories::RemoveCategory(const char *gameID, unsigned int id)
|
|||||||
|
|
||||||
void CGameCategories::RemoveCategory(const std::string &gameID, unsigned int id)
|
void CGameCategories::RemoveCategory(const std::string &gameID, unsigned int id)
|
||||||
{
|
{
|
||||||
for (std::map<std::string, std::vector<unsigned int> >::iterator itr = List.begin(); itr != List.end(); itr++)
|
for (std::map<std::string, std::vector<unsigned int>>::iterator itr = List.begin(); itr != List.end(); itr++)
|
||||||
{
|
{
|
||||||
if(gameID == itr->first)
|
if (gameID == itr->first)
|
||||||
{
|
{
|
||||||
for(u32 i = 0; i < itr->second.size(); ++i)
|
for (u32 i = 0; i < itr->second.size(); ++i)
|
||||||
{
|
{
|
||||||
if(itr->second[i] == id)
|
if (itr->second[i] == id)
|
||||||
{
|
{
|
||||||
itr->second.erase(itr->second.begin()+ i);
|
itr->second.erase(itr->second.begin() + i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -332,22 +305,23 @@ void CGameCategories::RemoveCategory(const std::string &gameID, unsigned int id)
|
|||||||
|
|
||||||
bool CGameCategories::isInCategory(const char *gameID, unsigned int id)
|
bool CGameCategories::isInCategory(const char *gameID, unsigned int id)
|
||||||
{
|
{
|
||||||
if(id == 0) //! ID = 0 means category 'All' so it is always true
|
if (id == 0) //! ID = 0 means category 'All' so it is always true
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if(!gameID) return false;
|
if (!gameID)
|
||||||
|
return false;
|
||||||
|
|
||||||
std::string gameID6;
|
std::string gameID6;
|
||||||
for(int i = 0; i < 6 && gameID[i] != 0; ++i)
|
for (int i = 0; i < 6 && gameID[i] != 0; ++i)
|
||||||
gameID6.push_back(gameID[i]);
|
gameID6.push_back(gameID[i]);
|
||||||
|
|
||||||
for (std::map<std::string, std::vector<unsigned int> >::iterator itr = GameCategories.List.begin(); itr != GameCategories.List.end(); itr++)
|
for (std::map<std::string, std::vector<unsigned int>>::iterator itr = GameCategories.List.begin(); itr != GameCategories.List.end(); itr++)
|
||||||
{
|
{
|
||||||
if(itr->first == gameID6)
|
if (itr->first == gameID6)
|
||||||
{
|
{
|
||||||
for(u32 i = 0; i < itr->second.size(); ++i)
|
for (u32 i = 0; i < itr->second.size(); ++i)
|
||||||
{
|
{
|
||||||
if(itr->second[i] == id)
|
if (itr->second[i] == id)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -361,45 +335,45 @@ bool CGameCategories::ImportFromGameTDB(const std::string &xmlpath)
|
|||||||
{
|
{
|
||||||
GameTDB XML_DB;
|
GameTDB XML_DB;
|
||||||
|
|
||||||
if(!XML_DB.OpenFile(xmlpath.c_str()))
|
if (!XML_DB.OpenFile(xmlpath.c_str()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
StartProgress(tr("Importing categories"), tr("Please wait..."), 0, false, true);
|
StartProgress(tr("Importing categories"), tr("Please wait..."), 0, false, true);
|
||||||
|
|
||||||
XML_DB.SetLanguageCode(Settings.db_language);
|
XML_DB.SetLanguageCode(Settings.db_language);
|
||||||
wString filter(gameList.GetCurrentFilter());
|
|
||||||
gameList.LoadUnfiltered();
|
|
||||||
|
|
||||||
for(int i = 0; i < gameList.size(); ++i)
|
std::vector<struct discHdr *> headerlist;
|
||||||
|
if (!gameList.GetGameListHeaders(headerlist, MODE_ALL))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for (u32 i = 0; i < headerlist.size(); ++i)
|
||||||
{
|
{
|
||||||
ShowProgress(i, gameList.size());
|
ShowProgress(i, headerlist.size());
|
||||||
|
|
||||||
std::vector<std::string> genreList;
|
std::vector<std::string> genreList;
|
||||||
std::string GameType;
|
std::string GameType;
|
||||||
|
|
||||||
if(XML_DB.GetGameType((const char *) gameList[i]->id, GameType))
|
if (XML_DB.GetGameType((const char *)headerlist[i]->id, GameType))
|
||||||
{
|
{
|
||||||
if(!CategoryList.findCategory(GameType))
|
if (!CategoryList.findCategory(GameType))
|
||||||
CategoryList.AddCategory(GameType);
|
CategoryList.AddCategory(GameType);
|
||||||
|
|
||||||
this->SetCategory(gameList[i]->id, CategoryList.getCurrentID());
|
this->SetCategory(headerlist[i]->id, CategoryList.getCurrentID());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!XML_DB.GetGenreList((const char *) gameList[i]->id, genreList))
|
if (!XML_DB.GetGenreList((const char *)headerlist[i]->id, genreList))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for(u32 n = 0; n < genreList.size(); ++n)
|
for (u32 n = 0; n < genreList.size(); ++n)
|
||||||
{
|
{
|
||||||
if(!CategoryList.findCategory(genreList[n]))
|
if (!CategoryList.findCategory(genreList[n]))
|
||||||
CategoryList.AddCategory(genreList[n]);
|
CategoryList.AddCategory(genreList[n]);
|
||||||
|
|
||||||
this->SetCategory(gameList[i]->id, CategoryList.getCurrentID());
|
this->SetCategory(headerlist[i]->id, CategoryList.getCurrentID());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XML_DB.CloseFile();
|
XML_DB.CloseFile();
|
||||||
gameList.FilterList(filter.c_str());
|
|
||||||
|
|
||||||
ProgressStop();
|
ProgressStop();
|
||||||
|
|
||||||
|
@ -28,11 +28,9 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "xml/tinyxml2.h"
|
#include "xml/pugixml.hpp"
|
||||||
#include "CCategoryList.hpp"
|
#include "CCategoryList.hpp"
|
||||||
|
|
||||||
using namespace tinyxml2;
|
|
||||||
|
|
||||||
class CGameCategories
|
class CGameCategories
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -58,7 +56,7 @@ class CGameCategories
|
|||||||
|
|
||||||
CCategoryList CategoryList;
|
CCategoryList CategoryList;
|
||||||
protected:
|
protected:
|
||||||
bool ValidVersion(XMLElement *xmlfile);
|
bool ValidVersion(pugi::xml_node xmlfile);
|
||||||
|
|
||||||
std::string configPath;
|
std::string configPath;
|
||||||
const std::vector<unsigned int> defaultCategory;
|
const std::vector<unsigned int> defaultCategory;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -26,12 +26,13 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "pugixml.hpp"
|
||||||
|
|
||||||
typedef struct _Accessoir
|
typedef struct _Accessory
|
||||||
{
|
{
|
||||||
std::string Name;
|
std::string Name;
|
||||||
bool Required;
|
bool Required;
|
||||||
} Accessoir;
|
} Accessory;
|
||||||
|
|
||||||
typedef struct _GameXMLInfo
|
typedef struct _GameXMLInfo
|
||||||
{
|
{
|
||||||
@ -49,7 +50,7 @@ typedef struct _GameXMLInfo
|
|||||||
int WifiPlayers;
|
int WifiPlayers;
|
||||||
std::vector<std::string> WifiFeatureList;
|
std::vector<std::string> WifiFeatureList;
|
||||||
int Players;
|
int Players;
|
||||||
std::vector<Accessoir> AccessoirList;
|
std::vector<Accessory> AccessoryList;
|
||||||
long CaseColor;
|
long CaseColor;
|
||||||
|
|
||||||
} GameXMLInfo;
|
} GameXMLInfo;
|
||||||
@ -63,96 +64,97 @@ typedef struct _GameOffsets
|
|||||||
|
|
||||||
class GameTDB
|
class GameTDB
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
GameTDB();
|
GameTDB();
|
||||||
//! Constructor
|
//! Constructor
|
||||||
//! If filepath is passed the xml file is opened and the node offsets are loaded
|
//! If filepath is passed the xml file is opened and the node offsets are loaded
|
||||||
GameTDB(const char * filepath);
|
GameTDB(const char *filepath);
|
||||||
//! Destructor
|
//! Destructor
|
||||||
~GameTDB();
|
~GameTDB();
|
||||||
//! If filepath is passed the xml file is opened and the node offsets are loaded
|
//! If filepath is passed the xml file is opened and the node offsets are loaded
|
||||||
bool OpenFile(const char * filepath);
|
bool OpenFile(const char *filepath);
|
||||||
//! Closes the GameTDB xml file
|
//! Closes the GameTDB xml file
|
||||||
void CloseFile();
|
void CloseFile();
|
||||||
//! Set the language code which should be use to find the appropriate language
|
//! Set the language code which should be use to find the appropriate language
|
||||||
//! If the language code is not found, the language code defaults to EN
|
//! If the language code is not found, the language code defaults to EN
|
||||||
void SetLanguageCode(const char * code) { if(code) LangCode = code; };
|
void SetLanguageCode(const char *code) { if(code) LangCode = code; };
|
||||||
//! Get the current set language code
|
//! Get the current set language code
|
||||||
const char * GetLanguageCode() { return LangCode.c_str(); };
|
const char *GetLanguageCode() { return LangCode.c_str(); };
|
||||||
//! Get the title of a specific game id in the language defined in LangCode
|
//! Get the title of a specific game id in the language defined in LangCode
|
||||||
bool GetTitle(const char * id, std::string & title);
|
bool GetTitle(const char *id, std::string &title);
|
||||||
//! Get the synopsis of a specific game id in the language defined in LangCode
|
//! Get the synopsis of a specific game id in the language defined in LangCode
|
||||||
bool GetSynopsis(const char * id, std::string & synopsis);
|
bool GetSynopsis(const char *id, std::string &synopsis);
|
||||||
//! Get the region of a game for a specific game id
|
//! Get the region of a game for a specific game id
|
||||||
bool GetRegion(const char * id, std::string & region);
|
bool GetRegion(const char *id, std::string ®ion);
|
||||||
//! Get the developer of a game for a specific game id
|
//! Get the languages of a game for a specific game id
|
||||||
bool GetDeveloper(const char * id, std::string & dev);
|
bool GetLanguages(const char *id, std::string &languages);
|
||||||
//! Get the publisher of a game for a specific game id
|
//! Get the developer of a game for a specific game id
|
||||||
bool GetPublisher(const char * id, std::string & pub);
|
bool GetDeveloper(const char *id, std::string &dev);
|
||||||
//! Get the publish date of a game for a specific game id
|
//! Get the publisher of a game for a specific game id
|
||||||
//! First 1 byte is the day, than 1 byte month and last 2 bytes is the year
|
bool GetPublisher(const char *id, std::string &pub);
|
||||||
//! year = (return >> 16), month = (return >> 8) & 0xFF, day = return & 0xFF
|
//! Get the publish date of a game for a specific game id
|
||||||
unsigned int GetPublishDate(const char * id);
|
//! First 1 byte is the day, than 1 byte month and last 2 bytes is the year
|
||||||
//! Get the genre list of a game for a specific game id
|
//! year = (return >> 16), month = (return >> 8) & 0xFF, day = return & 0xFF
|
||||||
bool GetGenreList(const char * id, std::vector<std::string> & genre);
|
unsigned int GetPublishDate(const char *id);
|
||||||
//! Get the rating type for a specific game id
|
//! Get the genre list of a game for a specific game id
|
||||||
//! The rating type can be converted to a std::string with GameTDB::RatingTostd::string(rating)
|
bool GetGenreList(const char *id, std::vector<std::string> &genre);
|
||||||
int GetRating(const char * id);
|
//! Get the rating type for a specific game id
|
||||||
//! Get the rating value for a specific game id
|
//! The rating type can be converted to a std::string with GameTDB::RatingTostd::string(rating)
|
||||||
bool GetRatingValue(const char * id, std::string & rating_value);
|
int GetRating(const char *id);
|
||||||
//! Get the rating descriptor list inside a std::vector for a specific game id
|
//! Get the rating value for a specific game id
|
||||||
//! Returns the amount of descriptors found or -1 if failed
|
bool GetRatingValue(const char *id, std::string &rating_value);
|
||||||
int GetRatingDescriptorList(const char * id, std::vector<std::string> & desc_list);
|
//! Get the rating descriptor list inside a std::vector for a specific game id
|
||||||
//! Get the wifi player count for a specific game id
|
//! Returns the amount of descriptors found or -1 if failed
|
||||||
//! Returns the amount of wifi players or -1 if failed
|
int GetRatingDescriptorList(const char *id, std::vector<std::string> &desc_list);
|
||||||
int GetWifiPlayers(const char * id);
|
//! Get the wifi player count for a specific game id
|
||||||
//! Get the wifi feature list inside a std::vector for a specific game id
|
//! Returns the amount of wifi players or -1 if failed
|
||||||
//! Returns the amount of wifi features found or -1 if failed
|
int GetWifiPlayers(const char *id);
|
||||||
int GetWifiFeatureList(const char * id, std::vector<std::string> & feat_list);
|
//! Get the wifi feature list inside a std::vector for a specific game id
|
||||||
//! Get the player count for a specific game id
|
//! Returns the amount of wifi features found or -1 if failed
|
||||||
//! Returns the amount of players or -1 if failed
|
int GetWifiFeatureList(const char *id, std::vector<std::string> &feat_list);
|
||||||
int GetPlayers(const char * id);
|
//! Get the player count for a specific game id
|
||||||
//! Returns the amount of accessoirs found or -1 if failed
|
//! Returns the amount of players or -1 if failed
|
||||||
//! Get the accessoir (inputs) list inside a std::vector for a specific game id
|
int GetPlayers(const char *id);
|
||||||
int GetAccessoirList(const char * id, std::vector<Accessoir> & acc_list);
|
//! Returns the amount of accessories found or -1 if failed
|
||||||
//! Get the box (case) color for a specific game id
|
//! Get the accessory (inputs) list inside a std::vector for a specific game id
|
||||||
//! Returns the color in RGB (first 3 bytes)
|
int GetAccessoryList(const char *id, std::vector<Accessory> &acc_list);
|
||||||
int GetCaseColor(const char * id);
|
//! Get the box (case) color for a specific game id
|
||||||
//! Get the complete game info in the GameXMLInfo struct
|
//! Returns the color in RGB (first 3 bytes)
|
||||||
bool GetGameXMLInfo(const char * id, GameXMLInfo * gameInfo);
|
int GetCaseColor(const char *id);
|
||||||
//! Get the type of the game. If blank the game is a Wii game.
|
//! Get the complete game info in the GameXMLInfo struct
|
||||||
bool GetGameType(const char * id, std::string &GameType);
|
bool GetGameXMLInfo(const char *id, GameXMLInfo *gameInfo);
|
||||||
//! Translate genre list to configure language code
|
//! Get the type of the game. If blank the game is a Wii game.
|
||||||
void TranslateGenres(std::vector<std::string> &GenreList);
|
bool GetGameType(const char *id, std::string &GameType);
|
||||||
//! Translate descriptors list to configure language code
|
//! Translate genre list to configure language code
|
||||||
void TranslateDescriptors(std::vector<std::string> &DescList);
|
void TranslateGenres(std::vector<std::string> &GenreList);
|
||||||
//! Convert a specific game rating to a std::string
|
//! Translate descriptors list to configure language code
|
||||||
static const char * RatingToString(int rating);
|
//! void TranslateDescriptors(std::vector<std::string> &DescList);
|
||||||
//! Convert a rating std::string to a rating number
|
//! Convert a specific game rating to a std::string
|
||||||
static int StringToRating(const char *rate_string);
|
static const char *RatingToString(int rating);
|
||||||
//! Convert a rating to another rating
|
//! Convert a rating std::string to a rating number
|
||||||
static int ConvertRating(const char *value, const char *from, const char *to);
|
static int StringToRating(const char *rate_string);
|
||||||
//! Get the version of the gametdb xml database
|
//! Convert a rating to another rating
|
||||||
unsigned long long GetGameTDBVersion();
|
static int ConvertRating(const char *value, const char *from, const char *to);
|
||||||
//! Get the entry count in the xml database
|
//! Get the version of the gametdb xml database
|
||||||
inline size_t GetEntryCount() { return OffsetMap.size(); };
|
unsigned long long GetGameTDBVersion();
|
||||||
private:
|
//! Get the entry count in the xml database
|
||||||
bool ParseFile();
|
inline size_t GetEntryCount() { return OffsetMap.size(); };
|
||||||
bool LoadGameOffsets(const char * path);
|
|
||||||
bool SaveGameOffsets(const char * path);
|
|
||||||
inline int GetData(char * data, int offset, int size);
|
|
||||||
inline char * LoadGameNode(const char * id);
|
|
||||||
inline char * GetGameNode(const char * id);
|
|
||||||
inline GameOffsets * GetGameOffset(const char * id);
|
|
||||||
inline char * SeekLang(char * text, const char * langcode);
|
|
||||||
inline char * GetNodeText(char * data, const char * nodestart, const char * nodeend);
|
|
||||||
|
|
||||||
std::vector<GameOffsets> OffsetMap;
|
private:
|
||||||
FILE * file;
|
bool ParseFile();
|
||||||
std::string LangCode;
|
bool LoadGameOffsets(const char *path);
|
||||||
char * GameNodeCache;
|
bool SaveGameOffsets(const char *path);
|
||||||
char GameIDCache[7];
|
bool ParseGameNode(const char *id);
|
||||||
|
inline int GetData(char *data, int offset, int size);
|
||||||
|
inline char *LoadGameNode(const char *id);
|
||||||
|
inline GameOffsets *GetGameOffset(const char *id);
|
||||||
|
|
||||||
|
std::vector<GameOffsets> OffsetMap;
|
||||||
|
FILE *file;
|
||||||
|
std::string LangCode;
|
||||||
|
char GameIDCache[7];
|
||||||
|
pugi::xml_document xmlDoc;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
77
source/xml/pugiconfig.hpp
Normal file
77
source/xml/pugiconfig.hpp
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/**
|
||||||
|
* pugixml parser - version 1.13
|
||||||
|
* --------------------------------------------------------
|
||||||
|
* Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||||
|
* Report bugs and download new versions at https://pugixml.org/
|
||||||
|
*
|
||||||
|
* This library is distributed under the MIT License. See notice at the end
|
||||||
|
* of this file.
|
||||||
|
*
|
||||||
|
* This work is based on the pugxml parser, which is:
|
||||||
|
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HEADER_PUGICONFIG_HPP
|
||||||
|
#define HEADER_PUGICONFIG_HPP
|
||||||
|
|
||||||
|
// Uncomment this to enable wchar_t mode
|
||||||
|
// #define PUGIXML_WCHAR_MODE
|
||||||
|
|
||||||
|
// Uncomment this to enable compact mode
|
||||||
|
// #define PUGIXML_COMPACT
|
||||||
|
|
||||||
|
// Uncomment this to disable XPath
|
||||||
|
// #define PUGIXML_NO_XPATH
|
||||||
|
|
||||||
|
// Uncomment this to disable STL
|
||||||
|
// #define PUGIXML_NO_STL
|
||||||
|
|
||||||
|
// Uncomment this to disable exceptions
|
||||||
|
// #define PUGIXML_NO_EXCEPTIONS
|
||||||
|
|
||||||
|
// Set this to control attributes for public classes/functions, i.e.:
|
||||||
|
// #define PUGIXML_API __declspec(dllexport) // to export all public symbols from DLL
|
||||||
|
// #define PUGIXML_CLASS __declspec(dllimport) // to import all classes from DLL
|
||||||
|
// #define PUGIXML_FUNCTION __fastcall // to set calling conventions to all public functions to fastcall
|
||||||
|
// In absence of PUGIXML_CLASS/PUGIXML_FUNCTION definitions PUGIXML_API is used instead
|
||||||
|
|
||||||
|
// Tune these constants to adjust memory-related behavior
|
||||||
|
// #define PUGIXML_MEMORY_PAGE_SIZE 32768
|
||||||
|
// #define PUGIXML_MEMORY_OUTPUT_STACK 10240
|
||||||
|
// #define PUGIXML_MEMORY_XPATH_PAGE_SIZE 4096
|
||||||
|
|
||||||
|
// Tune this constant to adjust max nesting for XPath queries
|
||||||
|
// #define PUGIXML_XPATH_DEPTH_LIMIT 1024
|
||||||
|
|
||||||
|
// Uncomment this to switch to header-only version
|
||||||
|
// #define PUGIXML_HEADER_ONLY
|
||||||
|
|
||||||
|
// Uncomment this to enable long long support
|
||||||
|
// #define PUGIXML_HAS_LONG_LONG
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2006-2022 Arseny Kapoulkine
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person
|
||||||
|
* obtaining a copy of this software and associated documentation
|
||||||
|
* files (the "Software"), to deal in the Software without
|
||||||
|
* restriction, including without limitation the rights to use,
|
||||||
|
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following
|
||||||
|
* conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be
|
||||||
|
* included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
13158
source/xml/pugixml.cpp
Normal file
13158
source/xml/pugixml.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1506
source/xml/pugixml.hpp
Normal file
1506
source/xml/pugixml.hpp
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user