;TOSPJPKPJPKPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPAGAFAGAO

	incdir	"include:"
	include	"exec/types.i"
	include	"exec/ports.i"
	include	"libs/exec.i"
	include	"libs/reqtools.i"
	include	"libraries/reqtools.i"
	include	"intuition/intuitionbase.i"
	incdir	"ups:"
	include	"ups.i"


Start	moveq	#0,d0
	rts
.end	blk.b	32+Start-.end
	dc.l	pfsControlLong
	dc.l	0			; pointer to next patcher
	dc.l	0			; pointer to prev patcher
	dc.l	UPSMainVersion		; minimum version of UPS to start
	dc.l	UPSMainVersion		; version of UPS which was used
					; while patcher was developed
	dc.l	PatcherName		; pointer to name of patcher
	dc.w	39,0			; version
	dc.l	CoderName		; pointer to name of programmer
	dc.l	VerString		; pointer to $VER: string
	dc.l	PatcherIDString		; listview entry
	dc.l	pfsDisableable+pfsPrefs	; flags
	dc.l	0			; status of flags
execbase
	dc.l	0			; exec base
intbase	dc.l	0			; intuition base
gadtbase
	dc.l	0			; gadtools base
dosbase	dc.l	0			; dos base
gfxbase	dc.l	0			; graphics base
cxbase	dc.l	0			; commodities base
laybase	dc.l	0			; layers base
upsbase	dc.l	0			; UPS lib base
	dc.l	0			; pointer to init routine
	dc.l	0			; pointer to exit routine
	dc.l	popup			; pointer to prefs routine
	dc.l	keys			; pointer to cx keys to call prefs rout
	dc.l	Resources		; pointer to structure of requested
    					; opened resources
	dc.l	Patch1			; pointer to structure for patches
	dc.l	pls1			; pointer to pls structure
	dc.l	0			; pointer to main UPS msg port
	dc.l	0			; pointer to rexx port
	dc.l	0			; pointer to pxs structure
	dc.l	0,0,0
	dc.l	pfsControlLong
	dc.l	Start			; pointer to the beginning of struct

PatcherName
	dc.b	'Small Palette Utility',0
	even
CoderName
	dc.b	'Goran Mitrovic',0
	even
VerString
	dc.b	'$VER: Small Palette Utility V1.0',0
	even
PatcherIDString
	dc.b	'Small Palette Utility',0			; 25
	even
keys	dc.b	'rcommand shift p',0
	even


Resources
	dc.l	0			; pointer to next entry
	dc.l	0			; pointer to previous entry
	dc.l	rt_Library		; type of resource
	dc.l	100			; resource id
	dc.l	0			; flags
	dc.l	res1name		; pointer to name of resource
res1base
	dc.l	0			; base of opened resource
	dc.l	0			; version, if needed
	blk.l	8			; ...to put in data regs
	dc.l	0			; user open rout for user type
	dc.l	0			; user close rout for user type
	dc.l	0			; pointer to name for user type
	dc.l	0,0

res1name
	dc.b	'reqtools.library',0
	cnop	0,4



Patch1
	dc.l	0			; pointer to next patch
	dc.l	0			; pointer to prev patch
	dc.l	0			; priority, less runs first
	dc.l	Start			; pointer to parent Patcher
	dc.l	Patch1ID		; listview entry
	dc.l	Patch1purpose		; pointer to purpose string
	dc.l	100			; id of resource to be patched
	dc.l	mpsDisableable		; flags
	dc.l	0			; status of flags
	dc.l	rtPaletteRequestA	; offset to change
	dc.l	Patch1rout		; pointer to new routine
	dc.l	0			; pointer to old routine
	dc.l	0			; pointer to pns structure
	dc.l	notify			; notified when enabled/disabled
	dc.l	0			; install rout for user type
	dc.l	0			; uninstall rout for user type
	dc.l	0			; pointer to init routine
	dc.l	0			; pointer to exit routine
	dc.l	pls1			; pointer to pls structure
	dc.l	0,0,0,0


Patch1ID
	dc.b	'rtPaletteRequestA',0		; 27
	even
Patch1purpose
	dc.b	'nothing',0			; 16
	cnop	0,4



pls1	dc.l	0			; pointer to next link
	dc.l	0			; pointer to prev link
	dc.l	pls1ID			; listview string
	dc.l	popup			; pointer to prefs routine
	dc.l	plsDisableable+plsPrefs	; flags
	dc.l	0			; status
	dc.l	Patch1
	dc.l	0

pls1ID	dc.b	'rtPaletteRequestA',0		; 27
	cnop	0,4




Patch1rout
	rts

popup	tst.l	disabled
	bne.s	.exit
	movem.l	d1-a6,-(a7)
	lea	reqname,a1
	move.l	#38,d0
	move.l	4,a6
	jsr	OpenLibrary(a6)
	tst.l	d0
	beq.s	.exit2
	move.l	d0,a6

	move.l	intbase,a0
	move.l	ib_ActiveWindow(a0),window

	lea	title,a2
	move.l	#0,a3
	lea	tags,a0
	jsr	rtPaletteRequestA(a6)

	move.l	a6,a1
	move.l	4,a6
	jsr	CloseLibrary(a6)
.exit2	movem.l	(a7)+,d1-a6
.exit	rts

notify	move.l	d0,disabled
	rts

disabled
	dc.l	0				; 1 for disabled

title	dc.b	'Palette',0
reqname	dc.b	'reqtools.library',0
	cnop	0,4
tags	dc.l	RT_Window
window	dc.l	0
	dc.l	TAG_DONE,0

