Skip to content

Commit

Permalink
webMAN MOD 1.47.34
Browse files Browse the repository at this point in the history
- Fixed regression in installer detecting if full edition was installed
- Added /dev_hdd0/ROMS to /mkdirs.ps3
- Improved mount_device using /mount.ps3<device-path>[&name=<dn>&fs=<fs>]
- Rebug Edition now uses fm.js if it's found, instead of the embedded script
- Tweak to avoid error loading pages
- Show more descriptive http errors
  • Loading branch information
aldostools committed Feb 18, 2021
1 parent bbb44da commit e62aa76
Show file tree
Hide file tree
Showing 22 changed files with 124 additions and 111 deletions.
Binary file modified _Projects_/updater/pkgfiles/PARAM.SFO
Binary file not shown.
Binary file modified _Projects_/updater/pkgfiles/USRDIR/webftp_server_full.sprx
Binary file not shown.
Binary file modified _Projects_/updater/pkgfiles/USRDIR/webftp_server_lite.sprx
Binary file not shown.
Binary file modified _Projects_/updater/pkgfiles/USRDIR/webftp_server_noncobra.sprx
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion _Projects_/updater/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ int main()

if(button & (BUTTON_L1)) full = true; else
if(button & (BUTTON_CROSS | BUTTON_CIRCLE)) lite = true; else
if( (!(button & BUTTON_R1) && (file_exists(PLUGINS_DIR "/webftp_server.sprx")) && (stat.st_size > 300000)) ||
if( (!(button & BUTTON_R1) && ((sysLv2FsStat(PLUGINS_DIR "/webftp_server.sprx", &stat) == SUCCESS) && (stat.st_size > 300000))) ||
(is_ps3hen() == 0x1337) ||
(file_exists("/dev_flash/hen/PS3HEN.BIN")) ||
(file_exists(HDDROOT_DIR "/hen/PS3HEN.BIN")) ||
Expand Down
Binary file modified _Projects_/updater/update/dev_hdd0/plugins/webftp_server.sprx
Binary file not shown.
Binary file not shown.
34 changes: 17 additions & 17 deletions cobra/cobra.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ int cobra_get_disc_type(unsigned int *real_disctype, unsigned int *effective_dis
int ret;

ret = sys_storage_ext_get_disc_type(&rdt, &edt, NULL);
if (ret != 0)
if (ret)
return ret;

rdt = translate_type(rdt);
Expand Down Expand Up @@ -770,7 +770,7 @@ int cobra_disc_auth(void)
int ret;

ret = sys_storage_ext_get_disc_type(&real_disctype, NULL, NULL);
if (ret != 0)
if (ret)
return ret;

if (real_disctype == 0)
Expand Down Expand Up @@ -919,7 +919,7 @@ int cobra_get_disc_phys_info(uint32_t handle, uint8_t layer, DiscPhysInfo *info)
response = (ScsiReadDiscStructureFormat0Response *)output;
ret = sys_storage_send_device_command(handle, STORAGE_COMMAND_NATIVE, scsi_cmd, sizeof(scsi_cmd), response, sizeof(ScsiReadDiscStructureFormat0Response));
if (ret != 0)
if (ret)
return ret;
memcpy(info, output+4, 17);
Expand Down Expand Up @@ -949,7 +949,7 @@ int cobra_get_cd_td(uint32_t handle, TrackDef *td, unsigned int max_tracks, unsi
data->outlen = cmd->alloc_length;
ret = sys_storage_send_device_command(handle, STORAGE_COMMAND_NATIVE, scsi_cmd, sizeof(scsi_cmd), &toc_info, sizeof(toc_info));
if (ret != 0)
if (ret)
return ret;
cd_num_tracks = toc_info.last_track;
Expand All @@ -958,7 +958,7 @@ int cobra_get_cd_td(uint32_t handle, TrackDef *td, unsigned int max_tracks, unsi
data->outlen = cmd->alloc_length;
ret = sys_storage_send_device_command(handle, STORAGE_COMMAND_NATIVE, scsi_cmd, sizeof(scsi_cmd), response, cmd->alloc_length);
if (ret != 0)
if (ret)
{
free(response);
return ret;
Expand Down Expand Up @@ -1005,7 +1005,7 @@ int cobra_get_cd_td(uint32_t handle, TrackDef *td, unsigned int max_tracks, unsi
}
}
if (ret != 0)
if (ret)
{
free(response);
return ret;
Expand Down Expand Up @@ -1281,7 +1281,7 @@ int cobra_parse_cue(void *cue, uint32_t size, TrackDef *tracks, unsigned int max
if (ntracks == 0)
{
if (lba != 0)
if (lba)
{
//DPRINTF("First track must be at 00:00:00, but it is at %02d:%02d:%02d\n", minutes, seconds, frames);
ret = ENOTSUP;
Expand Down Expand Up @@ -1401,7 +1401,7 @@ int cobra_map_game(const char *path, const char *title_id, int use_app_home)
if (!path)
{
int ret = sys_map_path("/dev_bdvd", NULL);
if (ret != 0)
if (ret)
return ret;
sys_map_path("/app_home", "/dev_usb000");
Expand All @@ -1416,7 +1416,7 @@ int cobra_map_game(const char *path, const char *title_id, int use_app_home)
build_blank_iso(title_id);

int ret = sys_map_path("/dev_bdvd", path);
if (ret != 0) return ret;
if (ret) return ret;

sys_map_path("//dev_bdvd", path);

Expand Down Expand Up @@ -1580,7 +1580,7 @@ int cobra_set_psp_umd(char *path, char *umd_root, char *icon_save_path)

files[0] = (char *)path;
ret = sys_storage_ext_mount_dvd_discfile(1, files);
if (ret != 0)
if (ret)
{
if (real_disctype != DISC_TYPE_NONE)
cobra_send_fake_disc_insert_event();
Expand Down Expand Up @@ -1844,7 +1844,7 @@ int cobra_set_psp_umd(char *path, char *umd_root, char *icon_save_path)
files[0] = path;
ret = sys_storage_ext_mount_dvd_discfile(1, files);
if (ret != 0)
if (ret)
{
if (real_disctype != DISC_TYPE_NONE)
cobra_send_fake_disc_insert_event();
Expand Down Expand Up @@ -2101,7 +2101,7 @@ int cobra_set_psp_umd2(char *path, char *umd_root, char *icon_save_path, uint64_
files[0] = path;
ret = sys_storage_ext_mount_dvd_discfile(1, files);
if (ret != 0)
if (ret)
{
if (real_disctype != DISC_TYPE_NONE)
cobra_send_fake_disc_insert_event();
Expand Down Expand Up @@ -2213,7 +2213,7 @@ int cobra_set_psp_umd2(char *path, char *umd_root, char *icon_save_path, uint64_
if (emu == EMU_AUTO)
{
snprintf(umd_file, sizeof(umd_file), "%s/PSP_GAME/PARAM.SFO", root);
if (parse_param_sfo(umd_file, "TITLE", title_name) != 0)
if (parse_param_sfo(umd_file, "TITLE", title_name))
{
title_name[0] = 0;
}
Expand Down Expand Up @@ -2263,12 +2263,12 @@ int cobra_get_usb_device_name(char *mount_point, char *dev_name)
sys_device_handle_t handle;
ret = cellFsUtilGetMountInfoSize(&size);
if (ret != 0)
if (ret)
return ret;
info = malloc(size*sizeof(CellFsMountInfo));
ret = cellFsUtilGetMountInfo(info, size, &size);
if (ret != 0)
if (ret)
{
free(info);
return ret;
Expand Down Expand Up @@ -2338,7 +2338,7 @@ int cobra_get_version(uint16_t *cobra_version, uint16_t *ps3_version)
int ret;
ret = sys_get_version(&version1);
if (ret != 0)
if (ret)
return ret;
if (cobra_version && sys_get_version2(&version2) == 0)
Expand Down Expand Up @@ -2441,7 +2441,7 @@ int cobra_get_ps2_emu_type(void)
uint8_t hw_config[8], ret2;

ret = sys_get_hw_config(&ret2, hw_config);
if (ret != 0)
if (ret)
{
return ret;
}
Expand Down
5 changes: 3 additions & 2 deletions include/cpursx.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,9 @@ static void cpu_rsx_stats(char *buffer, char *templn, char *param, u8 is_ps3_htt
#endif
if(IS_ON_XMB && ((View_Find("game_plugin") != 0) || (View_Find("download_plugin") != 0)) )
{
sprintf(templn, "<hr><font size=2>&starf; Status: %s %s</font>", (View_Find("download_plugin") != 0) ? "Downloading file" : "",
(View_Find("game_plugin") != 0) ? "Installing PKG" : ""); buffer += concat(buffer, templn);
sprintf(templn, "<hr><font size=2>&starf; Status: %s %s</font>",
View_Find("download_plugin") ? "Downloading file" : "",
View_Find("game_plugin") ? "Installing PKG" : ""); buffer += concat(buffer, templn);
}

if(strstr(param, "?"))
Expand Down
2 changes: 1 addition & 1 deletion include/fancontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static void set_fan_speed(u8 new_fan_speed)

static void restore_fan(u8 set_syscon_mode)
{
if(set_fan_policy_offset > 0)
if(set_fan_policy_offset)
{
//pokeq(syscall_base + (u64) (130 * 8), backup[3]);
//pokeq(syscall_base + (u64) (138 * 8), backup[4]);
Expand Down
81 changes: 43 additions & 38 deletions include/file.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#define SC_FS_LINK (810)
#define SC_FS_MOUNT (837)
#define SC_FS_UMOUNT (838)
#define SC_FS_DISK_FREE (840)

#define SC_BDVD_DECRYPT (36)
#define SC_BDVD_DECRYPT (36)

#define NO_MSG NULL

Expand All @@ -22,6 +23,7 @@ static u32 copied_count = 0;

#define DEV_NTFS "/dev_nt"

static void enable_dev_blind(const char *msg);
static sys_addr_t g_sysmem = NULL;

enum scan_operations
Expand Down Expand Up @@ -116,23 +118,52 @@ static void filepath_check(char *file)
#endif
}

static void check_path_alias(char *param)
{
if(not_exists(param))
{
if(!islike(param, "/dev_") && !islike(param, "/net"))
{
char path[STD_PATH_LEN]; snprintf(path, STD_PATH_LEN - 1, "%s", (*param == '/') ? param + 1 : param);
if(IS(param, "/pkg")) {sprintf(param, DEFAULT_PKG_PATH);} else
if(IS(param, "/xmb")) {enable_dev_blind(NULL); sprintf(param, "/dev_blind/vsh/resource/explore/xmb");} else
if(*html_base_path == '/') {snprintf(param, HTML_RECV_LAST, "%s/%s", html_base_path, path);} // use html path (if path is omitted)
if(not_exists(param)) {snprintf(param, HTML_RECV_LAST, "%s/%s", HTML_BASE_PATH, path);} // try HTML_BASE_PATH
if(not_exists(param)) {snprintf(param, HTML_RECV_LAST, "%s/%s", webman_config->home_url, path);} // try webman_config->home_url
if(not_exists(param)) {snprintf(param, HTML_RECV_LAST, "%s%s", HDD0_GAME_DIR, path);} // try /dev_hdd0/game
if(not_exists(param)) {snprintf(param, HTML_RECV_LAST, "%s%s", _HDD0_GAME_DIR, path);} // try /dev_hdd0//game
if(not_exists(param))
{
for(u8 i = 0; i < MAX_DRIVES; i++)
{
if(i == NET) i = NTFS + 1;
snprintf(param, HTML_RECV_LAST, "%s/%s", drives[i], path);
if(file_exists(param)) return;
}
} // try hdd0, usb0, usb1, etc.
if(not_exists(param)) {snprintf(param, HTML_RECV_LAST, "%s/%s", "/dev_hdd0/tmp", path);} // try hdd0
}
}
}


static u64 get_free_space(const char *dev_name)
{
#ifdef USE_NTFS
if(is_ntfs_path(dev_name))
{
char tmp[8];
strncpy(tmp, dev_name + 5, 8); tmp[5] = ':', tmp[7] = 0;

struct statvfs vbuf;
char tmp[STD_PATH_LEN];
strcpy(tmp, dev_name); tmp[10] = ':', tmp[12] = 0;
ps3ntfs_statvfs(tmp + 5, &vbuf);
ps3ntfs_statvfs(tmp, &vbuf);
return ((u64)vbuf.f_bfree * (u64)vbuf.f_bsize);
}
#endif
if(!islike(dev_name, "/dev_")) return 0;

u64 freeSize = 0, devSize = 0;

#define SC_FS_DISK_FREE 840
{system_call_3(SC_FS_DISK_FREE, (u64)(u32)(dev_name), (u64)(u32)&devSize, (u64)(u32)&freeSize);}
return freeSize;
/*
Expand Down Expand Up @@ -238,34 +269,6 @@ static bool is_ext(const char *path, const char *ext)
return !extcasecmp(path, ext, 4);
}

static void check_path_alias(char *param)
{
if(not_exists(param))
{
if(!islike(param, "/dev_") && !islike(param, "/net"))
{
char path[STD_PATH_LEN]; snprintf(path, STD_PATH_LEN - 1, "%s", (*param == '/') ? param + 1 : param);
if(IS(param, "/pkg")) {sprintf(param, DEFAULT_PKG_PATH);} else
if(IS(param, "/xmb")) {sprintf(param, "/dev_blind/vsh/resource/explore/xmb");} else
if(*html_base_path == '/') {snprintf(param, HTML_RECV_LAST, "%s/%s", html_base_path, path);} // use html path (if path is omitted)
if(not_exists(param)) {snprintf(param, HTML_RECV_LAST, "%s/%s", HTML_BASE_PATH, path);} // try HTML_BASE_PATH
if(not_exists(param)) {snprintf(param, HTML_RECV_LAST, "%s/%s", webman_config->home_url, path);} // try webman_config->home_url
if(not_exists(param)) {snprintf(param, HTML_RECV_LAST, "%s%s", HDD0_GAME_DIR, path);} // try /dev_hdd0/game
if(not_exists(param)) {snprintf(param, HTML_RECV_LAST, "%s%s", _HDD0_GAME_DIR, path);} // try /dev_hdd0//game
if(not_exists(param))
{
for(u8 i = 0; i < MAX_DRIVES; i++)
{
if(i == NET) i = NTFS + 1;
snprintf(param, HTML_RECV_LAST, "%s/%s", drives[i], path);
if(file_exists(param)) return;
}
} // try hdd0
if(not_exists(param)) {snprintf(param, HTML_RECV_LAST, "%s/%s", "/dev_hdd0/tmp", path);} // try hdd0
}
}
}

#ifdef COBRA_ONLY
static bool is_iso_0(const char *filename)
{
Expand Down Expand Up @@ -321,6 +324,9 @@ static void mkdirs(char *param)
//cellFsMkdir("/dev_hdd0/PS2ISO", DMODE);
//cellFsMkdir("/dev_hdd0/PSXISO", DMODE);
//cellFsMkdir("/dev_hdd0/PSPISO", DMODE);
#ifdef MOUNT_ROMS
cellFsMkdir("/dev_hdd0/ROMS", DMODE);
#endif

sprintf(param, "/dev_hdd0");
for(u8 i = 0; i < 9; i++)
Expand Down Expand Up @@ -1365,14 +1371,13 @@ static void mount_device(const char *dev_path, const char *dev_name, const char
{
if(!sys_admin) return;

if(!dev_path || isDir(dev_path)) return;
if(!dev_path || (*dev_path != '/') || isDir(dev_path)) return;

if(islike(dev_path, "/dev_blind"))
{system_call_8(SC_FS_MOUNT, (u64)(char*)"CELL_FS_IOS:BUILTIN_FLSH1", (u64)(char*)"CELL_FS_FAT", (u64)(char*)"/dev_blind", 0, 0, 0, 0, 0);}
else if(islike(dev_path, "/dev_hdd1"))
{system_call_8(SC_FS_MOUNT, (u64)(char*)"CELL_FS_UTILITY:HDD1", (u64)(char*)"CELL_FS_FAT", (u64)(char*)"/dev_hdd1", 0, 0, 0, 0, 0);}
else if(!dev_name || !file_system) return;
else if((*dev_path == '/') && islike(dev_name, "CELL_FS_") && islike(file_system, "CELL_FS_"))
else if(!dev_name || !file_system || islike(dev_path, "/dev_hdd1"))
{system_call_8(SC_FS_MOUNT, (u64)(char*)"CELL_FS_UTILITY:HDD1", (u64)(char*)"CELL_FS_FAT", (u32)dev_path, 0, 0, 0, 0, 0);}
else if(islike(dev_name, "CELL_FS_") && islike(file_system, "CELL_FS_"))
{system_call_8(SC_FS_MOUNT, (u32)dev_name, (u32)file_system, (u32)dev_path, 0, 0, 0, 0, 0);}
}

Expand Down
36 changes: 20 additions & 16 deletions include/file_manager.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#define SC_FS_DISK_FREE 840

#define ICON_STYLE "style=\"position:fixed;top:%ipx;right:%ipx;max-height:176px;z-index:-1;display:none\" onerror=\"this.style.display='none';\""

static u16 _LINELEN = LINELEN;
Expand Down Expand Up @@ -941,26 +939,36 @@ static bool folder_listing(char *buffer, u32 BUFFER_SIZE_HTML, char *templn, cha
///////////

#ifdef COPY_PS3
// add fm.js script
if(file_exists(FM_SCRIPT_JS))
{
sprintf(templn, SCRIPT_SRC_FMT, FM_SCRIPT_JS); _concat(&sout, templn);
}
#ifdef EMBED_JS
sprintf(tempstr, // popup menu
else
{
sprintf(tempstr, // popup menu
"<div id='mnu' style='position:fixed;width:140px;background:#333;display:none;padding:5px;'>"
#ifdef PKG_HANDLER
#ifdef PKG_HANDLER
"<a id='m0'>%s</a>"
#endif
#endif
"<a id='m1'>%s</a><a id='m2'>%s</a><hr><a id='m3'>%s<br></a><a href=\"javascript:t=prompt('%s',self.location.pathname);if(t.indexOf('/dev_')==0)self.location='/mkdir.ps3'+t\">%s</a><hr>"
"<a id='m4'>%s<br></a><a id='m5'>%s<br></a><a id='m6'>%s</a><hr><a id='m7'>%s<br></a><a id='m8'>%s</a>"
"</div>"
"<script>var s,m;window.addEventListener('contextmenu',function(e){if(s)s.color='#ccc';t=e.target,s=t.style,c=t.className,m=mnu.style,p=t.pathname;if(c=='w'||c=='d'){e.preventDefault();s.color='#fff',b='block',n='none';m.display=b;m.left=(e.clientX+12)+'px';y=e.clientY;w=window.innerHeight;m.top=(((y+220)<w)?(y+12):(w-220))+'px';"
#ifdef PKG_HANDLER
"<script>var s,m;window.addEventListener('contextmenu',function(e){"
"if(s)s.color='#ccc';t=e.target,s=t.style,c=t.className,m=mnu.style,p=t.pathname;"
"if(c.charAt(0)=='w'||c=='w'||c=='d'){e.preventDefault();s.color='#fff',b='block',n='none';m.display=b;m.left=(e.clientX+12)+'px';"
#ifdef PKG_HANDLER
"m0.href='/install.ps3'+p;m0.style.display=(p.indexOf('.pkg')>0)?b:n;"
#endif
#endif
"m1.href='/mount.ps3'+p;m1.style.display=(p.toLowerCase().indexOf('.iso')>0||c=='d'||p.indexOf('/GAME')>0)?b:n;"
"m2.href=p;m2.text=(c=='w')?'Download':'Open';"
"m3.href='/delete.ps3'+p;"
"m4.href='/cut.ps3'+p;"
"m5.href='/cpy.ps3'+p;"
"m6.href='/paste.ps3'+self.location.pathname;"
"m7.href='javascript:rn(\"'+p+'\")';m7.style.display=(p.substring(0,5)=='/dev_')?b:n;"
"y=e.clientY;w=window.innerHeight;m.top=(((y+mnu.clientHeight)<w)?(y+12):(w-mnu.clientHeight))+'px';"
"m8.href='/copy.ps3'+p}},false);"
"window.onclick=function(e){if(m)m.display=n;};"

Expand All @@ -970,15 +978,11 @@ static bool folder_listing(char *buffer, u32 BUFFER_SIZE_HTML, char *templn, cha
"function ku(e){e=e||window.event;if(e.keyCode==113){var a=document.querySelectorAll('a:hover')[0].pathname;rn(a);}}"

"</script>",
#ifdef PKG_HANDLER
#ifdef PKG_HANDLER
"Install PKG", //m0
#endif
"Mount", "Open", "Delete", "New Folder", "New Folder", "Cut", "Copy", "Paste", "Rename", "Copy To"); _concat(&sout, tempstr);
#else
// add fm.js script
if(file_exists(FM_SCRIPT_JS))
{
sprintf(templn, SCRIPT_SRC_FMT, FM_SCRIPT_JS); _concat(&sout, templn);
#endif
"Mount", "Open", "Delete", "New Folder", "New Folder", "Cut", "Copy", "Paste", "Rename", "Copy To");
_concat(&sout, tempstr);
}
#endif // #ifdef EMBED_JS
#endif // #ifdef COPY_PS3
Expand Down
Loading

0 comments on commit e62aa76

Please sign in to comment.