@@ -41,6 +41,7 @@ static char NewVHDfile[MAX_PATH];
4141static char IniFile[MAX_PATH] { 0 };
4242static char HardDiskPath[MAX_PATH];
4343static ::vcc::devices::rtc::cloud9 cloud9_rtc;
44+ static const char * const gConfigurationSection = " Hard Drive" ;
4445
4546static void * gHostKey = nullptr ;
4647static PakReadMemoryByteHostCallback MemRead8 = nullptr ;
@@ -304,43 +305,39 @@ void LoadHardDisk(int drive)
304305// Get configuration items from ini file
305306void LoadConfig ()
306307{
307- char ModName[MAX_LOADSTRING]=" " ;
308308 HANDLE hr;
309309
310310 GetPrivateProfileString (" DefaultPaths" , " HardDiskPath" , " " ,
311311 HardDiskPath, MAX_PATH, IniFile);
312312
313- // Determine module name for config lookups
314- LoadString (gModuleInstance ,IDS_MODULE_NAME, ModName, MAX_LOADSTRING);
315-
316313 // Verify HD0 image file exists and mount it.
317- GetPrivateProfileString (ModName ," VHDImage" ," " ,VHDfile0,MAX_PATH,IniFile);
314+ GetPrivateProfileString (gConfigurationSection ," VHDImage" ," " ,VHDfile0,MAX_PATH,IniFile);
318315 CheckPath (VHDfile0);
319316 hr = CreateFile (VHDfile0,0 ,FILE_SHARE_READ,nullptr ,
320317 OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,nullptr );
321318 if (hr==INVALID_HANDLE_VALUE) {
322319 strcpy (VHDfile0," " );
323- WritePrivateProfileString (ModName ," VHDImage" ," " ,IniFile);
320+ WritePrivateProfileString (gConfigurationSection ," VHDImage" ," " ,IniFile);
324321 } else {
325322 CloseHandle (hr);
326323 MountHD (VHDfile0,0 );
327324 }
328325
329326 // Verify HD1 image file exists and mount it.
330- GetPrivateProfileString (ModName ," VHDImage1" ," " ,VHDfile1,MAX_PATH,IniFile);
327+ GetPrivateProfileString (gConfigurationSection ," VHDImage1" ," " ,VHDfile1,MAX_PATH,IniFile);
331328 CheckPath (VHDfile1);
332329 hr = CreateFile (VHDfile1,0 ,FILE_SHARE_READ,nullptr ,
333330 OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,nullptr );
334331 if (hr==INVALID_HANDLE_VALUE) {
335332 strcpy (VHDfile1," " );
336- WritePrivateProfileString (ModName ," VHDImage1" ," " ,IniFile);
333+ WritePrivateProfileString (gConfigurationSection ," VHDImage1" ," " ,IniFile);
337334 } else {
338335 CloseHandle (hr);
339336 MountHD (VHDfile1,1 );
340337 }
341338
342- ClockEnabled = GetPrivateProfileInt (ModName , " ClkEnable" , 1 , IniFile) != 0 ;
343- ClockReadOnly = GetPrivateProfileInt (ModName , " ClkRdOnly" , 1 , IniFile) != 0 ;
339+ ClockEnabled = GetPrivateProfileInt (gConfigurationSection , " ClkEnable" , 1 , IniFile) != 0 ;
340+ ClockReadOnly = GetPrivateProfileInt (gConfigurationSection , " ClkRdOnly" , 1 , IniFile) != 0 ;
344341
345342 // Create config menu
346343 BuildCartridgeMenu ();
@@ -350,19 +347,16 @@ void LoadConfig()
350347// Save config saves the hard disk path and vhd file names
351348void SaveConfig ()
352349{
353- char ModName[MAX_LOADSTRING]=" " ;
354- LoadString (gModuleInstance ,IDS_MODULE_NAME,ModName, MAX_LOADSTRING);
355-
356350 ValidatePath (VHDfile0);
357351 ValidatePath (VHDfile1);
358352 if (strcmp (HardDiskPath, " " ) != 0 ) {
359353 WritePrivateProfileString
360354 (" DefaultPaths" , " HardDiskPath" , HardDiskPath, IniFile);
361355 }
362- WritePrivateProfileString (ModName ," VHDImage" ,VHDfile0 ,IniFile);
363- WritePrivateProfileString (ModName ," VHDImage1" ,VHDfile1 ,IniFile);
364- WritePrivateProfileInt (ModName , " ClkEnable" , ClockEnabled, IniFile);
365- WritePrivateProfileInt (ModName , " ClkRdOnly" , ClockReadOnly, IniFile);
356+ WritePrivateProfileString (gConfigurationSection ," VHDImage" ,VHDfile0 ,IniFile);
357+ WritePrivateProfileString (gConfigurationSection ," VHDImage1" ,VHDfile1 ,IniFile);
358+ WritePrivateProfileInt (gConfigurationSection , " ClkEnable" , ClockEnabled, IniFile);
359+ WritePrivateProfileInt (gConfigurationSection , " ClkRdOnly" , ClockReadOnly, IniFile);
366360 return ;
367361}
368362
0 commit comments