	IFND	UPS_I
UPS_I	SET	1
**
**	$VER: ups.i 39.0 (17.06.95)
**
**	Structures and constants for Ultimate Patch System.
**
**	(C) Copyright 1994-1995 Glenz Points.
**	    All Rights Reserved
**

	incdir	'include:'
	include	"exec/types.i"
	include	"exec/ports.i"



***
***  Patcher file structure
***

 STRUCTURE pfs,32
    LONG  pfs_ControlLong		; must be equal to ControlLong
    APTR  pfs_Next			; pointer to next patcher
    APTR  pfs_Prev			; pointer to prev patcher
    LONG  pfs_NeedVersion		; minimum version of UPS to start
    LONG  pfs_UsedVersion		; version of UPS which was used
					; while patcher was developed
    APTR  pfs_PatcherName		; pointer to name of patcher
    LONG  pfs_Version			; version
    APTR  pfs_CoderName			; pointer to name of programmer
    APTR  pfs_VersionString		; pointer to $VER: string
    APTR  pfs_PatcherIDString		; listview entry
    LONG  pfs_Flags			; flags
    LONG  pfs_Status			; status of flags
    APTR  pfs_ExecBase			; exec base
    APTR  pfs_IntBase			; intuition base
    APTR  pfs_GadTBase			; gadtools base
    APTR  pfs_DosBase			; dos base
    APTR  pfs_GfxBase			; graphics base
    APTR  pfs_CxBase			; commodities base
    APTR  pfs_LayBase			; layers base
    APTR  pfs_UPSBase			; UPS lib base
    FPTR  pfs_Init			; pointer to init routine
    FPTR  pfs_Exit			; pointer to exit routine
    FPTR  pfs_Prefs			; pointer to prefs routine
    APTR  pfs_PrefsKey                  ; pointer to cx keys to call
                                        ; prefs rout
    APTR  pfs_ListPtr			; pointer to structure of requested
    					; opened resources
    APTR  pfs_Patch			; pointer to structure for patches
    APTR  pfs_pls			; pointer to pls structure
    APTR  pfs_UPSMsgPort		; pointer to main UPS msg port
    APTR  pfs_UPSRexxPort		; pointer to rexx port
    APTR  pfs_pxs			; pointer to pxs structure
    APTR  pfs_fakesemaphore		; pointer to bool, TRUE for UPS's
					; setfunction
    LONG  pfs_User1			;
    LONG  pfs_User2			;
    LONG  pfs_ControlLong2		; ControlLong
    APTR  pfs_PFS			; pointer to the beginning of struct
    LABEL pfs_SIZEOF

pfsControlLong	        equ	$17061995
UPSMainVersion	        equ	39
UPSMainRevision	        equ	0
pfsPatcherStringLen	equ	25
pfsPatchLinkStringLen   equ     27
pfsPatcherStartupLen    equ     31
pfsOffsetLen            equ     26
pfsStartupCycleLen      equ     29
pfsLibOverviewLen       equ     38
pfsPMListviewLen        equ     16
pfsOldNewLen            equ      9
pfsPurposeLen           equ     16
pfsLOPatcherStrLen      equ     16

pfsDisableable	equ	$00000001	; Enable disable patcher option
pfsPrefs	equ	$00000002	; Prefs editor exists
pfsNoRemoveable equ     $00000004       ; Disable Removing of Patcher


***
***  Patcher Extended Structure
***

 STRUCTURE pxs,0
    LONG  pxs_CxID                      ; Commodity hotkey id
    APTR  pxs_CsObjs                    ; Commodity object pointer
    LABEL pxs_SIZEOF


***
***  Version strcuture
***

 STRUCTURE PVS,0
    WORD  PVS_Version			; version word
    BYTE  PVS_Revision			; revision byte
    BYTE  PVS_User1			;
    LABEL PVS_SIZEOF



***
***  Open Resource List
***

 STRUCTURE orl,0
    APTR  orl_Next			; pointer to next entry
    APTR  orl_Prev			; pointer to previous entry
    LONG  orl_Type			; type of resource
    LONG  orl_ID			; resource id
    LONG  orl_Flags                     ; flags
    APTR  orl_Name			; pointer to name of resource
    APTR  orl_Base			; base of opened resource
    LONG  orl_Version                   ; version, if needed
    STRUCT orl_DataRegs,4*8		; ...to put in data regs
    FPTR  orl_Open			; user open rout for user type
    FPTR  orl_Close			; user close rout for user type
    APTR  orl_UTName			; pointer to name for user type
    LONG  orl_User1			;
    LONG  orl_User2			;
    LABEL orl_SIZEOF

orlNoNecessary equ $00000001            ; dont care if not opened

 ENUM 1
 EITEM rt_Library			; resource type is library
 EITEM rt_TrapVector			; resource type is trap vector
 EITEM rt_Device			; resource type is device
 EITEM rt_Handler			; resource type is handler
 EITEM rt_Resource			; resource type is resource
 EITEM rt_DataType			; resource type is datatype
 ENUM 1024
 EITEM rt_User1				; User type. Needs user open/close
 EITEM rt_User2
 EITEM rt_User3
 EITEM rt_User4
 EITEM rt_User5
 EITEM rt_User6
 EITEM rt_User7
 EITEM rt_User8



***
***  Main Patch Structure
***

 STRUCTURE mps,0
    APTR  mps_Next			; pointer to next patch
    APTR  mps_Prev			; pointer to prev patch
    APTR  mps_Pri                       ; priority, less runs first
    APTR  mps_Patcher			; pointer to parent Patcher
    APTR  mps_PatchIDString		; listview entry
    APTR  mps_PurposeString		; pointer to purpose string
    LONG  mps_ID			; id of resource to be patched
    LONG  mps_Flags			; flags
    LONG  mps_Status			; status of flags
    LONG  mps_Offset			; offset to change
    FPTR  mps_New			; pointer to new routine
    FPTR  mps_Old			; pointer to old routine
    FPTR  mps_pns			; pointer to pns structure
    FPTR  mps_NotifyDisable		; notified when enabled/disabled
    FPTR  mps_Install			; install rout for user type
    FPTR  mps_Remove			; uninstall rout for user type
    FPTR  mps_Init			; pointer to init routine
    FPTR  mps_Exit			; pointer to exit routine
    APTR  mps_pls			; pointer to pls structure
    LONG  mps_User1			;
    LONG  mps_User2			;
    LONG  mps_User3			;
    LONG  mps_User4			;
    LABEL mps_SIZEOF


mpsIDStringLen	equ	27

mpsDisableable	equ	$00000001	; Enable disable patch option
mpsFullPatch    equ     $00000002       ; if full, don't call orig. patch
mpsDisTemp      equ     $00000004       ; While removed, previous status



***
***  Patch node struct
***

 STRUCTURE pns,0
    WORD  pns_Jsr			; jsr ($4eb9)
    APTR  pns_New			; newrout
    WORD  pns_Jmp			; jmp ($4ef9)
    APTR  pns_Next			; nextrout
    APTR  pns_Prev			; pointer to prev node
    APTR  pns_Pri                       ; pri, less first
    APTR  pns_Orig			; orginal routine
    APTR  pns_Patch			; pointer to main patch
    APTR  pns_Patcher			; pointer to patcher
    LONG  pns_Mark                      ; $fc263815
    APTR  pns_pns                       ; pointer to this structure
    LONG  pns_User1			;
    LONG  pns_User2			;
    LABEL pns_SIZEOF



***
***  UPS Message
***

 STRUCTURE um,MN_SIZE
    LONG  um_Command			; command to execute
    LONG  um_A0				; adress register 0
    LONG  um_A1				; adress register 1
    LONG  um_A2				; adress register 2
    LONG  um_A3				; adress register 3
    LONG  um_D0				; data register 0
    LONG  um_D1				; data register 1
    LONG  um_D2				; data register 2
    LONG  um_D3				; data register 3
    LABEL um_SIZEOF


umAllocUPS	equ	$00000001	; Allocate UPS, in a0 ptr to
					; app name
umFreeUPS	equ	$00000002	; Free UPS, in a0 ptr to app
					; name
umLoadPatcher	equ	$00000010	; Initiate LoadPatcher routine
umAddPatcher	equ	$00000015	; Load Patcher, in a0 ptr to
					; filename, in d0 error code
umInstall	equ	$00000030	; Install Patcher, in a0 ptr to
					; patcher, in d0 error code
umRemove	equ	$00000031	; Remove Patcher, in a0 ptr to
					; patcher
umOpenResource	equ	$00000050	; Open Resource, in a0 ptr to
					; resource, in d0 return BOOL.
umCloseResource	equ	$00000051	; Close Resource, in a0 ptr to
					; resource
umInstallPatch	equ	$00000040	; Install Patch, in a0 ptr to
					; patch, in d0 error code
umRemovePatch	equ	$00000041	; Remove Patch, in a0 ptr to
					; patch
umEnablePatcher	equ	$00000035	; Enable patcher in a0
umDisablePatcher equ	$00000036	; Disable patcher in a0
umEnablePLink	equ	$00000037	; Enadle patch link in a0
umDisablePLink	equ	$00000038	; Disable patch link in a0
umOpenMain	equ	$00000060	; Open Main Window
umCloseMain	equ	$0000006f	; Close Main Window
umOpenPM	equ	$00000061	; Open Patcher Manager Window
umClosePM	equ	$0000006e	; Close Patcher Man. Window
umOpenLO	equ	$00000062	; Open Library Overview Window
umCloseLO	equ	$0000006d	; Close Lib. Overview Window
umSpitRequester	equ	$00000070	; Spit requester, with text in
					; a0
umPrint		equ	$00000073	; Print text line in a0
umPrefsPatcher	equ	$00000078	; Call prefs from Patcher in a0
umPrefsPatchL	equ	$0000007a	; Call prefs from PatchList in
					; a0
umGetLibBase	equ	$00000008	; Get base ptr from code in d0,
					; result in a0
umGetPList	equ	$0000000a	; Get PList ptr in a0, and
					; PList itself in d0/d1/d2
umMakeEasyPatcher equ	$0000001c	; Make easy patcher with
					; tagarray in a0. Pointer in
					; a0, or null for error
umFreeEasyPatcher equ	$0000001d	; Remove easy patcher in a0.
umMakeEasyPatch	equ	$0000001e	; Add Patch to easy patcher.
					; Pointer to tagarray in a0,
					; and parent patcher in a1.
					; Pointer to patch in a0, null
					; for error.
umFreeEasyPatch	equ	$0000001f	; Remove east patch in a0.
umNoFree	equ	$80000000	; Don't free memory after
					; processing

umLibExec	equ	$00000001
umLibDOS	equ	$00000002
umLibIntuition	equ	$00000003
umLibGadTools	equ	$00000004
umLibUtility	equ	$00000005
umLibCommodities equ	$00000006
umLibIcon	equ	$00000007
umLibReqTools	equ	$00000008
umLibLayers	equ	$00000009
umLibGraphics	equ	$0000000a
umLibWorkbench	equ	$0000000b

umTagNeedVer		equ	$80000001
umTagPatcherName	equ	$80000002
umTagCoderName		equ	$80000003
umTagPatcherIDString	equ	$80000004
umTagPatcherDisableable	equ	$80000005
umTagPatcherPrefs	equ	$80000006
umTagPatcherNoRemove	equ	$8000001b
umTagNeedVersion	equ	$80000007
umTagVersion		equ	$80000008
umTagInit		equ	$80000009
umTagExit		equ	$8000000a
umTagPrefs		equ	$8000000b
umTagPrefsKey		equ	$8000000c
umTagResourceType	equ	$8000000d
umTagResourceName	equ	$8000000e
umTagResourceVersion	equ	$8000000f
umTagResourceID		equ	$80000010
umTagPatchPri		equ	$80000011
umTagPatchPurposeString	equ	$80000012
umTagPatchIDString	equ	$80000013
umTagPatchOffset	equ	$80000014
umTagPatchDisableable	equ	$80000015
umTagPatchFullPatch	equ	$80000016
umTagPatch		equ	$80000017
umTagPatchNotifyDisable	equ	$80000018
umTagPatchInit		equ	$80000019
umTagPatchExit		equ	$8000001a       ; 1b is last



***
***  Patchers List
***

 STRUCTURE psl,MLN_SIZE			; simple node structure
    APTR  psl_Segment			; BPTR to patcher segment
    APTR  psl_Patcher			; pointer to patcher structure
    LABEL psl_SIZEOF


***
***  Patch link structure
***

 STRUCTURE pls,0
    APTR  pls_Next			; pointer to next link
    APTR  pls_Prev			; pointer to prev link
    APTR  pls_LinkIDString		; listview string
    APTR  pls_Prefs                     ; pointer to prefs routine
    LONG  pls_Flags                     ; flags
    LONG  pls_Status                    ; status
    LABEL pls_List			; patches

plsPrefs        equ     $00000001
plsDisableable  equ     $00000002
plsDisTemp      equ     $00000004       ; While removed, previous status


	ENDC	; UPS_I

