2 Copyright © 2009, The AROS Development Team. All rights reserved.
6 #include <libraries/muiscreen.h>
9 #include <proto/iffparse.h>
10 #include <prefs/prefhdr.h>
12 #include <aros/debug.h>
14 #include "fileformat.h"
16 /*****************************************************************************
19 #include <proto/muiscreen.h>
21 AROS_LH2(APTR
, MUIS_OpenPubFile
,
24 AROS_LHA(char*, name
, A0
),
25 AROS_LHA(ULONG
, mode
, D0
),
28 struct Library
*, MUIScreenBase
, 9, MUIScreen
)
46 ******************************************************************************/
51 struct IFFHandle
*iff
;
53 D(bug("MUIS_OpenPubFile(%s, %d)\n", name
, mode
));
55 if ((iff
= AllocIFF()))
57 if ((iff
->iff_Stream
= (IPTR
) Open(name
, mode
)))
60 if (!OpenIFF(iff
, (mode
== MODE_OLDFILE
? IFFF_READ
: IFFF_WRITE
)))
62 if (mode
== MODE_NEWFILE
)
64 if (!PushChunk(iff
, ID_PREF
, ID_FORM
, IFFSIZE_UNKNOWN
))
66 if (!PushChunk(iff
, ID_PREF
, ID_PRHD
, sizeof(struct FilePrefHeader
)))
68 struct FilePrefHeader head
;
70 head
.ph_Version
= 0; // FIXME: shouold be PHV_CURRENT, but see <prefs/prefhdr.h>
77 if (WriteChunkBytes(iff
, &head
, sizeof(head
)) == sizeof(head
))