#include "../common/common.h" static char argBuf[ENTRY_ARGBUFSIZE]; static void init_args(char *dst, size_t dst_maxsize, u32 *in_args, size_t size) { size_t tmplen; u32 argi; char *in_argdata = (char*)&in_args[1]; size-= sizeof(u32); for (argi=0; argi dst_maxsize) break; if (dst_maxsize < 3) break; *dst++ = '"'; dst_maxsize--; strncpy(dst, in_argdata, tmplen); in_argdata+= tmplen+1; size-= tmplen+1; dst+= tmplen; dst_maxsize-= tmplen; *dst++ = '"'; dst_maxsize--; if (argi+1 < in_args[0]) { *dst++ = ' '; dst_maxsize--; } } } static bool init(void) { return envHasNextLoad(); } static void deinit(void) { } static void launchFile(const char* path, argData_s* args) { /*if (strncmp(path, "sdmc:/",6) == 0) path += 5;*/ memset(argBuf, 0, sizeof(argBuf)); init_args(argBuf, sizeof(argBuf)-1, args->buf, sizeof(args->buf)); Result rc = envSetNextLoad(path, argBuf); if(R_FAILED(rc)) fatalSimple(rc);//TODO: How should failing be handled? uiExitLoop(); } const loaderFuncs_s loader_builtin = { .name = "builtin", .init = init, .deinit = deinit, .launchFile = launchFile, };