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

debug asserts to avoid crash on 0x0 size image

Paul пре 11 година
родитељ
комит
bc397fb829

+ 2 - 0
utilities/ffvii_field_dat_dumper/src/DatFile.cpp

@@ -2840,6 +2840,8 @@ DatFile::DumpBackground( const Ogre::String& export_path, const Field& field, Mi
     export_text->Log( " clip=\"" + IntToString( 320 * 3 ) + " " + IntToString( 240 * 3 ) + "\"" );
     export_text->Log( ">\n" );
 
+    assert(width != 0);
+    assert(height != 0);
     full_image = CreateSurface( width, height );
     x_32 = 0; y_32 = 0; x_16 = 0; y_16 = 0; n_16 = 0;
 

+ 9 - 1
utilities/ffvii_field_dat_dumper/src/Main.cpp

@@ -168,9 +168,17 @@ main( int argc, char *argv[] )
 
     fill_names();
 
+    /*
+    // can use this for debugging if not using export.cfg
     Field f = {};
-    f.name = "C:\\Users\\paul\\Downloads\\data\\data\\en\\nmkin_1";
+    f.tex_width = 1024;
+    f.tex_height = 512;
+    // Note: Must create path CWD\export_en\maps\ffvii_field
+    f.name = "md1_2"; // DO NOT put a full path here, else it will attempt to save with full output path and fail
     fields.push_back(f);
+    */
+
+
 /*
     for (int f = 0; f < fields.size(); ++f)
     {

+ 4 - 3
utilities/q-gears-launcher/src/ff7DataInstaller.cpp

@@ -163,17 +163,18 @@ static void FF7PcFieldToQGearsField(QGears::FLevelFilePtr& field, const std::str
         // Decompile to LUA
         FF7FieldScriptFormatter formatter;
         std::string luaScript = SUDM::FF7::Field::Decompile(field->getName(), rawFieldData, formatter);
+        std::cout << luaScript << std::endl;
     }
     catch (const ::InternalDecompilerError& ex)
     {
         std::cerr << "InternalDecompilerError: " << ex.what() << std::endl;
     }
 
-    /*
+    
     const QGears::PaletteFilePtr& pal = field->getPalette();
     std::unique_ptr<Ogre::Image> bgImage(bg->createImage(pal));
     bgImage->save(outDir + "/" + field->getName() + ".png");
-    */
+
     {
         TiXmlDocument doc;
         std::unique_ptr<TiXmlElement> element(new TiXmlElement("background2d"));
@@ -241,7 +242,7 @@ void FF7DataInstaller::ConvertFields(std::string archive, std::string outDir)
         if (!QGears::StringUtil::endsWith(resourceName, ".tex")
          && !QGears::StringUtil::endsWith(resourceName, ".tut")
          && !QGears::StringUtil::endsWith(resourceName, ".siz")
-         && resourceName != "maplist" && resourceName == "md1_1")
+         && resourceName != "maplist" && resourceName == "md1_2")
         {
             //try
             {