[Include] Southclaw's & Pottus's Anti-cheat patches
#13

Quote:
Originally Posted by ******
View Post
Could I make a request (partially a suggestion). You explicitly mention that this should be included before YSI, and I agree, but there are a few things to be aware of with that:

1) You say you can use y_iterate, but if you include these patches before YSI the "foreach" macro won't yet exist and that code will never be used even if it is included later.

2) y_hooks in YSI 4.0 is awkward to deal with in terms of orderings. Currently y_hooks hooks always come before ALS hooks, even if they appear later in source code, the ordering is changed (or, more accurately, set) at run-time, not compile-time. I have a solution to this that will be released shortly (I am now back home), but the solution requires some co-operation from other library developers that want their code to come before any y_hooks code. "Breaking" an ALS chain is tricky as you need to be able to detect the chain, but this can be done. I want to try and figure out an even better way of specifying ordering, but for now this is the best I have come up with. Instead of your current hooking method use:

pawn Code:
// This function has two purposes - defines 3 states, and declares your ALS prefix.
// You seem to use different prefixes for each callback though, I'm not sure that's a
// good idea and will make detection MUCH harder.
forward @@@_AC();
// The function is never called, but can be found by the "@@@_" prefix.
public @@@_AC() <AC_state : AC_state1> {}
public @@@_AC() <AC_state : AC_state2> {}
public @@@_AC() <AC_state : AC_state3> {}

#define AC_FORWARD%0(%1) \
    forward%0(%1); \
    public%0(%1)<> return 0; \
    public%0(%1)<AC_state : AC_state1> return 0

// Now this is a normal callback.
public OnPlayerDisconnect(playerid, reason)
{
    // And this is the hook, no wrapping of any kind required.
    return AC_OnPlayerDisconnect(playerid, reason);
}

#if defined _ALS_OnPlayerDisconnect
    #undef OnPlayerDisconnect
#else
    #define _ALS_OnPlayerDisconnect
#endif
#define OnPlayerDisconnect(%0) AC_OnPlayerDisconnect(%0) <AC_state : AC_state2>

AC_FORWARD AC_OnPlayerDisconnect(playerid, reason);
Using that, the order hooks are done in becomes:

- State-based hooks.
- y_hooks.
- ALS hooks.
- Public function.

If you need me to explain the issues in more depth, or would like to discuss alternate solutions (I would), feel free to contact me here or on IRC. This is a VERY brief post on the issue, and I wish there was a better way. Note that you also need:

pawn Code:
state AC_state : AC_state2;
Somewhere to make the whole thing work, but you could add that to every callback, I just prefer doing it in OnGameModeInit (etc).

Other than that, nice.
They already did when they first posted: "- Patches are to be designed to be included BEFORE YSI"
Reply


Messages In This Thread
Southclaw's & Pottus's Anti-cheat patches - by Pottus - 02.04.2014, 23:54
Re: Southclaw's & Pottus's Anti-cheat patches - by RenovanZ - 03.04.2014, 01:36
Re: Southclaw's & Pottus's Anti-cheat patches - by Whitetiger - 03.04.2014, 01:42
Re: Southclaw's & Pottus's Anti-cheat patches - by Pottus - 03.04.2014, 01:57
Re: Southclaw's & Pottus's Anti-cheat patches - by awsomedude - 03.04.2014, 03:50
Re: Southclaw's & Pottus's Anti-cheat patches - by Niko_boy - 03.04.2014, 03:54
Re: Southclaw's & Pottus's Anti-cheat patches - by Lorenc_ - 03.04.2014, 06:07
Re: Southclaw's & Pottus's Anti-cheat patches - by iZN - 03.04.2014, 08:12
Re: Southclaw's & Pottus's Anti-cheat patches - by Kar - 03.04.2014, 12:36
Re: Southclaw's & Pottus's Anti-cheat patches - by Pottus - 03.04.2014, 13:03
Re: Southclaw's & Pottus's Anti-cheat patches - by shittt - 03.04.2014, 13:15
Respuesta: Southclaw's & Pottus's Anti-cheat patches - by MugiwaraNoLuffy - 05.04.2014, 05:51
Re: Southclaw's & Pottus's Anti-cheat patches - by Kyle - 08.04.2014, 09:51
Re: Southclaw's & Pottus's Anti-cheat patches - by Admigo - 08.04.2014, 14:08
Re: Southclaw's & Pottus's Anti-cheat patches - by Kyra - 08.04.2014, 20:12
Re: Southclaw's & Pottus's Anti-cheat patches - by Pottus - 09.04.2014, 00:31
Respuesta: Re: Southclaw's & Pottus's Anti-cheat patches - by MugiwaraNoLuffy - 09.04.2014, 03:41
Re: Southclaw's & Pottus's Anti-cheat patches - by kristo - 13.04.2014, 13:18
Re: Southclaw's & Pottus's Anti-cheat patches - by Pottus - 13.04.2014, 13:22
Re: Southclaw's & Pottus's Anti-cheat patches - by SkittlesAreFalling - 14.04.2014, 03:46
Re: Southclaw's & Pottus's Anti-cheat patches - by iRaiDeN - 14.04.2014, 08:22
Re: Southclaw's & Pottus's Anti-cheat patches - by Kyra - 14.04.2014, 21:04
Re: Southclaw's & Pottus's Anti-cheat patches - by NoahF - 20.04.2014, 11:27
Re: Southclaw's & Pottus's Anti-cheat patches - by Kyra - 11.05.2014, 17:52
Re: Southclaw's & Pottus's Anti-cheat patches - by Pottus - 15.05.2014, 12:28
Re: Southclaw's & Pottus's Anti-cheat patches - by Admigo - 15.05.2014, 14:53
Re: Southclaw's & Pottus's Anti-cheat patches - by Kyra - 17.05.2014, 20:32
Re: Southclaw's & Pottus's Anti-cheat patches - by Chrillzen - 04.10.2014, 12:22
Re: Southclaw's & Pottus's Anti-cheat patches - by Chefгo - 28.10.2014, 14:03
Re: Southclaw's & Pottus's Anti-cheat patches - by Alex Magaсa - 28.10.2014, 15:48
Re: Southclaw's & Pottus's Anti-cheat patches - by Chefгo - 28.10.2014, 16:41
Re: Southclaw's & Pottus's Anti-cheat patches - by Pottus - 01.11.2014, 05:25
Re: Southclaw's & Pottus's Anti-cheat patches - by Pottus - 02.11.2014, 01:15
Re: Southclaw's & Pottus's Anti-cheat patches - by Killa[DGZ] - 02.11.2014, 01:24
Re: Southclaw's & Pottus's Anti-cheat patches - by Killa[DGZ] - 02.11.2014, 01:33
Re: Southclaw's & Pottus's Anti-cheat patches - by Pottus - 02.11.2014, 01:35
Re: Southclaw's & Pottus's Anti-cheat patches - by Killa[DGZ] - 02.11.2014, 01:39
Re: Southclaw's & Pottus's Anti-cheat patches - by Killa[DGZ] - 02.11.2014, 02:28
Re: Southclaw's & Pottus's Anti-cheat patches - by Jakwob - 18.11.2014, 19:51
Re: Southclaw's & Pottus's Anti-cheat patches - by PaulDinam - 15.01.2015, 13:16
Re: Southclaw's & Pottus's Anti-cheat patches - by HydraHumza - 01.03.2015, 03:53
Re: Southclaw's & Pottus's Anti-cheat patches - by Yashas - 02.05.2015, 15:02
Re: Southclaw's & Pottus's Anti-cheat patches - by Pottus - 02.05.2015, 15:05
Re: Southclaw's & Pottus's Anti-cheat patches - by GameR16 - 01.06.2015, 14:51
Re: Southclaw's & Pottus's Anti-cheat patches - by anime107 - 15.07.2015, 21:55
Re: Southclaw's & Pottus's Anti-cheat patches - by Yashas - 05.10.2015, 09:37
Re: Southclaw's & Pottus's Anti-cheat patches - by qilia - 07.10.2015, 23:43
Re: Southclaw's & Pottus's Anti-cheat patches - by thaKing - 08.10.2015, 04:28
Re: Southclaw's & Pottus's Anti-cheat patches - by T-N-Z - 21.11.2015, 20:27
Re: Southclaw's & Pottus's Anti-cheat patches - by Yashas - 22.11.2015, 11:38
Re: Southclaw's & Pottus's Anti-cheat patches - by Mister0 - 22.08.2016, 22:16
Re: Southclaw's & Pottus's Anti-cheat patches - by Abagail - 22.08.2016, 23:27
Re: Southclaw's & Pottus's Anti-cheat patches - by PT - 14.01.2017, 19:48

Forum Jump:


Users browsing this thread: 2 Guest(s)