mirror of
https://git.checksum.fail/alec/erythros
synced 2025-12-12 14:09:54 +02:00
28 lines
534 B
HolyC
28 lines
534 B
HolyC
|
|
U0 @function_insert_call(U32 from, U32 to)
|
||
|
|
{
|
||
|
|
*(from(U8*)) = 0xE8;
|
||
|
|
*((from + 1)(I32*)) = to - from - 5;
|
||
|
|
}
|
||
|
|
|
||
|
|
U0 @function_patch(U32 from, U32 to)
|
||
|
|
{
|
||
|
|
*(from(U8*)) = 0xE9;
|
||
|
|
*((from + 1)(I32*)) = to - from - 5;
|
||
|
|
}
|
||
|
|
|
||
|
|
class @function
|
||
|
|
{
|
||
|
|
U0(*InsertCall)
|
||
|
|
(U32 from, U32 to);
|
||
|
|
U0(*Patch)
|
||
|
|
(U32 from, U32 to);
|
||
|
|
};
|
||
|
|
|
||
|
|
@function Function;
|
||
|
|
Function.InsertCall = &@function_insert_call;
|
||
|
|
Function.Patch = &@function_patch;
|
||
|
|
|
||
|
|
// usage: Function.InsertCall(addr, &func);
|
||
|
|
// usage: Function.Patch(&old_func, &new_func);
|
||
|
|
|
||
|
|
"function ";
|