@@ -182,20 +182,49 @@ Depending on the type of function you are attempting to hook and what you want t
182
182
==== Const Functions
183
183
184
184
When hooking a `const` function you will need to prefix the "self" pointer with `const`.
185
- [horizontal]
186
- *Non-Const Function*:: `(auto& scope, SomeClass* self)`
187
- *Const Function*:: `(auto& scope, *const* SomeClass* self)`
185
+
186
+ [cols="1,4a"]
187
+ |===
188
+ | Is Const? | Format
189
+
190
+ | Non-Const
191
+ | `(auto& scope, SomeClass* self)`
192
+
193
+ | Const
194
+ | `(auto& scope, *const* SomeClass* self)`
195
+
196
+ |===
188
197
189
198
==== Hooking AFTER
190
199
191
200
For "after" hooks, add the `_AFTER` postfix to the macro names.
192
201
193
- Be aware that the hook function signature changes accordingly and will no longer need the "scope":
194
- [horizontal]
195
- *Non-Virtual*:: `SUBSCRIBE_METHOD_AFTER(SomeClass::MemberFunction, []([*return value by reference,*] SomeClass* self [*,parameters*]))`
196
- *Virtual*:: `SUBSCRIBE_METHOD_VIRTUAL_AFTER(SomeClass::MemberFunction, []([*return value by reference,*] SomeClass* self [*,parameters*]))`
202
+ Be aware that the hook function signature changes accordingly and no longer needs the "scope".
203
+
204
+ The below examples are for non-virtual functions.
205
+ For virtual functions, use `SUBSCRIBE_METHOD_VIRTUAL_AFTER` instead of `SUBSCRIBE_METHOD_AFTER`.
206
+
207
+ [cols="1,1,4a"]
208
+ |===
209
+ | Return? | Parameters? | Format
210
+
211
+ | ❌
212
+ | ❌
213
+ | `SUBSCRIBE_METHOD_AFTER(SomeClass::MemberFunction, [](SomeClass* self))`
214
+
215
+ | ✔️
216
+ | ❌
217
+ | `SUBSCRIBE_METHOD_AFTER(SomeClass::MemberFunction, [](auto returnValue, SomeClass* self))`
218
+
219
+ | ❌
220
+ | ✔️
221
+ | `SUBSCRIBE_METHOD_AFTER(SomeClass::MemberFunction, [](SomeClass* self, int arg1, int arg2))`
222
+
223
+ | ✔️
224
+ | ✔️
225
+ | `SUBSCRIBE_METHOD_AFTER(SomeClass::MemberFunction, [](auto returnValue, SomeClass* self, int arg1, int arg2))`
197
226
198
- **★ [*return value by reference,*] and [*,parameters*] are to be replaced if present, do NOT leave it as is!**
227
+ |===
199
228
200
229
==== FORCEINLINE Functions
201
230
0 commit comments