mirror of
				https://github.com/davidgiven/fluxengine.git
				synced 2025-10-24 11:11:02 -07:00 
			
		
		
		
	Some more renaming.
This commit is contained in:
		| @@ -680,7 +680,7 @@ TracksAndSectors readAndDecodeTrack(const DiskLayout& diskLayout, | ||||
| void readDiskCommand(const DiskLayout& diskLayout, | ||||
|     FluxSource& fluxSource, | ||||
|     Decoder& decoder, | ||||
|     Disk& decodedDisk) | ||||
|     Disk& disk) | ||||
| { | ||||
|     std::unique_ptr<FluxSinkFactory> outputFluxSinkFactory; | ||||
|     if (globalConfig()->decoder().has_copy_flux_to()) | ||||
| @@ -705,12 +705,12 @@ void readDiskCommand(const DiskLayout& diskLayout, | ||||
|             auto [trackFluxes, trackSectors] = | ||||
|                 readAndDecodeTrack(diskLayout, fluxSource, decoder, ltl); | ||||
|             for (const auto& flux : trackFluxes) | ||||
|                 decodedDisk.tracksByPhysicalLocation.emplace( | ||||
|                 disk.tracksByPhysicalLocation.emplace( | ||||
|                     CylinderHead{ | ||||
|                         flux->ptl->physicalCylinder, flux->ptl->physicalHead}, | ||||
|                     flux); | ||||
|             for (const auto& sector : trackSectors) | ||||
|                 decodedDisk.sectorsByPhysicalLocation.emplace( | ||||
|                 disk.sectorsByPhysicalLocation.emplace( | ||||
|                     sector->physicalLocation.value(), sector); | ||||
|  | ||||
|             if (outputFluxSink) | ||||
| @@ -778,34 +778,33 @@ void readDiskCommand(const DiskLayout& diskLayout, | ||||
|             log(TrackReadLogMessage{trackFluxes, trackSectors}); | ||||
|  | ||||
|             std::vector<std::shared_ptr<const Sector>> all_sectors; | ||||
|             for (auto& [ch, sector] : decodedDisk.sectorsByPhysicalLocation) | ||||
|             for (auto& [ch, sector] : disk.sectorsByPhysicalLocation) | ||||
|                 all_sectors.push_back(sector); | ||||
|             all_sectors = collectSectors(all_sectors); | ||||
|             decodedDisk.image = std::make_shared<Image>(all_sectors); | ||||
|             disk.image = std::make_shared<Image>(all_sectors); | ||||
|  | ||||
|             /* Log a _copy_ of the decodedDisk structure so that the logger | ||||
|              * doesn't see the decodedDisk get mutated in subsequent reads. */ | ||||
|             log(DiskReadLogMessage{std::make_shared<Disk>(decodedDisk)}); | ||||
|             /* Log a _copy_ of the disk structure so that the logger | ||||
|              * doesn't see the disk get mutated in subsequent reads. */ | ||||
|             log(DiskReadLogMessage{std::make_shared<Disk>(disk)}); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     if (!decodedDisk.image) | ||||
|         decodedDisk.image = std::make_shared<Image>(); | ||||
|     if (!disk.image) | ||||
|         disk.image = std::make_shared<Image>(); | ||||
|  | ||||
|     log(EndOperationLogMessage{"Read complete"}); | ||||
| } | ||||
|  | ||||
| void readDiskCommand(const DiskLayout& diskLayout, | ||||
|     FluxSource& fluxsource, | ||||
|     FluxSource& fluxSource, | ||||
|     Decoder& decoder, | ||||
|     ImageWriter& writer) | ||||
| { | ||||
|     Disk decodedDisk; | ||||
|     readDiskCommand(diskLayout, fluxsource, decoder, decodedDisk); | ||||
|     Disk disk; | ||||
|     readDiskCommand(diskLayout, fluxSource, decoder, disk); | ||||
|  | ||||
|     writer.printMap(*decodedDisk.image); | ||||
|     writer.printMap(*disk.image); | ||||
|     if (globalConfig()->decoder().has_write_csv_to()) | ||||
|         writer.writeCsv( | ||||
|             *decodedDisk.image, globalConfig()->decoder().write_csv_to()); | ||||
|     writer.writeImage(*decodedDisk.image); | ||||
|         writer.writeCsv(*disk.image, globalConfig()->decoder().write_csv_to()); | ||||
|     writer.writeImage(*disk.image); | ||||
| } | ||||
|   | ||||
| @@ -122,9 +122,9 @@ extern TracksAndSectors readAndDecodeTrack(const DiskLayout& diskLayout, | ||||
|     const std::shared_ptr<const LogicalTrackLayout>& ltl); | ||||
|  | ||||
| extern void readDiskCommand(const DiskLayout& diskLayout, | ||||
|     FluxSource& fluxsource, | ||||
|     FluxSource& fluxSource, | ||||
|     Decoder& decoder, | ||||
|     Disk& diskflux); | ||||
|     Disk& disk); | ||||
| extern void readDiskCommand(const DiskLayout& diskLayout, | ||||
|     FluxSource& source, | ||||
|     Decoder& decoder, | ||||
|   | ||||
| @@ -96,12 +96,12 @@ public: | ||||
|                 { | ||||
|                     auto* fluxSource = GetContext().GetFluxSource(); | ||||
|                     auto* decoder = GetContext().GetDecoder(); | ||||
|                     auto diskflux = readDiskCommand(*fluxSource, *decoder); | ||||
|                     auto disk = readDiskCommand(*fluxSource, *decoder); | ||||
|  | ||||
|                     runOnUiThread( | ||||
|                         [&]() | ||||
|                         { | ||||
|                             visualiser->SetDiskData(diskflux); | ||||
|                             visualiser->SetDiskData(disk); | ||||
|                         }); | ||||
|                 }); | ||||
|         } | ||||
|   | ||||
| @@ -17,11 +17,11 @@ AbstractSectorView::AbstractSectorView(const std::string& name): | ||||
|  | ||||
| void AbstractSectorView::drawContent() | ||||
| { | ||||
|     auto diskFlux = Datastore::getDisk(); | ||||
|     auto disk = Datastore::getDisk(); | ||||
|     auto diskLayout = Datastore::getDiskLayout(); | ||||
|     if (!diskFlux || !diskLayout) | ||||
|     if (!disk || !diskLayout) | ||||
|         return; | ||||
|     auto& image = diskFlux->image; | ||||
|     auto& image = disk->image; | ||||
|     if (!image) | ||||
|         return; | ||||
|  | ||||
|   | ||||
| @@ -43,9 +43,9 @@ static void saveSectorImage() | ||||
|  | ||||
| void ControlPanelView::drawContent() | ||||
| { | ||||
|     auto diskFlux = Datastore::getDisk(); | ||||
|     auto disk = Datastore::getDisk(); | ||||
|     bool busy = Datastore::isBusy(); | ||||
|     bool hasImage = diskFlux && diskFlux->image; | ||||
|     bool hasImage = disk && disk->image; | ||||
|  | ||||
|     if (ImGui::BeginTable("controlPanelOuter", | ||||
|             3, | ||||
| @@ -99,12 +99,12 @@ void ControlPanelView::drawContent() | ||||
|         button(ICON_TA_REPEAT, | ||||
|             "fluxengine.view.controlpanel.rereadBad"_lang, | ||||
|             nullptr, | ||||
|             busy || !diskFlux); | ||||
|             busy || !disk); | ||||
|         ImGui::TableNextColumn(); | ||||
|         button(ICON_TA_DOWNLOAD, | ||||
|             "fluxengine.view.controlpanel.writeFlux"_lang, | ||||
|             saveFluxFile, | ||||
|             busy || !diskFlux); | ||||
|             busy || !disk); | ||||
|  | ||||
|         ImGui::TableNextRow(); | ||||
|         button(ICON_VS_FOLDER_OPENED, | ||||
|   | ||||
| @@ -34,7 +34,7 @@ | ||||
|  | ||||
| using hex::operator""_lang; | ||||
|  | ||||
| static std::shared_ptr<const Disk> diskFlux; | ||||
| static std::shared_ptr<const Disk> disk; | ||||
| static std::shared_ptr<Image> wtImage; | ||||
|  | ||||
| static std::deque<std::function<void()>> pendingTasks; | ||||
| @@ -246,7 +246,7 @@ void Datastore::init() | ||||
|     Events::SeekToTrackViaPhysicalLocation::subscribe( | ||||
|         [](CylinderHead physicalLocation) | ||||
|         { | ||||
|             if (!diskFlux || !diskLayout) | ||||
|             if (!disk || !diskLayout) | ||||
|                 return; | ||||
|             auto ptlo = findOptionally(diskLayout->layoutByPhysicalLocation, | ||||
|                 {physicalLocation.cylinder, physicalLocation.head}); | ||||
| @@ -294,7 +294,7 @@ std::shared_ptr<const DiskLayout> Datastore::getDiskLayout() | ||||
|  | ||||
| std::shared_ptr<const Disk> Datastore::getDisk() | ||||
| { | ||||
|     return diskFlux; | ||||
|     return disk; | ||||
| } | ||||
|  | ||||
| static void badConfiguration() | ||||
| @@ -332,7 +332,7 @@ static void wtClearDiskData() | ||||
|         [] | ||||
|         { | ||||
|             ::wtImage = nullptr; | ||||
|             ::diskFlux = nullptr; | ||||
|             ::disk = nullptr; | ||||
|         }); | ||||
| } | ||||
|  | ||||
| @@ -496,10 +496,10 @@ void Datastore::onLogMessage(const AnyLogMessage& message) | ||||
|             [&](std::shared_ptr<const DiskReadLogMessage> m) | ||||
|             { | ||||
|                 /* This is where data gets from the worker thread to the GUI. | ||||
|                  * The diskFlux here is a copy of the one being worked on, and | ||||
|                  * The disk here is a copy of the one being worked on, and | ||||
|                  * is guaranteed not to change. */ | ||||
|  | ||||
|                 diskFlux = m->disk; | ||||
|                 disk = m->disk; | ||||
|             }, | ||||
|  | ||||
|             /* Large-scale operation start. */ | ||||
| @@ -544,8 +544,8 @@ void Datastore::beginRead() | ||||
|                 auto fluxSource = FluxSource::create(globalConfig()); | ||||
|                 auto decoder = Arch::createDecoder(globalConfig()); | ||||
|  | ||||
|                 auto diskflux = std::make_shared<Disk>(); | ||||
|                 readDiskCommand(*diskLayout, *fluxSource, *decoder, *diskflux); | ||||
|                 auto disk = std::make_shared<Disk>(); | ||||
|                 readDiskCommand(*diskLayout, *fluxSource, *decoder, *disk); | ||||
|             } | ||||
|             catch (...) | ||||
|             { | ||||
| @@ -605,7 +605,7 @@ void Datastore::beginWrite() | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|                 auto image = diskFlux->image; | ||||
|                 auto image = disk->image; | ||||
|                 writeDiskCommand(*diskLayout, | ||||
|                     *image, | ||||
|                     *encoder, | ||||
| @@ -705,11 +705,11 @@ void Datastore::readImage(const std::fs::path& path) | ||||
|                 std::shared_ptr<Image> image = | ||||
|                     ImageReader::create(globalConfig())->readImage(); | ||||
|  | ||||
|                 auto diskFlux = wtMakeDiskDataFromImage(image); | ||||
|                 auto disk = wtMakeDiskDataFromImage(image); | ||||
|                 hex::TaskManager::doLater( | ||||
|                     [=] | ||||
|                     { | ||||
|                         ::diskFlux = diskFlux; | ||||
|                         ::disk = disk; | ||||
|                     }); | ||||
|             } | ||||
|             catch (...) | ||||
| @@ -735,16 +735,16 @@ void Datastore::writeFluxFile(const std::fs::path& path) | ||||
|                 wtRebuildConfiguration(); | ||||
|                 wtWaitForUiThreadToCatchUp(); | ||||
|  | ||||
|                 if (!diskFlux || !diskFlux->image) | ||||
|                 if (!disk || !disk->image) | ||||
|                     error("no loaded image"); | ||||
|                 if (diskFlux->image->getGeometry().totalBytes != | ||||
|                 if (disk->image->getGeometry().totalBytes != | ||||
|                     diskLayout->totalBytes) | ||||
|                     error( | ||||
|                         "loaded image is not the right size for this " | ||||
|                         "format"); | ||||
|  | ||||
|                 globalConfig().setFluxSink(path.string()); | ||||
|                 auto fluxSource = FluxSource::createMemoryFluxSource(*diskFlux); | ||||
|                 auto fluxSource = FluxSource::createMemoryFluxSource(*disk); | ||||
|                 auto fluxSinkFactory = FluxSinkFactory::create(globalConfig()); | ||||
|                 writeRawDiskCommand(*diskLayout, *fluxSource, *fluxSinkFactory); | ||||
|             } | ||||
| @@ -781,11 +781,11 @@ void Datastore::createBlankImage() | ||||
|                 filesystem->create(false, "FLUXENGINE"); | ||||
|                 filesystem->flushChanges(); | ||||
|  | ||||
|                 auto diskFlux = wtMakeDiskDataFromImage(image); | ||||
|                 auto disk = wtMakeDiskDataFromImage(image); | ||||
|                 hex::TaskManager::doLater( | ||||
|                     [=] | ||||
|                     { | ||||
|                         ::diskFlux = diskFlux; | ||||
|                         ::disk = disk; | ||||
|                     }); | ||||
|             } | ||||
|             catch (...) | ||||
|   | ||||
| @@ -60,9 +60,9 @@ void DiskProvider::close() {} | ||||
|  | ||||
| void DiskProvider::readRaw(u64 offset, void* buffer, size_t size) | ||||
| { | ||||
|     const auto& diskFlux = Datastore::getDisk(); | ||||
|     const auto& disk = Datastore::getDisk(); | ||||
|     const auto& diskLayout = Datastore::getDiskLayout(); | ||||
|     if (diskFlux && diskFlux->image && diskLayout) | ||||
|     if (disk && disk->image && diskLayout) | ||||
|     { | ||||
|         while (size != 0) | ||||
|         { | ||||
| @@ -74,7 +74,7 @@ void DiskProvider::readRaw(u64 offset, void* buffer, size_t size) | ||||
|  | ||||
|             unsigned realOffset = it->first; | ||||
|             auto logicalLocation = it->second; | ||||
|             auto sector = diskFlux->image->get(logicalLocation); | ||||
|             auto sector = disk->image->get(logicalLocation); | ||||
|             auto& ltl = diskLayout->layoutByLogicalLocation.at( | ||||
|                 logicalLocation.trackLocation()); | ||||
|             unsigned blockOffset = realOffset - offset; | ||||
|   | ||||
| @@ -20,6 +20,6 @@ DiskLayout::LayoutBounds ImageView::getBounds() | ||||
| std::shared_ptr<const Sector> ImageView::getSector( | ||||
|     unsigned logicalCylinder, unsigned logicalHead, unsigned sectorId) | ||||
| { | ||||
|     auto diskFlux = Datastore::getDisk(); | ||||
|     return diskFlux->image->get({logicalCylinder, logicalHead, sectorId}); | ||||
|     auto disk = Datastore::getDisk(); | ||||
|     return disk->image->get({logicalCylinder, logicalHead, sectorId}); | ||||
| } | ||||
|   | ||||
| @@ -25,13 +25,12 @@ DiskLayout::LayoutBounds PhysicalView::getBounds() | ||||
| std::shared_ptr<const Sector> PhysicalView::getSector( | ||||
|     unsigned physicalCylinder, unsigned physicalHead, unsigned sectorId) | ||||
| { | ||||
|     const auto& diskFlux = Datastore::getDisk(); | ||||
|     const auto& disk = Datastore::getDisk(); | ||||
|     const auto& diskLayout = Datastore::getDiskLayout(); | ||||
|     const auto& ptl = findOrDefault( | ||||
|         diskLayout->layoutByPhysicalLocation, {physicalCylinder, physicalHead}); | ||||
|     if (!ptl) | ||||
|         return nullptr; | ||||
|     const auto& ltl = ptl->logicalTrackLayout; | ||||
|     return diskFlux->image->get( | ||||
|         {ltl->logicalCylinder, ltl->logicalHead, sectorId}); | ||||
|     return disk->image->get({ltl->logicalCylinder, ltl->logicalHead, sectorId}); | ||||
| } | ||||
|   | ||||
| @@ -65,11 +65,11 @@ SummaryView::SummaryView(): | ||||
| } | ||||
|  | ||||
| static std::set<std::shared_ptr<const Sector>> findSectors( | ||||
|     const Disk& diskFlux, unsigned physicalCylinder, unsigned physicalHead) | ||||
|     const Disk& disk, unsigned physicalCylinder, unsigned physicalHead) | ||||
| { | ||||
|     std::set<std::shared_ptr<const Sector>> sectors; | ||||
|  | ||||
|     auto [startIt, endIt] = diskFlux.sectorsByPhysicalLocation.equal_range( | ||||
|     auto [startIt, endIt] = disk.sectorsByPhysicalLocation.equal_range( | ||||
|         {physicalCylinder, physicalHead}); | ||||
|     for (auto it = startIt; it != endIt; it++) | ||||
|         sectors.insert(it->second); | ||||
| @@ -84,10 +84,10 @@ struct TrackAnalysis | ||||
| }; | ||||
|  | ||||
| static TrackAnalysis analyseTrack( | ||||
|     const Disk& diskFlux, unsigned physicalCylinder, unsigned physicalHead) | ||||
|     const Disk& disk, unsigned physicalCylinder, unsigned physicalHead) | ||||
| { | ||||
|     TrackAnalysis result = {}; | ||||
|     auto sectors = findSectors(diskFlux, physicalCylinder, physicalHead); | ||||
|     auto sectors = findSectors(disk, physicalCylinder, physicalHead); | ||||
|     result.colour = ImGui::GetColorU32(ImGuiCol_TextDisabled); | ||||
|     result.tooltip = "No data"; | ||||
|     if (!sectors.empty()) | ||||
| @@ -137,7 +137,7 @@ static void drawPhysicalMap(unsigned minPhysicalCylinder, | ||||
|     unsigned maxPhysicalCylinder, | ||||
|     unsigned minPhysicalHead, | ||||
|     unsigned maxPhysicalHead, | ||||
|     const Disk& diskFlux) | ||||
|     const Disk& disk) | ||||
| { | ||||
|     int numPhysicalCylinders = maxPhysicalCylinder - minPhysicalCylinder + 1; | ||||
|     int numPhysicalHeads = maxPhysicalHead - minPhysicalHead + 1; | ||||
| @@ -185,7 +185,7 @@ static void drawPhysicalMap(unsigned minPhysicalCylinder, | ||||
|                 cylinder <= maxPhysicalCylinder; | ||||
|                 cylinder++) | ||||
|             { | ||||
|                 auto [tooltip, colour] = analyseTrack(diskFlux, cylinder, head); | ||||
|                 auto [tooltip, colour] = analyseTrack(disk, cylinder, head); | ||||
|                 ImGui::PushStyleColor(ImGuiCol_Header, colour); | ||||
|                 DEFER(ImGui::PopStyleColor()); | ||||
|                 ImGui::PushFont(NULL, originalFontSize); | ||||
| @@ -219,7 +219,7 @@ static void drawLogicalMap(unsigned minPhysicalCylinder, | ||||
|     unsigned maxPhysicalCylinder, | ||||
|     unsigned minPhysicalHead, | ||||
|     unsigned maxPhysicalHead, | ||||
|     const Disk& diskFlux, | ||||
|     const Disk& disk, | ||||
|     const DiskLayout& diskLayout) | ||||
| { | ||||
|     auto originalFontSize = ImGui::GetFontSize(); | ||||
| @@ -278,7 +278,7 @@ static void drawLogicalMap(unsigned minPhysicalCylinder, | ||||
|                 if (ptl->groupOffset == 0) | ||||
|                 { | ||||
|                     auto [tooltip, colour] = | ||||
|                         analyseTrack(diskFlux, physicalCylinder, physicalHead); | ||||
|                         analyseTrack(disk, physicalCylinder, physicalHead); | ||||
|  | ||||
|                     ImGui::PushStyleColor(ImGuiCol_Header, colour); | ||||
|                     DEFER(ImGui::PopStyleColor()); | ||||
| @@ -325,9 +325,9 @@ static void drawLogicalMap(unsigned minPhysicalCylinder, | ||||
|  | ||||
| void SummaryView::drawContent() | ||||
| { | ||||
|     auto diskFlux = Datastore::getDisk(); | ||||
|     auto disk = Datastore::getDisk(); | ||||
|     auto diskLayout = Datastore::getDiskLayout(); | ||||
|     if (!diskFlux || !diskLayout) | ||||
|     if (!disk || !diskLayout) | ||||
|         return; | ||||
|  | ||||
|     auto [minPhysicalCylinder, | ||||
| @@ -337,7 +337,7 @@ void SummaryView::drawContent() | ||||
|     int numPhysicalCylinders = maxPhysicalCylinder - minPhysicalCylinder + 1; | ||||
|     int numPhysicalHeads = maxPhysicalHead - minPhysicalHead + 1; | ||||
|  | ||||
|     if (diskFlux) | ||||
|     if (disk) | ||||
|     { | ||||
|         ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, {1, 1}); | ||||
|         DEFER(ImGui::PopStyleVar()); | ||||
| @@ -354,7 +354,7 @@ void SummaryView::drawContent() | ||||
|             maxPhysicalCylinder, | ||||
|             minPhysicalHead, | ||||
|             maxPhysicalHead, | ||||
|             *diskFlux); | ||||
|             *disk); | ||||
|  | ||||
|         ImGuiExt::TextFormattedCenteredHorizontal( | ||||
|             "fluxengine.view.summary.logical"_lang); | ||||
| @@ -363,7 +363,7 @@ void SummaryView::drawContent() | ||||
|             maxPhysicalCylinder, | ||||
|             minPhysicalHead, | ||||
|             maxPhysicalHead, | ||||
|             *diskFlux, | ||||
|             *disk, | ||||
|             *diskLayout); | ||||
|  | ||||
|         ImGui::Dummy(ImVec2(0, ImGui::GetFontSize())); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user