Documented GVF_SAVE_VAR alongside other flags, and removed a query/doubt
[AROS.git] / rom / graphics / finddisplayinfo.c
blobb1be9ce3a7f182f041a2620780b2f3b0cc0adb1f
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function FindDisplayInfo()
6 Lang: english
7 */
8 #include <aros/debug.h>
9 #include <proto/graphics.h>
10 #include <graphics/displayinfo.h>
11 #include <hidd/graphics.h>
13 #include "graphics_intern.h"
14 #include "dispinfo.h"
16 /*****************************************************************************
18 NAME */
19 #include <proto/graphics.h>
21 AROS_LH1(DisplayInfoHandle, FindDisplayInfo,
23 /* SYNOPSIS */
24 AROS_LHA(ULONG, ID, D0),
26 /* LOCATION */
27 struct GfxBase *, GfxBase, 121, Graphics)
29 /* FUNCTION
30 Search for a DisplayInfo which matches the ID key.
32 INPUTS
33 ID - identifier
35 RESULT
36 handle - handle to a displayinfo record with that key
37 or NULL if no match
39 NOTES
41 EXAMPLE
43 BUGS
45 SEE ALSO
46 graphics/displayinfo.h
48 INTERNALS
50 HISTORY
53 ******************************************************************************/
55 AROS_LIBFUNC_INIT
57 struct monitor_driverdata *mdd;
58 struct DisplayInfoHandle *ret = NULL;
59 HIDDT_ModeID hiddmode;
61 D(bug("FindDisplayInfo(id=%x)\n", ID));
63 /* The database may fail on INVALID_ID, so handle this explicitly */
64 if (ID == INVALID_ID)
65 return NULL;
67 /* Find display driver data */
68 for (mdd = CDD(GfxBase)->monitors; mdd; mdd = mdd->next) {
69 if (mdd->id == (ID & mdd->mask))
70 break;
72 if (!mdd)
73 return NULL;
75 /* Calculate HIDD part of ModeID */
76 hiddmode = ID & (~mdd->mask);
78 /* Go through all mode records of this driver */
79 for (ret = mdd->modes; ret->id != vHidd_ModeID_Invalid; ret++) {
80 if (ret->id == hiddmode)
81 return ret;
84 return NULL;
86 AROS_LIBFUNC_EXIT
87 } /* FindDisplayInfo */