mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
TRPLoader: Use std::string_view
This commit is contained in:
parent
27becdec97
commit
7329fa9cf5
@ -720,12 +720,12 @@ error_code sys_usbd_register_ldd(ppu_thread& ppu, u32 handle, vm::ptr<char> s_pr
|
||||
// The register_ldd appears to be a more promiscuous mode function, where all device 'inserts' would be presented to the cellUsbd for Probing.
|
||||
// Unsure how many more devices might need similar treatment (i.e. just a compare and force VID/PID add), or if it's worth adding a full promiscuous
|
||||
// capability
|
||||
if (strcmp(s_product.get_ptr(), "guncon3") == 0)
|
||||
if (s_product.get_ptr() == "guncon3"sv)
|
||||
{
|
||||
sys_usbd.warning("sys_usbd_register_ldd(handle=0x%x, s_product=%s, slen_product=0x%x) -> Redirecting to sys_usbd_register_extra_ldd", handle, s_product, slen_product);
|
||||
sys_usbd_register_extra_ldd(ppu, handle, s_product, slen_product, 0x0B9A, 0x0800, 0x0800);
|
||||
}
|
||||
else if (strcmp(s_product.get_ptr(), "PS3A-USJ") == 0)
|
||||
else if (s_product.get_ptr() == "PS3A-USJ"sv)
|
||||
{
|
||||
// Arcade v406 USIO board
|
||||
sys_usbd.warning("sys_usbd_register_ldd(handle=0x%x, s_product=%s, slen_product=0x%x) -> Redirecting to sys_usbd_register_extra_ldd", handle, s_product, slen_product);
|
||||
|
@ -46,9 +46,9 @@ namespace vk
|
||||
}
|
||||
}
|
||||
|
||||
bool is_supported(const char* ext)
|
||||
bool is_supported(std::string_view ext)
|
||||
{
|
||||
return std::any_of(m_vk_exts.cbegin(), m_vk_exts.cend(), [&](const VkExtensionProperties& p) { return std::strcmp(p.extensionName, ext) == 0; });
|
||||
return std::any_of(m_vk_exts.cbegin(), m_vk_exts.cend(), [&](const VkExtensionProperties& p) { return p.extensionName == ext; });
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -11,7 +11,7 @@ TRPLoader::TRPLoader(const fs::file& f)
|
||||
{
|
||||
}
|
||||
|
||||
bool TRPLoader::Install(const std::string& dest, bool /*show*/)
|
||||
bool TRPLoader::Install(std::string_view dest, bool /*show*/)
|
||||
{
|
||||
if (!trp_f)
|
||||
{
|
||||
@ -151,11 +151,16 @@ u64 TRPLoader::GetRequiredSpace() const
|
||||
return file_size - sizeof(m_header) - file_element_size;
|
||||
}
|
||||
|
||||
bool TRPLoader::ContainsEntry(const char *filename)
|
||||
bool TRPLoader::ContainsEntry(std::string_view filename)
|
||||
{
|
||||
if (filename.size() >= sizeof(TRPEntry::name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const TRPEntry& entry : m_entries)
|
||||
{
|
||||
if (!strcmp(entry.name, filename))
|
||||
if (entry.name == filename)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -163,12 +168,17 @@ bool TRPLoader::ContainsEntry(const char *filename)
|
||||
return false;
|
||||
}
|
||||
|
||||
void TRPLoader::RemoveEntry(const char *filename)
|
||||
void TRPLoader::RemoveEntry(std::string_view filename)
|
||||
{
|
||||
if (filename.size() >= sizeof(TRPEntry::name))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<TRPEntry>::iterator i = m_entries.begin();
|
||||
while (i != m_entries.end())
|
||||
{
|
||||
if (!strcmp(i->name, filename))
|
||||
if (i->name == filename)
|
||||
{
|
||||
i = m_entries.erase(i);
|
||||
}
|
||||
@ -179,13 +189,18 @@ void TRPLoader::RemoveEntry(const char *filename)
|
||||
}
|
||||
}
|
||||
|
||||
void TRPLoader::RenameEntry(const char *oldname, const char *newname)
|
||||
void TRPLoader::RenameEntry(std::string_view oldname, std::string_view newname)
|
||||
{
|
||||
if (oldname.size() >= sizeof(TRPEntry::name) || newname.size() >= sizeof(TRPEntry::name))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (TRPEntry& entry : m_entries)
|
||||
{
|
||||
if (!strcmp(entry.name, oldname))
|
||||
if (entry.name == oldname)
|
||||
{
|
||||
strcpy_trunc(entry.name, std::string_view(newname));
|
||||
strcpy_trunc(entry.name, newname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,11 +30,11 @@ class TRPLoader final
|
||||
public:
|
||||
TRPLoader(const fs::file& f);
|
||||
|
||||
bool Install(const std::string& dest, bool show = false);
|
||||
bool Install(std::string_view dest, bool show = false);
|
||||
bool LoadHeader(bool show = false);
|
||||
u64 GetRequiredSpace() const;
|
||||
|
||||
bool ContainsEntry(const char *filename);
|
||||
void RemoveEntry(const char *filename);
|
||||
void RenameEntry(const char *oldname, const char *newname);
|
||||
bool ContainsEntry(std::string_view filename);
|
||||
void RemoveEntry(std::string_view filename);
|
||||
void RenameEntry(std::string_view oldname, std::string_view newname);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user