Merge pull request #344 from diamante0018/develop
[Weapon] Fix null pointer
This commit is contained in:
commit
562cac3a99
@ -448,6 +448,48 @@ namespace Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void __declspec(naked) Weapon::CG_UpdatePrimaryForAltModeWeapon_Stub()
|
||||||
|
{
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
mov eax, 0x440EB0 // BG_GetWeaponDef
|
||||||
|
call eax
|
||||||
|
add esp, 0x4
|
||||||
|
|
||||||
|
test eax, eax
|
||||||
|
jz null
|
||||||
|
|
||||||
|
// Game code
|
||||||
|
push 0x59E349
|
||||||
|
retn
|
||||||
|
|
||||||
|
null:
|
||||||
|
mov al, 1
|
||||||
|
ret
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __declspec(naked) Weapon::CG_SelectWeaponIndex_Stub()
|
||||||
|
{
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
mov eax, 0x440EB0 // BG_GetWeaponDef
|
||||||
|
call eax
|
||||||
|
add esp, 0x4
|
||||||
|
|
||||||
|
test eax, eax
|
||||||
|
jz null
|
||||||
|
|
||||||
|
// Game code
|
||||||
|
push 0x48BB2D
|
||||||
|
retn
|
||||||
|
|
||||||
|
null:
|
||||||
|
push 0x48BB1F // Exit function
|
||||||
|
ret
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void __declspec(naked) Weapon::WeaponEntCanBeGrabbed_Stub()
|
void __declspec(naked) Weapon::WeaponEntCanBeGrabbed_Stub()
|
||||||
{
|
{
|
||||||
using namespace Game;
|
using namespace Game;
|
||||||
@ -525,6 +567,9 @@ namespace Components
|
|||||||
//Utils::Hook::Nop(0x452C1D, 2);
|
//Utils::Hook::Nop(0x452C1D, 2);
|
||||||
//Utils::Hook::Nop(0x452C24, 5);
|
//Utils::Hook::Nop(0x452C24, 5);
|
||||||
|
|
||||||
|
Utils::Hook(0x59E341, CG_UpdatePrimaryForAltModeWeapon_Stub, HOOK_JUMP).install()->quick();
|
||||||
|
Utils::Hook(0x48BB25, CG_SelectWeaponIndex_Stub, HOOK_JUMP).install()->quick();
|
||||||
|
|
||||||
AddScriptMethods();
|
AddScriptMethods();
|
||||||
|
|
||||||
AssertOffset(Game::playerState_s, Game::playerState_s::weapCommon.weapFlags, 0x2BC);
|
AssertOffset(Game::playerState_s, Game::playerState_s::weapCommon.weapFlags, 0x2BC);
|
||||||
|
@ -26,6 +26,9 @@ namespace Components
|
|||||||
static int ParseWeaponConfigStrings();
|
static int ParseWeaponConfigStrings();
|
||||||
static int ClearConfigStrings(void* dest, int value, int size);
|
static int ClearConfigStrings(void* dest, int value, int size);
|
||||||
|
|
||||||
|
static void CG_UpdatePrimaryForAltModeWeapon_Stub();
|
||||||
|
static void CG_SelectWeaponIndex_Stub();
|
||||||
|
|
||||||
static void WeaponEntCanBeGrabbed_Stub();
|
static void WeaponEntCanBeGrabbed_Stub();
|
||||||
static void AddScriptMethods();
|
static void AddScriptMethods();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user