-
Notifications
You must be signed in to change notification settings - Fork 11
/
patch.h
46 lines (39 loc) · 1.55 KB
/
patch.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* ff7_opengl - Complete OpenGL replacement of the Direct3D renderer used in
* the original ports of Final Fantasy VII and Final Fantasy VIII for the PC.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* patch.h - helper functions for runtime code patching
*/
#ifndef _PATCH_H_
#define _PATCH_H_
#include "types.h"
#include "globals.h"
#include "log.h"
uint replace_function(uint offset, void *func);
void unreplace_function(uint func);
void unreplace_functions();
void replace_call(uint offset, void *func);
uint get_relative_call(uint base, uint offset);
uint get_absolute_value(uint base, uint offset);
void patch_code_byte(uint offset, unsigned char r);
void patch_code_word(uint offset, word r);
void patch_code_uint(uint offset, uint r);
void patch_code_float(uint offset, float r);
void patch_code_double(uint offset, double r);
void memcpy_code(uint offset, void *data, uint size);
void memset_code(uint offset, uint val, uint size);
#endif