diff --git a/.travis.yml b/.travis.yml index 62130daf6f..6bb94decea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,7 +53,7 @@ before_install: fi; before_script: - - git submodule update --init asmjit 3rdparty/ffmpeg 3rdparty/GSL 3rdparty/libpng Vulkan/glslang Vulkan/Vulkan-LoaderAndValidationLayers + - git submodule update --init asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/GSL 3rdparty/libpng Vulkan/glslang Vulkan/Vulkan-LoaderAndValidationLayers - mkdir build - cd build - if [ "$TRAVIS_OS_NAME" = "linux" ]; then cmake ..; else cmake .. -DLLVM_DIR=/usr/local/opt/llvm36/lib/llvm-3.6/share/llvm/cmake; fi diff --git a/Utilities/rXml.cpp b/Utilities/rXml.cpp index 30e0b457c2..1e0dfff1b5 100644 --- a/Utilities/rXml.cpp +++ b/Utilities/rXml.cpp @@ -1,117 +1,120 @@ #include "stdafx.h" #include "Utilities/rXml.h" #pragma warning(push) -#pragma message("TODO: remove wx dependency: ") #pragma warning(disable : 4996) -#include +#include #pragma warning(pop) rXmlNode::rXmlNode() { ownPtr = true; - handle = reinterpret_cast(new wxXmlNode()); + handle = new pugi::xml_node; } -rXmlNode::rXmlNode(void *ptr) +rXmlNode::rXmlNode(pugi::xml_node *ptr) { ownPtr = false; handle = ptr; } -rXmlNode::rXmlNode(const rXmlNode& other) -{ - ownPtr = true; - handle = reinterpret_cast(new wxXmlNode(*reinterpret_cast(other.handle))); -} - -rXmlNode &rXmlNode::operator=(const rXmlNode& other) -{ - if (ownPtr) - { - delete reinterpret_cast(handle); - } - handle = reinterpret_cast(new wxXmlNode(*reinterpret_cast(other.handle))); - ownPtr = true; - return *this; -} - rXmlNode::~rXmlNode() { if (ownPtr) { - delete reinterpret_cast(handle); + delete handle; } } +rXmlNode::rXmlNode(const rXmlNode& other) +{ + ownPtr = true; + handle = new pugi::xml_node(*other.handle); +} + +rXmlNode &rXmlNode::operator=(const rXmlNode& other) +{ + if (ownPtr) + { + delete handle; + } + handle = new pugi::xml_node(*other.handle); + ownPtr = true; + return *this; +} + std::shared_ptr rXmlNode::GetChildren() { - wxXmlNode* result = reinterpret_cast(handle)->GetChildren(); - if (result) + // it.begin() returns node_iterator*, *it.begin() return node*. + pugi::xml_object_range it = handle->children(); + pugi::xml_node begin = *it.begin(); + + if (begin) { - return std::make_shared(reinterpret_cast(result)); + return std::make_shared(&begin); } else { - return std::shared_ptr(nullptr); + return nullptr; } } std::shared_ptr rXmlNode::GetNext() { - wxXmlNode* result = reinterpret_cast(handle)->GetNext(); + pugi::xml_node result = handle->next_sibling(); if (result) { - return std::make_shared(reinterpret_cast(result)); + return std::make_shared(&result); } else { - return std::shared_ptr(nullptr); + return nullptr; } } std::string rXmlNode::GetName() { - return fmt::ToUTF8(reinterpret_cast(handle)->GetName()); + return handle->name(); } std::string rXmlNode::GetAttribute(const std::string &name) { - return fmt::ToUTF8(reinterpret_cast(handle)->GetAttribute(fmt::FromUTF8(name))); + auto pred = [&name](pugi::xml_attribute attr) { return (name == attr.name()); }; + return handle->find_attribute(pred).value(); } std::string rXmlNode::GetNodeContent() { - return fmt::ToUTF8(reinterpret_cast(handle)->GetNodeContent()); + return handle->text().get(); +} + +void *rXmlNode::AsVoidPtr() +{ + return static_cast(handle); } rXmlDocument::rXmlDocument() { - handle = reinterpret_cast(new wxXmlDocument()); -} - -rXmlDocument::rXmlDocument(const rXmlDocument& other) -{ - handle = reinterpret_cast(new wxXmlDocument(*reinterpret_cast(other.handle))); -} - -rXmlDocument &rXmlDocument::operator = (const rXmlDocument& other) -{ - delete reinterpret_cast(handle); - handle = reinterpret_cast(new wxXmlDocument(*reinterpret_cast(other.handle))); - return *this; + handle = new pugi::xml_document; } rXmlDocument::~rXmlDocument() { - delete reinterpret_cast(handle); + delete handle; } void rXmlDocument::Load(const std::string & path) { - reinterpret_cast(handle)->Load(fmt::FromUTF8(path)); + // TODO: Unsure of use of c_str. + handle->load_string(path.c_str()); } std::shared_ptr rXmlDocument::GetRoot() { - return std::make_shared(reinterpret_cast(reinterpret_cast(handle)->GetRoot())); + pugi::xml_node root = handle->root(); + return std::make_shared(&root); +} + +void *rXmlDocument::AsVoidPtr() +{ + return static_cast(handle); } diff --git a/Utilities/rXml.h b/Utilities/rXml.h index 9531936f73..08edf5f934 100644 --- a/Utilities/rXml.h +++ b/Utilities/rXml.h @@ -1,9 +1,11 @@ #pragma once +#include + struct rXmlNode { rXmlNode(); - rXmlNode(void *); + rXmlNode(pugi::xml_node *); rXmlNode(const rXmlNode& other); rXmlNode &operator=(const rXmlNode& other); ~rXmlNode(); @@ -12,19 +14,21 @@ struct rXmlNode std::string GetName(); std::string GetAttribute( const std::string &name); std::string GetNodeContent(); + void *AsVoidPtr(); - void *handle; + pugi::xml_node *handle; bool ownPtr; }; struct rXmlDocument { rXmlDocument(); - rXmlDocument(const rXmlDocument& other); - rXmlDocument &operator=(const rXmlDocument& other); + rXmlDocument(const rXmlDocument& other) = delete; + rXmlDocument &operator=(const rXmlDocument& other) = delete; ~rXmlDocument(); void Load(const std::string & path); std::shared_ptr GetRoot(); + void *AsVoidPtr(); - void *handle; + pugi::xml_document *handle; }; \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 643b414dcf..65603cd216 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,7 +14,7 @@ branches: before_build: # until git for win 2.5 release with commit checkout - - git submodule update --init 3rdparty/ffmpeg asmjit rsx_program_decompiler 3rdparty/GSL 3rdparty/libpng Vulkan/glslang Vulkan/Vulkan-LoaderAndValidationLayers + - git submodule update --init 3rdparty/ffmpeg 3rdparty/pugixml asmjit rsx_program_decompiler 3rdparty/GSL 3rdparty/libpng Vulkan/glslang Vulkan/Vulkan-LoaderAndValidationLayers - 7z x wxWidgets.7z -aos -oC:\rpcs3\wxWidgets > null - 7z x zlib.7z -aos -oC:\rpcs3\ > null - if %configuration%==Release (cmake -G "Visual Studio 14 Win64" -DZLIB_ROOT=C:/rpcs3/zlib/) diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index efdc5b81cc..cae5fdd3d5 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -106,6 +106,7 @@ ${wxWidgets_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR} ${OPENAL_INCLUDE_DIR} ${LLVM_INCLUDE_DIRS} +"${RPCS3_SRC_DIR}/../3rdparty/pugixml/src" "${RPCS3_SRC_DIR}/../3rdparty/ffmpeg/${PLATFORM_ARCH}/include" "${RPCS3_SRC_DIR}" "${RPCS3_SRC_DIR}/Loader" @@ -164,6 +165,7 @@ endforeach() file( GLOB_RECURSE RPCS3_SRC +"${RPCS3_SRC_DIR}/../3rdparty/pugixml/src/pugixml.cpp" "${RPCS3_SRC_DIR}/rpcs3.cpp" "${RPCS3_SRC_DIR}/config.cpp" "${RPCS3_SRC_DIR}/stb_image.cpp" diff --git a/rpcs3_default.props b/rpcs3_default.props index b739149eb8..676f2ede1a 100644 --- a/rpcs3_default.props +++ b/rpcs3_default.props @@ -3,7 +3,7 @@ - .\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;..\wxWidgets\src\zlib;..\3rdparty\ffmpeg\WindowsInclude;..\3rdparty\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\minidx12\Include;..\3rdparty\glm;..\3rdparty\GSL\include;..\3rdparty\libpng;..\3rdparty\GL;..\3rdparty\stblib;..\3rdparty\OpenAL\include + .\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;..\wxWidgets\src\zlib;..\3rdparty\ffmpeg\WindowsInclude;..\3rdparty\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\minidx12\Include;..\3rdparty\glm;..\3rdparty\GSL\include;..\3rdparty\libpng;..\3rdparty\GL;..\3rdparty\stblib;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src $(SolutionDir)lib\$(Configuration)-$(Platform)\ $(SolutionDir)lib\$(Configuration)-$(Platform)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath) $(SolutionDir)tmp\$(ProjectName)-$(Configuration)-$(Platform)\