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

Important fix #7701

Merged
merged 1 commit into from Mar 5, 2020
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
4 changes: 2 additions & 2 deletions Utilities/StrFmt.cpp
Expand Up @@ -342,7 +342,7 @@ std::string fmt::replace_first(const std::string& src, const std::string& from,
{
auto pos = src.find(from);

if (pos == std::string::npos)
if (pos == umax)
{
return src;
}
Expand All @@ -353,7 +353,7 @@ std::string fmt::replace_first(const std::string& src, const std::string& from,
std::string fmt::replace_all(const std::string& src, const std::string& from, const std::string& to)
{
std::string target = src;
for (auto pos = target.find(from); pos != std::string::npos; pos = target.find(from, pos + 1))
for (auto pos = target.find(from); pos != umax; pos = target.find(from, pos + 1))
{
target = (pos ? target.substr(0, pos) + to : to) + std::string(target.c_str() + pos + from.length());
pos += to.length();
Expand Down
14 changes: 7 additions & 7 deletions Utilities/Thread.cpp
Expand Up @@ -2024,11 +2024,11 @@ void thread_ctrl::detect_cpu_layout()
return;

const auto system_id = utils::get_system_info();
if (system_id.find("Ryzen") != std::string::npos)
if (system_id.find("Ryzen") != umax)
{
g_native_core_layout.store(native_core_arrangement::amd_ccx);
}
else if (system_id.find("Intel") != std::string::npos)
else if (system_id.find("Intel") != umax)
{
#ifdef _WIN32
const LOGICAL_PROCESSOR_RELATIONSHIP relationship = LOGICAL_PROCESSOR_RELATIONSHIP::RelationProcessorCore;
Expand Down Expand Up @@ -2098,7 +2098,7 @@ u64 thread_ctrl::get_affinity_mask(thread_class group)
const auto system_id = utils::get_system_info();
if (thread_count >= 32)
{
if (system_id.find("3950X") != std::string::npos)
if (system_id.find("3950X") != umax)
{
// zen2
// Ryzen 9 3950X
Expand All @@ -2107,7 +2107,7 @@ u64 thread_ctrl::get_affinity_mask(thread_class group)
spu_mask = 0b00000000111111110000000000000000;
rsx_mask = 0b00000000000000001111111100000000;
}
else if (system_id.find("2970WX") != std::string::npos)
else if (system_id.find("2970WX") != umax)
{
// zen+
// Threadripper 2970WX
Expand All @@ -2129,7 +2129,7 @@ u64 thread_ctrl::get_affinity_mask(thread_class group)
}
else if (thread_count == 24)
{
if (system_id.find("3900X") != std::string::npos)
if (system_id.find("3900X") != umax)
{
// zen2
// Ryzen 9 3900X
Expand All @@ -2150,7 +2150,7 @@ u64 thread_ctrl::get_affinity_mask(thread_class group)
}
else if (thread_count == 16)
{
if (system_id.find("3700X") != std::string::npos || system_id.find("3800X") != std::string::npos)
if (system_id.find("3700X") != umax || system_id.find("3800X") != umax)
{
// Ryzen 7 3700/3800 (x)
// Assign threads 1-16
Expand All @@ -2170,7 +2170,7 @@ u64 thread_ctrl::get_affinity_mask(thread_class group)
}
else if (thread_count == 12)
{
if (system_id.find("3600") != std::string::npos)
if (system_id.find("3600") != umax)
{
// zen2
// R5 3600 (x)
Expand Down
6 changes: 3 additions & 3 deletions rpcs3/Emu/GDB.cpp
Expand Up @@ -599,7 +599,7 @@ bool gdb_thread::cmd_write_register(gdb_cmd& cmd)
if (th->id_type() == 1) {
auto ppu = static_cast<named_thread<ppu_thread>*>(th.get());
size_t eq_pos = cmd.data.find('=');
if (eq_pos == std::string::npos) {
if (eq_pos == umax) {
GDB.warning("Wrong write_register cmd data '%s'.", cmd.data);
return send_cmd_ack("E02");
}
Expand Down Expand Up @@ -641,7 +641,7 @@ bool gdb_thread::cmd_write_memory(gdb_cmd& cmd)
{
size_t s = cmd.data.find(',');
size_t s2 = cmd.data.find(':');
if ((s == std::string::npos) || (s2 == std::string::npos)) {
if ((s == umax) || (s2 == umax)) {
GDB.warning("Malformed write memory request received: '%s'.", cmd.data);
return send_cmd_ack("E01");
}
Expand Down Expand Up @@ -778,7 +778,7 @@ bool gdb_thread::cmd_set_breakpoint(gdb_cmd& cmd)
//software breakpoint
if (type == '0') {
u32 addr = INVALID_PTR;
if (cmd.data.find(';') != std::string::npos) {
if (cmd.data.find(';') != umax) {
GDB.warning("Received request to set breakpoint with condition, but they are not supported.");
return send_cmd_ack("E01");
}
Expand Down
6 changes: 3 additions & 3 deletions rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp
Expand Up @@ -421,17 +421,17 @@ void FragmentProgramDecompiler::AddCodeCond(const std::string& lhs, const std::s

bool src_is_fp16 = false;
if ((opflags & (OPFLAGS::texture_ref | OPFLAGS::src_cast_f32)) == 0 &&
rhs.find("$0") != std::string::npos)
rhs.find("$0") != umax)
{
// Texture sample operations are full-width and are exempt
src_is_fp16 = (src0.fp16 && src0.reg_type == RSX_FP_REGISTER_TYPE_TEMP);

if (src_is_fp16 && rhs.find("$1") != std::string::npos)
if (src_is_fp16 && rhs.find("$1") != umax)
{
// References operand 1
src_is_fp16 = (src1.fp16 && src1.reg_type == RSX_FP_REGISTER_TYPE_TEMP);

if (src_is_fp16 && rhs.find("$2") != std::string::npos)
if (src_is_fp16 && rhs.find("$2") != umax)
{
// References operand 2
src_is_fp16 = (src2.fp16 && src2.reg_type == RSX_FP_REGISTER_TYPE_TEMP);
Expand Down
4 changes: 2 additions & 2 deletions rpcs3/Emu/RSX/Common/ShaderParam.h
Expand Up @@ -184,7 +184,7 @@ class ShaderVariable
std::string simple_var;
const auto eq_pos = var.find('=');

if (eq_pos != std::string::npos)
if (eq_pos != umax)
{
simple_var = var.substr(0, eq_pos - 1);
}
Expand All @@ -195,7 +195,7 @@ class ShaderVariable

const auto brace_pos = var.find_last_of(')');
std::string prefix;
if (brace_pos != std::string::npos)
if (brace_pos != umax)
{
prefix = simple_var.substr(0, brace_pos);
simple_var = simple_var.substr(brace_pos);
Expand Down
8 changes: 4 additions & 4 deletions rpcs3/Emu/RSX/GL/GLHelpers.h
Expand Up @@ -234,7 +234,7 @@ namespace gl
vendor_string = "intel"; //lowest acceptable value
}

if (vendor_string.find("intel") != std::string::npos)
if (vendor_string.find("intel") != umax)
{
int version_major = 0;
int version_minor = 0;
Expand All @@ -258,16 +258,16 @@ namespace gl
if (!EXT_dsa_supported && glGetTextureImageEXT && glTextureBufferRangeEXT)
EXT_dsa_supported = true;
}
else if (vendor_string.find("nvidia") != std::string::npos)
else if (vendor_string.find("nvidia") != umax)
{
vendor_NVIDIA = true;
}
else if (vendor_string.find("x.org") != std::string::npos)
else if (vendor_string.find("x.org") != umax)
{
vendor_MESA = true;
}
#ifdef _WIN32
else if (vendor_string.find("amd") != std::string::npos || vendor_string.find("ati") != std::string::npos)
else if (vendor_string.find("amd") != umax || vendor_string.find("ati") != umax)
{
vendor_AMD = true;
}
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/RSX/Overlays/overlay_fonts.cpp
Expand Up @@ -174,7 +174,7 @@ namespace rsx

std::string extension;
if (const auto extension_start = font_file.find_last_of('.');
extension_start != std::string::npos)
extension_start != umax)
{
extension = font_file.substr(extension_start + 1);
}
Expand Down
10 changes: 5 additions & 5 deletions rpcs3/Emu/RSX/VK/VKHelpers.h
Expand Up @@ -627,7 +627,7 @@ namespace vk
rsx_log.notice("Found vulkan-compatible GPU: '%s' running on driver %s", get_name(), get_driver_version());

if (get_driver_vendor() == driver_vendor::RADV &&
get_name().find("LLVM 8.0.0") != std::string::npos)
get_name().find("LLVM 8.0.0") != umax)
{
// Serious driver bug causing black screens
// See https://bugs.freedesktop.org/show_bug.cgi?id=110970
Expand All @@ -651,22 +651,22 @@ namespace vk
if (!driver_properties.driverID)
{
const auto gpu_name = get_name();
if (gpu_name.find("Radeon") != std::string::npos)
if (gpu_name.find("Radeon") != umax)
{
return driver_vendor::AMD;
}

if (gpu_name.find("NVIDIA") != std::string::npos || gpu_name.find("GeForce") != std::string::npos)
if (gpu_name.find("NVIDIA") != umax || gpu_name.find("GeForce") != umax)
{
return driver_vendor::NVIDIA;
}

if (gpu_name.find("RADV") != std::string::npos)
if (gpu_name.find("RADV") != umax)
{
return driver_vendor::RADV;
}

if (gpu_name.find("Intel") != std::string::npos)
if (gpu_name.find("Intel") != umax)
{
return driver_vendor::INTEL;
}
Expand Down
6 changes: 3 additions & 3 deletions rpcs3/Emu/RSX/VK/VKProgramPipeline.cpp
Expand Up @@ -57,18 +57,18 @@ namespace vk
// Link step is only useful for rasterizer programs, compute programs do not need this
for (const auto &uniform : uniforms[program_input_type::input_type_texture])
{
if (const auto name_start = uniform.name.find("tex"); name_start != std::string::npos)
if (const auto name_start = uniform.name.find("tex"); name_start != umax)
{
const auto name_end = uniform.name.find("_stencil");
const auto index_start = name_start + 3; // Skip 'tex' part
const auto index_length = (name_end != std::string::npos) ? name_end - index_start : name_end;
const auto index_length = (name_end != umax) ? name_end - index_start : name_end;
const auto index_part = uniform.name.substr(index_start, index_length);
const auto index = std::stoi(index_part);

if (name_start == 0)
{
// Fragment texture (tex...)
if (name_end == std::string::npos)
if (name_end == umax)
{
// Normal texture
fs_texture_bindings[index] = uniform.location;
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/System.cpp
Expand Up @@ -1034,7 +1034,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
const std::string hdd0_disc = vfs::get("/dev_hdd0/disc/");
const std::size_t game_dir_size = 8; // size of PS3_GAME and PS3_GMXX
const std::size_t bdvd_pos = m_cat == "DG" && bdvd_dir.empty() && disc.empty() ? elf_dir.rfind("/USRDIR") - game_dir_size : 0;
const bool from_hdd0_game = m_path.find(hdd0_game) != std::string::npos;
const bool from_hdd0_game = m_path.find(hdd0_game) != umax;

if (bdvd_pos && from_hdd0_game)
{
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Input/ds3_pad_handler.cpp
Expand Up @@ -219,7 +219,7 @@ std::shared_ptr<ds3_pad_handler::ds3_device> ds3_pad_handler::get_ds3_device(con
return nullptr;

size_t pos = padId.find(m_name_string);
if (pos == std::string::npos)
if (pos == umax)
return nullptr;

int pad_number = std::stoi(padId.substr(pos + 9));
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Input/ds4_pad_handler.cpp
Expand Up @@ -225,7 +225,7 @@ std::shared_ptr<ds4_pad_handler::DS4Device> ds4_pad_handler::GetDS4Device(const
return nullptr;

size_t pos = padId.find(m_name_string);
if (pos == std::string::npos)
if (pos == umax)
return nullptr;

std::string pad_serial = padId.substr(pos + 9);
Expand Down
4 changes: 2 additions & 2 deletions rpcs3/Input/evdev_joystick_handler.cpp
Expand Up @@ -327,9 +327,9 @@ void evdev_joystick_handler::get_next_button_press(const std::string& padId, con
std::string name = button.second;

// Handle annoying useless buttons
if (padId.find("Xbox 360") != std::string::npos && code >= BTN_TRIGGER_HAPPY)
if (padId.find("Xbox 360") != umax && code >= BTN_TRIGGER_HAPPY)
continue;
if (padId.find("Sony") != std::string::npos && (code == BTN_TL2 || code == BTN_TR2))
if (padId.find("Sony") != umax && (code == BTN_TL2 || code == BTN_TR2))
continue;

if (!get_blacklist && std::find(blacklist.begin(), blacklist.end(), name) != blacklist.end())
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Input/xinput_pad_handler.cpp
Expand Up @@ -146,7 +146,7 @@ int xinput_pad_handler::GetDeviceNumber(const std::string& padId)
return -1;

size_t pos = padId.find(m_name_string);
if (pos == std::string::npos)
if (pos == umax)
return -1;

int device_number = std::stoul(padId.substr(pos + 12)) - 1; // Controllers 1-n in GUI
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Loader/TAR.cpp
Expand Up @@ -68,7 +68,7 @@ fs::file tar_object::get_file(std::string path)
{
TARHeader header = read_header(largest_offset);

if (std::string(header.magic).find("ustar") != std::string::npos)
if (std::string(header.magic).find("ustar") != umax)
m_map[header.name] = largest_offset;

int size = octalToDecimal(atoi(header.size));
Expand Down
4 changes: 2 additions & 2 deletions rpcs3/rpcs3qt/main_window.cpp
Expand Up @@ -626,12 +626,12 @@ void main_window::HandlePupInstallation(QString file_path)
auto updatefilenames = update_files.get_filenames();

updatefilenames.erase(std::remove_if(
updatefilenames.begin(), updatefilenames.end(), [](std::string s) { return s.find("dev_flash_") == std::string::npos; }),
updatefilenames.begin(), updatefilenames.end(), [](std::string s) { return s.find("dev_flash_") == umax; }),
updatefilenames.end());

std::string version_string = pup.get_file(0x100).to_string();
size_t version_pos = version_string.find('\n');
if (version_pos != std::string::npos)
if (version_pos != umax)
{
version_string.erase(version_pos);
}
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/rpcs3qt/register_editor_dialog.cpp
Expand Up @@ -123,7 +123,7 @@ void register_editor_dialog::updateRegister(const QString& text)
auto& spu = *static_cast<spu_thread*>(cpu.get());

std::string::size_type first_brk = reg.find('[');
if (first_brk != std::string::npos)
if (first_brk != umax)
{
long reg_index;
reg_index = atol(reg.substr(first_brk + 1, reg.length() - 2).c_str());
Expand Down
4 changes: 2 additions & 2 deletions rpcs3/rpcs3qt/update_manager.cpp
Expand Up @@ -502,7 +502,7 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
break;
}

if (size_t pos = name.find_last_of('/'); pos != std::string::npos)
if (size_t pos = name.find_last_of('/'); pos != umax)
{
update_log.trace("Creating path: %s", name.substr(0, pos));
fs::create_path(name.substr(0, pos));
Expand All @@ -521,7 +521,7 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
// File failed to open, probably because in use, rename existing file and try again
const auto pos = name.find_last_of('/');
std::string filename;
if (pos == std::string::npos)
if (pos == umax)
filename = name;
else
filename = name.substr(pos + 1);
Expand Down