Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move DiscIO enums to a new file #3983

Merged
merged 1 commit into from
Jul 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 16 additions & 16 deletions Source/Android/jni/MainAndroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "Core/PowerPC/Profiler.h"
#include "Core/State.h"

#include "DiscIO/Enums.h"
#include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h"

Expand Down Expand Up @@ -226,15 +227,14 @@ static int GetCountry(std::string filename)

if (pVolume != nullptr)
{
DiscIO::IVolume::ECountry country = pVolume->GetCountry();
int country = static_cast<int>(pVolume->GetCountry());

__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Country Code: %i", country);

return country;
}

// Return UNKNOWN
return 13;
return static_cast<int>(DiscIO::Country::COUNTRY_UNKNOWN);
}

static int GetPlatform(std::string filename)
Expand All @@ -245,13 +245,13 @@ static int GetPlatform(std::string filename)
{
switch (pVolume->GetVolumeType())
{
case DiscIO::IVolume::GAMECUBE_DISC:
case DiscIO::Platform::GAMECUBE_DISC:
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Volume is a GameCube disc.");
return 0;
case DiscIO::IVolume::WII_DISC:
case DiscIO::Platform::WII_DISC:
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Volume is a Wii disc.");
return 1;
case DiscIO::IVolume::WII_WAD:
case DiscIO::Platform::WII_WAD:
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Volume is a Wii WAD.");
return 2;
}
Expand All @@ -269,13 +269,13 @@ static std::string GetTitle(std::string filename)

if (pVolume != nullptr)
{
std::map<DiscIO::IVolume::ELanguage, std::string> titles = pVolume->GetLongNames();
std::map<DiscIO::Language, std::string> titles = pVolume->GetLongNames();
if (titles.empty())
titles = pVolume->GetShortNames();

/*
bool is_wii_title = pVolume->GetVolumeType() != DiscIO::IVolume::GAMECUBE_DISC;
DiscIO::IVolume::ELanguage language = SConfig::GetInstance().GetCurrentLanguage(is_wii_title);
bool is_wii_title = pVolume->GetVolumeType() != DiscIO::Platform::GAMECUBE_DISC;
DiscIO::Language language = SConfig::GetInstance().GetCurrentLanguage(is_wii_title);

auto it = titles.find(language);
if (it != end)
Expand All @@ -284,8 +284,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::IVolume::ELanguage::LANGUAGE_ENGLISH) {
auto it = titles.find(DiscIO::IVolume::ELanguage::LANGUAGE_ENGLISH);
// if (language != DiscIO::Language::LANGUAGE_ENGLISH) {
auto it = titles.find(DiscIO::Language::LANGUAGE_ENGLISH);
if (it != end)
return it->second;
//}
Expand All @@ -312,11 +312,11 @@ static std::string GetDescription(std::string filename)

if (volume != nullptr)
{
std::map<DiscIO::IVolume::ELanguage, std::string> descriptions = volume->GetDescriptions();
std::map<DiscIO::Language, std::string> descriptions = volume->GetDescriptions();

/*
bool is_wii_title = pVolume->GetVolumeType() != DiscIO::IVolume::GAMECUBE_DISC;
DiscIO::IVolume::ELanguage language = SConfig::GetInstance().GetCurrentLanguage(is_wii_title);
bool is_wii_title = pVolume->GetVolumeType() != DiscIO::Platform::GAMECUBE_DISC;
DiscIO::Language language = SConfig::GetInstance().GetCurrentLanguage(is_wii_title);

auto it = descriptions.find(language);
if (it != end)
Expand All @@ -325,8 +325,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::IVolume::ELanguage::LANGUAGE_ENGLISH) {
auto it = descriptions.find(DiscIO::IVolume::ELanguage::LANGUAGE_ENGLISH);
// if (language != DiscIO::Language::LANGUAGE_ENGLISH) {
auto it = descriptions.find(DiscIO::Language::LANGUAGE_ENGLISH);
if (it != end)
return it->second;
//}
Expand Down
10 changes: 6 additions & 4 deletions Source/Core/Core/Boot/Boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
#include "Core/PowerPC/PowerPC.h"
#include "Core/PowerPC/SignatureDB.h"

#include "DiscIO/Enums.h"
#include "DiscIO/NANDContentLoader.h"
#include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h"

bool CBoot::DVDRead(u64 dvd_offset, u32 output_address, u32 length, bool decrypt)
Expand Down Expand Up @@ -263,7 +265,7 @@ bool CBoot::BootUp()

const DiscIO::IVolume& pVolume = DVDInterface::GetVolume();

if ((pVolume.GetVolumeType() == DiscIO::IVolume::WII_DISC) != _StartupPara.bWii)
if ((pVolume.GetVolumeType() == DiscIO::Platform::WII_DISC) != _StartupPara.bWii)
{
PanicAlertT("Warning - starting ISO in wrong console mode!");
}
Expand All @@ -278,7 +280,7 @@ bool CBoot::BootUp()
WII_IPC_HLE_Interface::ES_DIVerify(tmd_buffer);
}

_StartupPara.bWii = pVolume.GetVolumeType() == DiscIO::IVolume::WII_DISC;
_StartupPara.bWii = pVolume.GetVolumeType() == DiscIO::Platform::WII_DISC;

// HLE BS2 or not
if (_StartupPara.bHLE_BS2)
Expand Down Expand Up @@ -338,7 +340,7 @@ bool CBoot::BootUp()
BS2Success = EmulatedBS2(dolWii);
}
else if ((!DVDInterface::VolumeIsValid() ||
DVDInterface::GetVolume().GetVolumeType() != DiscIO::IVolume::WII_DISC) &&
DVDInterface::GetVolume().GetVolumeType() != DiscIO::Platform::WII_DISC) &&
!_StartupPara.m_strDefaultISO.empty())
{
DVDInterface::SetVolumeName(_StartupPara.m_strDefaultISO);
Expand Down Expand Up @@ -409,7 +411,7 @@ bool CBoot::BootUp()

// Poor man's bootup
if (_StartupPara.bWii)
SetupWiiMemory(DiscIO::IVolume::COUNTRY_UNKNOWN);
SetupWiiMemory(DiscIO::Country::COUNTRY_UNKNOWN);
else
EmulatedBS2_GC(true);

Expand Down
7 changes: 5 additions & 2 deletions Source/Core/Core/Boot/Boot.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
#include <cstdlib>
#include <string>

#include "DiscIO/Volume.h"
namespace DiscIO
{
enum class Country;
}

struct CountrySetting
{
Expand Down Expand Up @@ -54,5 +57,5 @@ class CBoot
static bool Load_BS2(const std::string& _rBootROMFilename);
static void Load_FST(bool _bIsWii);

static bool SetupWiiMemory(DiscIO::IVolume::ECountry country);
static bool SetupWiiMemory(DiscIO::Country country);
};
21 changes: 12 additions & 9 deletions Source/Core/Core/Boot/Boot_BS2Emu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#include "Core/PatchEngine.h"
#include "Core/PowerPC/PowerPC.h"

#include "DiscIO/Enums.h"
#include "DiscIO/Volume.h"

void CBoot::RunFunction(u32 _iAddr)
{
PC = _iAddr;
Expand Down Expand Up @@ -178,21 +181,21 @@ bool CBoot::EmulatedBS2_GC(bool skipAppLoader)
return true;
}

bool CBoot::SetupWiiMemory(DiscIO::IVolume::ECountry country)
bool CBoot::SetupWiiMemory(DiscIO::Country country)
{
static const CountrySetting SETTING_EUROPE = {"EUR", "PAL", "EU", "LE"};
static const CountrySetting SETTING_USA = {"USA", "NTSC", "US", "LU"};
static const CountrySetting SETTING_JAPAN = {"JPN", "NTSC", "JP", "LJ"};
static const CountrySetting SETTING_KOREA = {"KOR", "NTSC", "KR", "LKH"};
static const std::map<DiscIO::IVolume::ECountry, const CountrySetting> country_settings = {
{DiscIO::IVolume::COUNTRY_EUROPE, SETTING_EUROPE},
{DiscIO::IVolume::COUNTRY_USA, SETTING_USA},
{DiscIO::IVolume::COUNTRY_JAPAN, SETTING_JAPAN},
{DiscIO::IVolume::COUNTRY_KOREA, SETTING_KOREA},
static const std::map<DiscIO::Country, const CountrySetting> country_settings = {
{DiscIO::Country::COUNTRY_EUROPE, SETTING_EUROPE},
{DiscIO::Country::COUNTRY_USA, SETTING_USA},
{DiscIO::Country::COUNTRY_JAPAN, SETTING_JAPAN},
{DiscIO::Country::COUNTRY_KOREA, SETTING_KOREA},
// TODO: Determine if Taiwan have their own specific settings.
// Also determine if there are other specific settings
// for other countries.
{DiscIO::IVolume::COUNTRY_TAIWAN, SETTING_JAPAN}};
{DiscIO::Country::COUNTRY_TAIWAN, SETTING_JAPAN}};
auto entryPos = country_settings.find(country);
const CountrySetting& country_setting =
(entryPos != country_settings.end()) ?
Expand Down Expand Up @@ -333,7 +336,7 @@ bool CBoot::EmulatedBS2_Wii()
INFO_LOG(BOOT, "Faking Wii BS2...");

// Setup Wii memory
DiscIO::IVolume::ECountry country_code = DiscIO::IVolume::COUNTRY_UNKNOWN;
DiscIO::Country country_code = DiscIO::Country::COUNTRY_UNKNOWN;
if (DVDInterface::VolumeIsValid())
country_code = DVDInterface::GetVolume().GetCountry();
if (SetupWiiMemory(country_code) == false)
Expand All @@ -342,7 +345,7 @@ bool CBoot::EmulatedBS2_Wii()
// Execute the apploader
bool apploaderRan = false;
if (DVDInterface::VolumeIsValid() &&
DVDInterface::GetVolume().GetVolumeType() == DiscIO::IVolume::WII_DISC)
DVDInterface::GetVolume().GetVolumeType() == DiscIO::Platform::WII_DISC)
{
// This is some kind of consistency check that is compared to the 0x00
// values as the game boots. This location keeps the 4 byte ID for as long
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/Boot/Boot_ELF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <memory>

#include "Common/CommonFuncs.h"
#include "Common/FileUtil.h"
#include "Core/Boot/Boot.h"
#include "Core/Boot/ElfReader.h"
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/Core/Boot/Boot_WiiWAD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "Core/PatchEngine.h"
#include "Core/PowerPC/PowerPC.h"

#include "DiscIO/Enums.h"
#include "DiscIO/NANDContentLoader.h"
#include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h"
Expand Down Expand Up @@ -92,7 +93,7 @@ bool CBoot::Boot_WiiWAD(const std::string& _pFilename)
if (!SetupWiiMemory(ContentLoader.GetCountry()))
return false;
// this sets a bit that is used to detect NTSC-J
if (ContentLoader.GetCountry() == DiscIO::IVolume::COUNTRY_JAPAN)
if (ContentLoader.GetCountry() == DiscIO::Country::COUNTRY_JAPAN)
{
VideoInterface::SetRegionReg('J');
}
Expand Down
48 changes: 26 additions & 22 deletions Source/Core/Core/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
#include "Core/HW/SI.h"
#include "Core/PowerPC/PowerPC.h"

#include "DiscIO/Enums.h"
#include "DiscIO/NANDContentLoader.h"
#include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h"

SConfig* SConfig::m_Instance;
Expand Down Expand Up @@ -672,31 +674,31 @@ void SConfig::LoadDefaults()
m_revision = 0;
}

static const char* GetRegionOfCountry(DiscIO::IVolume::ECountry country)
static const char* GetRegionOfCountry(DiscIO::Country country)
{
switch (country)
{
case DiscIO::IVolume::COUNTRY_USA:
case DiscIO::Country::COUNTRY_USA:
return USA_DIR;

case DiscIO::IVolume::COUNTRY_TAIWAN:
case DiscIO::IVolume::COUNTRY_KOREA:
case DiscIO::Country::COUNTRY_TAIWAN:
case DiscIO::Country::COUNTRY_KOREA:
// TODO: Should these have their own Region Dir?
case DiscIO::IVolume::COUNTRY_JAPAN:
case DiscIO::Country::COUNTRY_JAPAN:
return JAP_DIR;

case DiscIO::IVolume::COUNTRY_AUSTRALIA:
case DiscIO::IVolume::COUNTRY_EUROPE:
case DiscIO::IVolume::COUNTRY_FRANCE:
case DiscIO::IVolume::COUNTRY_GERMANY:
case DiscIO::IVolume::COUNTRY_ITALY:
case DiscIO::IVolume::COUNTRY_NETHERLANDS:
case DiscIO::IVolume::COUNTRY_RUSSIA:
case DiscIO::IVolume::COUNTRY_SPAIN:
case DiscIO::IVolume::COUNTRY_WORLD:
case DiscIO::Country::COUNTRY_AUSTRALIA:
case DiscIO::Country::COUNTRY_EUROPE:
case DiscIO::Country::COUNTRY_FRANCE:
case DiscIO::Country::COUNTRY_GERMANY:
case DiscIO::Country::COUNTRY_ITALY:
case DiscIO::Country::COUNTRY_NETHERLANDS:
case DiscIO::Country::COUNTRY_RUSSIA:
case DiscIO::Country::COUNTRY_SPAIN:
case DiscIO::Country::COUNTRY_WORLD:
return EUR_DIR;

case DiscIO::IVolume::COUNTRY_UNKNOWN:
case DiscIO::Country::COUNTRY_UNKNOWN:
default:
return nullptr;
}
Expand Down Expand Up @@ -745,7 +747,7 @@ bool SConfig::AutoSetup(EBootBS2 _BootBS2)
m_revision = pVolume->GetRevision();

// Check if we have a Wii disc
bWii = pVolume->GetVolumeType() == DiscIO::IVolume::WII_DISC;
bWii = pVolume->GetVolumeType() == DiscIO::Platform::WII_DISC;

const char* retrieved_region_dir = GetRegionOfCountry(pVolume->GetCountry());
if (!retrieved_region_dir)
Expand Down Expand Up @@ -947,17 +949,19 @@ void SConfig::CheckMemcardPath(std::string& memcardPath, const std::string& game
}
}

DiscIO::IVolume::ELanguage SConfig::GetCurrentLanguage(bool wii) const
DiscIO::Language SConfig::GetCurrentLanguage(bool wii) const
{
DiscIO::IVolume::ELanguage language;
int language_value;
if (wii)
language = (DiscIO::IVolume::ELanguage)SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG");
language_value = SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG");
else
language = (DiscIO::IVolume::ELanguage)(SConfig::GetInstance().SelectedLanguage + 1);
language_value = SConfig::GetInstance().SelectedLanguage + 1;
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::IVolume::ELanguage::LANGUAGE_UNKNOWN || language < 0)
language = DiscIO::IVolume::ELanguage::LANGUAGE_UNKNOWN;
if (language > DiscIO::Language::LANGUAGE_UNKNOWN ||
language < DiscIO::Language::LANGUAGE_JAPANESE)
language = DiscIO::Language::LANGUAGE_UNKNOWN;
return language;
}

Expand Down
8 changes: 6 additions & 2 deletions Source/Core/Core/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
#include "Common/SysConf.h"
#include "Core/HW/EXI_Device.h"
#include "Core/HW/SI_Device.h"
#include "DiscIO/Volume.h"

namespace DiscIO
{
enum class Language;
}

// DSP Backend Types
#define BACKEND_NULLSOUND _trans("No audio output")
Expand Down Expand Up @@ -177,7 +181,7 @@ struct SConfig : NonCopyable
bool AutoSetup(EBootBS2 _BootBS2);
const std::string& GetUniqueID() const { return m_strUniqueID; }
void CheckMemcardPath(std::string& memcardPath, const std::string& gameRegion, bool isSlotA);
DiscIO::IVolume::ELanguage GetCurrentLanguage(bool wii) const;
DiscIO::Language GetCurrentLanguage(bool wii) const;

IniFile LoadDefaultGameIni() const;
IniFile LoadLocalGameIni() const;
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/Core/HW/DVDInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "Core/IPC_HLE/WII_IPC_HLE_Device_DI.h"
#include "Core/Movie.h"

#include "DiscIO/Enums.h"
#include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h"

Expand Down Expand Up @@ -1417,7 +1418,7 @@ s64 CalculateRawDiscReadTime(u64 offset, s64 length)
// Note that the speed at a track (in bytes per second) is the same as
// the radius of that track because of the length unit used.
double speed;
if (s_inserted_volume->GetVolumeType() == DiscIO::IVolume::WII_DISC)
if (s_inserted_volume->GetVolumeType() == DiscIO::Platform::WII_DISC)
{
speed = std::sqrt(((average_offset - WII_DISC_LOCATION_1_OFFSET) / WII_BYTES_PER_AREA_UNIT +
WII_DISC_AREA_UP_TO_LOCATION_1) /
Expand Down