Fixed handling of symbolic links, pretend to have changed file owner.
[AROS.git] / rom / dosboot / bootscreen.c
blob20b697fc158dd5d18c25c86455aefec945ce8e2e
1 #include <aros/debug.h>
2 #include <exec/alerts.h>
3 #include <exec/libraries.h>
4 #include <graphics/gfxbase.h>
5 #include <graphics/modeid.h>
6 #include <intuition/screens.h>
7 #include <proto/exec.h>
8 #include <proto/graphics.h>
9 #include <proto/intuition.h>
11 #include "dosboot_intern.h"
13 struct Screen *OpenBootScreen(struct DOSBootBase *DOSBootBase)
15 UWORD height, depth;
16 ULONG mode;
18 GfxBase = (void *)TaggedOpenLibrary(TAGGEDOPEN_GRAPHICS);
19 IntuitionBase = (void *)TaggedOpenLibrary(TAGGEDOPEN_INTUITION);
21 if ((!IntuitionBase) || (!GfxBase))
22 /* We failed to open one of system libraries. AROS is in utterly broken state */
23 Alert(AT_DeadEnd|AN_BootStrap|AG_OpenLib);
25 height = 480;
26 mode = BestModeID(BIDTAG_DesiredWidth, 640, BIDTAG_DesiredHeight, height,
27 BIDTAG_Depth, 8, TAG_DONE);
28 if (mode != INVALID_ID) {
29 /* if we got depth=8 mode, we must have fast enough hardware for 4 planes too,
30 * either it is non-Amiga(tm) hardware or AGA chipset */
31 depth = 4;
32 } else {
33 /* we probably have OCS or ECS chipset, select 2 planes because 4 planes OCS/ECS hires is very slow */
34 depth = 2;
36 /* set PAL or NTSC default height if we are running on Amiga(tm) hardware
37 * we are using interlaced screen height because boot screen assumes 1:1 pixels */
38 if (GfxBase->DisplayFlags & NTSC)
39 height = 200 * 2;
40 else if (GfxBase->DisplayFlags & PAL)
41 height = 256 * 2;
43 /* We want the screen to occupy the whole display, so we find best maching
44 mode ID and then open a screen with that mode */
45 mode = BestModeID(BIDTAG_DesiredWidth, 640, BIDTAG_DesiredHeight, height,
46 BIDTAG_Depth, depth, TAG_DONE);
47 if (mode != INVALID_ID)
49 struct Screen *scr = OpenScreenTags(NULL, SA_DisplayID, mode, SA_Draggable, FALSE,
50 SA_Quiet, TRUE, SA_Depth, depth, TAG_DONE);
52 if (scr)
53 return scr;
55 /* We can't open a screen. Likely there are no display modes in the database at all */
56 Alert(AN_SysScrnType);
57 return NULL;
62 struct Screen *NoBootMediaScreen(struct DOSBootBase *DOSBootBase)
64 struct Screen *scr = OpenBootScreen(DOSBootBase);
66 if (!anim_Init(scr, DOSBootBase))
68 SetAPen(&scr->RastPort, 1);
69 Move(&scr->RastPort, 215, 120);
70 Text(&scr->RastPort, "No bootable media found...", 26);
73 return scr;
76 void CloseBootScreen(struct Screen *scr, struct DOSBootBase *DOSBootBase)
78 CloseScreen(scr);
80 CloseLibrary(&IntuitionBase->LibNode);
81 CloseLibrary(&GfxBase->LibNode);