muimaster.library: update minor version
[AROS.git] / arch / m68k-amiga / setpatch / setpatch_init.c
blobb02999daf747cb51b6e40a104bd594f57d6a4c61
1 /*
2 * Copyright (C) 2013, The AROS Development Team
3 * All right reserved.
4 * Author: Jason S. McMullan <jason.mcmullan@gmail.com>
6 * Licensed under the AROS PUBLIC LICENSE (APL) Version 1.1
7 */
9 #include <aros/debug.h>
10 #include <aros/symbolsets.h>
11 #include <proto/graphics.h>
12 #include <graphics/gfxbase.h>
14 #include LC_LIBDEFS_FILE
16 TEXT CONST aros_patchname[] = "AROS";
18 #include <dos/dosextens.h>
20 #if 0
21 AROS_LH1(struct MsgPort *, spFindPort,
22 AROS_LHA(CONST_STRPTR, name, A1),
23 struct ExecBase *, SysBase, 65, Exec)
25 AROS_LIBFUNC_INIT
26 if (strcmp(name, SETPATCH_1_NAME) == 0) {
27 bug("SetPatch v1.x detected\n");
29 if (strcmp(name, SETPATCH_2_NAME) == 0) {
30 bug("SetPatch v2.x detected\n");
32 return (struct MsgPort *)FindName(&SysBase->PortList,name);
33 AROS_LIBFUNC_EXIT
35 #endif
37 AROS_LH1(struct SignalSemaphore *, spFindSemaphore,
38 AROS_LHA(CONST_STRPTR, name, A1),
39 struct ExecBase *, SysBase, 99, Exec)
41 AROS_LIBFUNC_INIT
42 /* WB 3.x C:SetPatch called, we need to enable AGA. */
43 if (strcmp(name, SETPATCH_3_NAME) == 0) {
44 /* Not nice. Calling OpenLibrary() inside FindSemaphore(). */
45 struct GfxBase *GfxBase = (struct GfxBase*)TaggedOpenLibrary(TAGGEDOPEN_GRAPHICS);
46 if (GfxBase) {
47 SetChipRev(SETCHIPREV_BEST);
48 CloseLibrary(GfxBase);
50 /* bug("SetPatch v3.x detected: %s\n", ((struct Process*)FindTask(NULL))->pr_Arguments ); */
52 return (struct SignalSemaphore *)FindName(&SysBase->SemaphoreList,name);
53 AROS_LIBFUNC_EXIT
56 int SetPatch_Init(struct SetPatchBase *sp)
58 /* Make dummy port for WB 1.x's SetPatch */
59 sp->sp_Patch1.sp_MsgPort.mp_Node.ln_Name = SETPATCH_1_NAME;
60 sp->sp_Patch1.sp_MsgPort.mp_Node.ln_Pri = -128;
61 sp->sp_Patch1.sp_MsgPort.mp_Flags = PA_IGNORE;
62 NEWLIST(&sp->sp_Patch1.sp_MsgPort.mp_MsgList);
63 AddPort(&sp->sp_Patch1.sp_MsgPort);
65 /* Make dummy port for WB 2.x's SetPatch */
66 sp->sp_Entry2[0].se_Valid = 1;
67 sp->sp_Entry2[0].se_Name = aros_patchname;
68 sp->sp_Entry2[1].se_Valid = 0;
70 sp->sp_Patch2.sp_PatchEntrySize = sizeof(sp->sp_Entry2[0]);
71 sp->sp_Patch2.sp_ThisIsTheValue2 = 2;
72 sp->sp_Patch2.sp_PatchTable = &sp->sp_Entry2[0];
74 sp->sp_Patch2.sp_Version_Major = sp->sp_Library.lib_Version;
75 sp->sp_Patch2.sp_Version_Minor = sp->sp_Library.lib_Revision;
77 sp->sp_Patch2.sp_MsgPort.mp_Node.ln_Name = SETPATCH_2_NAME;
78 sp->sp_Patch2.sp_MsgPort.mp_Node.ln_Pri = -128;
79 sp->sp_Patch2.sp_MsgPort.mp_Flags = PA_IGNORE;
80 NEWLIST(&sp->sp_Patch2.sp_MsgPort.mp_MsgList);
81 AddPort(&sp->sp_Patch2.sp_MsgPort);
83 /* Make dummy semaphore for WB 3.x's SetPatch */
84 sp->sp_Patch3.sp_Version_Major = sp->sp_Library.lib_Version;
85 sp->sp_Patch3.sp_Version_Minor = sp->sp_Library.lib_Revision;
87 NEWLIST(&sp->sp_Patch3.sp_PatchList);
89 sp->sp_Patch3.sp_Semaphore.ss_Link.ln_Name = SETPATCH_3_NAME;
90 sp->sp_Patch3.sp_Semaphore.ss_Link.ln_Pri = -128;
91 AddSemaphore(&sp->sp_Patch3.sp_Semaphore);
93 /* Patch FindPort and FindSemaphore */
94 #if 0
95 sp->sp_OldFindPort = SetFunction(SysBase, -65 * LIB_VECTSIZE, Exec_65_spFindPort);
96 #endif
97 sp->sp_OldFindSemaphore = SetFunction(SysBase, -99 * LIB_VECTSIZE, Exec_99_spFindSemaphore);
99 return 1;
102 ADD2INITLIB(SetPatch_Init, 0);