Fledge68 / WiiFlow_Lite

My mod of the Wii USB Loader WiiFlow
459 stars 58 forks source link

Assignment of categories to the game are lost when game title changes due to localization #318

Closed eku closed 1 year ago

eku commented 2 years ago

Describe the bug It looks like the categories are assigned by the title of the game instead of the game ID. If the name of the game changes, all associated cateregories disappear. To do this, it is enough to add a localized title to the plugin_data/plugin/plugin.xml for the game.

To Reproduce Steps to reproduce the behavior:

  1. Set some categories for a game
  2. Edit the entry for this game in the plugin data and add an title tag in the section for your configured locale (here "DE") with a text different from the locale "EN"
  3. Refresh the WFL cache for that plugin
  4. Open categories for that game
  5. Categories are gone

What version of WiiFlow Lite v5.5.3

On Wii or Wii U vWii Wii

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

Fledge68 commented 2 years ago

yep a known issue. using the ID is only good if we force everyone to use the plugin database files. but even then there's a small chance the game main not be found (for some reason) in the database.

Using the filename from the end of the games path might be feasible.

eku commented 2 years ago

@Fledge68 I would make the change, test it and prepare a PR. Could you give me a hint in which class file the functionality is?

eku commented 2 years ago

The categories are obviously lost when the plugin is assigned to another emulator, which is also annoying.

Fledge68 commented 1 year ago

an update on this issue: the problem is IF i make these changes your (and everyone's) categories ini will not work anymore and will have to be manually edited or recreated.


void CMenu::_getGameCategories(void)
{
    const dir_discHdr *hdr = CoverFlow.getHdr();
    /* get the domain text [TEXT] */
    switch(hdr->type)
    {
        case TYPE_CHANNEL:
            catDomain = "NAND";
            break;
        case TYPE_EMUCHANNEL:
            catDomain = "CHANNELS";
            break;
        case TYPE_HOMEBREW:
            catDomain = "HOMEBREW";
            break;
        case TYPE_GC_GAME:
            catDomain = "GAMECUBE";
            break;
        case TYPE_WII_GAME:
            catDomain = "WII";
            break;
        default:
            if(hdr->id == "PLUGIN")
                catDomain = m_plugin.PluginMagicWord;// no platform.ini - we use plugin magic
            else
                catDomain = m_platform.getString("PLUGINS", m_plugin.PluginMagicWord)// console/platform from platform.ini
    }

    /* get KEY text (before =) */
    memset(id, 0, 64);
    if(hdr->type == TYPE_HOMEBREW)
        wcstombs(id, hdr->title, sizeof(id) - 1);//we use title(folder) because no ID and filenames are all boot.dol or boot.elf
    else if(hdr->type == TYPE_PLUGIN && hdr->id == "PLUGIN")// no ID from plugin database files
    {
        if(strrchr(hdr->path, '/') != NULL)
            wcstombs(id, hdr->title, sizeof(id) - 1);// without ID we can't use database files. title is the rom filename without extension or custom title.
        else
            strcpy(id, hdr->path);// scummvm
    }
    else
        strcpy(id, hdr->id);// wii, gc, channels, and plugin games with an ID from database files

    /* get the game's categories uing the domain and key */
    const char *gameCats = m_cat.getString(catDomain, id, "").c_str();
    if(strlen(gameCats) > 0)
    {
        for(u8 j = 0; j < strlen(gameCats); ++j)
        {
            int k = (static_cast<int>(gameCats[j])) - 32;
            m_categories.at(k) = '1';
        }
    }
    else
        m_cat.remove(catDomain, id);
    m_btnMgr.setText(m_categoryLblTitle, CoverFlow.getTitle());
}`
eku commented 1 year ago

You mean, all users lose their categories or only the assignment of the games to the categories?

Is the migration of data through WFL too complicated or even impossible?