Skip to content

Commit

Permalink
webMAN MOD 1.47.47g
Browse files Browse the repository at this point in the history
More cosmetic changes:
- Normalized order of CELL_FS_O attributes
- Replaced 0x8000000000000000ULL with BASE_MEMORY
- Replaced some sprintf with concat2
  • Loading branch information
aldostools committed Oct 28, 2024
1 parent 4bd1412 commit f74195f
Show file tree
Hide file tree
Showing 29 changed files with 105 additions and 105 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 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.
2 changes: 1 addition & 1 deletion cobra/cobra.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ static int copy_file(char *src, char *dst)
ret = cellFsOpen(src, CELL_FS_O_RDONLY, &fd_s, NULL, 0);
if(ret == 0)
{
ret = cellFsOpen(dst, CELL_FS_O_WRONLY | CELL_FS_O_CREAT | CELL_FS_O_TRUNC, &fd_d, NULL, 0);
ret = cellFsOpen(dst, CELL_FS_O_CREAT | CELL_FS_O_WRONLY | CELL_FS_O_TRUNC, &fd_d, NULL, 0);
if(ret == 0)
{
const u32 buf_size = _16KB_;
Expand Down
2 changes: 2 additions & 0 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@

#define SYSCALL_PTR(n) ( (SYSCALL_TABLE) + ( 8 * (n) ) )

#define BASE_MEMORY 0x8000000000000000ULL

#define HV_BASE 0x8000000014000000ULL // where in lv2 to map lv1
#define HV_SIZE 0x001000 // 0x1000 (we need 4k from lv1 only)
#define HV_PAGE_SIZE 0x0C // 4k = 0x1000 (1 << 0x0c)
Expand Down
5 changes: 2 additions & 3 deletions include/cmd/md5.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@

check_path_alias(filename);

sprintf(buffer, "File: ");
strcopy(buffer, "File: ");
add_breadcrumb_trail(buffer, filename);

struct CellFsStat buf; cellFsStat(filename, &buf);
unsigned long long sz = (unsigned long long)buf.st_size;
u64 sz = file_size(filename);

char md5[33];
calc_md5(filename, md5);
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 @@ -104,7 +104,7 @@
pos = strstr(buffer, "\n");
if(pos) {size -= ++pos - buffer; buffer = pos;} // skip first line
}
write_file(filename, CELL_FS_O_APPEND | CELL_FS_O_CREAT | CELL_FS_O_WRONLY, buffer, len + 1, size, false);
write_file(filename, CELL_FS_O_CREAT | CELL_FS_O_WRONLY | CELL_FS_O_APPEND, buffer, len + 1, size, false);
//save_file(filename, buffer, -size); // append rest of file
}
else if(size + len < buffer_size)
Expand Down
14 changes: 7 additions & 7 deletions include/feat/idps.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,15 @@ static void save_idps_psid(bool is_psid, bool is_idps, char *header, char *param

*act_dat = NULL; int i = 0;

cellFsUnlink("/dev_hdd0/psid.hex");
cellFsUnlink("/dev_hdd0/idps.hex");
cellFsUnlink("/dev_hdd0/act.dat");
unlink_file(drives[0], "", "/psid.hex");
unlink_file(drives[0], "", "/idps.hex");
unlink_file(drives[0], "", "/act.dat");

if(is_psid)
{
for(i = 1; i >= 0; i--)
{
if(is_default) {sprintf(filename, "%s/psid.hex", drives[i]); sprintf(act_dat, "%s/act.dat", drives[i]);}
if(is_default) {concat2(filename, drives[i], "/psid.hex"); concat2(act_dat, drives[i], "/act.dat");}
save_file(filename, (char*)&PSID[0], 16);
if(file_exists(filename)) break; is_default = true;
}
Expand All @@ -197,7 +197,7 @@ static void save_idps_psid(bool is_psid, bool is_idps, char *header, char *param
{
for(i = 1; i >= 0; i--)
{
if(is_default) {sprintf(filename, "%s/idps.hex", drives[i]); sprintf(act_dat, "%s/act.dat", drives[i]);}
if(is_default) {concat2(filename, drives[i], "/idps.hex"); concat2(act_dat, drives[i], "/act.dat");}
save_file(filename, (char*)&IDPS[0], 16);
if(file_exists(filename)) break; is_default = true;
}
Expand Down Expand Up @@ -227,12 +227,12 @@ static void save_idps_psid(bool is_psid, bool is_idps, char *header, char *param

if(is_idps)
{
if(is_default) sprintf(file_path, "%s/idps.hex", drives[i]);
if(is_default) concat2(file_path, drives[i], "/idps.hex");
if(file_exists(file_path)) {add_breadcrumb_trail(buffer, file_path); sprintf(header, " • %016llX%016llX<br>", IDPS[0], IDPS[1]); strcat(buffer, header);}
}
if(is_psid)
{
if(is_default) sprintf(file_path, "%s/psid.hex", drives[i]);
if(is_default) concat2(file_path, drives[i], "/psid.hex");
if(file_exists(file_path)) {add_breadcrumb_trail(buffer, file_path); sprintf(header, " • %016llX%016llX<br>", PSID[0], PSID[1]); strcat(buffer, header);}
}
}
Expand Down
2 changes: 1 addition & 1 deletion include/feat/rospatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ static int patch_ros(const char *patch_file, u8 *mem, int conn_s, u8 ros, bool f
ssend_message(conn_s, "<p>Preparing ROS%d overlay...</p>", cur_ros);
int fd_overlay;

if(cellFsOpen(overlay_path[cur_ros], CELL_FS_O_CREAT|CELL_FS_O_WRONLY|CELL_FS_O_TRUNC, &fd_overlay, NULL, 0) != CELL_FS_SUCCEEDED)
if(cellFsOpen(overlay_path[cur_ros], CELL_FS_O_CREAT | CELL_FS_O_WRONLY | CELL_FS_O_TRUNC, &fd_overlay, NULL, 0) != CELL_FS_SUCCEEDED)
{
ssend_message(conn_s, "<p style=\"color:red;\">Error creating overlay file!</p>");
BEEP3; ros_patching = false; return FAILED;
Expand Down
2 changes: 1 addition & 1 deletion include/feat/xmb_savebmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static void saveBMP(char *path, bool notify_bmp, bool small)

// create bmp file
int fd; mkdir_tree(path);
if(IS_INGAME || cellFsOpen(path, CELL_FS_O_WRONLY|CELL_FS_O_CREAT|CELL_FS_O_TRUNC, &fd, NULL, 0) != CELL_FS_SUCCEEDED) { BEEP3 ; return;}
if(IS_INGAME || cellFsOpen(path, CELL_FS_O_CREAT | CELL_FS_O_WRONLY | CELL_FS_O_TRUNC, &fd, NULL, 0) != CELL_FS_SUCCEEDED) { BEEP3 ; return;}

// max frame line size = 1920 pixel * 4(byte per pixel) = 7680 byte = 8 KB
// max bmp buffer size = 1920 pixel * 3(byte per pixel) = 5760 byte = 6 KB
Expand Down
4 changes: 2 additions & 2 deletions include/file/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,8 @@ int save_file(const char *file, const char *mem, s64 size)

bool crlf = (size == APPEND_TEXT); // auto add new line

int flags = CELL_FS_O_CREAT | CELL_FS_O_TRUNC | CELL_FS_O_WRONLY;
if( size < 0 ) {flags = CELL_FS_O_APPEND | CELL_FS_O_CREAT | CELL_FS_O_WRONLY; size = crlf ? SAVE_ALL : -size;} else
int flags = CELL_FS_O_CREAT | CELL_FS_O_WRONLY | CELL_FS_O_TRUNC;
if( size < 0 ) {flags = CELL_FS_O_CREAT | CELL_FS_O_WRONLY | CELL_FS_O_APPEND; size = crlf ? SAVE_ALL : -size;} else
if(!extcmp(file, "/PARAM.SFO", 10)) flags = CELL_FS_O_WRONLY;
return write_file(file, flags, mem, 0, (int)size, crlf);
}
Expand Down
4 changes: 2 additions & 2 deletions include/file/file_copy.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ int64_t file_copy(const char *file1, char *file2)
}
#endif
// copy_file
if(is_ntfs2 || merge_part || (cellFsOpen(file2, CELL_FS_O_CREAT | CELL_FS_O_WRONLY | CELL_FS_O_TRUNC, &fd2, 0, 0) == CELL_FS_SUCCEEDED))
if(is_ntfs2 || merge_part || (cellFsOpen(file2, CELL_FS_O_CREAT | CELL_FS_O_WRONLY | CELL_FS_O_TRUNC , &fd2, 0, 0) == CELL_FS_SUCCEEDED))
{
pos = 0;
while(size > 0)
Expand Down Expand Up @@ -504,7 +504,7 @@ static int file_concat(const char *file1, char *file2)
if(sysmem)
{
// append
if(cellFsOpen(file2, CELL_FS_O_CREAT | CELL_FS_O_RDWR | CELL_FS_O_APPEND, &fd2, 0, 0) == CELL_FS_SUCCEEDED)
if(cellFsOpen(file2, CELL_FS_O_RDWR | CELL_FS_O_CREAT | CELL_FS_O_APPEND, &fd2, 0, 0) == CELL_FS_SUCCEEDED)
{
char *chunk = (char*)sysmem;
u64 read = 0, written = 0, pos=0;
Expand Down
6 changes: 3 additions & 3 deletions include/init/firmware.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ static void detect_firmware(void)
}
#endif //#ifdef DEX_SUPPORT

base_addr |= 0x8000000000000000ULL;
open_hook |= 0x8000000000000000ULL;
base_addr |= BASE_MEMORY;
open_hook |= BASE_MEMORY;
#endif //#ifndef COBRA_ONLY

if(IS_CEX)
Expand Down Expand Up @@ -1037,7 +1037,7 @@ static bool disable_map_path(bool toggle_patch) // based on haxxxen's patch post
{
if(open_hook)
{
const u64 open_hook_symbol = open_hook | 0x8000000000000000ULL;
const u64 open_hook_symbol = open_hook | BASE_MEMORY;

if(!map_path_instruction) map_path_instruction = peekq(open_hook_symbol); // backup cobra mappath instruction

Expand Down
2 changes: 1 addition & 1 deletion include/mount/mount.h
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ static void cache_file_to_hdd(char *source, char *target, const char *basepath,
{
if(*source == '/')
{
concat2(target, "/dev_hdd0", basepath);
concat2(target, drives[0], basepath);
cellFsMkdir(target, DMODE);

strcat(target, get_filename(source)); // add file name
Expand Down
52 changes: 26 additions & 26 deletions include/mount/mount_noncobra.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

if(sc_600)
{ // restore original values
sc_600 |= 0x8000000000000000ULL;
sc_604 |= 0x8000000000000000ULL;
sc_142 |= 0x8000000000000000ULL;
sc_600 |= BASE_MEMORY;
sc_604 |= BASE_MEMORY;
sc_142 |= BASE_MEMORY;

if(peekq(SYSCALL_PTR(600)) != sc_600) pokeq(SYSCALL_PTR(600), sc_600); // sys_storage_open 600
if(peekq(SYSCALL_PTR(604)) != sc_604) pokeq(SYSCALL_PTR(604), sc_604); // sys_storage_send_device_cmd 604
Expand Down Expand Up @@ -140,13 +140,13 @@

char path2[strlen(_path) + 24];

sprintf(path2, "%s/PS3_GAME", _path); check_ps3_game(path2);
concat2(path2, _path, "/PS3_GAME"); check_ps3_game(path2);
add_to_map(APP_HOME_DIR, path2);

sprintf(path2, "%s/PS3_GAME/USRDIR", _path); check_ps3_game(path2);
concat2(path2, _path, "/PS3_GAME/USRDIR"); check_ps3_game(path2);
add_to_map("/app_home/USRDIR", path2);

sprintf(path2, "%s/PS3_GAME/USRDIR/", _path); check_ps3_game(path2);
concat2(path2, _path, "/PS3_GAME/USRDIR/"); check_ps3_game(path2);
add_to_map("/app_home/", path2);
}

Expand All @@ -164,7 +164,7 @@
else if(strstr(_path, "/GAME"))
{
char extgdfile[STD_PATH_LEN + 24], *extgdini = extgdfile;
sprintf(extgdfile, "%s/PS3_GAME/PS3GAME.INI", _path); check_ps3_game(extgdfile);
concat2(extgdfile, _path, "/PS3_GAME/PS3GAME.INI"); check_ps3_game(extgdfile);
if(read_file(extgdfile, extgdini, 12, 0))
{
if((extgd == 0) && (extgdini[10] & (1<<1))) set_gamedata_status(1, false); else
Expand All @@ -182,30 +182,30 @@
char expplg[64];
char app_sys[40];

sprintf(app_sys, "%s/sys", MM_ROOT_STD);
concat2(app_sys, MM_ROOT_STD, "/sys");
if(!isDir(app_sys))
sprintf(app_sys, "%s/sys", MM_ROOT_STL);
concat2(app_sys, MM_ROOT_STL, "/sys");
if(!isDir(app_sys))
sprintf(app_sys, "%s/sys", MM_ROOT_SSTL);
concat2(app_sys, MM_ROOT_SSTL, "/sys");

if(c_firmware == 3.55f)
sprintf(expplg, "%s/IEXP0_355.BIN", app_sys);
concat2(expplg, app_sys, "/IEXP0_355.BIN");
else if(c_firmware == 4.21f)
sprintf(expplg, "%s/IEXP0_420.BIN", app_sys);
concat2(expplg, app_sys, "/IEXP0_420.BIN");
else if(c_firmware == 4.30f || c_firmware == 4.31f)
sprintf(expplg, "%s/IEXP0_430.BIN", app_sys);
concat2(expplg, app_sys, "/IEXP0_430.BIN");
else if(c_firmware == 4.40f || c_firmware == 4.41f)
sprintf(expplg, "%s/IEXP0_440.BIN", app_sys);
concat2(expplg, app_sys, "/IEXP0_440.BIN");
else if(c_firmware == 4.46f)
sprintf(expplg, "%s/IEXP0_446.BIN", app_sys);
concat2(expplg, app_sys, "/IEXP0_446.BIN");
else if(BETWEEN(4.50f, c_firmware, 4.55f))
sprintf(expplg, "%s/IEXP0_450.BIN", app_sys);
concat2(expplg, app_sys, "/IEXP0_450.BIN");
else if(BETWEEN(4.60f, c_firmware, 4.66f))
sprintf(expplg, "%s/IEXP0_460.BIN", app_sys);
concat2(expplg, app_sys, "/IEXP0_460.BIN");
else if(c_firmware >= 4.70f)
sprintf(expplg, "%s/IEXP0_470.BIN", app_sys);
concat2(expplg, app_sys, "/IEXP0_470.BIN");
else
sprintf(expplg, "%s/none", app_sys);
concat2(expplg, app_sys, "/none");

if(action && file_exists(expplg))
add_to_map(VSH_MODULE_DIR "explore_plugin.sprx", expplg);
Expand All @@ -216,9 +216,9 @@
if(action && (c_firmware >= 4.20f))
{
if(file_exists(NEW_LIBFS_PATH))
sprintf(expplg, NEW_LIBFS_PATH);
str_copy(expplg, NEW_LIBFS_PATH);
else
sprintf(expplg, "%s/ILFS0_000.BIN", app_sys);
concat2(expplg, app_sys, "/ILFS0_000.BIN");

if(file_exists(expplg))
add_to_map(ORG_LIBFS_PATH, expplg);
Expand All @@ -235,20 +235,20 @@

u16 src_len, dst_len;

for(u8 n = 0; n < max_mapped; n++)
for(u8 n = 0; n < max_mapped; n++, map_data += 0x20)
{
if(map_paths > 0x80000000007FE800ULL) break;

pokeq(map_data + (n * 0x20) + 0x10, map_paths);
pokeq(map_data + 0x10, map_paths);
src_len = string_to_lv2(file_to_map[n].src, map_paths);
map_paths += src_len; //(src_len + 8) & 0x7f8;

pokeq(map_data + (n * 0x20) + 0x18, map_paths);
pokeq(map_data + 0x18, map_paths);
dst_len = string_to_lv2(file_to_map[n].dst, map_paths);
map_paths += dst_len; //(dst_len + 8) & 0x7f8;

pokeq(map_data + (n * 0x20) + 0x00, src_len);
pokeq(map_data + (n * 0x20) + 0x08, dst_len);
pokeq(map_data + 0x00, src_len);
pokeq(map_data + 0x08, dst_len);
}

wait_for("/dev_bdvd", 2);
Expand Down
2 changes: 1 addition & 1 deletion include/mount/netclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ static int copy_net_file(const char *local_file, const char *remote_file, int ns

show_progress(remote_file, OV_COPY);

if(cellFsOpen(local_file, CELL_FS_O_CREAT | CELL_FS_O_TRUNC | CELL_FS_O_WRONLY, &fdw, NULL, 0) == CELL_FS_SUCCEEDED)
if(cellFsOpen(local_file, CELL_FS_O_CREAT | CELL_FS_O_WRONLY | CELL_FS_O_TRUNC, &fdw, NULL, 0) == CELL_FS_SUCCEEDED)
{
if(chunk_size > file_size) chunk_size = (u32)file_size;

Expand Down
2 changes: 1 addition & 1 deletion include/mount/rawseciso.h
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ static void get_psx_track_data(void)
}
else
{
lv2_addr = 0x8000000000000000ULL + (u64) track_data[2];
lv2_addr = BASE_MEMORY | (u64) track_data[2];
my_memcpy64((u64*)buff, lv2_addr, track_data[3]);

while(k < (int) track_data[3])
Expand Down
6 changes: 3 additions & 3 deletions include/notify/show_msg2.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// ~C = L"\uF893" = Dualshock L2 buttonD-Pad LEFT Button-Combo
// ~D = L"\uF894" = Dualshock R2 buttonD-Pad RIGHT Button-Combo

static void show_navigation_msg(char* msg)
static void show_navigation_msg(const char* msg)
{
u32 system_plugin_handle = View_Find("system_plugin");
if (system_plugin_handle == 0)
Expand All @@ -35,15 +35,15 @@ static void show_navigation_msg(char* msg)
int len = strlen(msg) + 1;

wchar_t wmsg[len];
mbstowcs((wchar_t*)wmsg, (const char*)msg, len); //size_t stdc_FCAC2E8E(wchar_t *dest, const char *src, size_t max)
mbstowcs((wchar_t*)wmsg, msg, len); //size_t stdc_FCAC2E8E(wchar_t *dest, const char *src, size_t max)

for (int i = 0; i < len; i++) if (wmsg[i] == 0x7E) { wmsg[i] = 0xF850 + (u8)wmsg[i + 1], wmsg[++i] = 0x20; }

ShowButtonNavigationText(widget, wmsg, 4, 0);
}

/*
static void show_navigation_msg(char* msg)
static void show_navigation_msg(const char* msg)
{
int view = View_Find("xmb_plugin");
if(view)
Expand Down
14 changes: 7 additions & 7 deletions include/ps3mapi/debug_mem.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

static void poke_chunk_lv1(u64 start, int size, u8 *buffer, u8 oper)
{
start |= 0x8000000000000000ULL; u64 old_value, new_value;
start |= BASE_MEMORY; u64 old_value, new_value;
for(int offset = 0; offset < size; offset += 8)
{
new_value = *(u64*)(buffer + offset);
Expand All @@ -28,7 +28,7 @@ static void poke_chunk_lv1(u64 start, int size, u8 *buffer, u8 oper)

static void poke_chunk_lv2(u64 start, int size, u8 *buffer, u8 oper)
{
start |= 0x8000000000000000ULL; u64 old_value, new_value;
start |= BASE_MEMORY; u64 old_value, new_value;
for(int offset = 0; offset < size; offset += 8)
{
new_value = *(u64*)(buffer + offset);
Expand Down Expand Up @@ -85,11 +85,11 @@ static int ps3mapi_get_memory(u32 pid, u32 address, char *mem, u32 size)
{
if(pid == LV1)
{
peek_chunk_lv1((address | 0x8000000000000000ULL), size, (u64*)mem);
peek_chunk_lv1((address | BASE_MEMORY), size, (u64*)mem);
}
else if(pid == LV2)
{
peek_chunk_lv2((address | 0x8000000000000000ULL), size, (u64*)mem);
peek_chunk_lv2((address | BASE_MEMORY), size, (u64*)mem);
}
else if(pid == FLASH)
{
Expand Down Expand Up @@ -125,7 +125,7 @@ static void ps3mapi_dump_process(const char *dump_file, u32 pid, u32 address, u3

show_msg_with_icon(ICON_WAIT, "Dumping...");

if(cellFsOpen(dump_file, CELL_FS_O_CREAT | CELL_FS_O_TRUNC | CELL_FS_O_WRONLY, &fd, NULL, 0) == CELL_FS_SUCCEEDED)
if(cellFsOpen(dump_file, CELL_FS_O_CREAT | CELL_FS_O_WRONLY | CELL_FS_O_TRUNC, &fd, NULL, 0) == CELL_FS_SUCCEEDED)
{
char label[20];
for(u32 addr = 0; addr < size; addr += _64KB_)
Expand Down Expand Up @@ -281,7 +281,7 @@ static void ps3mapi_find_peek_poke_hexview(char *buffer, char *templn, char *par

concat(buffer, "<pre>");

address|=0x8000000000000000ULL;
address |= BASE_MEMORY;

lv1 = strstr(param,".lv1?") ? 1 : 0;
#ifdef COBRA_ONLY
Expand All @@ -297,7 +297,7 @@ static void ps3mapi_find_peek_poke_hexview(char *buffer, char *templn, char *par

pos = strstr(param, "&stop=");
if(pos)
{upper_memory = convertH(pos + 6) | 0x8000000000000000ULL; *pos = NULL;}
{upper_memory = convertH(pos + 6) | BASE_MEMORY; *pos = NULL;}
else
{upper_memory = (lv1 ? LV1_UPPER_MEMORY : LV2_UPPER_MEMORY) - 8;}
}
Expand Down
Loading

0 comments on commit f74195f

Please sign in to comment.