mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-25 12:12:50 +01:00
Patch engine: add bd32, bd64 and utf8 patch types
bd32 is the same as be32 with a hint it's not executable. utf8 is NOT null-terminated string, null can be added manually.
This commit is contained in:
parent
00be247913
commit
629d608d4f
@ -44,9 +44,12 @@ void fmt_class_string<patch_type>::format(std::string& out, u64 arg)
|
||||
case patch_type::bef64: return "bef64";
|
||||
case patch_type::be16: return "be16";
|
||||
case patch_type::be32: return "be32";
|
||||
case patch_type::bd32: return "bd32";
|
||||
case patch_type::be64: return "be64";
|
||||
case patch_type::bd64: return "bd64";
|
||||
case patch_type::lef32: return "lef32";
|
||||
case patch_type::lef64: return "lef64";
|
||||
case patch_type::utf8: return "utf8";
|
||||
}
|
||||
|
||||
return unknown;
|
||||
@ -427,6 +430,10 @@ bool patch_engine::add_patch_data(YAML::Node node, patch_info& info, u32 modifie
|
||||
|
||||
switch (p_data.type)
|
||||
{
|
||||
case patch_type::utf8:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case patch_type::bef32:
|
||||
case patch_type::lef32:
|
||||
case patch_type::bef64:
|
||||
@ -568,6 +575,11 @@ static std::basic_string<u32> apply_modification(const patch_engine::patch_info&
|
||||
*reinterpret_cast<be_t<u16, 1>*>(ptr) = static_cast<u16>(p.value.long_value);
|
||||
break;
|
||||
}
|
||||
case patch_type::bd32:
|
||||
{
|
||||
*reinterpret_cast<be_t<u32, 1>*>(ptr) = static_cast<u32>(p.value.long_value);
|
||||
break;
|
||||
}
|
||||
case patch_type::be32:
|
||||
{
|
||||
*reinterpret_cast<be_t<u32, 1>*>(ptr) = static_cast<u32>(p.value.long_value);
|
||||
@ -579,6 +591,11 @@ static std::basic_string<u32> apply_modification(const patch_engine::patch_info&
|
||||
*reinterpret_cast<be_t<u32, 1>*>(ptr) = std::bit_cast<u32, f32>(static_cast<f32>(p.value.double_value));
|
||||
break;
|
||||
}
|
||||
case patch_type::bd64:
|
||||
{
|
||||
*reinterpret_cast<be_t<u64, 1>*>(ptr) = static_cast<u64>(p.value.long_value);
|
||||
break;
|
||||
}
|
||||
case patch_type::be64:
|
||||
{
|
||||
*reinterpret_cast<be_t<u64, 1>*>(ptr) = static_cast<u64>(p.value.long_value);
|
||||
@ -597,6 +614,11 @@ static std::basic_string<u32> apply_modification(const patch_engine::patch_info&
|
||||
*reinterpret_cast<be_t<u64, 1>*>(ptr) = std::bit_cast<u64, f64>(p.value.double_value);
|
||||
break;
|
||||
}
|
||||
case patch_type::utf8:
|
||||
{
|
||||
std::memcpy(ptr, p.original_value.data(), p.original_value.size());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Possibly an executable instruction
|
||||
|
@ -34,9 +34,12 @@ enum class patch_type
|
||||
lef64,
|
||||
be16,
|
||||
be32,
|
||||
bd32, // be32 with data hint (non-code)
|
||||
be64,
|
||||
bd64, // be64 with data hint (non-code)
|
||||
bef32,
|
||||
bef64,
|
||||
utf8, // Text of string (not null-terminated automatically)
|
||||
};
|
||||
|
||||
class patch_engine
|
||||
|
Loading…
Reference in New Issue
Block a user