Display nicer version strings for the Wii Menu

The Tools > Load System Menu option displays the version of the
installed Wii Menu. This commit changes the way we display that
version, like so: "Load System Menu 514P" -> "Load System Menu 4.3E"

The numbers are from http://wiibrew.org/wiki/System_Menu
This commit is contained in:
JosJuice 2017-03-17 21:01:50 +01:00
parent 47fe78a76a
commit 19d6092847
3 changed files with 62 additions and 4 deletions

View File

@ -141,6 +141,62 @@ u8 GetSysMenuRegion(u16 title_version)
}
}
std::string GetSysMenuVersionString(u16 title_version)
{
if (title_version == 33)
return "1.0"; // 1.0 uses 33 as the version number in all regions
std::string region_letter;
switch (GetSysMenuRegion(title_version))
{
case 'J':
region_letter = "J";
break;
case 'E':
region_letter = "U";
break;
case 'P':
region_letter = "E";
break;
case 'K':
region_letter = "K";
break;
}
switch (title_version & ~0xf)
{
case 96:
case 128:
return "2.0" + region_letter;
case 160:
return "2.1" + region_letter;
case 192:
return "2.2" + region_letter;
case 224:
return "3.0" + region_letter;
case 256:
return "3.1" + region_letter;
case 288:
return "3.2" + region_letter;
case 320:
case 352:
return "3.3" + region_letter;
case 384:
return (region_letter != "K" ? "3.4" : "3.5") + region_letter;
case 416:
return "4.0" + region_letter;
case 448:
return "4.1" + region_letter;
case 480:
return "4.2" + region_letter;
case 512:
return "4.3" + region_letter;
default:
return "?.?" + region_letter;
}
}
std::string GetCompanyFromID(const std::string& company_id)
{
static const std::map<std::string, std::string> companies = {

View File

@ -4,6 +4,8 @@
#pragma once
#include <string>
#include "Common/CommonTypes.h"
namespace DiscIO
@ -71,5 +73,6 @@ Region RegionSwitchGC(u8 country_code);
Region RegionSwitchWii(u8 country_code);
Country CountrySwitch(u8 country_code);
u8 GetSysMenuRegion(u16 title_version);
std::string GetSysMenuVersionString(u16 title_version);
std::string GetCompanyFromID(const std::string& company_id);
}

View File

@ -545,11 +545,10 @@ void MainMenuBar::RefreshWiiSystemMenuLabel() const
if (sys_menu_loader.IsValid())
{
const u16 sys_menu_version = sys_menu_loader.GetTMD().GetTitleVersion();
const char sys_menu_region = DiscIO::GetSysMenuRegion(sys_menu_version);
const u16 version_number = sys_menu_loader.GetTMD().GetTitleVersion();
const wxString version_string = StrToWxStr(DiscIO::GetSysMenuVersionString(version_number));
item->Enable();
item->SetItemLabel(
wxString::Format(_("Load Wii System Menu %u%c"), sys_menu_version, sys_menu_region));
item->SetItemLabel(wxString::Format(_("Load Wii System Menu %s"), version_string));
}
else
{