0 Members and 1 Guest are viewing this topic.
Quote from: ElementCoder on January 17, 2013, 03:30:14 amDon't we have nsNandMgr for this now? Or is that not capable of loading custom OSes?nsNandMgr doesn't deal with OSes at all, and so is unable to run them.But as nsNandMgr does deal with Boot2/Diags, you could run a custom Boot2 which would then load an OS the way you want.
Don't we have nsNandMgr for this now? Or is that not capable of loading custom OSes?
How difficult is it to create a custom Boot2?
Could this brick my calculator if I messed up?
Now where would I begin modifying the OS to change some menus around? I see a bunch of asm files
But where do I go from here? Say, to add some entries to the menu when the "menu" key is pressed?
void hook_menu_handler(Button button, CallbackData button_data, EventCode eventCode){ if(eventCode == ENTER || eventCode == MOUSECLIC) { Config *conf = new_config(); char *filename = "/ThemeEditor.tns"; char *argv[] = {filename}; if (read_config(conf, 1, argv)) { free_config(conf); return; } if (conf->mode == 2) conf->current_index = themeEditor(conf->current_index); else theme_editor_gui(conf); write_config(conf); free_config(conf); }}static int32_t* new_menu = NULL;void hook_menu (){ if(*((int*)HOOK_ADDR) == HOOK_VALUE) { int32_t new_menu_[] = { 1, 0xE5, 0xFFFFFFFF, 1, SYST, 2, 0xE7, 0, 0, SYST, 3, 0xEB, 0xFFFFFFFF, 2, SYST, 3, 0x16D, 0xFFFFFFFF, 3, SYST, 1, 0x176, 0xFFFFFFFF, 4, SYST, 1, 0x192, 0xFFFFFFFF, 5, SYST, 1, 0x5E, 0xFFFFFFFF, 6, SYST, // sentinel 0x42133769 because we can't get absolute addressing in the declaration of a table 1, 0x34, 0x42133769, 0, SYST, 0, 0, 0, 0, 0 }; new_menu = malloc (sizeof (new_menu_)); unsigned i = 0; unsigned n = sizeof (new_menu_) / sizeof (new_menu_[0]); for (; i < n; ++i) if (new_menu_[i] == (int32_t)0xFFFFFFFF) new_menu[i] = (int32_t)MENU_CALLBACK; else if (new_menu_[i] == 0x42133769) new_menu[i] = (int32_t)hook_menu_handler; else new_menu[i] = (int32_t)new_menu_[i]; *((int32_t**)HOOK_ADDR) = new_menu; puts("patched"); nl_set_resident(); }
I understand C fairly well, but I don't see where the code adds the "6: Theme Editor" to the Settings menu.. Any ideas?
Deep, Resource ID, callback, callbackdata, Resource Lib,...0, 0, 0, 0, 0
How do I extract the resource strings using "get_res_string(lib, id)" ? Say I added that in the C file somewhere, how would I be able to see the array that is returned?
#include <os.h>#include <libndls.h>static unsigned get_res_string_addrs[] = {0x100E9B20, 0x100E9E10, 0x100E9634, 0x100E994C};#define get_res_string SYSCALL_CUSTOM(get_res_string_addrs, char *, int, int)enum { CLNK = 0x636C6E6B, CTLG = 0x63746C67, DCOL = 0x64636F6C, DLOG = 0x646C6F67, DTST = 0x64747374, GEOG = 0x67656F67, MATH = 0x6D617468, MWIZ = 0x6D77697A, NTPD = 0x6E747064, PGED = 0x70676564, QCKP = 0x71636B70, QUES = 0x71756573, SCPD = 0x73637064, SYST = 0x73797374, TBLT = 0x74626C74,};int main(){ char *undef = "U\0n\0d\0e\0f\0i\0n\0e\0d\0\0"; int i = 0; char *utf16; String s = string_new(); do { string_set_utf16(s, get_res_string(SYST, i)); if (memcmp(undef, s->str, 20) == 0) break; char ascii[s->len + 1]; printf("0x%X : %s\n", i, string_to_ascii(s)); ++i; } while (1); string_free(s); puts(""); return 0;}