Skip to content

Commit

Permalink
webMAN MOD 1.47.47g
Browse files Browse the repository at this point in the history
- Removed duplicated scsi_inquire.h
- Added web command /err.ps3 to query generic errors
- Global replace of sprintf with new functions: strcopy, strncopy, concat2, concat3, concat_path, concat_path2.
- Added strfmt() to allow pass formatted strings as parameter
- These new functions help to reduce the memory footprint
- Refactored foder_count() to stop scanning earlier
- Added compilation flag FULL_EDITION
  • Loading branch information
aldostools committed Oct 27, 2024
1 parent bd700a2 commit 799b713
Show file tree
Hide file tree
Showing 80 changed files with 621 additions and 616 deletions.
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.
Binary file modified _Projects_/updater/update/dev_hdd0/plugins/webftp_server.sprx
Binary file not shown.
Binary file modified _Projects_/updater/update/dev_hdd0/plugins/webftp_server_lite.sprx
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#define COBRA_ONLY // comment out for ccapi/non-cobra release
#define REX_ONLY // shortcuts for REBUG REX CFWs / comment out for usual CFW
#define FULL_EDITION

#define PS3MAPI // ps3 manager API & webGUI by _NzV_
//#define LITE_EDITION // no ps3netsrv support, smaller memory footprint
Expand Down
1 change: 1 addition & 0 deletions flags/flags_full.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#define COBRA_ONLY // comment out for ccapi/non-cobra release
#define REX_ONLY // shortcuts for REBUG REX CFWs / comment out for usual CFW
#define FULL_EDITION

#define PS3MAPI // ps3 manager API & webGUI by _NzV_
//#define LITE_EDITION // no ps3netsrv support, smaller memory footprint
Expand Down
2 changes: 1 addition & 1 deletion flags/flags_lite.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#define ARTEMIS_PRX

//// EXTRA FEATURES ////
//#define AUTO_TOGGLE_ON_XMB // auto switch to full edition (L1+R1+TRIANGLE) when a game returns to XMB
//#define GET_KLICENSEE // /klic.ps3
//#define XMB_SCREENSHOT // screenshot XMB using L2 + R2 + SELECT + START (thanks to 3141card)
//#define SWAP_KERNEL // load custom lv2_kernel.self patching LV1 and soft rebooting (use /copy.ps3) [requires QA flag enabled]
Expand All @@ -55,6 +54,7 @@
//#define PHOTO_GUI // PhotoGUI: mount games through Photo column
//#define MOUNT_PNG // support fake PNG as ISO
//#define VISUALIZERS // Rotate visualizers (earth, lines, canyon, coldboot_*.ac3)
//#define AUTO_TOGGLE_ON_XMB // auto switch to full edition (L1+R1+TRIANGLE) when a game returns to XMB

//// INTERNAL PLUGINS ////
//#define USE_INTERNAL_NET_PLUGIN // comment out to use netiso.sprx
Expand Down
2 changes: 1 addition & 1 deletion include/cmd/artemis.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
if((*code_list != '/') || strstr(code_list, ".ncl"))
code_list = ARTEMIS_CODES_FILE;

sprintf(param, "%s%s", "/edit.ps3", code_list);
concat2(param, "/edit.ps3", code_list);

start_artemis(); sys_ppu_thread_sleep(1);

Expand Down
2 changes: 1 addition & 1 deletion include/cmd/cpy_cut_paste.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// /cut.ps3<path> stores <path> in <cp_path> clipboard buffer for move with /paste.ps3 (cp_mode = 2)

cp_mode = islike(param, "/cut.ps3") ? CP_MODE_MOVE : CP_MODE_COPY;
snprintf(cp_path, STD_PATH_LEN, "%s", param + 8);
strncopy(cp_path, STD_PATH_LEN, param + 8);
check_path_alias(cp_path);
if(not_exists(cp_path) && !islike(cp_path, "/net"))
cp_mode = CP_MODE_NONE;
Expand Down
6 changes: 3 additions & 3 deletions include/cmd/edit_chat_popup.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

if(*filename != '/')
{
sprintf(filename, "/dev_hdd0/boot_plugins.txt"); // default file
strcopy(filename, "/dev_hdd0/boot_plugins.txt"); // default file
}

char *pos = strstr(param, "&t=");
if(pos)
{
// backup the original text file
sprintf(backup, "%s.bak", filename);
concat2(backup, filename, ".bak");
rename_file(filename, backup); // replace previous backup

// save text file
Expand Down Expand Up @@ -116,7 +116,7 @@
show_msg(msg);

if(mode=='=')
sbuffer.size = sprintf(sbuffer.str, "%s", msg); // raw mode
sbuffer.size = strcopy(sbuffer.str, msg); // raw mode
else if(op)
_concat(&sbuffer, msg);
else
Expand Down
14 changes: 14 additions & 0 deletions include/cmd/err.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifdef FULL_EDITION
if(islike(param, "/err.ps3"))
{
char *params = param + 9, *buffer = header;

int errnum = val(params);

sprintf(buffer, "Error 0x%x: %s", errnum, strerror(errnum));

keep_alive = http_response(conn_s, param, "/err.ps3", CODE_HTTP_OK, buffer);

goto exit_handleclient_www;
}
#endif
4 changes: 2 additions & 2 deletions include/cmd/games.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
mobile_mode = true; const char *params = param + 10;

if(not_exists(MOBILE_HTML))
{sprintf(param, "/index.ps3%s", params); mobile_mode = false;}
{concat2(param, "/index.ps3", params); mobile_mode = false;}
else if(strstr(param, "?g="))
sprintf(param, MOBILE_HTML);
else if(strchr(param, '?'))
sprintf(param, "/index.ps3%s", params);
concat2(param, "/index.ps3", params);
else if(not_exists(GAMELIST_JS))
sprintf(param, "/index.ps3?mobile");
else
Expand Down
2 changes: 1 addition & 1 deletion include/cmd/install.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

if(islike(pkg_file, "/net"))
{
sprintf(param, "%s%s", "/mount_ps3", pkg_file); // use /mount.ps3 command to install the remote pkg
concat2(param, "/mount_ps3", pkg_file); // use /mount.ps3 command to install the remote pkg
is_binary = WEB_COMMAND;
goto html_response;
}
Expand Down
2 changes: 1 addition & 1 deletion include/cmd/klic.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
get_game_info(); snprintf(buffer, 0x200, "%s %s</H2>"
"KLicensee: %s<br>"
"Content ID: %s<br>"
"File: %s<p>",
"File: %s<p>",
_game_TitleID, _game_Title,
kl, (char*)KLIC_CONTENT_ID, (char*)KLIC_PATH);
}
Expand Down
2 changes: 1 addition & 1 deletion include/cmd/mount_copy.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@

else if(!islike(params, "/net") && !islike(params, WMTMP))
{
strcpy(templn, params);
strcopy(templn, params);
if(not_exists(params))
{
find_slaunch_game(params, 10); // search in slaunch.bin
Expand Down
2 changes: 1 addition & 1 deletion include/cmd/mount_search.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
if(islike(param, "/mount") && is_ntfs_path(param + 10))
{
char *filename = param + 10; change_cue2iso(filename);
sprintf(header, "%s%s", filename, ".ntfs[");
concat2(header, filename, ".ntfs[");
int flen = get_name(filename, header, GET_WMTMP);

for(int i = 2; i < 9; i++) // "PS3ISO", "BDISO", "DVDISO", "PS2ISO", "PSXISO", "PSXGAMES", "PSPISO"
Expand Down
12 changes: 6 additions & 6 deletions include/cmd/pad_combo_play.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,16 @@
#ifdef COBRA_NON_LITE
strcpy(header, params); params = (char*)header;
if(_islike(params, "movian") || IS(params, "HTSS00003"))
{sprintf(params, "col=tv&seg=HTSS00003"); mount_unk = APP_GAME;} else
if(_islike(params, "remoteplay")){sprintf(params, "col=network&seg=seg_premo");} else
if(_islike(params, "retro")) {sprintf(params, "SSNE10000");} else
if(_islike(params, "multiman")) {sprintf(params, "BLES80608");} else
if(_islike(params, "rebug")) {sprintf(params, "RBGTLBOX2");}
{strcopy(params, "col=tv&seg=HTSS00003"); mount_unk = APP_GAME;} else
if(_islike(params, "remoteplay")){strcopy(params, "col=network&seg=seg_premo");} else
if(_islike(params, "retro")) {strcopy(params, "SSNE10000");} else
if(_islike(params, "multiman")) {strcopy(params, "BLES80608");} else
if(_islike(params, "rebug")) {strcopy(params, "RBGTLBOX2");}
#endif

#ifdef COBRA_ONLY
char path[32];
snprintf(path, 32, "%s%s", HDD0_GAME_DIR, params);
snprintf(path, sizeof(path), "%s%s", HDD0_GAME_DIR, params);

if(*map_title_id && (*params == NULL))
{
Expand Down
2 changes: 1 addition & 1 deletion include/cmd/popup.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
{
show_persistent_popup = PERSIST;
if(param[11])
{is_custom_popup = true; snprintf(custom_popup_msg, 200, "%s", &param[11]);}
{is_custom_popup = true; strncopy(custom_popup_msg, 200, &param[11]);}
else
{show_info_popup = true; BEEP1;} // show persistent info ON
}
Expand Down
2 changes: 1 addition & 1 deletion include/cmd/reloadxmb.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if(islike(param, "/reloadxmb.ps3") && refreshing_xml == 0)
{
reload_xmb(param[14]);
sprintf(param, "/index.ps3");
strcopy(param, "/index.ps3");
}
2 changes: 1 addition & 1 deletion include/cmd/rename_swap_move.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
#endif
if((cmd_len == SWAP_CMD) && file_exists(source) && file_exists(dest))
{
sprintf(header, "%s.bak", source);
concat2(header, source, ".bak");
rename_file(source, header);
rename_file(dest, source);
rename_file(header, dest);
Expand Down
73 changes: 0 additions & 73 deletions include/cmd/scsi_inquire.h

This file was deleted.

4 changes: 2 additions & 2 deletions include/cmd/secureid.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
hook_savedata_plugin();
sprintf(param, "Save data plugin: %s", securfileid_hooked ? STR_ENABLED : STR_DISABLED);

if(file_exists("/dev_hdd0/secureid.log") {sprintf(header, HTML_URL, "/dev_hdd0/secureid.log", "/dev_hdd0/secureid.log"); strcat(param, "<p>Download: "); strcat(param, header);}

if(file_exists("/dev_hdd0/secureid.log") concat2(param, "<p>Download: ", strfmt(HTML_URL, "/dev_hdd0/secureid.log", "/dev_hdd0/secureid.log"));
keep_alive = http_response(conn_s, header, param, CODE_HTTP_OK, param);
goto exit_handleclient_www;
}
Expand Down
2 changes: 1 addition & 1 deletion include/cmd/view.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

// backup original PARAM.SFO
if(patch)
{sprintf(out, "%s.bak", filename); save_file(out, param_sfo, sfo_size);}
{concat2(out, filename, ".bak"); save_file(out, param_sfo, sfo_size);}

// add header & style sheet
sprintf(tmp, "<style>a{%s;cursor:pointer}</style>", HTML_URL_STYLE);
Expand Down
2 changes: 1 addition & 1 deletion include/cmd/write_trunc_unzip.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
if(isHEX(data))
size = Hex2Bin(data, header);
else
size = sprintf(header, "%s", data);
size = strcopy(header, data);

write_file(filename, CELL_FS_O_CREAT | CELL_FS_O_WRONLY, header, offset, size, false);

Expand Down
8 changes: 4 additions & 4 deletions include/cmd/xmb_browser.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,9 @@
if(IS_ON_XMB || *params == '?' || *params == '/')
{ // in-XMB
#ifdef COBRA_ONLY
if(islike(params, "$vsh_menu")) {start_vsh_gui(true); sprintf(param, "/cpursx.ps3"); goto html_response;}
if(islike(params, "$vsh_menu")) {start_vsh_gui(true); strcopy(param, "/cpursx.ps3"); goto html_response;}
else
if(islike(params, "$slaunch")) {start_vsh_gui(false); sprintf(param, "/cpursx.ps3"); goto html_response;}
if(islike(params, "$slaunch")) {start_vsh_gui(false); strcopy(param, "/cpursx.ps3"); goto html_response;}
else
#endif
#ifdef XMB_SCREENSHOT
Expand Down Expand Up @@ -349,7 +349,7 @@
#endif
{
#ifndef LITE_EDITION
if(*params == NULL) sprintf(params, "/");
if(*params == NULL) strcopy(params, "/");
if(*params == '/' ) {do_umount(false); check_path_alias(params); from_xmb_ps3 = true; sprintf(header, "http://%s%s", local_ip, params); open_browser(header, 0);} else
if(*params == '$' ) {if(get_explore_interface()) exec_xmb_command(url);} else
if(*params == '?' ) {do_umount(false); open_browser(url, 0);} else
Expand All @@ -360,7 +360,7 @@
}
}
else
sprintf(url, "ERROR: Not in XMB!");
strcopy(url, "ERROR: Not in XMB!");

if(!mc) keep_alive = http_response(conn_s, header, param, CODE_HTTP_OK, url);

Expand Down
18 changes: 9 additions & 9 deletions include/cpursx.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ static void get_cobra_version(char *cfw_info)
if(!cobra_version) {char *cfw = strchr(cfw_info, ' '); *cfw = NULL;}
#elif defined(DEX_SUPPORT)
#if defined(DECR_SUPPORT)
sprintf(cfw_info, "%s", IS_DEH ? "DECR" : dex_mode ? "DEX" : "CEX");
strcopy(cfw_info, IS_DEH ? "DECR" : dex_mode ? "DEX" : "CEX");
#else
sprintf(cfw_info, "%s", dex_mode ? "DEX" : "CEX");
strcopy(cfw_info, dex_mode ? "DEX" : "CEX");
#endif
if(pex_mode) *cfw_info = 'P';
#else
sprintf(cfw_info, "CEX");
strcopy(cfw_info, "CEX");
#endif
#ifndef COBRA_ONLY
sprintf(cfw_info, " nonCobra");
strcopy(cfw_info, " nonCobra");
#endif

// noBD LV1 4.75 - 4.91
Expand Down Expand Up @@ -183,7 +183,7 @@ static void get_sys_info(char *msg, u8 op, bool nolabel)
if(op == 19) // temp
{char *p = strchr(msg, '\n'); _memset(p, len-30); return;}
if(op == 20) // fan mode
{sprintf(msg, "%s", fan_mode + 3); return;}
{strcopy(msg, fan_mode + 3); return;}
#endif
if(op == 21) // Startup time
sprintf(msg, "%s: %s%02d:%02d:%02d", "Startup", days, hh, mm, ss);
Expand Down Expand Up @@ -244,7 +244,7 @@ static void get_sys_info(char *msg, u8 op, bool nolabel)
if(nolabel)
{
char *sep = strchr(msg, ':');
if(sep) sprintf(msg, "%s", sep + 2);
if(sep) strcopy(msg, sep + 2);
}
else if(op == 34) replace_char(msg, ':', 'D');
return;
Expand Down Expand Up @@ -333,17 +333,17 @@ static void qr_code(char *html, const char *url, const char *prefix, bool small,
len = snprintf(text, 800, "http://%s%s", ip, url);
}
else if(*url == '?')
len = snprintf(text, 800, "%s", url + 1);
len = strncopy(text, 800, url + 1);
else
len = snprintf(text, 800, "%s", url);
len = strncopy(text, 800, url);

strcpy(text + len, "\");</script><br>");

if(small)
concat(buffer, html);
else
{
sz = sprintf(buffer, "%s", html);
sz = strcopy(buffer, html);

// add caption
text[len] = 0;
Expand Down
Loading

0 comments on commit 799b713

Please sign in to comment.