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

Method SaveLastDiskImage

source/Disk.cpp:227–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225//===========================================================================
226
227void Disk2InterfaceCard::SaveLastDiskImage(const int drive)
228{
229 _ASSERT(drive == DRIVE_1 || drive == DRIVE_2);
230
231 if (!m_saveDiskImage || !m_saveDiskImageToRegistry)
232 return;
233
234 std::string regSection = RegGetConfigSlotSection(m_slot);
235 RegSaveValue(regSection.c_str(), REGVALUE_CARD_TYPE, TRUE, CT_Disk2);
236
237 const std::string regKey = (drive == DRIVE_1)
238 ? REGVALUE_LAST_DISK_1
239 : REGVALUE_LAST_DISK_2;
240
241 const std::string& pathName = DiskGetFullPathName(drive);
242
243 RegSaveString(regSection.c_str(), regKey.c_str(), TRUE, pathName);
244
245 //
246
247 // For now, only update 'Starting Directory' for slot6 & drive1
248 // . otherwise you'll get inconsistent results if you set drive1, then drive2 (and the images were in different folders)
249 if (m_slot != SLOT6 || drive != DRIVE_1)
250 return;
251
252 const size_t slash = pathName.find_last_of(PATH_SEPARATOR);
253 if (slash != std::string::npos)
254 {
255 const std::string dirName = pathName.substr(0, slash + 1);
256 RegSaveString(REG_PREFS, REGVALUE_PREF_START_DIR, 1, dirName);
257 }
258}
259
260//===========================================================================
261

Callers

nothing calls this directly

Calls 3

RegGetConfigSlotSectionFunction · 0.85
RegSaveValueFunction · 0.85
RegSaveStringFunction · 0.85

Tested by

no test coverage detected