Bug fixes; added YouTube image.

This commit is contained in:
Marcio T 2021-12-07 20:24:17 -07:00
parent afb8d6fe8f
commit 49ce1bc093
7 changed files with 60 additions and 12 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

BIN
images/youtube.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 KiB

View File

@ -14,7 +14,8 @@ void mac_list_volumes() {
for (;;) { for (;;) {
OSErr err = PBHGetVInfo(&paramBlock, false); OSErr err = PBHGetVInfo(&paramBlock, false);
if (err == nsvErr) break; 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++; paramBlock.volumeParam.ioVolIndex++;
} }
} }
@ -23,7 +24,7 @@ OSErr mac_get_drive_volumes(int driveNum, Str255 str) {
HParamBlockRec paramBlock; HParamBlockRec paramBlock;
Str255 volName; Str255 volName;
Boolean first = true; Boolean first = true;
str[0] = '\0';
paramBlock.volumeParam.ioCompletion = 0; paramBlock.volumeParam.ioCompletion = 0;
paramBlock.volumeParam.ioNamePtr = volName; paramBlock.volumeParam.ioNamePtr = volName;
paramBlock.volumeParam.ioVRefNum = 0; 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(&paramBlock);
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) { void mac_unmount(int id) {
HParamBlockRec paramBlock; HParamBlockRec paramBlock;
paramBlock.volumeParam.ioCompletion = 0; paramBlock.volumeParam.ioCompletion = 0;

View File

@ -3,3 +3,6 @@ void mac_unmount(int id);
void mac_eject(int id); void mac_eject(int id);
OSErr mac_get_drive_volumes(int driveNum, Str255 str); OSErr mac_get_drive_volumes(int driveNum, Str255 str);
OSErr mac_unmount_drive(int driveNum); OSErr mac_unmount_drive(int driveNum);
OSErr mac_mount_drive(int driveNum);
OSErr mac_mount_drives();
OSErr mac_list_drives();

View File

@ -38,8 +38,10 @@ bool process_command() {
printf("\n"); printf("\n");
char *arg_str = strchr(cmd, ' '); char *arg_str = strchr(cmd, ' ');
while(*arg_str == ' ') arg_str++; if(arg_str) {
if(arg_str) arg_val = atoi(arg_str); while(*arg_str == ' ') arg_str++;
arg_val = atoi(arg_str);
}
switch( tolower(cmd[0]) ) { switch( tolower(cmd[0]) ) {
case 'h': print_help(); break; case 'h': print_help(); break;
@ -51,6 +53,8 @@ bool process_command() {
case 'v': mac_list_volumes(); break; case 'v': mac_list_volumes(); break;
case 'u': mac_unmount(arg_val); break; case 'u': mac_unmount(arg_val); break;
case 'q': return false; 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"); default: printf("Unknown command, type 'h' for help\n");
} }
return true; return true;
@ -62,10 +66,15 @@ void print_help() {
" help : print this help\n" " help : print this help\n"
" quit : exit the command line\n" " quit : exit the command line\n"
"\nMacintosh commands:\n" "\nMacintosh volume commands:\n"
" volumes : list Mac volumes\n" " volumes : list Mac volumes\n"
" unmount [n] : unmount a volume\n"
" eject [n] : eject 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" "\nGeneral SCSI operations:\n"
" reset : reset the SCSI bus\n" " reset : reset the SCSI bus\n"
@ -84,9 +93,9 @@ void scan_bus() {
for( id=0; id<8; id++ ) { for( id=0; id<8; id++ ) {
err = scsi_inquiry( id, 0, &reply); err = scsi_inquiry( id, 0, &reply);
if( err != 0 ) { if( err != 0 ) {
printf( " %hd: (Not installed)\n", id ); printf( "%4hd: (Not installed)\n", id );
} else { } else {
printf( " %hd: ", id ); printf( "%4hd: ", id );
printn( reply.vend, 8 ); printn( reply.vend, 8 );
printf( ", " ); printf( ", " );
printn( reply.prod, 16 ); printn( reply.prod, 16 );

View File

@ -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+32);
LineTo(LOGO_1_LEFT+0, LOGO_1_TOP+35); LineTo(LOGO_1_LEFT+0, LOGO_1_TOP+35);
// show the current logo bitmap
SplashTheBitmap();
// paint the 3D program title // paint the 3D program title
Paint3DHeadline(szIntroTitle, BODY_LEFT, TITLE_TOP); 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)); SetRect(&rect, WH_RECT(BODY_LEFT, BODY_TOP+64, BODY_WIDTH, 115));
TETextBox(szIntroText, strlen(szIntroText), &rect, teFlushDefault); TETextBox(szIntroText, strlen(szIntroText), &rect, teFlushDefault);
// show the current logo bitmap
SplashTheBitmap();
ReleaseDC(hIntroWnd); ReleaseDC(hIntroWnd);
} }
@ -177,6 +177,7 @@ void WndProc(long iMessage, uint16_t wParam) {
EjectIomegaCartridge(CurrentDevice); EjectIomegaCartridge(CurrentDevice);
break; break;
case DISK_LOW_SPARES: case DISK_LOW_SPARES:
CartridgeStatus = DISK_AT_SPEED;
SetRichEditText(szNotRunning); SetRichEditText(szNotRunning);
SetWindowText(hTestButton, szPressToStart); SetWindowText(hTestButton, szPressToStart);
PrepareToBeginTesting(); PrepareToBeginTesting();

View File

@ -83,9 +83,11 @@ void run_tip() {
} }
} while (!gDone); } while (!gDone);
EjectAllMedia();
DisposeTipWindow(); DisposeTipWindow();
DisposeRgn(cursorRgn); DisposeRgn(cursorRgn);
// Remount any drives we may have unmounted
mac_mount_drives();
} }
void NewTipWindow() { void NewTipWindow() {