;Hook manager GUI include "settings.inc" include "ti83plus.inc" include "equates.inc" SEGMENT Main GLOBALS ON EXTERN ExitApp,StartApp,PutSApp,ReorderChain,DispHexHL,DisplayPressAnyKey,DispA EXTERN menuAddr,topItem,selectedItem StartManager: B_CALL ClrLCDFull B_CALL HomeUp ld hl,hookTable ld (menuAddr),hl ld a,1 ld (topItem),a ld (selectedItem),a ld hl,sSelectHook call PutSApp RedrawManager: ld a,(topItem) ld c,a add a,c ld d,0 ld e,a ld hl,hookTable-2 add hl,de ld (menuAddr),hl push hl ld b,1 redrawLoop: ld a,b ld (curRow),a xor a ld (curCol),a ld a,' ' B_CALL PutC B_CALL PutC ld hl,(menuAddr) B_CALL ldHLind ld a,(selectedItem) cp c jr nz,$F set textInverse,(iy+textFlags) $$: call PutSApp res textInverse,(iy+textFlags) B_CALL EraseEOL ld a,(topItem) add a,a ld d,0 ld e,a ld hl,hookTable-2 add hl,de dec hl ld a,(hl) dec hl ld e,(hl) or e jr z,$F ld hl,0F01h ld (curRow),hl ld a,1Eh B_CALL PutC $$: ld hl,(menuAddr) inc hl inc hl ld e,(hl) inc hl ld a,(hl) dec hl or e jr z,redrawLoopDone ld (menuAddr),hl inc b inc c ld a,b cp 8 jr nz,redrawLoop redrawLoopDone: ld a,(topItem) add a,6 add a,a ld d,0 ld e,a ld hl,hookTable-2 add hl,de inc hl inc hl ld e,(hl) inc hl ld a,(hl) pop hl ld (menuAddr),hl ld hl,0F07h ld (curRow),hl or e ld a,' ' jr z,$F ld a,1Fh $$: B_CALL PutC managerKeyLoop: B_CALL GetKey cp kClear jr z,StartApp cp kQuit jr z,ExitApp cp kUp jr z,upPressed cp kDown jr z,downPressed cp kEnter jr z,enterPressed jr managerKeyLoop enterPressed: ld a,(selectedItem) cp silentLinkHookID jr nz,notSilentLinkHook ;Make sure they're 1.13+ for the silent link hook B_CALL GetBaseVer ld de,1*256+13 or a jr z,badOSVersion dec a jr nz,continueEnterPressed ;we're at least 2.x, so we're good for the silent link hook ld a,b cp 13 jr c,badOSVersion ;if we're not at least 1.13, get out jr continueEnterPressed notSilentLinkHook: ld a,(selectedItem) cp USBActivityHookID jr nz,continueEnterPressed B_CALL GetBaseVer ld de,2*256+30 dec a jr z,badOSVersion ;if version 1, get out now dec a jr nz,continueEnterPressed ;we're at least 3.x, so we're good for the USB activity hook ld a,b cp 30 jr c,badOSVersion continueEnterPressed: jr ReorderChain badOSVersion: push de B_CALL ClrLCDFull B_CALL HomeUp ld hl,sBadOSVersion call PutSApp pop hl ld de,0005h ld (curRow),de ld a,h add a,30h B_CALL PutC ld a,'.' B_CALL PutC ld a,l call DispA call DisplayPressAnyKey B_CALL GetKey jr StartApp sBadOSVersion: DB "You must have at" DB "least the OS " DB "version below to" DB "select this " DB "hook:",0 upPressed: ld a,1 ld hl,selectedItem cp (hl) jr z,managerKeyLoop ld b,(hl) dec (hl) ld a,(topItem) cp b jr nz,RedrawManager ld hl,topItem dec (hl) jr RedrawManager downPressed: ld hl,selectedItem ld a,24 cp (hl) jr z,managerKeyLoop inc (hl) ld b,(hl) ld a,(topItem) add a,7 cp b jr nz,RedrawManager ld hl,topItem inc (hl) jr RedrawManager sSelectHook: DB "Select Hook:",0 DW 0000h hookTable: DW sLinkActivityHook DW sCursorHook DW sLibraryHook DW sRawKeyHook DW sGetKeyHook DW sHomescreenHook DW sWindowHook DW sGraphHook DW sYEqualsHook DW sFontHook DW sRegraphHook DW sGraphicsHook DW sTraceHook DW sParserHook DW sAppChangeHook DW sCatalog1Hook DW sCatalog2Hook DW sHelpHook DW scxRedispHook DW sMenuHook DW sTokenHook DW sLocalizeHook DW sSilentLinkHook DW sUSBActivityHook DW 0000h sLinkActivityHook: DB "Link Activity",0 sCursorHook: DB "Cursor",0 sLibraryHook: DB "Library",0 sRawKeyHook: DB "RawKey",0 sGetKeyHook: DB "GetKey",0 sHomescreenHook: DB "Homescreen",0 sWindowHook: DB "Window",0 sGraphHook: DB "Graph",0 sYEqualsHook: DB "Y=",0 sFontHook: DB "Font",0 sRegraphHook: DB "Regraph",0 sGraphicsHook: DB "Graphics",0 sTraceHook: DB "Trace",0 sParserHook: DB "Parser",0 sAppChangeHook: DB "App Change",0 sCatalog1Hook: DB "Catalog1",0 sCatalog2Hook: DB "Catalog2",0 sHelpHook: DB "Help",0 scxRedispHook: DB "cxRedisp",0 sMenuHook: DB "Menu",0 sTokenHook: DB "Token",0 sLocalizeHook: DB "Localize",0 sSilentLinkHook: DB "Silent Link",0 sUSBActivityHook: DB "USB Activity",0