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.1.1 by cebix, 1999-10-03T14:16:25Z vs.
Revision 1.19 by gbeauche, 2008-01-01T09:40:31Z

# 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-2008 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 + #define __USE_SYSBASE
34   #include <proto/exec.h>
35   #include <proto/dos.h>
36   #include <proto/intuition.h>
# Line 37 | Line 39
39   #include <proto/graphics.h>
40   #include <proto/asl.h>
41   #include <proto/Picasso96.h>
42 + #include <proto/cybergraphics.h>
43   #include <proto/ahi.h>
44 + #include <inline/exec.h>
45 + #include <inline/dos.h>
46 + #include <inline/intuition.h>
47 + #include <inline/gadtools.h>
48 + #include <inline/gtlayout.h>
49 + #include <inline/graphics.h>
50 + #include <inline/asl.h>
51 + #include <inline/Picasso96.h>
52 + #include <inline/cybergraphics.h>
53 + #include <inline/cybergraphics.h>
54 + #include <inline/ahi.h>
55 + #include <clib/alib_protos.h>
56  
57   #include "sysdeps.h"
58   #include "main.h"
# Line 65 | Line 80 | const int GAD_CDROM_DEVICE = 0x0304;
80   const int GAD_CDROM_UNIT = 0x0305;
81   const int GAD_BOOTDRIVER = 0x0306;
82   const int GAD_NOCDROM = 0x0307;
83 + const int GAD_EXTFS = 0x0308;
84  
85   const int GAD_VOLUME_READONLY = 0x0310;         // "Add/Edit Volume" window
86   const int GAD_VOLUME_TYPE = 0x0311;
# Line 91 | Line 107 | const int GAD_SCSI3_UNIT = 0x0413;
107   const int GAD_SCSI4_UNIT = 0x0414;
108   const int GAD_SCSI5_UNIT = 0x0415;
109   const int GAD_SCSI6_UNIT = 0x0416;
110 + const int GAD_SCSI_MEMTYPE = 0x0420;
111  
112   const int GAD_VIDEO_TYPE = 0x0500;                      // "Graphics/Sound" pane
113   const int GAD_DISPLAY_X = 0x0501;
# Line 139 | Line 156 | static void read_settings(struct LayoutH
156  
157  
158   /*
159 < *  Locale hook function - returns string for given ID
159 > *  Locale hook - returns string for given ID
160   */
161  
162 < static __saveds __asm char *locale_hook_func(register __a0 struct Hook *hook, register __a2 struct LayoutHandle *h, register __a1 LONG id)
162 > static __saveds __attribute__((regparm(3))) const char *locale_hook_func(struct Hook *hook /*a0*/, void *id /*a1*/, struct LayoutHandle *h /*a2*/)
163   {
164 <        return GetString(id);
164 >        return GetString((uint32)id);
165   }
166  
167   struct Hook locale_hook = {{NULL, NULL}, (HOOKFUNC)locale_hook_func, NULL, NULL};
# Line 162 | Line 179 | bool PrefsEditor(void)
179          struct Window *win = NULL;
180          struct Menu *menu = NULL;
181  
182 +        // Pane tabs
183 +        static const LONG labels[] = {
184 +                STR_VOLUMES_PANE_TITLE,
185 +                STR_SCSI_PANE_TITLE,
186 +                STR_GRAPHICS_SOUND_PANE_TITLE,
187 +                STR_SERIAL_NETWORK_PANE_TITLE,
188 +                STR_MEMORY_MISC_PANE_TITLE,
189 +                -1
190 +        };
191 +
192          // Open gtlayout.library
193 <        GTLayoutBase = (struct Library *)OpenLibrary((UBYTE *)"gtlayout.library", 39);
193 >        GTLayoutBase = (struct Library *)OpenLibrary("gtlayout.library", 39);
194          if (GTLayoutBase == NULL) {
195                  WarningAlert(GetString(STR_NO_GTLAYOUT_LIB_WARN));
196 <                goto quit;
196 >                return true;
197          }
198  
199          // Create layout handle
200          h = LT_CreateHandleTags(NULL,
201                  LAHN_AutoActivate, FALSE,
202 <                LAHN_LocaleHook, &locale_hook,
202 >                LAHN_LocaleHook, (ULONG)&locale_hook,
203                  TAG_END
204          );
205          if (h == NULL)
# Line 180 | Line 207 | bool PrefsEditor(void)
207  
208          // Create menus
209          menu = LT_NewMenuTags(
210 <                LAMN_LayoutHandle, h,
210 >                LAMN_LayoutHandle, (ULONG)h,
211                  LAMN_TitleID, STR_PREFS_MENU,
212                  LAMN_ItemID, STR_PREFS_ITEM_ABOUT,
213                  LAMN_UserData, MSG_ABOUT,
214 <                LAMN_ItemText, NM_BARLABEL,
214 >                LAMN_ItemText, (ULONG)NM_BARLABEL,
215                  LAMN_ItemID, STR_PREFS_ITEM_START,
216                  LAMN_UserData, MSG_OK,
217                  LAMN_ItemID, STR_PREFS_ITEM_ZAP_PRAM,
218                  LAMN_UserData, MSG_ZAP_PRAM,
219 <                LAMN_ItemText, NM_BARLABEL,
219 >                LAMN_ItemText, (ULONG)NM_BARLABEL,
220                  LAMN_ItemID, STR_PREFS_ITEM_QUIT,
221                  LAMN_UserData, MSG_CANCEL,
222 <                LAMN_KeyText, "Q",
222 >                LAMN_KeyText, (ULONG)"Q",
223                  TAG_END
224          );
225  
226          // Create window contents
227          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                };
228                  VGROUP;
229                          LT_New(h, LA_Type, TAB_KIND,
230 <                                LATB_LabelTable, labels,
230 >                                LATB_LabelTable, (ULONG)labels,
231                                  LATB_AutoPageID, GAD_PAGEGROUP,
232                                  LATB_FullWidth, TRUE,
233                                  TAG_END
# Line 261 | Line 279 | bool PrefsEditor(void)
279          // Open window
280          win = LT_Build(h,
281                  LAWN_TitleID, STR_PREFS_TITLE,
282 <                LAWN_Menu, menu,
282 >                LAWN_Menu, (ULONG)menu,
283                  LAWN_IDCMP, IDCMP_CLOSEWINDOW,
284                  LAWN_BelowMouse, TRUE,
285                  LAWN_SmartZoom, TRUE,
# Line 279 | Line 297 | bool PrefsEditor(void)
297          dev_request = (struct FileRequester *)AllocAslRequestTags(ASL_FileRequest,
298                  ASLFR_DoPatterns, TRUE,
299                  ASLFR_RejectIcons, TRUE,
300 <                ASLFR_InitialDrawer, "DEVS:",
301 <                ASLFR_InitialPattern, "#?.device",
300 >                ASLFR_InitialDrawer, (ULONG)"DEVS:",
301 >                ASLFR_InitialPattern, (ULONG)"#?.device",
302                  TAG_END
303          );
304          file_request = (struct FileRequester *)AllocAslRequestTags(ASL_FileRequest,
305                  ASLFR_DoPatterns, TRUE,
306                  ASLFR_RejectIcons, TRUE,
307 <                ASLFR_InitialPattern, "#?",
307 >                ASLFR_InitialPattern, (ULONG)"#?",
308                  TAG_END
309          );
310  
# Line 350 | Line 368 | bool PrefsEditor(void)
368                                                  case GAD_BOOTDRIVER:
369                                                          switch (code) {
370                                                                  case 0:
371 <                                                                        PrefsReplaceInt16("bootdriver", 0);
371 >                                                                        PrefsReplaceInt32("bootdriver", 0);
372                                                                          break;
373                                                                  case 1:
374 <                                                                        PrefsReplaceInt16("bootdriver", CDROMRefNum);
374 >                                                                        PrefsReplaceInt32("bootdriver", CDROMRefNum);
375                                                                          break;
376                                                          }
377                                                          break;
378  
379 +                                                case GAD_SCSI_MEMTYPE:
380 +                                                        PrefsReplaceInt32("scsimemtype", code);
381 +                                                        break;
382 +
383                                                  case GAD_VIDEO_TYPE:
384                                                          ghost_graphics_gadgets(h);
385                                                          break;
# Line 424 | Line 446 | bool PrefsEditor(void)
446                                                  case GAD_SCSI6_DEVICE:
447                                                  case GAD_SERIALA_DEVICE:
448                                                  case GAD_SERIALB_DEVICE:
449 +                                                        if (dev_request) {
450 +                                                                LT_LockWindow(win);
451 +                                                                BOOL result = AslRequestTags(dev_request,
452 +                                                                        ASLFR_Window, (ULONG)win,
453 +                                                                        ASLFR_InitialDrawer, (ULONG) "Devs:",
454 +                                                                        TAG_END);
455 +                                                                LT_UnlockWindow(win);
456 +                                                                if (result) {
457 +                                                                        char *str;
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, (ULONG)str, TAG_END);
462 +                                                                }
463 +                                                        }
464 +                                                        break;
465 +
466                                                  case GAD_ETHER_DEVICE:
467                                                          if (dev_request) {
468                                                                  LT_LockWindow(win);
469 <                                                                BOOL result = AslRequestTags(dev_request, ASLFR_Window, win, TAG_END);
469 >                                                                BOOL result = AslRequestTags(dev_request,
470 >                                                                        ASLFR_Window, (ULONG)win,
471 >                                                                        ASLFR_InitialDrawer, (ULONG) "Devs:Networks",
472 >                                                                        TAG_END);
473                                                                  LT_UnlockWindow(win);
474                                                                  if (result) {
475                                                                          char *str;
476 <                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, &str, TAG_END);
476 >                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, (ULONG)&str, TAG_END);
477                                                                          strncpy(str, dev_request->rf_File, 255);        // Don't copy the directory part. This is usually "DEVS:" and we don't need that.
478                                                                          str[255] = 0;
479 <                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, str, TAG_END);
479 >                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, (ULONG)str, TAG_END);
480                                                                  }
481                                                          }
482                                                          break;
# Line 442 | Line 484 | bool PrefsEditor(void)
484                                                  case GAD_ROM_FILE:
485                                                          if (file_request) {
486                                                                  LT_LockWindow(win);
487 <                                                                BOOL result = AslRequestTags(file_request, ASLFR_Window, win, TAG_END);
487 >                                                                BOOL result = AslRequestTags(file_request, ASLFR_Window, (ULONG)win, TAG_END);
488                                                                  LT_UnlockWindow(win);
489                                                                  if (result) {
490                                                                          char *str;
491 <                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, &str, TAG_END);
491 >                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, (ULONG)&str, TAG_END);
492                                                                          strncpy(str, file_request->rf_Dir, 255);
493                                                                          str[255] = 0;
494                                                                          AddPart(str, file_request->rf_File, 255);
495 <                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, str, TAG_END);
495 >                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, (ULONG)str, TAG_END);
496                                                                  }
497                                                          }
498                                                          break;
# Line 509 | Line 551 | quit:
551          FreeAslRequest(dev_request);
552          FreeAslRequest(file_request);
553  
554 +        // Delete Menus
555 +        LT_DisposeMenu(menu);
556 +
557          // Delete handle
558          LT_DeleteHandle(h);
559  
# Line 523 | Line 568 | quit:
568   */
569  
570   static struct List disk_list;
571 < static char cdrom_name[256];
571 > static char cdrom_name[256], extfs_name[256];
572   static ULONG cdrom_unit, cdrom_flags, cdrom_start, cdrom_size, cdrom_bsize;
573   static BYTE bootdriver_num, nocdrom;
574  
# Line 547 | Line 592 | static void parse_volumes_prefs(void)
592  
593          bootdriver_num = 0;
594  
595 <        int bootdriver = PrefsFindInt16("bootdriver");
595 >        int bootdriver = PrefsFindInt32("bootdriver");
596          switch (bootdriver) {
597                  case 0:
598                          bootdriver_num = 0;
# Line 558 | Line 603 | static void parse_volumes_prefs(void)
603          }
604  
605          nocdrom = PrefsFindBool("nocdrom");
606 +
607 +        extfs_name[0] = 0;
608 +        str = PrefsFindString("extfs");
609 +        if (str)
610 +                strncpy(extfs_name, str, sizeof(extfs_name) - 1);
611   }
612  
613   // Ghost/unghost "Edit" and "Remove" buttons
# Line 644 | Line 694 | static void add_edit_volume(struct Layou
694          struct Window *win = NULL;
695          h = LT_CreateHandleTags(NULL,
696                  LAHN_AutoActivate, FALSE,
697 <                LAHN_LocaleHook, &locale_hook,
697 >                LAHN_LocaleHook, (ULONG)&locale_hook,
698                  TAG_END
699          );
700          if (h == NULL)
# Line 657 | Line 707 | static void add_edit_volume(struct Layou
707                          LT_New(h, LA_Type, CHECKBOX_KIND,
708                                  LA_LabelID, STR_VOL_READONLY_CTRL,
709                                  LA_ID, GAD_VOLUME_READONLY,
710 <                                LA_BYTE, &read_only,
710 >                                LA_BYTE, (ULONG)&read_only,
711                                  TAG_END
712                          );
713                          LT_New(h, LA_Type, CYCLE_KIND,
# Line 666 | Line 716 | static void add_edit_volume(struct Layou
716                                  LACY_AutoPageID, GAD_VOLUME_PAGEGROUP,
717                                  LACY_FirstLabel, STR_VOL_FILE_LAB,
718                                  LACY_LastLabel, STR_VOL_DEVICE_LAB,
719 <                                LA_BYTE, &is_device,
719 >                                LA_BYTE, (ULONG)&is_device,
720                                  TAG_END
721                          );
722                  ENDGROUP;
# Line 680 | Line 730 | static void add_edit_volume(struct Layou
730                                          LA_LabelID, STR_VOL_FILE_CTRL,
731                                          LA_ID, GAD_VOLUME_FILE,
732                                          LA_Chars, 20,
733 <                                        LA_STRPTR, file_name,
733 >                                        LA_STRPTR, (ULONG)file_name,
734                                          GTST_MaxChars, sizeof(file_name) - 1,
735                                          LAST_Picker, TRUE,
736                                          TAG_END
# Line 691 | Line 741 | static void add_edit_volume(struct Layou
741                                          LA_LabelID, STR_DEVICE_CTRL,
742                                          LA_ID, GAD_VOLUME_DEVICE,
743                                          LA_Chars, 20,
744 <                                        LA_STRPTR, dev_name,
744 >                                        LA_STRPTR, (ULONG)dev_name,
745                                          GTST_MaxChars, sizeof(dev_name) - 1,
746                                          LAST_Picker, TRUE,
747                                          TAG_END
# Line 699 | Line 749 | static void add_edit_volume(struct Layou
749                                  LT_New(h, LA_Type, INTEGER_KIND,
750                                          LA_LabelID, STR_UNIT_CTRL,
751                                          LA_ID, GAD_VOLUME_UNIT,
752 <                                        LA_LONG, &dev_unit,
752 >                                        LA_LONG, (ULONG)&dev_unit,
753                                          LAIN_UseIncrementers, TRUE,
754                                          GTIN_MaxChars, 8,
755                                          TAG_END
# Line 707 | Line 757 | static void add_edit_volume(struct Layou
757                                  LT_New(h, LA_Type, INTEGER_KIND,
758                                          LA_LabelID, STR_VOL_OPENFLAGS_CTRL,
759                                          LA_ID, GAD_VOLUME_OPENFLAGS,
760 <                                        LA_LONG, &dev_flags,
760 >                                        LA_LONG, (ULONG)&dev_flags,
761                                          LAIN_UseIncrementers, TRUE,
762                                          GTIN_MaxChars, 8,
763                                          TAG_END
# Line 715 | Line 765 | static void add_edit_volume(struct Layou
765                                  LT_New(h, LA_Type, INTEGER_KIND,
766                                          LA_LabelID, STR_VOL_STARTBLOCK_CTRL,
767                                          LA_ID, GAD_VOLUME_STARTBLOCK,
768 <                                        LA_LONG, &dev_start,
768 >                                        LA_LONG, (ULONG)&dev_start,
769                                          LAIN_UseIncrementers, TRUE,
770                                          GTIN_MaxChars, 8,
771                                          TAG_END
# Line 723 | Line 773 | static void add_edit_volume(struct Layou
773                                  LT_New(h, LA_Type, INTEGER_KIND,
774                                          LA_LabelID, STR_VOL_SIZE_CTRL,
775                                          LA_ID, GAD_VOLUME_SIZE,
776 <                                        LA_LONG, &dev_size,
776 >                                        LA_LONG, (ULONG)&dev_size,
777                                          LAIN_UseIncrementers, TRUE,
778                                          GTIN_MaxChars, 8,
779                                          TAG_END
# Line 731 | Line 781 | static void add_edit_volume(struct Layou
781                                  LT_New(h, LA_Type, INTEGER_KIND,
782                                          LA_LabelID, STR_VOL_BLOCKSIZE_CTRL,
783                                          LA_ID, GAD_VOLUME_BLOCKSIZE,
784 <                                        LA_LONG, &dev_bsize,
784 >                                        LA_LONG, (ULONG)&dev_bsize,
785                                          LAIN_UseIncrementers, TRUE,
786                                          GTIN_MaxChars, 8,
787                                          TAG_END
# Line 831 | Line 881 | static void add_edit_volume(struct Layou
881                                                          req = dev_request;
882   do_req:                                         if (req) {
883                                                                  LT_LockWindow(win);
884 <                                                                BOOL result = AslRequestTags(req, ASLFR_Window, win, TAG_END);
884 >                                                                BOOL result = AslRequestTags(req, ASLFR_Window, (ULONG)win, TAG_END);
885                                                                  LT_UnlockWindow(win);
886                                                                  if (result) {
887                                                                          char *str;
888 <                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, &str, TAG_END);
888 >                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, (ULONG)&str, TAG_END);
889                                                                          if (gad->GadgetID == GAD_VOLUME_FILE) {
890                                                                                  strncpy(str, req->rf_Dir, 255);
891                                                                                  str[255] = 0;
# Line 853 | Line 903 | do_req:                                                if (req) {
903                                                                                          LT_SetAttributes(h, GAD_VOLUME_BLOCKSIZE, GTIN_Number, dev_bsize, TAG_END);
904                                                                                  }
905                                                                          }
906 <                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, str, TAG_END);
906 >                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, (ULONG)str, TAG_END);
907                                                                  }
908                                                          }
909                                                          break;
# Line 864 | Line 914 | do_req:                                                if (req) {
914                  }
915          } while (!done);
916  
867        // Delete handle
868        LT_DeleteHandle(h);
869
917          // Update preferences and list view
918          if (ok_clicked) {
919                  char str[256];
# Line 881 | Line 928 | do_req:                                                if (req) {
928                  if (adding) {
929  
930                          // Add new item
931 +                        int i;
932                          PrefsAddString("disk", str);
933                          struct Node *item = (struct Node *)AllocMem(sizeof(struct Node), MEMF_CLEAR);
934 <                        for (int i=0; PrefsFindString("disk", i); i++) ;
934 >                        for (i=0; PrefsFindString("disk", i); i++) ;
935                          item->ln_Name = (char *)PrefsFindString("disk", i - 1);
936                          AddTail(&disk_list, item);
937  
# Line 900 | Line 948 | do_req:                                                if (req) {
948                                  item = item->ln_Succ;
949                          }
950                  }
951 <                LT_SetAttributes(h2, GAD_DISK_LIST, GTLV_Labels, &disk_list, TAG_END);
951 >                LT_SetAttributes(h2, GAD_DISK_LIST, GTLV_Labels, (ULONG)&disk_list, TAG_END);
952                  ghost_volumes_gadgets(h2);
953          }
954 +
955 +        // Delete handle
956 +        LT_DeleteHandle(h);
957   }
958  
959   // Remove volume from list
# Line 924 | Line 975 | static void remove_volume(struct LayoutH
975                          }
976                          item = next;
977                  }
978 <                LT_SetAttributes(h, GAD_DISK_LIST, GTLV_Labels, &disk_list, GTLV_Selected, 0xffff, TAG_END);
978 >                LT_SetAttributes(h, GAD_DISK_LIST, GTLV_Labels, (ULONG)&disk_list, GTLV_Selected, 0xffff, TAG_END);
979                  ghost_volumes_gadgets(h);
980          }
981   }
# Line 948 | Line 999 | static void read_volumes_settings(void)
999                  PrefsRemoveItem("cdrom");
1000  
1001          PrefsReplaceBool("nocdrom", nocdrom);
1002 +
1003 +        if (strlen(extfs_name))
1004 +                PrefsReplaceString("extfs", extfs_name);
1005   }
1006  
1007   // Create "Volumes" pane
# Line 963 | Line 1017 | static void create_volumes_pane(struct L
1017                          VGROUP;
1018                                  LT_New(h, LA_Type, LISTVIEW_KIND,
1019                                          LA_ID, GAD_DISK_LIST,
1020 <                                        GTLV_Labels, &disk_list,
1020 >                                        LA_Chars, 20,
1021 >                                        GTLV_Labels, (ULONG)&disk_list,
1022                                          LALV_Lines, 6,
1023 <                                        LALV_Link, NIL_LINK,
1023 >                                        LALV_Link, (ULONG)NIL_LINK,
1024                                          LALV_ResizeX, TRUE,
1025                                          LALV_ResizeY, TRUE,
1026                                          LALV_Selected, 0,
# Line 1002 | Line 1057 | static void create_volumes_pane(struct L
1057                                  LA_LabelID, STR_DEVICE_CTRL,
1058                                  LA_ID, GAD_CDROM_DEVICE,
1059                                  LA_Chars, 20,
1060 <                                LA_STRPTR, cdrom_name,
1060 >                                LA_STRPTR, (ULONG)cdrom_name,
1061                                  GTST_MaxChars, sizeof(cdrom_name) - 1,
1062                                  LAST_Picker, TRUE,
1063                                  TAG_END
# Line 1010 | Line 1065 | static void create_volumes_pane(struct L
1065                          LT_New(h, LA_Type, INTEGER_KIND,
1066                                  LA_LabelID, STR_UNIT_CTRL,
1067                                  LA_ID, GAD_CDROM_UNIT,
1068 <                                LA_LONG, &cdrom_unit,
1068 >                                LA_LONG, (ULONG)&cdrom_unit,
1069                                  LAIN_UseIncrementers, TRUE,
1070                                  GTIN_MaxChars, 8,
1071                                  TAG_END
# Line 1020 | Line 1075 | static void create_volumes_pane(struct L
1075                                  LA_ID, GAD_BOOTDRIVER,
1076                                  LACY_FirstLabel, STR_BOOT_ANY_LAB,
1077                                  LACY_LastLabel, STR_BOOT_CDROM_LAB,
1078 <                                LA_BYTE, &bootdriver_num,
1078 >                                LA_BYTE, (ULONG)&bootdriver_num,
1079                                  TAG_END
1080                          );
1081                          LT_New(h, LA_Type, CHECKBOX_KIND,
1082                                  LA_LabelID, STR_NOCDROM_CTRL,
1083                                  LA_ID, GAD_NOCDROM,
1084 <                                LA_BYTE, &nocdrom,
1084 >                                LA_BYTE, (ULONG)&nocdrom,
1085 >                                TAG_END
1086 >                        );
1087 >                ENDGROUP;
1088 >                VGROUP;
1089 >                        LT_New(h, LA_Type, STRING_KIND,
1090 >                                LA_LabelID, STR_EXTFS_CTRL,
1091 >                                LA_ID, GAD_EXTFS,
1092 >                                LA_Chars, 20,
1093 >                                LA_STRPTR, (ULONG)extfs_name,
1094 >                                GTST_MaxChars, sizeof(extfs_name) - 1,
1095                                  TAG_END
1096                          );
1097                  ENDGROUP;
# Line 1040 | Line 1105 | static void create_volumes_pane(struct L
1105  
1106   static char scsi_dev[6][256];
1107   static LONG scsi_unit[6];
1108 + static LONG scsi_memtype;
1109  
1110   // Read SCSI preferences
1111   static void parse_scsi_prefs(void)
# Line 1054 | Line 1120 | static void parse_scsi_prefs(void)
1120                  if (str)
1121                          sscanf(str, "%[^/]/%ld", scsi_dev[i], &scsi_unit[i]);
1122          }
1123 +
1124 +        scsi_memtype = PrefsFindInt32("scsimemtype");
1125   }
1126  
1127   // Read settings from gadgets and set preferences
# Line 1065 | Line 1133 | static void read_scsi_settings(void)
1133  
1134                  if (strlen(scsi_dev[i])) {
1135                          char str[256];
1136 <                        sprintf("%s/%ld", scsi_dev[i], scsi_unit[i]);
1136 >                        sprintf(str, "%s/%ld", scsi_dev[i], scsi_unit[i]);
1137                          PrefsReplaceString(prefs_name, str);
1138                  } else
1139                          PrefsRemoveItem(prefs_name);
# Line 1078 | Line 1146 | static void create_scsi_pane(struct Layo
1146          parse_scsi_prefs();
1147  
1148          VGROUP;
1149 <                for (int i=0; i<7; i++) {
1150 <                        HGROUP;
1151 <                                LT_New(h, LA_Type, TEXT_KIND,
1152 <                                        LA_LabelID, STR_SCSI_ID_0 + i,
1153 <                                        TAG_END
1154 <                                );
1155 <                                LT_New(h, LA_Type, STRING_KIND,
1156 <                                        LA_LabelID, STR_DEVICE_CTRL,
1157 <                                        LA_ID, GAD_SCSI0_DEVICE + i,
1158 <                                        LA_Chars, 20,
1159 <                                        LA_STRPTR, scsi_dev[i],
1160 <                                        GTST_MaxChars, sizeof(scsi_dev[i]) - 1,
1161 <                                        LAST_Picker, TRUE,
1162 <                                        TAG_END
1163 <                                );
1164 <                                LT_New(h, LA_Type, INTEGER_KIND,
1165 <                                        LA_LabelID, STR_UNIT_CTRL,
1166 <                                        LA_ID, GAD_SCSI0_UNIT + i,
1167 <                                        LA_Chars, 4,
1168 <                                        LA_LONG, &scsi_unit[i],
1169 <                                        LAIN_UseIncrementers, TRUE,
1170 <                                        GTIN_MaxChars, 8,
1171 <                                        TAG_END
1172 <                                );
1173 <                        ENDGROUP;
1174 <                }
1149 >                LT_New(h, LA_Type, VERTICAL_KIND,
1150 >                        LA_LabelID, STR_SCSI_DEVICES_CTRL,
1151 >                        TAG_END
1152 >                );
1153 >                        for (int i=0; i<7; i++) {
1154 >                                HGROUP;
1155 >                                        LT_New(h, LA_Type, TEXT_KIND,
1156 >                                                LA_LabelID, STR_SCSI_ID_0 + i,
1157 >                                                TAG_END
1158 >                                        );
1159 >                                        LT_New(h, LA_Type, STRING_KIND,
1160 >                                                LA_LabelID, STR_DEVICE_CTRL,
1161 >                                                LA_ID, GAD_SCSI0_DEVICE + i,
1162 >                                                LA_Chars, 20,
1163 >                                                LA_STRPTR, (ULONG)scsi_dev[i],
1164 >                                                GTST_MaxChars, sizeof(scsi_dev[i]) - 1,
1165 >                                                LAST_Picker, TRUE,
1166 >                                                TAG_END
1167 >                                        );
1168 >                                        LT_New(h, LA_Type, INTEGER_KIND,
1169 >                                                LA_LabelID, STR_UNIT_CTRL,
1170 >                                                LA_ID, GAD_SCSI0_UNIT + i,
1171 >                                                LA_Chars, 4,
1172 >                                                LA_LONG, (ULONG)&scsi_unit[i],
1173 >                                                LAIN_UseIncrementers, TRUE,
1174 >                                                GTIN_MaxChars, 8,
1175 >                                                TAG_END
1176 >                                        );
1177 >                                ENDGROUP;
1178 >                        }
1179 >                ENDGROUP;
1180 >                VGROUP;
1181 >                        LT_New(h, LA_Type, CYCLE_KIND,
1182 >                                LA_LabelID, STR_SCSI_MEMTYPE_CTRL,
1183 >                                LA_ID, GAD_SCSI_MEMTYPE,
1184 >                                LACY_FirstLabel, STR_MEMTYPE_CHIP_LAB,
1185 >                                LACY_LastLabel, STR_MEMTYPE_ANY_LAB,
1186 >                                LA_LONG, (ULONG)&scsi_memtype,
1187 >                                TAG_END
1188 >                        );
1189 >                ENDGROUP;
1190          ENDGROUP;
1191   }
1192  
# Line 1119 | Line 1202 | enum {
1202          DISPLAY_SCREEN
1203   };
1204  
1205 < static BYTE display_type;
1205 > static LONG display_type;
1206   static LONG dis_width, dis_height;
1207   static ULONG mode_id;
1208   static BYTE frameskip_num;
# Line 1163 | Line 1246 | static void parse_graphics_prefs(void)
1246  
1247          const char *str = PrefsFindString("screen");
1248          if (str) {
1249 <                if (sscanf(str, "win/%d/%d", &dis_width, &dis_height) == 2)
1249 >                if (sscanf(str, "win/%ld/%ld", &dis_width, &dis_height) == 2)
1250                          display_type = DISPLAY_WINDOW;
1251 <                else if (sscanf(str, "pip/%d/%d", &dis_width, &dis_height) == 2)
1251 >                else if (sscanf(str, "pip/%ld/%ld", &dis_width, &dis_height) == 2)
1252                          display_type = DISPLAY_PIP;
1253                  else if (sscanf(str, "scr/%08lx", &mode_id) == 1)
1254                          display_type = DISPLAY_SCREEN;
# Line 1177 | Line 1260 | static void parse_graphics_prefs(void)
1260          if (str) {
1261                  if (sscanf(str, "ahi/%08lx", &ahi_id) == 1 && AHIBase) {
1262                          AHI_GetAudioAttrs(ahi_id, NULL,
1263 <                                AHIDB_Name, ahi_mode_name,
1263 >                                AHIDB_Name, (ULONG)ahi_mode_name,
1264                                  AHIDB_BufferLen, sizeof(ahi_mode_name) - 1,
1265                                  TAG_END
1266                          );
# Line 1217 | Line 1300 | static void ghost_graphics_gadgets(struc
1300   // Show screen mode requester
1301   static void screen_mode_req(struct Window *win, struct LayoutHandle *h)
1302   {
1303 <        if (P96Base == NULL)
1303 >        if (P96Base == NULL && CyberGfxBase == NULL)
1304                  return;
1305  
1306          LT_LockWindow(win);
1307 <        ULONG id = p96RequestModeIDTags(
1308 <                P96MA_MinDepth, 8,
1309 <                P96MA_FormatsAllowed, RGBFF_CLUT | RGBFF_R5G5B5 | RGBFF_A8R8G8B8,
1310 <                TAG_END
1311 <        );
1307 >
1308 >        ULONG id;
1309 >
1310 >        // Try P96 first, because it also provides a (fake) cybergraphics.library
1311 >        if (P96Base) {
1312 >                id = p96RequestModeIDTags(
1313 >                        P96MA_MinDepth, 8,
1314 >                        P96MA_FormatsAllowed, RGBFF_CLUT | RGBFF_R5G5B5 | RGBFF_A8R8G8B8,
1315 >                        TAG_END
1316 >                );
1317 >        } else {
1318 >                UWORD ModelArray[] = { PIXFMT_LUT8, PIXFMT_RGB15, PIXFMT_ARGB32, 0, ~0 };
1319 >                id = (ULONG) CModeRequestTags(NULL,
1320 >                        CYBRMREQ_MinDepth, 8,
1321 >                        CYBRMREQ_CModelArray, (ULONG) ModelArray,
1322 >                        TAG_END
1323 >                );
1324 >        }
1325          LT_UnlockWindow(win);
1326  
1327          if (id != INVALID_ID) {
1328                  mode_id = id;
1329                  GetDisplayInfoData(NULL, (UBYTE *)&mode_name, sizeof(mode_name), DTAG_NAME, mode_id);
1330 <                LT_SetAttributes(h, GAD_SCREEN_MODE, GTTX_Text, mode_name.Name, TAG_END);
1330 >                LT_SetAttributes(h, GAD_SCREEN_MODE, GTTX_Text, (ULONG)mode_name.Name, TAG_END);
1331          }
1332   }
1333  
# Line 1242 | Line 1338 | static void ahi_mode_req(struct Window *
1338                  return;
1339  
1340          struct AHIAudioModeRequester *req = AHI_AllocAudioRequest(
1341 <                AHIR_Window, win,
1341 >                AHIR_Window, (ULONG)win,
1342                  TAG_END
1343          );
1344          if (req == NULL)
# Line 1258 | Line 1354 | static void ahi_mode_req(struct Window *
1354          if (ok) {
1355                  ahi_id = req->ahiam_AudioID;
1356                  AHI_GetAudioAttrs(ahi_id, NULL,
1357 <                        AHIDB_Name, ahi_mode_name,
1357 >                        AHIDB_Name, (ULONG)ahi_mode_name,
1358                          AHIDB_BufferLen, sizeof(ahi_mode_name) - 1,
1359                          TAG_END
1360                  );
1361 <                LT_SetAttributes(h, GAD_AHI_MODE, GTTX_Text, ahi_mode_name, TAG_END);
1361 >                LT_SetAttributes(h, GAD_AHI_MODE, GTTX_Text, (ULONG)ahi_mode_name, TAG_END);
1362          }
1363          AHI_FreeAudioRequest(req);
1364   }
# Line 1307 | Line 1403 | static void create_graphics_pane(struct
1403                          LT_New(h, LA_Type, CYCLE_KIND,
1404                                  LA_LabelID, STR_VIDEO_TYPE_CTRL,
1405                                  LA_ID, GAD_VIDEO_TYPE,
1406 <                                LACY_LabelTable, labels,
1407 <                                LA_BYTE, &display_type,
1406 >                                LACY_LabelTable, (ULONG)labels,
1407 >                                LA_LONG, (ULONG)&display_type,
1408                                  TAG_END
1409                          );
1410                          LT_New(h, LA_Type, INTEGER_KIND,
1411                                  LA_LabelID, STR_DISPLAY_X_CTRL,
1412                                  LA_ID, GAD_DISPLAY_X,
1413 <                                LA_LONG, &dis_width,
1413 >                                LA_LONG, (ULONG)&dis_width,
1414                                  GTIN_MaxChars, 8,
1415                                  TAG_END
1416                          );
1417                          LT_New(h, LA_Type, INTEGER_KIND,
1418                                  LA_LabelID, STR_DISPLAY_Y_CTRL,
1419                                  LA_ID, GAD_DISPLAY_Y,
1420 <                                LA_LONG, &dis_height,
1420 >                                LA_LONG, (ULONG)&dis_height,
1421                                  GTIN_MaxChars, 8,
1422                                  TAG_END
1423                          );
# Line 1330 | Line 1426 | static void create_graphics_pane(struct
1426                                  LA_ID, GAD_FRAMESKIP,
1427                                  LAPU_FirstLabel, STR_REF_5HZ_LAB,
1428                                  LAPU_LastLabel, STR_REF_60HZ_LAB,
1429 <                                LA_BYTE, &frameskip_num,
1429 >                                LA_BYTE, (ULONG)&frameskip_num,
1430                                  TAG_END
1431                          );
1432                          LT_New(h, LA_Type, TEXT_KIND,
# Line 1338 | Line 1434 | static void create_graphics_pane(struct
1434                                  LA_ID, GAD_SCREEN_MODE,
1435                                  LA_Chars, DISPLAYNAMELEN,
1436                                  LATX_Picker, TRUE,
1437 <                                GTTX_Text, mode_name.Name,
1437 >                                GTTX_Text, (ULONG)mode_name.Name,
1438                                  GTTX_Border, TRUE,
1439                                  TAG_END
1440                          );
# Line 1352 | Line 1448 | static void create_graphics_pane(struct
1448                                  LA_ID, GAD_AHI_MODE,
1449                                  LA_Chars, DISPLAYNAMELEN,
1450                                  LATX_Picker, TRUE,
1451 <                                GTTX_Text, ahi_mode_name,
1451 >                                GTTX_Text, (ULONG)ahi_mode_name,
1452                                  GTTX_Border, TRUE,
1453                                  TAG_END
1454                          );
1455                          LT_New(h, LA_Type, CHECKBOX_KIND,
1456                                  LA_LabelID, STR_NOSOUND_CTRL,
1457                                  LA_ID, GAD_NOSOUND,
1458 <                                LA_BYTE, &nosound,
1458 >                                LA_BYTE, (ULONG)&nosound,
1459                                  TAG_END
1460                          );
1461                  ENDGROUP;
# Line 1381 | Line 1477 | static char ether_dev[256];
1477   static ULONG ether_unit;
1478  
1479   // Read serial/network preferences
1480 < static void parse_serial_prefs(const char *prefs, char *dev, LONG &unit, BYTE &ispar)
1480 > static void parse_ser_prefs(const char *prefs, char *dev, LONG &unit, BYTE &ispar)
1481   {
1482          dev[0] = 0;
1483          unit = 0;
# Line 1395 | Line 1491 | static void parse_serial_prefs(const cha
1491                  }
1492                  sscanf(str, "%[^/]/%ld", dev, &unit);
1493          }
1494 + }
1495 +
1496 + static void parse_serial_prefs(void)
1497 + {
1498 +        parse_ser_prefs("seriala", seriala_dev, seriala_unit, seriala_ispar);
1499 +        parse_ser_prefs("serialb", serialb_dev, serialb_unit, serialb_ispar);
1500  
1501          ether_dev[0] = 0;
1502          ether_unit = 0;
1503  
1504 <        str = PrefsFindString("ether");
1505 <        if (str)
1506 <                sscanf(str, "%[^/]/%ld", ether_dev, &ether_unit);
1504 >        const char *str = PrefsFindString("ether");
1505 >        if (str) {
1506 >                const char *FirstSlash = strchr(str, '/');
1507 >                const char *LastSlash = strrchr(str, '/');
1508 >
1509 >                if (FirstSlash && FirstSlash && FirstSlash != LastSlash) {
1510 >                        // Device name contains path, i.e. "Networks/xyzzy.device"
1511 >                        const char *lp = str;
1512 >                        char *dp = ether_dev;
1513 >
1514 >                        while (lp != LastSlash)
1515 >                                *dp++ = *lp++;
1516 >                        *dp = '\0';
1517 >
1518 >                        sscanf(LastSlash, "/%ld", &ether_unit);
1519 >
1520 > //                      printf("dev=<%s> unit=%d\n", ether_dev, ether_unit);
1521 >                } else {
1522 >                        sscanf(str, "%[^/]/%ld", ether_dev, &ether_unit);
1523 >                }
1524 >        }
1525   }
1526  
1527   // Set serial preference item
# Line 1423 | Line 1543 | static void read_serial_settings(void)
1543  
1544          if (strlen(ether_dev)) {
1545                  char str[256];
1546 +
1547                  sprintf(str, "%s/%ld", ether_dev, ether_unit);
1548                  PrefsReplaceString("ether", str);
1549          } else
# Line 1432 | Line 1553 | static void read_serial_settings(void)
1553   // Create "Serial/Network" pane
1554   static void create_serial_pane(struct LayoutHandle *h)
1555   {
1556 <        parse_serial_prefs("seriala", seriala_dev, seriala_unit, seriala_ispar);
1436 <        parse_serial_prefs("serialb", serialb_dev, serialb_unit, serialb_ispar);
1556 >        parse_serial_prefs();
1557  
1558          VGROUP;
1559                  LT_New(h, LA_Type, VERTICAL_KIND,
# Line 1444 | Line 1564 | static void create_serial_pane(struct La
1564                                  LA_LabelID, STR_DEVICE_CTRL,
1565                                  LA_ID, GAD_SERIALA_DEVICE,
1566                                  LA_Chars, 20,
1567 <                                LA_STRPTR, seriala_dev,
1567 >                                LA_STRPTR, (ULONG)seriala_dev,
1568                                  GTST_MaxChars, sizeof(seriala_dev) - 1,
1569                                  LAST_Picker, TRUE,
1570                                  TAG_END
# Line 1452 | Line 1572 | static void create_serial_pane(struct La
1572                          LT_New(h, LA_Type, INTEGER_KIND,
1573                                  LA_LabelID, STR_UNIT_CTRL,
1574                                  LA_ID, GAD_SERIALA_UNIT,
1575 <                                LA_LONG, &seriala_unit,
1575 >                                LA_LONG, (ULONG)&seriala_unit,
1576                                  LAIN_UseIncrementers, TRUE,
1577                                  GTIN_MaxChars, 8,
1578                                  TAG_END
# Line 1460 | Line 1580 | static void create_serial_pane(struct La
1580                          LT_New(h, LA_Type, CHECKBOX_KIND,
1581                                  LA_LabelID, STR_ISPAR_CTRL,
1582                                  LA_ID, GAD_SERIALA_ISPAR,
1583 <                                LA_BYTE, &seriala_ispar,
1583 >                                LA_BYTE, (ULONG)&seriala_ispar,
1584                                  TAG_END
1585                          );
1586                  ENDGROUP;
# Line 1473 | Line 1593 | static void create_serial_pane(struct La
1593                                  LA_LabelID, STR_DEVICE_CTRL,
1594                                  LA_ID, GAD_SERIALB_DEVICE,
1595                                  LA_Chars, 20,
1596 <                                LA_STRPTR, serialb_dev,
1596 >                                LA_STRPTR, (ULONG)serialb_dev,
1597                                  GTST_MaxChars, sizeof(serialb_dev) - 1,
1598                                  LAST_Picker, TRUE,
1599                                  TAG_END
# Line 1481 | Line 1601 | static void create_serial_pane(struct La
1601                          LT_New(h, LA_Type, INTEGER_KIND,
1602                                  LA_LabelID, STR_UNIT_CTRL,
1603                                  LA_ID, GAD_SERIALB_UNIT,
1604 <                                LA_LONG, &serialb_unit,
1604 >                                LA_LONG, (ULONG)&serialb_unit,
1605                                  LAIN_UseIncrementers, TRUE,
1606                                  GTIN_MaxChars, 8,
1607                                  TAG_END
# Line 1489 | Line 1609 | static void create_serial_pane(struct La
1609                          LT_New(h, LA_Type, CHECKBOX_KIND,
1610                                  LA_LabelID, STR_ISPAR_CTRL,
1611                                  LA_ID, GAD_SERIALB_ISPAR,
1612 <                                LA_BYTE, &serialb_ispar,
1612 >                                LA_BYTE, (ULONG)&serialb_ispar,
1613                                  TAG_END
1614                          );
1615                  ENDGROUP;
# Line 1502 | Line 1622 | static void create_serial_pane(struct La
1622                                  LA_LabelID, STR_DEVICE_CTRL,
1623                                  LA_ID, GAD_ETHER_DEVICE,
1624                                  LA_Chars, 20,
1625 <                                LA_STRPTR, ether_dev,
1625 >                                LA_STRPTR, (ULONG)ether_dev,
1626                                  GTST_MaxChars, sizeof(ether_dev) - 1,
1627                                  LAST_Picker, TRUE,
1628                                  TAG_END
# Line 1510 | Line 1630 | static void create_serial_pane(struct La
1630                          LT_New(h, LA_Type, INTEGER_KIND,
1631                                  LA_LabelID, STR_UNIT_CTRL,
1632                                  LA_ID, GAD_ETHER_UNIT,
1633 <                                LA_LONG, &ether_unit,
1633 >                                LA_LONG, (ULONG)&ether_unit,
1634                                  LAIN_UseIncrementers, TRUE,
1635                                  GTIN_MaxChars, 8,
1636                                  TAG_END
# Line 1573 | Line 1693 | static void create_memory_pane(struct La
1693                          LA_LabelID, STR_RAMSIZE_SLIDER,
1694                          LA_ID, GAD_RAMSIZE,
1695                          LA_Chars, 20,
1696 <                        LA_LONG, &ramsize_mb,
1697 <                        GTSL_LevelFormat, GetString(STR_RAMSIZE_FMT),
1696 >                        LA_LONG, (ULONG)&ramsize_mb,
1697 >                        GTSL_LevelFormat, (ULONG)GetString(STR_RAMSIZE_FMT),
1698                          GTSL_Min, 1,
1699                          GTSL_Max, AvailMem(MEMF_LARGEST) >> 20,
1700                          TAG_END
# Line 1584 | Line 1704 | static void create_memory_pane(struct La
1704                          LA_ID, GAD_MODELID,
1705                          LACY_FirstLabel, STR_MODELID_5_LAB,
1706                          LACY_LastLabel, STR_MODELID_14_LAB,
1707 <                        LA_BYTE, &model_num,
1707 >                        LA_BYTE, (ULONG)&model_num,
1708                          TAG_END
1709                  );
1710                  LT_New(h, LA_Type, STRING_KIND,
1711                          LA_LabelID, STR_ROM_FILE_CTRL,
1712                          LA_ID, GAD_ROM_FILE,
1713                          LA_Chars, 20,
1714 <                        LA_STRPTR, rom_file,
1714 >                        LA_STRPTR, (ULONG)rom_file,
1715                          GTST_MaxChars, sizeof(rom_file) - 1,
1716                          LAST_Picker, TRUE,
1717                          TAG_END

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines