Skip to content

Commit

Permalink
Merge pull request #6567 from JosJuice/discio-enums-case
Browse files Browse the repository at this point in the history
DiscIO: Don't use all uppercase for enum values
  • Loading branch information
leoetlino committed Mar 31, 2018
2 parents 127c2ce + 4387432 commit 3296221
Show file tree
Hide file tree
Showing 22 changed files with 254 additions and 267 deletions.
18 changes: 9 additions & 9 deletions Source/Android/jni/MainAndroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,13 @@ static int GetPlatform(std::string filename)
{
switch (pVolume->GetVolumeType())
{
case DiscIO::Platform::GAMECUBE_DISC:
case DiscIO::Platform::GameCubeDisc:
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Volume is a GameCube disc.");
return 0;
case DiscIO::Platform::WII_DISC:
case DiscIO::Platform::WiiDisc:
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Volume is a Wii disc.");
return 1;
case DiscIO::Platform::WII_WAD:
case DiscIO::Platform::WiiWAD:
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Volume is a Wii WAD.");
return 2;
}
Expand All @@ -282,7 +282,7 @@ static std::string GetTitle(std::string filename)
titles = pVolume->GetShortNames();

/*
bool is_wii_title = pVolume->GetVolumeType() != DiscIO::Platform::GAMECUBE_DISC;
const bool is_wii_title = DiscIO::IsWii(pVolume->GetVolumeType());
DiscIO::Language language = SConfig::GetInstance().GetCurrentLanguage(is_wii_title);
auto it = titles.find(language);
Expand All @@ -292,8 +292,8 @@ static std::string GetTitle(std::string filename)
auto end = titles.end();

// English tends to be a good fallback when the requested language isn't available
// if (language != DiscIO::Language::LANGUAGE_ENGLISH) {
auto it = titles.find(DiscIO::Language::LANGUAGE_ENGLISH);
// if (language != DiscIO::Language::English) {
auto it = titles.find(DiscIO::Language::English);
if (it != end)
return it->second;
//}
Expand Down Expand Up @@ -323,7 +323,7 @@ static std::string GetDescription(std::string filename)
std::map<DiscIO::Language, std::string> descriptions = volume->GetDescriptions();

/*
bool is_wii_title = pVolume->GetVolumeType() != DiscIO::Platform::GAMECUBE_DISC;
const bool is_wii_title = DiscIO::IsWii(pVolume->GetVolumeType());
DiscIO::Language language = SConfig::GetInstance().GetCurrentLanguage(is_wii_title);
auto it = descriptions.find(language);
Expand All @@ -333,8 +333,8 @@ static std::string GetDescription(std::string filename)
auto end = descriptions.end();

// English tends to be a good fallback when the requested language isn't available
// if (language != DiscIO::Language::LANGUAGE_ENGLISH) {
auto it = descriptions.find(DiscIO::Language::LANGUAGE_ENGLISH);
// if (language != DiscIO::Language::English) {
auto it = descriptions.find(DiscIO::Language::English);
if (it != end)
return it->second;
//}
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/Boot/Boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,12 @@ bool CBoot::Load_BS2(const std::string& boot_rom_filename)
break;
default:
PanicAlertT("IPL with unknown hash %x", ipl_hash);
ipl_region = DiscIO::Region::UNKNOWN_REGION;
ipl_region = DiscIO::Region::Unknown;
break;
}

const DiscIO::Region boot_region = SConfig::GetInstance().m_region;
if (ipl_region != DiscIO::Region::UNKNOWN_REGION && boot_region != ipl_region)
if (ipl_region != DiscIO::Region::Unknown && boot_region != ipl_region)
PanicAlertT("%s IPL found in %s directory. The disc might not be recognized",
SConfig::GetDirectoryForRegion(ipl_region),
SConfig::GetDirectoryForRegion(boot_region));
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Boot/Boot_BS2Emu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ static void WriteEmptyPlayRecord()
bool CBoot::EmulatedBS2_Wii(const DiscIO::Volume& volume)
{
INFO_LOG(BOOT, "Faking Wii BS2...");
if (volume.GetVolumeType() != DiscIO::Platform::WII_DISC)
if (volume.GetVolumeType() != DiscIO::Platform::WiiDisc)
return false;

const DiscIO::Partition partition = volume.GetGamePartition();
Expand Down
13 changes: 6 additions & 7 deletions Source/Core/Core/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ struct SetGameMetadata
bool operator()(const BootParameters::Disc& disc) const
{
config->SetRunningGameMetadata(*disc.volume, disc.volume->GetGamePartition());
config->bWii = disc.volume->GetVolumeType() == DiscIO::Platform::WII_DISC;
config->bWii = disc.volume->GetVolumeType() == DiscIO::Platform::WiiDisc;
config->m_disc_booted_from_game_list = true;
*region = disc.volume->GetRegion();
return true;
Expand All @@ -901,7 +901,7 @@ struct SetGameMetadata

config->bWii = executable.reader->IsWii();

*region = DiscIO::Region::UNKNOWN_REGION;
*region = DiscIO::Region::Unknown;

// Strip the .elf/.dol file extension and directories before the name
SplitPath(executable.path, nullptr, &config->m_debugger_game_id, nullptr);
Expand Down Expand Up @@ -974,7 +974,7 @@ bool SConfig::SetPathsAndGameMetadata(const BootParameters& boot)
return false;

// Fall back to the system menu region, if possible.
if (m_region == DiscIO::Region::UNKNOWN_REGION)
if (m_region == DiscIO::Region::Unknown)
{
IOS::HLE::Kernel ios;
const IOS::ES::TMDReader system_menu_tmd = ios.GetES()->FindInstalledTMD(Titles::SYSTEM_MENU);
Expand All @@ -983,7 +983,7 @@ bool SConfig::SetPathsAndGameMetadata(const BootParameters& boot)
}

// Fall back to PAL.
if (m_region == DiscIO::Region::UNKNOWN_REGION)
if (m_region == DiscIO::Region::Unknown)
m_region = DiscIO::Region::PAL;

// Set up paths
Expand Down Expand Up @@ -1054,9 +1054,8 @@ DiscIO::Language SConfig::GetCurrentLanguage(bool wii) const
DiscIO::Language language = static_cast<DiscIO::Language>(language_value);

// Get rid of invalid values (probably doesn't matter, but might as well do it)
if (language > DiscIO::Language::LANGUAGE_UNKNOWN ||
language < DiscIO::Language::LANGUAGE_JAPANESE)
language = DiscIO::Language::LANGUAGE_UNKNOWN;
if (language > DiscIO::Language::Unknown || language < DiscIO::Language::Japanese)
language = DiscIO::Language::Unknown;
return language;
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/HW/DVD/DVDInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@ void ScheduleReads(u64 offset, u32 length, const DiscIO::Partition& partition, u

const u64 current_time = CoreTiming::GetTicks();
const u32 ticks_per_second = SystemTimers::GetTicksPerSecond();
const bool wii_disc = DVDThread::GetDiscType() == DiscIO::Platform::WII_DISC;
const bool wii_disc = DVDThread::GetDiscType() == DiscIO::Platform::WiiDisc;

// Where the DVD read head is (usually parked at the end of the buffer,
// unless we've interrupted it mid-buffer-read).
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/IOS/ES/Formats.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class TMDReader final : public SignedBlobReader
u16 GetTitleVersion() const;
u16 GetGroupId() const;

// Provides a best guess for the region. Might be inaccurate or UNKNOWN_REGION.
// Provides a best guess for the region. Might be inaccurate or Region::Unknown.
DiscIO::Region GetRegion() const;

// Constructs a 6-character game ID in the format typically used by Dolphin.
Expand Down
24 changes: 12 additions & 12 deletions Source/Core/Core/TitleDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,25 @@ static std::string GetLanguageCode(DiscIO::Language language)
{
switch (language)
{
case DiscIO::Language::LANGUAGE_JAPANESE:
case DiscIO::Language::Japanese:
return "ja";
case DiscIO::Language::LANGUAGE_ENGLISH:
case DiscIO::Language::English:
return "en";
case DiscIO::Language::LANGUAGE_GERMAN:
case DiscIO::Language::German:
return "de";
case DiscIO::Language::LANGUAGE_FRENCH:
case DiscIO::Language::French:
return "fr";
case DiscIO::Language::LANGUAGE_SPANISH:
case DiscIO::Language::Spanish:
return "es";
case DiscIO::Language::LANGUAGE_ITALIAN:
case DiscIO::Language::Italian:
return "it";
case DiscIO::Language::LANGUAGE_DUTCH:
case DiscIO::Language::Dutch:
return "nl";
case DiscIO::Language::LANGUAGE_SIMPLIFIED_CHINESE:
case DiscIO::Language::SimplifiedChinese:
return "zh_CN";
case DiscIO::Language::LANGUAGE_TRADITIONAL_CHINESE:
case DiscIO::Language::TraditionalChinese:
return "zh_TW";
case DiscIO::Language::LANGUAGE_KOREAN:
case DiscIO::Language::Korean:
return "ko";
default:
return "en";
Expand Down Expand Up @@ -95,12 +95,12 @@ static bool IsWiiTitle(const std::string& game_id)

static bool IsJapaneseGCTitle(const std::string& game_id)
{
return IsGCTitle(game_id) && DiscIO::CountrySwitch(game_id[3]) == DiscIO::Country::COUNTRY_JAPAN;
return IsGCTitle(game_id) && DiscIO::CountrySwitch(game_id[3]) == DiscIO::Country::Japan;
}

static bool IsNonJapaneseGCTitle(const std::string& game_id)
{
return IsGCTitle(game_id) && DiscIO::CountrySwitch(game_id[3]) != DiscIO::Country::COUNTRY_JAPAN;
return IsGCTitle(game_id) && DiscIO::CountrySwitch(game_id[3]) != DiscIO::Country::Japan;
}

// Note that this function will not overwrite entries that already are in the maps
Expand Down
11 changes: 5 additions & 6 deletions Source/Core/Core/WiiUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,11 @@ std::string SystemUpdater::GetDeviceRegion()
if (tmd.IsValid())
{
const DiscIO::Region region = tmd.GetRegion();
static const std::map<DiscIO::Region, std::string> regions = {
{DiscIO::Region::NTSC_J, "JPN"},
{DiscIO::Region::NTSC_U, "USA"},
{DiscIO::Region::PAL, "EUR"},
{DiscIO::Region::NTSC_K, "KOR"},
{DiscIO::Region::UNKNOWN_REGION, "EUR"}};
static const std::map<DiscIO::Region, std::string> regions = {{DiscIO::Region::NTSC_J, "JPN"},
{DiscIO::Region::NTSC_U, "USA"},
{DiscIO::Region::PAL, "EUR"},
{DiscIO::Region::NTSC_K, "KOR"},
{DiscIO::Region::Unknown, "EUR"}};
return regions.at(region);
}
return "";
Expand Down
14 changes: 7 additions & 7 deletions Source/Core/DiscIO/DiscExtractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ void ExportDirectory(const Volume& volume, const Partition& partition, const Fil

bool ExportWiiUnencryptedHeader(const Volume& volume, const std::string& export_filename)
{
if (volume.GetVolumeType() != Platform::WII_DISC)
if (volume.GetVolumeType() != Platform::WiiDisc)
return false;

return ExportData(volume, PARTITION_NONE, 0, 0x100, export_filename);
}

bool ExportWiiRegionData(const Volume& volume, const std::string& export_filename)
{
if (volume.GetVolumeType() != Platform::WII_DISC)
if (volume.GetVolumeType() != Platform::WiiDisc)
return false;

return ExportData(volume, PARTITION_NONE, 0x4E000, 0x20, export_filename);
Expand All @@ -170,15 +170,15 @@ bool ExportWiiRegionData(const Volume& volume, const std::string& export_filenam
bool ExportTicket(const Volume& volume, const Partition& partition,
const std::string& export_filename)
{
if (volume.GetVolumeType() != Platform::WII_DISC)
if (volume.GetVolumeType() != Platform::WiiDisc)
return false;

return ExportData(volume, PARTITION_NONE, partition.offset, 0x2a4, export_filename);
}

bool ExportTMD(const Volume& volume, const Partition& partition, const std::string& export_filename)
{
if (volume.GetVolumeType() != Platform::WII_DISC)
if (volume.GetVolumeType() != Platform::WiiDisc)
return false;

const std::optional<u32> size = volume.ReadSwapped<u32>(partition.offset + 0x2a4, PARTITION_NONE);
Expand All @@ -193,7 +193,7 @@ bool ExportTMD(const Volume& volume, const Partition& partition, const std::stri
bool ExportCertificateChain(const Volume& volume, const Partition& partition,
const std::string& export_filename)
{
if (volume.GetVolumeType() != Platform::WII_DISC)
if (volume.GetVolumeType() != Platform::WiiDisc)
return false;

const std::optional<u32> size = volume.ReadSwapped<u32>(partition.offset + 0x2ac, PARTITION_NONE);
Expand All @@ -208,7 +208,7 @@ bool ExportCertificateChain(const Volume& volume, const Partition& partition,
bool ExportH3Hashes(const Volume& volume, const Partition& partition,
const std::string& export_filename)
{
if (volume.GetVolumeType() != Platform::WII_DISC)
if (volume.GetVolumeType() != Platform::WiiDisc)
return false;

const std::optional<u64> offset =
Expand Down Expand Up @@ -351,7 +351,7 @@ bool ExportSystemData(const Volume& volume, const Partition& partition,
success &= ExportDOL(volume, partition, export_folder + "/sys/main.dol");
success &= ExportFST(volume, partition, export_folder + "/sys/fst.bin");

if (volume.GetVolumeType() == Platform::WII_DISC)
if (volume.GetVolumeType() == Platform::WiiDisc)
{
File::CreateFullPath(export_folder + "/disc/");
success &= ExportWiiUnencryptedHeader(volume, export_folder + "/disc/header.bin");
Expand Down

0 comments on commit 3296221

Please sign in to comment.