diff --git a/images/mac-tip1.png b/images/mac-tip1.png deleted file mode 100644 index 32ae484..0000000 Binary files a/images/mac-tip1.png and /dev/null differ diff --git a/images/youtube.png b/images/youtube.png new file mode 100644 index 0000000..1a644fc Binary files /dev/null and b/images/youtube.png differ diff --git a/mac-cpp-source/macos/mac_vol.cpp b/mac-cpp-source/macos/mac_vol.cpp index 07231bb..0cc73f3 100644 --- a/mac-cpp-source/macos/mac_vol.cpp +++ b/mac-cpp-source/macos/mac_vol.cpp @@ -14,7 +14,8 @@ void mac_list_volumes() { for (;;) { OSErr err = PBHGetVInfo(¶mBlock, false); if (err == nsvErr) break; - printf(" %d: %#s\n", paramBlock.volumeParam.ioVolIndex, paramBlock.volumeParam.ioNamePtr); + size_t size = paramBlock.volumeParam.ioVAlBlkSiz * paramBlock.volumeParam.ioVNmAlBlks; + printf("%4d: [%7.2f MBs] %#s\n", paramBlock.volumeParam.ioVolIndex, float(size)/1024/1024, paramBlock.volumeParam.ioNamePtr); paramBlock.volumeParam.ioVolIndex++; } } @@ -23,7 +24,7 @@ OSErr mac_get_drive_volumes(int driveNum, Str255 str) { HParamBlockRec paramBlock; Str255 volName; Boolean first = true; - + str[0] = '\0'; paramBlock.volumeParam.ioCompletion = 0; paramBlock.volumeParam.ioNamePtr = volName; paramBlock.volumeParam.ioVRefNum = 0; @@ -65,6 +66,38 @@ OSErr mac_unmount_drive(int driveNum) { } } +OSErr mac_mount_drive(int driveNum) { + ParamBlockRec paramBlock; + + paramBlock.volumeParam.ioVRefNum = driveNum; + + OSErr err = PBMountVol(¶mBlock); + return err; +} + +OSErr mac_mount_drives() { + const QHdrPtr qh = GetDrvQHdr(); + for(DrvQElPtr qe = (DrvQElPtr) qh->qHead; qe; qe = (DrvQElPtr) qe->qLink) { + OSErr err = mac_mount_drive(qe->dQDrive); + switch(err) { + case volOnLinErr: continue; + default: printf("Error %d while mounting drive %d\n", err, qe->dQDrive); + } + } + return noErr; +} + +OSErr mac_list_drives() { + Str255 volumeNames; + const QHdrPtr qh = GetDrvQHdr(); + for(DrvQElPtr qe = (DrvQElPtr) qh->qHead; qe; qe = (DrvQElPtr) qe->qLink) { + size_t size = size_t(qe->dQDrvSz) | ((qe->qType == 1) ? size_t(qe->dQDrvSz2) << 16 : 0) ; + mac_get_drive_volumes(qe->dQDrive, volumeNames); + printf("%4d: [%7.2f MBs] %#s\n", qe->dQDrive, float(size)/2/1024, volumeNames); + } + return noErr; +} + void mac_unmount(int id) { HParamBlockRec paramBlock; paramBlock.volumeParam.ioCompletion = 0; diff --git a/mac-cpp-source/macos/mac_vol.h b/mac-cpp-source/macos/mac_vol.h index 95b5436..e2e8db0 100644 --- a/mac-cpp-source/macos/mac_vol.h +++ b/mac-cpp-source/macos/mac_vol.h @@ -3,3 +3,6 @@ void mac_unmount(int id); void mac_eject(int id); OSErr mac_get_drive_volumes(int driveNum, Str255 str); OSErr mac_unmount_drive(int driveNum); +OSErr mac_mount_drive(int driveNum); +OSErr mac_mount_drives(); +OSErr mac_list_drives(); \ No newline at end of file diff --git a/mac-cpp-source/scsi/command_line.cpp b/mac-cpp-source/scsi/command_line.cpp index bf5bf33..f52fbd6 100644 --- a/mac-cpp-source/scsi/command_line.cpp +++ b/mac-cpp-source/scsi/command_line.cpp @@ -38,8 +38,10 @@ bool process_command() { printf("\n"); char *arg_str = strchr(cmd, ' '); - while(*arg_str == ' ') arg_str++; - if(arg_str) arg_val = atoi(arg_str); + if(arg_str) { + while(*arg_str == ' ') arg_str++; + arg_val = atoi(arg_str); + } switch( tolower(cmd[0]) ) { case 'h': print_help(); break; @@ -51,6 +53,8 @@ bool process_command() { case 'v': mac_list_volumes(); break; case 'u': mac_unmount(arg_val); break; case 'q': return false; + case 'd': mac_list_drives(); break; + case 'm': if(arg_str) mac_mount_drive(arg_val); else mac_mount_drives(); break; default: printf("Unknown command, type 'h' for help\n"); } return true; @@ -62,10 +66,15 @@ void print_help() { " help : print this help\n" " quit : exit the command line\n" - "\nMacintosh commands:\n" + "\nMacintosh volume commands:\n" " volumes : list Mac volumes\n" - " unmount [n] : unmount a volume\n" " eject [n] : eject a volume\n" + " unmount [n] : unmount a volume\n" + + "\nMacintosh drive commands:\n" + " drives : list all drives\n" + " mount [n] : mount a drive\n" + " mount : mount all drives\n" "\nGeneral SCSI operations:\n" " reset : reset the SCSI bus\n" @@ -84,9 +93,9 @@ void scan_bus() { for( id=0; id<8; id++ ) { err = scsi_inquiry( id, 0, &reply); if( err != 0 ) { - printf( " %hd: (Not installed)\n", id ); + printf( "%4hd: (Not installed)\n", id ); } else { - printf( " %hd: ", id ); + printf( "%4hd: ", id ); printn( reply.vend, 8 ); printf( ", " ); printn( reply.prod, 16 ); diff --git a/mac-cpp-source/tip/tip.cpp b/mac-cpp-source/tip/tip.cpp index 1cfe406..069f054 100644 --- a/mac-cpp-source/tip/tip.cpp +++ b/mac-cpp-source/tip/tip.cpp @@ -118,9 +118,6 @@ void WndProc(long iMessage, uint16_t wParam) { LineTo(LOGO_1_LEFT+0, LOGO_1_TOP+32); LineTo(LOGO_1_LEFT+0, LOGO_1_TOP+35); - // show the current logo bitmap - SplashTheBitmap(); - // paint the 3D program title Paint3DHeadline(szIntroTitle, BODY_LEFT, TITLE_TOP); @@ -135,6 +132,9 @@ void WndProc(long iMessage, uint16_t wParam) { SetRect(&rect, WH_RECT(BODY_LEFT, BODY_TOP+64, BODY_WIDTH, 115)); TETextBox(szIntroText, strlen(szIntroText), &rect, teFlushDefault); + // show the current logo bitmap + SplashTheBitmap(); + ReleaseDC(hIntroWnd); } @@ -177,6 +177,7 @@ void WndProc(long iMessage, uint16_t wParam) { EjectIomegaCartridge(CurrentDevice); break; case DISK_LOW_SPARES: + CartridgeStatus = DISK_AT_SPEED; SetRichEditText(szNotRunning); SetWindowText(hTestButton, szPressToStart); PrepareToBeginTesting(); diff --git a/mac-cpp-source/tip/tip_main.cpp b/mac-cpp-source/tip/tip_main.cpp index 599781e..9eea046 100644 --- a/mac-cpp-source/tip/tip_main.cpp +++ b/mac-cpp-source/tip/tip_main.cpp @@ -83,9 +83,11 @@ void run_tip() { } } while (!gDone); - EjectAllMedia(); DisposeTipWindow(); DisposeRgn(cursorRgn); + + // Remount any drives we may have unmounted + mac_mount_drives(); } void NewTipWindow() {