Skip to content

Commit

Permalink
webMAN MOD 1.47.37
Browse files Browse the repository at this point in the history
- Added support for scanning covers in a centralized /dev_hdd0/tmp/wmtmp/covers
(All covers including BD and DVD covers are scanned in this folders too)
- wMM now checks that the remote file exists before mount or copy it
- Mounting of /net files now are restricted to folder and valid ISO extensions
(This fixes an issue where mounting non ISO files breaks the server connection)
- Fixed mounting of remote PSXISO using .CUE/.CCD
- Added support for MAME Midway core in RetroArch (ROMS/MIDWAY)
- Removed support for scanning the folder ROMS/MAME078
  • Loading branch information
aldostools committed Feb 5, 2022
1 parent a2aeed7 commit 7c740d3
Show file tree
Hide file tree
Showing 23 changed files with 120 additions and 40 deletions.
2 changes: 1 addition & 1 deletion _Projects_/updater/pkgfiles/USRDIR/lang/LANG_ROMS.TXT
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
2048 [2048]
CAP32 [Amstrad - CPC (Caprice32)]
MAME [Arcade (MAME)]
MAME078 [Arcade (MAME 0.78)]
MAME2000 [Arcade (MAME 2000)]
MAME2003 [Arcade (MAME 2003)]
MIDWAY [Arcade (MAME 2003 Midway)]
MAMEPLUS [Arcade (MAME 2003 Plus)]
FBA [Arcade (FB Alpha)]
FBA2012 [Arcade (FBA 2012)]
Expand Down
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 not shown.
Binary file modified _Projects_/updater/pkgfiles/USRDIR/xmb/PKGLAUNCH/USRDIR/EBOOT.BIN
Binary file not shown.
Binary file not shown.
Binary file modified _Projects_/updater/update/dev_hdd0/game/PKGLAUNCH/USRDIR/EBOOT.BIN
Binary file not shown.
Binary file modified _Projects_/updater/update/dev_hdd0/plugins/webftp_server.sprx
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
2048 [2048]
CAP32 [Amstrad - CPC (Caprice32)]
MAME [Arcade (MAME)]
MAME078 [Arcade (MAME 0.78)]
MAME2000 [Arcade (MAME 2000)]
MAME2003 [Arcade (MAME 2003)]
MIDWAY [Arcade (MAME 2003 Midway)]
MAMEPLUS [Arcade (MAME 2003 Plus)]
FBA [Arcade (FB Alpha)]
FBA2012 [Arcade (FBA 2012)]
Expand Down
5 changes: 4 additions & 1 deletion _Projects_/wm_url_launcher/CREATE_PKG.bat
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ set PKG_NAME=./%CONTENTID%.pkg
python.exe %PKG% --contentid %CONTENTID% %PKG_DIR% %PKG_NAME%

ren UP0001-PKGLAUNCH_00-0000000000000000.pkg ROMS_PKG_Launcher.pkg
pause

xcopy .\pkg ..\updater\pkgfiles\USRDIR\xmb\PKGLAUNCH /Y/E/S
xcopy .\pkg ..\updater\update\dev_hdd0\game\PKGLAUNCH /Y/E/S
pause
20 changes: 11 additions & 9 deletions _Projects_/wm_url_launcher/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,19 +545,21 @@ int main(int argc, const char* argv[])
else
if(strcasestr(path, "/ROMS/MAME/"))
{
sprintf(path, "%s/mame078%s", RETROARCH, sufix[i]);
sprintf(path, "%s/mame2003%s", RETROARCH, sufix[i]);
if(not_exists(path)) sprintf(path, "%s/mame2000%s", RETROARCH, sufix[i]);
if(not_exists(path)) sprintf(path, "%s/mame2003%s", RETROARCH, sufix[i]);
if(not_exists(path)) sprintf(path, "%s/mame2003_plus%s", RETROARCH, sufix[i]);
if(not_exists(path)) sprintf(path, "%s/mame2003_midway%s", RETROARCH, sufix[i]);
if(not_exists(path)) sprintf(path, "%s/mame078%s", RETROARCH, sufix[i]);
}
else
if(strcasestr(path, "/ROMS/MAME078/")) sprintf(path, "%s/mame078%s", RETROARCH, sufix[i]); else
if(strcasestr(path, "/ROMS/MAME2000/")) sprintf(path, "%s/mame2000%s", RETROARCH, sufix[i]); else
if(strcasestr(path, "/ROMS/MAME2003/")) sprintf(path, "%s/mame2003%s", RETROARCH, sufix[i]); else
if(strcasestr(path, "/ROMS/MAMEPLUS/")) sprintf(path, "%s/mame2003_plus%s", RETROARCH, sufix[i]); else

if(strcasestr(path, "/ROMS/QUAKE/")) sprintf(path, "%s/tyrquake%s", RETROARCH, sufix[i]); else
if(strcasestr(path, "/ROMS/QUAKE2/")) sprintf(path, "%s/vitaquake2%s", RETROARCH, sufix[i]); else
if(strcasestr(path, "/ROMS/MAME078/")) sprintf(path, "%s/mame078%s", RETROARCH, sufix[i]); else
if(strcasestr(path, "/ROMS/MAME2000/")) sprintf(path, "%s/mame2000%s", RETROARCH, sufix[i]); else
if(strcasestr(path, "/ROMS/MAME2003/")) sprintf(path, "%s/mame2003%s", RETROARCH, sufix[i]); else
if(strcasestr(path, "/ROMS/MAMEPLUS/")) sprintf(path, "%s/mame2003_plus%s", RETROARCH, sufix[i]); else
if(strcasestr(path, "/ROMS/MIDWAY/")) sprintf(path, "%s/mame2003_midway%s", RETROARCH, sufix[i]); else

if(strcasestr(path, "/ROMS/QUAKE/")) sprintf(path, "%s/tyrquake%s", RETROARCH, sufix[i]); else
if(strcasestr(path, "/ROMS/QUAKE2/")) sprintf(path, "%s/vitaquake2%s", RETROARCH, sufix[i]); else
if(strcasestr(path, "/ROMS/DOOM/")) sprintf(path, "%s/prboom%s", RETROARCH, sufix[i]); else

if(strcasestr(path, "/ROMS/PCE/"))
Expand Down
Binary file modified _Projects_/wm_url_launcher/pkg/PS3_GAME/USRDIR/EBOOT.BIN
Binary file not shown.
Binary file modified _Projects_/wm_url_launcher/pkg/USRDIR/EBOOT.BIN
Binary file not shown.
19 changes: 15 additions & 4 deletions include/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,11 @@ static bool isDir(const char* path)
return ((ps3ntfs_stat(tmp + 5, &bufn) >= 0) && (bufn.st_mode & S_IFDIR));
}
#endif

struct CellFsStat s;
if(cellFsStat(path, &s) == CELL_FS_SUCCEEDED)
return ((s.st_mode & CELL_FS_S_IFDIR) != 0);
else
return 0;
return false;
}

#ifdef COBRA_ONLY
Expand Down Expand Up @@ -253,12 +252,25 @@ static u64 file_size(const char *path)

static bool file_exists(const char *path)
{
#ifdef NET_SUPPORT
if(islike(path, "/net"))
{
bool ret = false;
int ns = connect_to_remote_server(path[4] & 0x0F);
if(ns >= 0)
{
ret = (remote_file_exists(ns, path + 5) != FAILED);
sclose(&ns);
}
return ret;
}
#endif
return (file_ssize(path) >= 0);
}

static bool not_exists(const char *path)
{
return (file_ssize(path) <= FAILED);
return !file_exists(path);
}

static char *get_ext(const char *path)
Expand Down Expand Up @@ -1213,7 +1225,6 @@ static void uninstall(char *param)

cellFsUnlink(WMCONFIG);
cellFsUnlink(WMNOSCAN);
cellFsUnlink(WM_COMBO_PATH);
cellFsUnlink(WMREQUEST_FILE);
cellFsUnlink(WMNET_DISABLED);
cellFsUnlink(WMONLINE_GAMES);
Expand Down
30 changes: 23 additions & 7 deletions include/games_covers.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static bool use_custom_icon_path = false, use_icon_region = false;
static bool is_devil303_server = false;
#endif

static bool covers_exist[8];
static bool covers_exist[9];
static bool covers_retro_exist[3];
static bool wm_icons_exists = false;

Expand All @@ -79,7 +79,8 @@ static void check_cover_folders(char *buffer)
{
sprintf(buffer, "%s/covers", cpath[p]); covers_exist[p + 1] = isDir(buffer); // MM_ROOT_STD, MM_ROOT_STL, MM_ROOT_SSTL, "/dev_hdd0/GAMES", "/dev_hdd0/GAMEZ"
}
covers_exist[6] = isDir(WMTMP) && SHOW_COVERS_OR_ICON0; // WMTMP
covers_exist[6] = isDir(WMTMP_COVERS);
covers_exist[8] = isDir(WMTMP) && SHOW_COVERS_OR_ICON0; // WMTMP

#ifndef ENGLISH_ONLY
if(!covers_exist[0]) {use_custom_icon_path = strstr(COVERS_PATH, "%s"); use_icon_region = strstr(COVERS_PATH, "%s/%s");} else {use_icon_region = use_custom_icon_path = false;}
Expand Down Expand Up @@ -134,9 +135,11 @@ static size_t get_name(char *name, const char *filename, u8 cache)

int flen, pos = 0;
if(cache) {pos = strlen(filename); while(pos > 0 && filename[pos - 1] != '/') pos--;}
if(cache == 2) cache = 0;
if(cache == NO_PATH) cache = 0;

if(cache)
if(cache == WM_COVERS)
flen = sprintf(name, "%s/%s", WMTMP_COVERS, filename + pos);
else if(cache)
flen = sprintf(name, "%s/%s", WMTMP, filename + pos);
else
{
Expand Down Expand Up @@ -215,8 +218,15 @@ static bool get_cover_by_titleid(char *icon, char *title_id)
if(get_image_file(icon, flen)) return true;
}

// Search covers in WMTMP
// Search covers in WMTMP_COVERS
if(covers_exist[6])
{
flen = sprintf(icon, "%s/%s", WMTMP_COVERS, title_id);
if(get_image_file(icon, flen)) return true;
}

// Search covers in WMTMP
if(covers_exist[8])
{
flen = sprintf(icon, "%s/%s", WMTMP, title_id);
if(get_image_file(icon, flen)) return true;
Expand Down Expand Up @@ -381,9 +391,15 @@ static void get_default_icon_from_folder(char *icon, u8 is_dir, const char *para
// continue searching for covers
if(SHOW_COVERS) return;

// get covers/icons from /dev_hdd0/tmp/wmtmp
flen = get_name(icon, entry_name, GET_WMTMP);
// Search covers in WMTMP_COVERS
if(covers_exist[6])
{
flen = get_name(icon, entry_name, WM_COVERS);
if(get_image_file(icon, flen)) return;
}

// Search covers in WMTMP
flen = get_name(icon, entry_name, GET_WMTMP);
if(get_image_file(icon, flen)) return;

*icon = NULL;
Expand Down
2 changes: 1 addition & 1 deletion include/games_xml.h
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ static bool scan_mygames_xml(u64 conn_s_p)

#ifdef MOUNT_ROMS
#define ROM_PATHS 89
const char *roms_path[ROM_PATHS] = { "2048", "CAP32", "MAME", "MAME078", "MAME2000", "MAME2003", "MAMEPLUS", "FBA", "FBA2012", "FBNEO", "ATARI", "ATARI2600", "STELLA", "ATARI5200", "ATARI7800", "JAGUAR", "LYNX", "HANDY", "HATARI", "CANNONBALL", "NXENGINE", "COLECO", "AMIGA", "CD32", "VICE", "X64", "X64SC", "X64DTV", "X64SCPU", "X128", "XCBM2", "XCMB25X0", "XPET", "XPLUS4", "XVIC", "DOSBOX", "GME", "GW", "DOOM", "QUAKE", "JAVAME", "O2EM", "INTV", "BMSX", "MSX", "FMSX", "MSX2", "NEOCD", "NEO", "NEOGEO", "PCE", "PCECD", "PCFX", "SGX", "NGP", "NES", "FCEUMM", "NESTOPIA", "QNES", "GB", "GBC", "GAMBATTE", "TGBDUAL", "GBA", "VBA", "MGBA", "VBOY", "PALM", "POKEMINI", "GENESIS", "GEN", "SEGACD", "MEGAD", "MEGADRIVE", "GG", "GEARBOY", "MASTER", "SG1000", "FUSE", "ZX81", "SNES", "MSNES", "SNES9X", "SNES9X2005", "SNES9X2010", "SNES9X_NEXT", "THEODORE", "VECX", "WSWAM" };
const char *roms_path[ROM_PATHS] = { "2048", "CAP32", "MAME", "MAME2000", "MAME2003", "MIDWAY", "MAMEPLUS", "FBA", "FBA2012", "FBNEO", "ATARI", "ATARI2600", "STELLA", "ATARI5200", "ATARI7800", "JAGUAR", "LYNX", "HANDY", "HATARI", "CANNONBALL", "NXENGINE", "COLECO", "AMIGA", "CD32", "VICE", "X64", "X64SC", "X64DTV", "X64SCPU", "X128", "XCBM2", "XCMB25X0", "XPET", "XPLUS4", "XVIC", "DOSBOX", "GME", "GW", "DOOM", "QUAKE", "JAVAME", "O2EM", "INTV", "BMSX", "MSX", "FMSX", "MSX2", "NEOCD", "NEO", "NEOGEO", "PCE", "PCECD", "PCFX", "SGX", "NGP", "NES", "FCEUMM", "NESTOPIA", "QNES", "GB", "GBC", "GAMBATTE", "TGBDUAL", "GBA", "VBA", "MGBA", "VBOY", "PALM", "POKEMINI", "GENESIS", "GEN", "SEGACD", "MEGAD", "MEGADRIVE", "GG", "GEARBOY", "MASTER", "SG1000", "FUSE", "ZX81", "SNES", "MSNES", "SNES9X", "SNES9X2005", "SNES9X2010", "SNES9X_NEXT", "THEODORE", "VECX", "WSWAM" };
u16 roms_count[ROM_PATHS]; u32 count_roms = 0;
#endif
u8 roms_index = 0;
Expand Down
26 changes: 19 additions & 7 deletions include/mount_net.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ if(netid >= '0' && netid <= '4')
{
netiso_svrid = (netid & 0x0F);
memset((void*)&netiso_args, 0, sizeof(_netiso_args));
/*
if(is_netsrv_enabled(netiso_svrid) == false)

if(_path[5] == NULL) strcat(_path, "/.");

char *netpath = _path + 5, *pkg_slash = NULL;

if(file_exists(_path) == false)
{
ret = false;
goto exit_mount;
}
*/
if(_path[5] == NULL) strcat(_path, "/.");

char *netpath = _path + 5, *pkg_slash = NULL;

size_t len = sprintf(netiso_args.path, "%s", netpath);

Expand All @@ -28,6 +28,17 @@ if(netid >= '0' && netid <= '4')
{
if(strlen(ext) == 4 || islike(ext, ".0"))
is_iso = (strcasestr(ISO_EXTENSIONS, ext) != NULL);

if(!is_iso && (remote_is_dir(_path) == false))
{
ret = false;
goto exit_mount;
}
}
else if(remote_is_dir(_path) == false)
{
ret = false;
goto exit_mount;
}

mount_unk = netiso_args.emu_mode = EMU_BD;
Expand All @@ -40,14 +51,15 @@ if(netid >= '0' && netid <= '4')
{
sprintf(netiso_args.path, "/***DVD***%s", "/PSPISO");
}
else if(islike(netpath, "/PSX") && is_iso)
else if(strstr(netpath, "/PSX") && is_iso)
{
TrackDef tracks[MAX_TRACKS];
unsigned int num_tracks = 1;

int ns = connect_to_remote_server(netiso_svrid);
if(ns >= 0)
{
// load cuesheet
cellFsUnlink(TEMP_NET_PSXCUE);
const char *cue_ext[4] = {".cue", ".ccd", ".CUE", ".CCD"};
for(u8 e = 0; e < 4; e++)
Expand Down
50 changes: 42 additions & 8 deletions include/netclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,20 @@ static int remote_stat(int s, const char *path, int *is_directory, s64 *file_siz
return CELL_OK;
}

static int remote_file_exists(int ns, const char *remote_file)
{
s64 size = 0; int abort_connection = 0;
int is_directory = 0; u64 mtime, ctime, atime;

if(remote_stat(ns, remote_file, &is_directory, &size, &mtime, &ctime, &atime, &abort_connection) != CELL_OK)
return FAILED;

if(is_directory || (size > 0))
return CELL_OK;

return FAILED;
}

#ifdef USE_INTERNAL_NET_PLUGIN
static int read_remote_file_critical(u64 offset, void *buf, u32 size)
{
Expand Down Expand Up @@ -747,21 +761,24 @@ static int copy_net_file(const char *local_file, const char *remote_file, int ns
{
copy_aborted = false;

if(ns < 0) return FAILED;
if((ns < 0) || (maxbytes <= 0)) return FAILED;

if(file_exists(local_file)) return CELL_OK; // local file already exists

s64 size = 0; int abort_connection = 0;

if(!strchr(remote_file, '*'))
// check invalid characters
for(u16 c = 0; remote_file[c]; c++)
{
int is_directory = 0; u64 mtime, ctime, atime;
if(remote_stat(ns, remote_file, &is_directory, &size, &mtime, &ctime, &atime, &abort_connection) != CELL_OK || size <= 0) return FAILED;
if(strchr("\"<|>:*?", remote_file[c])) return FAILED;
}

// check remote file exists
if(remote_file_exists(ns, remote_file)) return FAILED;

// copy remote file
int ret = FAILED;
int abort_connection = 0;

size = open_remote_file(ns, remote_file, &abort_connection);
s64 size = open_remote_file(ns, remote_file, &abort_connection);

u64 file_size = size;

Expand All @@ -775,7 +792,7 @@ static int copy_net_file(const char *local_file, const char *remote_file, int ns

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

if(chunk_size > file_size) chunk_size = (u32)file_size;

Expand Down Expand Up @@ -804,4 +821,21 @@ static int copy_net_file(const char *local_file, const char *remote_file, int ns

return ret;
}

static bool remote_is_dir(const char *remote_path)
{
int ns = connect_to_remote_server(remote_path[4]);
if(ns >= 0)
{
s64 size = 0; int abort_connection = 0;
int is_directory = 0; u64 mtime, ctime, atime;

if(remote_stat(ns, remote_path + 5, &is_directory, &size, &mtime, &ctime, &atime, &abort_connection) != CELL_OK)
return false;

if(is_directory)
return true;
}
return false;
}
#endif //#ifdef NET_SUPPORT
1 change: 1 addition & 0 deletions include/paths.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

#define WMCONFIG TMP_DIR "/wm_config.bin" // webMAN config file
#define WMTMP TMP_DIR "/wmtmp" // webMAN work/temp folder
#define WMTMP_COVERS TMP_DIR "/wmtmp/covers" // webMAN covers folder
#define WM_RES_PATH TMP_DIR "/wm_res" // webMAN resources
#define WM_LANG_PATH TMP_DIR "/wm_lang" // webMAN language folder
#define WM_ICONS_PATH TMP_DIR "/wm_icons" // webMAN icons folder
Expand Down
3 changes: 2 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ enum get_name_options
{
NO_EXT = 0,
GET_WMTMP = 1,
NO_PATH = 2,
WM_COVERS = 2,
NO_PATH = 3,
};

enum is_binary_options
Expand Down

0 comments on commit 7c740d3

Please sign in to comment.