Fixed the exploit that allows you to gain excessive skill points from Tag! perk before leaving the character screen (from Mr.Stalin)

Minor edits to documents.
This commit is contained in:
NovaRain
2018-10-12 10:56:18 +08:00
parent ee64d981fa
commit 009a6cc21d
5 changed files with 45 additions and 4 deletions
+1 -1
View File
@@ -351,7 +351,7 @@ CorpseLineOfFireFix=0
;Set to 1 (or some higher number if needed, the maximum is 127) to prevent 100% CPU use ;Set to 1 (or some higher number if needed, the maximum is 127) to prevent 100% CPU use
ProcessorIdle=-1 ProcessorIdle=-1
;Set a number of how many protos of a type can be loaded into memory at once (valid range: 512..4096) ;Set a number of how many protos per type can be loaded into memory at once (valid range: 512..4096)
;Set to -1 to let set_proto_data script function automatically increase the limit when needed ;Set to -1 to let set_proto_data script function automatically increase the limit when needed
LoadProtoMaxLimit=-1 LoadProtoMaxLimit=-1
+1 -1
View File
@@ -216,7 +216,7 @@ Some additional reg_anim_* functions were introduced. They all work in the same
> void reg_anim_turn_towards(object, tile/target, delay) > void reg_anim_turn_towards(object, tile/target, delay)
- makes object change its direction to face given tile num or target object. - makes object change its direction to face given tile num or target object.
> int metarule2_explosions(int arg1, int arg2) > int metarule2_explosions(int arg1, int arg2, int arg3)
was made as a dirty easy hack to allow dynamically change some explosion parameters (ranged attack). All changed parameters are reset to vanilla state automatically after each attack action. Following macros are available in sfall.h: was made as a dirty easy hack to allow dynamically change some explosion parameters (ranged attack). All changed parameters are reset to vanilla state automatically after each attack action. Following macros are available in sfall.h:
> void set_attack_explosion_pattern(x, y) > void set_attack_explosion_pattern(x, y)
+40 -2
View File
@@ -1323,7 +1323,7 @@ static void __declspec(naked) compute_damage_hack() {
__asm { __asm {
mov ecx, esi; // ctd mov ecx, esi; // ctd
call InstantDeathFix; call InstantDeathFix;
// overwritted engine code // overwritten engine code
add esp, 0x34; add esp, 0x34;
pop ebp; pop ebp;
pop edi; pop edi;
@@ -1532,6 +1532,36 @@ limit:
} }
} }
int tagSkill4LevelBase = -1;
static void __declspec(naked) SliderBtn_hook_down() {
__asm {
call fo::funcoffs::skill_level_;
cmp tagSkill4LevelBase, -1;
jnz fix;
retn;
fix:
cmp ds:[FO_VAR_tag_skill + 3 * 4], ebx; // _tag_skill4, ebx = _skill_cursor
jnz skip;
cmp eax, tagSkill4LevelBase; // curr > x2
jg skip;
xor eax, eax;
skip:
retn;
}
}
static void __declspec(naked) Add4thTagSkill_hook() {
__asm {
mov edi, eax;
call fo::funcoffs::skill_set_tags_;
mov eax, ds:[FO_VAR_obj_dude];
mov edx, dword ptr ds:[edi + 3 * 4]; // _temp_tag_skill4
call fo::funcoffs::skill_level_;
mov tagSkill4LevelBase, eax; // x2
retn;
}
}
static BYTE retrievePtr = 0; static BYTE retrievePtr = 0;
static void __declspec(naked) ai_retrieve_object_hook() { static void __declspec(naked) ai_retrieve_object_hook() {
__asm { __asm {
@@ -2006,6 +2036,14 @@ void BugFixes::init()
MakeCall(0x472F5F, inven_obj_examine_func_hack); MakeCall(0x472F5F, inven_obj_examine_func_hack);
SafeWrite8(0x472F64, 0x90); SafeWrite8(0x472F64, 0x90);
// Fix for the exploit that allows you to gain excessive skill points from Tag! perk before leaving the character screen
//if (GetConfigInt("Misc", "TagPerkFix", 1)) {
dlog("Applying fix for Tag! exploit.", DL_INIT);
HookCall(0x43B463, SliderBtn_hook_down);
HookCall(0x43D7DD, Add4thTagSkill_hook);
dlogr(" Done", DL_INIT);
//}
// Fix for ai_retrieve_object_ engine function not returning the requested object when there are different objects // Fix for ai_retrieve_object_ engine function not returning the requested object when there are different objects
// with the same ID // with the same ID
dlog("Applying ai_retrieve_object engine function fix.", DL_INIT); dlog("Applying ai_retrieve_object engine function fix.", DL_INIT);
@@ -2020,7 +2058,7 @@ void BugFixes::init()
dlogr(" Done", DL_INIT); dlogr(" Done", DL_INIT);
} }
// Fix for "Heave Ho!" perk increasing strength stat above 10 when determining the max range of thrown weapons // Fix for Heave Ho! perk increasing Strength stat above 10 when determining the maximum range of thrown weapons
HookCall(0x478AD9, item_w_range_hook); HookCall(0x478AD9, item_w_range_hook);
} }
+2
View File
@@ -11,6 +11,8 @@ public:
void init(); void init();
}; };
extern int tagSkill4LevelBase;
extern void ResetBodyState(); extern void ResetBodyState();
} }
+1
View File
@@ -474,6 +474,7 @@ success:
call PerksAcceptCharScreen; call PerksAcceptCharScreen;
end: end:
_InLoop2(0, CHARSCREEN); _InLoop2(0, CHARSCREEN);
mov tagSkill4LevelBase, -1; // for fixing Tag! perk exploit
popad; popad;
retn; retn;
} }