MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / SaveLastDiskImage

Method SaveLastDiskImage

source/Harddisk.cpp:335–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

333//===========================================================================
334
335void HarddiskInterfaceCard::SaveLastDiskImage(const int drive)
336{
337 _ASSERT(drive >= HARDDISK_1 && drive < NUM_HARDDISKS);
338
339 if (!m_saveDiskImage || !m_saveDiskImageToRegistry)
340 return;
341
342 std::string regSection = RegGetConfigSlotSection(m_slot);
343 RegSaveValue(regSection.c_str(), REGVALUE_CARD_TYPE, TRUE, CT_GenericHDD);
344
345 const std::string regKey = std::string(REGVALUE_LAST_HARDDISK_) + (char)('1' + drive);
346 const std::string& pathName = HarddiskGetFullPathName(drive);
347
348 RegSaveString(regSection.c_str(), regKey.c_str(), TRUE, pathName);
349
350 //
351
352 // For now, only update 'HDV Starting Directory' for slot7 & drive1
353 // . otherwise you'll get inconsistent results if you set drive1, then drive2 (and the images were in different folders)
354 if (m_slot != SLOT7 || drive != HARDDISK_1)
355 return;
356
357 const size_t slash = pathName.find_last_of(PATH_SEPARATOR);
358 if (slash != std::string::npos)
359 {
360 const std::string dirName = pathName.substr(0, slash + 1);
361 RegSaveString(REG_PREFS, REGVALUE_PREF_HDV_START_DIR, 1, dirName);
362 }
363}
364
365//===========================================================================
366

Callers

nothing calls this directly

Calls 3

RegGetConfigSlotSectionFunction · 0.85
RegSaveValueFunction · 0.85
RegSaveStringFunction · 0.85

Tested by

no test coverage detected