mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-05 22:47:03 +00:00
Fix std::basic_string warnings (#16261)
This commit is contained in:
parent
2262ac1684
commit
2b0f786b2d
22 changed files with 147 additions and 130 deletions
|
|
@ -27,7 +27,6 @@
|
|||
#include <span>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
#include <shared_mutex>
|
||||
#include "util/asm.hpp"
|
||||
|
||||
LOG_CHANNEL(ppu_loader);
|
||||
|
|
@ -683,7 +682,7 @@ extern bool ppu_register_library_lock(std::string_view libname, bool lock_lib)
|
|||
}
|
||||
|
||||
// Load and register exports; return special exports found (nameless module)
|
||||
static auto ppu_load_exports(const ppu_module& _module, ppu_linkage_info* link, u32 exports_start, u32 exports_end, bool for_observing_callbacks = false, std::vector<u32>* funcs = nullptr, std::basic_string<bool>* loaded_flags = nullptr)
|
||||
static auto ppu_load_exports(const ppu_module& _module, ppu_linkage_info* link, u32 exports_start, u32 exports_end, bool for_observing_callbacks = false, std::vector<u32>* funcs = nullptr, std::basic_string<char>* loaded_flags = nullptr)
|
||||
{
|
||||
std::unordered_map<u32, u32> result;
|
||||
|
||||
|
|
@ -984,7 +983,7 @@ static auto ppu_load_imports(const ppu_module& _module, std::vector<ppu_reloc>&
|
|||
}
|
||||
|
||||
// For _sys_prx_register_module
|
||||
void ppu_manual_load_imports_exports(u32 imports_start, u32 imports_size, u32 exports_start, u32 exports_size, std::basic_string<bool>& loaded_flags)
|
||||
void ppu_manual_load_imports_exports(u32 imports_start, u32 imports_size, u32 exports_start, u32 exports_size, std::basic_string<char>& loaded_flags)
|
||||
{
|
||||
auto& _main = g_fxo->get<main_ppu_module>();
|
||||
auto& link = g_fxo->get<ppu_linkage_info>();
|
||||
|
|
@ -1289,7 +1288,7 @@ static void ppu_check_patch_spu_images(const ppu_module& mod, const ppu_segment&
|
|||
std::string name;
|
||||
std::string dump;
|
||||
|
||||
std::basic_string<u32> applied;
|
||||
std::vector<u32> applied;
|
||||
|
||||
// Executable hash
|
||||
sha1_context sha2;
|
||||
|
|
@ -1363,12 +1362,12 @@ static void ppu_check_patch_spu_images(const ppu_module& mod, const ppu_segment&
|
|||
}
|
||||
|
||||
// Apply the patch
|
||||
applied += g_fxo->get<patch_engine>().apply(hash, [&](u32 addr, u32 /*size*/) { return addr + elf_header + prog.p_offset; }, prog.p_filesz, prog.p_vaddr);
|
||||
g_fxo->get<patch_engine>().apply(applied, hash, [&](u32 addr, u32 /*size*/) { return addr + elf_header + prog.p_offset; }, prog.p_filesz, prog.p_vaddr);
|
||||
|
||||
if (!Emu.GetTitleID().empty())
|
||||
{
|
||||
// Alternative patch
|
||||
applied += g_fxo->get<patch_engine>().apply(Emu.GetTitleID() + '-' + hash, [&](u32 addr, u32 /*size*/) { return addr + elf_header + prog.p_offset; }, prog.p_filesz, prog.p_vaddr);
|
||||
g_fxo->get<patch_engine>().apply(applied, Emu.GetTitleID() + '-' + hash, [&](u32 addr, u32 /*size*/) { return addr + elf_header + prog.p_offset; }, prog.p_filesz, prog.p_vaddr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1830,7 +1829,7 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, bool virtual_lo
|
|||
liblv2_end = prx->segs[0].addr + prx->segs[0].size;
|
||||
}
|
||||
|
||||
std::basic_string<u32> applied;
|
||||
std::vector<u32> applied;
|
||||
|
||||
for (usz i = Emu.DeserialManager() ? prx->segs.size() : 0; i < prx->segs.size(); i++)
|
||||
{
|
||||
|
|
@ -1841,18 +1840,19 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, bool virtual_lo
|
|||
const std::string hash_seg = fmt::format("%s-%u", hash, i);
|
||||
|
||||
// Apply the patch
|
||||
auto _applied = g_fxo->get<patch_engine>().apply(hash_seg, [&](u32 addr, u32 size) { return prx->get_ptr<u8>(addr + seg.addr, size); }, seg.size);
|
||||
std::vector<u32> _applied;
|
||||
g_fxo->get<patch_engine>().apply(_applied, hash_seg, [&](u32 addr, u32 size) { return prx->get_ptr<u8>(addr + seg.addr, size); }, seg.size);
|
||||
|
||||
if (!Emu.GetTitleID().empty())
|
||||
{
|
||||
// Alternative patch
|
||||
_applied += g_fxo->get<patch_engine>().apply(Emu.GetTitleID() + '-' + hash_seg, [&](u32 addr, u32 size) { return prx->get_ptr<u8>(addr + seg.addr, size); }, seg.size);
|
||||
g_fxo->get<patch_engine>().apply(_applied, Emu.GetTitleID() + '-' + hash_seg, [&](u32 addr, u32 size) { return prx->get_ptr<u8>(addr + seg.addr, size); }, seg.size);
|
||||
}
|
||||
|
||||
// Rebase patch offsets
|
||||
std::for_each(_applied.begin(), _applied.end(), [&](u32& res) { if (res != umax) res += seg.addr; });
|
||||
|
||||
applied += _applied;
|
||||
applied.insert(applied.end(), _applied.begin(), _applied.end());
|
||||
|
||||
if (_applied.empty())
|
||||
{
|
||||
|
|
@ -1877,10 +1877,11 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, bool virtual_lo
|
|||
// Find the first segment
|
||||
if (prog.p_type == 0x1u /* LOAD */ && prog.p_memsz)
|
||||
{
|
||||
std::basic_string_view<uchar> elf_memory{prog.bin.data(), prog.bin.size()};
|
||||
elf_memory.remove_prefix(end - prx->segs[0].addr);
|
||||
std::span<const uchar> elf_memory{prog.bin.begin(), prog.bin.size()};
|
||||
elf_memory = elf_memory.subspan(end - prx->segs[0].addr);
|
||||
|
||||
if (elf_memory != std::basic_string_view<uchar>{&prx->get_ref<uchar>(end), elf_memory.size()})
|
||||
const auto tmp = std::span<uchar>{&prx->get_ref<uchar>(end), elf_memory.size()};
|
||||
if (!std::equal(elf_memory.begin(), elf_memory.end(), tmp.begin(), tmp.end()))
|
||||
{
|
||||
// There are changes, disable analysis optimization
|
||||
ppu_loader.notice("Disabling analysis optimization due to memory changes from original file");
|
||||
|
|
@ -2198,12 +2199,13 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str
|
|||
Emu.SetExecutableHash(hash);
|
||||
|
||||
// Apply the patch
|
||||
auto applied = g_fxo->get<patch_engine>().apply(!ar ? hash : std::string{}, [&](u32 addr, u32 size) { return _main.get_ptr<u8>(addr, size); });
|
||||
std::vector<u32> applied;
|
||||
g_fxo->get<patch_engine>().apply(applied, !ar ? hash : std::string{}, [&](u32 addr, u32 size) { return _main.get_ptr<u8>(addr, size); });
|
||||
|
||||
if (!ar && !Emu.GetTitleID().empty())
|
||||
{
|
||||
// Alternative patch
|
||||
applied += g_fxo->get<patch_engine>().apply(Emu.GetTitleID() + '-' + hash, [&](u32 addr, u32 size) { return _main.get_ptr<u8>(addr, size); });
|
||||
g_fxo->get<patch_engine>().apply(applied, Emu.GetTitleID() + '-' + hash, [&](u32 addr, u32 size) { return _main.get_ptr<u8>(addr, size); });
|
||||
}
|
||||
|
||||
if (!applied.empty() || ar)
|
||||
|
|
@ -2216,10 +2218,11 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str
|
|||
// Find the first segment
|
||||
if (prog.p_type == 0x1u /* LOAD */ && prog.p_memsz)
|
||||
{
|
||||
std::basic_string_view<uchar> elf_memory{prog.bin.data(), prog.bin.size()};
|
||||
elf_memory.remove_prefix(end - _main.segs[0].addr);
|
||||
std::span<const uchar> elf_memory{prog.bin.begin(), prog.bin.size()};
|
||||
elf_memory = elf_memory.subspan(end - _main.segs[0].addr);
|
||||
|
||||
if (elf_memory != std::basic_string_view<uchar>{&_main.get_ref<u8>(end), elf_memory.size()})
|
||||
const auto tmp = std::span<uchar>{&_main.get_ref<u8>(end), elf_memory.size()};
|
||||
if (!std::equal(elf_memory.begin(), elf_memory.end(), tmp.begin(), tmp.end()))
|
||||
{
|
||||
// There are changes, disable analysis optimization
|
||||
ppu_loader.notice("Disabling analysis optimization due to memory changes from original file");
|
||||
|
|
@ -2881,12 +2884,13 @@ std::pair<std::shared_ptr<lv2_overlay>, CellError> ppu_load_overlay(const ppu_ex
|
|||
}
|
||||
|
||||
// Apply the patch
|
||||
auto applied = g_fxo->get<patch_engine>().apply(!Emu.DeserialManager() ? hash : std::string{}, [ovlm](u32 addr, u32 size) { return ovlm->get_ptr<u8>(addr, size); });
|
||||
std::vector<u32> applied;
|
||||
g_fxo->get<patch_engine>().apply(applied, !Emu.DeserialManager() ? hash : std::string{}, [ovlm](u32 addr, u32 size) { return ovlm->get_ptr<u8>(addr, size); });
|
||||
|
||||
if (!Emu.DeserialManager() && !Emu.GetTitleID().empty())
|
||||
{
|
||||
// Alternative patch
|
||||
applied += g_fxo->get<patch_engine>().apply(Emu.GetTitleID() + '-' + hash, [ovlm](u32 addr, u32 size) { return ovlm->get_ptr<u8>(addr, size); });
|
||||
g_fxo->get<patch_engine>().apply(applied, Emu.GetTitleID() + '-' + hash, [ovlm](u32 addr, u32 size) { return ovlm->get_ptr<u8>(addr, size); });
|
||||
}
|
||||
|
||||
if (!applied.empty() || ar)
|
||||
|
|
@ -2899,10 +2903,10 @@ std::pair<std::shared_ptr<lv2_overlay>, CellError> ppu_load_overlay(const ppu_ex
|
|||
// Find the first segment
|
||||
if (prog.p_type == 0x1u /* LOAD */ && prog.p_memsz)
|
||||
{
|
||||
std::basic_string_view<uchar> elf_memory{prog.bin.data(), prog.bin.size()};
|
||||
elf_memory.remove_prefix(end - ovlm->segs[0].addr);
|
||||
std::span<const uchar> elf_memory{prog.bin.begin(), prog.bin.size()};
|
||||
elf_memory = elf_memory.subspan(end - ovlm->segs[0].addr);
|
||||
|
||||
if (elf_memory != std::basic_string_view<uchar>{&ovlm->get_ref<u8>(end), elf_memory.size()})
|
||||
if (!std::equal(elf_memory.begin(), elf_memory.end(), &ovlm->get_ref<u8>(end)))
|
||||
{
|
||||
// There are changes, disable analysis optimization
|
||||
ppu_loader.notice("Disabling analysis optimization due to memory changes from original file");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue