/[projet1]/public/pc/tools/osdk/main/FloppyBuilder/Floppy.cpp
Defence Force logotype

Diff of /public/pc/tools/osdk/main/FloppyBuilder/Floppy.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1094 by dbug, Tue Jan 28 18:06:41 2014 UTC revision 1095 by dbug, Wed Jan 29 13:46:25 2014 UTC
# Line 190  Floppy::Floppy() : Line 190  Floppy::Floppy() :
190    m_SectorNumber(0),    m_SectorNumber(0),
191    m_CurrentTrack(0),    m_CurrentTrack(0),
192    m_CurrentSector(1),    m_CurrentSector(1),
193      m_LastFileWithMetadata(0),
194    m_CompressionMode(e_CompressionNone),    m_CompressionMode(e_CompressionNone),
195    m_OffsetFirstSector(156),   // 156 (Location of the first byte of data of the first sector)    m_OffsetFirstSector(156),   // 156 (Location of the first byte of data of the first sector)
196    m_InterSectorSpacing(358)   // 358 (Number of bytes to skip to go to the next sector: 256+59+43)    m_InterSectorSpacing(358)   // 358 (Number of bytes to skip to go to the next sector: 256+59+43)
# Line 584  bool Floppy::WriteFile(const char *fileN Line 585  bool Floppy::WriteFile(const char *fileN
585    fileEntry.m_SectorCount=(fileSize+255)/256;    fileEntry.m_SectorCount=(fileSize+255)/256;
586    fileEntry.m_FilePath   =fileName;    fileEntry.m_FilePath   =fileName;
587    fileEntry.m_CompressionMode=e_CompressionNone;    fileEntry.m_CompressionMode=e_CompressionNone;
588    fileEntry.m_Metadata = metadata;  
589      if (!metadata.empty())
590      {
591        fileEntry.m_Metadata = metadata;
592        m_LastFileWithMetadata=m_FileEntries.size();
593      }
594    
595    for (auto metadataIt(metadata.begin());metadataIt!=metadata.end();++metadataIt)    for (auto metadataIt(metadata.begin());metadataIt!=metadata.end();++metadataIt)
596    {    {
# Line 630  bool Floppy::WriteFile(const char *fileN Line 636  bool Floppy::WriteFile(const char *fileN
636      memcpy((char*)m_Buffer+offset,fileData,sizeToWrite);      memcpy((char*)m_Buffer+offset,fileData,sizeToWrite);
637      fileData+=sizeToWrite;      fileData+=sizeToWrite;
638    
639      MoveToNextSector();      if (!MoveToNextSector())
640        {
641          ShowError("Floppy disk is full, not enough space to store '%s'.\n",fileName);
642        }
643    }    }
644    free(fileBuffer);    free(fileBuffer);
645    
# Line 714  bool Floppy::SaveDescription(const char* Line 723  bool Floppy::SaveDescription(const char*
723    
724        code_compressed << ",";        code_compressed << ",";
725    
726          if (counter<=m_LastFileWithMetadata)
727        {        {
728          for (auto metadataIt(metadata_content.begin());metadataIt!=metadata_content.end();metadataIt++)          for (auto metadataIt(metadata_content.begin());metadataIt!=metadata_content.end();metadataIt++)
729          {          {
# Line 759  bool Floppy::SaveDescription(const char* Line 769  bool Floppy::SaveDescription(const char*
769        file_list_summary << "(" << fileEntry.m_StoredFileSize << " compressed bytes: " << (fileEntry.m_StoredFileSize*100)/fileEntry.m_FinalFileSize << "% of " << fileEntry.m_FinalFileSize << " bytes).\n";        file_list_summary << "(" << fileEntry.m_StoredFileSize << " compressed bytes: " << (fileEntry.m_StoredFileSize*100)/fileEntry.m_FinalFileSize << "% of " << fileEntry.m_FinalFileSize << " bytes).\n";
770      }      }
771    
772        if (counter<=m_LastFileWithMetadata)
773      {      {
774            if (!fileEntry.m_Metadata.empty())        if (!fileEntry.m_Metadata.empty())
775            {        {
776                  file_list_summary << "// - Associated metadata: ";          file_list_summary << "// - Associated metadata: ";
777            }        }
778        for (auto metadataIt(m_MetadataCategories.begin());metadataIt!=m_MetadataCategories.end();metadataIt++)        for (auto metadataIt(m_MetadataCategories.begin());metadataIt!=m_MetadataCategories.end();metadataIt++)
779        {        {
780          const std::string& metadataCategoryName(*metadataIt);          const std::string& metadataCategoryName(*metadataIt);
# Line 792  bool Floppy::SaveDescription(const char* Line 803  bool Floppy::SaveDescription(const char*
803          metadata_content[metadataCategoryName+"_Low"] << "<" << metadataLabelEntry;          metadata_content[metadataCategoryName+"_Low"] << "<" << metadataLabelEntry;
804          metadata_content[metadataCategoryName+"_High"] << ">" << metadataLabelEntry;          metadata_content[metadataCategoryName+"_High"] << ">" << metadataLabelEntry;
805        }        }
806            if (!fileEntry.m_Metadata.empty())        if (!fileEntry.m_Metadata.empty())
807            {        {
808                  file_list_summary << "\n";          file_list_summary << "\n";
809            }        }
810      }      }
811    
812          /*          /*

Legend:
Removed from v.1094  
changed lines
  Added in v.1095

  ViewVC Help
Powered by ViewVC 1.1.26