/*============================================================================*/
/*=                                                                          =*/
/*= Alertpatch V1.50                                                         =*/
/*= by Ctryxx of Trinomic  23.01.95                                          =*/
/*= © 1995                                                                   =*/
/*=                                                                          =*/
/*= now replaced the rülf                                                    =*/
/*=                                                                          =*/
/*============================================================================*/

#include <exec/exec.h>						/* einbinden der Standard-Header-Dateien */
#include <dos/dos.h>
#include <intuition/intuitionbase.h>

#include <proto/exec.h>
#include <proto/intuition.h>


/*============================================================================*/
/*= Deklaration von Funktionen                                               =*/
/*============================================================================*/

BOOL __asm __saveds DisplayAlert_patch( register __d0 ULONG nr, register __a0 UBYTE *st, register __d1 LONG he );


/*============================================================================*/
/*= Deklaration von externen Variablen                                       =*/
/*============================================================================*/

struct IntuitionBase *IntuitionBase = NULL;


/*============================================================================*/
/*= Patch der Funktion DisplayAlert, Alert->Requester                        =*/
/*============================================================================*/

BOOL __asm __saveds DisplayAlert_patch( register __d0 ULONG nr, register __a0 UBYTE *st, register __d1 LONG he )

{	struct EasyStruct ReqText =
   {	sizeof(struct EasyStruct),
    	0,
    	"AlertPatch V1.50 by Ctryxx/Trinomic",
    	0l,
    	"Schrompf|Bundeswehr!!!",
 	};

	ReqText.es_TextFormat = st+3;

	for( he=0; he<2; st++ )						/*Bearbeiten des Alertstrings */
	{	if ( *st == 0 )
		{	*st = 32;
			he++;
		}
		else
		{	he = 0;
		}

		if ( *st == 1 )
		{	*st = 32;
			*(st+1) = 32;
			*(st+2) = 32;
			*(st+3) = 10;
		}
	}

	return( (BOOL)EasyRequest(0l, &ReqText, 0l) );
}


/*============================================================================*/
/*= Installer für den Patch                                                  =*/
/*============================================================================*/

void main( void )

{	APTR	displayAlert;

	if (! (IntuitionBase = OpenLibrary( "intuition.library",0l )) )
	{	CloseLibrary( IntuitionBase );
		exit( 0 );
	}

	Forbid();
	displayAlert = SetFunction( IntuitionBase, -90, DisplayAlert_patch );
	Permit();
	Wait( SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D );
	
	Forbid();
	SetFunction( IntuitionBase, -90, displayAlert );
	Permit();
	CloseLibrary( IntuitionBase );

	exit( 0 );
}
