@@ -185,7 +185,7 @@ std::string GetRTCDisplay()
const time_t current_time = CEXIIPL::GetEmulatedTime(CEXIIPL::UNIX_EPOCH);
const tm* const gm_time = gmtime(&current_time);

std::stringstream format_time;
std::ostringstream format_time;
format_time << std::put_time(gm_time, "Date/Time: %c\n");
return format_time.str();
}
@@ -37,7 +37,7 @@ BreakPoints::TBreakPointsStr BreakPoints::GetStrings() const
{
if (!bp.is_temporary)
{
std::stringstream ss;
std::ostringstream ss;
ss << std::hex << bp.address << " " << (bp.is_enabled ? "n" : "");
bp_strings.push_back(ss.str());
}
@@ -130,7 +130,7 @@ MemChecks::TMemChecksStr MemChecks::GetStrings() const
TMemChecksStr mc_strings;
for (const TMemCheck& mc : m_mem_checks)
{
std::stringstream ss;
std::ostringstream ss;
ss << std::hex << mc.start_address;
ss << " " << (mc.is_ranged ? mc.end_address : mc.start_address) << " "
<< (mc.is_ranged ? "n" : "") << (mc.is_break_on_read ? "r" : "")
@@ -1193,7 +1193,7 @@ void LogGeneratedX86(size_t size, const PPCAnalyst::CodeBuffer& code_buffer, con

if (b->codeSize <= 250)
{
std::stringstream ss;
std::ostringstream ss;
ss << std::hex;
for (u8 i = 0; i <= b->codeSize; i++)
{
@@ -32,7 +32,7 @@
namespace PowerPC
{
// STATE_TO_SAVE
PowerPCState ppcState{};
PowerPCState ppcState;

static CPUCoreBase* s_cpu_core_base = nullptr;
static bool s_cpu_core_base_is_injected = false;
@@ -348,21 +348,22 @@ Region GetSysMenuRegion(u16 title_version)

std::string GetSysMenuVersionString(u16 title_version)
{
std::string region_letter;
std::string version;
char region_letter = '\0';

switch (GetSysMenuRegion(title_version))
{
case Region::NTSC_J:
region_letter = "J";
region_letter = 'J';
break;
case Region::NTSC_U:
region_letter = "U";
region_letter = 'U';
break;
case Region::PAL:
region_letter = "E";
region_letter = 'E';
break;
case Region::NTSC_K:
region_letter = "K";
region_letter = 'K';
break;
case Region::Unknown:
WARN_LOG(DISCIO, "Unknown region for Wii Menu version %u", title_version);
@@ -372,36 +373,55 @@ std::string GetSysMenuVersionString(u16 title_version)
switch (title_version & 0xff0)
{
case 32:
return "1.0" + region_letter;
version = "1.0";
break;
case 96:
case 128:
return "2.0" + region_letter;
version = "2.0";
break;
case 160:
return "2.1" + region_letter;
version = "2.1";
break;
case 192:
return "2.2" + region_letter;
version = "2.2";
break;
case 224:
return "3.0" + region_letter;
version = "3.0";
break;
case 256:
return "3.1" + region_letter;
version = "3.1";
break;
case 288:
return "3.2" + region_letter;
version = "3.2";
break;
case 320:
case 352:
return "3.3" + region_letter;
version = "3.3";
break;
case 384:
return (region_letter != "K" ? "3.4" : "3.5") + region_letter;
version = (region_letter != 'K' ? "3.4" : "3.5");
break;
case 416:
return "4.0" + region_letter;
version = "4.0";
break;
case 448:
return "4.1" + region_letter;
version = "4.1";
break;
case 480:
return "4.2" + region_letter;
version = "4.2";
break;
case 512:
return "4.3" + region_letter;
version = "4.3";
break;
default:
return "?.?" + region_letter;
version = "?.?";
break;
}

if (region_letter != '\0')
version += region_letter;

return version;
}

const std::string& GetCompanyFromID(const std::string& company_id)
@@ -5,6 +5,7 @@
#include "DiscIO/VolumeVerifier.h"

#include <algorithm>
#include <cassert>
#include <cinttypes>
#include <future>
#include <limits>
@@ -678,38 +679,47 @@ bool VolumeVerifier::IsDebugSigned() const

bool VolumeVerifier::ShouldHaveChannelPartition() const
{
const std::unordered_set<std::string> channel_discs{
static constexpr std::array<std::string_view, 18> channel_discs = {
"RFNE01", "RFNJ01", "RFNK01", "RFNP01", "RFNW01", "RFPE01", "RFPJ01", "RFPK01", "RFPP01",
"RFPW01", "RGWE41", "RGWJ41", "RGWP41", "RGWX41", "RMCE01", "RMCJ01", "RMCK01", "RMCP01",
};
assert(std::is_sorted(channel_discs.cbegin(), channel_discs.cend()));

return channel_discs.find(m_volume.GetGameID()) != channel_discs.end();
return std::binary_search(channel_discs.cbegin(), channel_discs.cend(),
std::string_view(m_volume.GetGameID()));
}

bool VolumeVerifier::ShouldHaveInstallPartition() const
{
const std::unordered_set<std::string> dragon_quest_x{"S4MJGD", "S4SJGD", "S6TJGD", "SDQJGD"};
return dragon_quest_x.find(m_volume.GetGameID()) != dragon_quest_x.end();
static constexpr std::array<std::string_view, 4> dragon_quest_x = {"S4MJGD", "S4SJGD", "S6TJGD",
"SDQJGD"};
const std::string& game_id = m_volume.GetGameID();
return std::any_of(dragon_quest_x.cbegin(), dragon_quest_x.cend(),
[&game_id](std::string_view x) { return x == game_id; });
}

bool VolumeVerifier::ShouldHaveMasterpiecePartitions() const
{
const std::unordered_set<std::string> ssbb{"RSBE01", "RSBJ01", "RSBK01", "RSBP01"};
return ssbb.find(m_volume.GetGameID()) != ssbb.end();
static constexpr std::array<std::string_view, 4> ssbb = {"RSBE01", "RSBJ01", "RSBK01", "RSBP01"};
const std::string& game_id = m_volume.GetGameID();
return std::any_of(ssbb.cbegin(), ssbb.cend(),
[&game_id](std::string_view x) { return x == game_id; });
}

bool VolumeVerifier::ShouldBeDualLayer() const
{
// The Japanese versions of Xenoblade and The Last Story are single-layer
// (unlike the other versions) and must not be added to this list.
const std::unordered_set<std::string> dual_layer_discs{
static constexpr std::array<std::string_view, 33> dual_layer_discs = {
"R3ME01", "R3MP01", "R3OE01", "R3OJ01", "R3OP01", "RSBE01", "RSBJ01", "RSBK01", "RSBP01",
"RXMJ8P", "S59E01", "S59JC8", "S59P01", "S5QJC8", "SK8X52", "SAKENS", "SAKPNS", "SK8V52",
"SK8X52", "SLSEXJ", "SLSP01", "SQIE4Q", "SQIP4Q", "SQIY4Q", "SR5E41", "SR5P41", "SUOE41",
"SUOP41", "SVXX52", "SVXY52", "SX4E01", "SX4P01", "SZ3EGT", "SZ3PGT",
"RXMJ8P", "S59E01", "S59JC8", "S59P01", "S5QJC8", "SAKENS", "SAKPNS", "SK8V52", "SK8X52",
"SLSEXJ", "SLSP01", "SQIE4Q", "SQIP4Q", "SQIY4Q", "SR5E41", "SR5P41", "SUOE41", "SUOP41",
"SVXX52", "SVXY52", "SX4E01", "SX4P01", "SZ3EGT", "SZ3PGT",
};
assert(std::is_sorted(dual_layer_discs.cbegin(), dual_layer_discs.cend()));

return dual_layer_discs.find(m_volume.GetGameID()) != dual_layer_discs.end();
return std::binary_search(dual_layer_discs.cbegin(), dual_layer_discs.cend(),
std::string_view(m_volume.GetGameID()));
}

void VolumeVerifier::CheckDiscSize()
@@ -30,7 +30,7 @@ bool InputConfig::LoadConfig(bool isGC)
{
IniFile inifile;
bool useProfile[MAX_BBMOTES] = {false, false, false, false, false};
std::string num[MAX_BBMOTES] = {"1", "2", "3", "4", "BB"};
static constexpr std::array<std::string_view, MAX_BBMOTES> num = {"1", "2", "3", "4", "BB"};
std::string profile[MAX_BBMOTES];
std::string path;

@@ -58,10 +58,10 @@ bool InputConfig::LoadConfig(bool isGC)

for (int i = 0; i < 4; i++)
{
if (control_section->Exists(type + "Profile" + num[i]))
if (control_section->Exists(type + "Profile" + std::string(num[i])))
{
std::string profile_setting;
if (control_section->Get(type + "Profile" + num[i], &profile_setting))
if (control_section->Get(type + "Profile" + std::string(num[i]), &profile_setting))
{
auto profiles = InputProfile::GetProfilesFromSetting(
profile_setting, File::GetUserPath(D_CONFIG_IDX) + path);
@@ -76,7 +76,7 @@ std::vector<ResourcePack>& GetPacks()
std::vector<ResourcePack*> GetLowerPriorityPacks(ResourcePack& pack)
{
std::vector<ResourcePack*> list;
for (auto it = std::find(packs.begin(), packs.end(), pack) + 1; it != packs.end(); it++)
for (auto it = std::find(packs.begin(), packs.end(), pack) + 1; it != packs.end(); ++it)
{
auto& entry = *it;
if (!IsInstalled(pack))
@@ -93,7 +93,7 @@ std::vector<ResourcePack*> GetHigherPriorityPacks(ResourcePack& pack)
std::vector<ResourcePack*> list;
auto end = std::find(packs.begin(), packs.end(), pack);

for (auto it = packs.begin(); it != end; it++)
for (auto it = packs.begin(); it != end; ++it)
{
auto& entry = *it;
if (!IsInstalled(entry))
@@ -464,7 +464,7 @@ std::string FormatSize(u64 bytes)

// Don't need exact values, only 5 most significant digits
const double unit_size = std::pow(2, unit * 10);
std::stringstream ss;
std::ostringstream ss;
ss << std::fixed << std::setprecision(2);
ss << bytes / unit_size << ' ' << Common::GetStringT(unit_symbols[unit]);
return ss.str();
@@ -178,7 +178,7 @@ bool StreamBuffer::WaitForClearSpace(u32 num_bytes)
u32 new_gpu_position = 0;

auto iter = m_tracked_fences.begin();
for (; iter != m_tracked_fences.end(); iter++)
for (; iter != m_tracked_fences.end(); ++iter)
{
// Would this fence bring us in line with the GPU?
// This is the "last resort" case, where a command buffer execution has been forced
@@ -144,28 +144,35 @@ static void APIENTRY ClearDepthf(GLfloat depthval)

static void InitDriverInfo()
{
std::string svendor = std::string(g_ogl_config.gl_vendor);
std::string srenderer = std::string(g_ogl_config.gl_renderer);
std::string sversion = std::string(g_ogl_config.gl_version);
const std::string_view svendor(g_ogl_config.gl_vendor);
const std::string_view srenderer(g_ogl_config.gl_renderer);
const std::string_view sversion(g_ogl_config.gl_version);
DriverDetails::Vendor vendor = DriverDetails::VENDOR_UNKNOWN;
DriverDetails::Driver driver = DriverDetails::DRIVER_UNKNOWN;
DriverDetails::Family family = DriverDetails::Family::UNKNOWN;
double version = 0.0;

// Get the vendor first
if (svendor == "NVIDIA Corporation" && srenderer != "NVIDIA Tegra")
if (svendor == "NVIDIA Corporation")
{
vendor = DriverDetails::VENDOR_NVIDIA;
if (srenderer != "NVIDIA Tegra")
{
vendor = DriverDetails::VENDOR_NVIDIA;
}
else
{
vendor = DriverDetails::VENDOR_TEGRA;
}
}
else if (svendor == "ATI Technologies Inc." || svendor == "Advanced Micro Devices, Inc.")
{
vendor = DriverDetails::VENDOR_ATI;
}
else if (std::string::npos != sversion.find("Mesa"))
else if (sversion.find("Mesa") != std::string::npos)
{
vendor = DriverDetails::VENDOR_MESA;
}
else if (std::string::npos != svendor.find("Intel"))
else if (svendor.find("Intel") != std::string::npos)
{
vendor = DriverDetails::VENDOR_INTEL;
}
@@ -186,10 +193,6 @@ static void InitDriverInfo()
{
vendor = DriverDetails::VENDOR_IMGTEC;
}
else if (svendor == "NVIDIA Corporation" && srenderer == "NVIDIA Tegra")
{
vendor = DriverDetails::VENDOR_TEGRA;
}
else if (svendor == "Vivante Corporation")
{
vendor = DriverDetails::VENDOR_VIVANTE;
@@ -238,8 +241,8 @@ static void InitDriverInfo()
else if (srenderer.find("Ivybridge") != std::string::npos)
family = DriverDetails::Family::INTEL_IVY;
}
else if (std::string::npos != srenderer.find("AMD") ||
std::string::npos != srenderer.find("ATI"))
else if (srenderer.find("AMD") != std::string::npos ||
srenderer.find("ATI") != std::string::npos)
{
driver = DriverDetails::DRIVER_R600;
}
@@ -254,7 +254,7 @@ bool StreamBuffer::WaitForClearSpace(u32 num_bytes)
u32 new_gpu_position = 0;

auto iter = m_tracked_fences.begin();
for (; iter != m_tracked_fences.end(); iter++)
for (; iter != m_tracked_fences.end(); ++iter)
{
// Would this fence bring us in line with the GPU?
// This is the "last resort" case, where a command buffer execution has been forced
@@ -434,7 +434,7 @@ void PostProcessing::BlitFromTexture(const MathUtil::Rectangle<int>& dst,

std::string PostProcessing::GetUniformBufferHeader() const
{
std::stringstream ss;
std::ostringstream ss;
u32 unused_counter = 1;
if (g_ActiveConfig.backend_info.api_type == APIType::D3D)
ss << "cbuffer PSBlock : register(b0) {\n";
@@ -493,7 +493,7 @@ std::string PostProcessing::GetUniformBufferHeader() const

std::string PostProcessing::GetHeader() const
{
std::stringstream ss;
std::ostringstream ss;
ss << GetUniformBufferHeader();
if (g_ActiveConfig.backend_info.api_type == APIType::D3D)
{
@@ -602,7 +602,7 @@ void main(in float3 v_tex0_ : TEXCOORD0, out float4 ocol0_ : SV_Target)

bool PostProcessing::CompileVertexShader()
{
std::stringstream ss;
std::ostringstream ss;
ss << GetUniformBufferHeader();

if (g_ActiveConfig.backend_info.api_type == APIType::D3D)
@@ -1392,7 +1392,7 @@ std::string GenerateDecodingShader(TextureFormat format, TLUTFormat palette_form
if (!info)
return "";

std::stringstream ss;
std::ostringstream ss;
switch (palette_format)
{
case TLUTFormat::IA8:
@@ -1414,7 +1414,7 @@ std::string GenerateDecodingShader(TextureFormat format, TLUTFormat palette_form

std::string GeneratePaletteConversionShader(TLUTFormat palette_format, APIType api_type)
{
std::stringstream ss;
std::ostringstream ss;

ss << R"(
int Convert3To8(int v)
@@ -768,12 +768,12 @@ void VertexManagerBase::OnEndFrame()

#if 0
{
std::stringstream ss;
std::ostringstream ss;
std::for_each(m_cpu_accesses_this_frame.begin(), m_cpu_accesses_this_frame.end(), [&ss](u32 idx) { ss << idx << ","; });
WARN_LOG(VIDEO, "CPU EFB accesses in last frame: %s", ss.str().c_str());
}
{
std::stringstream ss;
std::ostringstream ss;
std::for_each(m_scheduled_command_buffer_kicks.begin(), m_scheduled_command_buffer_kicks.end(), [&ss](u32 idx) { ss << idx << ","; });
WARN_LOG(VIDEO, "Scheduled command buffer kicks: %s", ss.str().c_str());
}