Need help passing arguments to another dol
Posted: Thu Jul 16, 2009 11:22 pm
Hello,
I'm trying to launch another .dol from my own code, and the piece of code that I got looks like this:
This runs fine for the case that there's no argument after the path to the .dol to be launched. But assuming that the launched dol is expecting an additional argument, what needs to be changed from the code above?
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.
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.