فهرست منبع

Updated the encoder to add "-h" argument for heightmaps just like the existing argument "-heightmaps".
Fixed the GPBDecoder for decoding a GPB file and printing its heading information (for trouble shooting purposes).

Darryl Gough 13 سال پیش
والد
کامیت
5937b4ca30
2فایلهای تغییر یافته به همراه4 افزوده شده و 3 حذف شده
  1. 2 2
      gameplay-encoder/src/EncoderArguments.cpp
  2. 2 1
      gameplay-encoder/src/GPBDecoder.cpp

+ 2 - 2
gameplay-encoder/src/EncoderArguments.cpp

@@ -181,7 +181,7 @@ void EncoderArguments::printUsage() const
     fprintf(stderr,"  -t\t\t\tWrite text/xml.\n");
     fprintf(stderr,"  -g <node id> <animation id>\n" \
         "\t\t\tGroup all animation channels targetting the nodes into a new animation.\n");
-    fprintf(stderr,"  -heightmaps \"<node ids>\"\n" \
+    fprintf(stderr,"  -h \"<node ids>\"\n" \
         "\t\t\tList of nodes to generate heightmaps for.\n" \
         "\t\t\tNode id list should be in quotes with a space between each id.\n" \
         "\t\t\tHeightmaps will be saved in files named <nodeid>.png.\n");
@@ -313,7 +313,7 @@ void EncoderArguments::readOption(const std::vector<std::string>& options, size_
         break;
     case 'h':
         {
-            if (str.compare("-heightmaps") == 0)
+            if (str.compare("-heightmaps") == 0 || str.compare("-h") == 0)
             {
                 (*index)++;
                 if (*index < options.size())

+ 2 - 1
gameplay-encoder/src/GPBDecoder.cpp

@@ -40,9 +40,10 @@ void GPBDecoder::readBinary(const std::string& filepath)
 bool GPBDecoder::validateHeading()
 {
     const size_t HEADING_SIZE = 9;
-    const char identifier[] = { '«', 'G', 'P', 'B', '»', '\r', '\n', '\x1A', '\n' };
+    const char identifier[] = "\xABGPB\xBB\r\n\x1A\n";
 
     char heading[HEADING_SIZE];
+    fread(heading, sizeof(unsigned char), HEADING_SIZE, _file);
     for (size_t i = 0; i < HEADING_SIZE; ++i)
     {
         if (heading[i] != identifier[i])