Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / muiscreen / writepubfile.c
blobab1a381dd1d61f3481136eda09b5ab816adf9aa1
1 /*
2 Copyright © 2009, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <libraries/muiscreen.h>
7 #include <libraries/iffparse.h>
8 #include <proto/iffparse.h>
9 #include <prefs/prefhdr.h>
10 #include <proto/exec.h>
11 #define DEBUG 1
12 #include <aros/debug.h>
14 #include "fileformat.h"
16 /*****************************************************************************
18 NAME */
19 #include <proto/muiscreen.h>
21 AROS_LH2(BOOL, MUIS_WritePubFile,
23 /* SYNOPSIS */
24 AROS_LHA(APTR, pf, A0),
25 AROS_LHA(struct MUI_PubScreenDesc *, desc, A1),
27 /* LOCATION */
28 struct Library *, MUIScreenBase, 12, MUIScreen)
30 /* FUNCTION
32 INPUTS
34 RESULT
36 NOTES
38 EXAMPLE
40 BUGS
42 SEE ALSO
44 INTERNALS
46 ******************************************************************************/
49 AROS_LIBFUNC_INIT
51 D(bug("MUIS_WritePubFile(%p, %p)\n", pf, desc));
53 struct IFFHandle *iff = (struct IFFHandle *) pf;
54 BOOL retval = FALSE;
55 struct MUI_PubScreenDescArray desc_tmp;
57 LONG_TO_ARRAY(desc->Version, desc_tmp.Version);
58 CopyMem(desc->Name, desc_tmp.Name, sizeof(desc_tmp.Name));
59 CopyMem(desc->Title, desc_tmp.Title, sizeof(desc_tmp.Title));
60 CopyMem(desc->Font, desc_tmp.Font, sizeof(desc_tmp.Font));
61 CopyMem(desc->Background, desc_tmp.Background, sizeof(desc_tmp.Background));
62 LONG_TO_ARRAY(desc->DisplayID, desc_tmp.DisplayID);
63 WORD_TO_ARRAY(desc->DisplayWidth, desc_tmp.DisplayWidth);
64 WORD_TO_ARRAY(desc->DisplayHeight, desc_tmp.DisplayHeight);
65 desc_tmp.DisplayDepth = desc->DisplayDepth;
66 desc_tmp.OverscanType = desc->OverscanType;
67 desc_tmp.AutoScroll = desc->AutoScroll;
68 desc_tmp.NoDrag = desc->NoDrag;
69 desc_tmp.Exclusive = desc->Exclusive;
70 desc_tmp.Interleaved = desc->Interleaved;
71 desc_tmp.SysDefault = desc->SysDefault;
72 desc_tmp.Behind = desc->Behind;
73 desc_tmp.AutoClose = desc->AutoClose;
74 desc_tmp.CloseGadget = desc->CloseGadget;
75 desc_tmp.DummyWasForeign = desc->DummyWasForeign;
76 CopyMem(desc->SystemPens, desc_tmp.SystemPens, sizeof(desc_tmp.SystemPens));
77 CopyMem(desc->Reserved, desc_tmp.Reserved, sizeof(desc_tmp.Reserved));
78 COLS_TO_ARRAY(desc->Palette, desc_tmp.Palette);
79 COLS_TO_ARRAY(desc->rsvd, desc_tmp.rsvd);
80 CopyMem(desc->rsvd2, desc_tmp.rsvd2, sizeof(desc_tmp.rsvd2));
81 LONG_TO_ARRAY(desc->Changed, desc_tmp.Changed);
83 if (!PushChunk(iff, ID_PREF, ID_MPUB, sizeof(struct MUI_PubScreenDescArray)))
85 if (WriteChunkBytes(iff, &desc_tmp, sizeof(struct MUI_PubScreenDescArray)) == sizeof(struct MUI_PubScreenDescArray))
87 retval = TRUE;
89 PopChunk(iff);
92 return retval;
94 AROS_LIBFUNC_EXIT