summaryrefslogtreecommitdiff
path: root/patch.h
blob: eed7e584060ca5ddcb2650104be1a4d3f1879f11 (plain) (blame)
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
/*
	Copyright (C) 2020-2021 Reiko Asakura. All Rights Reserved.

	Moonshine
*/

#ifndef PATCH_H_
#define PATCH_H_

#include <taihen.h>

#define HOOK_NEXT(func, ...) TAI_NEXT(func##_hook, func##_hook_ref, ##__VA_ARGS__)

#define HOOK_OFFSET(modid, segidx, offset, thumb, func) \
	hook_offset(modid, segidx, offset, thumb, func##_hook, &func##_hook_id, &func##_hook_ref, #func)

#define UNHOOK(func) unhook(&func##_hook_id, func##_hook_ref, #func)

int hook_offset(
	SceUID modid, int segidx, int offset, int thumb, void *func,
	SceUID *hook_id, tai_hook_ref_t *hook_ref, const char *name);

int unhook(SceUID *hook_id, tai_hook_ref_t hook_ref, const char *name);

#endif /* PATCH_H_ */