302 log_info(
"| - ToolboxAPI Wrappers");
307 log_info(
"| - IteratorAPI Wrappers");
311 log_info(
"| - BuildingAPI Wrappers");
347 log_info(
"| - RegistrationAPI Wrappers");
372static void initialize_spelltype_hook()
382static void initialize_spell_trigger_hook()
392static void initialize_building_done_hook()
413static void initialize_building_entry_hook()
423static void initialize_subeffect_add_hook()
440static void initialize_spellend_hook()
458static void initialize_spellrefresh_hook()
471static void __declspec(naked) menuload_hook_beta()
473 asm (
"push %%edi \n\t"
532static void initialize_ui_overlay_fix_hook()
557static void initialize_menuload_hook()
566static void initialize_deal_damage_hook()
577static void initialize_onhit_hook()
585static void initialize_ai_support_spell_hook()
595static void initialize_ai_offensive_hook()
612static void initialize_ai_aoe_hook()
627static void initialize_avoidance_hook()
639static void __declspec(naked) ranged_exp_beta()
641 asm (
"cmpw $0x11, %%ax \n\t"
643 "cmpw $0x16, %%ax \n\t"
646 "1: jmp *%0 \n\t" : :
649static void initialize_utility_hooks()
651 log_info(
"Hooking Combat Ability Detection");
658 log_info(
"Hooking AOE Spell Detection");
672 log_info(
"Hooking Black Aura Detection");
679 log_info(
"Hooking White Aura Detection");
686 log_info(
"Hooking Summon Spell Line Detection");
693 log_info(
"Hooking Domination Spell Detection");
700 log_info(
"Hooking Domination Spell Line Detection");
725static void initialize_spell_buttons_hooks()
748static void initialize_worker_logic_hooks()
877 initialize_spelltype_hook();
880 initialize_spell_trigger_hook();
882 log_info(
"Hooking Spell Refresh Triggers");
883 initialize_spellrefresh_hook();
885 log_info(
"Hooking Spell End Triggers");
886 initialize_spellend_hook();
888 log_info(
"Hooking Deal Damage Trigger");
889 initialize_deal_damage_hook();
891 log_info(
"Hooking AddSpellFromEffect function");
892 initialize_subeffect_add_hook();
894 log_info(
"Dirty Menu Loading Trigger Test");
895 initialize_menuload_hook();
898 initialize_onhit_hook();
900 log_info(
"Hooking AI Support Spell Handling");
901 initialize_ai_support_spell_hook();
903 log_info(
"Hooking AI Offensive Spell Handling");
904 initialize_ai_offensive_hook();
906 log_info(
"Hooking AI Spell Avoidance Handling");
907 initialize_avoidance_hook();
909 log_info(
"Hook UI Overlay to Fix Descriptions");
910 initialize_ui_overlay_fix_hook();
913 initialize_ai_aoe_hook();
915 log_info (
"Hooking Building Done Handling");
916 initialize_building_done_hook();
918 log_info (
"Hooking Building Entry Handling");
919 initialize_building_entry_hook();
922 initialize_worker_logic_hooks();
924 log_info(
"Hooking Utility Functions");
925 initialize_utility_hooks();
928 initialize_spell_buttons_hooks();
RegistrationFunctions * registrationAPI
SpellFunctions * spellAPI
FigureFunctions * figureAPI
ToolboxFunctions * toolboxAPI
uint32_t __thiscall rank_support_spell_hook(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
Injects into the ranking system for a single target AI spell.
uint32_t __thiscall avoidance_penalty_hook(SF_CGdBattleDevelopment *_this, uint16_t figure_index)
uint32_t __thiscall rank_offensive_spell_hook(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall ai_AOE2_hook(SF_CGdBattleDevelopment *_this, SF_Coord *cast_pos, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall ai_AOE_hook(SF_CGdBattleDevelopment *_this, SF_Coord cast_pos, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
void initialize_campaign_hooks()
void initialize_console_data_hooks()
uint32_t g_damage_return_addr
void sf_damage_hook()
Hook function for damage handling in the game. This function intercepts the call to deal damage and r...
void __thiscall sf_spelleffect_hook(SF_CGdSpell *_this)
void __thiscall sf_endspell_hook(SF_CGdSpell *_this, uint16_t spell_index)
void initialize_data_hooks()
Used to initialize all disparate hooks in one place.
EffectFunctions effectAPI
void initialize_beta_hooks()
IteratorFunctions iteratorAPI
BuildingFunctions buildingAPI
uint32_t g_ranged_return_fail
uint32_t g_ranged_return_ok
int __thiscall sf_refresh_hook(SF_CGdSpell *_this, uint16_t spell_index)
void initialize_spelltype_data_hooks()
uint16_t __thiscall sf_spelltype_hook(SF_CGdSpell *_this, uint16_t spell_id, uint16_t param2, SF_CGdTargetData *source, SF_CGdTargetData *target, uint16_t param5)
bool __thiscall is_summon_spellline(SF_CGdSpell *_this, GdSpellLine spell_line)
bool __thiscall is_white_aura_spell(SF_CGdSpell *_this, GdSpellLine spell_line)
bool __thiscall is_aura_spell(SF_CGdSpell *_this, GdSpellLine spell_line)
bool __thiscall is_combat_ability(SF_CGdSpell *_this, GdSpellLine spell_line)
bool __thiscall is_domination_spell(SF_CGdSpell *_this, GdSpellLine spell_line)
bool __thiscall is_aoe_spell(SF_CGdSpell *_this, GdSpellLine spell_line)
bool __thiscall is_domination_spellline(SF_CGdSpell *_this, GdSpellLine spell_line)
bool __thiscall is_black_aura_spell(SF_CGdSpell *_this, GdSpellLine spell_line)
bool __thiscall buildingIsForge(SF_CGdBuilding *_this, uint16_t building_index)
bool __thiscall buildingIsMoonsilverMine(SF_CGdBuilding *_this, uint16_t building_index)
bool __thiscall buildingIsShrine(SF_CGdBuilding *_this, uint16_t building_index)
void __thiscall addBonusMultToStatistic(SF_CGdFigure *figure, StatisticDataKey key, uint16_t target, int8_t value)
bool __thiscall buildingIsSawmill(SF_CGdBuilding *_this, uint16_t building_index)
uint32_t __thiscall getDistance(SF_Coord *pointA, SF_Coord *pointB)
bool __thiscall buildingIsHabitable(SF_CGdBuilding *_this, uint16_t building_index)
bool __thiscall buildingIsGatherer(SF_CGdBuilding *_this, uint16_t building_index)
bool __thiscall buildingIsHunter(SF_CGdBuilding *_this, uint16_t building_index)
bool __thiscall buildingIsScavenger(SF_CGdBuilding *_this, uint16_t building_index)
bool __thiscall buildingIsFisher(SF_CGdBuilding *_this, uint16_t building_index)
bool __thiscall buildingIsWoodcutter(SF_CGdBuilding *_this, uint16_t building_index)
uint16_t __thiscall getCurrentStat(SF_CGdFigure *_this, uint16_t target, StatisticDataKey key)
bool __thiscall XDataExists(SF_CGdEffect *_this, uint16_t effect_index, SpellDataKey data)
bool __thiscall buildingIsIronMine(SF_CGdBuilding *_this, uint16_t building_index)
void __thiscall setupFigureIterator(CGdFigureIterator *iterator, SF_CGdSpell *spell)
bool __thiscall buildingIsHQ(SF_CGdBuilding *_this, uint16_t building_index)
uint16_t __thiscall getPhysDamageReduction(SF_CGdFigureToolbox *_this, uint16_t source_index, uint16_t target_index, uint16_t action_id)
bool __thiscall buildingIsHabitableSingle(SF_CGdBuilding *_this, uint16_t building_index)
bool __thiscall hasBuildingTag(uint8_t building_type, BuildingTag tag)
bool __thiscall isSiegeUnit(SF_CGdFigure *_this, uint16_t figure_index)
bool __thiscall buildingIsFoodstore(SF_CGdBuilding *_this, uint16_t building_index)
bool __thiscall buildingIsStonecutter(SF_CGdBuilding *_this, uint16_t building_index)
bool __thiscall buildingIsTemple(SF_CGdBuilding *_this, uint16_t building_index)
void log_debug(DebugLevel level, const char *format,...)
bool __thiscall hasSpellTag(uint16_t spell_id, SpellTag tag)
bool __thiscall hasAuraActive(SF_CGdFigureToolbox *_this, uint16_t figure_id)
void __thiscall spellClearFigureFlag(SF_CGdSpell *_this, uint16_t spell_id, SpellFlagKey key)
void __thiscall tryClearCheckSpellsBeforeJob(SF_CGdSpell *_this, uint16_t spell_index, uint16_t figure_index)
bool __thiscall buildingIsQuarry(SF_CGdBuilding *_this, uint16_t building_index)
uint16_t __thiscall getMaxStat(SF_CGdFigure *_this, uint16_t target, StatisticDataKey key)
void __thiscall disposeFigureIterator(CGdFigureIterator *iterator)
bool __thiscall buildingIsTower(SF_CGdBuilding *_this, uint16_t building_index)
void initialize_wrapper_data_hooks()
uint16_t __thiscall sf_get_spell_id(SF_CGdSpell *_this, uint16_t spell_index)
void log_info(const char *format,...)
bool __thiscall buildingIsMaceCarver(SF_CGdBuilding *_this, uint16_t building_index)
bool __thiscall buildingIsSmelter(SF_CGdBuilding *_this, uint16_t building_index)
uint32_t __thiscall getBuildingXData(SF_CGdBuildingToolbox *_this, uint16_t building_index, uint8_t key_type)
int AddrOf(int offset)
returns "real" virtual address of given memory offset
bool BeginRewrite(MemoryRegion &mem_region)
allows rewriting code in a given memory region by overwriting permissions for that memory region
bool EndRewrite(MemoryRegion &mem_region)
ends rewriting by restoring old permissions in a given memory region
void __thiscall sf_building_done_hook(SF_CGdBuildingToolbox *_this, uint16_t building_index)
void initialize_building_done_hooks()
void __thiscall job_start_working_at_building_hook(SF_CGdFigureJobs *_this, uint16_t figure_id)
void __thiscall sf_figure_end_spells_hook(SF_CGdFigureToolbox *_this, uint16_t figure_id)
void __thiscall applyBuildingTag(SFBuilding *spell, BuildingTag tag)
void __thiscall linkAOEAIHandler(SFSpell *spell, ai_aoe_handler_ptr handler)
#define DEFINE_FUNCTION(group, name, address)
void __thiscall linkEndHandler(SFSpell *spell, handler_ptr endHandler)
SFBuilding *__thiscall registerBuilding(uint8_t building_type)
void __thiscall linkDealDamageHandler(SFSpell *spell, damage_handler_ptr handler, SpellDamagePhase phase)
void __thiscall applySpellTag(SFSpell *spell, SpellTag tag)
void __thiscall linkTypeHandler(SFSpell *spell, handler_ptr typeHandler)
#define INCLUDE_FUNCTION(group, name, pointer)
void __thiscall linkEnchantChanceHandler(SFSpell *spell, enchant_handler_ptr handler)
void __thiscall linkPhysEffectHandler(SFSpell *spell, phys_effect_handler_ptr handler)
void __thiscall linkRefreshHandler(SFSpell *spell, refresh_handler_ptr handler)
void __thiscall linkEffectHandler(SFSpell *spell, uint16_t spell_effect_id, handler_ptr effectHandler)
void __thiscall linkSingleTargetAIHandler(SFSpell *spell, ai_single_handler_ptr handler)
void __thiscall linkBuildingJSON(SFBuilding *building, const char *building_json_name)
void __thiscall linkAvoidanceAIHandler(SFSpell *spell, ai_avoidance_handler_ptr handler)
void __thiscall linkOnHitHandler(SFSpell *spell, onhit_handler_ptr handler, OnHitPhase phase)
void __thiscall linkBuildingDoneHandler(SFBuilding *building, building_done_handler_ptr handler)
void __thiscall linkPhysRainHandler(SFSpell *spell, sub_effect_handler_ptr handler)
void __thiscall linkSubEffectHandler(SFSpell *spell, sub_effect_handler_ptr handler)
SFSpell *__thiscall registerSpell(uint16_t spell_id)
void __thiscall linkBuildingEntryHandler(SFBuilding *building, building_entry_handler_ptr handler)
uint8_t __thiscall getRacialIronMine(uint8_t race)
uint8_t __thiscall getRacialWoodcutter(uint8_t race)
uint8_t __thiscall getRacialStonecutter(uint8_t race)
uint32_t __thiscall getBuildingTags(uint8_t building_type)
uint8_t __thiscall getRacialFoodstore(uint8_t race)
uint8_t __thiscall getRacialQuarry(uint8_t race)
uint8_t __thiscall getRacialSawmill(uint8_t race)
uint8_t __thiscall getRacialSmelter(uint8_t race)
uint16_t __thiscall getSpellTags(uint16_t spell_line_id)
void initialize_onhit_data_hooks()
void __thiscall sf_onhit_hook(SF_CGdFigureJobs *_this, uint16_t source_index, uint32_t param_2, uint8_t param_3)
void __thiscall getWeaponStats(SF_CGdFigure *_this, uint16_t figure_id, uint8_t slot, SF_CGdFigureWeaponStats *stats)
void __thiscall initializeSpellData(SF_CGdSpell *_this, uint16_t spell_id, SpellDataKey key)
CMnuLabel *__thiscall attachMeshedLabel(CMnuLabel *new_label, CMnuContainer *parent, char *mesh_char, char *label_char, uint8_t font_index, uint16_t x_pos, uint16_t y_pos, uint16_t width, uint16_t height)
void __thiscall updateLabelText(CMnuLabel *label, const char *text)
SF_String *__thiscall SFStringConstructor_char(SF_String *_this, const char *char_string)
Constructs an SF_String from a null-terminated char string. Moved here from sf_vanilla_fix_hook....
CMnuContainer *__thiscall createContainer(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const char *background_msb, const char *border_msb, float alpha)
CMnuLabel *__thiscall attachLabel(CMnuLabel *label_ptr, CMnuContainer *parent, char *label_chars, uint8_t font_index, uint16_t x_pos, uint16_t y_pos, uint16_t width, uint16_t height)
CMnuSmpButton *__thiscall attachNewButton(CMnuContainer *parent, char *button_mesh_default, char *button_mesh_pressed, char *button_initial_load_mesh, char *button_mesh_disabled, char *label_char, uint8_t font_index, uint16_t x_pos, uint16_t y_pos, uint16_t width, uint16_t height, int button_index, uint32_t callback_func_ptr)
void __thiscall SFStringConstructor(SF_String *_this)
Zero-initializes an SF_String (no allocation). Moved here from sf_vanilla_fix_hook....
SF_String *__thiscall getSpecialFigureName(SF_CGdFigureToolbox *_this, SF_String *in_string, uint16_t figure_id)
void initialize_vanilla_fix_hooks()
SF_String *__thiscall portrait_overlay_hook(AutoClass101 *_this, SF_String *param_1, uint16_t figure_id, uint32_t param3, uint32_t param4, uint32_t param5)
bool __thiscall onWoodcutterFinishJob(SF_CGdFigureJobs *_this, uint16_t figure_id)
bool __thiscall onMinerFinishJob(SF_CGdFigureJobs *_this, uint16_t figure_id)
void __thiscall onCarpenterFinishJob(SF_CGdFigureJobs *_this, uint16_t figure_id)
void initialize_worker_logic_data_hooks()
bool __thiscall onStoneMinerFinishJob(SF_CGdFigureJobs *_this, uint16_t figure_id)
MemoryRegion is used for rewriting code in a given memory block.
Group of functions related to AI manipulation.
Group of functions related to Effect manipulation.
Group of functions related to Iteration, Often used for AOE or Chain Like Spells.
A structure dedicated to the registration of spells This structure holds functions that are used to c...
Represents a collection of function pointers for managing spell-related operations.
Group of functions related to UI manipulation.