From: chaoskagami Date: Wed, 24 Aug 2016 05:06:38 +0000 (-0400) Subject: No, that menu gap is not normal on o3ds. X-Git-Tag: v0.3.0~40 X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=7e998946083d50b3ebf018bf77359f52a2c43998;p=corbenik%2Fcorbenik.git No, that menu gap is not normal on o3ds. How long have you guys been dealing with that one? Seriously, should have been reported long before now; it was a bug. Also, minor note to self. --- diff --git a/source/menu-backend.c b/source/menu-backend.c index fc58efa..d12576b 100644 --- a/source/menu-backend.c +++ b/source/menu-backend.c @@ -90,19 +90,23 @@ show_menu(struct options_s *options, uint8_t *toggles) else header("A:Enter B:Back DPAD:Nav Select:Info"); - - for (int i = window_top; options[i].index != -1; ++i) { // -1 Sentinel. - if (i > window_bottom) + for (int i = window_top, skip = 0; options[i].index != -1; ++i) { // -1 Sentinel. + if (i > window_bottom + skip) break; + if (options[i].allowed == boolean_val_n3ds && !is_n3ds) { + ++skip; + continue; + } + // NOTE - Signed to unsigned conversion here. Again, not an issue. - set_cursor(TOP_SCREEN, 0, (unsigned int)(i - window_top + 2) ); + set_cursor(TOP_SCREEN, 0, (unsigned int)(i - window_top - skip + 2) ); int indent = options[i].indent; for(int j=0; j < indent; j++) fprintf(TOP_SCREEN, " "); - if (options[i].allowed == boolean_val || (is_n3ds && options[i].allowed == boolean_val_n3ds)) { + if (options[i].allowed == boolean_val || options[i].allowed == boolean_val_n3ds) { if (cursor_y == i) { accent_color(TOP_SCREEN, 1); fprintf(TOP_SCREEN, ">>\x1b[0m "); diff --git a/source/patch/module.c b/source/patch/module.c index aba1a61..1120168 100644 --- a/source/patch/module.c +++ b/source/patch/module.c @@ -39,6 +39,8 @@ inject_module(char* fpath) if (module->contentSize > sysmodule->contentSize) { uint32_t need_units = (module->contentSize - sysmodule->contentSize); + // FIXME - We're potentially corrupting memory here depending on whether we go over the theoretical maximum size of FIRM + memmove((uint8_t *)sysmodule + module->contentSize * 0x200, (uint8_t *)sysmodule + sysmodule->contentSize * 0x200, ((uint32_t)firm_modules + firm_size) - ((uint32_t)sysmodule + (module->contentSize * 0x200)));