Show vWii System Menu version in Menu Bar
This commit is contained in:
parent
82d20ce352
commit
88c57a00a3
|
@ -161,9 +161,12 @@ public final class MainActivity extends AppCompatActivity
|
|||
|
||||
if (WiiUtils.isSystemMenuInstalled())
|
||||
{
|
||||
int resId = WiiUtils.isSystemMenuvWii() ?
|
||||
R.string.grid_menu_load_vwii_system_menu_installed :
|
||||
R.string.grid_menu_load_wii_system_menu_installed;
|
||||
|
||||
menu.findItem(R.id.menu_load_wii_system_menu).setTitle(
|
||||
getString(R.string.grid_menu_load_wii_system_menu_installed,
|
||||
WiiUtils.getSystemMenuVersion()));
|
||||
getString(resId, WiiUtils.getSystemMenuVersion()));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -32,6 +32,8 @@ public final class WiiUtils
|
|||
|
||||
public static native boolean isSystemMenuInstalled();
|
||||
|
||||
public static native boolean isSystemMenuvWii();
|
||||
|
||||
public static native String getSystemMenuVersion();
|
||||
|
||||
public static native boolean syncSdFolderToSdImage();
|
||||
|
|
|
@ -441,6 +441,7 @@
|
|||
<string name="grid_menu_online_system_update">Perform Online System Update</string>
|
||||
<string name="grid_menu_load_wii_system_menu">Load Wii System Menu</string>
|
||||
<string name="grid_menu_load_wii_system_menu_installed">Load Wii System Menu (%s)</string>
|
||||
<string name="grid_menu_load_vwii_system_menu_installed">Load vWii System Menu (%s)</string>
|
||||
<string name="import_in_progress">Importing...</string>
|
||||
<string name="export_in_progress">Exporting...</string>
|
||||
<string name="do_not_close_app">Do not close the app!</string>
|
||||
|
|
|
@ -165,6 +165,15 @@ Java_org_dolphinemu_dolphinemu_utils_WiiUtils_isSystemMenuInstalled(JNIEnv* env,
|
|||
return tmd.IsValid();
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_utils_WiiUtils_isSystemMenuvWii(JNIEnv* env, jclass)
|
||||
{
|
||||
IOS::HLE::Kernel ios;
|
||||
const auto tmd = ios.GetES()->FindInstalledTMD(Titles::SYSTEM_MENU);
|
||||
|
||||
return tmd.IsvWii();
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_utils_WiiUtils_getSystemMenuVersion(JNIEnv* env, jclass)
|
||||
{
|
||||
|
@ -176,7 +185,7 @@ Java_org_dolphinemu_dolphinemu_utils_WiiUtils_getSystemMenuVersion(JNIEnv* env,
|
|||
return ToJString(env, "");
|
||||
}
|
||||
|
||||
return ToJString(env, DiscIO::GetSysMenuVersionString(tmd.GetTitleVersion()));
|
||||
return ToJString(env, DiscIO::GetSysMenuVersionString(tmd.GetTitleVersion(), tmd.IsvWii()));
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
|
|
|
@ -291,6 +291,11 @@ DiscIO::Region TMDReader::GetRegion() const
|
|||
return region <= DiscIO::Region::NTSC_K ? region : DiscIO::Region::Unknown;
|
||||
}
|
||||
|
||||
bool TMDReader::IsvWii() const
|
||||
{
|
||||
return *(m_bytes.data() + offsetof(TMDHeader, is_vwii));
|
||||
}
|
||||
|
||||
std::string TMDReader::GetGameID() const
|
||||
{
|
||||
char game_id[6];
|
||||
|
|
|
@ -68,6 +68,8 @@ struct TMDHeader
|
|||
u8 tmd_version;
|
||||
u8 ca_crl_version;
|
||||
u8 signer_crl_version;
|
||||
// This is usually an always 0 padding byte, which is set to 1 on vWii TMDs
|
||||
u8 is_vwii;
|
||||
u64 ios_id;
|
||||
u64 title_id;
|
||||
u32 title_flags;
|
||||
|
@ -85,6 +87,7 @@ struct TMDHeader
|
|||
u16 fill2;
|
||||
};
|
||||
static_assert(sizeof(TMDHeader) == 0x1e4, "TMDHeader has the wrong size");
|
||||
static_assert(offsetof(TMDHeader, ios_id) == 0x184);
|
||||
|
||||
struct Content
|
||||
{
|
||||
|
@ -200,6 +203,7 @@ public:
|
|||
u16 GetTitleVersion() const;
|
||||
u16 GetGroupId() const;
|
||||
DiscIO::Region GetRegion() const;
|
||||
bool IsvWii() const;
|
||||
|
||||
// Constructs a 6-character game ID in the format typically used by Dolphin.
|
||||
// If the 6-character game ID would contain unprintable characters,
|
||||
|
|
|
@ -362,7 +362,7 @@ Region GetSysMenuRegion(u16 title_version)
|
|||
}
|
||||
}
|
||||
|
||||
std::string GetSysMenuVersionString(u16 title_version)
|
||||
std::string GetSysMenuVersionString(u16 title_version, bool is_vwii)
|
||||
{
|
||||
std::string version;
|
||||
char region_letter = '\0';
|
||||
|
@ -386,6 +386,27 @@ std::string GetSysMenuVersionString(u16 title_version)
|
|||
break;
|
||||
}
|
||||
|
||||
if (is_vwii)
|
||||
{
|
||||
// For vWii return the Wii U version which installed the menu
|
||||
switch (title_version & 0xff0)
|
||||
{
|
||||
case 512:
|
||||
version = "1.0.0";
|
||||
break;
|
||||
case 544:
|
||||
version = "4.0.0";
|
||||
break;
|
||||
case 608:
|
||||
version = "5.2.0";
|
||||
break;
|
||||
default:
|
||||
version = "?.?.?";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (title_version & 0xff0)
|
||||
{
|
||||
case 32:
|
||||
|
@ -433,6 +454,7 @@ std::string GetSysMenuVersionString(u16 title_version)
|
|||
version = "?.?";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (region_letter != '\0')
|
||||
version += region_letter;
|
||||
|
|
|
@ -88,7 +88,7 @@ Country CountryCodeToCountry(u8 country_code, Platform platform, Region region =
|
|||
std::optional<u16> revision = {});
|
||||
|
||||
Region GetSysMenuRegion(u16 title_version);
|
||||
std::string GetSysMenuVersionString(u16 title_version);
|
||||
std::string GetSysMenuVersionString(u16 title_version, bool is_vwii);
|
||||
|
||||
const std::string& GetCompanyFromID(const std::string& company_id);
|
||||
} // namespace DiscIO
|
||||
|
|
|
@ -1010,10 +1010,14 @@ void MenuBar::UpdateToolsMenu(bool emulation_started)
|
|||
const auto tmd = ios.GetES()->FindInstalledTMD(Titles::SYSTEM_MENU);
|
||||
|
||||
const QString sysmenu_version =
|
||||
tmd.IsValid() ?
|
||||
QString::fromStdString(DiscIO::GetSysMenuVersionString(tmd.GetTitleVersion())) :
|
||||
tmd.IsValid() ? QString::fromStdString(
|
||||
DiscIO::GetSysMenuVersionString(tmd.GetTitleVersion(), tmd.IsvWii())) :
|
||||
QString{};
|
||||
m_boot_sysmenu->setText(tr("Load Wii System Menu %1").arg(sysmenu_version));
|
||||
|
||||
const QString sysmenu_text = (tmd.IsValid() && tmd.IsvWii()) ? tr("Load vWii System Menu %1") :
|
||||
tr("Load Wii System Menu %1");
|
||||
|
||||
m_boot_sysmenu->setText(sysmenu_text.arg(sysmenu_version));
|
||||
|
||||
m_boot_sysmenu->setEnabled(tmd.IsValid());
|
||||
|
||||
|
|
Loading…
Reference in New Issue