Repository navigation
Expand file tree
/
Copy pathbootscreen.c
More file actions
121 lines (98 loc) · 3.8 KB
/
Copy pathbootscreen.c
File metadata and controls
121 lines (98 loc) · 3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
Copyright � 1995-2014, The AROS Development Team. All rights reserved.
$Id$
*/
#include <aros/debug.h>
#include <exec/alerts.h>
#include <exec/libraries.h>
#include <graphics/gfxbase.h>
#include <graphics/modeid.h>
#include <intuition/screens.h>
#include <proto/exec.h>
#include <proto/graphics.h>
#include <proto/intuition.h>
#include "dosboot_intern.h"
static struct Screen *OpenBootScreenType(struct DOSBootBase *DOSBootBase, BYTE MinDepth, BYTE SquarePixels)
{
UWORD height;
ULONG mode;
GfxBase = (void *)TaggedOpenLibrary(TAGGEDOPEN_GRAPHICS);
IntuitionBase = (void *)TaggedOpenLibrary(TAGGEDOPEN_INTUITION);
if ((!IntuitionBase) || (!GfxBase))
/* We failed to open one of system libraries. AROS is in utterly broken state */
Alert(AT_DeadEnd|AN_BootStrap|AG_OpenLib);
height = 240;
mode = BestModeID(BIDTAG_DesiredWidth, 640, BIDTAG_DesiredHeight, height,
BIDTAG_Depth, MinDepth, TAG_DONE);
if (mode == INVALID_ID)
Alert(AN_SysScrnType);
/* Set PAL or NTSC default height if we are running on Amiga(tm) hardware.
* We also need to check if this is really PAL or NTSC mode because we have to
* use PC 640x480 mode if user has Amiga hardware + RTG board.
* Check DisplayFlags first because non-Amiga modeIDs use different format.
*/
/* We want the screen to occupy the whole display, so we find best maching
mode ID and then open a screen with that mode */
mode = BestModeID(BIDTAG_DesiredWidth, 640, BIDTAG_DesiredHeight, height,
BIDTAG_Depth, MinDepth, TAG_DONE);
if (mode != INVALID_ID)
{
struct Screen *scr = OpenScreenTags(NULL, SA_DisplayID, mode, SA_Draggable, FALSE,
SA_Quiet, TRUE, SA_Depth, MinDepth, TAG_DONE);
if (scr)
return scr;
}
/* We can't open a screen. Likely there are no display modes in the database at all */
Alert(AN_SysScrnType);
return NULL;
}
static struct Screen *OpenBootScreenType2(struct DOSBootBase *DOSBootBase, BYTE MinDepth, BYTE SquarePixels)
{
UWORD height;
ULONG mode;
GfxBase = (void *)TaggedOpenLibrary(TAGGEDOPEN_GRAPHICS);
IntuitionBase = (void *)TaggedOpenLibrary(TAGGEDOPEN_INTUITION);
if ((!IntuitionBase) || (!GfxBase))
/* We failed to open one of system libraries. AROS is in utterly broken state */
Alert(AT_DeadEnd|AN_BootStrap|AG_OpenLib);
height = 240;
mode = BestModeID(BIDTAG_DesiredWidth, 320, BIDTAG_DesiredHeight, height,
BIDTAG_Depth, MinDepth, TAG_DONE);
if (mode == INVALID_ID)
Alert(AN_SysScrnType);
mode = BestModeID(BIDTAG_DesiredWidth, 320, BIDTAG_DesiredHeight, height,
BIDTAG_Depth, MinDepth, TAG_DONE);
if (mode != INVALID_ID)
{
struct Screen *scr = OpenScreenTags(NULL, SA_DisplayID, mode, SA_Draggable, FALSE,
SA_Quiet, TRUE, SA_Depth, MinDepth, TAG_DONE);
if (scr)
return scr;
}
/* We can't open a screen. Likely there are no display modes in the database at all */
Alert(AN_SysScrnType);
return NULL;
}
struct Screen *OpenBootScreen(struct DOSBootBase *DOSBootBase)
{
/* Boot menu requires basic 4+ color screen */
return OpenBootScreenType(DOSBootBase, 2, FALSE);
}
struct Screen *NoBootMediaScreen(struct DOSBootBase *DOSBootBase)
{
/* Boot anim requires 16+ color screen and 1:1 pixels */
struct Screen *scr = OpenBootScreenType2(DOSBootBase, 4, TRUE);
if (!anim_Init(scr, DOSBootBase))
{
SetAPen(&scr->RastPort, 1);
Move(&scr->RastPort, 215, 120);
Text(&scr->RastPort, "Vampire wants your media blood", 26);
}
return scr;
}
void CloseBootScreen(struct Screen *scr, struct DOSBootBase *DOSBootBase)
{
CloseScreen(scr);
CloseLibrary(&IntuitionBase->LibNode);
CloseLibrary(&GfxBase->LibNode);
}