https://github.com/commandblockguy/capnhook
A hook management library for the TI-84 Plus CE
https://github.com/commandblockguy/capnhook
ti-84-plus-ce
Last synced: 10 months ago
JSON representation
A hook management library for the TI-84 Plus CE
- Host: GitHub
- URL: https://github.com/commandblockguy/capnhook
- Owner: commandblockguy
- License: mit
- Created: 2020-03-01T04:45:10.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-09-15T01:16:07.000Z (over 3 years ago)
- Last Synced: 2025-02-27T15:28:38.409Z (11 months ago)
- Topics: ti-84-plus-ce
- Language: Assembly
- Homepage:
- Size: 126 KB
- Stars: 15
- Watchers: 6
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cap'n Hook
*A hook manager for the TI-84 Plus CE and TI-83 Premium CE.*
[Hooks](https://wikiti.brandonw.net/index.php?title=83Plus:OS:Hooks) are a feature of TI-OS that allow apps and programs to run their own code whenever an event occurs in the OS - for example, using a token hook, you can change how tokens are displayed in TI-OS.
A major limitation of hooks is that only one program can install a hook of a particular type. If another program wants to use the same type of hook, it must either prevent the first hook from using it, or implement chaining logic.
Cap'n Hook seeks to prevent this problem by providing a common interface for programs to register their hooks with. This has a number of advantages over the OS's interface:
* Multiple programs can use the same type of hook.
* Individual programs do not have to implement chaining logic.
* If a hook is changed by a program that does not use Cap'n Hook, the next time a program that does use Cap'n Hook is run, the old hooks are restored.
* In case two hooks conflict with each other (for example, two programs both want to open a menu when a certain key is pressed), the user can assign them a priority to change which one will run.
Cap'n Hook does not currently provide a mechanism for storing hooks persistently. Hooks should be stored somewhere that is unlikely to be overwritten - for example, in a deleted appvar, which will persist until the next garbage collect.
Before using this library, [reserve a range of IDs for your program](https://github.com/commandblockguy/capnhook/wiki/Hook-ID-Registry) to prevent conflicts with other programs.