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.16 by cebix, 2001-05-24T14:31:07Z

# Line 1 | Line 1
1   /*
2   *  prefs_editor_amiga.cpp - Preferences editor, AmigaOS implementation (using gtlayout.library)
3   *
4 < *  Basilisk II (C) 1997-1999 Christian Bauer
4 > *  Basilisk II (C) 1997-2001 Christian Bauer
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# 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 91 | Line 94 | const int GAD_SCSI3_UNIT = 0x0413;
94   const int GAD_SCSI4_UNIT = 0x0414;
95   const int GAD_SCSI5_UNIT = 0x0415;
96   const int GAD_SCSI6_UNIT = 0x0416;
97 + const int GAD_SCSI_MEMTYPE = 0x0420;
98  
99   const int GAD_VIDEO_TYPE = 0x0500;                      // "Graphics/Sound" pane
100   const int GAD_DISPLAY_X = 0x0501;
# Line 139 | Line 143 | static void read_settings(struct LayoutH
143  
144  
145   /*
146 < *  Locale hook function - returns string for given ID
146 > *  Locale hook - returns string for given ID
147   */
148  
149 < static __saveds __asm char *locale_hook_func(register __a0 struct Hook *hook, register __a2 struct LayoutHandle *h, register __a1 LONG id)
149 > static __saveds __attribute__((regparm(3))) const char *locale_hook_func(struct Hook *hook /*a0*/, void *id /*a1*/, struct LayoutHandle *h /*a2*/)
150   {
151 <        return GetString(id);
151 >        return GetString((uint32)id);
152   }
153  
154   struct Hook locale_hook = {{NULL, NULL}, (HOOKFUNC)locale_hook_func, NULL, NULL};
# Line 162 | Line 166 | bool PrefsEditor(void)
166          struct Window *win = NULL;
167          struct Menu *menu = NULL;
168  
169 +        // Pane tabs
170 +        static const LONG labels[] = {
171 +                STR_VOLUMES_PANE_TITLE,
172 +                STR_SCSI_PANE_TITLE,
173 +                STR_GRAPHICS_SOUND_PANE_TITLE,
174 +                STR_SERIAL_NETWORK_PANE_TITLE,
175 +                STR_MEMORY_MISC_PANE_TITLE,
176 +                -1
177 +        };
178 +
179          // Open gtlayout.library
180          GTLayoutBase = (struct Library *)OpenLibrary((UBYTE *)"gtlayout.library", 39);
181          if (GTLayoutBase == NULL) {
182                  WarningAlert(GetString(STR_NO_GTLAYOUT_LIB_WARN));
183 <                goto quit;
183 >                return true;
184          }
185  
186          // Create layout handle
187          h = LT_CreateHandleTags(NULL,
188                  LAHN_AutoActivate, FALSE,
189 <                LAHN_LocaleHook, &locale_hook,
189 >                LAHN_LocaleHook, (ULONG)&locale_hook,
190                  TAG_END
191          );
192          if (h == NULL)
# Line 180 | Line 194 | bool PrefsEditor(void)
194  
195          // Create menus
196          menu = LT_NewMenuTags(
197 <                LAMN_LayoutHandle, h,
197 >                LAMN_LayoutHandle, (ULONG)h,
198                  LAMN_TitleID, STR_PREFS_MENU,
199                  LAMN_ItemID, STR_PREFS_ITEM_ABOUT,
200                  LAMN_UserData, MSG_ABOUT,
201 <                LAMN_ItemText, NM_BARLABEL,
201 >                LAMN_ItemText, (ULONG)NM_BARLABEL,
202                  LAMN_ItemID, STR_PREFS_ITEM_START,
203                  LAMN_UserData, MSG_OK,
204                  LAMN_ItemID, STR_PREFS_ITEM_ZAP_PRAM,
205                  LAMN_UserData, MSG_ZAP_PRAM,
206 <                LAMN_ItemText, NM_BARLABEL,
206 >                LAMN_ItemText, (ULONG)NM_BARLABEL,
207                  LAMN_ItemID, STR_PREFS_ITEM_QUIT,
208                  LAMN_UserData, MSG_CANCEL,
209 <                LAMN_KeyText, "Q",
209 >                LAMN_KeyText, (ULONG)"Q",
210                  TAG_END
211          );
212  
213          // Create window contents
214          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                };
215                  VGROUP;
216                          LT_New(h, LA_Type, TAB_KIND,
217 <                                LATB_LabelTable, labels,
217 >                                LATB_LabelTable, (ULONG)labels,
218                                  LATB_AutoPageID, GAD_PAGEGROUP,
219                                  LATB_FullWidth, TRUE,
220                                  TAG_END
# Line 261 | Line 266 | bool PrefsEditor(void)
266          // Open window
267          win = LT_Build(h,
268                  LAWN_TitleID, STR_PREFS_TITLE,
269 <                LAWN_Menu, menu,
269 >                LAWN_Menu, (ULONG)menu,
270                  LAWN_IDCMP, IDCMP_CLOSEWINDOW,
271                  LAWN_BelowMouse, TRUE,
272                  LAWN_SmartZoom, TRUE,
# Line 279 | Line 284 | bool PrefsEditor(void)
284          dev_request = (struct FileRequester *)AllocAslRequestTags(ASL_FileRequest,
285                  ASLFR_DoPatterns, TRUE,
286                  ASLFR_RejectIcons, TRUE,
287 <                ASLFR_InitialDrawer, "DEVS:",
288 <                ASLFR_InitialPattern, "#?.device",
287 >                ASLFR_InitialDrawer, (ULONG)"DEVS:",
288 >                ASLFR_InitialPattern, (ULONG)"#?.device",
289                  TAG_END
290          );
291          file_request = (struct FileRequester *)AllocAslRequestTags(ASL_FileRequest,
292                  ASLFR_DoPatterns, TRUE,
293                  ASLFR_RejectIcons, TRUE,
294 <                ASLFR_InitialPattern, "#?",
294 >                ASLFR_InitialPattern, (ULONG)"#?",
295                  TAG_END
296          );
297  
# Line 350 | Line 355 | bool PrefsEditor(void)
355                                                  case GAD_BOOTDRIVER:
356                                                          switch (code) {
357                                                                  case 0:
358 <                                                                        PrefsReplaceInt16("bootdriver", 0);
358 >                                                                        PrefsReplaceInt32("bootdriver", 0);
359                                                                          break;
360                                                                  case 1:
361 <                                                                        PrefsReplaceInt16("bootdriver", CDROMRefNum);
361 >                                                                        PrefsReplaceInt32("bootdriver", CDROMRefNum);
362                                                                          break;
363                                                          }
364                                                          break;
365  
366 +                                                case GAD_SCSI_MEMTYPE:
367 +                                                        PrefsReplaceInt32("scsimemtype", code);
368 +                                                        break;
369 +
370                                                  case GAD_VIDEO_TYPE:
371                                                          ghost_graphics_gadgets(h);
372                                                          break;
# Line 424 | Line 433 | bool PrefsEditor(void)
433                                                  case GAD_SCSI6_DEVICE:
434                                                  case GAD_SERIALA_DEVICE:
435                                                  case GAD_SERIALB_DEVICE:
436 +                                                        if (dev_request) {
437 +                                                                LT_LockWindow(win);
438 +                                                                BOOL result = AslRequestTags(dev_request,
439 +                                                                        ASLFR_Window, (ULONG)win,
440 +                                                                        ASLFR_InitialDrawer, (ULONG) "Devs:",
441 +                                                                        TAG_END);
442 +                                                                LT_UnlockWindow(win);
443 +                                                                if (result) {
444 +                                                                        char *str;
445 +                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, (ULONG)&str, TAG_END);
446 +                                                                        strncpy(str, dev_request->rf_File, 255);        // Don't copy the directory part. This is usually "DEVS:" and we don't need that.
447 +                                                                        str[255] = 0;
448 +                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, (ULONG)str, TAG_END);
449 +                                                                }
450 +                                                        }
451 +                                                        break;
452 +
453                                                  case GAD_ETHER_DEVICE:
454                                                          if (dev_request) {
455                                                                  LT_LockWindow(win);
456 <                                                                BOOL result = AslRequestTags(dev_request, ASLFR_Window, win, TAG_END);
456 >                                                                BOOL result = AslRequestTags(dev_request,
457 >                                                                        ASLFR_Window, (ULONG)win,
458 >                                                                        ASLFR_InitialDrawer, (ULONG) "Devs:Networks",
459 >                                                                        TAG_END);
460                                                                  LT_UnlockWindow(win);
461                                                                  if (result) {
462                                                                          char *str;
463 <                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, &str, TAG_END);
463 >                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, (ULONG)&str, TAG_END);
464                                                                          strncpy(str, dev_request->rf_File, 255);        // Don't copy the directory part. This is usually "DEVS:" and we don't need that.
465                                                                          str[255] = 0;
466 <                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, str, TAG_END);
466 >                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, (ULONG)str, TAG_END);
467                                                                  }
468                                                          }
469                                                          break;
# Line 442 | Line 471 | bool PrefsEditor(void)
471                                                  case GAD_ROM_FILE:
472                                                          if (file_request) {
473                                                                  LT_LockWindow(win);
474 <                                                                BOOL result = AslRequestTags(file_request, ASLFR_Window, win, TAG_END);
474 >                                                                BOOL result = AslRequestTags(file_request, ASLFR_Window, (ULONG)win, TAG_END);
475                                                                  LT_UnlockWindow(win);
476                                                                  if (result) {
477                                                                          char *str;
478 <                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, &str, TAG_END);
478 >                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, (ULONG)&str, TAG_END);
479                                                                          strncpy(str, file_request->rf_Dir, 255);
480                                                                          str[255] = 0;
481                                                                          AddPart(str, file_request->rf_File, 255);
482 <                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, str, TAG_END);
482 >                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, (ULONG)str, TAG_END);
483                                                                  }
484                                                          }
485                                                          break;
# Line 509 | Line 538 | quit:
538          FreeAslRequest(dev_request);
539          FreeAslRequest(file_request);
540  
541 +        // Delete Menus
542 +        LT_DisposeMenu(menu);
543 +
544          // Delete handle
545          LT_DeleteHandle(h);
546  
# Line 523 | Line 555 | quit:
555   */
556  
557   static struct List disk_list;
558 < static char cdrom_name[256];
558 > static char cdrom_name[256], extfs_name[256];
559   static ULONG cdrom_unit, cdrom_flags, cdrom_start, cdrom_size, cdrom_bsize;
560   static BYTE bootdriver_num, nocdrom;
561  
# Line 547 | Line 579 | static void parse_volumes_prefs(void)
579  
580          bootdriver_num = 0;
581  
582 <        int bootdriver = PrefsFindInt16("bootdriver");
582 >        int bootdriver = PrefsFindInt32("bootdriver");
583          switch (bootdriver) {
584                  case 0:
585                          bootdriver_num = 0;
# Line 558 | Line 590 | static void parse_volumes_prefs(void)
590          }
591  
592          nocdrom = PrefsFindBool("nocdrom");
593 +
594 +        extfs_name[0] = 0;
595 +        str = PrefsFindString("extfs");
596 +        if (str)
597 +                strncpy(extfs_name, str, sizeof(extfs_name) - 1);
598   }
599  
600   // Ghost/unghost "Edit" and "Remove" buttons
# Line 644 | Line 681 | static void add_edit_volume(struct Layou
681          struct Window *win = NULL;
682          h = LT_CreateHandleTags(NULL,
683                  LAHN_AutoActivate, FALSE,
684 <                LAHN_LocaleHook, &locale_hook,
684 >                LAHN_LocaleHook, (ULONG)&locale_hook,
685                  TAG_END
686          );
687          if (h == NULL)
# Line 657 | Line 694 | static void add_edit_volume(struct Layou
694                          LT_New(h, LA_Type, CHECKBOX_KIND,
695                                  LA_LabelID, STR_VOL_READONLY_CTRL,
696                                  LA_ID, GAD_VOLUME_READONLY,
697 <                                LA_BYTE, &read_only,
697 >                                LA_BYTE, (ULONG)&read_only,
698                                  TAG_END
699                          );
700                          LT_New(h, LA_Type, CYCLE_KIND,
# Line 666 | Line 703 | static void add_edit_volume(struct Layou
703                                  LACY_AutoPageID, GAD_VOLUME_PAGEGROUP,
704                                  LACY_FirstLabel, STR_VOL_FILE_LAB,
705                                  LACY_LastLabel, STR_VOL_DEVICE_LAB,
706 <                                LA_BYTE, &is_device,
706 >                                LA_BYTE, (ULONG)&is_device,
707                                  TAG_END
708                          );
709                  ENDGROUP;
# Line 680 | Line 717 | static void add_edit_volume(struct Layou
717                                          LA_LabelID, STR_VOL_FILE_CTRL,
718                                          LA_ID, GAD_VOLUME_FILE,
719                                          LA_Chars, 20,
720 <                                        LA_STRPTR, file_name,
720 >                                        LA_STRPTR, (ULONG)file_name,
721                                          GTST_MaxChars, sizeof(file_name) - 1,
722                                          LAST_Picker, TRUE,
723                                          TAG_END
# Line 691 | Line 728 | static void add_edit_volume(struct Layou
728                                          LA_LabelID, STR_DEVICE_CTRL,
729                                          LA_ID, GAD_VOLUME_DEVICE,
730                                          LA_Chars, 20,
731 <                                        LA_STRPTR, dev_name,
731 >                                        LA_STRPTR, (ULONG)dev_name,
732                                          GTST_MaxChars, sizeof(dev_name) - 1,
733                                          LAST_Picker, TRUE,
734                                          TAG_END
# Line 699 | Line 736 | static void add_edit_volume(struct Layou
736                                  LT_New(h, LA_Type, INTEGER_KIND,
737                                          LA_LabelID, STR_UNIT_CTRL,
738                                          LA_ID, GAD_VOLUME_UNIT,
739 <                                        LA_LONG, &dev_unit,
739 >                                        LA_LONG, (ULONG)&dev_unit,
740                                          LAIN_UseIncrementers, TRUE,
741                                          GTIN_MaxChars, 8,
742                                          TAG_END
# Line 707 | Line 744 | static void add_edit_volume(struct Layou
744                                  LT_New(h, LA_Type, INTEGER_KIND,
745                                          LA_LabelID, STR_VOL_OPENFLAGS_CTRL,
746                                          LA_ID, GAD_VOLUME_OPENFLAGS,
747 <                                        LA_LONG, &dev_flags,
747 >                                        LA_LONG, (ULONG)&dev_flags,
748                                          LAIN_UseIncrementers, TRUE,
749                                          GTIN_MaxChars, 8,
750                                          TAG_END
# Line 715 | Line 752 | static void add_edit_volume(struct Layou
752                                  LT_New(h, LA_Type, INTEGER_KIND,
753                                          LA_LabelID, STR_VOL_STARTBLOCK_CTRL,
754                                          LA_ID, GAD_VOLUME_STARTBLOCK,
755 <                                        LA_LONG, &dev_start,
755 >                                        LA_LONG, (ULONG)&dev_start,
756                                          LAIN_UseIncrementers, TRUE,
757                                          GTIN_MaxChars, 8,
758                                          TAG_END
# Line 723 | Line 760 | static void add_edit_volume(struct Layou
760                                  LT_New(h, LA_Type, INTEGER_KIND,
761                                          LA_LabelID, STR_VOL_SIZE_CTRL,
762                                          LA_ID, GAD_VOLUME_SIZE,
763 <                                        LA_LONG, &dev_size,
763 >                                        LA_LONG, (ULONG)&dev_size,
764                                          LAIN_UseIncrementers, TRUE,
765                                          GTIN_MaxChars, 8,
766                                          TAG_END
# Line 731 | Line 768 | static void add_edit_volume(struct Layou
768                                  LT_New(h, LA_Type, INTEGER_KIND,
769                                          LA_LabelID, STR_VOL_BLOCKSIZE_CTRL,
770                                          LA_ID, GAD_VOLUME_BLOCKSIZE,
771 <                                        LA_LONG, &dev_bsize,
771 >                                        LA_LONG, (ULONG)&dev_bsize,
772                                          LAIN_UseIncrementers, TRUE,
773                                          GTIN_MaxChars, 8,
774                                          TAG_END
# Line 831 | Line 868 | static void add_edit_volume(struct Layou
868                                                          req = dev_request;
869   do_req:                                         if (req) {
870                                                                  LT_LockWindow(win);
871 <                                                                BOOL result = AslRequestTags(req, ASLFR_Window, win, TAG_END);
871 >                                                                BOOL result = AslRequestTags(req, ASLFR_Window, (ULONG)win, TAG_END);
872                                                                  LT_UnlockWindow(win);
873                                                                  if (result) {
874                                                                          char *str;
875 <                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, &str, TAG_END);
875 >                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, (ULONG)&str, TAG_END);
876                                                                          if (gad->GadgetID == GAD_VOLUME_FILE) {
877                                                                                  strncpy(str, req->rf_Dir, 255);
878                                                                                  str[255] = 0;
# Line 853 | Line 890 | do_req:                                                if (req) {
890                                                                                          LT_SetAttributes(h, GAD_VOLUME_BLOCKSIZE, GTIN_Number, dev_bsize, TAG_END);
891                                                                                  }
892                                                                          }
893 <                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, str, TAG_END);
893 >                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, (ULONG)str, TAG_END);
894                                                                  }
895                                                          }
896                                                          break;
# Line 864 | Line 901 | do_req:                                                if (req) {
901                  }
902          } while (!done);
903  
867        // Delete handle
868        LT_DeleteHandle(h);
869
904          // Update preferences and list view
905          if (ok_clicked) {
906                  char str[256];
# Line 881 | Line 915 | do_req:                                                if (req) {
915                  if (adding) {
916  
917                          // Add new item
918 +                        int i;
919                          PrefsAddString("disk", str);
920                          struct Node *item = (struct Node *)AllocMem(sizeof(struct Node), MEMF_CLEAR);
921 <                        for (int i=0; PrefsFindString("disk", i); i++) ;
921 >                        for (i=0; PrefsFindString("disk", i); i++) ;
922                          item->ln_Name = (char *)PrefsFindString("disk", i - 1);
923                          AddTail(&disk_list, item);
924  
# Line 900 | Line 935 | do_req:                                                if (req) {
935                                  item = item->ln_Succ;
936                          }
937                  }
938 <                LT_SetAttributes(h2, GAD_DISK_LIST, GTLV_Labels, &disk_list, TAG_END);
938 >                LT_SetAttributes(h2, GAD_DISK_LIST, GTLV_Labels, (ULONG)&disk_list, TAG_END);
939                  ghost_volumes_gadgets(h2);
940          }
941 +
942 +        // Delete handle
943 +        LT_DeleteHandle(h);
944   }
945  
946   // Remove volume from list
# Line 924 | Line 962 | static void remove_volume(struct LayoutH
962                          }
963                          item = next;
964                  }
965 <                LT_SetAttributes(h, GAD_DISK_LIST, GTLV_Labels, &disk_list, GTLV_Selected, 0xffff, TAG_END);
965 >                LT_SetAttributes(h, GAD_DISK_LIST, GTLV_Labels, (ULONG)&disk_list, GTLV_Selected, 0xffff, TAG_END);
966                  ghost_volumes_gadgets(h);
967          }
968   }
# Line 948 | Line 986 | static void read_volumes_settings(void)
986                  PrefsRemoveItem("cdrom");
987  
988          PrefsReplaceBool("nocdrom", nocdrom);
989 +
990 +        if (strlen(extfs_name))
991 +                PrefsReplaceString("extfs", extfs_name);
992   }
993  
994   // Create "Volumes" pane
# Line 963 | Line 1004 | static void create_volumes_pane(struct L
1004                          VGROUP;
1005                                  LT_New(h, LA_Type, LISTVIEW_KIND,
1006                                          LA_ID, GAD_DISK_LIST,
1007 <                                        GTLV_Labels, &disk_list,
1007 >                                        LA_Chars, 20,
1008 >                                        GTLV_Labels, (ULONG)&disk_list,
1009                                          LALV_Lines, 6,
1010 <                                        LALV_Link, NIL_LINK,
1010 >                                        LALV_Link, (ULONG)NIL_LINK,
1011                                          LALV_ResizeX, TRUE,
1012                                          LALV_ResizeY, TRUE,
1013                                          LALV_Selected, 0,
# Line 1002 | Line 1044 | static void create_volumes_pane(struct L
1044                                  LA_LabelID, STR_DEVICE_CTRL,
1045                                  LA_ID, GAD_CDROM_DEVICE,
1046                                  LA_Chars, 20,
1047 <                                LA_STRPTR, cdrom_name,
1047 >                                LA_STRPTR, (ULONG)cdrom_name,
1048                                  GTST_MaxChars, sizeof(cdrom_name) - 1,
1049                                  LAST_Picker, TRUE,
1050                                  TAG_END
# Line 1010 | Line 1052 | static void create_volumes_pane(struct L
1052                          LT_New(h, LA_Type, INTEGER_KIND,
1053                                  LA_LabelID, STR_UNIT_CTRL,
1054                                  LA_ID, GAD_CDROM_UNIT,
1055 <                                LA_LONG, &cdrom_unit,
1055 >                                LA_LONG, (ULONG)&cdrom_unit,
1056                                  LAIN_UseIncrementers, TRUE,
1057                                  GTIN_MaxChars, 8,
1058                                  TAG_END
# Line 1020 | Line 1062 | static void create_volumes_pane(struct L
1062                                  LA_ID, GAD_BOOTDRIVER,
1063                                  LACY_FirstLabel, STR_BOOT_ANY_LAB,
1064                                  LACY_LastLabel, STR_BOOT_CDROM_LAB,
1065 <                                LA_BYTE, &bootdriver_num,
1065 >                                LA_BYTE, (ULONG)&bootdriver_num,
1066                                  TAG_END
1067                          );
1068                          LT_New(h, LA_Type, CHECKBOX_KIND,
1069                                  LA_LabelID, STR_NOCDROM_CTRL,
1070                                  LA_ID, GAD_NOCDROM,
1071 <                                LA_BYTE, &nocdrom,
1071 >                                LA_BYTE, (ULONG)&nocdrom,
1072 >                                TAG_END
1073 >                        );
1074 >                ENDGROUP;
1075 >                VGROUP;
1076 >                        LT_New(h, LA_Type, STRING_KIND,
1077 >                                LA_LabelID, STR_EXTFS_CTRL,
1078 >                                LA_ID, GAD_EXTFS,
1079 >                                LA_Chars, 20,
1080 >                                LA_STRPTR, (ULONG)extfs_name,
1081 >                                GTST_MaxChars, sizeof(extfs_name) - 1,
1082                                  TAG_END
1083                          );
1084                  ENDGROUP;
# Line 1040 | Line 1092 | static void create_volumes_pane(struct L
1092  
1093   static char scsi_dev[6][256];
1094   static LONG scsi_unit[6];
1095 + static LONG scsi_memtype;
1096  
1097   // Read SCSI preferences
1098   static void parse_scsi_prefs(void)
# Line 1054 | Line 1107 | static void parse_scsi_prefs(void)
1107                  if (str)
1108                          sscanf(str, "%[^/]/%ld", scsi_dev[i], &scsi_unit[i]);
1109          }
1110 +
1111 +        scsi_memtype = PrefsFindInt32("scsimemtype");
1112   }
1113  
1114   // Read settings from gadgets and set preferences
# Line 1065 | Line 1120 | static void read_scsi_settings(void)
1120  
1121                  if (strlen(scsi_dev[i])) {
1122                          char str[256];
1123 <                        sprintf("%s/%ld", scsi_dev[i], scsi_unit[i]);
1123 >                        sprintf(str, "%s/%ld", scsi_dev[i], scsi_unit[i]);
1124                          PrefsReplaceString(prefs_name, str);
1125                  } else
1126                          PrefsRemoveItem(prefs_name);
# Line 1078 | Line 1133 | static void create_scsi_pane(struct Layo
1133          parse_scsi_prefs();
1134  
1135          VGROUP;
1136 <                for (int i=0; i<7; i++) {
1137 <                        HGROUP;
1138 <                                LT_New(h, LA_Type, TEXT_KIND,
1139 <                                        LA_LabelID, STR_SCSI_ID_0 + i,
1140 <                                        TAG_END
1141 <                                );
1142 <                                LT_New(h, LA_Type, STRING_KIND,
1143 <                                        LA_LabelID, STR_DEVICE_CTRL,
1144 <                                        LA_ID, GAD_SCSI0_DEVICE + i,
1145 <                                        LA_Chars, 20,
1146 <                                        LA_STRPTR, scsi_dev[i],
1147 <                                        GTST_MaxChars, sizeof(scsi_dev[i]) - 1,
1148 <                                        LAST_Picker, TRUE,
1149 <                                        TAG_END
1150 <                                );
1151 <                                LT_New(h, LA_Type, INTEGER_KIND,
1152 <                                        LA_LabelID, STR_UNIT_CTRL,
1153 <                                        LA_ID, GAD_SCSI0_UNIT + i,
1154 <                                        LA_Chars, 4,
1155 <                                        LA_LONG, &scsi_unit[i],
1156 <                                        LAIN_UseIncrementers, TRUE,
1157 <                                        GTIN_MaxChars, 8,
1158 <                                        TAG_END
1159 <                                );
1160 <                        ENDGROUP;
1161 <                }
1136 >                LT_New(h, LA_Type, VERTICAL_KIND,
1137 >                        LA_LabelID, STR_SCSI_DEVICES_CTRL,
1138 >                        TAG_END
1139 >                );
1140 >                        for (int i=0; i<7; i++) {
1141 >                                HGROUP;
1142 >                                        LT_New(h, LA_Type, TEXT_KIND,
1143 >                                                LA_LabelID, STR_SCSI_ID_0 + i,
1144 >                                                TAG_END
1145 >                                        );
1146 >                                        LT_New(h, LA_Type, STRING_KIND,
1147 >                                                LA_LabelID, STR_DEVICE_CTRL,
1148 >                                                LA_ID, GAD_SCSI0_DEVICE + i,
1149 >                                                LA_Chars, 20,
1150 >                                                LA_STRPTR, (ULONG)scsi_dev[i],
1151 >                                                GTST_MaxChars, sizeof(scsi_dev[i]) - 1,
1152 >                                                LAST_Picker, TRUE,
1153 >                                                TAG_END
1154 >                                        );
1155 >                                        LT_New(h, LA_Type, INTEGER_KIND,
1156 >                                                LA_LabelID, STR_UNIT_CTRL,
1157 >                                                LA_ID, GAD_SCSI0_UNIT + i,
1158 >                                                LA_Chars, 4,
1159 >                                                LA_LONG, (ULONG)&scsi_unit[i],
1160 >                                                LAIN_UseIncrementers, TRUE,
1161 >                                                GTIN_MaxChars, 8,
1162 >                                                TAG_END
1163 >                                        );
1164 >                                ENDGROUP;
1165 >                        }
1166 >                ENDGROUP;
1167 >                VGROUP;
1168 >                        LT_New(h, LA_Type, CYCLE_KIND,
1169 >                                LA_LabelID, STR_SCSI_MEMTYPE_CTRL,
1170 >                                LA_ID, GAD_SCSI_MEMTYPE,
1171 >                                LACY_FirstLabel, STR_MEMTYPE_CHIP_LAB,
1172 >                                LACY_LastLabel, STR_MEMTYPE_ANY_LAB,
1173 >                                LA_LONG, (ULONG)&scsi_memtype,
1174 >                                TAG_END
1175 >                        );
1176 >                ENDGROUP;
1177          ENDGROUP;
1178   }
1179  
# Line 1119 | Line 1189 | enum {
1189          DISPLAY_SCREEN
1190   };
1191  
1192 < static BYTE display_type;
1192 > static LONG display_type;
1193   static LONG dis_width, dis_height;
1194   static ULONG mode_id;
1195   static BYTE frameskip_num;
# Line 1163 | Line 1233 | static void parse_graphics_prefs(void)
1233  
1234          const char *str = PrefsFindString("screen");
1235          if (str) {
1236 <                if (sscanf(str, "win/%d/%d", &dis_width, &dis_height) == 2)
1236 >                if (sscanf(str, "win/%ld/%ld", &dis_width, &dis_height) == 2)
1237                          display_type = DISPLAY_WINDOW;
1238 <                else if (sscanf(str, "pip/%d/%d", &dis_width, &dis_height) == 2)
1238 >                else if (sscanf(str, "pip/%ld/%ld", &dis_width, &dis_height) == 2)
1239                          display_type = DISPLAY_PIP;
1240                  else if (sscanf(str, "scr/%08lx", &mode_id) == 1)
1241                          display_type = DISPLAY_SCREEN;
# Line 1177 | Line 1247 | static void parse_graphics_prefs(void)
1247          if (str) {
1248                  if (sscanf(str, "ahi/%08lx", &ahi_id) == 1 && AHIBase) {
1249                          AHI_GetAudioAttrs(ahi_id, NULL,
1250 <                                AHIDB_Name, ahi_mode_name,
1250 >                                AHIDB_Name, (ULONG)ahi_mode_name,
1251                                  AHIDB_BufferLen, sizeof(ahi_mode_name) - 1,
1252                                  TAG_END
1253                          );
# Line 1217 | Line 1287 | static void ghost_graphics_gadgets(struc
1287   // Show screen mode requester
1288   static void screen_mode_req(struct Window *win, struct LayoutHandle *h)
1289   {
1290 <        if (P96Base == NULL)
1290 >        if (P96Base == NULL && CyberGfxBase == NULL)
1291                  return;
1292  
1293          LT_LockWindow(win);
1294 <        ULONG id = p96RequestModeIDTags(
1295 <                P96MA_MinDepth, 8,
1296 <                P96MA_FormatsAllowed, RGBFF_CLUT | RGBFF_R5G5B5 | RGBFF_A8R8G8B8,
1297 <                TAG_END
1298 <        );
1294 >
1295 >        ULONG id;
1296 >
1297 >        // Try P96 first, because it also provides a (fake) cybergraphics.library
1298 >        if (P96Base) {
1299 >                id = p96RequestModeIDTags(
1300 >                        P96MA_MinDepth, 8,
1301 >                        P96MA_FormatsAllowed, RGBFF_CLUT | RGBFF_R5G5B5 | RGBFF_A8R8G8B8,
1302 >                        TAG_END
1303 >                );
1304 >        } else {
1305 >                UWORD ModelArray[] = { PIXFMT_LUT8, PIXFMT_RGB15, PIXFMT_ARGB32, 0, ~0 };
1306 >                id = (ULONG) CModeRequestTags(NULL,
1307 >                        CYBRMREQ_MinDepth, 8,
1308 >                        CYBRMREQ_CModelArray, (ULONG) ModelArray,
1309 >                        TAG_END
1310 >                );
1311 >        }
1312          LT_UnlockWindow(win);
1313  
1314          if (id != INVALID_ID) {
1315                  mode_id = id;
1316                  GetDisplayInfoData(NULL, (UBYTE *)&mode_name, sizeof(mode_name), DTAG_NAME, mode_id);
1317 <                LT_SetAttributes(h, GAD_SCREEN_MODE, GTTX_Text, mode_name.Name, TAG_END);
1317 >                LT_SetAttributes(h, GAD_SCREEN_MODE, GTTX_Text, (ULONG)mode_name.Name, TAG_END);
1318          }
1319   }
1320  
# Line 1242 | Line 1325 | static void ahi_mode_req(struct Window *
1325                  return;
1326  
1327          struct AHIAudioModeRequester *req = AHI_AllocAudioRequest(
1328 <                AHIR_Window, win,
1328 >                AHIR_Window, (ULONG)win,
1329                  TAG_END
1330          );
1331          if (req == NULL)
# Line 1258 | Line 1341 | static void ahi_mode_req(struct Window *
1341          if (ok) {
1342                  ahi_id = req->ahiam_AudioID;
1343                  AHI_GetAudioAttrs(ahi_id, NULL,
1344 <                        AHIDB_Name, ahi_mode_name,
1344 >                        AHIDB_Name, (ULONG)ahi_mode_name,
1345                          AHIDB_BufferLen, sizeof(ahi_mode_name) - 1,
1346                          TAG_END
1347                  );
1348 <                LT_SetAttributes(h, GAD_AHI_MODE, GTTX_Text, ahi_mode_name, TAG_END);
1348 >                LT_SetAttributes(h, GAD_AHI_MODE, GTTX_Text, (ULONG)ahi_mode_name, TAG_END);
1349          }
1350          AHI_FreeAudioRequest(req);
1351   }
# Line 1307 | Line 1390 | static void create_graphics_pane(struct
1390                          LT_New(h, LA_Type, CYCLE_KIND,
1391                                  LA_LabelID, STR_VIDEO_TYPE_CTRL,
1392                                  LA_ID, GAD_VIDEO_TYPE,
1393 <                                LACY_LabelTable, labels,
1394 <                                LA_BYTE, &display_type,
1393 >                                LACY_LabelTable, (ULONG)labels,
1394 >                                LA_LONG, (ULONG)&display_type,
1395                                  TAG_END
1396                          );
1397                          LT_New(h, LA_Type, INTEGER_KIND,
1398                                  LA_LabelID, STR_DISPLAY_X_CTRL,
1399                                  LA_ID, GAD_DISPLAY_X,
1400 <                                LA_LONG, &dis_width,
1400 >                                LA_LONG, (ULONG)&dis_width,
1401                                  GTIN_MaxChars, 8,
1402                                  TAG_END
1403                          );
1404                          LT_New(h, LA_Type, INTEGER_KIND,
1405                                  LA_LabelID, STR_DISPLAY_Y_CTRL,
1406                                  LA_ID, GAD_DISPLAY_Y,
1407 <                                LA_LONG, &dis_height,
1407 >                                LA_LONG, (ULONG)&dis_height,
1408                                  GTIN_MaxChars, 8,
1409                                  TAG_END
1410                          );
# Line 1330 | Line 1413 | static void create_graphics_pane(struct
1413                                  LA_ID, GAD_FRAMESKIP,
1414                                  LAPU_FirstLabel, STR_REF_5HZ_LAB,
1415                                  LAPU_LastLabel, STR_REF_60HZ_LAB,
1416 <                                LA_BYTE, &frameskip_num,
1416 >                                LA_BYTE, (ULONG)&frameskip_num,
1417                                  TAG_END
1418                          );
1419                          LT_New(h, LA_Type, TEXT_KIND,
# Line 1338 | Line 1421 | static void create_graphics_pane(struct
1421                                  LA_ID, GAD_SCREEN_MODE,
1422                                  LA_Chars, DISPLAYNAMELEN,
1423                                  LATX_Picker, TRUE,
1424 <                                GTTX_Text, mode_name.Name,
1424 >                                GTTX_Text, (ULONG)mode_name.Name,
1425                                  GTTX_Border, TRUE,
1426                                  TAG_END
1427                          );
# Line 1352 | Line 1435 | static void create_graphics_pane(struct
1435                                  LA_ID, GAD_AHI_MODE,
1436                                  LA_Chars, DISPLAYNAMELEN,
1437                                  LATX_Picker, TRUE,
1438 <                                GTTX_Text, ahi_mode_name,
1438 >                                GTTX_Text, (ULONG)ahi_mode_name,
1439                                  GTTX_Border, TRUE,
1440                                  TAG_END
1441                          );
1442                          LT_New(h, LA_Type, CHECKBOX_KIND,
1443                                  LA_LabelID, STR_NOSOUND_CTRL,
1444                                  LA_ID, GAD_NOSOUND,
1445 <                                LA_BYTE, &nosound,
1445 >                                LA_BYTE, (ULONG)&nosound,
1446                                  TAG_END
1447                          );
1448                  ENDGROUP;
# Line 1381 | Line 1464 | static char ether_dev[256];
1464   static ULONG ether_unit;
1465  
1466   // Read serial/network preferences
1467 < static void parse_serial_prefs(const char *prefs, char *dev, LONG &unit, BYTE &ispar)
1467 > static void parse_ser_prefs(const char *prefs, char *dev, LONG &unit, BYTE &ispar)
1468   {
1469          dev[0] = 0;
1470          unit = 0;
# Line 1395 | Line 1478 | static void parse_serial_prefs(const cha
1478                  }
1479                  sscanf(str, "%[^/]/%ld", dev, &unit);
1480          }
1481 + }
1482 +
1483 + static void parse_serial_prefs(void)
1484 + {
1485 +        parse_ser_prefs("seriala", seriala_dev, seriala_unit, seriala_ispar);
1486 +        parse_ser_prefs("serialb", serialb_dev, serialb_unit, serialb_ispar);
1487  
1488          ether_dev[0] = 0;
1489          ether_unit = 0;
1490  
1491 <        str = PrefsFindString("ether");
1492 <        if (str)
1493 <                sscanf(str, "%[^/]/%ld", ether_dev, &ether_unit);
1491 >        const char *str = PrefsFindString("ether");
1492 >        if (str) {
1493 >                const char *FirstSlash = strchr(str, '/');
1494 >                const char *LastSlash = strrchr(str, '/');
1495 >
1496 >                if (FirstSlash && FirstSlash && FirstSlash != LastSlash) {
1497 >                        // Device name contains path, i.e. "Networks/xyzzy.device"
1498 >                        const char *lp = str;
1499 >                        char *dp = ether_dev;
1500 >
1501 >                        while (lp != LastSlash)
1502 >                                *dp++ = *lp++;
1503 >                        *dp = '\0';
1504 >
1505 >                        sscanf(LastSlash, "/%ld", &ether_unit);
1506 >
1507 > //                      printf("dev=<%s> unit=%d\n", ether_dev, ether_unit);
1508 >                } else {
1509 >                        sscanf(str, "%[^/]/%ld", ether_dev, &ether_unit);
1510 >                }
1511 >        }
1512   }
1513  
1514   // Set serial preference item
# Line 1423 | Line 1530 | static void read_serial_settings(void)
1530  
1531          if (strlen(ether_dev)) {
1532                  char str[256];
1533 +
1534                  sprintf(str, "%s/%ld", ether_dev, ether_unit);
1535                  PrefsReplaceString("ether", str);
1536          } else
# Line 1432 | Line 1540 | static void read_serial_settings(void)
1540   // Create "Serial/Network" pane
1541   static void create_serial_pane(struct LayoutHandle *h)
1542   {
1543 <        parse_serial_prefs("seriala", seriala_dev, seriala_unit, seriala_ispar);
1436 <        parse_serial_prefs("serialb", serialb_dev, serialb_unit, serialb_ispar);
1543 >        parse_serial_prefs();
1544  
1545          VGROUP;
1546                  LT_New(h, LA_Type, VERTICAL_KIND,
# Line 1444 | Line 1551 | static void create_serial_pane(struct La
1551                                  LA_LabelID, STR_DEVICE_CTRL,
1552                                  LA_ID, GAD_SERIALA_DEVICE,
1553                                  LA_Chars, 20,
1554 <                                LA_STRPTR, seriala_dev,
1554 >                                LA_STRPTR, (ULONG)seriala_dev,
1555                                  GTST_MaxChars, sizeof(seriala_dev) - 1,
1556                                  LAST_Picker, TRUE,
1557                                  TAG_END
# Line 1452 | Line 1559 | static void create_serial_pane(struct La
1559                          LT_New(h, LA_Type, INTEGER_KIND,
1560                                  LA_LabelID, STR_UNIT_CTRL,
1561                                  LA_ID, GAD_SERIALA_UNIT,
1562 <                                LA_LONG, &seriala_unit,
1562 >                                LA_LONG, (ULONG)&seriala_unit,
1563                                  LAIN_UseIncrementers, TRUE,
1564                                  GTIN_MaxChars, 8,
1565                                  TAG_END
# Line 1460 | Line 1567 | static void create_serial_pane(struct La
1567                          LT_New(h, LA_Type, CHECKBOX_KIND,
1568                                  LA_LabelID, STR_ISPAR_CTRL,
1569                                  LA_ID, GAD_SERIALA_ISPAR,
1570 <                                LA_BYTE, &seriala_ispar,
1570 >                                LA_BYTE, (ULONG)&seriala_ispar,
1571                                  TAG_END
1572                          );
1573                  ENDGROUP;
# Line 1473 | Line 1580 | static void create_serial_pane(struct La
1580                                  LA_LabelID, STR_DEVICE_CTRL,
1581                                  LA_ID, GAD_SERIALB_DEVICE,
1582                                  LA_Chars, 20,
1583 <                                LA_STRPTR, serialb_dev,
1583 >                                LA_STRPTR, (ULONG)serialb_dev,
1584                                  GTST_MaxChars, sizeof(serialb_dev) - 1,
1585                                  LAST_Picker, TRUE,
1586                                  TAG_END
# Line 1481 | Line 1588 | static void create_serial_pane(struct La
1588                          LT_New(h, LA_Type, INTEGER_KIND,
1589                                  LA_LabelID, STR_UNIT_CTRL,
1590                                  LA_ID, GAD_SERIALB_UNIT,
1591 <                                LA_LONG, &serialb_unit,
1591 >                                LA_LONG, (ULONG)&serialb_unit,
1592                                  LAIN_UseIncrementers, TRUE,
1593                                  GTIN_MaxChars, 8,
1594                                  TAG_END
# Line 1489 | Line 1596 | static void create_serial_pane(struct La
1596                          LT_New(h, LA_Type, CHECKBOX_KIND,
1597                                  LA_LabelID, STR_ISPAR_CTRL,
1598                                  LA_ID, GAD_SERIALB_ISPAR,
1599 <                                LA_BYTE, &serialb_ispar,
1599 >                                LA_BYTE, (ULONG)&serialb_ispar,
1600                                  TAG_END
1601                          );
1602                  ENDGROUP;
# Line 1502 | Line 1609 | static void create_serial_pane(struct La
1609                                  LA_LabelID, STR_DEVICE_CTRL,
1610                                  LA_ID, GAD_ETHER_DEVICE,
1611                                  LA_Chars, 20,
1612 <                                LA_STRPTR, ether_dev,
1612 >                                LA_STRPTR, (ULONG)ether_dev,
1613                                  GTST_MaxChars, sizeof(ether_dev) - 1,
1614                                  LAST_Picker, TRUE,
1615                                  TAG_END
# Line 1510 | Line 1617 | static void create_serial_pane(struct La
1617                          LT_New(h, LA_Type, INTEGER_KIND,
1618                                  LA_LabelID, STR_UNIT_CTRL,
1619                                  LA_ID, GAD_ETHER_UNIT,
1620 <                                LA_LONG, &ether_unit,
1620 >                                LA_LONG, (ULONG)&ether_unit,
1621                                  LAIN_UseIncrementers, TRUE,
1622                                  GTIN_MaxChars, 8,
1623                                  TAG_END
# Line 1573 | Line 1680 | static void create_memory_pane(struct La
1680                          LA_LabelID, STR_RAMSIZE_SLIDER,
1681                          LA_ID, GAD_RAMSIZE,
1682                          LA_Chars, 20,
1683 <                        LA_LONG, &ramsize_mb,
1684 <                        GTSL_LevelFormat, GetString(STR_RAMSIZE_FMT),
1683 >                        LA_LONG, (ULONG)&ramsize_mb,
1684 >                        GTSL_LevelFormat, (ULONG)GetString(STR_RAMSIZE_FMT),
1685                          GTSL_Min, 1,
1686                          GTSL_Max, AvailMem(MEMF_LARGEST) >> 20,
1687                          TAG_END
# Line 1584 | Line 1691 | static void create_memory_pane(struct La
1691                          LA_ID, GAD_MODELID,
1692                          LACY_FirstLabel, STR_MODELID_5_LAB,
1693                          LACY_LastLabel, STR_MODELID_14_LAB,
1694 <                        LA_BYTE, &model_num,
1694 >                        LA_BYTE, (ULONG)&model_num,
1695                          TAG_END
1696                  );
1697                  LT_New(h, LA_Type, STRING_KIND,
1698                          LA_LabelID, STR_ROM_FILE_CTRL,
1699                          LA_ID, GAD_ROM_FILE,
1700                          LA_Chars, 20,
1701 <                        LA_STRPTR, rom_file,
1701 >                        LA_STRPTR, (ULONG)rom_file,
1702                          GTST_MaxChars, sizeof(rom_file) - 1,
1703                          LAST_Picker, TRUE,
1704                          TAG_END

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines