Cosmetic edits: renamed some return addr variables in hacks

This commit is contained in:
NovaRain
2026-02-25 21:16:06 +08:00
parent e9c73e6dd3
commit f408534ce4
8 changed files with 29 additions and 29 deletions
+8 -8
View File
@@ -49,7 +49,7 @@ static __declspec(naked) void ai_try_attack_hook_FleeFix() {
} }
static __declspec(naked) void combat_ai_hook_FleeFix() { static __declspec(naked) void combat_ai_hook_FleeFix() {
static const DWORD combat_ai_hook_flee_Ret = 0x42B206; static const DWORD combat_ai_flee_Ret = 0x42B206;
using namespace fo; using namespace fo;
__asm { __asm {
test byte ptr [ebp], ReTarget; // CombatStateFlag flag (critter.combat_state) test byte ptr [ebp], ReTarget; // CombatStateFlag flag (critter.combat_state)
@@ -60,7 +60,7 @@ reTarget:
xor edi, edi; xor edi, edi;
mov dword ptr [esi + whoHitMe], edi; mov dword ptr [esi + whoHitMe], edi;
add esp, 4; add esp, 4;
jmp combat_ai_hook_flee_Ret; jmp combat_ai_flee_Ret;
} }
} }
@@ -74,14 +74,14 @@ static __declspec(naked) void ai_try_attack_hook_runFix() {
} }
static __declspec(naked) void combat_ai_hack() { static __declspec(naked) void combat_ai_hack() {
static const DWORD combat_ai_hack_Ret = 0x42B204; static const DWORD combat_ai_Ret = 0x42B204;
__asm { __asm {
mov edx, [ebx + 0x10]; // cap.min_hp mov edx, [ebx + 0x10]; // cap.min_hp
cmp eax, edx; cmp eax, edx;
jl tryHeal; // curr_hp < min_hp jl tryHeal; // curr_hp < min_hp
end: end:
add esp, 4; add esp, 4;
jmp combat_ai_hack_Ret; // jump to call ai_check_drugs_ jmp combat_ai_Ret; // jump to call ai_check_drugs_
tryHeal: tryHeal:
push ecx; push ecx;
push esi; // mov eax, esi; push esi; // mov eax, esi;
@@ -383,7 +383,7 @@ static long __fastcall item_weapon_reload_cost_fix(fo::GameObject* source, fo::G
} }
static __declspec(naked) void ai_try_attack_hook_cost_reload() { static __declspec(naked) void ai_try_attack_hook_cost_reload() {
static const DWORD ai_try_attack_hook_goNext_Ret = 0x42A9F2; static const DWORD ai_try_attack_goNext_Ret = 0x42A9F2;
__asm { __asm {
push ebx; // ammoObj ref push ebx; // ammoObj ref
mov ecx, eax; // source mov ecx, eax; // source
@@ -394,7 +394,7 @@ static __declspec(naked) void ai_try_attack_hook_cost_reload() {
//noAPs: // not enough action points //noAPs: // not enough action points
// add esp, 4; // destroy ret // add esp, 4; // destroy ret
// mov edi, 10; // mov edi, 10;
// jmp ai_try_attack_hook_goNext_Ret; // end ai_try_attack_ // jmp ai_try_attack_goNext_Ret; // end ai_try_attack_
} }
} }
@@ -484,7 +484,7 @@ skipMove:
} }
static __declspec(naked) void ai_move_away_hook() { static __declspec(naked) void ai_move_away_hook() {
static const DWORD ai_move_away_hook_Ret = 0x4289DA; static const DWORD ai_move_away_Ret = 0x4289DA;
__asm { __asm {
test ebx, ebx; test ebx, ebx;
jl fix; // distance arg < 0 jl fix; // distance arg < 0
@@ -495,7 +495,7 @@ fix:
cmp ebx, eax; cmp ebx, eax;
cmovg ebx, eax; // if (distance > ap) dist = ap cmovg ebx, eax; // if (distance > ap) dist = ap
add esp, 4; add esp, 4;
jmp ai_move_away_hook_Ret; jmp ai_move_away_Ret;
} }
} }
+4 -4
View File
@@ -47,8 +47,8 @@ static sBook* __fastcall FindBook(DWORD pid) {
return 0; return 0;
} }
static __declspec(naked) void obj_use_book_hook() { static __declspec(naked) void obj_use_book_hack() {
static const DWORD obj_use_book_hook_back = 0x49BA5A; static const DWORD obj_use_book_Ret = 0x49BA5A;
__asm { __asm {
mov edi, -1; mov edi, -1;
mov ecx, eax; mov ecx, eax;
@@ -58,7 +58,7 @@ static __declspec(naked) void obj_use_book_hook() {
mov edi, [eax + 4]; // msgID mov edi, [eax + 4]; // msgID
mov ecx, [eax + 8]; // skill mov ecx, [eax + 8]; // skill
skip: skip:
jmp obj_use_book_hook_back; jmp obj_use_book_Ret;
} }
} }
@@ -116,7 +116,7 @@ void Books::init() {
} }
BooksCount--; // set to last index BooksCount--; // set to last index
MakeJump(0x49B9FB, obj_use_book_hook); MakeJump(0x49B9FB, obj_use_book_hack);
} }
dlog_f(" (%d/%d books)\n", DL_INIT, n, count); dlog_f(" (%d/%d books)\n", DL_INIT, n, count);
} }
+4 -4
View File
@@ -2171,13 +2171,13 @@ skip:
// when there are no more items in the inventory // when there are no more items in the inventory
static __declspec(naked) void ai_check_drugs_hack_break() { static __declspec(naked) void ai_check_drugs_hack_break() {
static const DWORD ai_check_drugs_hack_Ret = 0x42878B; static const DWORD ai_check_drugs_break_Ret = 0x42878B;
__asm { __asm {
mov eax, -1; mov eax, -1;
cmp firstItemDrug, eax; cmp firstItemDrug, eax;
jne useDrugs; // pid != -1 jne useDrugs; // pid != -1
add esp, 4; add esp, 4;
jmp ai_check_drugs_hack_Ret; // break loop jmp ai_check_drugs_break_Ret; // break loop
useDrugs: // use the first found item useDrugs: // use the first found item
mov dword ptr [esp + 4], eax; // slot set -1 mov dword ptr [esp + 4], eax; // slot set -1
mov edi, firstItemDrug; mov edi, firstItemDrug;
@@ -2203,7 +2203,7 @@ checkDrugs:
} }
static __declspec(naked) void ai_check_drugs_hack_use() { static __declspec(naked) void ai_check_drugs_hack_use() {
static const DWORD ai_check_drugs_hack_Loop = 0x428675; static const DWORD ai_check_drugs_use_Loop = 0x428675;
__asm { __asm {
cmp eax, 3; // counter cmp eax, 3; // counter
jge beginLoop; jge beginLoop;
@@ -2214,7 +2214,7 @@ beginLoop:
mov firstItemDrug, edi; // keep first found drug item mov firstItemDrug, edi; // keep first found drug item
skip: skip:
add esp, 4; add esp, 4;
jmp ai_check_drugs_hack_Loop; // goto begin loop, search next item jmp ai_check_drugs_use_Loop; // goto begin loop, search next item
} }
}*/ }*/
+2 -2
View File
@@ -462,12 +462,12 @@ static __declspec(naked) void win_debug_win_draw_hook() {
static long debugWndWidth; static long debugWndWidth;
static __declspec(naked) void win_debug_pitch_calc_hack() { static __declspec(naked) void win_debug_pitch_calc_hack() {
static const DWORD win_debug_pitch_calc_hack_back = 0x4DC542; static const DWORD win_debug_pitch_calc_Ret = 0x4DC542;
__asm { __asm {
mov eax, debugWndWidth; mov eax, debugWndWidth;
imul esi; imul esi;
mov ebp, eax; mov ebp, eax;
jmp win_debug_pitch_calc_hack_back; jmp win_debug_pitch_calc_Ret;
} }
} }
+2 -2
View File
@@ -98,7 +98,7 @@ static long __fastcall op_metarule3_ext(long metafunc, long* args) {
} }
static __declspec(naked) void op_metarule3_hack() { static __declspec(naked) void op_metarule3_hack() {
static const DWORD op_metarule3_hack_Ret = 0x45732C; static const DWORD op_metarule3_Ret = 0x45732C;
__asm { __asm {
cmp ecx, 111; cmp ecx, 111;
jnz extended; jnz extended;
@@ -112,7 +112,7 @@ extended:
// //
call op_metarule3_ext; // ecx - metafunc arg call op_metarule3_ext; // ecx - metafunc arg
add esp, 4; add esp, 4;
jmp op_metarule3_hack_Ret; jmp op_metarule3_Ret;
} }
} }
+2 -2
View File
@@ -93,12 +93,12 @@ static __declspec(naked) void register_object_take_out_hack() {
} }
static __declspec(naked) void gdAddOptionStr_hack() { static __declspec(naked) void gdAddOptionStr_hack() {
static const DWORD gdAddOptionStr_hack_Ret = 0x4458FA; static const DWORD gdAddOptionStr_Ret = 0x4458FA;
__asm { __asm {
mov ecx, ds:[FO_VAR_gdNumOptions]; mov ecx, ds:[FO_VAR_gdNumOptions];
add ecx, '1'; add ecx, '1';
push ecx; push ecx;
jmp gdAddOptionStr_hack_Ret; jmp gdAddOptionStr_Ret;
} }
} }
+5 -5
View File
@@ -51,7 +51,7 @@ const char* __stdcall ObjectName::GetName(fo::GameObject* object) {
} }
static __declspec(naked) void critter_name_hack() { static __declspec(naked) void critter_name_hack() {
static DWORD critter_name_hack_Ret = 0x42D125; static DWORD critter_name_Ret = 0x42D125;
using namespace fo::Fields; using namespace fo::Fields;
__asm { __asm {
push ebx; // object push ebx; // object
@@ -62,12 +62,12 @@ static __declspec(naked) void critter_name_hack() {
retn; retn;
override: override:
add esp, 4; add esp, 4;
jmp critter_name_hack_Ret; jmp critter_name_Ret;
} }
} }
static __declspec(naked) void critter_name_hack_check() { static __declspec(naked) void critter_name_hack_check() {
static DWORD critter_name_hack_Ret = 0x42D12F; static DWORD critter_name_check_Ret = 0x42D12F;
using namespace fo::Fields; using namespace fo::Fields;
__asm { __asm {
mov ecx, [ebx + scriptId]; mov ecx, [ebx + scriptId];
@@ -77,7 +77,7 @@ static __declspec(naked) void critter_name_hack_check() {
jne default; jne default;
add esp, 4; add esp, 4;
mov eax, ds:[FO_VAR_name_critter]; mov eax, ds:[FO_VAR_name_critter];
jmp critter_name_hack_Ret; jmp critter_name_check_Ret;
checkScrIdx: checkScrIdx:
mov ecx, [ebx + scriptIndex]; mov ecx, [ebx + scriptIndex];
cmp ecx, -1; // no inherited script index cmp ecx, -1; // no inherited script index
@@ -86,7 +86,7 @@ checkScrIdx:
jne end; jne end;
add esp, 4; add esp, 4;
mov eax, ds:[FO_VAR_name_critter]; mov eax, ds:[FO_VAR_name_critter];
jmp critter_name_hack_Ret; jmp critter_name_check_Ret;
default: default:
mov ecx, [ebx + scriptIndex]; mov ecx, [ebx + scriptIndex];
end: end:
+2 -2
View File
@@ -309,7 +309,7 @@ static long __fastcall get_unarmed_damage(fo::GameObject* source, fo::AttackType
} }
static __declspec(naked) void item_w_damage_hack() { static __declspec(naked) void item_w_damage_hack() {
static DWORD item_w_damage_hack_Ret = 0x478553; static DWORD item_w_damage_Ret = 0x478553;
__asm { __asm {
lea eax, [esp + 4]; // min_DMG lea eax, [esp + 4]; // min_DMG
lea edx, [esp + 0]; // max_DMG lea edx, [esp + 0]; // max_DMG
@@ -320,7 +320,7 @@ static __declspec(naked) void item_w_damage_hack() {
call get_unarmed_damage; call get_unarmed_damage;
mov ebx, eax; // bonus mov ebx, eax; // bonus
pop ecx; pop ecx;
jmp item_w_damage_hack_Ret; jmp item_w_damage_Ret;
} }
} }