Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / muiscreen / readpubfile.c
blobb406ace6dd2b860a6c52b70dcbe0e062df279e1f
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 #include <proto/dos.h>
12 #define DEBUG 1
13 #include <aros/debug.h>
15 #include "fileformat.h"
17 /*****************************************************************************
19 NAME */
20 #include <proto/muiscreen.h>
22 AROS_LH1(struct MUI_PubScreenDesc *, MUIS_ReadPubFile,
24 /* SYNOPSIS */
25 AROS_LHA(APTR, pf, A0),
27 /* LOCATION */
28 struct Library *, MUIScreenBase, 0x36, 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_ReadPubFile(%p)\n", pf));
53 struct IFFHandle *iff = (struct IFFHandle *) pf;
54 struct MUI_PubScreenDesc *retval = NULL;
56 if (!StopChunk(iff, ID_PREF, ID_MPUB))
58 if (!ParseIFF(iff, IFFPARSE_SCAN))
60 struct ContextNode *cn;
61 cn = CurrentChunk(iff);
62 if (cn->cn_Size == sizeof(struct MUI_PubScreenDescArray))
64 struct MUI_PubScreenDesc desc;
65 struct MUI_PubScreenDescArray desc_tmp;
66 if (ReadChunkBytes(iff, &desc_tmp, sizeof(struct MUI_PubScreenDescArray)) == sizeof(struct MUI_PubScreenDescArray))
68 desc.Version = ARRAY_TO_LONG(desc_tmp.Version);
69 CopyMem(desc_tmp.Name, desc.Name, sizeof(desc_tmp.Name));
70 CopyMem(desc_tmp.Title, desc.Title, sizeof(desc_tmp.Title));
71 CopyMem(desc_tmp.Font, desc.Font, sizeof(desc_tmp.Font));
72 CopyMem(desc_tmp.Background, desc.Background, sizeof(desc_tmp.Background));
73 desc.DisplayID = ARRAY_TO_LONG(desc_tmp.DisplayID);
74 desc.DisplayWidth = ARRAY_TO_WORD(desc_tmp.DisplayWidth);
75 desc.DisplayHeight = ARRAY_TO_WORD(desc_tmp.DisplayHeight);
76 desc.DisplayDepth = desc_tmp.DisplayDepth;
77 desc.OverscanType = desc_tmp.OverscanType;
78 desc.AutoScroll = desc_tmp.AutoScroll;
79 desc.NoDrag = desc_tmp.NoDrag;
80 desc.Exclusive = desc_tmp.Exclusive;
81 desc.Interleaved = desc_tmp.Interleaved;
82 desc.SysDefault = desc_tmp.SysDefault;
83 desc.Behind = desc_tmp.Behind;
84 desc.AutoClose = desc_tmp.AutoClose;
85 desc.CloseGadget = desc_tmp.CloseGadget;
86 desc.DummyWasForeign = desc_tmp.DummyWasForeign;
87 CopyMem(desc_tmp.SystemPens, desc.SystemPens, sizeof(desc_tmp.SystemPens));
88 CopyMem(desc_tmp.Reserved, desc.Reserved, sizeof(desc_tmp.Reserved));
89 ARRAY_TO_COLS(desc_tmp.Palette, desc.Palette);
90 ARRAY_TO_COLS(desc_tmp.rsvd, desc.rsvd);
91 CopyMem(desc_tmp.rsvd2, desc.rsvd2, sizeof(desc_tmp.rsvd2));
92 desc.Changed = ARRAY_TO_LONG(desc_tmp.Changed);
94 retval = MUIS_AllocPubScreenDesc(&desc);
100 return retval;
102 AROS_LIBFUNC_EXIT