Additional fixes.

This commit is contained in:
Marcio T 2021-11-26 17:26:56 -07:00
parent c3fff87822
commit de7879f4bf
5 changed files with 18 additions and 8 deletions

View File

@ -10,6 +10,7 @@
#include "iomega_cmds.h" #include "iomega_cmds.h"
bool process_command(); bool process_command();
void confirm_run_tip(int id);
void printn( unsigned char *c, int n ); void printn( unsigned char *c, int n );
void print_help(); void print_help();
void scan_bus(); void scan_bus();
@ -24,7 +25,7 @@ void main() {
printf( "This Mac port (c) 2021 Marcio Teixeira http://github.com/marciot/mac-tip\n" ); printf( "This Mac port (c) 2021 Marcio Teixeira http://github.com/marciot/mac-tip\n" );
printf( "Based on code (c) 2006 Gibson Research Corp http://grc.com/tip/clickdeath.htm\n" ); printf( "Based on code (c) 2006 Gibson Research Corp http://grc.com/tip/clickdeath.htm\n" );
SIOUXSetTitle("\pIomega Tester (Beta) V0.1"); SIOUXSetTitle("\pIomega Tester Beta (" __DATE__ ")");
print_help(); print_help();
@ -58,7 +59,7 @@ bool process_command() {
case 'i': dev_info(arg_val); break; case 'i': dev_info(arg_val); break;
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 't': run_tip(arg_val); break; case 't': confirm_run_tip(arg_val); break;
case 'q': return false; case 'q': return false;
case 'o': SetRichEditText(arg_str); break; case 'o': SetRichEditText(arg_str); break;
default: printf("Unknown command, type 'h' for help\n"); default: printf("Unknown command, type 'h' for help\n");
@ -66,6 +67,15 @@ bool process_command() {
return true; return true;
} }
void confirm_run_tip(int id) {
char cmd[80];
printf("\nThis program is in BETA TESTING and may cause severe data loss!\n\nProceed [Y/N]? ");
gets( cmd );
if(tolower(cmd[0]) == 'y') {
run_tip(id);
}
}
void print_help() { void print_help() {
printf( printf(
"\nGeneral commands:\n" "\nGeneral commands:\n"

Binary file not shown.

View File

@ -53,7 +53,7 @@ OSErr scsi_cmd(int id, void *cmd, size_t clen, void *buff, size_t siz, size_t cn
/* Send the command to the SCSI device and perform the requested I/O */ /* Send the command to the SCSI device and perform the requested I/O */
err = SCSICmd( (Ptr) cmd, clen ); err = SCSICmd( (Ptr) cmd, clen );
if (err == noErr) { if (err == noErr) {
OSErr io_err; OSErr io_err = noErr;
switch(flags) { switch(flags) {
case SCSI_WRITE | SCSI_BLIND: io_err = SCSIWBlind( (Ptr) TIB ); break; case SCSI_WRITE | SCSI_BLIND: io_err = SCSIWBlind( (Ptr) TIB ); break;
case SCSI_READ | SCSI_BLIND: io_err = SCSIRBlind( (Ptr) TIB ); break; case SCSI_READ | SCSI_BLIND: io_err = SCSIRBlind( (Ptr) TIB ); break;

View File

@ -526,7 +526,7 @@ void SetCartridgeStatusToEAX(long eax) {
esi = szPressToStop; esi = szPressToStop;
break; break;
case DISK_NOT_PRESENT: case DISK_NOT_PRESENT:
SetRichEditText(szNotRunning); //SetRichEditText(szNotRunning);
goto DisableActions; goto DisableActions;
case DISK_AT_SPEED: case DISK_AT_SPEED:
eax = GetSpareSectorCounts(true); // update the Cart Condition eax = GetSpareSectorCounts(true); // update the Cart Condition
@ -683,8 +683,6 @@ long PerformRegionTransfer(short XferCmd, void *pBuffer) {
long eax = SCSICommand(CurrentDevice, Scsi, pBuffer, NumberOfLBAs * BYTES_PER_SECTOR); long eax = SCSICommand(CurrentDevice, Scsi, pBuffer, NumberOfLBAs * BYTES_PER_SECTOR);
// if we failed somewhere during our transfer ... let's zero in on it // if we failed somewhere during our transfer ... let's zero in on it
if (eax) { if (eax) {
printf("Error during transfer %lx (lba: %ld)\n", eax, FirstLBASector);
if ( eax == SS_ERR || // if it's a CONTROLLER ERROR, skip! if ( eax == SS_ERR || // if it's a CONTROLLER ERROR, skip!
eax == BUFFER_TOO_BIG || eax == BUFFER_TOO_BIG ||
eax == LBA_TOO_LARGE) { eax == LBA_TOO_LARGE) {
@ -797,7 +795,7 @@ void TestTheDisk() {
StopApplicationTimer(); StopApplicationTimer();
PreventProgramExit(); PreventProgramExit();
SetRichEditText(szRunning); //SetRichEditText(szRunning);
CartridgeStatus = DISK_TEST_UNDERWAY; CartridgeStatus = DISK_TEST_UNDERWAY;
TestingPhase = TESTING_STARTUP; // inhibit stopping now TestingPhase = TESTING_STARTUP; // inhibit stopping now
SetWindowText(hTestButton, szPressToStop); SetWindowText(hTestButton, szPressToStop);
@ -854,7 +852,7 @@ void TestTheDisk() {
// ------------------------------- // -------------------------------
TestingPhase = WRITING_DATA; TestingPhase = WRITING_DATA;
UpdateRunPhaseDisplay(); UpdateRunPhaseDisplay();
PerformRegionTransfer(SCSI_Cmd_Verify, pUserDataBuffer); PerformRegionTransfer(SCSI_Cmd_WriteMany, pUserDataBuffer);
} }
else if (eax == LBA_TOO_LARGE) { else if (eax == LBA_TOO_LARGE) {
// if we hit the end of the disk ... exit gracefully! // if we hit the end of the disk ... exit gracefully!

View File

@ -201,6 +201,7 @@ void DoDiskEvent(EventRecord &event) {
mac_get_drive_volumes(driveNum, volumes); mac_get_drive_volumes(driveNum, volumes);
// Ask the user whether they want to unmount the disk // Ask the user whether they want to unmount the disk
ParamText(volumes, "\p", "\p", "\p");
if (CautionAlert(128, NULL) == 1) { if (CautionAlert(128, NULL) == 1) {
// The user wishes to unmount the disk // The user wishes to unmount the disk
OSErr err = mac_unmount_drive(driveNum); OSErr err = mac_unmount_drive(driveNum);
@ -253,6 +254,7 @@ int ShowAlert(AlertTypes type, const char* format, ...) {
void SetRichEditText(const char *name) { void SetRichEditText(const char *name) {
static const char *lastName = 0; static const char *lastName = 0;
if(name == lastName) return; if(name == lastName) return;
lastName = name;
if(ShowAlert(YN_DLG, "Would you like to read the document \"%s\" now?", name) == 2) { if(ShowAlert(YN_DLG, "Would you like to read the document \"%s\" now?", name) == 2) {
return; return;