Преглед изворни кода

Fixed some problems with the installer.

Iñigo Valentin пре 4 година
родитељ
комит
24622076a7

+ 3 - 0
CMakeLists.txt

@@ -229,6 +229,9 @@ if (UNIX AND $ENV{COVERAGE}==1)
       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage") # enabling coverage
 endif()
 
+#DEBUG, no optimizations
+#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -rdynamic -O0")
+
 add_definitions(-DTIXML_USE_STL)
 add_subdirectory(lib)
 add_subdirectory(V-Gears)

+ 2 - 0
V-Gears-Installer/CMakeLists.txt

@@ -50,6 +50,8 @@ add_subdirectory(flevel)
 add_subdirectory(lzs)
 #add_subdirectory(v-gears-launcher)
 
+#DEBUG, no optimizations
+#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -rdynamic -O0")
 
 find_package ( Qt5Widgets REQUIRED )
 #include ( ${QT_USE_FILE} )

+ 3 - 0
V-Gears-Installer/src/CMakeLists.txt

@@ -39,6 +39,9 @@ add_library(Utility STATIC
   ${SOURCE_FILES}
 )
 
+#DEBUG, no optimizations
+#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -rdynamic -O0")
+
 target_link_libraries(Utility
     ${OGRE_LIBRARIES}
     ${OIS_LIBRARIES}

+ 19 - 12
V-Gears-Installer/src/ff7DataInstaller.cpp

@@ -98,18 +98,25 @@ int FF7DataInstaller::Progress(){
               "TEX", "FFVIITextures"
             );
             // TODO: DEBUG
+            std::cout << "[INS] -> SPAWN_POINTS_AND_SCALE_FACTORS_INIT" << std::endl;
             installation_state_ = SPAWN_POINTS_AND_SCALE_FACTORS_INIT;
             //installation_state_ = CONVERT_FIELD_MODELS;
             return CalcProgress();
         case SPAWN_POINTS_AND_SCALE_FACTORS_INIT:
             write_output_line("Collecting spawn points and scale factors");
+            std::cout << "[INS][PRE] InitCollectSpawnAndScaleFactors" << std::endl;
             InitCollectSpawnAndScaleFactors();
+            std::cout << "[INS][POST] InitCollectSpawnAndScaleFactors" << std::endl;
             return CalcProgress();
         case SPAWN_POINTS_AND_SCALE_FACTORS:
+            std::cout << "[INS][PRE] CollectSpawnAndScaleFactors" << std::endl;
             CollectionFieldSpawnAndScaleFactors();
+            std::cout << "[INS][POST] CollectSpawnAndScaleFactors" << std::endl;
             return CalcProgress();
         case CONVERT_FIELDS:
+            std::cout << "[INS][PRE] ConvertFieldsIteration" << std::endl;
             ConvertFieldsIteration();
+            std::cout << "[INS][POST] ConvertFieldsIteration" << std::endl;
             return CalcProgress();
         case WRITE_MAPS_INIT:
             write_output_line("Write fields");
@@ -1355,7 +1362,7 @@ void FF7DataInstaller::InitCollectSpawnAndScaleFactors(){
     );
     // Load the map list field.
     QGears::MapListFilePtr map_list
-      = QGears::MapListFileManager::getSingleton().load(
+      = QGears::MapListFileManager::GetSingleton().load(
         "maplist", "FFVIIFields"
       ).staticCast<QGears::MapListFile>();
     map_list_ = map_list->GetMapList();
@@ -1371,12 +1378,12 @@ void FF7DataInstaller::CollectionFieldSpawnAndScaleFactors(){
         auto resource_name = (*flevel_file_list_)[iterator_counter_];
         // Exclude things that are not fields.
         if (IsAFieldFile(resource_name) /*&& IsTestField(resourceName)*/){
-            conversion_step_++;
+            conversion_step_ ++;
             if (conversion_step_ == 1){
-                field_ = QGears::LZSFLevelFileManager::getSingleton().load(
-                        resource_name, "FFVIIFields"
+                field_ = QGears::LZSFLevelFileManager::GetSingleton().load(
+                  resource_name, "FFVIIFields"
                 ).staticCast<QGears::FLevelFile>();
-                //write_output_line("Load field " + resourceName);
+                //write_output_line("Load field " + resource_name);
                 return;
             }
             if (conversion_step_ == 2){
@@ -1388,11 +1395,11 @@ void FF7DataInstaller::CollectionFieldSpawnAndScaleFactors(){
                 //write_output_line("Read scale factor");
                 CollectFieldScaleFactors(field_, scale_factors_, map_list_);
                 conversion_step_ = 0;
-                iterator_counter_++;
+                iterator_counter_ ++;
                 return;
             }
         }
-        else iterator_counter_++;
+        else iterator_counter_ ++;
     }
     else{
         field_.reset();
@@ -1409,7 +1416,7 @@ void FF7DataInstaller::ConvertFieldsIteration(){
     progress_step_num_elements_ = flevel_file_list_->size();
     if (iterator_counter_ < flevel_file_list_->size()){
         auto resource_name = (*flevel_file_list_)[iterator_counter_];
-        // Exclude things that are not fields
+        // Exclude things that are not fields.
         if (IsAFieldFile(resource_name)){
             if (/*IsTestField(resource_name) &&*/ !WillCrash(resource_name)){
                 //write_output_line("Converting field " + resource_name);
@@ -1417,7 +1424,7 @@ void FF7DataInstaller::ConvertFieldsIteration(){
                 //  << std::endl;
                 CreateDir(FieldMapDir() + "/" + resource_name);
                 QGears::FLevelFilePtr field
-                  = QGears::LZSFLevelFileManager::getSingleton().load(
+                  = QGears::LZSFLevelFileManager::GetSingleton().load(
                     resource_name, "FFVIIFields"
                   ).staticCast<QGears::FLevelFile>();
                 FF7PcFieldToQGearsField(
@@ -1445,7 +1452,7 @@ void FF7DataInstaller::ConvertFieldsIteration(){
 }
 
 void FF7DataInstaller::WriteMapsXmlBegin(){
-    // Write out maps.xml .
+    // Write out maps.xml.
     progress_step_num_elements_ = 1;
     doc_ = std::make_unique<TiXmlDocument>();
     element_ = std::make_unique<TiXmlElement>("maps");
@@ -1509,7 +1516,7 @@ void FF7DataInstaller::ConvertFieldModelsIteration(){
         else{
             try{
                 Ogre::ResourcePtr hrc
-                  = QGears::HRCFileManager::getSingleton().load(
+                  = QGears::HRCFileManager::GetSingleton().load(
                     model_animation_map_iterator_->first, "FFVII"
                   );
                 Ogre::String base_name;
@@ -1525,7 +1532,7 @@ void FF7DataInstaller::ConvertFieldModelsIteration(){
                 Ogre::SkeletonPtr skeleton(mesh->getSkeleton());
                 for (auto& anim : model_animation_map_iterator_->second){
                     QGears::AFileManager &afl_mgr(
-                      QGears::AFileManager::getSingleton()
+                      QGears::AFileManager::GetSingleton()
                     );
                     QGears::AFilePtr a
                       = afl_mgr.load(anim, "FFVII").staticCast<QGears::AFile>();

+ 2 - 1
V-Gears-Installer/src/ff7FieldTextWriter.cpp

@@ -13,6 +13,7 @@
  * GNU General Public License for more details.
  */
 
+#include <iostream>
 #include "../include/ff7FieldTextWriter.h"
 #include "common/QGearsStringUtil.h"
 
@@ -227,7 +228,7 @@ void FF7FieldTextWriter::Write(
         logger_->Log("</dialog>\n");
     }
     const u16 dialogCount = GetU16LE(offset_to_sector + offset_to_dialogs);
-    for (u16 i = 0; i <dialogCount; + +i){
+    for (u16 i = 0; i <dialogCount; ++ i){
         // gGt offset of string data.
         u32 offset
           = offset_to_sector + offset_to_dialogs + GetU16LE(

+ 5 - 5
V-Gears-Installer/src/mainwindow.cpp

@@ -75,12 +75,12 @@ void MainWindow::InitSettings(void){
     if(settings_->value("ConfigDir").isNull()){
         if (win){
             settings_->setValue(
-              "ConfigDir", QString("%1/q-gears").arg(QDir::homePath())
+              "ConfigDir", QString("%1/v-gears").arg(QDir::homePath())
             );
         }
         else{
           settings_->setValue(
-            "ConfigDir", QString("%1/.q-gears").arg(QDir::homePath())
+            "ConfigDir", QString("%1/.v-gears").arg(QDir::homePath())
           );
         }
     }
@@ -88,12 +88,12 @@ void MainWindow::InitSettings(void){
     if(settings_->value("DataDir").isNull()){
         if (win){
             settings_->setValue(
-              "DataDir",QString("%1/q-gears/data").arg(QDir::homePath())
+              "DataDir",QString("%1/v-gears/data").arg(QDir::homePath())
             );
         }
         else{
             settings_->setValue(
-              "DataDir",QString("%1/.q-gears/data").arg(QDir::homePath())
+              "DataDir",QString("%1/.v-gears/data").arg(QDir::homePath())
             );
         }
     }
@@ -101,7 +101,7 @@ void MainWindow::InitSettings(void){
     if (settings_->value("QGearsEXE").isNull()){
         if (win){
             settings_->setValue(
-              "QGearsEXE",QString("%1/q-gears.exe").arg(
+              "QGearsEXE",QString("%1/v-gears.exe").arg(
                  QCoreApplication::applicationDirPath()
                )
             );

+ 1 - 1
V-Gears-Installer/src/mainwindow.ui

@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>720</width>
-    <height>375</height>
+    <height>500</height>
    </rect>
   </property>
   <property name="windowTitle">

+ 21 - 9
V-Gears/src/core/Background2D.cpp

@@ -709,23 +709,34 @@ void Background2D::renderQueueEnded(
   Ogre::uint8 queue_group_id, const Ogre::String& invocation,
   bool& repeat_this_invocation
 ){
-    /*
-     * TODO: Something in this function is responsible for the black screen
-     * glitching (I think).
-     */
     if (cv_show_background2d.GetB() == false) return;
-    if(queue_group_id == Ogre::RENDER_QUEUE_MAIN){
-        render_system_->_setWorldMatrix(Ogre::Matrix4::IDENTITY);
-        render_system_->_setProjectionMatrix(Ogre::Matrix4::IDENTITY);
+    if (queue_group_id == Ogre::RENDER_QUEUE_MAIN){
+        Ogre::GpuProgramParametersPtr rs_params
+          = render_system_->getFixedFunctionParams(
+            Ogre::TVC_NONE, Ogre::FOG_NONE
+          );
+        rs_params->setConstant(
+          Ogre::GpuProgramParameters::ACT_WORLD_MATRIX, Ogre::Matrix4::IDENTITY
+        );
+        rs_params->setConstant(
+          Ogre::GpuProgramParameters::ACT_PROJECTION_MATRIX,
+          Ogre::Matrix4::IDENTITY
+        );
         Ogre::Viewport *viewport(CameraManager::getSingleton().getViewport());
         float width = static_cast<float>(viewport->getActualWidth());
         float height = static_cast<float>(viewport->getActualHeight());
         Ogre::Matrix4 view;
         view.makeTrans(
-          Ogre::Vector3(position_real_.x * 2 / width,
-          -position_real_.y * 2 / height, 0)
+          Ogre::Vector3(position_real_.x /* * 2*/ / width,
+          -position_real_.y /* * 2*/ / height, 0)
         );
+        // TODO This is deprecated, but if not done , the background image
+        // disappears.
         render_system_->_setViewMatrix(view);
+        rs_params->setConstant(
+          Ogre::GpuProgramParameters::ACT_VIEW_MATRIX, view
+        );
+        render_system_->applyFixedFunctionParams(rs_params, Ogre::GPV_GLOBAL);
         if (alpha_render_op_.vertexData->vertexCount != 0){
             scene_manager_->_setPass(
               alpha_material_->getTechnique(0)->getPass(0), true, false
@@ -744,6 +755,7 @@ void Background2D::renderQueueEnded(
             );
             render_system_->_render(subtract_render_op_);
         }
+
     }
 }
 

+ 1 - 1
V-Gears/src/data/QGearsFLevelFileSerializer.cpp

@@ -50,7 +50,7 @@ namespace QGears{
     ){
         // Read header.
         const size_t start_position(stream->tell());
-        readFileHeader(stream);
+        ReadFileHeader(stream);
         // Read section offsets.
         std::vector<uint32> section_offsetsVec(header_.section_count);
         std::vector<uint32> section_sizesVec(header_.section_count);

+ 3 - 3
V-Gears/src/data/QGearsHRCFileSerializer.cpp

@@ -57,7 +57,7 @@ namespace QGears{
             OGRE_EXCEPT(
               Ogre::Exception::ERR_INVALIDPARAMS,
               "Empty file",
-              "HRCFileSerializer::readFileHeader"
+              "HRCFileSerializer::ReadFileHeader"
             );
         }
         Block header_block;
@@ -73,7 +73,7 @@ namespace QGears{
                 OGRE_EXCEPT(
                   Ogre::Exception::ERR_INVALIDPARAMS,
                   "Header directive does not have a value",
-                  "HRCFileSerializer::readFileHeader"
+                  "HRCFileSerializer::ReadFileHeader"
                 );
             }
             if(parts[0] == TAG_VERSION)
@@ -121,7 +121,7 @@ namespace QGears{
     void HRCFileSerializer::ImportHRCFile(
       Ogre::DataStreamPtr &stream, HRCFile* dest
     ){
-        readFileHeader(stream);
+        ReadFileHeader(stream);
         if(header_.bone_count == 0) header_.bone_count = 1;
         dest->SetSkeletonName(header_.name);
         ReadVector(stream, dest->GetBones(), header_.bone_count);

+ 0 - 1
V-Gears/src/data/QGearsLZSDataStream.cpp

@@ -13,7 +13,6 @@
  * GNU General Public License for more details.
  */
 
-
 #include <OgreException.h>
 #include "data/QGearsLZSDataStream.h"
 

+ 3 - 5
V-Gears/src/data/QGearsLZSFLevelFileManager.cpp

@@ -25,8 +25,8 @@ namespace QGears{
     }
 
     LZSFLevelFileManager &LZSFLevelFileManager::GetSingleton(){
-        assert( msSingleton );
-        return(*msSingleton );
+        assert(msSingleton);
+        return(*msSingleton);
     }
 
     LZSFLevelFileManager::LZSFLevelFileManager(){
@@ -50,8 +50,6 @@ namespace QGears{
       const Ogre::String &group, bool is_manual,
       Ogre::ManualResourceLoader *loader,
       const Ogre::NameValuePairList *create_params
-    ){
-        return new LZSFLevelFile(this, name, handle, group, is_manual, loader);
-    }
+    ){return new LZSFLevelFile(this, name, handle, group, is_manual, loader);}
 
 }

+ 1 - 1
V-Gears/src/data/QGearsPFileSerializer.cpp

@@ -75,7 +75,7 @@ namespace QGears{
     }
 
     void PFileSerializer::ImportPFile(Ogre::DataStreamPtr &stream, PFile* dest){
-        readFileHeader(stream);
+        ReadFileHeader(stream);
         ReadVector(stream, dest->GetVertices(), header_.num_vertices);
         ReadVector(stream, dest->GetNormals(), header_.num_normals);
         ReadVector(stream, dest->GetUnknown1(), header_.num_unknown1);

+ 2 - 2
V-Gears/src/data/QGearsRSDFileSerializer.cpp

@@ -47,7 +47,7 @@ namespace QGears{
             OGRE_EXCEPT(
               Ogre::Exception::ERR_INVALIDPARAMS,
               "First line in RSD File should start with " + TAG_HEADER,
-              "RSDFileSerializer::readFileHeader"
+              "RSDFileSerializer::ReadFileHeader"
             );
         }
     }
@@ -117,7 +117,7 @@ namespace QGears{
     ){
         texture_count_ = 0;
         has_texture_count_ = false;
-        readFileHeader(stream);
+        ReadFileHeader(stream);
         while (!stream->eof()) ParseLine(GetLine(stream), dest);
         if (!has_texture_count_){
             Ogre::LogManager::getSingleton().stream()


+ 0 - 1
lib/cotire/CMakeLists.txt

@@ -1,5 +1,4 @@
 # cotire example project
-
 cmake_minimum_required(VERSION 2.8.12)
 
 if (POLICY CMP0058)

BIN
output/RenderSystem_GL.so.1.12.10