0 Members and 4 Guests are viewing this topic.
/* Shared data between hook and nclock */static long * display12hrs = 0;... (same style as the line above)static long * checkTimeOnStartup = 0;static long * noMiniClock = 0;
/* Install hook */HOOK_INSTALL(HOOK_ADDR, hook_nclock);
/* If hook isn't already installed */if(*((int*)HOOK_ADDR) == HOOK_VALUE) {}
HOOK_DEFINE(hook_nclock) { if(!*noMiniClock) mini_nclock(1); HOOK_RESTORE_RETURN(hook_nclock);}
// Defines the adresses and value(?)static const int hook_addrs[] = {0x100B66C8, 0x100B6988, // Clickpad / Touchpad 3.1 0x100EAAAC, 0x100EADC4, // CX 3.1 0x100E72CC, 0x100E75E4, // CM 3.1 0x101122b8, 0x100eb288, // Clickpad / Touchpad 3.6 0x10111cfc, 0x1011201C}; // CX 3.6//What does this mean? what does nl_osvalue(... , ...); do?#define HOOK_ADDR (nl_osvalue((int*)hook_addrs, sizeof(hook_addrs)/sizeof(hook_addrs[0])))static const int hook_values[] = {0xe92d47f0, 0xe92d47f0, 0xE59F1030, 0xE59F1030, 0xE59F1030, 0xE59F1030, 0xE59F1030, 0xE59F1030, 0xE59F1030, 0xE59F1030};#define HOOK_VALUE (nl_osvalue((int*)hook_values, sizeof(hook_values)/sizeof(hook_values[0])))
int n1_osvalue(const values[], unsigned size):returns the value of values corresponding to the OS version. size is the number of values.values[0] corresponds to non-CAS 3.1, values[1] to CAS 3.1, values[2] to non-CAS CX 3.1,values[3] to CAS CX 3.1, values[4] to CM-C 3.1, values[5] to CAS CM-C 3.1.
Is there any good hooking tutorial for ndless on the ti-nspire 3.6?
I wanted to make a notepad which i can activate by something like ctrl+return.
Code: [Select]// Defines the adresses and value(?)static const int hook_addrs[] = {0x100B66C8, 0x100B6988, // Clickpad / Touchpad 3.1 0x100EAAAC, 0x100EADC4, // CX 3.1 0x100E72CC, 0x100E75E4, // CM 3.1 0x101122b8, 0x100eb288, // Clickpad / Touchpad 3.6 0x10111cfc, 0x1011201C}; // CX 3.6//What does this mean? what does nl_osvalue(... , ...); do?#define HOOK_ADDR (nl_osvalue((int*)hook_addrs, sizeof(hook_addrs)/sizeof(hook_addrs[0])))static const int hook_values[] = {0xe92d47f0, 0xe92d47f0, 0xE59F1030, 0xE59F1030, 0xE59F1030, 0xE59F1030, 0xE59F1030, 0xE59F1030, 0xE59F1030, 0xE59F1030};#define HOOK_VALUE (nl_osvalue((int*)hook_values, sizeof(hook_values)/sizeof(hook_values[0])))
The full code of nclock is attached.
So this means that for every os version the author of nclock has a specific address?
How do i get these addresses?
By finding out what interrupts are and everything around it, the only thread was this one:
http://www.omnimaga.org/calculator-c-language/(ndless)-interrupts-newbie-hereYou tried to help him and he seems to understand... I don't
installhook(ram_address, function_to_activate_when_ram_has_a_specific_value());//orinstallhook(ram_address); //launches my program, when user presses ctrl+return
Vogtinator told me that the os interrupt handler is a good place to set up a hook. You tell me that the key code translator is the better place.
I "just" wanted a little code example cause i cant rly figure out how i can manipulate the ram(?)
I just wanted something like this if its possible:Code: [Select]installhook(ram_address, function_to_activate_when_ram_has_a_specific_value());
installhook(ram_address, function_to_activate_when_ram_has_a_specific_value());
Afaik, a hook means a ram address and if the value is changed, my code activates(?)
0x00 MOV r1, #00x04 MOV r2, #420x08 MOV r3, #690x0C BL foo0x10 BL bar
/* Hook at address 0x0 on every OS version */static const int hook_addrs[] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};#define HOOK_ADDR (nl_osvalue((int*)hook_addrs, sizeof(hook_addrs)/sizeof(hook_addrs[0])))HOOK_DEFINE(my_hook) { /* Code */}int main() { HOOK_INSTALL(HOOK_ADDR , my_hook) nl_set_resident(); return 0;}
0x00 ADD LR, PC, #4 ; compute return address0x04 STMFD !SP, {R0-R12, LR} ; save the context0x08 B hook_handler ; jump to handler0x0C BL foo ; previous context0x10 BL bar ; previous context[...] ; elsewhere in RAMhook_handler:0x40 BL my_hook ; the hook defined in C with HOOK_DEFINE0x44 MOV r1, #0 ;\0x48 MOV r2, #42 ; }all the previous context saved because we erased it with custom code0x4C MOV r3, #69 ;/0x50 LDMFD !SP, {R0-R12, PC} ; return to previous context
#define HOOK_ADDRjust decides which is used right?
How can i find these addresses? When i open the debugger, my emulator freezed (both emulators so it seems to be normal)
I dont know any assembler
By finding out what interrupts are and everything around it, the only thread was this one:http://www.omnimaga.org/calculator-c-language/(ndless)-interrupts-newbie-here/You tried to help him and he seems to understand... I don't