From 9f43f91dc76971d70e2b1ce457d84a95359e2231 Mon Sep 17 00:00:00 2001
From: KiritoDv <kiritodev01@gmail.com>
Date: Sat, 16 Nov 2024 16:19:14 -0600
Subject: [PATCH] Add o2r support and xml display lists

---
 src/port/Engine.cpp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/port/Engine.cpp b/src/port/Engine.cpp
index cb01a048..9b93d8c2 100644
--- a/src/port/Engine.cpp
+++ b/src/port/Engine.cpp
@@ -64,7 +64,8 @@ GameEngine::GameEngine() {
         !patches_path.empty() && std::filesystem::exists(patches_path)) {
         if (std::filesystem::is_directory(patches_path)) {
             for (const auto& p : std::filesystem::recursive_directory_iterator(patches_path)) {
-                if (StringHelper::IEquals(p.path().extension().string(), ".otr")) {
+                const auto ext = p.path().extension().string();
+                if (StringHelper::IEquals(ext, ".otr") || StringHelper::IEquals(ext, ".o2r")) {
                     OTRFiles.push_back(p.path().generic_string());
                 }
             }
@@ -110,12 +111,20 @@ GameEngine::GameEngine() {
                                     "Texture", static_cast<uint32_t>(LUS::ResourceType::Texture), 0);
     loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryTextureV1>(), RESOURCE_FORMAT_BINARY,
                                     "Texture", static_cast<uint32_t>(LUS::ResourceType::Texture), 1);
+
     loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryVertexV0>(), RESOURCE_FORMAT_BINARY,
                                     "Vertex", static_cast<uint32_t>(LUS::ResourceType::Vertex), 0);
+    loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryXMLVertexV0>(), RESOURCE_FORMAT_XML,
+                                    "Vertex", static_cast<uint32_t>(LUS::ResourceType::Vertex), 0);
+
     loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryDisplayListV0>(), RESOURCE_FORMAT_BINARY,
                                     "DisplayList", static_cast<uint32_t>(LUS::ResourceType::DisplayList), 0);
+    loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryXMLDisplayListV0>(), RESOURCE_FORMAT_XML,
+                                    "DisplayList", static_cast<uint32_t>(LUS::ResourceType::DisplayList), 0);
+
     loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryMatrixV0>(), RESOURCE_FORMAT_BINARY,
                                     "Matrix", static_cast<uint32_t>(LUS::ResourceType::Matrix), 0);
+
     loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryBlobV0>(), RESOURCE_FORMAT_BINARY,
                                     "Blob", static_cast<uint32_t>(LUS::ResourceType::Blob), 0);
 }