//ds2_main.c
#include <libBAG.h>

void ds2_main(void){
	if(!BAG_Init(1))
		ds2_plug_exit();
		
	//just incase there are error messages that need to be displayed by the arg functions
    BAG_DBG_Init(NULL, DBG_HALT | DBG_LIB);

    //Lets get the root directory of where the program is launched!
    //This only works if you are using a loader such as BAGPlug or iMenu
    //these menus can be used to pass off other information in args
    //such as a file to load!

    char **argv[2];//lets have a max of 2 args that we need to read
    //the first arg (argv[0]) is always the path of the binary that is running
    int count = BAG_Filesystem_GetArgs(argv, 2);//this returns how many arguments (within the limit of 2) were found
    //since the first arg has the path of the binary, we need to convert it to the
    //path of the folder it is in
    BAG_Filesystem_GetArgsRoot(argv[0]);
    //now we have the path of the directory the binary is in!
    printf("%s\n", argv[0]);
    //now for some cleanup, the GetArgs function allocates some memory on its own
    BAG_Filesystem_FreeArgs(argv, count);

	while(1){
		BAG_Update();
	}
}

