I'm trying to launch another .dol from my own code, and the piece of code that I got looks like this:
Code: Select all
struct __argv dolArgv;
bzero(&dolArgv, sizeof(dolArgv));
dolArgv.argvMagic = ARGV_MAGIC;
dolArgv.length = strlen(filename) + 2;
dolArgv.commandLine = malloc(dolArgv.length);
if (!dolArgv.commandLine)
{
init_video_and_wpad();
printf("Error creating arguments, could not allocate memory for commandLine\n");
printf("Press any button to reboot Wii...\n");
press_button_to_reboot();
}
strcpy(dolArgv.commandLine, filename);
dolArgv.commandLine[dolArgv.length - 1] = '\x00';
dolArgv.argc = 1;
dolArgv.argv = &(dolArgv.commandLine);
dolArgv.endARGV = dolArgv.argv + 1;
run_dol(myBuffer, &dolArgv);
I've tried a bunch of things including adding the argument to the "commandLine" and setting the "argc" to 2 (and other things) but I could not get this to work.
Also, what exactly is variable "endARGV"?
Any help is greatly appreciated.