I think one way to do this is to simplify the loop used to run the menu, instead of running the menu then an eboot alternating like it does now, to just load what is put into hb_filename(or the menu if it hasn't changed), like so:
Code: Select all
loadGlobalConfig();
char filename[512]; //Why was this inside the loop before? o.0
while (!exit)
{
int initial_free_ram = sceKernelTotalFreeMemSize();
strcpy(filename, g->hb_filename);
//Load default config
loadGlobalConfig();
LOGSTR0("Config Loaded OK\n");
//Run menu if filename is unchanged
if(strcmp(filename,hb_filename) == 0) {
run_menu();
LOGSTR0("Default Menu Started OK\n");
//Run filename otherwise
} else {
LOGSTR1("Eboot is: %s\n", (u32)filename);
//run homebrew
run_eboot(filename);
LOGSTR0("Eboot Started OK\n");
}
wait_for_eboot_end();
cleanup(num_lib);
ramcheck(initial_free_ram);
if (strcmp("quit", g->hb_filename) == 0 || g->exit_callback_called)
exit = 1;
}
Please note I haven't tested this, and it needs tweaks in other places.(like making all eboots have argv[1]
) Might also be somewhat outdated, haven't updated my HBL source in a while
Another thing that would be interesting, since it's possible peoples menu's could screw up/etc, we could have an argv[2] with error messages, such as if an improper filename is attempted, or the last homebrew tried doing something improperly, and the menu could report these when starting. Sounds more like something for a debug version, but would be useful for people making homebrew with HBL though. Could probably also put a pointer into an argument, which could be a struct of pointers to HBL functions, or expand the current structure, though that could break older menus(maybe not if everything is just added to the end of the struct? o.0)
I kind of like m0skit0's second idea though, that removes the need of the loop and menu API completely, and the sceKernelExitGame() could just be made to load the menu.