Skip to content

Commit

Permalink
webMAN MOD 1.43.32
Browse files Browse the repository at this point in the history
- Added shortcut to quick install PKG on /dev_hdd0/packages
(SELECT+R2+O)
- Added the option to disable the combo in /setup.ps3
- Added remove .bak extension in File Manager
- Changed spoof to 4.80 for old Cobra
- Changed the back button in html response to history.back()
- Removed some old files
  • Loading branch information
Aldo Vargas committed Jul 30, 2016
1 parent 2733417 commit dafcd11
Show file tree
Hide file tree
Showing 25 changed files with 121 additions and 1,334 deletions.
7 changes: 7 additions & 0 deletions include/combos.h
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,13 @@
led(GREEN, ON);
}
}
#ifdef PKG_HANDLER
else
if(!(webman_config->combo2 & INSTALPKG) && (data.button[CELL_PAD_BTN_OFFSET_DIGITAL2] == (CELL_PAD_CTRL_CIRCLE | CELL_PAD_CTRL_R2)) ) // SELECT+R2+O
{
installPKG_combo(msg);
}
#endif
else
if(!(webman_config->combo & UMNT_GAME) && (data.button[CELL_PAD_BTN_OFFSET_DIGITAL2] == CELL_PAD_CTRL_CIRCLE) ) // SELECT+O (unmount)
{
Expand Down
2 changes: 2 additions & 0 deletions include/file_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ static void add_list_entry(char *tempstr, bool is_dir, char *ename, char *templn
#endif
)
sprintf(fsize, "<a href=\"/copy.ps3%s\" title=\"%'llu %s copy to %s\">%'llu %s</a>", templn, sbytes, STR_BYTE, islike(templn, "/dev_hdd0") ? "/dev_usb000" : "/dev_hdd0", sz, sf);
else if( !extcmp(name, ".bak", 4) )
sprintf(fsize, "<a href=\"/rename.ps3%s|\">%'llu %s</a>", templn, sz, sf);
#endif //#ifdef COPY_PS3


Expand Down
2 changes: 2 additions & 0 deletions include/html.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ static void prepare_header(char *header, char *param, u8 is_binary)

static bool islike(const char *param, const char *text)
{
if(param == NULL) return false;

return (memcmp(param, text, strlen(text)) == 0);
}

Expand Down
118 changes: 73 additions & 45 deletions include/pkg_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@
#include "../vsh/download_plugin.h"
#include "../vsh/stdc.h"

static char pkg_path[MAX_PATH_LEN];
static wchar_t pkg_dpath[MAX_PATH_LEN];
static wchar_t pkg_durl[MAX_PATH_LEN];
#define MAX_URL_LEN 360
#define MAX_DLPATH_LEN 240

#define MAX_PKGPATH_LEN 240
static char pkg_path[MAX_PKGPATH_LEN];

static wchar_t pkg_durl[MAX_URL_LEN];
static wchar_t pkg_dpath[MAX_DLPATH_LEN];

static bool wmget = false;

#define DEFAULT_PKG_PATH "/dev_hdd0/packages/"
#define INT_HDD_ROOT_PATH "/dev_hdd0/"
#define DEFAULT_PKG_PATH "/dev_hdd0/packages/"

static int LoadPluginById(int id, void *handler)
{
Expand Down Expand Up @@ -68,12 +73,21 @@ static void installPKG_thread(void)
game_ext_interface->DoUnk34(pkg_path); // install PKG from path
}

static void download_file(char *param, char *msg)
static int download_file(char *param, char *msg)
{
char msg_durl[MAX_PATH_LEN] = ""; //////Conversion Debug msg
char msg_dpath[MAX_PATH_LEN] = ""; //////Conversion Debug msg
char pdpath[MAX_PATH_LEN] = "";
char pdurl[MAX_PATH_LEN] = "";
int ret = FAILED;

if(View_Find("game_plugin"))
{
sprintf(msg, (const char *)"ERROR: download from XMB");
return ret;
}

char *msg_durl = msg;
char *msg_dpath = msg + MAX_URL_LEN + 16;

char pdurl[MAX_URL_LEN] = "";
char pdpath[MAX_DLPATH_LEN] = "";

size_t conv_num_durl = 0;
size_t conv_num_dpath = 0;
Expand All @@ -84,14 +98,14 @@ static void download_file(char *param, char *msg)
size_t dparam_len;
int pdpath_len;

wmemset(pkg_dpath, 0, MAX_PATH_LEN);
wmemset(pkg_durl, 0, MAX_PATH_LEN); // Use wmemset from stdc.h instead of reinitialising wchar_t with a loop.
wmemset(pkg_durl, 0, MAX_URL_LEN); // Use wmemset from stdc.h instead of reinitialising wchar_t with a loop.
wmemset(pkg_dpath, 0, MAX_DLPATH_LEN);

memset(pdurl, 0, MAX_PATH_LEN);
memset(pdpath, 0, MAX_PATH_LEN);
memset(pdurl, 0, MAX_URL_LEN);
memset(pdpath, 0, MAX_DLPATH_LEN);

sprintf(msg_durl, (const char *)"ERROR: Invalid URL\n");
sprintf(msg_dpath, (const char *)"Download canceled\n");
sprintf(msg_durl, (const char *)"ERROR: Invalid URL");
sprintf(msg_dpath, (const char *)"Download canceled");

if(islike(param + 13, "?to=")) //Use of the optional parameter
{
Expand All @@ -101,20 +115,15 @@ static void download_file(char *param, char *msg)
{
ptemp_len = strlen((const char *)ptemp);
pdurl_len = ptemp_len - 5;
if((pdurl_len > 0) && (pdurl_len < MAX_PATH_LEN))
if((pdurl_len > 0) && (pdurl_len < MAX_URL_LEN))
{
strncpy(pdurl, ptemp + 5, pdurl_len);
}
else
{
goto end_download_process;
}
}
else
{
sprintf(msg_durl, (const char *)"ERROR: No URL given\n");
goto end_download_process;
}

dparam_len = strlen((const char *)param + 13);
pdpath_len = dparam_len - ptemp_len - 4;
Expand All @@ -124,48 +133,42 @@ static void download_file(char *param, char *msg)
conv_num_durl = mbstowcs((wchar_t *)pkg_durl, (const char *)pdurl, pdurl_len + 1); //size_t stdc_FCAC2E8E(wchar_t *dest, const char *src, size_t max)

}
else if(islike(param + 13, "?url=")) //
else if(islike(param + 13, "?url="))
{
pdurl_len = strlen(param) - 18;
if((pdurl_len>0) && (pdurl_len<MAX_PATH_LEN))
if((pdurl_len>0) && (pdurl_len<MAX_URL_LEN))
{
pdpath_len = strlen((const char *)DEFAULT_PKG_PATH);
strncpy(pdpath, (const char *)DEFAULT_PKG_PATH, pdpath_len);
strncpy(pdurl, param + 18, pdurl_len);
conv_num_durl = mbstowcs((wchar_t *)pkg_durl,(const char *)pdurl, pdurl_len + 1); //size_t stdc_FCAC2E8E(wchar_t *dest, const char *src, size_t max)
}
else
{
goto end_download_process;
}
}
else
{
goto end_download_process;
}

if(conv_num_durl > 0)
{
if((pdpath_len > 0) && (pdpath_len < MAX_PATH_LEN) && (isDir((const char *)pdpath) || cellFsMkdir(pdpath, DMODE) == CELL_FS_SUCCEEDED))
if((pdpath_len > 0) && (pdpath_len < MAX_DLPATH_LEN) && (isDir((const char *)pdpath) || cellFsMkdir(pdpath, DMODE) == CELL_FS_SUCCEEDED))
{
conv_num_dpath = mbstowcs((wchar_t *)pkg_dpath, (const char *)pdpath, pdpath_len + 1);
sprintf(msg_dpath, (const char *)"To: %s\n", (const char *)pdpath);
sprintf(msg_dpath, (const char *)"To: %s", (const char *)pdpath);
}
else if(isDir((const char *)DEFAULT_PKG_PATH) || cellFsMkdir(pdpath, DMODE) == CELL_FS_SUCCEEDED)
{
conv_num_dpath = mbstowcs((wchar_t *)pkg_dpath, (const char *)DEFAULT_PKG_PATH, strlen((const char *)DEFAULT_PKG_PATH) + 1);
sprintf(msg_dpath, (const char *)"To: %s\n", (const char *)DEFAULT_PKG_PATH);
sprintf(msg_dpath, (const char *)"To: %s", (const char *)DEFAULT_PKG_PATH);
}
else
{
conv_num_dpath = mbstowcs((wchar_t *)pkg_dpath, (const char *)INT_HDD_ROOT_PATH, strlen((const char *)INT_HDD_ROOT_PATH) + 1);
sprintf(msg_dpath, (const char *)"To: %s\n", (const char *)INT_HDD_ROOT_PATH);
sprintf(msg_dpath, (const char *)"To: %s", (const char *)INT_HDD_ROOT_PATH);
}

if(conv_num_dpath > 0)
{
int ret = -1;

if (View_Find("webrender_plugin"))
{
ret = UnloadPluginById(0x1C,(void *)unloadSysPluginCallback);
Expand All @@ -177,28 +180,22 @@ static void download_file(char *param, char *msg)
sys_timer_usleep(5);
}

sprintf(msg_durl, (const char *)"Downloading: %s\n", (const char *)pdurl);
sprintf(msg_durl, (const char *)"Downloading: %s", (const char *)pdurl);

ret = LoadPluginById(0x29, (void *)downloadPKG_thread);
}
else
{
sprintf(msg_durl, (const char *)"ERROR: Setting storage location\n");
}
}
else
{
sprintf(msg_durl, (const char *)"ERROR: Invalid URL\n");
sprintf(msg_durl, (const char *)"ERROR: Setting storage location");
}

end_download_process:
sprintf(msg, "%s%s", msg_durl, msg_dpath);
sprintf(msg, "%s\n%s", msg_durl, msg_dpath);
return ret;
}

static int installPKG(char *pkgpath, char *msg)
{
int ret = FAILED;

if(View_Find("game_plugin"))
{
sprintf(msg, (const char *)"ERROR: install from XMB");
Expand All @@ -209,9 +206,9 @@ static int installPKG(char *pkgpath, char *msg)

size_t pkg_path_len = strlen(pkgpath);

if (pkg_path_len < MAX_PATH_LEN)
if (pkg_path_len < MAX_PKGPATH_LEN)
{
memset(pkg_path, 0, MAX_PATH_LEN);
memset(pkg_path, 0, MAX_PKGPATH_LEN);
strcpy(pkg_path, pkgpath);

if( file_exists(pkg_path) )
Expand All @@ -237,4 +234,35 @@ static int installPKG(char *pkgpath, char *msg)
return ret;
}

static int installPKG_combo(char *msg)
{
int fd, ret = FAILED;

if(cellFsOpendir(DEFAULT_PKG_PATH, &fd) == CELL_FS_SUCCEEDED)
{
char pkgfile[MAX_PKGPATH_LEN] = "";

CellFsDirent dir; u64 read = sizeof(CellFsDirent);

if(file_exists(pkg_path)) {sprintf(pkgfile, "%s.bak", pkg_path); cellFsRename(pkg_path, pkgfile); pkg_path[0] = NULL;}

while(!cellFsReaddir(fd, &dir, &read))
{
if(!read) break;
if(!extcasecmp(dir.d_name, ".pkg", 4))
{
sprintf(pkgfile, "%s%s", DEFAULT_PKG_PATH, dir.d_name); ret = 0; { BEEP1 }

installPKG(pkgfile, msg); show_msg(msg);
break;
}
}
cellFsClosedir(fd);

if(ret == FAILED) { BEEP2 } else sys_timer_sleep(2);
}

return ret;
}

#endif // #ifdef PKG_HANDLER
8 changes: 8 additions & 0 deletions include/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define UMNT_GAME (1<<7)
#define VIDRECORD (1<<8)
#define PLAY_DISC (1<<9)
#define INSTALPKG (1<<10)

#define REBUGMODE (1<<13)
#define NORMAMODE (1<<14)
Expand Down Expand Up @@ -114,6 +115,10 @@ static void setup_parse_settings(char *param)

if(!strstr(param, "p2c=1")) webman_config->combo2|=PS2TOGGLE;
#endif

#ifdef PKG_HANDLER
if(!strstr(param, "pkg=1")) webman_config->combo2|=INSTALPKG;
#endif
if(!strstr(param, "p2s=1")) webman_config->combo2|=PS2SWITCH;
if(!strstr(param, "pgd=1")) webman_config->combo2|=EXTGAMDAT;
#ifndef LITE_EDITION
Expand Down Expand Up @@ -737,6 +742,9 @@ static void setup_form(char *buffer, char *templn)
#endif

add_check_box("p2s", "1", "PS2 SWITCH", " : <b>SELECT+L2+R2</b><br>" , !(webman_config->combo2 & PS2SWITCH), buffer);
#ifdef PKG_HANDLER
add_check_box("pkg", "1", "INSTALL PKG", " : <b>SELECT+R2+O</b><br>" , !(webman_config->combo2 & INSTALPKG), buffer);
#endif
add_check_box("pld", "1", "PLAY DISC", " : <b>L2+START</b><br>"
"</td></tr></table>" , !(webman_config->combo2 & PLAY_DISC), buffer);

Expand Down
Loading

0 comments on commit dafcd11

Please sign in to comment.