Move DiscIO enums to a new file

At first there weren't many enums in Volume.h, but the number has been
growing, and I'm planning to add one more for regions. To not make
Volume.h too large, and to avoid needing to include Volume.h in code
that doesn't use volume objects, I'm moving the enums to a new file.
I'm also turning them into enum classes while I'm at it.
This commit is contained in:
JosJuice
2016-07-13 17:29:27 +02:00
parent baf9abe911
commit 0a15aaaa12
49 changed files with 665 additions and 574 deletions
+16 -16
View File
@@ -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"
@@ -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)
@@ -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;
}
@@ -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)
@@ -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;
//}
@@ -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)
@@ -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;
//}
+6 -4
View File
@@ -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)
@@ -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!");
}
@@ -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)
@@ -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);
@@ -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);
+5 -2
View File
@@ -7,7 +7,10 @@
#include <cstdlib>
#include <string>
#include "DiscIO/Volume.h"
namespace DiscIO
{
enum class Country;
}
struct CountrySetting
{
@@ -54,5 +57,5 @@ private:
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);
};
+12 -9
View File
@@ -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;
@@ -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()) ?
@@ -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)
@@ -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
+1
View File
@@ -4,6 +4,7 @@
#include <memory>
#include "Common/CommonFuncs.h"
#include "Common/FileUtil.h"
#include "Core/Boot/Boot.h"
#include "Core/Boot/ElfReader.h"
+2 -1
View File
@@ -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"
@@ -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');
}
+26 -22
View File
@@ -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;
@@ -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;
}
@@ -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)
@@ -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;
}
+6 -2
View File
@@ -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")
@@ -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;
+2 -1
View File
@@ -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"
@@ -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) /
+8 -7
View File
@@ -27,6 +27,7 @@
#include "Core/HW/Sram.h"
#include "Core/HW/SystemTimers.h"
#include "Core/Movie.h"
#include "DiscIO/Enums.h"
#include "DiscIO/NANDContentLoader.h"
#define MC_STATUS_BUSY 0x80
@@ -135,7 +136,7 @@ CEXIMemoryCard::CEXIMemoryCard(const int index, bool gciFolder) : card_index(ind
void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
{
DiscIO::IVolume::ECountry country_code = DiscIO::IVolume::COUNTRY_UNKNOWN;
DiscIO::Country country_code = DiscIO::Country::COUNTRY_UNKNOWN;
auto strUniqueID = SConfig::GetInstance().m_strUniqueID;
u32 CurrentGameId = 0;
@@ -158,14 +159,14 @@ void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
std::string strDirectoryName = File::GetUserPath(D_GCUSER_IDX);
switch (country_code)
{
case DiscIO::IVolume::COUNTRY_JAPAN:
case DiscIO::Country::COUNTRY_JAPAN:
ascii = false;
strDirectoryName += JAP_DIR DIR_SEP;
break;
case DiscIO::IVolume::COUNTRY_USA:
case DiscIO::Country::COUNTRY_USA:
strDirectoryName += USA_DIR DIR_SEP;
break;
case DiscIO::IVolume::COUNTRY_UNKNOWN:
case DiscIO::Country::COUNTRY_UNKNOWN:
{
// The current game's region is not passed down to the EXI device level.
// Usually, we can retrieve the region from SConfig::GetInstance().m_strUniqueId.
@@ -185,20 +186,20 @@ void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
std::string region = memcardFilename.substr(memcardFilename.size() - 7, 3);
if (region == JAP_DIR)
{
country_code = DiscIO::IVolume::COUNTRY_JAPAN;
country_code = DiscIO::Country::COUNTRY_JAPAN;
ascii = false;
strDirectoryName += JAP_DIR DIR_SEP;
break;
}
else if (region == USA_DIR)
{
country_code = DiscIO::IVolume::COUNTRY_USA;
country_code = DiscIO::Country::COUNTRY_USA;
strDirectoryName += USA_DIR DIR_SEP;
break;
}
}
default:
country_code = DiscIO::IVolume::COUNTRY_EUROPE;
country_code = DiscIO::Country::COUNTRY_EUROPE;
strDirectoryName += EUR_DIR DIR_SEP;
}
strDirectoryName += StringFromFormat("Card %c", 'A' + card_index);
+6 -7
View File
@@ -24,7 +24,7 @@
const int NO_INDEX = -1;
static const char* MC_HDR = "MC_SYSTEM_AREA";
int GCMemcardDirectory::LoadGCI(const std::string& fileName, DiscIO::IVolume::ECountry card_region,
int GCMemcardDirectory::LoadGCI(const std::string& fileName, DiscIO::Country card_region,
bool currentGameOnly)
{
File::IOFile gcifile(fileName, "rb");
@@ -39,15 +39,15 @@ int GCMemcardDirectory::LoadGCI(const std::string& fileName, DiscIO::IVolume::EC
return NO_INDEX;
}
DiscIO::IVolume::ECountry gci_region;
DiscIO::Country gci_region;
// check region
switch (gci.m_gci_header.Gamecode[3])
{
case 'J':
gci_region = DiscIO::IVolume::COUNTRY_JAPAN;
gci_region = DiscIO::Country::COUNTRY_JAPAN;
break;
case 'E':
gci_region = DiscIO::IVolume::COUNTRY_USA;
gci_region = DiscIO::Country::COUNTRY_USA;
break;
case 'C':
// Used by Datel Action Replay Save
@@ -55,7 +55,7 @@ int GCMemcardDirectory::LoadGCI(const std::string& fileName, DiscIO::IVolume::EC
gci_region = card_region;
break;
default:
gci_region = DiscIO::IVolume::COUNTRY_EUROPE;
gci_region = DiscIO::Country::COUNTRY_EUROPE;
break;
}
@@ -146,8 +146,7 @@ int GCMemcardDirectory::LoadGCI(const std::string& fileName, DiscIO::IVolume::EC
}
GCMemcardDirectory::GCMemcardDirectory(const std::string& directory, int slot, u16 sizeMb,
bool ascii, DiscIO::IVolume::ECountry card_region,
int gameId)
bool ascii, DiscIO::Country card_region, int gameId)
: MemoryCardBase(slot, sizeMb), m_GameId(gameId), m_LastBlock(-1), m_hdr(slot, sizeMb, ascii),
m_bat1(sizeMb), m_saves(0), m_SaveDirectory(directory), m_exiting(false)
{
+3 -5
View File
@@ -14,7 +14,7 @@
#include "Common/Event.h"
#include "Common/NonCopyable.h"
#include "Core/HW/GCMemcard.h"
#include "DiscIO/Volume.h"
#include "DiscIO/Enums.h"
// Uncomment this to write the system data of the memorycard from directory to disc
//#define _WRITE_MC_HEADER 1
@@ -25,8 +25,7 @@ class GCMemcardDirectory : public MemoryCardBase, NonCopyable
public:
GCMemcardDirectory(const std::string& directory, int slot = 0, u16 sizeMb = MemCard2043Mb,
bool ascii = true,
DiscIO::IVolume::ECountry card_region = DiscIO::IVolume::COUNTRY_EUROPE,
int gameId = 0);
DiscIO::Country card_region = DiscIO::Country::COUNTRY_EUROPE, int gameId = 0);
~GCMemcardDirectory();
void FlushToFile();
void FlushThread();
@@ -37,8 +36,7 @@ public:
void DoState(PointerWrap& p) override;
private:
int LoadGCI(const std::string& fileName, DiscIO::IVolume::ECountry card_region,
bool currentGameOnly);
int LoadGCI(const std::string& fileName, DiscIO::Country card_region, bool currentGameOnly);
inline s32 SaveAreaRW(u32 block, bool writing = false);
// s32 DirectoryRead(u32 offset, u32 length, u8* destaddress);
s32 DirectoryWrite(u32 destaddress, u32 length, u8* srcaddress);
@@ -15,6 +15,7 @@
#include "Core/HW/SystemTimers.h"
#include "Core/IPC_HLE/WII_IPC_HLE.h"
#include "Core/IPC_HLE/WII_IPC_HLE_Device_DI.h"
#include "DiscIO/Volume.h"
CWII_IPC_HLE_Device_di::CWII_IPC_HLE_Device_di(u32 _DeviceID, const std::string& _rDeviceName)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
@@ -53,6 +53,7 @@
#include "Core/PowerPC/PowerPC.h"
#include "Core/ec_wii.h"
#include "DiscIO/NANDContentLoader.h"
#include "DiscIO/Volume.h"
#ifdef _WIN32
#include <Windows.h>
+2 -1
View File
@@ -34,6 +34,7 @@
#include "Core/NetPlayProto.h"
#include "Core/PowerPC/PowerPC.h"
#include "Core/State.h"
#include "DiscIO/Enums.h"
#include "InputCommon/GCPadStatus.h"
#include "VideoCommon/Fifo.h"
#include "VideoCommon/VideoBackendBase.h"
@@ -82,7 +83,7 @@ static u8 s_bongos, s_memcards;
static u8 s_revision[20];
static u32 s_DSPiromHash = 0;
static u32 s_DSPcoefHash = 0;
static u8 s_language = 10; // Set to unknown until language is known
static u8 s_language = static_cast<u8>(DiscIO::Language::LANGUAGE_UNKNOWN);
static bool s_bRecordingFromSaveState = false;
static bool s_bPolled = false;
+1 -1
View File
@@ -22,7 +22,7 @@
namespace DiscIO
{
// Increment CACHE_REVISION if the enum below is modified (ISOFile.cpp & GameFile.cpp)
// Increment CACHE_REVISION (ISOFile.cpp & GameFile.cpp) if the enum below is modified
enum class BlobType
{
PLAIN,
+2 -1
View File
@@ -4,12 +4,13 @@ set(SRCS Blob.cpp
CompressedBlob.cpp
DiscScrubber.cpp
DriveBlob.cpp
Enums.cpp
FileBlob.cpp
FileMonitor.cpp
FileSystemGCWii.cpp
Filesystem.cpp
NANDContentLoader.cpp
VolumeCommon.cpp
Volume.cpp
VolumeCreator.cpp
VolumeDirectory.cpp
VolumeGC.cpp
+4 -2
View File
@@ -40,12 +40,13 @@
<ClCompile Include="CompressedBlob.cpp" />
<ClCompile Include="DiscScrubber.cpp" />
<ClCompile Include="DriveBlob.cpp" />
<ClCompile Include="Enums.cpp" />
<ClCompile Include="FileBlob.cpp" />
<ClCompile Include="FileMonitor.cpp" />
<ClCompile Include="Filesystem.cpp" />
<ClCompile Include="FileSystemGCWii.cpp" />
<ClCompile Include="NANDContentLoader.cpp" />
<ClCompile Include="VolumeCommon.cpp" />
<ClCompile Include="Volume.cpp" />
<ClCompile Include="VolumeCreator.cpp" />
<ClCompile Include="VolumeDirectory.cpp" />
<ClCompile Include="VolumeGC.cpp" />
@@ -60,6 +61,7 @@
<ClInclude Include="CompressedBlob.h" />
<ClInclude Include="DiscScrubber.h" />
<ClInclude Include="DriveBlob.h" />
<ClInclude Include="Enums.h" />
<ClInclude Include="FileBlob.h" />
<ClInclude Include="FileMonitor.h" />
<ClInclude Include="Filesystem.h" />
@@ -91,4 +93,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
+9 -3
View File
@@ -54,9 +54,6 @@
<ClCompile Include="FileMonitor.cpp">
<Filter>Volume</Filter>
</ClCompile>
<ClCompile Include="VolumeCommon.cpp">
<Filter>Volume</Filter>
</ClCompile>
<ClCompile Include="VolumeCreator.cpp">
<Filter>Volume</Filter>
</ClCompile>
@@ -72,6 +69,12 @@
<ClCompile Include="VolumeWiiCrypted.cpp">
<Filter>Volume</Filter>
</ClCompile>
<ClCompile Include="Enums.cpp">
<Filter>Volume</Filter>
</ClCompile>
<ClCompile Include="Volume.cpp">
<Filter>Volume</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="DiscScrubber.h">
@@ -128,6 +131,9 @@
<ClInclude Include="VolumeWiiCrypted.h">
<Filter>Volume</Filter>
</ClInclude>
<ClInclude Include="Enums.h">
<Filter>Volume</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />
@@ -1,146 +1,83 @@
// Copyright 2009 Dolphin Emulator Project
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <algorithm>
#include <map>
#include <string>
#include <utility>
#include <vector>
#include "Common/ColorUtil.h"
#include "Common/CommonFuncs.h"
#include "DiscIO/Enums.h"
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "Common/Logging/Log.h"
#include "Common/StringUtil.h"
#include "DiscIO/Volume.h"
namespace DiscIO
{
static const unsigned int WII_BANNER_WIDTH = 192;
static const unsigned int WII_BANNER_HEIGHT = 64;
static const unsigned int WII_BANNER_SIZE = WII_BANNER_WIDTH * WII_BANNER_HEIGHT * 2;
static const unsigned int WII_BANNER_OFFSET = 0xA0;
// Increment CACHE_REVISION (ISOFile.cpp & GameFile.cpp) if the code below is modified
std::vector<u32> IVolume::GetWiiBanner(int* width, int* height, u64 title_id)
{
*width = 0;
*height = 0;
std::string file_name = StringFromFormat("%s/title/%08x/%08x/data/banner.bin",
File::GetUserPath(D_WIIROOT_IDX).c_str(),
(u32)(title_id >> 32), (u32)title_id);
if (!File::Exists(file_name))
return std::vector<u32>();
if (File::GetSize(file_name) < WII_BANNER_OFFSET + WII_BANNER_SIZE)
return std::vector<u32>();
File::IOFile file(file_name, "rb");
if (!file.Seek(WII_BANNER_OFFSET, SEEK_SET))
return std::vector<u32>();
std::vector<u8> banner_file(WII_BANNER_SIZE);
if (!file.ReadBytes(banner_file.data(), banner_file.size()))
return std::vector<u32>();
std::vector<u32> image_buffer(WII_BANNER_WIDTH * WII_BANNER_HEIGHT);
ColorUtil::decode5A3image(image_buffer.data(), (u16*)banner_file.data(), WII_BANNER_WIDTH,
WII_BANNER_HEIGHT);
*width = WII_BANNER_WIDTH;
*height = WII_BANNER_HEIGHT;
return image_buffer;
}
std::map<IVolume::ELanguage, std::string> IVolume::ReadWiiNames(const std::vector<u8>& data)
{
std::map<IVolume::ELanguage, std::string> names;
for (size_t i = 0; i < NUMBER_OF_LANGUAGES; ++i)
{
size_t name_start = NAME_BYTES_LENGTH * i;
size_t name_end = name_start + NAME_BYTES_LENGTH;
if (data.size() >= name_end)
{
u16* temp = (u16*)(data.data() + name_start);
std::wstring out_temp(NAME_STRING_LENGTH, '\0');
std::transform(temp, temp + out_temp.size(), out_temp.begin(), (u16(&)(u16))Common::swap16);
out_temp.erase(std::find(out_temp.begin(), out_temp.end(), 0x00), out_temp.end());
std::string name = UTF16ToUTF8(out_temp);
if (!name.empty())
names[(IVolume::ELanguage)i] = name;
}
}
return names;
}
// Increment CACHE_REVISION if the code below is modified (ISOFile.cpp & GameFile.cpp)
IVolume::ECountry CountrySwitch(u8 country_code)
Country CountrySwitch(u8 country_code)
{
switch (country_code)
{
// Worldwide
case 'A':
return IVolume::COUNTRY_WORLD;
return Country::COUNTRY_WORLD;
// PAL
case 'D':
return IVolume::COUNTRY_GERMANY;
return Country::COUNTRY_GERMANY;
case 'X': // Used by a couple PAL games
case 'Y': // German, French
case 'L': // Japanese import to PAL regions
case 'M': // Japanese import to PAL regions
case 'P':
return IVolume::COUNTRY_EUROPE;
return Country::COUNTRY_EUROPE;
case 'U':
return IVolume::COUNTRY_AUSTRALIA;
return Country::COUNTRY_AUSTRALIA;
case 'F':
return IVolume::COUNTRY_FRANCE;
return Country::COUNTRY_FRANCE;
case 'I':
return IVolume::COUNTRY_ITALY;
return Country::COUNTRY_ITALY;
case 'H':
return IVolume::COUNTRY_NETHERLANDS;
return Country::COUNTRY_NETHERLANDS;
case 'R':
return IVolume::COUNTRY_RUSSIA;
return Country::COUNTRY_RUSSIA;
case 'S':
return IVolume::COUNTRY_SPAIN;
return Country::COUNTRY_SPAIN;
// NTSC
case 'E':
case 'N': // Japanese import to USA and other NTSC regions
case 'Z': // Prince of Persia - The Forgotten Sands (Wii)
case 'B': // Ufouria: The Saga (Virtual Console)
return IVolume::COUNTRY_USA;
return Country::COUNTRY_USA;
case 'J':
return IVolume::COUNTRY_JAPAN;
return Country::COUNTRY_JAPAN;
case 'K':
case 'Q': // Korea with Japanese language
case 'T': // Korea with English language
return IVolume::COUNTRY_KOREA;
return Country::COUNTRY_KOREA;
case 'W':
return IVolume::COUNTRY_TAIWAN;
return Country::COUNTRY_TAIWAN;
default:
if (country_code > 'A') // Silently ignore IOS wads
WARN_LOG(DISCIO, "Unknown Country Code! %c", country_code);
return IVolume::COUNTRY_UNKNOWN;
return Country::COUNTRY_UNKNOWN;
}
}
u8 GetSysMenuRegion(u16 _TitleVersion)
u8 GetSysMenuRegion(u16 title_version)
{
switch (_TitleVersion)
switch (title_version)
{
case 128:
case 192:

Some files were not shown because too many files have changed in this diff Show More