Skip to content

Commit

Permalink
fix multi-game disc support for /app_home (#1075)
Browse files Browse the repository at this point in the history
  • Loading branch information
bibarub authored May 12, 2024
1 parent 1a5dbb7 commit 5849b09
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 23 deletions.
26 changes: 6 additions & 20 deletions include/mount/mount.h
Original file line number Diff line number Diff line change
Expand Up @@ -918,15 +918,15 @@ static bool game_mount(char *buffer, char *templn, char *param, char *tempstr, b

static void unmap_app_home(void)
{
// force remove "/app_home", "/app_home/PS3_GAME", "/app_home/USRDIR"
// force remove "/app_home", "/app_home/PS3_GAME"
for(u8 retry = 0; retry < 3; retry++)
{
sys_map_path("/app_home", NULL);
sys_map_path(APP_HOME_DIR, NULL);
}
}

static u8 gm = 01; // remembers last multi-game folder.
static u8 gm = 00; // remembers last multi-game folder.
// If PS3_GM01 exists, it's mapped to app_home and gm is incremented.
// if the same game is mounted again PS3_GM02 is mapped and gm is incremented again
// if PS3_GMxx doesn't exists, PS3_GAME is mapped and gm resets to 01.
Expand All @@ -935,27 +935,19 @@ void map_app_home(const char *path)
{
unmap_app_home();

sys_map_path("/app_home", path);

// remap app_home for multi-game discs
char *mpath = (char *)malloc(strlen(path) + 11);
char *mpath = (char *)malloc(strlen(path) + sizeof("/PS3_GAME") + 1);
if(mpath)
{
sprintf(mpath, "%s/PS3_GM%02i", path, gm);
if(not_exists(mpath))
{
gm = 01; sprintf(mpath, "%s/PS3_GM%02i", path, gm);
}

if(file_exists(mpath))
{
sys_map_path("/app_home/PS3_GAME", mpath); gm++;
gm = 01;
sys_map_path("/app_home", path);
}
else
{
sprintf(mpath, "%s/PS3_GAME", path);
if(file_exists(mpath))
sys_map_path("/app_home/PS3_GAME", mpath);
sys_map_path(APP_HOME_DIR, mpath); gm++;
}

free(mpath);
Expand Down Expand Up @@ -987,12 +979,6 @@ static void set_app_home(const char *game_path)
}
}

static void set_bdvd_as_app_home(void)
{
if(!(webman_config->app_home))
map_app_home("/dev_bdvd");
}

static void do_umount_iso(bool clean)
{
unsigned int real_disctype, effective_disctype, iso_disctype;
Expand Down
1 change: 0 additions & 1 deletion include/mount/mount_cobra.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ if(!cobra_version) {ret = false; goto finish;}
cobra_mount_ps3_disc_image(cobra_iso_list, iso_parts);
sys_ppu_thread_usleep(2500);
cobra_send_fake_disc_insert_event();
set_bdvd_as_app_home(); // mount (normal) PS3ISO in /app_home

{
get_name(templn, _path, GET_WMTMP);
Expand Down
1 change: 0 additions & 1 deletion include/mount/mount_net.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ if(BETWEEN('0', netid, '4'))
{
mount_unk = netiso_args.emu_mode = EMU_PS3;
if(!is_iso) sprintf(netiso_args.path, "/***PS3***%s", netpath);
set_bdvd_as_app_home(); // mount (NET) PS3ISO in /app_home
}
else if(islike(netpath, "/ROMS"))
{
Expand Down
1 change: 0 additions & 1 deletion include/mount/mount_rawiso.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ if(ntfs_ext)
{
get_name(templn, _path, GET_WMTMP);
cache_icon0_and_param_sfo(templn);
set_bdvd_as_app_home(); // mount (NTFS) PS3ISO in /app_home
#ifdef FIX_GAME
fix_game(_path, title_id, webman_config->fixgame);
#endif
Expand Down

0 comments on commit 5849b09

Please sign in to comment.