Beispiel #1
0
int CopyFile(char* path, char* path2)
{
	int ret = 0;
	s32 fd = -1;
	s32 fd2 = -1;
	u64 lenght = 0LL;

	u64 pos = 0ULL;
	u64 readed = 0, writed = 0;

	char *mem = NULL;

	sysFSStat stat;

	ret= sysLv2FsStat(path, &stat);
	if(ret) goto skip;

	if(!memcmp(path, "/dev_hdd0/", 10) && !memcmp(path2, "/dev_hdd0/", 10))
	{
		if(strcmp(path, path2)==0) return ret;

		sysLv2FsUnlink(path2);
		return sysLv2FsLink(path, path2);
	}

    lenght = stat.st_size;

	ret = sysLv2FsOpen(path, 0, &fd, S_IRWXU | S_IRWXG | S_IRWXO, NULL, 0);
	if(ret) goto skip;

	ret = sysLv2FsOpen(path2, SYS_O_WRONLY | SYS_O_CREAT | SYS_O_TRUNC, &fd2, 0777, NULL, 0);
	if(ret) {sysLv2FsClose(fd);goto skip;}

	mem = malloc(0x100000);
	if (mem == NULL) return FAILED;

	while(pos < lenght)
	{
		readed = lenght - pos; if(readed > 0x100000ULL) readed = 0x100000ULL;
		ret=sysLv2FsRead(fd, mem, readed, &writed);
		if(ret<0) goto skip;
		if(readed != writed) {ret = 0x8001000C; goto skip;}

		ret=sysLv2FsWrite(fd2, mem, readed, &writed);
		if(ret<0) goto skip;
		if(readed != writed) {ret = 0x8001000C; goto skip;}

		pos += readed;
	}

skip:

	if(mem) free(mem);
	if(fd >=0) sysLv2FsClose(fd);
	if(fd2>=0) sysLv2FsClose(fd2);
	if(ret>0) ret = SUCCESS;

	return ret;
}
Beispiel #2
0
int unlink_secure(void *path)
{
    if(file_exists(path)==SUCCESS)
	{
        sysLv2FsChmod(path, FS_S_IFMT | 0777);
        return sysLv2FsUnlink(path);
    }
    return FAILED;
}
Beispiel #3
0
int main()
{
	FILE* f=NULL;
	sysFSStat stat;

//--- hold CROSS

    unsigned button = 0;

    padInfo padinfo;
    padData paddata;

    ioPadInit(7);

    int n, r;
    for(r=0; r<10; r++)
    {
        ioPadGetInfo(&padinfo);
        for(n = 0; n < 7; n++)
        {
            if(padinfo.status[n])
            {
                ioPadGetData(n, &paddata);
                button = (paddata.button[2] << 8) | (paddata.button[3] & 0xff);
                break;
            }
        }
        if(button) break; else usleep(20000);
    }
    ioPadEnd();

	if(button & 0x04) full=true; else
	if(button & 0x60) lite=true;  // circle / cross
	if(button & 0x0F) vsh_menu=true; else vsh_menu = (sysLv2FsStat("/dev_hdd0/plugins/wm_vsh_menu.sprx", &stat) == SUCCESS);  // r1/r2/l1/l2
//---

	sysLv2FsMkdir("/dev_hdd0/tmp", 0777);
	sysLv2FsMkdir("/dev_hdd0/tmp/wm_lang", 0777);
	sysLv2FsMkdir("/dev_hdd0/tmp/wm_combo", 0777);

	// remove language files (old location)
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_EN.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_AR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_CN.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_DE.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_ES.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_FR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_GR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_DK.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_HU.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_HR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_BG.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_CZ.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_SK.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_IN.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_JP.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_KR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_IT.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_NL.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_PL.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_PT.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_RU.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_TR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_ZH.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_XX.TXT");

	// remove language files
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_EN.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_AR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_CN.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_DE.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_ES.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_FR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_GR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_DK.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_HU.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_HR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_BG.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_CZ.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_SK.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_IN.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_JP.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_KR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_IT.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_NL.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_PL.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_PT.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_RU.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_TR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_ZH.TXT");

	// remove old files
	sysLv2FsUnlink("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_multi19.sprx");
	sysLv2FsUnlink("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_multi20.sprx");
	sysLv2FsUnlink("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_multi21.sprx");
	sysLv2FsUnlink("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_webchat.sprx");

	// update languages
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_EN.TXT", "/dev_hdd0/tmp/wm_lang/LANG_EN.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_AR.TXT", "/dev_hdd0/tmp/wm_lang/LANG_AR.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_CN.TXT", "/dev_hdd0/tmp/wm_lang/LANG_CN.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_DE.TXT", "/dev_hdd0/tmp/wm_lang/LANG_DE.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_ES.TXT", "/dev_hdd0/tmp/wm_lang/LANG_ES.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_FR.TXT", "/dev_hdd0/tmp/wm_lang/LANG_FR.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_GR.TXT", "/dev_hdd0/tmp/wm_lang/LANG_GR.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_DK.TXT", "/dev_hdd0/tmp/wm_lang/LANG_DK.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_HU.TXT", "/dev_hdd0/tmp/wm_lang/LANG_HU.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_HR.TXT", "/dev_hdd0/tmp/wm_lang/LANG_HR.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_BG.TXT", "/dev_hdd0/tmp/wm_lang/LANG_BG.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_CZ.TXT", "/dev_hdd0/tmp/wm_lang/LANG_CZ.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_SK.TXT", "/dev_hdd0/tmp/wm_lang/LANG_SK.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_IN.TXT", "/dev_hdd0/tmp/wm_lang/LANG_IN.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_IT.TXT", "/dev_hdd0/tmp/wm_lang/LANG_IT.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_JP.TXT", "/dev_hdd0/tmp/wm_lang/LANG_JP.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_KR.TXT", "/dev_hdd0/tmp/wm_lang/LANG_KR.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_NL.TXT", "/dev_hdd0/tmp/wm_lang/LANG_NL.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_PL.TXT", "/dev_hdd0/tmp/wm_lang/LANG_PL.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_PT.TXT", "/dev_hdd0/tmp/wm_lang/LANG_PT.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_RU.TXT", "/dev_hdd0/tmp/wm_lang/LANG_RU.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_TR.TXT", "/dev_hdd0/tmp/wm_lang/LANG_TR.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_ZH.TXT", "/dev_hdd0/tmp/wm_lang/LANG_ZH.TXT");

	sysLv2FsMkdir("/dev_hdd0/xmlhost/game_plugin", 0777);
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/mobile.html", "/dev_hdd0/xmlhost/game_plugin/mobile.html");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/background.gif", "/dev_hdd0/xmlhost/game_plugin/background.gif");

	sysLv2FsMkdir("/dev_hdd0/tmp/wm_icons", 0777);

	// copy new icons
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_album_ps3.png", "/dev_hdd0/tmp/wm_icons/icon_wm_album_ps3.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_album_psx.png", "/dev_hdd0/tmp/wm_icons/icon_wm_album_psx.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_album_ps2.png", "/dev_hdd0/tmp/wm_icons/icon_wm_album_ps2.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_album_psp.png", "/dev_hdd0/tmp/wm_icons/icon_wm_album_psp.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_album_dvd.png", "/dev_hdd0/tmp/wm_icons/icon_wm_album_dvd.png");

	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_ps3.png"      , "/dev_hdd0/tmp/wm_icons/icon_wm_ps3.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_psx.png"      , "/dev_hdd0/tmp/wm_icons/icon_wm_psx.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_ps2.png"      , "/dev_hdd0/tmp/wm_icons/icon_wm_ps2.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_psp.png"      , "/dev_hdd0/tmp/wm_icons/icon_wm_psp.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_dvd.png"      , "/dev_hdd0/tmp/wm_icons/icon_wm_dvd.png");

	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_settings.png" , "/dev_hdd0/tmp/wm_icons/icon_wm_settings.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_eject.png"    , "/dev_hdd0/tmp/wm_icons/icon_wm_eject.png"   );

	// XMBM+ webMAN
	sysLv2FsMkdir("/dev_hdd0/game/XMBMANPLS", 0777);
	sysLv2FsMkdir("/dev_hdd0/game/XMBMANPLS/USRDIR", 0777);
	sysLv2FsMkdir("/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES", 0777);
	sysLv2FsMkdir("/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES", 0777);

	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN.xml"    ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_AR.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_AR.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_CN.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_CN.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_DE.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_DE.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_ES.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_ES.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_FR.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_FR.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_GR.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_GR.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_DK.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_DK.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_HU.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_HU.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_HR.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_HR.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_BG.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_BG.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_CZ.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_CZ.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_SK.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_SK.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_IN.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_IN.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_JP.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_JP.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_KR.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_KR.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_IT.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_IT.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_NL.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_NL.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_PL.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_PL.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_PT.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_PT.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_RU.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_RU.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_TR.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_TR.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_ZH.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_ZH.xml");

	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/bd.png"        	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/bd.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/cachefiles.png"	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/cachefiles.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/filemanager.png"	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/filemanager.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/devflash.png"  	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/devflash.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/gamesbrowser.png"	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/gamesbrowser.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/gamedata.png"  	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/gamedata.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/homebrew.png"  	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/homebrew.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/multiman.png"  	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/multiman.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/network.png"   	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/network.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/pkgmanager.png"	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/pkgmanager.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/refreshhtml.png"	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/refreshhtml.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/refreshxml.png"	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/refreshxml.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/restartps3.png"	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/restartps3.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/settings.png"  	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/settings.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/sysinfo.png"  	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/sysinfo.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/tools.png"  		,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/tools.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/unload.png"  		,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/unload.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webman.png"  		,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/webman.png");

	sysLv2FsMkdir("/dev_hdd0/plugins", 0777);

	// install vsh menu
	if(vsh_menu && sysLv2FsStat("/dev_hdd0/plugins", &stat) == SUCCESS)
	{
		sysLv2FsMkdir("/dev_hdd0/plugins/images", 0777);

		// update images
		/* if(sysLv2FsStat("/dev_hdd0/plugins/images/wm_vsh_menu.png",   &stat) != SUCCESS) */ CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/images/wm_vsh_menu.png",   "/dev_hdd0/plugins/images/wm_vsh_menu.png");
		/* if(sysLv2FsStat("/dev_hdd0/plugins/images/wm_vsh_menu_1.png", &stat) != SUCCESS) */ CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/images/wm_vsh_menu_1.png", "/dev_hdd0/plugins/images/wm_vsh_menu_1.png");
		/* if(sysLv2FsStat("/dev_hdd0/plugins/images/wm_vsh_menu_2.png", &stat) != SUCCESS) */ CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/images/wm_vsh_menu_2.png", "/dev_hdd0/plugins/images/wm_vsh_menu_2.png");
		/* if(sysLv2FsStat("/dev_hdd0/plugins/images/wm_vsh_menu_3.png", &stat) != SUCCESS) */ CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/images/wm_vsh_menu_3.png", "/dev_hdd0/plugins/images/wm_vsh_menu_3.png");
		/* if(sysLv2FsStat("/dev_hdd0/plugins/images/wm_vsh_menu_4.png", &stat) != SUCCESS) */ CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/images/wm_vsh_menu_4.png", "/dev_hdd0/plugins/images/wm_vsh_menu_4.png");
		/* if(sysLv2FsStat("/dev_hdd0/plugins/images/wm_vsh_menu_5.png", &stat) != SUCCESS) */ CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/images/wm_vsh_menu_5.png", "/dev_hdd0/plugins/images/wm_vsh_menu_5.png");
		/* if(sysLv2FsStat("/dev_hdd0/plugins/images/wm_vsh_menu_6.png", &stat) != SUCCESS) */ CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/images/wm_vsh_menu_6.png", "/dev_hdd0/plugins/images/wm_vsh_menu_6.png");

		// append path if installing for first time
		if(sysLv2FsStat("/dev_hdd0/plugins/wm_vsh_menu.sprx", &stat) != SUCCESS)
		{
			if(is_cobra())
			{
				// append line to boot_plugins.txt
				if(sysLv2FsStat("/dev_hdd0/boot_plugins.txt", &stat) == SUCCESS)
					f=fopen("/dev_hdd0/boot_plugins.txt", "a");
				else
					f=fopen("/dev_hdd0/boot_plugins.txt", "w");
					fputs("\r\n/dev_hdd0/plugins/wm_vsh_menu.sprx", f);
					fclose(f);
			}
			if(is_mamba())
			{
				// append line to mamba_plugins.txt
				if(sysLv2FsStat("/dev_hdd0/mamba_plugins.txt", &stat) == SUCCESS)
					f=fopen("/dev_hdd0/mamba_plugins.txt", "a");
				else
					f=fopen("/dev_hdd0/mamba_plugins.txt", "w");
					fputs("\r\n/dev_hdd0/plugins/wm_vsh_menu.sprx", f);
					fclose(f);
			}
			if(sysLv2FsStat("/dev_hdd0/prx_plugins.txt", &stat) == SUCCESS)
			{
				// append line to prx_plugins.txt
				f=fopen("/dev_hdd0/prx_plugins.txt", "a");
				fputs("\r\n/dev_hdd0/plugins/wm_vsh_menu.sprx", f);
				fclose(f);
			}
		}

		CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/wm_vsh_menu.sprx", "/dev_hdd0/plugins/wm_vsh_menu.sprx");
	}

	// skip update custom language file
	if(sysLv2FsStat("/dev_hdd0/tmp/wm_lang/LANG_XX.TXT", &stat))
		CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_XX.TXT", "/dev_hdd0/tmp/wm_lang/LANG_XX.TXT");

	// skip update custom combo file
	if(sysLv2FsStat("/dev_hdd0/tmp/wm_custom_combo", &stat))
		CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/wm_custom_combo", "/dev_hdd0/tmp/wm_custom_combo");

	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/libfs.sprx", "/dev_hdd0/tmp/libfs.sprx");

	// copy raw_iso.sprx to dev_flash
	if(sysLv2FsStat("/dev_flash/vsh/module/raw_iso.sprx", &stat) != SUCCESS)
	{
		if(sysLv2FsStat("/dev_blind", &stat) != SUCCESS)
			sys_fs_mount("CELL_FS_IOS:BUILTIN_FLSH1", "CELL_FS_FAT", "/dev_blind", 0);

		if(sysLv2FsStat("/dev_blind", &stat) == SUCCESS)
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/raw_iso.sprx", "/dev_blind/vsh/module/raw_iso.sprx");
	}

	// copy raw_iso.sprx to dev_hdd (if failed to copy it to dev_flash)
	if(sysLv2FsStat("/dev_flash/vsh/module/raw_iso.sprx", &stat) != SUCCESS)
	{
		if(sysLv2FsStat("/dev_hdd0/plugins", &stat) == SUCCESS)
		{
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/raw_iso.sprx", "/dev_hdd0/plugins/raw_iso.sprx");
            if(sysLv2FsStat("/dev_hdd0/plugins/raw_iso.sprx", &stat) == SUCCESS) sysLv2FsUnlink("/dev_hdd0/raw_iso.sprx");
		}
		else
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/raw_iso.sprx", "/dev_hdd0/raw_iso.sprx");
	}

	// copy standalone video recorder plugin (video_rec.sprx) to /plugins folder
	if((sysLv2FsStat("/dev_hdd0/plugins", &stat) == SUCCESS))
		CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/video_rec.sprx", "/dev_hdd0/plugins/video_rec.sprx");

	// update PRX+Mamba Loader
	if((sysLv2FsStat("/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server.sprx", &stat) == SUCCESS))
	{
		sysLv2FsChmod("/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server.sprx");

		if(full)
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_full.sprx", "/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server.sprx");
		else if((sysLv2FsStat("/dev_flash/rebug", &stat) == SUCCESS) && is_ps3mapi())
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_ps3mapi.sprx", "/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server.sprx");
		else if((sysLv2FsStat("/dev_flash/rebug", &stat) == SUCCESS))
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_multi23.sprx", "/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server.sprx");
		else if(lite)
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_lite.sprx", "/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server.sprx");
		else if(is_ps3mapi())
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_ps3mapi.sprx", "/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server.sprx");
		else
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server.sprx", "/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server.sprx");
	}
	else if((sysLv2FsStat("/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server_ps3mapi.sprx", &stat) == SUCCESS))
	{
		sysLv2FsChmod("/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server_ps3mapi.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server_ps3mapi.sprx");

		if((sysLv2FsStat("/dev_flash/rebug", &stat) == SUCCESS))
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_ps3mapi.sprx", "/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server_ps3mapi.sprx");
		else
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_ps3mapi.sprx", "/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server_ps3mapi.sprx");
	}

	char ligne[255];

	// update PRX Loader
	if(sysLv2FsStat("/dev_hdd0/game/PRXLOADER/USRDIR/plugins.txt", &stat) == SUCCESS)
	{
		f=fopen("/dev_hdd0/game/PRXLOADER/USRDIR/plugins.txt", "r");
		while(fgets(ligne, 255, f) != NULL)
		{
			if(strstr(ligne,"webftp_server") != NULL)
			{
				fclose(f);
				strtok(ligne, "\r\n");
				sysLv2FsUnlink(ligne);
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_noncobra.sprx",ligne);
				goto cont;
			}
		}
		fclose(f);
		f=fopen("/dev_hdd0/game/PRXLOADER/USRDIR/plugins.txt", "a");
		fputs("\r\n/dev_hdd0/game/PRXLOADER/USRDIR/webftp_server_noncobra.sprx", f);
		fclose(f);

		sysLv2FsChmod("/dev_hdd0/game/PRXLOADER/USRDIR/webftp_server_noncobra.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/game/PRXLOADER/USRDIR/webftp_server_noncobra.sprx");

		CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_noncobra.sprx", "/dev_hdd0/game/PRXLOADER/USRDIR/webftp_server_noncobra.sprx");
	}

cont:

	// update dev_flash (rebug)
	if((sysLv2FsStat("/dev_flash/vsh/module/webftp_server.sprx", &stat) == SUCCESS) || (sysLv2FsStat("/dev_flash/vsh/module/webftp_server.sprx.bak", &stat) == SUCCESS))
	{
		is_cobra(); // re-enable cobra if it's disabled

		if(sysLv2FsStat("/dev_blind", &stat) != SUCCESS)
			sys_fs_mount("CELL_FS_IOS:BUILTIN_FLSH1", "CELL_FS_FAT", "/dev_blind", 0);

		sysLv2FsChmod("/dev_blind/vsh/module/webftp_server.sprx", 0777);
		sysLv2FsUnlink("/dev_blind/vsh/module/webftp_server.sprx");

		sysLv2FsChmod("/dev_blind/vsh/module/webftp_server.sprx.bak", 0777);
		sysLv2FsUnlink("/dev_blind/vsh/module/webftp_server.sprx.bak");

		if(full)
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_full.sprx", "/dev_blind/vsh/module/webftp_server.sprx");
		else if(lite)
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_lite.sprx", "/dev_blind/vsh/module/webftp_server.sprx");
		else if(is_ps3mapi())
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_ps3mapi.sprx", "/dev_blind/vsh/module/webftp_server.sprx");
		else
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_multi23.sprx", "/dev_blind/vsh/module/webftp_server.sprx");


		// delete webMAN from hdd0
		if((sysLv2FsStat("/dev_blind/vsh/module/webftp_server.sprx", &stat) == SUCCESS))
		{
			sysLv2FsChmod("/dev_hdd0/webftp_server.sprx", 0777);
			sysLv2FsUnlink("/dev_hdd0/webftp_server.sprx");

			sysLv2FsChmod("/dev_hdd0/plugins/webftp_server.sprx", 0777);
			sysLv2FsUnlink("/dev_hdd0/plugins/webftp_server.sprx");

			if(sysLv2FsStat("/dev_hdd0/boot_plugins.txt", &stat) == SUCCESS)
			{
				f=fopen("/dev_hdd0/boot_plugins.txt", "r");
				while(fgets(ligne, 255, f) != NULL)
				{
					if(strstr(ligne,"webftp_server") != NULL && strstr(ligne,"/dev_blind") == NULL)
					{
						strtok(ligne, "\r\n");
						sysLv2FsChmod(ligne, 0777);
						sysLv2FsUnlink(ligne);
						break;
					}
				}
				fclose(f);
			}
		}

		// reboot
		sysLv2FsUnlink("/dev_hdd0/tmp/turnoff");
		//{lv2syscall4(379,0x200,0,0,0); return_to_user_prog(int);}
		//{lv2syscall4(379,0x1200,0,0,0); return_to_user_prog(int);}
		{lv2syscall3(SC_SYS_POWER, SYS_REBOOT, 0, 0); return_to_user_prog(int);}
        //{lv2syscall3(SC_SYS_POWER, SYS_REBOOT, 0, 0);}

		return 0;
	}

	// update boot_plugins.txt
	if(lite || full || is_cobra())
	{
		// parse boot_plugins.txt (update existing path)
		if(sysLv2FsStat("/dev_hdd0/boot_plugins.txt", &stat) == SUCCESS)
		{
			f=fopen("/dev_hdd0/boot_plugins.txt", "r");
			while(fgets(ligne, 255, f) != NULL)
			{
				if(strstr(ligne,"webftp_server") != NULL)
				{
					fclose(f);
					strtok(ligne, "\r\n");
					sysLv2FsChmod(ligne, 0777);
					sysLv2FsUnlink(ligne);
					if(full)
						CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_full.sprx", ligne);
					else if(lite)
						CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_lite.sprx", ligne);
					else
					{
						if(is_ps3mapi())
							CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_ps3mapi.sprx", ligne);
						else
							CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server.sprx", ligne);
					}
					goto exit;
				}
			}
			fclose(f);
		}

		// append line to boot_plugins.txt
		if(sysLv2FsStat("/dev_hdd0/boot_plugins.txt", &stat) == SUCCESS)
			f=fopen("/dev_hdd0/boot_plugins.txt", "a");
		else
			f=fopen("/dev_hdd0/boot_plugins.txt", "w");
		if((sysLv2FsStat("/dev_hdd0/plugins", &stat) == SUCCESS))
		{
			if(is_ps3mapi() && !lite && !full)
				fputs("\r\n/dev_hdd0/plugins/webftp_server_ps3mapi.sprx", f);
			else
				fputs("\r\n/dev_hdd0/plugins/webftp_server.sprx", f);
		}
		else
		{
			if(is_ps3mapi() && !lite && !full)
				fputs("\r\n/dev_hdd0/webftp_server_ps3mapi.sprx", f);
			else
				fputs("\r\n/dev_hdd0/webftp_server.sprx", f);
		}
		fclose(f);

		// delete old sprx
		sysLv2FsChmod("/dev_hdd0/webftp_server.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/webftp_server.sprx");

		sysLv2FsChmod("/dev_hdd0/plugins/webftp_server.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/plugins/webftp_server.sprx");

		sysLv2FsChmod("/dev_hdd0/webftp_server_ps3mapi.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/webftp_server_ps3mapi.sprx");

		sysLv2FsChmod("/dev_hdd0/plugins/webftp_server_ps3mapi.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/plugins/webftp_server_ps3mapi.sprx");

		// copy ps3mapi/cobra/rebug/lite sprx
		if((sysLv2FsStat("/dev_hdd0/plugins", &stat) == SUCCESS))
		{
			if(full)
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_full.sprx", "/dev_hdd0/plugins/webftp_server.sprx");
			else if(lite)
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_lite.sprx", "/dev_hdd0/plugins/webftp_server.sprx");
			else
			{
				if(is_ps3mapi())
				{
					if((sysLv2FsStat("/dev_flash/rebug", &stat) == SUCCESS))
						CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_ps3mapi.sprx", "/dev_hdd0/plugins/webftp_server_ps3mapi.sprx");
					else
						CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_ps3mapi.sprx", "/dev_hdd0/plugins/webftp_server_ps3mapi.sprx");
				}
				else
					CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server.sprx", "/dev_hdd0/plugins/webftp_server.sprx");
			}
		}
		else
		{
			if(full)
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_full.sprx", "/dev_hdd0/webftp_server.sprx");
			else if(lite)
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_lite.sprx", "/dev_hdd0/webftp_server.sprx");
			else
			{
				if(is_ps3mapi())
				{
					if((sysLv2FsStat("/dev_flash/rebug", &stat) == SUCCESS))
						CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_ps3mapi.sprx", "/dev_hdd0/webftp_server_ps3mapi.sprx");
					else
						CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_ps3mapi.sprx", "/dev_hdd0/webftp_server_ps3mapi.sprx");
				}
				else
					CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server.sprx", "/dev_hdd0/webftp_server.sprx");
			}
		}
	}

	// update mamba_plugins.txt
	if(is_mamba())
	{
		// parse mamba_plugins.txt (update existing path)
		if(sysLv2FsStat("/dev_hdd0/mamba_plugins.txt", &stat) == SUCCESS)
		{
			f=fopen("/dev_hdd0/mamba_plugins.txt", "r");
			while(fgets(ligne, 255, f) != NULL)
			{
				if(strstr(ligne,"webftp_server") != NULL)
				{
					fclose(f);
					strtok(ligne, "\r\n");
					sysLv2FsChmod(ligne, 0777);
					sysLv2FsUnlink(ligne);

					if(full)
						CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_full.sprx", ligne);
					else if(lite)
						CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_lite.sprx", ligne);
					else
						CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_ps3mapi.sprx", ligne);
					goto exit;
				}
			}
			fclose(f);
		}

		// append line to mamba_plugins.txt (Mamba/PRX Loader - PS3MAPI)
		if(sysLv2FsStat("/dev_hdd0/mamba_plugins.txt", &stat) == SUCCESS)
			f=fopen("/dev_hdd0/mamba_plugins.txt", "a");
		else
			f=fopen("/dev_hdd0/mamba_plugins.txt", "w");
		if((sysLv2FsStat("/dev_hdd0/plugins", &stat) == SUCCESS))
		{
			if(full || lite)
				fputs("\r\n/dev_hdd0/plugins/webftp_server.sprx", f);
			else
				fputs("\r\n/dev_hdd0/plugins/webftp_server_ps3mapi.sprx", f);
		}
		else if(full || lite)
			fputs("\r\n/dev_hdd0/webftp_server.sprx", f);
		else
			fputs("\r\n/dev_hdd0/webftp_server_ps3mapi.sprx", f);
		fclose(f);

		// delete old sprx
		sysLv2FsChmod("/dev_hdd0/webftp_server_ps3mapi.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/webftp_server_ps3mapi.sprx");

		sysLv2FsChmod("/dev_hdd0/plugins/webftp_server_ps3mapi.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/plugins/webftp_server_ps3mapi.sprx");

		// copy ps3mapi sprx
		if((sysLv2FsStat("/dev_hdd0/plugins", &stat) == SUCCESS))
		{
			if(full)
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_full.sprx", "/dev_hdd0/plugins/webftp_server.sprx");
			else if(lite)
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_lite.sprx", "/dev_hdd0/plugins/webftp_server.sprx");
			else if((sysLv2FsStat("/dev_flash/rebug", &stat) == SUCCESS))
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_ps3mapi.sprx", "/dev_hdd0/plugins/webftp_server_ps3mapi.sprx");
			else
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_ps3mapi.sprx", "/dev_hdd0/plugins/webftp_server_ps3mapi.sprx");
		}
		else
		{
			if(full)
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_full.sprx", "/dev_hdd0/webftp_server.sprx");
			else if(lite)
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_lite.sprx", "/dev_hdd0/webftp_server.sprx");
			else if((sysLv2FsStat("/dev_flash/rebug", &stat) == SUCCESS))
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_ps3mapi.sprx", "/dev_hdd0/webftp_server_ps3mapi.sprx");
			else
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_ps3mapi.sprx", "/dev_hdd0/webftp_server_ps3mapi.sprx");
		}
	}

	// update prx_plugins.txt (PRX LOADER)
	if(sysLv2FsStat("/dev_hdd0/prx_plugins.txt", &stat) == SUCCESS)
	{
		// parse prx_plugins.txt (update existing path)
		f=fopen("/dev_hdd0/prx_plugins.txt", "r");
		while(fgets(ligne, 255, f) != NULL)
		{
			if(strstr(ligne,"webftp_server") != NULL)
			{
				fclose(f);
				strtok(ligne, "\r\n");
				sysLv2FsUnlink(ligne);
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_noncobra.sprx",ligne);
				goto exit;
			}
		}
		fclose(f);

		// append line to prx_plugins.txt
		f=fopen("/dev_hdd0/prx_plugins.txt", "a");

		if(sysLv2FsStat("/dev_hdd0/plugins", &stat) == SUCCESS)
			fputs("\r\n/dev_hdd0/plugins/webftp_server_noncobra.sprx", f);
		else
			fputs("\r\n/dev_hdd0/webftp_server_noncobra.sprx", f);
		fclose(f);

		// delete old sprx
		sysLv2FsChmod("/dev_hdd0/webftp_server_noncobra.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/webftp_server_noncobra.sprx");

		sysLv2FsChmod("/dev_hdd0/plugins/webftp_server_noncobra.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/plugins/webftp_server_noncobra.sprx");

		// copy non cobra sprx
		if(sysLv2FsStat("/dev_hdd0/plugins", &stat) == SUCCESS)
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_noncobra.sprx", "/dev_hdd0/plugins/webftp_server_noncobra.sprx");
		else
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_noncobra.sprx", "/dev_hdd0/webftp_server_noncobra.sprx");
	}
	// exit
exit:

	// update category_game.xml (add fb.xml)
	if(add_mygame() != -2);


	// reboot
	sysLv2FsUnlink("/dev_hdd0/tmp/turnoff");
	//{lv2syscall4(379,0x200,0,0,0); return_to_user_prog(int);}
	//{lv2syscall4(379,0x1200,0,0,0); return_to_user_prog(int);}
	{lv2syscall3(SC_SYS_POWER, SYS_REBOOT, 0, 0); return_to_user_prog(int);}

	return 0;
}
Beispiel #4
0
int add_mygame()
{
// -2 failed and cannot rename the backup
// -1 failed
//  0 already
//  1 done

	char gameexit[] = {0x0d, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x78, 0x2d, 0x78, 0x6d, 0x62, 0x2f, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x2d, 0x70, 0x69, 0x78, 0x6d, 0x61, 0x70, 0x22, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x6b, 0x65, 0x79, 0x3d, 0x22, 0x73, 0x65, 0x67, 0x5f, 0x67, 0x61, 0x6d, 0x65, 0x65, 0x78, 0x69, 0x74, 0x22, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x73, 0x72, 0x63, 0x3d, 0x22, 0x73, 0x65, 0x6c, 0x3a, 0x2f, 0x2f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x2f, 0x69, 0x6e, 0x67, 0x61, 0x6d, 0x65, 0x3f, 0x70, 0x61, 0x74, 0x68, 0x3d, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x5f, 0x67, 0x61, 0x6d, 0x65, 0x2e, 0x78, 0x6d, 0x6c, 0x23, 0x73, 0x65, 0x67, 0x5f, 0x67, 0x61, 0x6d, 0x65, 0x65, 0x78, 0x69, 0x74, 0x26, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x67, 0x61, 0x6d, 0x65, 0x22, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x2f, 0x3e};
	char fb[] = {0x0d, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x78, 0x2d, 0x78, 0x6d, 0x62, 0x2f, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x2d, 0x70, 0x69, 0x78, 0x6d, 0x61, 0x70, 0x22, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x6b, 0x65, 0x79, 0x3d, 0x22, 0x78, 0x6d, 0x62, 0x5f, 0x61, 0x70, 0x70, 0x33, 0x22, 0x20, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x61, 0x74, 0x74, 0x72, 0x3d, 0x22, 0x78, 0x6d, 0x62, 0x5f, 0x61, 0x70, 0x70, 0x33, 0x22, 0x20, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x73, 0x72, 0x63, 0x3d, 0x22, 0x78, 0x6d, 0x62, 0x3a, 0x2f, 0x2f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x2f, 0x64, 0x65, 0x76, 0x5f, 0x68, 0x64, 0x64, 0x30, 0x2f, 0x78, 0x6d, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x66, 0x62, 0x2e, 0x78, 0x6d, 0x6c, 0x23, 0x73, 0x65, 0x67, 0x5f, 0x66, 0x62, 0x22, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x2f, 0x3e};
	FILE* f;
	long size;
	char *cat;
	char cat_path[255];
	size_t result;
	int i, j, pos=0;
	sysFSStat stat;

	//read original cat
	f=fopen("/dev_flash/vsh/resource/explore/xmb/category_game.xml", "r");
	if(f==NULL) return FAILED;
	fseek (f , 0 , SEEK_END);
	size = ftell (f);
	fseek(f, 0, SEEK_SET);

	cat = (char*) malloc (sizeof(char)*size);
	if (cat == NULL) {free(cat); return FAILED;}

	result = fread(cat,1,size, f);
	if (result != size) {free (cat); fclose (f); return FAILED;}
	fclose (f);

	// is fb.xml entry in cat file ?
	if(strstr(cat, "fb.xml")!=NULL) {free(cat); return 0;}

	// search position
	for(i=0; i < size - sizeof(gameexit); i++) {
		pos=i;
		for(j=0; j<sizeof(gameexit); j++) {
			if( cat[i+j] != gameexit[j]) break;
			if(j==(sizeof(gameexit)-1)) goto out_s;
		}
	}
	out_s:

	//write patched cat
	f=fopen("/dev_hdd0/game/UPDWEBMOD/USRDIR/category_game.xml", "w");
	if(f==NULL) {free(cat); return FAILED;}
	fwrite(cat, 1, pos, f);
	fwrite(fb, 1, sizeof(fb), f);
	fwrite(&cat[pos], 1, size-pos, f);
	fclose(f);


	// set target path for category_game.xml
	strcpy(cat_path, "/dev_blind/vsh/resource/explore/xmb/category_game.xml");
	if(sysLv2FsStat(cat_path, &stat) != SUCCESS) {
		strcpy(cat_path, "/dev_habib/vsh/resource/explore/xmb/category_game.xml");
		if(sysLv2FsStat(cat_path, &stat) != SUCCESS) {
			strcpy(cat_path, "/dev_rewrite/vsh/resource/explore/xmb/category_game.xml");

			// mount /dev_blind if category_game.xml is not found
			if(sysLv2FsStat(cat_path, &stat) != SUCCESS) {
				if(sys_fs_mount("CELL_FS_IOS:BUILTIN_FLSH1", "CELL_FS_FAT", "/dev_blind", 0) == SUCCESS) {
					strcpy(cat_path, "/dev_blind/vsh/resource/explore/xmb/category_game.xml");
					if(sysLv2FsStat(cat_path, &stat) != SUCCESS) { free(cat); return FAILED;}
				} else { free(cat); return FAILED;}
			}
		}
	}

	// rename category_game.xml as category_game.xml.bak
	char cat_path_bak[255];
	strcpy(cat_path_bak, cat_path);
	strcat(cat_path_bak, ".bak");
	sysLv2FsUnlink(cat_path_bak);
	if(sysLv2FsRename(cat_path, cat_path_bak) != SUCCESS) {free(cat); return FAILED;} ;

	// update category_game.xml
	if(CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/category_game.xml", cat_path) != SUCCESS)
	{
		sysLv2FsUnlink(cat_path);
		if(sysLv2FsRename(cat_path_bak, cat_path)) { //restore category_game.xml from category_game.xml.bak
			{lv2syscall3(392, 0x1004, 0xa, 0x1b6);} ///TRIPLE BIP
			free(cat);
			return -2;
		}
	}
	free(cat);
	return 1;
}
Beispiel #5
0
int main()
{
	#ifdef ENABLE_LOG
	verbose = 1;
	Open_Log(LOG_PATH);
	#endif
	//Detect startup mode
    unsigned button = 0;
    padInfo padinfo;
    padData paddata;
    ioPadInit(7);
    int n, r;
    for(r=0; r<10; r++)
    {
        ioPadGetInfo(&padinfo);
        for(n = 0; n < 7; n++)
        {
            if(padinfo.status[n])
            {
                ioPadGetData(n, &paddata);
                button = (paddata.button[2] << 8) | (paddata.button[3] & 0xff);
                break;
            }
        }
        if(button) break;
		else usleep(20000);
    }
    ioPadEnd();
	switch(button)
	{
		case BUTTON_CROSS:
			install_autoloader=1;
		break;

		case BUTTON_SQUARE:
			uninstall_autoloader=1;
		break;

		case BUTTON_R1:
			noplugins=1;
		break;

		case BUTTON_L1:
			mamba_off=1;
		break;
	}
	//Install MAMBA/PRX Autoloader if cross was hold
	if(install_autoloader)
	{
		if (run_install_autoloader() ==  SUCCESS)
		{
			#ifdef ENABLE_LOG
			CloseLog();
			#endif
			{ BEEP1 } //1 Beep
			sysLv2FsUnlink("/dev_hdd0/tmp/turnoff");
			{lv2syscall3(SC_SYS_POWER, SYS_REBOOT, 0, 0);} // Reboot
			return SUCCESS;
		}
		else
		{
			goto err_back_to_xmb;