mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-28 13:28:01 +03:00
sys_fs: Improved sys_fs_fcntl(0xc0000015&0xc000001c)
This commit is contained in:
parent
e0fe7989e9
commit
d2dc57585c
10 changed files with 36 additions and 104 deletions
|
@ -559,6 +559,18 @@ void cfg::log_entry::from_default()
|
|||
set_map({});
|
||||
}
|
||||
|
||||
std::pair<u16, u16> cfg::device_info::get_usb_ids() const
|
||||
{
|
||||
auto string_to_hex = [](const std::string& str) -> u16
|
||||
{
|
||||
u16 value = 0x0000;
|
||||
if (!str.empty() && std::from_chars(str.data(), str.data() + str.size(), value, 16).ec != std::errc{})
|
||||
cfg_log.error("Failed to parse hex from string \"%s\"", str);
|
||||
return value;
|
||||
};
|
||||
return {string_to_hex(vid), string_to_hex(pid)};
|
||||
}
|
||||
|
||||
void cfg::device_entry::set_map(map_of_type<device_info>&& map)
|
||||
{
|
||||
m_map = std::move(map);
|
||||
|
|
|
@ -644,6 +644,7 @@ namespace cfg
|
|||
std::string serial;
|
||||
std::string vid;
|
||||
std::string pid;
|
||||
std::pair<u16, u16> get_usb_ids() const;
|
||||
};
|
||||
|
||||
class device_entry final : public _base
|
||||
|
|
|
@ -37,6 +37,12 @@ std::string utf16_to_utf8(std::u16string_view src)
|
|||
return converter.to_bytes(src.data());
|
||||
}
|
||||
|
||||
std::u16string utf8_to_utf16(std::string_view src)
|
||||
{
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> converter{};
|
||||
return converter.from_bytes(src.data());
|
||||
}
|
||||
|
||||
std::wstring utf8_to_wchar(std::string_view src)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
std::wstring utf8_to_wchar(std::string_view src);
|
||||
std::string wchar_to_utf8(std::wstring_view src);
|
||||
std::string utf16_to_utf8(std::u16string_view src);
|
||||
std::u16string utf8_to_utf16(std::string_view src);
|
||||
|
||||
// Copy null-terminated string from a std::string or a char array to a char array with truncation
|
||||
template <typename D, typename T>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue