mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-12 09:48:37 +12:00
Patches/PPU: Extend and improve patching capabilities (code allocations, jumps to any address) (#10779)
* Patches/PPU: Implement dynamic code allocation + Any-Address jump patches Also fix deallocation path of fixed allocation patches.
This commit is contained in:
parent
ee6e4c493d
commit
b40ed5bdb7
8 changed files with 339 additions and 72 deletions
|
@ -27,6 +27,8 @@ enum class patch_type
|
|||
invalid,
|
||||
load,
|
||||
alloc, // Allocate memory at address (zeroized executable memory)
|
||||
code_alloc,// Allocate memory somewhere, saves branch to memory at specfied address (filled with PPU NOP and branch for returning)
|
||||
jump, // Install special 32-bit jump instruction (PPU only atm)
|
||||
byte,
|
||||
le16,
|
||||
le32,
|
||||
|
@ -56,6 +58,7 @@ public:
|
|||
u64 long_value;
|
||||
f64 double_value;
|
||||
} value{0};
|
||||
mutable u32 alloc_addr = 0; // Used to save optional allocation address (if occured)
|
||||
};
|
||||
|
||||
using patch_app_versions = std::unordered_map<std::string /*app_version*/, bool /*enabled*/>;
|
||||
|
@ -148,6 +151,9 @@ public:
|
|||
// Apply patch (returns the number of entries applied)
|
||||
std::basic_string<u32> apply(const std::string& name, u8* dst, u32 filesz = -1, u32 min_addr = 0);
|
||||
|
||||
// Deallocate memory used by patches
|
||||
void unload(const std::string& name);
|
||||
|
||||
private:
|
||||
// Database
|
||||
patch_map m_map{};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue