소스 검색

Attempts to convert all hrc files, some fail - perhaps because some models have no bones?

Paul 11 년 전
부모
커밋
8db9bf9541
2개의 변경된 파일28개의 추가작업 그리고 22개의 파일을 삭제
  1. 0 2
      SupportedGames/FinalFantasy7/include/common/FF7NameLookup.h
  2. 28 20
      utilities/installer/src/ff7DataInstaller.cpp

+ 0 - 2
SupportedGames/FinalFantasy7/include/common/FF7NameLookup.h

@@ -68,7 +68,6 @@ namespace QGears
                 {
                     return it->second;
                 }
-
                 return key;
             }
 
@@ -87,7 +86,6 @@ namespace QGears
                 {
                     return it->second;
                 }
-
                 return key;
             }
 

+ 28 - 20
utilities/installer/src/ff7DataInstaller.cpp

@@ -88,33 +88,41 @@ static void exportMesh(std::string outdir, const Ogre::MeshPtr &mesh)
 
 void FF7DataInstaller::ConvertFieldModels(std::string archive, std::string outDir)
 {
+    // TODO: Find a way to query the file list from the added resource else we're having
+    // to parse/load the LGP archive twice
+    QGears::LGPArchive lgp(archive, "LGP");
+    lgp.open(archive);
+    lgp.load();
+    auto files = lgp.find("*.hrc");
+    for (const auto& file : *files)
+    {
+        try
+        {
+            Ogre::ResourcePtr hrc = QGears::HRCFileManager::getSingleton().load(file, "FFVII");
+
+            Ogre::String baseName;
+            QGears::StringUtil::splitBase(file, baseName);
 
-    //QGears::LZSFLevelFileManager   &fmgr(QGears::LZSFLevelFileManager::getSingleton());
+            auto meshName = QGears::FF7::NameLookup::model(baseName) + ".mesh";
 
-   // QGears::FLevelFilePtr           f = fmgr.load(archive, "FFVII").staticCast<QGears::FLevelFile>();
+            Ogre::MeshPtr mesh(Ogre::MeshManager::getSingleton().load(meshName, "FFVII"));
+            Ogre::SkeletonPtr skeleton(mesh->getSkeleton());
+            exportMesh(outDir, mesh);
+        }
+        catch (const Ogre::Exception& ex)
+        {
+            std::cout << "ERROR converting: " << file << " Exception: " << ex.what() << std::endl;
+        }
+    }
 
-    Ogre::SceneManager*         scene_manager(Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC, "Scene"));
-    QGears::AFilePtr            a;
-    Ogre::ResourcePtr hrc = QGears::HRCFileManager::getSingleton().load("adda.hrc", "FFVII");
-    QGears::HRCFilePtr r = hrc.staticCast<QGears::HRCFile>();
-    QGears::AFileManager       &afl_mgr(QGears::AFileManager::getSingleton());
 
-    auto meshName = QGears::FF7::NameLookup::model("adda.hrc") + ".mesh";
 
     /*
     TODO:
-      To figure out what .a files relate to which .hrc files, we need to enumerate every field
-      and check its model loader data. These are always Idle, Walk, Run and then field specific
-      ordering.
-      Model loader is section 3 of the field file.
-
+    To figure out what .a files relate to which .hrc files, we need to enumerate every field
+    and check its model loader data. These are always Idle, Walk, Run and then field specific
+    ordering.
+    Model loader is section 3 of the field file.
     */
-
-    Ogre::MeshPtr mesh(Ogre::MeshManager::getSingleton().load(meshName, "FFVII"));
-    Ogre::SkeletonPtr skeleton(mesh->getSkeleton());
-
-
-    exportMesh(outDir, mesh);
-
 }