home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magazyn Amiga Shareware Floppies
/
ma58.dms
/
ma58.adf
/
superplay-lib_DEV
/
Programmers
/
Example_SPObjects
/
SPO
/
SP_RecogSubs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-05-27
|
4KB
|
149 lines
/* SP_RecogSubs.c
- Functions for External Module Recognition and Binding -
(c) 1993-96 by Andreas R. Kleinert
Last changes : 27.05.1996
*/
#include "spobject.h"
#include <exec/execbase.h>
#include <exec/resident.h>
#include <exec/initializers.h>
ULONG __saveds __stdargs SPLI_OpenLibs(void);
void __saveds __stdargs SPLI_CloseLibs(void);
void __saveds __stdargs SPLI_InitSPOList(void);
struct ExecBase *SysBase = N;
struct DosLibrary *DOSBase = N;
struct IntuitionBase *IntuitionBase = N;
struct GfxBase *GfxBase = N;
struct Library *UtilityBase = N;
struct XpkBase *XpkBase = N;
#define VERSION 2
#define REVISION 5
char __aligned SVLibName [] = "SPO.spobject";
char __aligned SVLibID [] = "SPO 2.5 (27.5.96)\15\12\0";
char __aligned AKCopyright [] = "(c) 1994-96 by Andreas R. Kleinert";
extern ULONG InitTab[];
extern APTR EndResident; /* below */
struct Resident ROMTag =
{
RTC_MATCHWORD,
&ROMTag,
&EndResident,
RTF_AUTOINIT,
VERSION,
NT_LIBRARY,
REVISION,
&SVLibName[0],
&SVLibID[0],
&InitTab[0]
};
APTR EndResident;
struct MyDataInit
{
UWORD ainit1; UWORD binit1; UWORD ln_type;
UBYTE ainit2; UBYTE binit2; ULONG ln_name2;
UWORD ainit3; UWORD binit3; UWORD lib_flags;
UWORD ainit4; UWORD binit4; UWORD lib_version;
UWORD ainit5; UWORD binit5; UWORD lib_revision;
UBYTE ainit6; UBYTE binit6; ULONG lib_idstring2;
ULONG end;
} DataTab =
{
INITBYTE(OFFSET(Node, ln_Type), NT_LIBRARY),
0x80, (UBYTE) OFFSET(Node, ln_Name), (ULONG) &SVLibName[0],
INITBYTE(OFFSET(Library, lib_Flags), LIBF_SUMUSED|LIBF_CHANGED),
INITWORD(OFFSET(Library, lib_Version), VERSION),
INITWORD(OFFSET(Library, lib_Revision), REVISION),
0x80, (UBYTE) OFFSET(Library, lib_IdString), (ULONG) &SVLibID[0],
(ULONG) 0
};
ULONG __saveds __stdargs SPLI_OpenLibs(void)
{
SysBase = (*((struct ExecBase **) 4));
DOSBase = (APTR) OpenLibrary("dos.library", 37);
if(!DOSBase) return(FALSE);
IntuitionBase = (APTR) OpenLibrary("intuition.library", 37);
if(!IntuitionBase) return(FALSE);
GfxBase = (APTR) OpenLibrary("graphics.library", 37);
if(!GfxBase) return(FALSE);
UtilityBase = (APTR) OpenLibrary("utility.library", 37);
if(!UtilityBase) return(FALSE);
XpkBase = (APTR) OpenLibrary("xpkmaster", 2);
if(!XpkBase) return(FALSE);
return(TRUE);
}
void __saveds __stdargs SPLI_CloseLibs(void)
{
if(DOSBase) CloseLibrary((APTR) DOSBase);
if(IntuitionBase) CloseLibrary((APTR) IntuitionBase);
if(GfxBase) CloseLibrary((APTR) GfxBase);
if(UtilityBase) CloseLibrary((APTR) UtilityBase);
if(XpkBase) CloseLibrary((APTR) XpkBase);
}
void __saveds __stdargs SPLI_InitSPOList(void)
{
struct SPO_ObjectNode *spo_node = N;
SPObjectBase->spb_SPObject = N;
if(FindName(&SysBase->LibList, "superplay.library"))
{
struct SuperPlayBase *SuperPlayBase = (APTR) OpenLibrary("superplay.library", 2);
if(SuperPlayBase)
{
SPObjectBase->spb_SPObject = (APTR) FindName((APTR) &SuperPlayBase->spb_SPObjectList, "SPO.spobject");
CloseLibrary((APTR) SuperPlayBase);
}
}else
{
spo_node = AllocVec(sizeof(struct SPO_ObjectNode), (MEMF_CLEAR|MEMF_PUBLIC));
if(!spo_node) return;
SPObjectBase->spb_SPObject = spo_node;
((struct Node *)spo_node)->ln_Type = NT_UNKNOWN;
((struct Node *)spo_node)->ln_Pri = -1;
((struct Node *)spo_node)->ln_Name = N;
spo_node->spo_Version = 2;
spo_node->spo_ObjectType = SPO_OBJECTTYPE_SAMPLE;
strcpy(spo_node->spo_FileName, "SPO.spobject");
strcpy(spo_node->spo_TypeID, "SPO Sample");
spo_node->spo_TypeCode = N; /* set by superplay.library */
spo_node->spo_SubTypeNum = 1;
strcpy(spo_node->spo_SubTypeID[0], " ");
spo_node->spo_SubTypeCode[0] = N; /* set by superplay.library */
spo_node->spo_BackgroundReplay = TRUE;
}
}