// pszFilename is not qualified with path BOOL HD_InsertDisk2(int nDrive, LPCTSTR pszFilename) { if (*pszFilename == 0x00) return false; char szFullFilename[MAX_PATH]; RegLoadString(TEXT("Preferences"),TEXT("HDV Starting Directory"), 1, szFullFilename, MAX_PATH); strcat(szFullFilename, pszFilename); return HD_InsertDisk(nDrive, szFullFilename); }
void HD_Select(int nDrive) { TCHAR directory[MAX_PATH] = TEXT(""); TCHAR filename[MAX_PATH] = TEXT(""); TCHAR title[40]; RegLoadString(TEXT("Preferences"),TEXT("HDV Starting Directory"),1,directory,MAX_PATH); _tcscpy(title,TEXT("Select HDV Image For HDD ")); _tcscat(title,nDrive ? TEXT("2") : TEXT("1")); OPENFILENAME ofn; ZeroMemory(&ofn,sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = g_hFrameWindow; ofn.hInstance = g_hInstance; ofn.lpstrFilter = TEXT("Hard Disk Images (*.hdv,*.po)\0*.hdv;*.po\0") TEXT("All Files\0*.*\0"); ofn.lpstrFile = filename; ofn.nMaxFile = MAX_PATH; ofn.lpstrInitialDir = directory; ofn.Flags = OFN_CREATEPROMPT | OFN_HIDEREADONLY; ofn.lpstrTitle = title; ofn.lpTemplateName = TEXT("INSERT_DIALOG"); if (GetOpenFileName(&ofn)) { if ((!ofn.nFileExtension) || !filename[ofn.nFileExtension]) _tcscat(filename,TEXT(".hdv")); if (HD_InsertDisk(nDrive, filename)) { filename[ofn.nFileOffset] = 0; if (_tcsicmp(directory,filename)) RegSaveString(TEXT("Preferences"),TEXT("HDV Starting Directory"),1,filename); } else { NotifyInvalidImage(filename); } } }
void HD_Select(const int iDrive) { TCHAR directory[MAX_PATH] = TEXT(""); TCHAR filename[MAX_PATH] = TEXT(""); TCHAR title[40]; RegLoadString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_HDV_START_DIR), 1, directory, MAX_PATH); _tcscpy(title, TEXT("Select HDV Image For HDD ")); _tcscat(title, iDrive ? TEXT("2") : TEXT("1")); OPENFILENAME ofn; ZeroMemory(&ofn,sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = g_hFrameWindow; ofn.hInstance = g_hInstance; ofn.lpstrFilter = TEXT("Hard Disk Images (*.hdv,*.po,*.2mg,*.2img,*.gz,*.zip)\0*.hdv;*.po;*.2mg;*.2img;*.gz;*.zip\0") TEXT("All Files\0*.*\0"); ofn.lpstrFile = filename; ofn.nMaxFile = MAX_PATH; ofn.lpstrInitialDir = directory; ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; // Don't allow creation & hide the read-only checkbox ofn.lpstrTitle = title; if (GetOpenFileName(&ofn)) { if ((!ofn.nFileExtension) || !filename[ofn.nFileExtension]) _tcscat(filename,TEXT(".hdv")); if (HD_InsertDisk(iDrive, filename)) { filename[ofn.nFileOffset] = 0; if (_tcsicmp(directory, filename)) RegSaveString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_HDV_START_DIR), 1, filename); } else { NotifyInvalidImage(filename); } } }
//Reads configuration from the registry entries void LoadConfiguration(void) { DWORD dwComputerType; if (REGLOAD(TEXT(REGVALUE_APPLE2_TYPE), &dwComputerType)) { if ((dwComputerType >= A2TYPE_MAX) || (dwComputerType >= A2TYPE_UNDEFINED && dwComputerType < A2TYPE_CLONE)) dwComputerType = A2TYPE_APPLE2EENHANCED; g_Apple2Type = (eApple2Type) dwComputerType; } else // Support older AppleWin registry entries { REGLOAD(TEXT(REGVALUE_OLD_APPLE2_TYPE), &dwComputerType); switch (dwComputerType) { // NB. No A2TYPE_APPLE2E (this is correct) case 0: g_Apple2Type = A2TYPE_APPLE2; case 1: g_Apple2Type = A2TYPE_APPLE2PLUS; case 2: g_Apple2Type = A2TYPE_APPLE2EENHANCED; default: g_Apple2Type = A2TYPE_APPLE2EENHANCED; } } switch (g_Apple2Type) //Sets the character set for the Apple model/clone { case A2TYPE_APPLE2: g_nCharsetType = 0; break; case A2TYPE_APPLE2PLUS: g_nCharsetType = 0; break; case A2TYPE_APPLE2E: g_nCharsetType = 0; break; case A2TYPE_APPLE2EENHANCED:g_nCharsetType = 0; break; case A2TYPE_PRAVETS82: g_nCharsetType = 1; break; case A2TYPE_PRAVETS8A: g_nCharsetType = 2; break; case A2TYPE_PRAVETS8M: g_nCharsetType = 3; break; //This charset has a very small difference with the PRAVETS82 one an probably has some misplaced characters. Still the Pravets82 charset is used, because setting charset to 3 results in some problems. } // if (!REGLOAD(TEXT(REGVALUE_JOYSTICK0_EMU_TYPE), &joytype[JN_JOYSTICK0])) LoadConfigOldJoystick(JN_JOYSTICK0); if (!REGLOAD(TEXT(REGVALUE_JOYSTICK1_EMU_TYPE), &joytype[JN_JOYSTICK1])) LoadConfigOldJoystick(JN_JOYSTICK1); REGLOAD(TEXT("Sound Emulation") ,&soundtype); char aySerialPortName[ CSuperSerialCard::SIZEOF_SERIALCHOICE_ITEM ]; if (RegLoadString( TEXT("Configuration"), TEXT(REGVALUE_SERIAL_PORT_NAME), TRUE, aySerialPortName, sizeof(aySerialPortName) ) ) { sg_SSC.SetSerialPortName(aySerialPortName); } REGLOAD(TEXT(REGVALUE_EMULATION_SPEED) ,&g_dwSpeed); REGLOAD(TEXT(REGVALUE_ENHANCE_DISK_SPEED),(DWORD *)&enhancedisk); Config_Load_Video(); REGLOAD(TEXT("Uthernet Active") ,(DWORD *)&tfe_enabled); SetCurrentCLK6502(); // DWORD dwTmp; if(REGLOAD(TEXT(REGVALUE_THE_FREEZES_F8_ROM), &dwTmp)) sg_PropertySheet.SetTheFreezesF8Rom(dwTmp); if(REGLOAD(TEXT(REGVALUE_SPKR_VOLUME), &dwTmp)) SpkrSetVolume(dwTmp, sg_PropertySheet.GetVolumeMax()); if(REGLOAD(TEXT(REGVALUE_MB_VOLUME), &dwTmp)) MB_SetVolume(dwTmp, sg_PropertySheet.GetVolumeMax()); if(REGLOAD(TEXT(REGVALUE_SAVE_STATE_ON_EXIT), &dwTmp)) g_bSaveStateOnExit = dwTmp ? true : false; if(REGLOAD(TEXT(REGVALUE_DUMP_TO_PRINTER), &dwTmp)) g_bDumpToPrinter = dwTmp ? true : false; if(REGLOAD(TEXT(REGVALUE_CONVERT_ENCODING), &dwTmp)) g_bConvertEncoding = dwTmp ? true : false; if(REGLOAD(TEXT(REGVALUE_FILTER_UNPRINTABLE), &dwTmp)) g_bFilterUnprintable = dwTmp ? true : false; if(REGLOAD(TEXT(REGVALUE_PRINTER_APPEND), &dwTmp)) g_bPrinterAppend = dwTmp ? true : false; if(REGLOAD(TEXT(REGVALUE_HDD_ENABLED), &dwTmp)) HD_SetEnabled(dwTmp ? true : false); char szHDVPathname[MAX_PATH] = {0}; if(RegLoadString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_LAST_HARDDISK_1), 1, szHDVPathname, sizeof(szHDVPathname))) HD_InsertDisk(HARDDISK_1, szHDVPathname); if(RegLoadString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_LAST_HARDDISK_2), 1, szHDVPathname, sizeof(szHDVPathname))) HD_InsertDisk(HARDDISK_2, szHDVPathname); if(REGLOAD(TEXT(REGVALUE_PDL_XTRIM), &dwTmp)) JoySetTrim((short)dwTmp, true); if(REGLOAD(TEXT(REGVALUE_PDL_YTRIM), &dwTmp)) JoySetTrim((short)dwTmp, false); if(REGLOAD(TEXT(REGVALUE_SCROLLLOCK_TOGGLE), &dwTmp)) sg_PropertySheet.SetScrollLockToggle(dwTmp); if(REGLOAD(TEXT(REGVALUE_CURSOR_CONTROL), &dwTmp)) sg_PropertySheet.SetJoystickCursorControl(dwTmp); if(REGLOAD(TEXT(REGVALUE_AUTOFIRE), &dwTmp)) sg_PropertySheet.SetAutofire(dwTmp); if(REGLOAD(TEXT(REGVALUE_CENTERING_CONTROL), &dwTmp)) sg_PropertySheet.SetJoystickCenteringControl(dwTmp); if(REGLOAD(TEXT(REGVALUE_MOUSE_CROSSHAIR), &dwTmp)) sg_PropertySheet.SetMouseShowCrosshair(dwTmp); if(REGLOAD(TEXT(REGVALUE_MOUSE_RESTRICT_TO_WINDOW), &dwTmp)) sg_PropertySheet.SetMouseRestrictToWindow(dwTmp); if(REGLOAD(TEXT(REGVALUE_SLOT4), &dwTmp)) g_Slot4 = (SS_CARDTYPE) dwTmp; if(REGLOAD(TEXT(REGVALUE_SLOT5), &dwTmp)) g_Slot5 = (SS_CARDTYPE) dwTmp; if (g_Slot4 == CT_MockingboardC || g_Slot4 == CT_Phasor) MB_SetSoundcardType(g_Slot4); else MB_SetSoundcardType(CT_Empty); // char szFilename[MAX_PATH] = {0}; // Current/Starting Dir is the "root" of where the user keeps his disk images RegLoadString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_START_DIR), 1, szFilename, MAX_PATH); if (szFilename[0] == 0) GetCurrentDirectory(sizeof(szFilename), szFilename); SetCurrentImageDir(szFilename); Disk_LoadLastDiskImage(DRIVE_1); Disk_LoadLastDiskImage(DRIVE_2); // szFilename[0] = 0; RegLoadString(TEXT(REG_CONFIG),TEXT(REGVALUE_SAVESTATE_FILENAME),1,szFilename,sizeof(szFilename)); Snapshot_SetFilename(szFilename); // If not in Registry than default will be used (ie. g_sCurrentDir + default filename) szFilename[0] = 0; RegLoadString(TEXT(REG_CONFIG),TEXT(REGVALUE_PRINTER_FILENAME),1,szFilename,sizeof(szFilename)); Printer_SetFilename(szFilename); // If not in Registry than default will be used dwTmp = 10; REGLOAD(TEXT(REGVALUE_PRINTER_IDLE_LIMIT), &dwTmp); Printer_SetIdleLimit(dwTmp); char szUthernetInt[MAX_PATH] = {0}; RegLoadString(TEXT(REG_CONFIG),TEXT("Uthernet Interface"),1,szUthernetInt,MAX_PATH); update_tfe_interface(szUthernetInt,NULL); if (REGLOAD(TEXT(REGVALUE_WINDOW_SCALE), &dwTmp)) SetViewportScale(dwTmp); if (REGLOAD(TEXT(REGVALUE_CONFIRM_REBOOT), &dwTmp)) g_bConfirmReboot = dwTmp; }