2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
5 Read an icon from an .info file
12 /****************************************************************************************/
18 #include <exec/memory.h>
19 #include <aros/bigendianio.h>
20 #include <aros/asmcall.h>
21 #include <aros/macros.h>
22 #include <workbench/workbench.h>
24 #include <proto/alib.h>
25 #include <proto/exec.h>
26 #include <proto/dos.h>
27 #include <proto/arossupport.h>
28 #include <proto/intuition.h>
30 #include "icon_intern.h"
32 # include <aros/debug.h>
34 /****************************************************************************************/
36 AROS_UFP3S(ULONG
, ProcessCheckFileType
,
37 AROS_UFPA(struct Hook
*, hook
, A0
),
38 AROS_UFPA(struct Hook
*, streamhook
, A2
),
39 AROS_UFPA(struct SDData
*, data
, A1
)
42 AROS_UFP3S(ULONG
, ProcessOldDrawerData
,
43 AROS_UFPA(struct Hook
*, hook
, A0
),
44 AROS_UFPA(struct Hook
*, streamhook
, A2
),
45 AROS_UFPA(struct SDData
*, data
, A1
)
48 AROS_UFP3S(ULONG
, ProcessNewDrawerData
,
49 AROS_UFPA(struct Hook
*, hook
, A0
),
50 AROS_UFPA(struct Hook
*, streamhook
, A2
),
51 AROS_UFPA(struct SDData
*, data
, A1
)
54 AROS_UFP3S(ULONG
, ProcessGadgetRender
,
55 AROS_UFPA(struct Hook
*, hook
, A0
),
56 AROS_UFPA(struct Hook
*, streamhook
, A2
),
57 AROS_UFPA(struct SDData
*, data
, A1
)
60 AROS_UFP3S(ULONG
, ProcessSelectRender
,
61 AROS_UFPA(struct Hook
*, hook
, A0
),
62 AROS_UFPA(struct Hook
*, streamhook
, A2
),
63 AROS_UFPA(struct SDData
*, data
, A1
)
66 AROS_UFP3S(ULONG
, ProcessDefaultTool
,
67 AROS_UFPA(struct Hook
*, hook
, A0
),
68 AROS_UFPA(struct Hook
*, streamhook
, A2
),
69 AROS_UFPA(struct SDData
*, data
, A1
)
72 AROS_UFP3S(ULONG
, ProcessToolWindow
,
73 AROS_UFPA(struct Hook
*, hook
, A0
),
74 AROS_UFPA(struct Hook
*, streamhook
, A2
),
75 AROS_UFPA(struct SDData
*, data
, A1
)
78 AROS_UFP3S(ULONG
, ProcessToolTypes
,
79 AROS_UFPA(struct Hook
*, hook
, A0
),
80 AROS_UFPA(struct Hook
*, streamhook
, A2
),
81 AROS_UFPA(struct SDData
*, data
, A1
)
84 AROS_UFP3S(ULONG
, ProcessFlagPtr
,
85 AROS_UFPA(struct Hook
*, hook
, A0
),
86 AROS_UFPA(struct Hook
*, streamhook
, A2
),
87 AROS_UFPA(struct SDData
*, data
, A1
)
90 AROS_UFP3S(ULONG
, ProcessIcon35
,
91 AROS_UFPA(struct Hook
*, hook
, A0
),
92 AROS_UFPA(struct Hook
*, streamhook
, A2
),
93 AROS_UFPA(struct SDData
*, data
, A1
)
96 AROS_UFP3S(ULONG
, ProcessIconNI
,
97 AROS_UFPA(struct Hook
*, hook
, A0
),
98 AROS_UFPA(struct Hook
*, streamhook
, A2
),
99 AROS_UFPA(struct SDData
*, data
, A1
)
103 ProcessCheckFileTypeHook
=
105 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessCheckFileType
), NULL
, NULL
107 ProcessOldDrawerDataHook
=
109 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessOldDrawerData
), NULL
, NULL
111 ProcessNewDrawerDataHook
=
113 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessNewDrawerData
), NULL
, NULL
115 ProcessGadgetRenderHook
=
117 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessGadgetRender
), NULL
, NULL
119 ProcessSelectRenderHook
=
121 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessSelectRender
), NULL
, NULL
125 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessFlagPtr
), NULL
, NULL
127 ProcessDefaultToolHook
=
129 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessDefaultTool
), NULL
, NULL
131 ProcessToolWindowHook
=
133 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessToolWindow
), NULL
, NULL
135 ProcessToolTypesHook
=
137 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessToolTypes
), NULL
, NULL
141 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessIcon35
), NULL
, NULL
145 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessIconNI
), NULL
, NULL
148 /****************************************************************************************/
151 #define O(x) (offsetof (struct Gadget,x))
153 /****************************************************************************************/
155 static const IPTR GadgetDesc
[] =
157 sizeof (struct Gadget
),
158 SDM_IGNORE(4), /* NextGadget */
159 SDM_WORD(O(LeftEdge
)),
160 SDM_WORD(O(TopEdge
)),
164 SDM_UWORD(O(Activation
)),
165 SDM_UWORD(O(GadgetType
)),
166 SDM_SPECIAL(O(GadgetRender
),&ProcessFlagPtrHook
),
167 SDM_SPECIAL(O(SelectRender
),&ProcessFlagPtrHook
),
168 SDM_SPECIAL(O(GadgetText
),&ProcessFlagPtrHook
),
169 SDM_LONG(O(MutualExclude
)),
170 SDM_SPECIAL(O(SpecialInfo
),&ProcessFlagPtrHook
),
171 SDM_UWORD(O(GadgetID
)),
172 SDM_ULONG(O(UserData
)),
176 /****************************************************************************************/
179 #define O(x) (offsetof (struct DiskObject,x))
181 /****************************************************************************************/
183 static const IPTR DiskObjectDesc
[] =
185 sizeof (struct DiskObject
),
186 SDM_UWORD(O(do_Magic
)),
187 SDM_UWORD(O(do_Version
)),
188 SDM_STRUCT(O(do_Gadget
),GadgetDesc
),
189 SDM_UBYTE(O(do_Type
)),
190 SDM_IGNORE(1), /* Pad */
191 SDM_SPECIAL(O(do_DefaultTool
),&ProcessFlagPtrHook
),
192 SDM_SPECIAL(O(do_ToolTypes
),&ProcessFlagPtrHook
),
193 SDM_LONG(O(do_CurrentX
)),
194 SDM_LONG(O(do_CurrentY
)),
195 SDM_SPECIAL(O(do_DrawerData
),&ProcessFlagPtrHook
),
196 SDM_SPECIAL(O(do_ToolWindow
),&ProcessFlagPtrHook
),
197 SDM_LONG(O(do_StackSize
)),
201 /****************************************************************************************/
204 #define O(x) (offsetof (struct Image,x))
206 /****************************************************************************************/
208 static const IPTR ImageDesc
[] =
210 sizeof (struct Image
),
211 SDM_WORD(O(LeftEdge
)),
212 SDM_WORD(O(TopEdge
)),
216 SDM_SPECIAL(O(ImageData
),&ProcessFlagPtrHook
),
217 SDM_UBYTE(O(PlanePick
)),
218 SDM_UBYTE(O(PlaneOnOff
)),
219 SDM_SPECIAL(O(NextImage
),&ProcessFlagPtrHook
),
223 /****************************************************************************************/
225 const IPTR IconDesc
[] =
227 sizeof (struct NativeIcon
),
228 SDM_STRUCT(0,DiskObjectDesc
),
229 SDM_SPECIAL(0,&ProcessCheckFileTypeHook
),
230 SDM_SPECIAL(0,&ProcessOldDrawerDataHook
),
231 SDM_SPECIAL(0,&ProcessGadgetRenderHook
),
232 SDM_SPECIAL(0,&ProcessSelectRenderHook
),
233 SDM_SPECIAL(0,&ProcessDefaultToolHook
),
234 SDM_SPECIAL(0,&ProcessToolTypesHook
),
235 SDM_SPECIAL(0,&ProcessToolWindowHook
),
236 SDM_SPECIAL(0,&ProcessNewDrawerDataHook
),
237 SDM_SPECIAL(0,&ProcessIcon35Hook
),
238 SDM_SPECIAL(0,&ProcessIconNIHook
),
242 /****************************************************************************************/
245 #define O(x) (offsetof (struct NewWindow,x))
247 /****************************************************************************************/
249 const IPTR NewWindowDesc
[] =
251 sizeof (struct NewWindow
),
252 SDM_WORD(O(LeftEdge
)),
253 SDM_WORD(O(TopEdge
)),
256 SDM_UBYTE(O(DetailPen
)),
257 SDM_UBYTE(O(BlockPen
)),
258 SDM_ULONG(O(IDCMPFlags
)),
260 SDM_IGNORE(4+4+4+4+4), /* FirstGadget
266 SDM_WORD(O(MinWidth
)),
267 SDM_WORD(O(MinHeight
)),
268 SDM_UWORD(O(MaxWidth
)),
269 SDM_UWORD(O(MaxHeight
)),
274 /****************************************************************************************/
277 #define O(x) (offsetof (struct DrawerData,x))
279 /****************************************************************************************/
281 const IPTR OldDrawerDataDesc
[] =
283 sizeof (struct DrawerData
),
284 SDM_STRUCT(O(dd_NewWindow
),NewWindowDesc
),
285 SDM_LONG(O(dd_CurrentX
)),
286 SDM_LONG(O(dd_CurrentY
)),
290 /****************************************************************************************/
292 AROS_UFH3(LONG
, dosstreamhook
,
293 AROS_UFHA(struct Hook
*, hook
, A0
),
294 AROS_UFHA(BPTR
, fh
, A2
),
295 AROS_UFHA(ULONG
*, msg
, A1
)
300 struct IconBase
*IconBase
= hook
->h_Data
;
309 kprintf ("dsh: Read: %02X\n", rc
);
314 rc
= FPutC (fh
, ((struct BEIOM_Write
*)msg
)->Data
);
320 rc
= Seek (fh
, ((struct BEIOM_Ignore
*)msg
)->Count
, OFFSET_CURRENT
);
322 kprintf ("dsh: Skip %d\n", ((struct BEIOM_Ignore
*)msg
)->Count
);
331 } /* dosstreamhook */
333 /****************************************************************************************/
335 #define DO(x) ((struct DiskObject *)x)
337 /****************************************************************************************/
339 AROS_UFH3S(ULONG
, ProcessCheckFileType
,
340 AROS_UFHA(struct Hook
*, hook
, A0
),
341 AROS_UFHA(struct Hook
*, streamhook
, A2
),
342 AROS_UFHA(struct SDData
*, data
, A1
)
347 struct DiskObject
*icon
= DO(data
->sdd_Dest
);
349 if (data
->sdd_Mode
== SDV_SPECIALMODE_READ
)
351 if ((icon
->do_Magic
!= WB_DISKMAGIC
))
363 /****************************************************************************************/
365 AROS_UFH3S(ULONG
, ProcessOldDrawerData
,
366 AROS_UFHA(struct Hook
*, hook
, A0
),
367 AROS_UFHA(struct Hook
*, streamhook
, A2
),
368 AROS_UFHA(struct SDData
*, data
, A1
)
374 struct IconBase
*IconBase
= streamhook
->h_Data
;
375 struct DiskObject
*icon
= DO(data
->sdd_Dest
);
378 kprintf ("ProcessOldDrawerData\n");
381 /* if (icon->do_Type == WBDRAWER)
383 /* sba: all icons which have do_DrawerData set actually contain
384 * also the drawer data */
386 if (icon
->do_DrawerData
)
388 switch (data
->sdd_Mode
)
390 case SDV_SPECIALMODE_READ
:
391 ptr
= AllocMemIcon(icon
, sizeof(struct DrawerData
), MEMF_PUBLIC
,
396 if (ReadStruct (streamhook
402 icon
->do_DrawerData
= ptr
;
403 NATIVEICON(data
->sdd_Dest
)->ni_ReadStruct_State
|= RSS_OLDDRAWERDATA_READ
;
408 case SDV_SPECIALMODE_WRITE
:
409 return WriteStruct (streamhook
410 , icon
->do_DrawerData
414 case SDV_SPECIALMODE_FREE
:
422 } /* ProcessOldDrawerData */
424 /****************************************************************************************/
426 static struct Image
* ReadImage (struct DiskObject
*icon
, struct Hook
* streamhook
, BPTR file
)
428 struct Image
* image
;
431 struct IconBase
*IconBase
= streamhook
->h_Data
;
433 image
= AllocMemIcon(icon
, sizeof(struct Image
),
434 MEMF_PUBLIC
| MEMF_CLEAR
, IconBase
);
438 if (!ReadStruct (streamhook
, (APTR
*)&image
, (APTR
)file
, ImageDesc
))
441 /* Size of imagedata in bytes */
442 size
= ((image
->Width
+ 15) >> 4) * image
->Height
* image
->Depth
* 2;
444 D(bug("%s: %dx%dx%d (%d bytes)\n", __func__
452 if (!(image
->ImageData
= AllocMemIcon(icon
, size
,
453 MEMF_PUBLIC
| MEMF_CHIP
, IconBase
)))
458 for (t
=0; t
<size
; t
++)
462 if (!ReadWord (streamhook
, &data
, (APTR
)file
))
465 image
->ImageData
[t
] = AROS_WORD2BE(data
);
470 D(bug("[%s] Strange. Short read at %d, expected %d\n", t
, size
));
478 /****************************************************************************************/
480 static int WriteImage (struct Hook
* streamhook
, BPTR file
,
481 struct Image
* image
)
486 if (!WriteStruct (streamhook
, image
, (APTR
)file
, ImageDesc
) )
489 /* Get size in words */
490 size
= ((image
->Width
+ 15) >> 4) * image
->Height
* image
->Depth
;
493 kprintf ("WriteImage: %dx%dx%d (%d bytes)\n"
501 for (t
=0; t
<size
; t
++)
503 UWORD data
= image
->ImageData
[t
];
505 if (!WriteWord (streamhook
, AROS_WORD2BE(data
), (APTR
)file
))
512 /****************************************************************************************/
514 AROS_UFH3S(ULONG
, ProcessGadgetRender
,
515 AROS_UFHA(struct Hook
*, hook
, A0
),
516 AROS_UFHA(struct Hook
*, streamhook
, A2
),
517 AROS_UFHA(struct SDData
*, data
, A1
)
522 struct Image
* image
;
523 struct DiskObject
*icon
= DO(data
->sdd_Dest
);
526 kprintf ("ProcessGadgetRender\n");
529 if (icon
->do_Gadget
.GadgetRender
|| (icon
->do_Gadget
.Flags
& GFLG_GADGIMAGE
))
531 switch (data
->sdd_Mode
)
533 case SDV_SPECIALMODE_READ
:
534 image
= ReadImage (icon
, streamhook
, (BPTR
)data
->sdd_Stream
);
539 icon
->do_Gadget
.GadgetRender
= image
;
540 NATIVEICON(data
->sdd_Dest
)->ni_ReadStruct_State
|= RSS_GADGETIMAGE_READ
;
543 case SDV_SPECIALMODE_WRITE
:
544 image
= icon
->do_Gadget
.GadgetRender
;
548 return WriteImage (streamhook
, (BPTR
)data
->sdd_Stream
, image
);
550 case SDV_SPECIALMODE_FREE
:
558 } /* ProcessGadgetRender */
560 /****************************************************************************************/
562 AROS_UFH3S(ULONG
, ProcessSelectRender
,
563 AROS_UFHA(struct Hook
*, hook
, A0
),
564 AROS_UFHA(struct Hook
*, streamhook
, A2
),
565 AROS_UFHA(struct SDData
*, data
, A1
)
570 struct Image
* image
;
571 struct DiskObject
*icon
= DO(data
->sdd_Dest
);
574 kprintf ("ProcessSelectRender\n");
577 /* Not all icon with second image seem to have GFLG_GADGHIMAGE set */
579 if (icon
->do_Gadget
.SelectRender
|| (icon
->do_Gadget
.Flags
& GFLG_GADGHIMAGE
))
581 switch (data
->sdd_Mode
)
583 case SDV_SPECIALMODE_READ
:
584 image
= ReadImage (icon
, streamhook
, (BPTR
)data
->sdd_Stream
);
589 icon
->do_Gadget
.SelectRender
= image
;
590 NATIVEICON(data
->sdd_Dest
)->ni_ReadStruct_State
|= RSS_SELECTIMAGE_READ
;
593 case SDV_SPECIALMODE_WRITE
:
594 image
= icon
->do_Gadget
.SelectRender
;
596 return WriteImage (streamhook
, (BPTR
)data
->sdd_Stream
, image
);
598 case SDV_SPECIALMODE_FREE
:
606 } /* ProcessSelectRender */
608 /****************************************************************************************/
610 AROS_UFH3S(ULONG
, ProcessFlagPtr
,
611 AROS_UFHA(struct Hook
*, hook
, A0
),
612 AROS_UFHA(struct Hook
*, streamhook
, A2
),
613 AROS_UFHA(struct SDData
*, data
, A1
)
619 struct IconBase
*IconBase
= streamhook
->h_Data
;
621 switch (data
->sdd_Mode
)
623 case SDV_SPECIALMODE_READ
:
624 if (FRead ((BPTR
)data
->sdd_Stream
, &ptr
, 1, 4) != 4)
628 kprintf ("ProcessFlagPtr: %08lx %ld\n", ptr
);
631 *((IPTR
*)data
->sdd_Dest
) = (IPTR
)(ptr
!= 0L);
635 case SDV_SPECIALMODE_WRITE
:
636 IconBase
= streamhook
->h_Data
;
637 if (*((APTR
*)data
->sdd_Dest
))
642 if (FWrite ((BPTR
)data
->sdd_Stream
, &ptr
, 1, 4) != 4)
647 case SDV_SPECIALMODE_FREE
:
655 } /* ProcessFlagPtr */
657 /****************************************************************************************/
659 static STRPTR
ReadIconString (struct DiskObject
*icon
, struct Hook
* streamhook
, BPTR file
)
664 struct IconBase
*IconBase
= streamhook
->h_Data
;
666 if (!ReadLong (streamhook
, &len
, (APTR
)file
))
669 str
= AllocMemIcon(icon
, len
, MEMF_PUBLIC
, IconBase
);
674 if (FRead ((BPTR
)file
, str
, len
, 1) == EOF
)
680 kprintf ("ReadIconString: \"%s\"\n", str
);
684 } /* ReadIconString */
686 /****************************************************************************************/
688 static int WriteIconString (struct Hook
* streamhook
, BPTR file
, STRPTR str
)
692 struct IconBase
*IconBase
= streamhook
->h_Data
;
694 len
= strlen (str
) + 1;
696 if (!WriteLong (streamhook
, len
, (APTR
)file
))
699 return FWrite (file
, str
, len
, 1) != EOF
;
700 } /* WriteIconString */
702 /****************************************************************************************/
704 AROS_UFH3S(ULONG
, ProcessDefaultTool
,
705 AROS_UFHA(struct Hook
*, hook
, A0
),
706 AROS_UFHA(struct Hook
*, streamhook
, A2
),
707 AROS_UFHA(struct SDData
*, data
, A1
)
713 struct DiskObject
*icon
= DO(data
->sdd_Dest
);
716 kprintf ("ProcessDefaultTool\n");
719 if (icon
->do_DefaultTool
)
721 switch (data
->sdd_Mode
)
723 case SDV_SPECIALMODE_READ
:
724 str
= ReadIconString (icon
, streamhook
, (BPTR
) data
->sdd_Stream
);
729 icon
->do_DefaultTool
= str
;
730 NATIVEICON(data
->sdd_Dest
)->ni_ReadStruct_State
|= RSS_DEFAULTTOOL_READ
;
733 case SDV_SPECIALMODE_WRITE
: {
734 str
= icon
->do_DefaultTool
;
736 WriteIconString (streamhook
, (BPTR
) data
->sdd_Stream
, str
);
740 case SDV_SPECIALMODE_FREE
:
748 } /* ProcessDefaultTool */
750 /****************************************************************************************/
752 AROS_UFH3S(ULONG
, ProcessToolWindow
,
753 AROS_UFHA(struct Hook
*, hook
, A0
),
754 AROS_UFHA(struct Hook
*, streamhook
, A2
),
755 AROS_UFHA(struct SDData
*, data
, A1
)
761 struct DiskObject
*icon
= DO(data
->sdd_Dest
);
764 kprintf ("ProcessToolWindow\n");
767 if (icon
->do_ToolWindow
)
769 switch (data
->sdd_Mode
)
771 case SDV_SPECIALMODE_READ
:
772 str
= ReadIconString (icon
, streamhook
, (BPTR
)data
->sdd_Stream
);
777 icon
->do_ToolWindow
= str
;
778 NATIVEICON(data
->sdd_Dest
)->ni_ReadStruct_State
|= RSS_TOOLWINDOW_READ
;
781 case SDV_SPECIALMODE_WRITE
: {
782 str
= icon
->do_ToolWindow
;
784 WriteIconString (streamhook
, (BPTR
)data
->sdd_Stream
, str
);
788 case SDV_SPECIALMODE_FREE
:
796 } /* ProcessToolWindow */
798 /****************************************************************************************/
800 AROS_UFH3S(ULONG
, ProcessToolTypes
,
801 AROS_UFHA(struct Hook
*, hook
, A0
),
802 AROS_UFHA(struct Hook
*, streamhook
, A2
),
803 AROS_UFHA(struct SDData
*, data
, A1
)
808 struct IconBase
*IconBase
= streamhook
->h_Data
;
809 struct DiskObject
*icon
= DO(data
->sdd_Dest
);
812 kprintf ("ProcessToolTypes\n");
815 if (icon
->do_ToolTypes
)
821 switch (data
->sdd_Mode
)
823 case SDV_SPECIALMODE_READ
:
824 /* Read size of ToolTypes array (each entry is 4 bytes and the
826 if (!ReadLong (streamhook
, &count
, data
->sdd_Stream
))
829 count
= (count
>> 2) - 1; /* How many entries */
833 icon
->do_ToolTypes
= NULL
;
837 ttarray
= AllocMemIcon(icon
, (count
+1)*sizeof(STRPTR
),
838 MEMF_PUBLIC
, IconBase
);
839 if (!ttarray
) return FALSE
;
842 kprintf ("Read %d tooltypes (tt=%p)\n", count
, ttarray
);
845 for (t
=0; t
<count
; t
++)
847 ttarray
[t
] = ReadIconString (icon
, streamhook
, (BPTR
)data
->sdd_Stream
);
849 kprintf ("String %d=%p=%s\n", t
, ttarray
[t
], ttarray
[t
]);
858 icon
->do_ToolTypes
= (STRPTR
*)ttarray
;
859 NATIVEICON(icon
)->ni_ReadStruct_State
|= RSS_TOOLTYPES_READ
;
862 case SDV_SPECIALMODE_WRITE
: {
865 ttarray
= (STRPTR
*)icon
->do_ToolTypes
;
867 for (count
=0; ttarray
[count
]; count
++);
870 kprintf ("Write %d tooltypes (%p)\n", count
, ttarray
);
875 if (!WriteLong (streamhook
, size
, data
->sdd_Stream
))
878 for (t
=0; t
<count
; t
++)
881 kprintf ("String %d=%p=%s\n", t
, ttarray
[t
], ttarray
[t
]);
883 if (!WriteIconString (streamhook
, (BPTR
)data
->sdd_Stream
, ttarray
[t
]))
889 case SDV_SPECIALMODE_FREE
:
895 kprintf ("No tool types\n");
901 } /* ProcessToolTypes */
903 /****************************************************************************************/
905 AROS_UFH3S(ULONG
, ProcessNewDrawerData
,
906 AROS_UFHA(struct Hook
*, hook
, A0
),
907 AROS_UFHA(struct Hook
*, streamhook
, A2
),
908 AROS_UFHA(struct SDData
*, data
, A1
)
913 struct DiskObject
*icon
= DO(data
->sdd_Dest
);
914 IPTR rev
= (IPTR
)icon
->do_Gadget
.UserData
& WB_DISKREVISIONMASK
;
916 kprintf ("ProcessNewDrawerData\n");
919 if (icon
->do_DrawerData
&& (rev
> 0) && (rev
<= WB_DISKREVISION
))
921 switch (data
->sdd_Mode
)
923 case SDV_SPECIALMODE_READ
:
924 if (!ReadLong(streamhook
, &icon
->do_DrawerData
->dd_Flags
, data
->sdd_Stream
))
927 if (!ReadWord(streamhook
, &icon
->do_DrawerData
->dd_ViewModes
, data
->sdd_Stream
))
932 case SDV_SPECIALMODE_WRITE
:
933 if (!WriteLong(streamhook
, icon
->do_DrawerData
->dd_Flags
, data
->sdd_Stream
))
936 if (!WriteWord(streamhook
, icon
->do_DrawerData
->dd_ViewModes
, data
->sdd_Stream
))
945 } /* ProcessNewDrawerData */
947 /****************************************************************************************/
949 #define IconBase ((IconBase_T *)(streamhook->h_Data))
951 /****************************************************************************************/
953 AROS_UFH3S(ULONG
, ProcessIcon35
,
954 AROS_UFHA(struct Hook
*, hook
, A0
),
955 AROS_UFHA(struct Hook
*, streamhook
, A2
),
956 AROS_UFHA(struct SDData
*, data
, A1
)
964 kprintf ("ProcessIcon35\n");
967 switch (data
->sdd_Mode
)
969 case SDV_SPECIALMODE_READ
:
970 ReadIcon35(NATIVEICON(DO(data
->sdd_Dest
)), streamhook
, data
->sdd_Stream
, IconBase
);
973 case SDV_SPECIALMODE_FREE
:
974 FreeIcon35(NATIVEICON(DO(data
->sdd_Dest
)), IconBase
);
977 case SDV_SPECIALMODE_WRITE
:
978 retval
= WriteIcon35(NATIVEICON(DO(data
->sdd_Dest
)), streamhook
, data
->sdd_Stream
, IconBase
);
986 } /* ProcessIcon35 */
988 /****************************************************************************************/
990 AROS_UFH3S(ULONG
, ProcessIconNI
,
991 AROS_UFHA(struct Hook
*, hook
, A0
),
992 AROS_UFHA(struct Hook
*, streamhook
, A2
),
993 AROS_UFHA(struct SDData
*, data
, A1
)
1001 kprintf ("ProcessIconNI\n");
1004 switch (data
->sdd_Mode
)
1006 case SDV_SPECIALMODE_READ
:
1007 ReadIconNI(NATIVEICON(DO(data
->sdd_Dest
)), streamhook
, data
->sdd_Stream
, IconBase
);
1010 case SDV_SPECIALMODE_FREE
:
1011 FreeIconNI(NATIVEICON(DO(data
->sdd_Dest
)), IconBase
);
1014 case SDV_SPECIALMODE_WRITE
:
1015 retval
= WriteIconNI(NATIVEICON(DO(data
->sdd_Dest
)), streamhook
, data
->sdd_Stream
, IconBase
);
1023 } /* ProcessIconNI */
1025 /****************************************************************************************/