From 4b2989230421ca95b66bea296d4ce98e8c83e47a Mon Sep 17 00:00:00 2001 From: Amos <48657826+Mauler125@users.noreply.github.com> Date: Tue, 18 Jan 2022 01:21:24 +0100 Subject: [PATCH] 's_pInterfacesRegs' Pattern works for all supported builds --- r5dev/core/init.cpp | 2 +- r5dev/vpc/interfaces.cpp | 17 ++++++++++------- r5dev/vpc/interfaces.h | 20 ++++++++++++++++---- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/r5dev/core/init.cpp b/r5dev/core/init.cpp index 4679ab0a..2a85c1ce 100644 --- a/r5dev/core/init.cpp +++ b/r5dev/core/init.cpp @@ -14,7 +14,7 @@ #include "vpc/IAppSystem.h" #include "vpc/keyvalues.h" #include "vpc/basefilesystem.h" -#include "vpc/keyvalues.h" +#include "vpc/interfaces.h" #include "common/opcodes.h" #include "launcher/IApplication.h" #include "ebisusdk/EbisuSDK.h" diff --git a/r5dev/vpc/interfaces.cpp b/r5dev/vpc/interfaces.cpp index 6f17ddc2..39f83d94 100644 --- a/r5dev/vpc/interfaces.cpp +++ b/r5dev/vpc/interfaces.cpp @@ -1,10 +1,11 @@ -#include "core/stdafx.h" -#include "interfaces.h" +//===========================================================================// +// +// Purpose: A higher level link library for general use in the game and SDK. +// +//===========================================================================// -/* Might wanna move this and rename a few things? -* I'm not sure how Amos wants to structure this part of the SDK. -* - Pix -*/ +#include "core/stdafx.h" +#include "vpc/interfaces.h" //--------------------------------------------------------------------------------- // Purpose: get all factory registered in the global s_pInterfacesRegs @@ -57,4 +58,6 @@ ADDRESS IFactory::GetFactoryPtr(const std::string& factoryName, bool versionLess void IFactory::AddFactory(FactoryInfo factoryInfo) { factories.push_back(factoryInfo); // Push factory info back into the vector. -} \ No newline at end of file +} + +IFactory* g_pFactory = new IFactory(); \ No newline at end of file diff --git a/r5dev/vpc/interfaces.h b/r5dev/vpc/interfaces.h index b14b7dbb..bf32a17a 100644 --- a/r5dev/vpc/interfaces.h +++ b/r5dev/vpc/interfaces.h @@ -40,11 +40,23 @@ public: std::vector factories = {}; }; +extern IFactory* g_pFactory; namespace { /* ==== s_pInterfaceRegs ==================================================================================================================================================== */ - // Check pattern viability for all seasons. - // Make sure it properly gets the interface factory pointer. - InterfaceGlobals_t* s_pInterfacesRegs = nullptr; /* g_mGameDll.FindPatternSIMD((std::uint8_t*)"\xE9\x00\x00\x00\x00\xCC\xCC\x89\x91\x00\x00\x00\x00", "x????xxxx????").FollowNearCallSelf().FindPatternSelf("48 8B 1D", ADDRESS::Direction::DOWN).ResolveRelativeAddressSelf(0x3, 0x7).DerefSelf().RCast(); */ -} \ No newline at end of file + InterfaceGlobals_t* s_pInterfacesRegs = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\xE9\x00\x00\x00\x00\xCC\xCC\x89\x91\x00\x00\x00\x00", "x????xxxx????").FollowNearCallSelf().FindPatternSelf("48 8B 1D", ADDRESS::Direction::DOWN).ResolveRelativeAddressSelf(0x3, 0x7).DerefSelf().RCast(); +} + +/////////////////////////////////////////////////////////////////////////////// +class HFactory : public IDetour +{ + virtual void debugp() + { + std::cout << "| VAR: s_pInterfacesRegs : 0x" << std::hex << std::uppercase << s_pInterfacesRegs << std::setw(0) << " |" << std::endl; + std::cout << "+----------------------------------------------------------------+" << std::endl; + } +}; +/////////////////////////////////////////////////////////////////////////////// + +REGISTER(HFactory); \ No newline at end of file