256
General Calculator Help / Re: Hacking the TI Nspire CX Native OS?
« on: January 19, 2013, 07:55:39 pm »
I understand C fairly well, but I don't see where the code adds the "6: Theme Editor" to the Settings menu.. Any ideas?
In Gui.c, last lines.
Edit1: okay, I'm naughty ..
Basicly, menus in the TI-Nspire OS are static and encoded like that :
Quote
Deep, Resource ID, callback, callbackdata, Resource Lib,
...
0, 0, 0, 0, 0
Deep defines what deep the menu entry is, basically, if it is in a submenu.
When you have a submenu, its callback and callbackdata are null.
The submenu is right after this entry.
Resource ID defines the offset in the Resource Lib. You'll have to extract all the resource strings to have an idea what is behind.
The function called is get_res_string(lib, id); This returns an utf16 char array.
Callback is the function that is ran when you hit the entry
Callbackdata is the data passed to this function as 2nd argument (first is the Button, third is the event Code - keep in mind to have a condition code to filter only active events like Enter or MouseClic).
Resource Lib is the lib to use for the string (SYST, DCOL, CTLG, etc ....) - those are defines in nFrame, sorry.
Edit2: By the way, I do not really add '6 - Theme Editor' because I do not have the place for one more entry in the OS.
I simply copied the existing table (I could have made a simple copy table also) in the source code and put one more entry.
This is not the extensible way to do, I know it, but it was worth for testing :p.