示例#1
0
void main()
{
    clear_screens();

    if(mount_sd() != 0) {
        draw_loading("Failed to mount SD", "Make sure your SD card can be read correctly");
        return;
    }

    // This function already correctly draws error messages
    if (load_firm() != 0) return;

    if (load_cakes_info("/cakes/patches") != 0) {
        draw_loading("Failed to read some cakes", "Make sure your cakes are up to date\n  and your SD card can be read correctly");
        return;
    }

    load_config();

    // If the L button isn't pressed, autoboot.
    if (config->autoboot_enabled && *hid_regs ^ 0xFFF ^ key_l) {
        boot_cfw();
    }

    menu_main();
}
示例#2
0
void main()
{
    clear_screens();

    if(mount_sd() != 0) {
        draw_loading("Failed to mount SD", "Make sure your SD card can be read correctly");
        return;
    }

    load_config();

    // If the L button isn't pressed, autoboot.
    if (config->autoboot_enabled && *hid_regs ^ 0xFFF ^ key_l) {
        print("Autobooting...");

        if (read_file(firm_loc, PATH_PATCHED_FIRMWARE, FCRAM_SPACING) != 0 ||
                firm_loc->magic != FIRM_MAGIC) {
            print("Failed to load patched FIRM");
            draw_message("Failed to load patched FIRM", "The option to autoboot was selected,\n  but no valid FIRM could be found at:\n  " PATH_PATCHED_FIRMWARE);
        } else {
            if (read_file(memory_loc, PATH_MEMORY, FCRAM_SPACING) != 0) {
                print("Failed to load memory patches");
                draw_message("Failed to load memory patches", "The option to autoboot was selected,\n  but no valid memory patches could be found at:\n  " PATH_MEMORY);
            } else {
                if (config->firm_console == console_n3ds && config->firm_ver > 0x0F) {
                    slot0x11key96_init();
                }

                // boot_firm() requires current_firm->console and current_firm->version.
                struct firm_signature config_firm = {.console = config->firm_console,
                                                     .version = config->firm_ver};
                current_firm = &config_firm;

                boot_firm();
            }
        }
    }

    if (load_firms() != 0) {
        if(menu_firms() !=0) return;
    }

    print("Loading cakes");
    if (load_cakes_info(PATH_PATCHES) != 0) {
        draw_loading("Failed to read some cakes", "Make sure your cakes are up to date\n  and your SD card can be read correctly");
        return;
    }

    load_config_cakes();

    menu_main();
}
示例#3
0
void version_info()
{
    int pos_y = draw_loading("Version info", "CakesFW version " CAKES_VERSION) + SPACING_VERT;
    int version_pos_x = SPACING_HORIZ * 21;

    draw_string(screen_top_left, "NATIVE_FIRM version:", 0, pos_y, COLOR_NEUTRAL);
    draw_string(screen_top_left, current_firm->version_string, version_pos_x, pos_y, COLOR_NEUTRAL);

    if (current_twl_firm) {
        pos_y += SPACING_VERT;

        draw_string(screen_top_left, "TWL_FIRM version:", 0, pos_y, COLOR_NEUTRAL);
        draw_string(screen_top_left, current_twl_firm->version_string, version_pos_x, pos_y, COLOR_NEUTRAL);
    }

    if (current_agb_firm) {
        pos_y += SPACING_VERT;

        draw_string(screen_top_left, "AGB_FIRM version:", 0, pos_y, COLOR_NEUTRAL);
        draw_string(screen_top_left, current_agb_firm->version_string, version_pos_x, pos_y, COLOR_NEUTRAL);
    }

    draw_string(screen_top_left, "Press B to return", 0, pos_y + 20, COLOR_SELECTED);
    while (1) {
        uint16_t key = wait_key();

        if (key == (key_released | key_b)) {
            return;
        }
    }
}
示例#4
0
int menu_firms()
{
    char firms[MAX_OPTIONS][_MAX_LFN + 1], dirpath[] = PATH_FIRMWARE_DIR;

    int pathlen = strlen(dirpath);
    int count = find_file_pattern(firms, dirpath, pathlen, MAX_OPTIONS, "firmware*.bin");

    if (!count) {
        draw_loading("Failed to load FIRM", "Make sure the encrypted FIRM is\n  located in the firmware directory");
        return 1;
    }

    char *options[count];
    for (int x = 0; x <= count; x++) options[x] = firms[x];

    int result = draw_menu("Select firmware", 0, count, options);
    if (result == -1) return 0;

    memcpy(config->firm_path, firms[result], _MAX_LFN + 1);

    reload_native_firm();
    load_cakes_info(PATH_PATCHES);

    return 0;
}
示例#5
0
static void menu_draw_row_callback(GContext *ctx, const Layer *cell_layer, MenuIndex *cell_index, void *data) {
  if (is_search_initialized) {
    save_contact_name(cell_index->row);
    save_contact_number(cell_index->row);
    save_contact_id(cell_index->row);
    draw_menu(ctx, cell_layer, current_contact, current_number);
  } else {
    draw_loading(ctx, cell_layer, "Loading...", "If you just installed, this menu will populate as you send texts");
  }
}
示例#6
0
void draw_message(char *title, char *text)
{
    int pos_y = draw_loading(title, text);

    draw_string(screen_top_left, "Press A to continue", 10, pos_y + 20, COLOR_SELECTED);

    while (1) {
        uint16_t key = wait_key();

        if (key == (key_released | key_a)) {
            return;
        }
    }
}