grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / c / iprefs / screenmodeprefs.c
blob7b20cee8ad089942aedede2fde3a044753e94011
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 /*********************************************************************************************/
11 #include "global.h"
13 #define DEBUG 0
14 #include <aros/debug.h>
16 #include <prefs/prefhdr.h>
17 #include <prefs/screenmode.h>
19 #include <intuition/iprefs.h>
21 static LONG stopchunks[] =
23 ID_PREF, ID_SCRM
26 /*********************************************************************************************/
28 void ScreenModePrefs_Handler(STRPTR filename)
30 struct IFFHandle *iff;
31 struct ScreenModePrefs *smp;
33 D(bug("In IPrefs:ScreenModePrefs_Handler\n"));
34 D(bug("filename=%s\n",filename));
36 iff = CreateIFF(filename, stopchunks, 1);
38 if (iff) {
39 while(ParseIFF(iff, IFFPARSE_SCAN) == 0) {
40 smp = LoadChunk(iff, sizeof(struct ScreenModePrefs), MEMF_ANY);
41 if (smp) {
42 struct IScreenModePrefs i;
44 i.smp_DisplayID = GET_LONG(smp->smp_DisplayID);
45 i.smp_Width = GET_WORD(smp->smp_Width);
46 i.smp_Height = GET_WORD(smp->smp_Height);
47 i.smp_Depth = GET_WORD(smp->smp_Depth);
48 i.smp_Control = AROS_BE2WORD(smp->smp_Control);
49 D(bug("[ScreenModePrefs] ModeID: 0x%08lX, Size: %dx%d, Depth: %d, Control: 0x%08lX\n",
50 i.smp_DisplayID, i.smp_Width, i.smp_Height, i.smp_Depth, i.smp_Control));
52 SetIPrefs(&i, sizeof(struct IScreenModePrefs), IPREFS_TYPE_SCREENMODE);
53 FreeVec(smp);
56 KillIFF(iff);