Make sure Marinetti is available before using NetDisk.

Also, add NetDiskError values used by the disk browser.
This commit is contained in:
Stephen Heumann 2019-07-15 16:44:57 -05:00
parent c4a1733c25
commit ea0f70fc94
5 changed files with 26 additions and 1 deletions

5
cdev.c
View File

@ -46,6 +46,7 @@
#define netDiskMissingError 3000
#define mountURLError 3001
#define unsupportedProtocolAlert 3002
#define marinettiMissingError 3003
#define yesBtn 1 /* number of "Yes" button in alert */
extern void FreeAllCDevMem(void);
@ -169,6 +170,10 @@ long DoMachine(void)
InitCursor();
AlertWindow(awResource+awButtonLayout, NULL, netDiskMissingError);
return 0;
} else if (mountURLRec.result == MARINETTI_NOT_PRESENT) {
InitCursor();
AlertWindow(awResource+awButtonLayout, NULL, marinettiMissingError);
return 0;
}
return 1;

View File

@ -287,6 +287,7 @@ resource rTextForLETextBox2 (helpWindow+helpTxt) {
#define netDiskMissingError 3000
#define mountURLError 3001
#define unsupportedProtocolAlert 3002
#define marinettiMissingError 3003
resource rAlertString (netDiskMissingError) {
"62/"
@ -295,6 +296,12 @@ resource rAlertString (netDiskMissingError) {
"/^#0\$00"
};
resource rAlertString (marinettiMissingError) {
"62/"
"Marinetti is not available. You must install Marinetti to use NetDisk."
"/^#0\$00"
};
resource rAlertString (mountURLError) {
"32:"
"MountURL error *0."

View File

@ -13,6 +13,9 @@ char *ErrorString(enum NetDiskError err) {
return "No more disks can be mounted via NetDisk.";
case OUT_OF_MEMORY:
return "Out of memory.";
case MARINETTI_NOT_PRESENT:
return "Marinetti is not available. You must install Marinetti to use "
"NetDisk.";
/* SetURL errors */
case URL_TOO_LONG:

View File

@ -8,6 +8,7 @@ enum NetDiskError {
DISK_ALREADY_MOUNTED,
NO_DIBS_AVAILABLE,
OUT_OF_MEMORY,
MARINETTI_NOT_PRESENT,
/* SetURL errors */
URL_TOO_LONG = 200,
@ -39,8 +40,12 @@ enum NetDiskError {
/* File format errors */
UNSUPPORTED_2IMG_FILE = 600,
NOT_MULTIPLE_OF_BLOCK_SIZE,
NOT_SPECIFIED_IMAGE_TYPE
NOT_SPECIFIED_IMAGE_TYPE,
UNSUPPORTED_IMAGE_TYPE,
/* Errors related to processing JSON result in the disk browser */
JSON_PARSING_ERROR = 900,
NOT_EXPECTED_CONTENTS,
};

View File

@ -182,6 +182,11 @@ static void notificationProc(void) {
#pragma databank 0
static void doMountURL(struct MountURLRec *mountURLRec) {
if (!TCPIPStatus() || toolerror()) {
mountURLRec->result = MARINETTI_NOT_PRESENT;
return;
}
DAccessRecGS controlRec = {5};
controlRec.code = MountURL;
controlRec.list = (pointer)mountURLRec;