ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/AmigaOS/prefs_editor_amiga.cpp
(Generate patch)

Comparing BasiliskII/src/AmigaOS/prefs_editor_amiga.cpp (file contents):
Revision 1.1 by cebix, 1999-10-03T14:16:25Z vs.
Revision 1.13 by cebix, 2000-10-16T17:37:58Z

# Line 27 | Line 27
27   #include <libraries/asl.h>
28   #include <libraries/gtlayout.h>
29   #include <libraries/Picasso96.h>
30 + #include <cybergraphics/cybergraphics.h>
31   #include <graphics/displayinfo.h>
32   #include <devices/ahi.h>
33   #include <proto/exec.h>
# Line 37 | Line 38
38   #include <proto/graphics.h>
39   #include <proto/asl.h>
40   #include <proto/Picasso96.h>
41 + #include <proto/cybergraphics.h>
42   #include <proto/ahi.h>
43  
44   #include "sysdeps.h"
# Line 65 | Line 67 | const int GAD_CDROM_DEVICE = 0x0304;
67   const int GAD_CDROM_UNIT = 0x0305;
68   const int GAD_BOOTDRIVER = 0x0306;
69   const int GAD_NOCDROM = 0x0307;
70 + const int GAD_EXTFS = 0x0308;
71  
72   const int GAD_VOLUME_READONLY = 0x0310;         // "Add/Edit Volume" window
73   const int GAD_VOLUME_TYPE = 0x0311;
# Line 139 | Line 142 | static void read_settings(struct LayoutH
142  
143  
144   /*
145 < *  Locale hook function - returns string for given ID
145 > *  Locale hook - returns string for given ID
146   */
147  
148 < static __saveds __asm char *locale_hook_func(register __a0 struct Hook *hook, register __a2 struct LayoutHandle *h, register __a1 LONG id)
148 > static __saveds __attribute__((regparm(3))) const char *locale_hook_func(struct Hook *hook /*a0*/, void *id /*a1*/, struct LayoutHandle *h /*a2*/)
149   {
150 <        return GetString(id);
150 >        return GetString((uint32)id);
151   }
152  
153   struct Hook locale_hook = {{NULL, NULL}, (HOOKFUNC)locale_hook_func, NULL, NULL};
# Line 162 | Line 165 | bool PrefsEditor(void)
165          struct Window *win = NULL;
166          struct Menu *menu = NULL;
167  
168 +        // Pane tabs
169 +        static const LONG labels[] = {
170 +                STR_VOLUMES_PANE_TITLE,
171 +                STR_SCSI_PANE_TITLE,
172 +                STR_GRAPHICS_SOUND_PANE_TITLE,
173 +                STR_SERIAL_NETWORK_PANE_TITLE,
174 +                STR_MEMORY_MISC_PANE_TITLE,
175 +                -1
176 +        };
177 +
178          // Open gtlayout.library
179          GTLayoutBase = (struct Library *)OpenLibrary((UBYTE *)"gtlayout.library", 39);
180          if (GTLayoutBase == NULL) {
181                  WarningAlert(GetString(STR_NO_GTLAYOUT_LIB_WARN));
182 <                goto quit;
182 >                return true;
183          }
184  
185          // Create layout handle
186          h = LT_CreateHandleTags(NULL,
187                  LAHN_AutoActivate, FALSE,
188 <                LAHN_LocaleHook, &locale_hook,
188 >                LAHN_LocaleHook, (ULONG)&locale_hook,
189                  TAG_END
190          );
191          if (h == NULL)
# Line 180 | Line 193 | bool PrefsEditor(void)
193  
194          // Create menus
195          menu = LT_NewMenuTags(
196 <                LAMN_LayoutHandle, h,
196 >                LAMN_LayoutHandle, (ULONG)h,
197                  LAMN_TitleID, STR_PREFS_MENU,
198                  LAMN_ItemID, STR_PREFS_ITEM_ABOUT,
199                  LAMN_UserData, MSG_ABOUT,
200 <                LAMN_ItemText, NM_BARLABEL,
200 >                LAMN_ItemText, (ULONG)NM_BARLABEL,
201                  LAMN_ItemID, STR_PREFS_ITEM_START,
202                  LAMN_UserData, MSG_OK,
203                  LAMN_ItemID, STR_PREFS_ITEM_ZAP_PRAM,
204                  LAMN_UserData, MSG_ZAP_PRAM,
205 <                LAMN_ItemText, NM_BARLABEL,
205 >                LAMN_ItemText, (ULONG)NM_BARLABEL,
206                  LAMN_ItemID, STR_PREFS_ITEM_QUIT,
207                  LAMN_UserData, MSG_CANCEL,
208 <                LAMN_KeyText, "Q",
208 >                LAMN_KeyText, (ULONG)"Q",
209                  TAG_END
210          );
211  
212          // Create window contents
213          VGROUP;
201                // Pane tabs
202                static const LONG labels[] = {
203                        STR_VOLUMES_PANE_TITLE,
204                        STR_SCSI_PANE_TITLE,
205                        STR_GRAPHICS_SOUND_PANE_TITLE,
206                        STR_SERIAL_NETWORK_PANE_TITLE,
207                        STR_MEMORY_MISC_PANE_TITLE,
208                        -1
209                };
214                  VGROUP;
215                          LT_New(h, LA_Type, TAB_KIND,
216 <                                LATB_LabelTable, labels,
216 >                                LATB_LabelTable, (ULONG)labels,
217                                  LATB_AutoPageID, GAD_PAGEGROUP,
218                                  LATB_FullWidth, TRUE,
219                                  TAG_END
# Line 261 | Line 265 | bool PrefsEditor(void)
265          // Open window
266          win = LT_Build(h,
267                  LAWN_TitleID, STR_PREFS_TITLE,
268 <                LAWN_Menu, menu,
268 >                LAWN_Menu, (ULONG)menu,
269                  LAWN_IDCMP, IDCMP_CLOSEWINDOW,
270                  LAWN_BelowMouse, TRUE,
271                  LAWN_SmartZoom, TRUE,
# Line 279 | Line 283 | bool PrefsEditor(void)
283          dev_request = (struct FileRequester *)AllocAslRequestTags(ASL_FileRequest,
284                  ASLFR_DoPatterns, TRUE,
285                  ASLFR_RejectIcons, TRUE,
286 <                ASLFR_InitialDrawer, "DEVS:",
287 <                ASLFR_InitialPattern, "#?.device",
286 >                ASLFR_InitialDrawer, (ULONG)"DEVS:",
287 >                ASLFR_InitialPattern, (ULONG)"#?.device",
288                  TAG_END
289          );
290          file_request = (struct FileRequester *)AllocAslRequestTags(ASL_FileRequest,
291                  ASLFR_DoPatterns, TRUE,
292                  ASLFR_RejectIcons, TRUE,
293 <                ASLFR_InitialPattern, "#?",
293 >                ASLFR_InitialPattern, (ULONG)"#?",
294                  TAG_END
295          );
296  
# Line 424 | Line 428 | bool PrefsEditor(void)
428                                                  case GAD_SCSI6_DEVICE:
429                                                  case GAD_SERIALA_DEVICE:
430                                                  case GAD_SERIALB_DEVICE:
431 +                                                        if (dev_request) {
432 +                                                                LT_LockWindow(win);
433 +                                                                BOOL result = AslRequestTags(dev_request,
434 +                                                                        ASLFR_Window, (ULONG)win,
435 +                                                                        ASLFR_InitialDrawer, (ULONG) "Devs:",
436 +                                                                        TAG_END);
437 +                                                                LT_UnlockWindow(win);
438 +                                                                if (result) {
439 +                                                                        char *str;
440 +                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, (ULONG)&str, TAG_END);
441 +                                                                        strncpy(str, dev_request->rf_File, 255);        // Don't copy the directory part. This is usually "DEVS:" and we don't need that.
442 +                                                                        str[255] = 0;
443 +                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, (ULONG)str, TAG_END);
444 +                                                                }
445 +                                                        }
446 +                                                        break;
447 +
448                                                  case GAD_ETHER_DEVICE:
449                                                          if (dev_request) {
450                                                                  LT_LockWindow(win);
451 <                                                                BOOL result = AslRequestTags(dev_request, ASLFR_Window, win, TAG_END);
451 >                                                                BOOL result = AslRequestTags(dev_request,
452 >                                                                        ASLFR_Window, (ULONG)win,
453 >                                                                        ASLFR_InitialDrawer, (ULONG) "Devs:Networks",
454 >                                                                        TAG_END);
455                                                                  LT_UnlockWindow(win);
456                                                                  if (result) {
457                                                                          char *str;
458 <                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, &str, TAG_END);
458 >                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, (ULONG)&str, TAG_END);
459                                                                          strncpy(str, dev_request->rf_File, 255);        // Don't copy the directory part. This is usually "DEVS:" and we don't need that.
460                                                                          str[255] = 0;
461 <                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, str, TAG_END);
461 >                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, (ULONG)str, TAG_END);
462                                                                  }
463                                                          }
464                                                          break;
# Line 442 | Line 466 | bool PrefsEditor(void)
466                                                  case GAD_ROM_FILE:
467                                                          if (file_request) {
468                                                                  LT_LockWindow(win);
469 <                                                                BOOL result = AslRequestTags(file_request, ASLFR_Window, win, TAG_END);
469 >                                                                BOOL result = AslRequestTags(file_request, ASLFR_Window, (ULONG)win, TAG_END);
470                                                                  LT_UnlockWindow(win);
471                                                                  if (result) {
472                                                                          char *str;
473 <                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, &str, TAG_END);
473 >                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, (ULONG)&str, TAG_END);
474                                                                          strncpy(str, file_request->rf_Dir, 255);
475                                                                          str[255] = 0;
476                                                                          AddPart(str, file_request->rf_File, 255);
477 <                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, str, TAG_END);
477 >                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, (ULONG)str, TAG_END);
478                                                                  }
479                                                          }
480                                                          break;
# Line 509 | Line 533 | quit:
533          FreeAslRequest(dev_request);
534          FreeAslRequest(file_request);
535  
536 +        // Delete Menus
537 +        LT_DisposeMenu(menu);
538 +
539          // Delete handle
540          LT_DeleteHandle(h);
541  
# Line 523 | Line 550 | quit:
550   */
551  
552   static struct List disk_list;
553 < static char cdrom_name[256];
553 > static char cdrom_name[256], extfs_name[256];
554   static ULONG cdrom_unit, cdrom_flags, cdrom_start, cdrom_size, cdrom_bsize;
555   static BYTE bootdriver_num, nocdrom;
556  
# Line 558 | Line 585 | static void parse_volumes_prefs(void)
585          }
586  
587          nocdrom = PrefsFindBool("nocdrom");
588 +
589 +        extfs_name[0] = 0;
590 +        str = PrefsFindString("extfs");
591 +        if (str)
592 +                strncpy(extfs_name, str, sizeof(extfs_name) - 1);
593   }
594  
595   // Ghost/unghost "Edit" and "Remove" buttons
# Line 644 | Line 676 | static void add_edit_volume(struct Layou
676          struct Window *win = NULL;
677          h = LT_CreateHandleTags(NULL,
678                  LAHN_AutoActivate, FALSE,
679 <                LAHN_LocaleHook, &locale_hook,
679 >                LAHN_LocaleHook, (ULONG)&locale_hook,
680                  TAG_END
681          );
682          if (h == NULL)
# Line 657 | Line 689 | static void add_edit_volume(struct Layou
689                          LT_New(h, LA_Type, CHECKBOX_KIND,
690                                  LA_LabelID, STR_VOL_READONLY_CTRL,
691                                  LA_ID, GAD_VOLUME_READONLY,
692 <                                LA_BYTE, &read_only,
692 >                                LA_BYTE, (ULONG)&read_only,
693                                  TAG_END
694                          );
695                          LT_New(h, LA_Type, CYCLE_KIND,
# Line 666 | Line 698 | static void add_edit_volume(struct Layou
698                                  LACY_AutoPageID, GAD_VOLUME_PAGEGROUP,
699                                  LACY_FirstLabel, STR_VOL_FILE_LAB,
700                                  LACY_LastLabel, STR_VOL_DEVICE_LAB,
701 <                                LA_BYTE, &is_device,
701 >                                LA_BYTE, (ULONG)&is_device,
702                                  TAG_END
703                          );
704                  ENDGROUP;
# Line 680 | Line 712 | static void add_edit_volume(struct Layou
712                                          LA_LabelID, STR_VOL_FILE_CTRL,
713                                          LA_ID, GAD_VOLUME_FILE,
714                                          LA_Chars, 20,
715 <                                        LA_STRPTR, file_name,
715 >                                        LA_STRPTR, (ULONG)file_name,
716                                          GTST_MaxChars, sizeof(file_name) - 1,
717                                          LAST_Picker, TRUE,
718                                          TAG_END
# Line 691 | Line 723 | static void add_edit_volume(struct Layou
723                                          LA_LabelID, STR_DEVICE_CTRL,
724                                          LA_ID, GAD_VOLUME_DEVICE,
725                                          LA_Chars, 20,
726 <                                        LA_STRPTR, dev_name,
726 >                                        LA_STRPTR, (ULONG)dev_name,
727                                          GTST_MaxChars, sizeof(dev_name) - 1,
728                                          LAST_Picker, TRUE,
729                                          TAG_END
# Line 699 | Line 731 | static void add_edit_volume(struct Layou
731                                  LT_New(h, LA_Type, INTEGER_KIND,
732                                          LA_LabelID, STR_UNIT_CTRL,
733                                          LA_ID, GAD_VOLUME_UNIT,
734 <                                        LA_LONG, &dev_unit,
734 >                                        LA_LONG, (ULONG)&dev_unit,
735                                          LAIN_UseIncrementers, TRUE,
736                                          GTIN_MaxChars, 8,
737                                          TAG_END
# Line 707 | Line 739 | static void add_edit_volume(struct Layou
739                                  LT_New(h, LA_Type, INTEGER_KIND,
740                                          LA_LabelID, STR_VOL_OPENFLAGS_CTRL,
741                                          LA_ID, GAD_VOLUME_OPENFLAGS,
742 <                                        LA_LONG, &dev_flags,
742 >                                        LA_LONG, (ULONG)&dev_flags,
743                                          LAIN_UseIncrementers, TRUE,
744                                          GTIN_MaxChars, 8,
745                                          TAG_END
# Line 715 | Line 747 | static void add_edit_volume(struct Layou
747                                  LT_New(h, LA_Type, INTEGER_KIND,
748                                          LA_LabelID, STR_VOL_STARTBLOCK_CTRL,
749                                          LA_ID, GAD_VOLUME_STARTBLOCK,
750 <                                        LA_LONG, &dev_start,
750 >                                        LA_LONG, (ULONG)&dev_start,
751                                          LAIN_UseIncrementers, TRUE,
752                                          GTIN_MaxChars, 8,
753                                          TAG_END
# Line 723 | Line 755 | static void add_edit_volume(struct Layou
755                                  LT_New(h, LA_Type, INTEGER_KIND,
756                                          LA_LabelID, STR_VOL_SIZE_CTRL,
757                                          LA_ID, GAD_VOLUME_SIZE,
758 <                                        LA_LONG, &dev_size,
758 >                                        LA_LONG, (ULONG)&dev_size,
759                                          LAIN_UseIncrementers, TRUE,
760                                          GTIN_MaxChars, 8,
761                                          TAG_END
# Line 731 | Line 763 | static void add_edit_volume(struct Layou
763                                  LT_New(h, LA_Type, INTEGER_KIND,
764                                          LA_LabelID, STR_VOL_BLOCKSIZE_CTRL,
765                                          LA_ID, GAD_VOLUME_BLOCKSIZE,
766 <                                        LA_LONG, &dev_bsize,
766 >                                        LA_LONG, (ULONG)&dev_bsize,
767                                          LAIN_UseIncrementers, TRUE,
768                                          GTIN_MaxChars, 8,
769                                          TAG_END
# Line 831 | Line 863 | static void add_edit_volume(struct Layou
863                                                          req = dev_request;
864   do_req:                                         if (req) {
865                                                                  LT_LockWindow(win);
866 <                                                                BOOL result = AslRequestTags(req, ASLFR_Window, win, TAG_END);
866 >                                                                BOOL result = AslRequestTags(req, ASLFR_Window, (ULONG)win, TAG_END);
867                                                                  LT_UnlockWindow(win);
868                                                                  if (result) {
869                                                                          char *str;
870 <                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, &str, TAG_END);
870 >                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, (ULONG)&str, TAG_END);
871                                                                          if (gad->GadgetID == GAD_VOLUME_FILE) {
872                                                                                  strncpy(str, req->rf_Dir, 255);
873                                                                                  str[255] = 0;
# Line 853 | Line 885 | do_req:                                                if (req) {
885                                                                                          LT_SetAttributes(h, GAD_VOLUME_BLOCKSIZE, GTIN_Number, dev_bsize, TAG_END);
886                                                                                  }
887                                                                          }
888 <                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, str, TAG_END);
888 >                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, (ULONG)str, TAG_END);
889                                                                  }
890                                                          }
891                                                          break;
# Line 864 | Line 896 | do_req:                                                if (req) {
896                  }
897          } while (!done);
898  
867        // Delete handle
868        LT_DeleteHandle(h);
869
899          // Update preferences and list view
900          if (ok_clicked) {
901                  char str[256];
# Line 881 | Line 910 | do_req:                                                if (req) {
910                  if (adding) {
911  
912                          // Add new item
913 +                        int i;
914                          PrefsAddString("disk", str);
915                          struct Node *item = (struct Node *)AllocMem(sizeof(struct Node), MEMF_CLEAR);
916 <                        for (int i=0; PrefsFindString("disk", i); i++) ;
916 >                        for (i=0; PrefsFindString("disk", i); i++) ;
917                          item->ln_Name = (char *)PrefsFindString("disk", i - 1);
918                          AddTail(&disk_list, item);
919  
# Line 900 | Line 930 | do_req:                                                if (req) {
930                                  item = item->ln_Succ;
931                          }
932                  }
933 <                LT_SetAttributes(h2, GAD_DISK_LIST, GTLV_Labels, &disk_list, TAG_END);
933 >                LT_SetAttributes(h2, GAD_DISK_LIST, GTLV_Labels, (ULONG)&disk_list, TAG_END);
934                  ghost_volumes_gadgets(h2);
935          }
936 +
937 +        // Delete handle
938 +        LT_DeleteHandle(h);
939   }
940  
941   // Remove volume from list
# Line 924 | Line 957 | static void remove_volume(struct LayoutH
957                          }
958                          item = next;
959                  }
960 <                LT_SetAttributes(h, GAD_DISK_LIST, GTLV_Labels, &disk_list, GTLV_Selected, 0xffff, TAG_END);
960 >                LT_SetAttributes(h, GAD_DISK_LIST, GTLV_Labels, (ULONG)&disk_list, GTLV_Selected, 0xffff, TAG_END);
961                  ghost_volumes_gadgets(h);
962          }
963   }
# Line 948 | Line 981 | static void read_volumes_settings(void)
981                  PrefsRemoveItem("cdrom");
982  
983          PrefsReplaceBool("nocdrom", nocdrom);
984 +
985 +        if (strlen(extfs_name))
986 +                PrefsReplaceString("extfs", extfs_name);
987   }
988  
989   // Create "Volumes" pane
# Line 963 | Line 999 | static void create_volumes_pane(struct L
999                          VGROUP;
1000                                  LT_New(h, LA_Type, LISTVIEW_KIND,
1001                                          LA_ID, GAD_DISK_LIST,
1002 <                                        GTLV_Labels, &disk_list,
1002 >                                        LA_Chars, 20,
1003 >                                        GTLV_Labels, (ULONG)&disk_list,
1004                                          LALV_Lines, 6,
1005 <                                        LALV_Link, NIL_LINK,
1005 >                                        LALV_Link, (ULONG)NIL_LINK,
1006                                          LALV_ResizeX, TRUE,
1007                                          LALV_ResizeY, TRUE,
1008                                          LALV_Selected, 0,
# Line 1002 | Line 1039 | static void create_volumes_pane(struct L
1039                                  LA_LabelID, STR_DEVICE_CTRL,
1040                                  LA_ID, GAD_CDROM_DEVICE,
1041                                  LA_Chars, 20,
1042 <                                LA_STRPTR, cdrom_name,
1042 >                                LA_STRPTR, (ULONG)cdrom_name,
1043                                  GTST_MaxChars, sizeof(cdrom_name) - 1,
1044                                  LAST_Picker, TRUE,
1045                                  TAG_END
# Line 1010 | Line 1047 | static void create_volumes_pane(struct L
1047                          LT_New(h, LA_Type, INTEGER_KIND,
1048                                  LA_LabelID, STR_UNIT_CTRL,
1049                                  LA_ID, GAD_CDROM_UNIT,
1050 <                                LA_LONG, &cdrom_unit,
1050 >                                LA_LONG, (ULONG)&cdrom_unit,
1051                                  LAIN_UseIncrementers, TRUE,
1052                                  GTIN_MaxChars, 8,
1053                                  TAG_END
# Line 1020 | Line 1057 | static void create_volumes_pane(struct L
1057                                  LA_ID, GAD_BOOTDRIVER,
1058                                  LACY_FirstLabel, STR_BOOT_ANY_LAB,
1059                                  LACY_LastLabel, STR_BOOT_CDROM_LAB,
1060 <                                LA_BYTE, &bootdriver_num,
1060 >                                LA_BYTE, (ULONG)&bootdriver_num,
1061                                  TAG_END
1062                          );
1063                          LT_New(h, LA_Type, CHECKBOX_KIND,
1064                                  LA_LabelID, STR_NOCDROM_CTRL,
1065                                  LA_ID, GAD_NOCDROM,
1066 <                                LA_BYTE, &nocdrom,
1066 >                                LA_BYTE, (ULONG)&nocdrom,
1067 >                                TAG_END
1068 >                        );
1069 >                ENDGROUP;
1070 >                VGROUP;
1071 >                        LT_New(h, LA_Type, STRING_KIND,
1072 >                                LA_LabelID, STR_EXTFS_CTRL,
1073 >                                LA_ID, GAD_EXTFS,
1074 >                                LA_Chars, 20,
1075 >                                LA_STRPTR, (ULONG)extfs_name,
1076 >                                GTST_MaxChars, sizeof(extfs_name) - 1,
1077                                  TAG_END
1078                          );
1079                  ENDGROUP;
# Line 1065 | Line 1112 | static void read_scsi_settings(void)
1112  
1113                  if (strlen(scsi_dev[i])) {
1114                          char str[256];
1115 <                        sprintf("%s/%ld", scsi_dev[i], scsi_unit[i]);
1115 >                        sprintf(str, "%s/%ld", scsi_dev[i], scsi_unit[i]);
1116                          PrefsReplaceString(prefs_name, str);
1117                  } else
1118                          PrefsRemoveItem(prefs_name);
# Line 1088 | Line 1135 | static void create_scsi_pane(struct Layo
1135                                          LA_LabelID, STR_DEVICE_CTRL,
1136                                          LA_ID, GAD_SCSI0_DEVICE + i,
1137                                          LA_Chars, 20,
1138 <                                        LA_STRPTR, scsi_dev[i],
1138 >                                        LA_STRPTR, (ULONG)scsi_dev[i],
1139                                          GTST_MaxChars, sizeof(scsi_dev[i]) - 1,
1140                                          LAST_Picker, TRUE,
1141                                          TAG_END
# Line 1097 | Line 1144 | static void create_scsi_pane(struct Layo
1144                                          LA_LabelID, STR_UNIT_CTRL,
1145                                          LA_ID, GAD_SCSI0_UNIT + i,
1146                                          LA_Chars, 4,
1147 <                                        LA_LONG, &scsi_unit[i],
1147 >                                        LA_LONG, (ULONG)&scsi_unit[i],
1148                                          LAIN_UseIncrementers, TRUE,
1149                                          GTIN_MaxChars, 8,
1150                                          TAG_END
# Line 1177 | Line 1224 | static void parse_graphics_prefs(void)
1224          if (str) {
1225                  if (sscanf(str, "ahi/%08lx", &ahi_id) == 1 && AHIBase) {
1226                          AHI_GetAudioAttrs(ahi_id, NULL,
1227 <                                AHIDB_Name, ahi_mode_name,
1227 >                                AHIDB_Name, (ULONG)ahi_mode_name,
1228                                  AHIDB_BufferLen, sizeof(ahi_mode_name) - 1,
1229                                  TAG_END
1230                          );
# Line 1217 | Line 1264 | static void ghost_graphics_gadgets(struc
1264   // Show screen mode requester
1265   static void screen_mode_req(struct Window *win, struct LayoutHandle *h)
1266   {
1267 <        if (P96Base == NULL)
1267 >        if (P96Base == NULL && CyberGfxBase == NULL)
1268                  return;
1269  
1270          LT_LockWindow(win);
1271 <        ULONG id = p96RequestModeIDTags(
1272 <                P96MA_MinDepth, 8,
1273 <                P96MA_FormatsAllowed, RGBFF_CLUT | RGBFF_R5G5B5 | RGBFF_A8R8G8B8,
1274 <                TAG_END
1275 <        );
1271 >
1272 >        ULONG id;
1273 >
1274 >        // Try P96 first, because it also provides a (fake) cybergraphics.library
1275 >        if (P96Base) {
1276 >                id = p96RequestModeIDTags(
1277 >                        P96MA_MinDepth, 8,
1278 >                        P96MA_FormatsAllowed, RGBFF_CLUT | RGBFF_R5G5B5 | RGBFF_A8R8G8B8,
1279 >                        TAG_END
1280 >                );
1281 >        } else {
1282 >                UWORD ModelArray[] = { PIXFMT_LUT8, PIXFMT_RGB15, PIXFMT_ARGB32, 0, ~0 };
1283 >                id = (ULONG) CModeRequestTags(NULL,
1284 >                        CYBRMREQ_MinDepth, 8,
1285 >                        CYBRMREQ_CModelArray, (ULONG) ModelArray,
1286 >                        TAG_END
1287 >                );
1288 >        }
1289          LT_UnlockWindow(win);
1290  
1291          if (id != INVALID_ID) {
1292                  mode_id = id;
1293                  GetDisplayInfoData(NULL, (UBYTE *)&mode_name, sizeof(mode_name), DTAG_NAME, mode_id);
1294 <                LT_SetAttributes(h, GAD_SCREEN_MODE, GTTX_Text, mode_name.Name, TAG_END);
1294 >                LT_SetAttributes(h, GAD_SCREEN_MODE, GTTX_Text, (ULONG)mode_name.Name, TAG_END);
1295          }
1296   }
1297  
# Line 1242 | Line 1302 | static void ahi_mode_req(struct Window *
1302                  return;
1303  
1304          struct AHIAudioModeRequester *req = AHI_AllocAudioRequest(
1305 <                AHIR_Window, win,
1305 >                AHIR_Window, (ULONG)win,
1306                  TAG_END
1307          );
1308          if (req == NULL)
# Line 1258 | Line 1318 | static void ahi_mode_req(struct Window *
1318          if (ok) {
1319                  ahi_id = req->ahiam_AudioID;
1320                  AHI_GetAudioAttrs(ahi_id, NULL,
1321 <                        AHIDB_Name, ahi_mode_name,
1321 >                        AHIDB_Name, (ULONG)ahi_mode_name,
1322                          AHIDB_BufferLen, sizeof(ahi_mode_name) - 1,
1323                          TAG_END
1324                  );
1325 <                LT_SetAttributes(h, GAD_AHI_MODE, GTTX_Text, ahi_mode_name, TAG_END);
1325 >                LT_SetAttributes(h, GAD_AHI_MODE, GTTX_Text, (ULONG)ahi_mode_name, TAG_END);
1326          }
1327          AHI_FreeAudioRequest(req);
1328   }
# Line 1307 | Line 1367 | static void create_graphics_pane(struct
1367                          LT_New(h, LA_Type, CYCLE_KIND,
1368                                  LA_LabelID, STR_VIDEO_TYPE_CTRL,
1369                                  LA_ID, GAD_VIDEO_TYPE,
1370 <                                LACY_LabelTable, labels,
1371 <                                LA_BYTE, &display_type,
1370 >                                LACY_LabelTable, (ULONG)labels,
1371 >                                LA_BYTE, (ULONG)&display_type,
1372                                  TAG_END
1373                          );
1374                          LT_New(h, LA_Type, INTEGER_KIND,
1375                                  LA_LabelID, STR_DISPLAY_X_CTRL,
1376                                  LA_ID, GAD_DISPLAY_X,
1377 <                                LA_LONG, &dis_width,
1377 >                                LA_LONG, (ULONG)&dis_width,
1378                                  GTIN_MaxChars, 8,
1379                                  TAG_END
1380                          );
1381                          LT_New(h, LA_Type, INTEGER_KIND,
1382                                  LA_LabelID, STR_DISPLAY_Y_CTRL,
1383                                  LA_ID, GAD_DISPLAY_Y,
1384 <                                LA_LONG, &dis_height,
1384 >                                LA_LONG, (ULONG)&dis_height,
1385                                  GTIN_MaxChars, 8,
1386                                  TAG_END
1387                          );
# Line 1330 | Line 1390 | static void create_graphics_pane(struct
1390                                  LA_ID, GAD_FRAMESKIP,
1391                                  LAPU_FirstLabel, STR_REF_5HZ_LAB,
1392                                  LAPU_LastLabel, STR_REF_60HZ_LAB,
1393 <                                LA_BYTE, &frameskip_num,
1393 >                                LA_BYTE, (ULONG)&frameskip_num,
1394                                  TAG_END
1395                          );
1396                          LT_New(h, LA_Type, TEXT_KIND,
# Line 1338 | Line 1398 | static void create_graphics_pane(struct
1398                                  LA_ID, GAD_SCREEN_MODE,
1399                                  LA_Chars, DISPLAYNAMELEN,
1400                                  LATX_Picker, TRUE,
1401 <                                GTTX_Text, mode_name.Name,
1401 >                                GTTX_Text, (ULONG)mode_name.Name,
1402                                  GTTX_Border, TRUE,
1403                                  TAG_END
1404                          );
# Line 1352 | Line 1412 | static void create_graphics_pane(struct
1412                                  LA_ID, GAD_AHI_MODE,
1413                                  LA_Chars, DISPLAYNAMELEN,
1414                                  LATX_Picker, TRUE,
1415 <                                GTTX_Text, ahi_mode_name,
1415 >                                GTTX_Text, (ULONG)ahi_mode_name,
1416                                  GTTX_Border, TRUE,
1417                                  TAG_END
1418                          );
1419                          LT_New(h, LA_Type, CHECKBOX_KIND,
1420                                  LA_LabelID, STR_NOSOUND_CTRL,
1421                                  LA_ID, GAD_NOSOUND,
1422 <                                LA_BYTE, &nosound,
1422 >                                LA_BYTE, (ULONG)&nosound,
1423                                  TAG_END
1424                          );
1425                  ENDGROUP;
# Line 1381 | Line 1441 | static char ether_dev[256];
1441   static ULONG ether_unit;
1442  
1443   // Read serial/network preferences
1444 < static void parse_serial_prefs(const char *prefs, char *dev, LONG &unit, BYTE &ispar)
1444 > static void parse_ser_prefs(const char *prefs, char *dev, LONG &unit, BYTE &ispar)
1445   {
1446          dev[0] = 0;
1447          unit = 0;
# Line 1395 | Line 1455 | static void parse_serial_prefs(const cha
1455                  }
1456                  sscanf(str, "%[^/]/%ld", dev, &unit);
1457          }
1458 + }
1459 +
1460 + static void parse_serial_prefs(void)
1461 + {
1462 +        parse_ser_prefs("seriala", seriala_dev, seriala_unit, seriala_ispar);
1463 +        parse_ser_prefs("serialb", serialb_dev, serialb_unit, serialb_ispar);
1464  
1465          ether_dev[0] = 0;
1466          ether_unit = 0;
1467  
1468 <        str = PrefsFindString("ether");
1469 <        if (str)
1470 <                sscanf(str, "%[^/]/%ld", ether_dev, &ether_unit);
1468 >        const char *str = PrefsFindString("ether");
1469 >        if (str) {
1470 >                const char *FirstSlash = strchr(str, '/');
1471 >                const char *LastSlash = strrchr(str, '/');
1472 >
1473 >                if (FirstSlash && FirstSlash && FirstSlash != LastSlash) {
1474 >                        // Device name contains path, i.e. "Networks/xyzzy.device"
1475 >                        const char *lp = str;
1476 >                        char *dp = ether_dev;
1477 >
1478 >                        while (lp != LastSlash)
1479 >                                *dp++ = *lp++;
1480 >                        *dp = '\0';
1481 >
1482 >                        sscanf(LastSlash, "/%ld", &ether_unit);
1483 >
1484 > //                      printf("dev=<%s> unit=%d\n", ether_dev, ether_unit);
1485 >                } else {
1486 >                        sscanf(str, "%[^/]/%ld", ether_dev, &ether_unit);
1487 >                }
1488 >        }
1489   }
1490  
1491   // Set serial preference item
# Line 1423 | Line 1507 | static void read_serial_settings(void)
1507  
1508          if (strlen(ether_dev)) {
1509                  char str[256];
1510 +
1511                  sprintf(str, "%s/%ld", ether_dev, ether_unit);
1512                  PrefsReplaceString("ether", str);
1513          } else
# Line 1432 | Line 1517 | static void read_serial_settings(void)
1517   // Create "Serial/Network" pane
1518   static void create_serial_pane(struct LayoutHandle *h)
1519   {
1520 <        parse_serial_prefs("seriala", seriala_dev, seriala_unit, seriala_ispar);
1436 <        parse_serial_prefs("serialb", serialb_dev, serialb_unit, serialb_ispar);
1520 >        parse_serial_prefs();
1521  
1522          VGROUP;
1523                  LT_New(h, LA_Type, VERTICAL_KIND,
# Line 1444 | Line 1528 | static void create_serial_pane(struct La
1528                                  LA_LabelID, STR_DEVICE_CTRL,
1529                                  LA_ID, GAD_SERIALA_DEVICE,
1530                                  LA_Chars, 20,
1531 <                                LA_STRPTR, seriala_dev,
1531 >                                LA_STRPTR, (ULONG)seriala_dev,
1532                                  GTST_MaxChars, sizeof(seriala_dev) - 1,
1533                                  LAST_Picker, TRUE,
1534                                  TAG_END
# Line 1452 | Line 1536 | static void create_serial_pane(struct La
1536                          LT_New(h, LA_Type, INTEGER_KIND,
1537                                  LA_LabelID, STR_UNIT_CTRL,
1538                                  LA_ID, GAD_SERIALA_UNIT,
1539 <                                LA_LONG, &seriala_unit,
1539 >                                LA_LONG, (ULONG)&seriala_unit,
1540                                  LAIN_UseIncrementers, TRUE,
1541                                  GTIN_MaxChars, 8,
1542                                  TAG_END
# Line 1460 | Line 1544 | static void create_serial_pane(struct La
1544                          LT_New(h, LA_Type, CHECKBOX_KIND,
1545                                  LA_LabelID, STR_ISPAR_CTRL,
1546                                  LA_ID, GAD_SERIALA_ISPAR,
1547 <                                LA_BYTE, &seriala_ispar,
1547 >                                LA_BYTE, (ULONG)&seriala_ispar,
1548                                  TAG_END
1549                          );
1550                  ENDGROUP;
# Line 1473 | Line 1557 | static void create_serial_pane(struct La
1557                                  LA_LabelID, STR_DEVICE_CTRL,
1558                                  LA_ID, GAD_SERIALB_DEVICE,
1559                                  LA_Chars, 20,
1560 <                                LA_STRPTR, serialb_dev,
1560 >                                LA_STRPTR, (ULONG)serialb_dev,
1561                                  GTST_MaxChars, sizeof(serialb_dev) - 1,
1562                                  LAST_Picker, TRUE,
1563                                  TAG_END
# Line 1481 | Line 1565 | static void create_serial_pane(struct La
1565                          LT_New(h, LA_Type, INTEGER_KIND,
1566                                  LA_LabelID, STR_UNIT_CTRL,
1567                                  LA_ID, GAD_SERIALB_UNIT,
1568 <                                LA_LONG, &serialb_unit,
1568 >                                LA_LONG, (ULONG)&serialb_unit,
1569                                  LAIN_UseIncrementers, TRUE,
1570                                  GTIN_MaxChars, 8,
1571                                  TAG_END
# Line 1489 | Line 1573 | static void create_serial_pane(struct La
1573                          LT_New(h, LA_Type, CHECKBOX_KIND,
1574                                  LA_LabelID, STR_ISPAR_CTRL,
1575                                  LA_ID, GAD_SERIALB_ISPAR,
1576 <                                LA_BYTE, &serialb_ispar,
1576 >                                LA_BYTE, (ULONG)&serialb_ispar,
1577                                  TAG_END
1578                          );
1579                  ENDGROUP;
# Line 1502 | Line 1586 | static void create_serial_pane(struct La
1586                                  LA_LabelID, STR_DEVICE_CTRL,
1587                                  LA_ID, GAD_ETHER_DEVICE,
1588                                  LA_Chars, 20,
1589 <                                LA_STRPTR, ether_dev,
1589 >                                LA_STRPTR, (ULONG)ether_dev,
1590                                  GTST_MaxChars, sizeof(ether_dev) - 1,
1591                                  LAST_Picker, TRUE,
1592                                  TAG_END
# Line 1510 | Line 1594 | static void create_serial_pane(struct La
1594                          LT_New(h, LA_Type, INTEGER_KIND,
1595                                  LA_LabelID, STR_UNIT_CTRL,
1596                                  LA_ID, GAD_ETHER_UNIT,
1597 <                                LA_LONG, &ether_unit,
1597 >                                LA_LONG, (ULONG)&ether_unit,
1598                                  LAIN_UseIncrementers, TRUE,
1599                                  GTIN_MaxChars, 8,
1600                                  TAG_END
# Line 1573 | Line 1657 | static void create_memory_pane(struct La
1657                          LA_LabelID, STR_RAMSIZE_SLIDER,
1658                          LA_ID, GAD_RAMSIZE,
1659                          LA_Chars, 20,
1660 <                        LA_LONG, &ramsize_mb,
1661 <                        GTSL_LevelFormat, GetString(STR_RAMSIZE_FMT),
1660 >                        LA_LONG, (ULONG)&ramsize_mb,
1661 >                        GTSL_LevelFormat, (ULONG)GetString(STR_RAMSIZE_FMT),
1662                          GTSL_Min, 1,
1663                          GTSL_Max, AvailMem(MEMF_LARGEST) >> 20,
1664                          TAG_END
# Line 1584 | Line 1668 | static void create_memory_pane(struct La
1668                          LA_ID, GAD_MODELID,
1669                          LACY_FirstLabel, STR_MODELID_5_LAB,
1670                          LACY_LastLabel, STR_MODELID_14_LAB,
1671 <                        LA_BYTE, &model_num,
1671 >                        LA_BYTE, (ULONG)&model_num,
1672                          TAG_END
1673                  );
1674                  LT_New(h, LA_Type, STRING_KIND,
1675                          LA_LabelID, STR_ROM_FILE_CTRL,
1676                          LA_ID, GAD_ROM_FILE,
1677                          LA_Chars, 20,
1678 <                        LA_STRPTR, rom_file,
1678 >                        LA_STRPTR, (ULONG)rom_file,
1679                          GTST_MaxChars, sizeof(rom_file) - 1,
1680                          LAST_Picker, TRUE,
1681                          TAG_END

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines