Esempio n. 1
0
void addThemeToList(char * fullPath, menuEntry_s * me, char * smdhName, int folderPathLen) {
    me->hidden = false;
    me->isTitleEntry = false;
    me->isRegionFreeEntry = false;

    char smdhPath[strlen(fullPath) + strlen(smdhName) + 1];
    strcpy(smdhPath, fullPath);
    strcat(smdhPath, smdhName);

    bool iconNeedsToBeGenerated = true;

    strcpy(me->name, "");
    strcpy(me->description, "");
    strcpy(me->author, "");

    if(fileExists(smdhPath, &sdmcArchive)) {
        static smdh_s tmpSmdh;
        int ret = loadFile(smdhPath, &tmpSmdh, &sdmcArchive, sizeof(smdh_s));

        if (!ret) {
            ret = extractSmdhData(&tmpSmdh, me->name, me->description, me->author, me->iconData);
            if (!ret) {
                iconNeedsToBeGenerated = false;
            }
        }
    }

    if (iconNeedsToBeGenerated) {
        memcpy(me->iconData, settingsIconTheme_bin, 48*48*3);
    }

    if (strlen(me->name) == 0) {
        if (strcmp(fullPath, "/3ds/") == 0) {
            strcpy(me->name, "3ds");
        }
        else {
            strcpy(me->name, fullPath+folderPathLen);
        }
    }

    if (strlen(me->description) == 0) {
        strcpy(me->description, "");
    }

    if (strlen(me->author) == 0) {
        strcpy(me->author, "");
    }

    me->drawFirstLetterOfName = iconNeedsToBeGenerated;
    me->drawFullTitle = true;

    strcpy(me->executablePath, fullPath+folderPathLen);

    addMenuEntryCopy(&themesMenu, me);
//    themesMenu.numEntries = themesMenu.numEntries + 1;
}
Esempio n. 2
0
void regionFreeUpdate()
{
	if(!regionFreeAvailable)return;

	Result ret = loadGamecardIcon(&gamecardSmdh);

	regionFreeGamecardIn = (ret == 0);

	if(regionFreeGamecardIn)extractSmdhData(&gamecardSmdh, gamecardMenuEntry.name, gamecardMenuEntry.description, gamecardMenuEntry.author, gamecardMenuEntry.iconData);
}
void createMenuEntryShortcut(menu_s* m, shortcut_s* s)
{
    if(!m || !s)return;

    static menuEntry_s tmpEntry;
    static smdh_s tmpSmdh;

    char* execPath = s->executable;

    if(!fileExists(execPath, &sdmcArchive))return;

    int i, l=-1; for(i=0; execPath[i]; i++) if(execPath[i]=='/') l=i;

    char* iconPath = s->icon;
    int ret = loadFile(iconPath, &tmpSmdh, &sdmcArchive, sizeof(smdh_s));

    if(!ret)
    {
        initEmptyMenuEntry(&tmpEntry);
        ret = extractSmdhData(&tmpSmdh, tmpEntry.name, tmpEntry.description, tmpEntry.author, tmpEntry.iconData);
        strncpy(tmpEntry.executablePath, execPath, ENTRY_PATHLENGTH);
    }

    if(ret) initMenuEntry(&tmpEntry, execPath, &execPath[l+1], execPath, "Unknown publisher", (u8*)installerIcon_bin);

    if(s->name) strncpy(tmpEntry.name, s->name, ENTRY_NAMELENGTH);
    if(s->description) strncpy(tmpEntry.description, s->description, ENTRY_DESCLENGTH);
    if(s->author) strncpy(tmpEntry.author, s->author, ENTRY_AUTHORLENGTH);

    if(s->arg)
    {
        strncpy(tmpEntry.arg, s->arg, ENTRY_ARGLENGTH);
    }

    if(fileExists(s->descriptor, &sdmcArchive)) loadDescriptor(&tmpEntry.descriptor, s->descriptor);

    tmpEntry.isShortcut = true;

    if (s->hasBanner) {
        strcpy(tmpEntry.bannerImagePath, s->bannerImagePath);
        tmpEntry.bannerIsFullScreen = s->bannerIsFullScreen;
    }
    else {
        tmpEntry.bannerImagePath[0] = '\0';
    }

    tmpEntry.hasBanner = s->hasBanner;

    addMenuEntryCopy(m, &tmpEntry);
}
void addDirectoryToMenu(menu_s* m, char* path)
{
	if(!m || !path)return;

	static menuEntry_s tmpEntry;
	static smdh_s tmpSmdh;
	static char execPath[128];
	static char iconPath[128];
	static char xmlPath[128];

	int i, l=-1; for(i=0; path[i]; i++) if(path[i]=='/') l=i;

	snprintf(execPath, 128, "%s/boot.3dsx", path);
	if(!fileExists(execPath, &sdmcArchive))
	{
		snprintf(execPath, 128, "%s/%s.3dsx", path, &path[l+1]);
		if(!fileExists(execPath, &sdmcArchive))return;
	}

	bool icon=false;
	snprintf(iconPath, 128, "%s/icon.bin", path);
	if(!icon && !(icon=fileExists(iconPath, &sdmcArchive)))snprintf(iconPath, 128, "%s/icon.smdh", path);
	if(!icon && !(icon=fileExists(iconPath, &sdmcArchive)))snprintf(iconPath, 128, "%s/icon.icn", path);
	if(!icon && !(icon=fileExists(iconPath, &sdmcArchive)))snprintf(iconPath, 128, "%s/%s.smdh", path, &path[l+1]);
	if(!icon && !(icon=fileExists(iconPath, &sdmcArchive)))snprintf(iconPath, 128, "%s/%s.icn", path, &path[l+1]);

	int ret=loadFile(iconPath, &tmpSmdh, &sdmcArchive, sizeof(smdh_s));

	if(!ret)
	{
		initEmptyMenuEntry(&tmpEntry);
		ret=extractSmdhData(&tmpSmdh, tmpEntry.name, tmpEntry.description, tmpEntry.author, tmpEntry.iconData);
		strncpy(tmpEntry.executablePath, execPath, ENTRY_PATHLENGTH);
	}

	if(ret)initMenuEntry(&tmpEntry, execPath, &path[l+1], execPath, "", (u8*)installerIcon_bin);

	snprintf(xmlPath, 128, "%s/descriptor.xml", path);

	if(!fileExists(xmlPath, &sdmcArchive))snprintf(xmlPath, 128, "%s/%s.xml", path, &path[l+1]);
	loadDescriptor(&tmpEntry.descriptor, xmlPath);

	addBannerPathToMenuEntry(tmpEntry.bannerImagePath, path, &path[l+1], &tmpEntry.bannerIsFullScreen, &tmpEntry.hasBanner);

	addMenuEntryCopy(m, &tmpEntry);
}
Esempio n. 5
0
void initMenu(menu_s* m)
{
	if(!m)return;

	m->entries=NULL;
	m->numEntries=0;
	m->selectedEntry=0;
	m->scrollLocation=0;
	m->scrollVelocity=0;
	m->scrollBarSize=0;
	m->scrollBarPos=0;
	m->scrollTarget=0;
	m->atEquilibrium=false;

	if(regionFreeAvailable)
	{
		extractSmdhData((smdh_s*)regionfree_bin, regionfreeEntry.name, regionfreeEntry.description, regionfreeEntry.author, regionfreeEntry.iconData);
		strcpy(regionfreeEntry.executablePath, REGIONFREE_PATH);
		addMenuEntryCopy(m, &regionfreeEntry);
	}
}