Beispiel #1
0
void HookArmor()
{
	DetourAttach((void**)MyClass::_UNKNOWN_0046F0B0_GetPtr(), (void*)GetFnAddr(&MyClass::TEST_0046F0B0));
	DetourAttach((void**)MyClass::_UNKNOWN_0046E720_GetPtr(), (void*)GetFnAddr(&MyClass::TEST_0046E720));
	//DetourAttach((void**)MyClass::_UNKNOWN_00432070_GetPtr(), *(void**)(&TEST_00432070));
	//auto TEST_00734F50 = &MyClass::TEST_00734F50;
	//auto TEST_00AB53E0 = &MyClass::TEST_00AB53E0;
	//DetourAttach((void**)MyClass::_UNKNOWN_00734F50_GetPtr(), *(void**)(&TEST_00734F50));
	//DetourAttach((void**)MyClass::_UNKNOWN_00AB53E0_GetPtr(), *(void**)(&TEST_00AB53E0));
}
void DehookMemory()
{
	//DetourDetach((void**)&OLD_0042C840, TEST_0042C840);
	//DetourDetach((void**)&OLD_0042C870, TEST_0042C870);
	//DetourDetach((void**)&OLD_00BE70B0, TEST_00BE70B0);
	DetourDetach((void**)HookHeap::_Allocate_GetPtr(), (void*)GetFnAddr(&HookHeap::Allocate));
	DetourDetach((void**)UnkHeapStruct1::_Unknown00436740_GetPtr(), (void*)GetFnAddr(&UnkHeapStruct1::TEST_00436740));
	DetourDetach((void**)UnkRCManager::_WaitForRun_GetPtr(), (void*)GetFnAddr(&UnkRCManager::WaitForRun));
	DetourDetach((void**)hkSkyrimMemoryAllocator::_blockAlloc_GetPtr(), (void*)GetFnAddr(&hkSkyrimMemoryAllocator::blockAllocGuard));
	DetourDetach((void**)hkSkyrimMemoryAllocator::_blockFree_GetPtr(), (void*)GetFnAddr(&hkSkyrimMemoryAllocator::blockFreeGuard));
}
Beispiel #3
0
void Hooks_SaveLoad_Commit(void)
{
	// Load & save
	WriteRelCall(0x006814D0 + 0x01E2, GetFnAddr(&BGSSaveLoadManager::SaveGame_Hook));
	WriteRelCall(0x006821C0 + 0x00B5, GetFnAddr(&BGSSaveLoadManager::LoadGame_Hook));
	WriteRelCall(0x0069CBD0 + 0x0064, GetFnAddr(&BGSSaveLoadManager::ProcessEvents_Hook));

	// New Game
	WriteRelCall(0x00876710 + 0x57, GetFnAddr(&TESQuest::NewGame_Hook));

	// Delete savegame
	WriteRelCall(0x00677600 + 0x10, (UInt32)DeleteSavegame_Hook); // DeleteGame
	WriteRelCall(0x00677890 + 0x73, (UInt32)DeleteSavegame_Hook); // SaveGame overwrite (= delete+new)
}
void Hooks_Papyrus_Commit(void)
{
#ifdef PAPYRUS_CUSTOM_CLASS
	SafeWrite32(0x010EAA64, GetFnAddr(&IObjectHandlePolicy::Unk_02_Hook));
	SafeWrite32(0x010EAA60, GetFnAddr(&IObjectHandlePolicy::IsType_Hook));
	SafeWrite32(0x010EAA6C, GetFnAddr(&IObjectHandlePolicy::Create_Hook));
	SafeWrite32(0x010EAA7C, GetFnAddr(&IObjectHandlePolicy::Resolve_Hook));
#endif

	WriteRelCall(0x008D7A40 + 0x098B, (UInt32)RegisterPapyrusFunctions_Hook);

	// GlobalData / event regs
	WriteRelCall(0x008D6550 + 0x002A, GetFnAddr(&SkyrimVM::OnFormDelete_Hook));
	WriteRelCall(0x008D6990 + 0x0017, GetFnAddr(&SkyrimVM::RevertGlobalData_Hook)); // Normal game load
	WriteRelCall(0x008D6D00 + 0x0116, GetFnAddr(&SkyrimVM::RevertGlobalData_Hook)); // New script reload command
	WriteRelCall(0x008D3750 + 0x0101, GetFnAddr(&SkyrimVM::SaveGlobalData_Hook));
	WriteRelCall(0x008D69C0 + 0x01B9, GetFnAddr(&SkyrimVM::LoadGlobalData_Hook));

//	SafeWrite32(0x01149B98 + 4 * 3, GetFnAddr(&VMClassLoader::Load_Hook));
}
void Hooks_SaveLoad_Commit(void)
{
	// Load & Save
	g_branchTrampoline.Write5Call(SaveGame_HookTarget_Enter, GetFnAddr(&BGSSaveLoadManager::SaveGame_Hook));
	g_branchTrampoline.Write5Call(SaveGame2_HookTarget_Enter, GetFnAddr(&BGSSaveLoadManager::SaveGame_Hook));
	g_branchTrampoline.Write5Call(LoadGame_HookTarget_Enter, GetFnAddr(&BGSSaveLoadManager::LoadGame_Hook));
	g_branchTrampoline.Write5Call(ProcessEvents_Enter, GetFnAddr(&BGSSaveLoadManager::ProcessEvents_Hook));

	// New Game
	g_branchTrampoline.Write5Call(NewGame_Enter, GetFnAddr(&TESQuest::NewGame_Hook));

	// Delete savegame
	g_branchTrampoline.Write5Call(DeleteSaveGame_Enter, GetFnAddr(&BGSSaveLoadManager::DeleteSavegame_Hook));
	g_branchTrampoline.Write5Call(DeleteSaveGame_Enter2, GetFnAddr(&BGSSaveLoadManager::DeleteSavegame_Hook));
}
void RegisterPapyrusFunctions_Hook(VMClassRegistry ** registryPtr)
{
#if LOG_PAPYRUS_FUNCTIONS
	// this is all kinds of bad
	VTableProxy	** vtableProxy = (VTableProxy **)registryPtr;
	void		* oldRegisterFunction = (*vtableProxy)->vtbl[0x16 + 1];
	SafeWrite32((UInt32)&(*vtableProxy)->vtbl[0x16 + 1], GetFnAddr(&VTableProxy::RegisterFunction_Hook));
#endif

	// call original code
	RegisterPapyrusFunctions(registryPtr);

#if LOG_PAPYRUS_FUNCTIONS
	SafeWrite32((UInt32)&(*vtableProxy)->vtbl[0x16 + 1], (UInt32)oldRegisterFunction);
#endif

	VMClassRegistry * registry = *registryPtr;

	// SKSE
	papyrusSKSE::RegisterFuncs(registry);

	// TESForm
	papyrusForm::RegisterFuncs(registry);

	// DefaultObjectManager
	papyrusDefaultObjectManager::RegisterFuncs(registry);

	// ColorForm
	papyrusColorComponent::RegisterFuncs(registry);
	papyrusColorForm::RegisterFuncs(registry);

	// Art
	papyrusArt::RegisterFuncs(registry);

	// EquipSlot
	papyrusEquipSlot::RegisterFuncs(registry);

	// HeadPart
	papyrusHeadPart::RegisterFuncs(registry);

	// TESObjectCELL
	papyrusCell::RegisterFuncs(registry);

	// ArmorAddon (TESObjectARMA)
	papyrusArmorAddon::RegisterFuncs(registry);

	// TESObjectARMO
	papyrusArmor::RegisterFuncs(registry);

	// TESSoulGem
	papyrusSoulGem::RegisterFuncs(registry);

	// BGSApparatus
	papyrusApparatus::RegisterFuncs(registry);

	// Math
	papyrusMath::RegisterFuncs(registry);

	// Input
	papyrusInput::RegisterFuncs(registry);

	// ObjectReference
	papyrusObjectReference::RegisterFuncs(registry);

	// Weapon
	papyrusWeapon::RegisterFuncs(registry);

	// Ammo
	papyrusAmmo::RegisterFuncs(registry);

	// CombatStyle
	papyrusCombatStyle::RegisterFuncs(registry);

	// Actor
	papyrusActor::RegisterFuncs(registry);

	// ActorBase (TESNPC)
	papyrusActorBase::RegisterFuncs(registry);

	// Outfit
	papyrusOutfit::RegisterFuncs(registry);

	// Potion
	papyrusPotion::RegisterFuncs(registry);

	// Race
	papyrusRace::RegisterFuncs(registry);

	// Spell
	papyrusSpell::RegisterFuncs(registry);

	// Enchantment
	papyrusEnchantment::RegisterFuncs(registry);

	// Ingredient
	papyrusIngredient::RegisterFuncs(registry);

	// Scroll
	papyrusScroll::RegisterFuncs(registry);

	// StringUtil
	papyrusStringUtil::RegisterFuncs(registry);

	// Keyword
	papyrusKeyword::RegisterFuncs(registry);

	// TESObjectBOOK
	papyrusBook::RegisterFuncs(registry);

	// ConstructibleObject
	papyrusConstructibleObject::RegisterFuncs(registry);

#ifdef PAPYRUS_CUSTOM_CLASS
	// TintMask
	papyrusTintMask::RegisterFuncs(registry);
#endif

	// Game
	papyrusGame::RegisterFuncs(registry);

	// UI
	papyrusUI::RegisterFuncs(registry);

	// Alias
	papyrusAlias::RegisterFuncs(registry);

	// Quest
	papyrusQuest::RegisterFuncs(registry);

	// Shout
	papyrusShout::RegisterFuncs(registry);

	// Utility
	papyrusUtility::RegisterFuncs(registry);

	// ActiveMagicEffect
	papyrusActiveMagicEffect::RegisterFuncs(registry);

	// SoundDescriptor
	papyrusSoundDescriptor::RegisterFuncs(registry);

	// Sound
	papyrusSound::RegisterFuncs(registry);

	// Weather
	papyrusWeather::RegisterFuncs(registry);

	// NetImmerse
	papyrusNetImmerse::RegisterFuncs(registry);

	// TextureSet
	papyrusTextureSet::RegisterFuncs(registry);

	// Tree
	papyrusTree::RegisterFuncs(registry);

	// Flora
	papyrusFlora::RegisterFuncs(registry);

	// Perk
	papyrusPerk::RegisterFuncs(registry);

	// MagicEffect
	papyrusMagicEffect::RegisterFuncs(registry);

	// UICallback
	papyrusUICallback::RegisterFuncs(registry);

	// ModEvent
	papyrusModEvent::RegisterFuncs(registry);

	// ActorValueInfo
	papyrusActorValueInfo::RegisterFuncs(registry);

	// LeveledItem
	papyrusLeveledItem::RegisterFuncs(registry);

	// LeveledSpell
	papyrusLeveledSpell::RegisterFuncs(registry);

	// LeveledActor
	papyrusLeveledActor::RegisterFuncs(registry);

	// WornObject
	papyrusWornObject::RegisterFuncs(registry);

//#ifdef _PPAPI
	// Plugins
	for(PapyrusPluginList::iterator iter = s_pap_plugins.begin(); iter != s_pap_plugins.end(); ++iter)
	{
		(*iter)(registry);
	}
//#endif
}
ResourceManager::~ResourceManager(void)
{
	DetourDetach((void**)NiObjectProxy::_release_GetPtr(), (void*)GetFnAddr(&NiObjectProxy::myRelease));
}
void Hooks_Threads_Commit(void)
{
	WriteRelCall(0x006910F0 + 0x016, GetFnAddr(&BSTaskPool::ProcessTasks));
	WriteRelCall(0x0069CBD0 + 0x578, GetFnAddr(&BSTaskPool::ProcessTasks));
}
Beispiel #9
0
void Hooks_Data_Commit(void)
{
	g_branchTrampoline.Write5Call(LoadScripts_Enter.GetUIntPtr(), GetFnAddr(&DataHandler::LoadScripts_Hook));
}
Beispiel #10
0
void DehookArmor()
{
	DetourDetach((void**)MyClass::_UNKNOWN_0046F0B0_GetPtr(), (void*)GetFnAddr(&MyClass::TEST_0046F0B0));
	DetourDetach((void**)MyClass::_UNKNOWN_0046E720_GetPtr(), (void*)GetFnAddr(&MyClass::TEST_0046E720));
}