Ind 945 Posted October 4, 2013 (edited) Hercules Plugin Manager: Hooking Hello~! What?! In March 1st we started the Hercules Renewal Phase One, in order to prepare Hercules for this update, and now 7 months later it's fully complete, we've gone all over the map-server's code, taken hundreds of notes, modified thousands of lines, and have greatly improved our knowledge, making it very much worth the effort. HPM Hooking Zero Processing OverheadNormally programs that avail hooking end up paying a price for it, processing-time-wise, HPM Design frees Hercules from that toll -- absolutely no processing overhead to functions not being hooked to. Smart, Flexible Design Hooks receive all function params as pointers, whereas the original is int pc_dropitem(struct map_session_data *sd,int n,int amount)the one for the hook shall be (struct map_session_data *sd,int *n,int *amount)which allows for hooks to modify any and all data as it pleases.postHooks receive one additional param, which accounts for the result of the original function, int <name>(int retVal, struct map_session_data *sd,int *n,int *amount)In this case it'd allow for the postHook to react properly to what the original returned, in this case (for pc_dropitem) 0 (failure) or 1 (success) Hooking is a simple operation, it is possible to hook an infinite number of times to the over 2k hookable functions (all the interfaced ones, accounting for over 99% of map server) HPExport void plugin_init (void) { addHookPre("pc->dropitem",my_pc_dropitem_preHook); /* int my_pc_dropitem_preHook(struct map_session_data *sd,int *n,int *amount) */ addHookPost("pc->dropitem",my_pc_dropitem_postHook);/* int my_pc_dropitem_postHook(int retVal, struct map_session_data *sd,int *n,int *amount) */ } DocumentationThe sample plugin has already been updated to demonstrate hooking, the documentation present in the wiki will be updated shortly. Hercules-Hooks Updates This covers how we'll maintain the hookable points up to date with the game server's code The cache that boosts the hooks -- Made Possible Thanks to Haruna! -- is maintained by an application, for a couple days it will remain like that so we can keep an eye on it and debug as we go, once we're confident with it we'll enable its standalone mode, which will make the process automatic (without the need for developers to proofread and approve) and able to follow up on any new commits within seconds of it landing on the repository. Also in Haruna has redesigned the Makefile for plugins, so those of you not using windows will need to re-enter your plugins in it (its much easier now, Haruna provided a very straight-forward documentation in the file) Pre-existing plugins will need to be recompiled, given the chances in the Hercules Plugin Manager, attempting to load any not-recompiled plugin will lead to it not being loaded (and a warning in console will be displayed) Design by Haruna, Xgear, Gepard and Ind Special Thanks to Hercules Team, Contributors, for all have contributed to us getting here, Thank you all very much! Takkun for the MSVC-2012 project files Haruna for the MSVC-2010 project files Link~u! Commit And - On the Horizon Script Engine UpdatesThose of you who lurk our page on github probably have already noticed some stuff from it, we'll soon be resuming, for those of you not familiar with it: Many syntax additions and improvements (Thanks to Haruna!) Limitless array support, improvements to array storage and processing Support for Char and Account variable arrays (and no more limit on amount of char/acc vars), improvements to processing and storage of char/acc variables. Catching UpWe hear you, we're lagging on staying up to date with the releases of other projects, we'll be prioritising towards catching up with them. Hercules Stress Test ServerI'll be delaying the release of our Stress Test Server, while it is now viable thanks to hooking, I'd like to prioritise catching up with other releases Edited February 7, 2017 by Ridley 16 sketchyphoenix, kyeme, Mystery and 13 others reacted to this Quote Share this post Link to post Share on other sites
hemagx 69 Posted October 4, 2013 Wew you awesome Quote Share this post Link to post Share on other sites
evilpuncker 504 Posted October 4, 2013 [*]Limitless array support, improvements to array storage and processing [*]Support for Char and Account variable arrays (and no more limit on amount of char/acc vars), improvements to processing and storage of char/acc variables. just, WOW Quote Share this post Link to post Share on other sites
Poison 10 Posted October 4, 2013 Script Engine Updates I second the motion, just WOW! :DD Quote Share this post Link to post Share on other sites
Uzieal 89 Posted October 5, 2013 And so it was written, let there be light. Quote Share this post Link to post Share on other sites
frenzmu06 5 Posted October 5, 2013 +1 to Hookers! o_O that sounds a bit different... Quote Share this post Link to post Share on other sites
sketchyphoenix 15 Posted October 5, 2013 Ind you know what time it is. 1 quesoph reacted to this Quote Share this post Link to post Share on other sites
KeiKun 8 Posted October 5, 2013 Ind you know what time it is. he doesn't know LOL GO LUA! Quote Share this post Link to post Share on other sites
Neo-Mind 264 Posted October 6, 2013 Go Hooks!! Ind you know what time it is. Oh YEA!!!! LUA time!! Quote Share this post Link to post Share on other sites
Kenpachi 65 Posted October 7, 2013 Finally hooking. There are many things which are much more important than an additional scripting language, guys... Quote Share this post Link to post Share on other sites
Ind 945 Posted October 16, 2013 The cache that boosts the hooks -- Made Possible Thanks to Haruna! -- is maintained by an application, for a couple days it will remain like that so we can keep an eye on it and debug as we go, once we're confident with it we'll enable its standalone mode, which will make the process automatic (without the need for developers to proofread and approve) and able to follow up on any new commits within seconds of it landing on the repository.This is now online, the application can now maintain the cache on its own, whenever commits that affect the HPM are made the application will follow up in a few seconds with the appropriate updates, in commits such as this https://github.com/HerculesWS/Hercules/commit/d93252a35eac6da8e06a1db016ea40d9d7fede00Made Possible Thanks to Haruna <3! 3 quesoph, JulioCF and Mystery reacted to this Quote Share this post Link to post Share on other sites