Documented GVF_SAVE_VAR alongside other flags, and removed a query/doubt
[AROS.git] / rom / dosboot / bootscreen.c
blob02a77bc6bed1ecb5f04d1e2224164f26e214b973
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/debug.h>
7 #include <exec/alerts.h>
8 #include <exec/libraries.h>
9 #include <graphics/gfxbase.h>
10 #include <graphics/modeid.h>
11 #include <intuition/screens.h>
12 #include <proto/exec.h>
13 #include <proto/graphics.h>
14 #include <proto/intuition.h>
16 #include "dosboot_intern.h"
18 static struct Screen *OpenBootScreenType(struct DOSBootBase *DOSBootBase, BYTE MinDepth, BYTE SquarePixels)
20 UWORD height;
21 ULONG mode;
23 GfxBase = (void *)TaggedOpenLibrary(TAGGEDOPEN_GRAPHICS);
24 IntuitionBase = (void *)TaggedOpenLibrary(TAGGEDOPEN_INTUITION);
26 if ((!IntuitionBase) || (!GfxBase))
27 /* We failed to open one of system libraries. AROS is in utterly broken state */
28 Alert(AT_DeadEnd|AN_BootStrap|AG_OpenLib);
30 height = 480;
31 mode = BestModeID(BIDTAG_DesiredWidth, 640, BIDTAG_DesiredHeight, height,
32 BIDTAG_Depth, MinDepth, TAG_DONE);
33 if (mode == INVALID_ID)
34 Alert(AN_SysScrnType);
36 /* Set PAL or NTSC default height if we are running on Amiga(tm) hardware.
37 * We also need to check if this is really PAL or NTSC mode because we have to
38 * use PC 640x480 mode if user has Amiga hardware + RTG board.
39 * Check DisplayFlags first because non-Amiga modeIDs use different format.
41 if (GfxBase->DisplayFlags & (NTSC | PAL)) {
42 if ((mode & MONITOR_ID_MASK) == NTSC_MONITOR_ID)
43 height = SquarePixels ? 400 : 200;
44 else if ((mode & MONITOR_ID_MASK) == PAL_MONITOR_ID)
45 height = SquarePixels ? 512 : 256;
48 /* We want the screen to occupy the whole display, so we find best maching
49 mode ID and then open a screen with that mode */
50 mode = BestModeID(BIDTAG_DesiredWidth, 640, BIDTAG_DesiredHeight, height,
51 BIDTAG_Depth, MinDepth, TAG_DONE);
53 if (mode != INVALID_ID)
55 struct Screen *scr = OpenScreenTags(NULL, SA_DisplayID, mode, SA_Draggable, FALSE,
56 SA_Quiet, TRUE, SA_Depth, MinDepth, TAG_DONE);
58 if (scr)
59 return scr;
61 /* We can't open a screen. Likely there are no display modes in the database at all */
62 Alert(AN_SysScrnType);
63 return NULL;
66 struct Screen *OpenBootScreen(struct DOSBootBase *DOSBootBase)
68 /* Boot menu requires basic 4+ color screen */
69 return OpenBootScreenType(DOSBootBase, 2, FALSE);
72 struct Screen *NoBootMediaScreen(struct DOSBootBase *DOSBootBase)
74 /* Boot anim requires 16+ color screen and 1:1 pixels */
75 struct Screen *scr = OpenBootScreenType(DOSBootBase, 4, TRUE);
77 if (!anim_Init(scr, DOSBootBase))
79 SetAPen(&scr->RastPort, 1);
80 Move(&scr->RastPort, 215, 120);
81 Text(&scr->RastPort, "No bootable media found...", 26);
84 return scr;
87 void CloseBootScreen(struct Screen *scr, struct DOSBootBase *DOSBootBase)
89 CloseScreen(scr);
91 CloseLibrary(&IntuitionBase->LibNode);
92 CloseLibrary(&GfxBase->LibNode);