Guillem96 / argon-nx

🚀 GUI payload chainloader for Nintendo Swtich.
GNU General Public License v2.0
169 stars 35 forks source link

More than 8 payloads, icons draw over each other #38

Closed mrdude2478 closed 5 years ago

mrdude2478 commented 5 years ago

Here's a mod to stop that happening:

u32 i = 0;
u32 j = 0;
/* For each payload generate its logo, its name and its path */
while(j <= 7 && payloads[i * 256]) //don't show more than 8 icons
{
    char* payload_path = (char*)malloc(256);
    payload_full_path(&payloads[i * 256], payload_path);
    //payload_full_path_2(&payloads[i * 256], payload_path);

    char payload_logo[256];
    payload_logo_path(&payloads[i * 256], payload_logo);

    u32 row = i / COLUMNS;
    u32 col = i % COLUMNS;
    u32 x = g_gfx_ctxt.width / COLUMNS * col + MARGIN_LEFT;
    u32 y = g_gfx_ctxt.height / ROWS * row + MARGIN_TOP + (row == 0 ? 30 : -60);

    const char* payload_wo_bin = str_replace(&payloads[i * 256], ".bin", "");
    gui_menu_append_entry(menu, 
        gui_create_menu_entry(payload_wo_bin,
                                sd_file_read(payload_logo), 
                                x, y,
                                200, 200,
                                (int (*)(void *))launch_payload, (void*)payload_path));
    i++;
    j++;
}
Guillem96 commented 5 years ago

Actually 8 payloads are the maximum allowed, probably in a new release I will implement more than one page