aldostools / webMAN-MOD

Extended services for PS3 console (web server, ftp server, netiso, ntfs, ps3mapi, etc.)
https://aldostools.github.io/webMAN-MOD/
GNU General Public License v3.0
1.3k stars 176 forks source link

fix multi-game disc support for /app_home #1075

Closed bibarub closed 4 months ago

bibarub commented 4 months ago

set_bdvd_as_app_home() was removed because it's redundant (check line 1748)

aldostools commented 4 months ago

I think line 929 should be changed back to static u8 gm = 01;

So PS3_GM01 will be always the first folder mounted and PS3_GAME will be the last.

Your current code will mount PS3_GAME only for the first game. After that all games will follow the behavior described above.

aldostools commented 4 months ago

Or maybe this code:


void map_app_home(const char *path)
{
    unmap_app_home();

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

            sprintf(mpath, "%s/PS3_GM01", path);
            gm = isDir(mpath) ? 01 : 00; // reset gm to 00 if the game is not a multi-game disc
        }
        else
        {
            sys_map_path(APP_HOME_DIR, mpath); gm++;
        }

        free(mpath);
    }
}
bibarub commented 4 months ago

I think line 929 should be changed back to static u8 gm = 01;

So PS3_GM01 will be always the first folder mounted and PS3_GAME will be the last.

Your current code will mount PS3_GAME only for the first game. After that all games will follow the behavior described above.

PS3_GAME -> PS3_GM01 -> PS3_GM.. is the order the XMB uses for multi-game discs, so i don't think it should be changed my code does exactly that - it mounts PS3_GAME first, then cycles through GM folders, until it runs out of them, and then mounts PS3_GAME again

(correct me if i'm wrong, i'm new to C)

aldostools commented 4 months ago

Yes your code does it right for the first game. After that the variable gm never return to 00. So when a new game is mounted, the variable gm return to 01 (for non multi-game discs or mounts the next folder in the cycle if the new game is also a multi-game disc).

The code above fixes this behavior, except when the new game is also a multi-game disc.

bibarub commented 4 months ago

why should it return to 0? if GMXX doesn't exist, it will simply follow the "if(not_exists(mpath))" condition and mount /app_home to /dev_bdvd. adding another check just creates redundancy imo

bibarub commented 4 months ago

oh, i think i finally understand what you mean