home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
553.lha
/
NewAvailFonts
/
NewAF.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-09
|
4KB
|
174 lines
/* NewAF.c -
* compiled with SASC 5.10a
* LC -b0 -cfist -v NewAF.c
* Blink FROM LIB:c.o,NewAF.o TO NewAF LIBRARY LIB:LC.lib,LIB:Amiga.lib
*
* Écrit par Jean-Michel Bezeau © 1991
* Ceci est la version modifié de l'exemple de commodité paru dans AmigaMail
*
* Création: 1991-08-14
*
*/
#include <exec/libraries.h>
#include <libraries/commodities.h>
#include <dos/dos.h>
#include <dos/dostags.h>
//#include <proto/exec.h>
#include <clib/exec_protos.h>
#include <pragmas/exec.h>
#include <proto/dos.h>
#include <proto/commodities.h>
#include <libraries/diskfont.h>
#include <clib/alib_protos.h>
#include <clib/alib_stdio_protos.h>
#include <string.h>
int CXBRK(void) { return(0); } /* Disable Lattice CTRL/C handling */
int chkabort(void) { return(0); }
struct Library *CxBase, *IconBase;
struct MsgPort *Broker_mp;
S Library *DFBase;
CxObj *Broker;
char Version[] = "NewAF v1.0 © Jean-Michel Bezeau 1991\0$VER: NewAF 1.0 (14-08-91)";
struct NewBroker NewBroker = {
NB_VERSION,
"NewAF", /* string to identify this broker */
Version,
"Patch system to force CG fonts",
NBU_UNIQUE | NBU_NOTIFY, /* Don't want any new commodities
* starting with this name. If someone
* tries it, let me know */
0,
0,
0,
0
};
ULONG cxsigflag;
//#pragma libcall DiskfontBase AvailFonts 24 10803
LONG (* __asm __saveds oldAvailFonts) ( register __a0 struct AvailFontsHeader *buffer,
register __d0 LONG bufBytes,
register __d1 ULONG flags,
register __a6 ULONG base );
/* ------------------------------------------------------------------------ */
LONG __asm __saveds newAvailFonts( register __a0 struct AvailFontsHeader *buffer,
register __d0 LONG bufBytes,
register __d1 ULONG flags,
register __a6 ULONG base )
{
if (flags == 0xff) // Pour prowrite
flags = AFF_SCALED | AFF_DISK | AFF_MEMORY;
flags |= AFF_SCALED;
return oldAvailFonts (buffer, bufBytes, flags, base);
}
/* ------------------------------------------------------------------------ */
LONG ProcessMsg(void)
{
extern struct MsgPort *Broker_mp;
extern CxObj *Broker;
extern ULONG cxsigflag;
CxMsg *msg;
ULONG sigrcvd, msgid, msgtype;
LONG returnvalue = 1L;
sigrcvd = Wait(SIGBREAKF_CTRL_C | cxsigflag);
while(msg = (CxMsg *)GetMsg(Broker_mp)) {
msgid = CxMsgID(msg);
msgtype = CxMsgType(msg);
ReplyMsg((struct Message *)msg);
switch(msgtype) {
case CXM_COMMAND:
switch(msgid) {
case CXCMD_DISABLE:
if (oldAvailFonts != NULL) {
SetFunction (DFBase, -(0x24), (APTR)oldAvailFonts);
oldAvailFonts = NULL;
ActivateCxObj(Broker, 0L);
}
break;
case CXCMD_ENABLE:
if (oldAvailFonts == NULL) {
oldAvailFonts = SetFunction (DFBase, -(0x24), (APTR)newAvailFonts);
ActivateCxObj(Broker, 1L);
}
break;
case CXCMD_KILL:
returnvalue = 0L;
break;
case CXCMD_UNIQUE: // Pour être tout seul à rouler sous ce nom
returnvalue = 0L;
break;
default:
break;
}
break;
default:
break;
}
}
if (sigrcvd & SIGBREAKF_CTRL_C) {
returnvalue = 0L;
}
return(returnvalue);
}
/* ------------------------------------------------------------------------ */
void main(int argc, char **argv)
{
if (CxBase = OpenLibrary("commodities.library", 37L)) {
if (Broker_mp = CreateMsgPort()) {
NewBroker.nb_Port = Broker_mp;
cxsigflag = 1L << Broker_mp->mp_SigBit;
if (Broker = CxBroker(&NewBroker, NULL)) {
DFBase = OpenLibrary ("diskfont.library", 37L);
if (DFBase != NULL) {
oldAvailFonts = SetFunction (DFBase, -(0x24), (APTR)newAvailFonts);
ActivateCxObj(Broker, 1L);
while (ProcessMsg());
DeleteCxObj(Broker);
if (oldAvailFonts != NULL)
SetFunction (DFBase, -(0x24), (APTR)oldAvailFonts);
CloseLibrary (DFBase);
}
}
DeleteMsgPort(Broker_mp);
}
CloseLibrary(CxBase);
}
return;
}