mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-04 18:45:05 +01:00
Automatically use a compatible language for games
This commit is contained in:
parent
5813ff3981
commit
83133a292b
@ -56,6 +56,7 @@
|
||||
#include "prompts/ProgressWindow.h"
|
||||
#include "neek.hpp"
|
||||
#include "lstub.h"
|
||||
#include "xml/GameTDB.hpp"
|
||||
|
||||
/* GCC 11 false positives */
|
||||
#if __GNUC__ > 10
|
||||
@ -328,6 +329,40 @@ int GameBooter::BootGame(struct discHdr *gameHdr)
|
||||
if (NandEmuMode == EMUNAND_NEEK && (gameHeader.type == TYPE_GAME_WII_IMG || gameHeader.type == TYPE_GAME_EMUNANDCHAN))
|
||||
return BootNeek(&gameHeader);
|
||||
|
||||
if (languageChoice == CONSOLE_DEFAULT)
|
||||
{
|
||||
std::string Filepath(Settings.titlestxt_path);
|
||||
if (Filepath.back() != '/')
|
||||
Filepath += '/';
|
||||
Filepath += "wiitdb.xml";
|
||||
|
||||
GameTDB XML_DB;
|
||||
if (XML_DB.OpenFile(Filepath.c_str()))
|
||||
{
|
||||
std::string gameLangs;
|
||||
if (XML_DB.GetLanguages((char *)gameHeader.id, gameLangs))
|
||||
{
|
||||
// Check if the game supports the system language (CONF_GetLanguage returns 0-9)
|
||||
std::string sysLangs[] = {"JA", "EN", "DE", "FR", "ES", "IT", "NL", "ZHCN", "ZHTW", "KO"};
|
||||
if (gameLangs.find(sysLangs[CONF_GetLanguage()]) == std::string::npos)
|
||||
{
|
||||
// Use whatever is the first supported language
|
||||
std::string lang = gameLangs.substr(0, gameLangs.find(","));
|
||||
for (u32 i = 0; i < sizeof(sysLangs) / sizeof(sysLangs[0]); i++)
|
||||
{
|
||||
if (sysLangs[i] == lang)
|
||||
{
|
||||
gprintf("Changed language to %s\n", lang.c_str());
|
||||
languageChoice = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
XML_DB.CloseFile();
|
||||
}
|
||||
}
|
||||
|
||||
AppCleanUp();
|
||||
|
||||
gprintf("\tSettings.partition: %d\n", Settings.partition);
|
||||
|
Loading…
Reference in New Issue
Block a user