mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added use_item_on_dude macro to sfall.h
Various code edits: * Implemented more HookCalls/MakeCalls/SafeWriteBatch in code. * Moved return/jump address consts into their respective functions.
This commit is contained in:
@@ -238,6 +238,12 @@
|
|||||||
#define ADD_PERK_MODE_PERK (2) // add to the player's perks
|
#define ADD_PERK_MODE_PERK (2) // add to the player's perks
|
||||||
#define ADD_PERK_MODE_REMOVE (4) // remove from the list of selectable perks (after added to the player)
|
#define ADD_PERK_MODE_REMOVE (4) // remove from the list of selectable perks (after added to the player)
|
||||||
|
|
||||||
|
// instantly apply the item to dude_obj (w/o animation)
|
||||||
|
#define use_item_on_dude(item) set_self(dude_obj); \
|
||||||
|
set_self(dude_obj); \
|
||||||
|
use_obj_on_obj(item, dude_obj); \
|
||||||
|
set_self(0)
|
||||||
|
|
||||||
// sfall_funcX macros
|
// sfall_funcX macros
|
||||||
#define add_global_timer_event(time, fixedParam) sfall_func2("add_g_timer_event", time, fixedParam)
|
#define add_global_timer_event(time, fixedParam) sfall_func2("add_g_timer_event", time, fixedParam)
|
||||||
#define add_iface_tag sfall_func0("add_iface_tag")
|
#define add_iface_tag sfall_func0("add_iface_tag")
|
||||||
|
|||||||
@@ -188,9 +188,9 @@ static DWORD __fastcall CheckSetSad(BYTE openFlag, DWORD valueMul) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __declspec(naked) object_move_hack() {
|
||||||
static const DWORD object_move_back0 = 0x417611;
|
static const DWORD object_move_back0 = 0x417611;
|
||||||
static const DWORD object_move_back1 = 0x417616;
|
static const DWORD object_move_back1 = 0x417616;
|
||||||
static void __declspec(naked) object_move_hack() {
|
|
||||||
__asm {
|
__asm {
|
||||||
mov ecx, ds:[ecx + 0x3C]; // openFlag
|
mov ecx, ds:[ecx + 0x3C]; // openFlag
|
||||||
mov edx, [esp + 0x4C - 0x20]; // valueMul
|
mov edx, [esp + 0x4C - 0x20]; // valueMul
|
||||||
|
|||||||
+3
-3
@@ -55,9 +55,9 @@ static const DWORD bboxSlotAddr[] = {
|
|||||||
0x4616F7, 0x46170F, 0x461736, 0x4616B1, 0x46151D, 0x4615B3
|
0x4616F7, 0x46170F, 0x461736, 0x4616B1, 0x46151D, 0x4615B3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void __declspec(naked) DisplayBoxesHack() {
|
||||||
static const DWORD DisplayBoxesRet1 = 0x4615A8;
|
static const DWORD DisplayBoxesRet1 = 0x4615A8;
|
||||||
static const DWORD DisplayBoxesRet2 = 0x4615BE;
|
static const DWORD DisplayBoxesRet2 = 0x4615BE;
|
||||||
static void __declspec(naked) DisplayBoxesHack() {
|
|
||||||
__asm {
|
__asm {
|
||||||
mov edx, [boxText];
|
mov edx, [boxText];
|
||||||
xor ebx, ebx;
|
xor ebx, ebx;
|
||||||
@@ -109,8 +109,8 @@ skip:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const DWORD SetIndexBoxRet = 0x4612E8;
|
|
||||||
static void __declspec(naked) BarBoxesIndexHack() {
|
static void __declspec(naked) BarBoxesIndexHack() {
|
||||||
|
static const DWORD SetIndexBoxRet = 0x4612E8;
|
||||||
__asm {
|
__asm {
|
||||||
mov eax, ds:[0x4612E2]; // fontnum
|
mov eax, ds:[0x4612E2]; // fontnum
|
||||||
mov ecx, setBoxIndex; // start index
|
mov ecx, setBoxIndex; // start index
|
||||||
@@ -119,9 +119,9 @@ static void __declspec(naked) BarBoxesIndexHack() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __declspec(naked) BarBoxesSizeHack() {
|
||||||
static const DWORD SizeLoopBoxRet = 0x461477;
|
static const DWORD SizeLoopBoxRet = 0x461477;
|
||||||
static const DWORD ExitLoopBoxRet = 0x461498;
|
static const DWORD ExitLoopBoxRet = 0x461498;
|
||||||
static void __declspec(naked) BarBoxesSizeHack() {
|
|
||||||
__asm {
|
__asm {
|
||||||
cmp edx, sizeBox;
|
cmp edx, sizeBox;
|
||||||
jz exitLoop;
|
jz exitLoop;
|
||||||
|
|||||||
+1
-1
@@ -42,8 +42,8 @@ static sBook* __fastcall FindBook(DWORD pid) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const DWORD obj_use_book_hook_back = 0x49BA5A;
|
|
||||||
static void __declspec(naked) obj_use_book_hook() {
|
static void __declspec(naked) obj_use_book_hook() {
|
||||||
|
static const DWORD obj_use_book_hook_back = 0x49BA5A;
|
||||||
__asm {
|
__asm {
|
||||||
mov edi, -1;
|
mov edi, -1;
|
||||||
mov ecx, eax;
|
mov ecx, eax;
|
||||||
|
|||||||
+1
-1
@@ -45,8 +45,8 @@ static long __fastcall ComputeSpray(DWORD* roundsLeftOut, DWORD* roundsRightOut,
|
|||||||
return (result % compute_spray_target_div) ? ++roundsMainTarget : roundsMainTarget; // if remainder then round up
|
return (result % compute_spray_target_div) ? ++roundsMainTarget : roundsMainTarget; // if remainder then round up
|
||||||
}
|
}
|
||||||
|
|
||||||
static const DWORD compute_spray_rounds_back = 0x42353A;
|
|
||||||
static void __declspec(naked) compute_spray_rounds_distribution() {
|
static void __declspec(naked) compute_spray_rounds_distribution() {
|
||||||
|
static const DWORD compute_spray_rounds_back = 0x42353A;
|
||||||
__asm {
|
__asm {
|
||||||
push ecx;
|
push ecx;
|
||||||
lea ecx, [esp + 8 + 4]; // roundsLeft - out
|
lea ecx, [esp + 8 + 4]; // roundsLeft - out
|
||||||
|
|||||||
+4
-4
@@ -85,9 +85,9 @@ static void _stdcall CombatBlocked() {
|
|||||||
DisplayConsoleMessage(combatBlockedMessage);
|
DisplayConsoleMessage(combatBlockedMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __declspec(naked) intface_use_item_hook() {
|
||||||
static const DWORD BlockCombatHook1Ret1 = 0x45F6AF;
|
static const DWORD BlockCombatHook1Ret1 = 0x45F6AF;
|
||||||
static const DWORD BlockCombatHook1Ret2 = 0x45F6D7;
|
static const DWORD BlockCombatHook1Ret2 = 0x45F6D7;
|
||||||
static void __declspec(naked) intface_use_item_hook() {
|
|
||||||
__asm {
|
__asm {
|
||||||
cmp combatDisabled, 0;
|
cmp combatDisabled, 0;
|
||||||
jne block;
|
jne block;
|
||||||
@@ -162,9 +162,9 @@ static void __declspec(naked) ai_search_inven_weap_hook() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// switch weapon mode from secondary to primary if there is not enough ammo to shoot
|
// switch weapon mode from secondary to primary if there is not enough ammo to shoot
|
||||||
|
static void __declspec(naked) ai_try_attack_hook() {
|
||||||
static const DWORD ai_try_attack_search_ammo = 0x42AA1E;
|
static const DWORD ai_try_attack_search_ammo = 0x42AA1E;
|
||||||
static const DWORD ai_try_attack_continue = 0x42A929;
|
static const DWORD ai_try_attack_continue = 0x42A929;
|
||||||
static void __declspec(naked) ai_try_attack_hook() {
|
|
||||||
__asm {
|
__asm {
|
||||||
mov ebx, [esp + 0x364 - 0x38]; // hit mode
|
mov ebx, [esp + 0x364 - 0x38]; // hit mode
|
||||||
cmp ebx, 3; // ATKTYPE_RWEAPON_SECONDARY
|
cmp ebx, 3; // ATKTYPE_RWEAPON_SECONDARY
|
||||||
@@ -247,8 +247,8 @@ static void __declspec(naked) compute_damage_hack() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const DWORD KnockbackRetAddr = 0x4136E1;
|
|
||||||
static void __declspec(naked) compute_dmg_damage_hack() {
|
static void __declspec(naked) compute_dmg_damage_hack() {
|
||||||
|
static const DWORD KnockbackRetAddr = 0x4136E1;
|
||||||
__asm {
|
__asm {
|
||||||
push ecx
|
push ecx
|
||||||
push esi; // Target
|
push esi; // Target
|
||||||
@@ -418,9 +418,9 @@ static int __fastcall AimedShotTest(DWORD pid) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __declspec(naked) item_w_called_shot_hook() {
|
||||||
static const DWORD aimedShotRet1 = 0x478EE4;
|
static const DWORD aimedShotRet1 = 0x478EE4;
|
||||||
static const DWORD aimedShotRet2 = 0x478EEA;
|
static const DWORD aimedShotRet2 = 0x478EEA;
|
||||||
static void __declspec(naked) item_w_called_shot_hook() {
|
|
||||||
__asm {
|
__asm {
|
||||||
push edx;
|
push edx;
|
||||||
mov ecx, edx; // item
|
mov ecx, edx; // item
|
||||||
|
|||||||
+1
-1
@@ -28,8 +28,8 @@ static void __stdcall ConsoleFilePrint(const char* msg) {
|
|||||||
consoleFile << msg << std::endl;
|
consoleFile << msg << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const DWORD ConsoleHookRet = 0x431871;
|
|
||||||
static void __declspec(naked) ConsoleHook() {
|
static void __declspec(naked) ConsoleHook() {
|
||||||
|
static const DWORD ConsoleHookRet = 0x431871;
|
||||||
__asm {
|
__asm {
|
||||||
pushadc;
|
pushadc;
|
||||||
push eax;
|
push eax;
|
||||||
|
|||||||
@@ -287,8 +287,8 @@ void RunDebugEditor() {
|
|||||||
WSACleanup();
|
WSACleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
static const DWORD dbg_error_ret = 0x453FD8;
|
|
||||||
static void __declspec(naked) dbg_error_hack() {
|
static void __declspec(naked) dbg_error_hack() {
|
||||||
|
static const DWORD dbg_error_ret = 0x453FD8;
|
||||||
__asm {
|
__asm {
|
||||||
cmp ebx, 1;
|
cmp ebx, 1;
|
||||||
je hide;
|
je hide;
|
||||||
|
|||||||
+6
-7
@@ -164,19 +164,18 @@ void ElevatorsInit() {
|
|||||||
//HookCall(0x43F2D2, UnknownHook2); // unused
|
//HookCall(0x43F2D2, UnknownHook2); // unused
|
||||||
|
|
||||||
SafeWrite8(0x43EF76, (BYTE)elevatorCount);
|
SafeWrite8(0x43EF76, (BYTE)elevatorCount);
|
||||||
SafeWrite32(0x43EFA4, (DWORD)elevators);
|
const DWORD elevatorsAddr[] = {0x43EFA4, 0x43EFB9, 0x43F2FC};
|
||||||
SafeWrite32(0x43EFB9, (DWORD)elevators);
|
SafeWriteBatch<DWORD>((DWORD)elevators, elevatorsAddr);
|
||||||
SafeWrite32(0x43F2FC, (DWORD)elevators);
|
const DWORD elevatorsTileAddr[] = {0x43EFEA, 0x43F315};
|
||||||
SafeWrite32(0x43EFEA, (DWORD)&elevators[0].Tile1);
|
SafeWriteBatch<DWORD>((DWORD)&elevators[0].Tile1, elevatorsTileAddr);
|
||||||
SafeWrite32(0x43F315, (DWORD)&elevators[0].Tile1);
|
|
||||||
SafeWrite32(0x43F309, (DWORD)&elevators[0].Elevation1);
|
SafeWrite32(0x43F309, (DWORD)&elevators[0].Elevation1);
|
||||||
|
|
||||||
SafeWrite32(0x43F438, (DWORD)&elevatorsFrms[0].main);
|
SafeWrite32(0x43F438, (DWORD)&elevatorsFrms[0].main);
|
||||||
SafeWrite32(0x43F475, (DWORD)&elevatorsFrms[0].buttons);
|
SafeWrite32(0x43F475, (DWORD)&elevatorsFrms[0].buttons);
|
||||||
|
|
||||||
// _btncnt
|
// _btncnt
|
||||||
SafeWrite32(0x43F65E, (DWORD)elevatorsBtnCount);
|
const DWORD elevsBtnCountAddr[] = {0x43F65E, 0x43F6BB};
|
||||||
SafeWrite32(0x43F6BB, (DWORD)elevatorsBtnCount);
|
SafeWriteBatch<DWORD>((DWORD)elevatorsBtnCount, elevsBtnCountAddr);
|
||||||
MakeCall(0x43F05D, GetNumButtonsHook1, 2);
|
MakeCall(0x43F05D, GetNumButtonsHook1, 2);
|
||||||
MakeCall(0x43F184, GetNumButtonsHook2, 2);
|
MakeCall(0x43F184, GetNumButtonsHook2, 2);
|
||||||
MakeCall(0x43F1E4, GetNumButtonsHook3, 2);
|
MakeCall(0x43F1E4, GetNumButtonsHook3, 2);
|
||||||
|
|||||||
@@ -1510,8 +1510,8 @@ endFunc:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const DWORD op_obj_art_fid_Ret = 0x45C5D9;
|
|
||||||
static void __declspec(naked) op_obj_art_fid_hack() {
|
static void __declspec(naked) op_obj_art_fid_hack() {
|
||||||
|
static const DWORD op_obj_art_fid_Ret = 0x45C5D9;
|
||||||
__asm {
|
__asm {
|
||||||
mov esi, [edi + 0x20]; // artFid
|
mov esi, [edi + 0x20]; // artFid
|
||||||
mov eax, [edi + 0x64]; // protoId
|
mov eax, [edi + 0x64]; // protoId
|
||||||
|
|||||||
@@ -552,8 +552,8 @@ end:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const DWORD RemoveObjHookRet = 0x477497;
|
|
||||||
static void __declspec(naked) RemoveObjHook() {
|
static void __declspec(naked) RemoveObjHook() {
|
||||||
|
static const DWORD RemoveObjHookRet = 0x477497;
|
||||||
__asm {
|
__asm {
|
||||||
mov ecx, [esp + 8]; // call addr
|
mov ecx, [esp + 8]; // call addr
|
||||||
HookBegin;
|
HookBegin;
|
||||||
@@ -688,8 +688,8 @@ end:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const DWORD _obj_blocking_at = 0x48B84E;
|
|
||||||
static void __declspec(naked) HexMBlockingHook() {
|
static void __declspec(naked) HexMBlockingHook() {
|
||||||
|
static const DWORD _obj_blocking_at = 0x48B84E;
|
||||||
__asm {
|
__asm {
|
||||||
HookBeginArgs(4);
|
HookBeginArgs(4);
|
||||||
mov args[0], eax;
|
mov args[0], eax;
|
||||||
@@ -1055,10 +1055,10 @@ static int __fastcall InventoryMoveHook_Script(DWORD itemReplace, DWORD item, in
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const DWORD UseArmorHack_back = 0x4713AF; // normal operation (old 0x4713A9)
|
|
||||||
static const DWORD UseArmorHack_skip = 0x471481; // skip code, prevent wearing armor
|
|
||||||
// This hack is called when an armor is dropped into the armor slot at inventory screen
|
// This hack is called when an armor is dropped into the armor slot at inventory screen
|
||||||
static void __declspec(naked) UseArmorHack() {
|
static void __declspec(naked) UseArmorHack() {
|
||||||
|
static const DWORD UseArmorHack_back = 0x4713AF; // normal operation (old 0x4713A9)
|
||||||
|
static const DWORD UseArmorHack_skip = 0x471481; // skip code, prevent wearing armor
|
||||||
__asm {
|
__asm {
|
||||||
mov ecx, ds:[_i_worn]; // replacement item (override code)
|
mov ecx, ds:[_i_worn]; // replacement item (override code)
|
||||||
mov edx, [esp + 0x58 - 0x40]; // item
|
mov edx, [esp + 0x58 - 0x40]; // item
|
||||||
@@ -1165,9 +1165,9 @@ static int __fastcall DropIntoContainer(DWORD ptrCont, DWORD item, DWORD addrCal
|
|||||||
return InventoryMoveHook_Script(ptrCont, item, type);
|
return InventoryMoveHook_Script(ptrCont, item, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __declspec(naked) DropIntoContainerHack() {
|
||||||
static const DWORD DropIntoContainer_back = 0x47649D; // normal operation
|
static const DWORD DropIntoContainer_back = 0x47649D; // normal operation
|
||||||
static const DWORD DropIntoContainer_skip = 0x476503;
|
static const DWORD DropIntoContainer_skip = 0x476503;
|
||||||
static void __declspec(naked) DropIntoContainerHack() {
|
|
||||||
__asm {
|
__asm {
|
||||||
pushadc;
|
pushadc;
|
||||||
mov ecx, ebp; // contaner ptr
|
mov ecx, ebp; // contaner ptr
|
||||||
@@ -1185,17 +1185,17 @@ skipdrop:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const DWORD DropIntoContainerRet = 0x471481;
|
|
||||||
static void __declspec(naked) DropIntoContainerHandSlotHack() {
|
static void __declspec(naked) DropIntoContainerHandSlotHack() {
|
||||||
|
static const DWORD DropIntoContainerRet = 0x471481;
|
||||||
__asm {
|
__asm {
|
||||||
call drop_into_container_;
|
call drop_into_container_;
|
||||||
jmp DropIntoContainerRet;
|
jmp DropIntoContainerRet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __declspec(naked) DropAmmoIntoWeaponHook() {
|
||||||
//static const DWORD DropAmmoIntoWeaponHack_back = 0x47658D; // proceed with reloading
|
//static const DWORD DropAmmoIntoWeaponHack_back = 0x47658D; // proceed with reloading
|
||||||
static const DWORD DropAmmoIntoWeaponHack_return = 0x476643;
|
static const DWORD DropAmmoIntoWeaponHack_return = 0x476643;
|
||||||
static void __declspec(naked) DropAmmoIntoWeaponHook() {
|
|
||||||
__asm {
|
__asm {
|
||||||
pushadc;
|
pushadc;
|
||||||
mov ecx, ebp; // weapon ptr
|
mov ecx, ebp; // weapon ptr
|
||||||
|
|||||||
+8
-7
@@ -182,9 +182,9 @@ static int __fastcall BarterAttemptTransaction(TGameObj* critter, TGameObj* tabl
|
|||||||
return (sizeTable <= size) ? 1 : 0;
|
return (sizeTable <= size) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static __declspec(naked) void barter_attempt_transaction_hack_pc() {
|
||||||
static const DWORD BarterAttemptTransactionPCFail = 0x474C81;
|
static const DWORD BarterAttemptTransactionPCFail = 0x474C81;
|
||||||
static const DWORD BarterAttemptTransactionPCRet = 0x474CA8;
|
static const DWORD BarterAttemptTransactionPCRet = 0x474CA8;
|
||||||
static __declspec(naked) void barter_attempt_transaction_hack_pc() {
|
|
||||||
__asm {
|
__asm {
|
||||||
/* cmp eax, edx */
|
/* cmp eax, edx */
|
||||||
jg fail; // if there's no available weight
|
jg fail; // if there's no available weight
|
||||||
@@ -201,9 +201,9 @@ fail:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static __declspec(naked) void barter_attempt_transaction_hack_pm() {
|
||||||
static const DWORD BarterAttemptTransactionPMFail = 0x474CD8;
|
static const DWORD BarterAttemptTransactionPMFail = 0x474CD8;
|
||||||
static const DWORD BarterAttemptTransactionPMRet = 0x474D01;
|
static const DWORD BarterAttemptTransactionPMRet = 0x474D01;
|
||||||
static __declspec(naked) void barter_attempt_transaction_hack_pm() {
|
|
||||||
__asm {
|
__asm {
|
||||||
/* cmp eax, edx */
|
/* cmp eax, edx */
|
||||||
jg fail; // if there's no available weight
|
jg fail; // if there's no available weight
|
||||||
@@ -261,8 +261,8 @@ static void __cdecl DisplaySizeStats(TGameObj* critter, const char* &message, DW
|
|||||||
strcpy(InvenFmt, InvenFmt1);
|
strcpy(InvenFmt, InvenFmt1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const DWORD DisplayStatsRet = 0x4725E5;
|
|
||||||
static __declspec(naked) void display_stats_hack() {
|
static __declspec(naked) void display_stats_hack() {
|
||||||
|
static const DWORD DisplayStatsRet = 0x4725E5;
|
||||||
__asm {
|
__asm {
|
||||||
mov ecx, esp;
|
mov ecx, esp;
|
||||||
sub ecx, 4;
|
sub ecx, 4;
|
||||||
@@ -311,8 +311,8 @@ static __declspec(naked) void inven_obj_examine_func_hook() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const DWORD ControlUpdateInfoRet = 0x44912A;
|
|
||||||
static void __declspec(naked) gdControlUpdateInfo_hack() {
|
static void __declspec(naked) gdControlUpdateInfo_hack() {
|
||||||
|
static const DWORD ControlUpdateInfoRet = 0x44912A;
|
||||||
__asm {
|
__asm {
|
||||||
mov ebx, eax;
|
mov ebx, eax;
|
||||||
push eax; // critter
|
push eax; // critter
|
||||||
@@ -342,8 +342,8 @@ static int __fastcall SuperStimFix(TGameObj* item, TGameObj* target) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const DWORD protinst_use_item_on_Ret = 0x49C5F4;
|
|
||||||
static void __declspec(naked) protinst_use_item_on_hack() {
|
static void __declspec(naked) protinst_use_item_on_hack() {
|
||||||
|
static const DWORD protinst_use_item_on_Ret = 0x49C5F4;
|
||||||
__asm {
|
__asm {
|
||||||
push ecx;
|
push ecx;
|
||||||
mov ecx, ebx; // ecx - item
|
mov ecx, ebx; // ecx - item
|
||||||
@@ -568,8 +568,8 @@ skip:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const DWORD DoMoveTimer_Ret = 0x476920;
|
|
||||||
static void __declspec(naked) do_move_timer_hook() {
|
static void __declspec(naked) do_move_timer_hook() {
|
||||||
|
static const DWORD DoMoveTimer_Ret = 0x476920;
|
||||||
__asm {
|
__asm {
|
||||||
cmp eax, 4;
|
cmp eax, 4;
|
||||||
jnz end;
|
jnz end;
|
||||||
@@ -608,8 +608,9 @@ static void __declspec(naked) do_move_timer_hack() {
|
|||||||
|
|
||||||
static int invenApCost, invenApCostDef;
|
static int invenApCost, invenApCostDef;
|
||||||
static char invenApQPReduction;
|
static char invenApQPReduction;
|
||||||
static const DWORD inven_ap_cost_Ret = 0x46E812;
|
|
||||||
static void __declspec(naked) inven_ap_cost_hack() {
|
static void __declspec(naked) inven_ap_cost_hack() {
|
||||||
|
static const DWORD inven_ap_cost_Ret = 0x46E812;
|
||||||
_asm {
|
_asm {
|
||||||
mul byte ptr invenApQPReduction;
|
mul byte ptr invenApQPReduction;
|
||||||
mov edx, invenApCost;
|
mov edx, invenApCost;
|
||||||
|
|||||||
+2
-2
@@ -32,8 +32,8 @@ static DWORD MainMenuTextOffset;
|
|||||||
|
|
||||||
static long OverrideColour, OverrideColour2;
|
static long OverrideColour, OverrideColour2;
|
||||||
|
|
||||||
static const DWORD MainMenuButtonYHookRet = 0x48184A;
|
|
||||||
static void __declspec(naked) MainMenuButtonYHook() {
|
static void __declspec(naked) MainMenuButtonYHook() {
|
||||||
|
static const DWORD MainMenuButtonYHookRet = 0x48184A;
|
||||||
__asm {
|
__asm {
|
||||||
xor edi, edi;
|
xor edi, edi;
|
||||||
xor esi, esi;
|
xor esi, esi;
|
||||||
@@ -62,8 +62,8 @@ override:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const DWORD MainMenuTextRet = 0x4817B0;
|
|
||||||
static void __declspec(naked) MainMenuTextHook() {
|
static void __declspec(naked) MainMenuTextHook() {
|
||||||
|
static const DWORD MainMenuTextRet = 0x4817B0;
|
||||||
__asm {
|
__asm {
|
||||||
mov esi, eax; // winptr
|
mov esi, eax; // winptr
|
||||||
mov ebp, ecx; // keep xpos
|
mov ebp, ecx; // keep xpos
|
||||||
|
|||||||
+6
-6
@@ -706,8 +706,8 @@ static void PerkSetup() {
|
|||||||
// _perk_data
|
// _perk_data
|
||||||
const DWORD perkDataAddr[] = {0x496669, 0x496837, 0x496BAD, 0x496C41, 0x496D25};
|
const DWORD perkDataAddr[] = {0x496669, 0x496837, 0x496BAD, 0x496C41, 0x496D25};
|
||||||
SafeWriteBatch<DWORD>((DWORD)Perks, perkDataAddr);
|
SafeWriteBatch<DWORD>((DWORD)Perks, perkDataAddr);
|
||||||
SafeWrite32(0x496696, (DWORD)&Perks[0].Desc);
|
const DWORD perkDataDescAddr[] = {0x496696, 0x496BD1};
|
||||||
SafeWrite32(0x496BD1, (DWORD)&Perks[0].Desc);
|
SafeWriteBatch<DWORD>((DWORD)&Perks[0].Desc, perkDataDescAddr);
|
||||||
SafeWrite32(0x496BF5, (DWORD)&Perks[0].Image);
|
SafeWrite32(0x496BF5, (DWORD)&Perks[0].Image);
|
||||||
SafeWrite32(0x496AD4, (DWORD)&Perks[0].Ranks);
|
SafeWrite32(0x496AD4, (DWORD)&Perks[0].Ranks);
|
||||||
}
|
}
|
||||||
@@ -916,10 +916,10 @@ static void TraitSetup() {
|
|||||||
memcpy(Traits, (void*)_trait_data, sizeof(TraitStruct) * TRAIT_count);
|
memcpy(Traits, (void*)_trait_data, sizeof(TraitStruct) * TRAIT_count);
|
||||||
|
|
||||||
// _trait_data
|
// _trait_data
|
||||||
SafeWrite32(0x4B3A81, (DWORD)Traits);
|
const DWORD traitDataAddr[] = {0x4B3A81, 0x4B3B80};
|
||||||
SafeWrite32(0x4B3B80, (DWORD)Traits);
|
SafeWriteBatch<DWORD>((DWORD)Traits, traitDataAddr);
|
||||||
SafeWrite32(0x4B3AAE, (DWORD)&Traits[0].Desc);
|
const DWORD traitDataDescAddr[] = {0x4B3AAE, 0x4B3BA0};
|
||||||
SafeWrite32(0x4B3BA0, (DWORD)&Traits[0].Desc);
|
SafeWriteBatch<DWORD>((DWORD)&Traits[0].Desc, traitDataDescAddr);
|
||||||
SafeWrite32(0x4B3BC0, (DWORD)&Traits[0].Image);
|
SafeWrite32(0x4B3BC0, (DWORD)&Traits[0].Image);
|
||||||
|
|
||||||
char buf[512], num[5] = {'t'};
|
char buf[512], num[5] = {'t'};
|
||||||
|
|||||||
+1
-1
@@ -212,10 +212,10 @@ static long __fastcall QuestsPrint(const char* text, int width, DWORD* buf, BYTE
|
|||||||
return EXITCODE_Normal;
|
return EXITCODE_Normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __declspec(naked) PipStatus_hack_print() {
|
||||||
static const DWORD PipStatus_NormalRet = 0x49818B;
|
static const DWORD PipStatus_NormalRet = 0x49818B;
|
||||||
static const DWORD PipStatus_NextRet = 0x498237;
|
static const DWORD PipStatus_NextRet = 0x498237;
|
||||||
static const DWORD PipStatus_BreakRet = 0x4982A4;
|
static const DWORD PipStatus_BreakRet = 0x4982A4;
|
||||||
static void __declspec(naked) PipStatus_hack_print() {
|
|
||||||
__asm {
|
__asm {
|
||||||
push ecx;
|
push ecx;
|
||||||
push ebx;
|
push ebx;
|
||||||
|
|||||||
@@ -1732,7 +1732,7 @@ void ScriptExtenderInit() {
|
|||||||
0x4A3E1C, // script_chk_timed_events_
|
0x4A3E1C, // script_chk_timed_events_
|
||||||
0x499AFA, 0x499CD7, 0x499E2B // TimedRest_
|
0x499AFA, 0x499CD7, 0x499E2B // TimedRest_
|
||||||
};
|
};
|
||||||
MakeCalls(TimedEventNextTime, queueNextTimeAddr);
|
HookCalls(TimedEventNextTime, queueNextTimeAddr);
|
||||||
HookCall(0x4A3E08, script_chk_timed_events_hook);
|
HookCall(0x4A3E08, script_chk_timed_events_hook);
|
||||||
|
|
||||||
// this patch makes it possible to export variables from sfall global scripts
|
// this patch makes it possible to export variables from sfall global scripts
|
||||||
|
|||||||
+2
-2
@@ -342,8 +342,8 @@ void SkillsInit() {
|
|||||||
HookCall(0x4AA574, skill_level_hook);
|
HookCall(0x4AA574, skill_level_hook);
|
||||||
// change the lower limit for negative skill points
|
// change the lower limit for negative skill points
|
||||||
MakeCall(0x4AAA84, skill_dec_point_hack_limit);
|
MakeCall(0x4AAA84, skill_dec_point_hack_limit);
|
||||||
SafeWrite8(0x4AA91B, SKILL_MIN_LIMIT);
|
const DWORD skillMinLimitAddr[] = {0x4AA91B, 0x4AAA1A};
|
||||||
SafeWrite8(0x4AAA1A, SKILL_MIN_LIMIT);
|
SafeWriteBatch<BYTE>(SKILL_MIN_LIMIT, skillMinLimitAddr);
|
||||||
SafeWrite32(0x4AAA23, SKILL_MIN_LIMIT);
|
SafeWrite32(0x4AAA23, SKILL_MIN_LIMIT);
|
||||||
|
|
||||||
MakeCall(0x4ABC62, skill_check_stealing_hack); // PickpocketMod
|
MakeCall(0x4ABC62, skill_check_stealing_hack); // PickpocketMod
|
||||||
|
|||||||
@@ -166,9 +166,7 @@ void SpeedPatchInit() {
|
|||||||
int size = sizeof(offsets) / 4;
|
int size = sizeof(offsets) / 4;
|
||||||
if (GetConfigInt("Speed", "AffectPlayback", 0) == 0) size -= 4;
|
if (GetConfigInt("Speed", "AffectPlayback", 0) == 0) size -= 4;
|
||||||
|
|
||||||
for (int i = 0; i < size; i++) {
|
SafeWriteBatch<DWORD>((DWORD)&sf_GetTickCount, offsets);
|
||||||
SafeWrite32(offsets[i], (DWORD)&sf_GetTickCount);
|
|
||||||
}
|
|
||||||
SafeWrite32(0x4FDF58, (DWORD)&sf_GetLocalTime);
|
SafeWrite32(0x4FDF58, (DWORD)&sf_GetLocalTime);
|
||||||
HookCall(0x4A433E, scripts_check_state_hook);
|
HookCall(0x4A433E, scripts_check_state_hook);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user