//=========================================================================== void KeybToggleP8ACapsLock () { _ASSERT(g_Apple2Type == A2TYPE_PRAVETS8A); P8CAPS_ON = !P8CAPS_ON; FrameRefreshStatus(DRAW_LEDS); // g_bP8CapsLock= g_bP8CapsLock?false:true; //The same as the upper, but slower }
//=========================================================================== void CheckSpinning () { DWORD modechange = (floppymotoron && !g_aFloppyDisk[currdrive].spinning); if (floppymotoron) g_aFloppyDisk[currdrive].spinning = 20000; if (modechange) FrameRefreshStatus(DRAW_LEDS); }
//=========================================================================== void KeybToggleCapsLock () { if (!IS_APPLE2) { g_bCapsLock = (GetKeyState(VK_CAPITAL) & 1); FrameRefreshStatus(DRAW_LEDS); } }
//=========================================================================== void KeybToggleCapsLock () { if (apple2e) { capslock = (GetKeyState(VK_CAPITAL) & 1); FrameRefreshStatus(DRAW_LEDS); } }
//=========================================================================== BYTE __stdcall TapeCASIN(WORD programcounter, BYTE address, BYTE write, BYTE value) { TCh Ch; while (PosBuffer < TamBuffer) { if (TamDados) { char c = Buffer[PosBuffer++]; TamDados--; FrameRefreshStatus(DRAW_LEDS); return c; } else { memcpy(&Ch, (Buffer + PosBuffer++), 4); if (!strncmp((char *)&Ch.ID, CT2_DADOS, 2)) { PosBuffer += 3; TamDados = Ch.Tam; } } } FrameRefreshStatus(DRAW_LEDS); return MemReturnRandomData(1); }
//=========================================================================== void TapeBotao(int Botao) { switch(Botao) { case TB_REW: PosBuffer = 0; break; case TB_STOP: PosBuffer = TamBuffer; break; } FrameRefreshStatus(DRAW_LEDS); }
//=========================================================================== BYTE __stdcall TapeCASIN2(WORD programcounter, BYTE address, BYTE write, BYTE value) { TCh Ch; while (PosBuffer < TamBuffer) { memcpy(&Ch, (Buffer + PosBuffer++), 4); if (!strncmp((char *)Ch.ID, CT2_CAB_B, 2)) { TamDados = 0; PosBuffer += 3; return 1; } } FrameRefreshStatus(DRAW_LEDS); return 0; }
//=========================================================================== void TapeSelect() { char directory[MAX_PATH] = ""; char filename[MAX_PATH] = ""; char title[40]; OPENFILENAME ofn; RegLoadString(PREFERENCIAS, DIRINIC, 1, directory, MAX_PATH); strcpy(title,"Selecione a imagem do tape"); ZeroMemory(&ofn,sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = framewindow; ofn.hInstance = instance; ofn.lpstrFilter = "Imagens de Tape (*.ct2)\0*.ct2\0"; ofn.lpstrFile = filename; ofn.nMaxFile = MAX_PATH; ofn.lpstrInitialDir = directory; ofn.Flags = OFN_PATHMUSTEXIST; ofn.lpstrTitle = title; if (GetOpenFileName(&ofn)) { int error; if ((!ofn.nFileExtension) || !filename[ofn.nFileExtension]) strcat(filename,".ct2"); error = TapeInsere(filename, ofn.Flags & OFN_READONLY, 1); if (!error) { //strcpy(NomeTitulo, filename + ofn.nFileOffset); TapePegaTitulo(filename + ofn.nFileOffset); filename[ofn.nFileOffset] = 0; if (stricmp(directory, filename)) RegSaveString(PREFERENCIAS, DIRINIC, 1, filename); FrameRefreshStatus(DRAW_BACKGROUND | DRAW_LEDS); } else TapeNotifyInvalidImage(filename, error); } }
BOOL CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam) { switch (message) { case WM_NOTIFY: { // Property Sheet notifications switch (((LPPSHNOTIFY)lparam)->hdr.code) { case PSN_SETACTIVE: // About to become the active page m_PropertySheetHelper.SetLastPage(m_Page); InitOptions(hWnd); break; case PSN_KILLACTIVE: SetWindowLong(hWnd, DWL_MSGRESULT, FALSE); // Changes are valid break; case PSN_APPLY: DlgOK(hWnd); SetWindowLong(hWnd, DWL_MSGRESULT, PSNRET_NOERROR); // Changes are valid break; case PSN_QUERYCANCEL: // Can use this to ask user to confirm cancel break; case PSN_RESET: DlgCANCEL(hWnd); break; } } break; case WM_COMMAND: switch (LOWORD(wparam)) { case IDC_COMBO_DISK1: if (HIWORD(wparam) == CBN_SELCHANGE) { HandleDiskCombo(hWnd, DRIVE_1, LOWORD(wparam)); FrameRefreshStatus(DRAW_BUTTON_DRIVES); } break; case IDC_COMBO_DISK2: if (HIWORD(wparam) == CBN_SELCHANGE) { HandleDiskCombo(hWnd, DRIVE_2, LOWORD(wparam)); FrameRefreshStatus(DRAW_BUTTON_DRIVES); } break; case IDC_COMBO_HDD1: if (HIWORD(wparam) == CBN_SELCHANGE) { HandleHDDCombo(hWnd, HARDDISK_1, LOWORD(wparam)); } break; case IDC_COMBO_HDD2: if (HIWORD(wparam) == CBN_SELCHANGE) { HandleHDDCombo(hWnd, HARDDISK_2, LOWORD(wparam)); } break; case IDC_HDD_ENABLE: EnableHDD(hWnd, IsDlgButtonChecked(hWnd, IDC_HDD_ENABLE)); break; case IDC_HDD_SWAP: HandleHDDSwap(hWnd); break; case IDC_CIDERPRESS_BROWSE: { std::string CiderPressLoc = m_PropertySheetHelper.BrowseToFile(hWnd, TEXT("Select path to CiderPress"), REGVALUE_CIDERPRESSLOC, TEXT("Applications (*.exe)\0*.exe\0") TEXT("All Files\0*.*\0") ); RegSaveString(TEXT(REG_CONFIG), REGVALUE_CIDERPRESSLOC, 1, CiderPressLoc.c_str()); SendDlgItemMessage(hWnd, IDC_CIDERPRESS_FILENAME, WM_SETTEXT, 0, (LPARAM) CiderPressLoc.c_str()); } break; } break; case WM_INITDIALOG: { m_PropertySheetHelper.FillComboBox(hWnd, IDC_DISKTYPE, m_discchoices, sg_Disk2Card.GetEnhanceDisk() ? 1 : 0); m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK1, m_defaultDiskOptions, -1); m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK2, m_defaultDiskOptions, -1); if (strlen(sg_Disk2Card.GetFullName(DRIVE_1)) > 0) { SendDlgItemMessage(hWnd, IDC_COMBO_DISK1, CB_INSERTSTRING, 0, (LPARAM)sg_Disk2Card.GetFullName(DRIVE_1)); SendDlgItemMessage(hWnd, IDC_COMBO_DISK1, CB_SETCURSEL, 0, 0); } if (strlen(sg_Disk2Card.GetFullName(DRIVE_2)) > 0) { SendDlgItemMessage(hWnd, IDC_COMBO_DISK2, CB_INSERTSTRING, 0, (LPARAM)sg_Disk2Card.GetFullName(DRIVE_2)); SendDlgItemMessage(hWnd, IDC_COMBO_DISK2, CB_SETCURSEL, 0, 0); } InitComboHDD(hWnd); TCHAR PathToCiderPress[MAX_PATH] = ""; RegLoadString(TEXT(REG_CONFIG), REGVALUE_CIDERPRESSLOC, 1, PathToCiderPress,MAX_PATH); SendDlgItemMessage(hWnd, IDC_CIDERPRESS_FILENAME ,WM_SETTEXT, 0, (LPARAM)PathToCiderPress); CheckDlgButton(hWnd, IDC_HDD_ENABLE, HD_CardIsEnabled() ? BST_CHECKED : BST_UNCHECKED); EnableHDD(hWnd, IsDlgButtonChecked(hWnd, IDC_HDD_ENABLE)); InitOptions(hWnd); break; } } return FALSE; }
ImageError_e Disk2InterfaceCard::InsertDisk(const int drive, LPCTSTR pszImageFilename, const bool bForceWriteProtected, const bool bCreateIfNecessary) { FloppyDrive* pDrive = &m_floppyDrive[drive]; FloppyDisk* pFloppy = &pDrive->m_disk; if (pFloppy->m_imagehandle) RemoveDisk(drive); // Reset the disk's attributes, but preserve the drive's attributes (GH#138/Platoon, GH#640) // . Changing the disk (in the drive) doesn't affect the drive's attributes. pFloppy->clear(); const DWORD dwAttributes = GetFileAttributes(pszImageFilename); if(dwAttributes == INVALID_FILE_ATTRIBUTES) pFloppy->m_bWriteProtected = false; // Assume this is a new file to create else pFloppy->m_bWriteProtected = bForceWriteProtected ? true : (dwAttributes & FILE_ATTRIBUTE_READONLY); // Check if image is being used by the other drive, and if so remove it in order so it can be swapped { const char* pszOtherPathname = DiskGetFullPathName(!drive); char szCurrentPathname[MAX_PATH]; DWORD uNameLen = GetFullPathName(pszImageFilename, MAX_PATH, szCurrentPathname, NULL); if (uNameLen == 0 || uNameLen >= MAX_PATH) strcpy_s(szCurrentPathname, MAX_PATH, pszImageFilename); if (!strcmp(pszOtherPathname, szCurrentPathname)) { EjectDisk(!drive); FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES); } } ImageError_e Error = ImageOpen(pszImageFilename, &pFloppy->m_imagehandle, &pFloppy->m_bWriteProtected, bCreateIfNecessary, pFloppy->m_strFilenameInZip); if (Error == eIMAGE_ERROR_NONE && ImageIsMultiFileZip(pFloppy->m_imagehandle)) { TCHAR szText[100+MAX_PATH]; szText[sizeof(szText)-1] = 0; _snprintf(szText, sizeof(szText)-1, "Only the first file in a multi-file zip is supported\nUse disk image '%s' ?", pFloppy->m_strFilenameInZip.c_str()); int nRes = MessageBox(g_hFrameWindow, szText, TEXT("Multi-Zip Warning"), MB_ICONWARNING | MB_YESNO | MB_SETFOREGROUND); if (nRes == IDNO) { RemoveDisk(drive); Error = eIMAGE_ERROR_REJECTED_MULTI_ZIP; } } if (Error == eIMAGE_ERROR_NONE) { GetImageTitle(pszImageFilename, pFloppy->m_imagename, pFloppy->m_fullname); Video_ResetScreenshotCounter(pFloppy->m_imagename); } else { Video_ResetScreenshotCounter(NULL); } SaveLastDiskImage(drive); return Error; }