2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Graphics hidd initialization code.
9 #include <exec/types.h>
10 #include <exec/lists.h>
11 #include <proto/exec.h>
12 #include <proto/oop.h>
14 #include <utility/utility.h>
16 #include "graphics_intern.h"
21 /* Customize libheader.c */
22 #define LC_SYSBASE_FIELD(lib) (((LIBBASETYPEPTR )(lib))->hdg_SysBase)
23 #define LC_SEGLIST_FIELD(lib) (((LIBBASETYPEPTR )(lib))->hdg_SegList)
24 #define LC_RESIDENTNAME hiddgraphics_resident
25 #define LC_RESIDENTFLAGS RTF_AUTOINIT | RTF_COLDSTART
26 #define LC_RESIDENTPRI 9
27 #define LC_LIBBASESIZE sizeof(LIBBASETYPE)
28 #define LC_LIBHEADERTYPEPTR LIBBASETYPEPTR
29 #define LC_LIB_FIELD(lib) (((LIBBASETYPEPTR)(lib))->hdg_LibNode)
32 #define LC_NO_CLOSELIB
34 /* to avoid removing the gfxhiddclass from memory add #define NOEXPUNGE */
36 #include <libcore/libheader.c>
41 #include <aros/debug.h>
43 #define SysBase (LC_SYSBASE_FIELD(lh))
45 //struct ExecBase * SysBase;
47 ULONG SAVEDS STDARGS
LC_BUILDNAME(L_InitLib
) (LC_LIBHEADERTYPEPTR lh
)
49 struct class_static_data
*xsd
; /* GfxHidd static data */
52 EnterFunc(bug("GfxHIDD_Init()\n"));
55 We map the memory into the shared memory space, because it is
56 to be accessed by many processes, eg searching for a HIDD etc.
58 Well, maybe once we've got MP this might help...:-)
60 xsd
= AllocVec(sizeof(struct class_static_data
), MEMF_CLEAR
|MEMF_PUBLIC
);
64 xsd
->sysbase
= SysBase
;
68 xsd
->oopbase
= OpenLibrary(AROSOOP_NAME
, 0);
71 D(bug(" Got OOPBase\n"));
72 xsd
->utilitybase
= OpenLibrary("utility.library", 37);
75 D(bug(" Got UtilityBase\n"));
76 xsd
->gfxhiddclass
= init_gfxhiddclass(xsd
);
78 // D(bug(" GfxHiddClass: %p\n", csd->gfxhiddclass))
82 // D(bug(" Got GfxHIDDClass\n"))
83 ReturnInt("GfxHIDD_Init", ULONG
, TRUE
);
86 CloseLibrary(xsd
->utilitybase
);
88 CloseLibrary(xsd
->oopbase
);
96 ReturnInt("GfxHIDD_Init", ULONG
, FALSE
);
101 void SAVEDS STDARGS
LC_BUILDNAME(L_ExpungeLib
) (LC_LIBHEADERTYPEPTR lh
)
103 //EnterFunc(bug("GfxHIDD_Expunge()\n"))
107 free_gfxhiddclass(lh
->hdg_csd
);
109 CloseLibrary(lh
->hdg_csd
->utilitybase
);
110 CloseLibrary(lh
->hdg_csd
->oopbase
);
112 FreeVec(lh
->hdg_csd
);
115 ReturnVoid("GfxHIDD_Expunge");