-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update signatures and function pointers for x86-64 support #99
Closed
magnalunar
wants to merge
6
commits into
danielga:x86-64-support-sourcesdk
from
magnalunar:x86-64-support-sourcesdk
Closed
Update signatures and function pointers for x86-64 support #99
magnalunar
wants to merge
6
commits into
danielga:x86-64-support-sourcesdk
from
magnalunar:x86-64-support-sourcesdk
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
danielga
force-pushed
the
x86-64-support-sourcesdk
branch
9 times, most recently
from
October 15, 2023 22:20
4f339ee
to
16c029d
Compare
danielga
force-pushed
the
x86-64-support-sourcesdk
branch
from
October 15, 2023 23:46
16c029d
to
2f8c566
Compare
danielga
force-pushed
the
x86-64-support-sourcesdk
branch
from
October 26, 2023 22:59
2f8c566
to
a470433
Compare
Is anything still applicable? Most of what survived time (in the attached patch), seems to be non specific to the x86-64 branch, and is either not up to date or can be applied to the master branch. From 048511e1a050247f6d8c40944e9565adadeb8c70 Mon Sep 17 00:00:00 2001
From: MagnaLunar <[email protected]>
Date: Tue, 1 Aug 2023 19:46:22 +0300
Subject: [PATCH] Added symbols for CLC_CmdKeyValues, SVC_CreateStringTable and
SVC_CmdKeyValues constructors
Updated and added new signatures
Improved function pointers
Format file
---
helpers_extended/source/FunctionPointers.cpp | 23 +++++++++++++-
helpers_extended/source/Symbols.cpp | 32 +++++++++++++++-----
2 files changed, 47 insertions(+), 8 deletions(-)
diff --git a/helpers_extended/source/FunctionPointers.cpp b/helpers_extended/source/FunctionPointers.cpp
index f49f0f2..cee6f0d 100644
--- a/helpers_extended/source/FunctionPointers.cpp
+++ b/helpers_extended/source/FunctionPointers.cpp
@@ -110,10 +110,12 @@ namespace FunctionPointers
if( func_pointer == nullptr )
{
SourceSDK::FactoryLoader engine_loader( "engine" );
+
// we use a starting point for sigscan because, on Linux, CBaseClient::ConnectionStart
// and CBaseClientState::ConnectionStart have the same signature
// this code expects CBaseClient::ConnectionStart to appear before
// CBaseClientState::ConnectionStart
+
func_pointer = ResolveSymbols<CBaseClientState_ConnectionStart_t>(
engine_loader, Symbols::CBaseClientState_ConnectionStart,
reinterpret_cast<const uint8_t *>( CBaseClient_ConnectionStart( ) ) + 16
@@ -132,6 +134,19 @@ namespace FunctionPointers
func_pointer = ResolveSymbols<CLC_CmdKeyValues_Constructor_t>(
engine_loader, Symbols::CLC_CmdKeyValues_Constructor
);
+
+ // we use an offset for the function pointer because, on Linux, Base_CmdKeyValues::Base_CmdKeyValues
+ // and CLC_CmdKeyValues::CLC_CmdKeyValues have the same signature
+ // this code adds the necessary offset to locate CLC_CmdKeyValues::CLC_CmdKeyValues
+
+#if defined SYSTEM_LINUX && defined ARCHITECTURE_X86_64
+
+ const uint8_t *tmp_func_pointer = reinterpret_cast<const uint8_t *>( func_pointer ) + 32;
+
+ func_pointer = reinterpret_cast<CLC_CmdKeyValues_Constructor_t>( tmp_func_pointer );
+
+#endif
+
}
return func_pointer;
@@ -143,9 +158,13 @@ namespace FunctionPointers
if( func_pointer == nullptr )
{
SourceSDK::FactoryLoader engine_loader( "engine" );
+
+ // we use a starting point for sigscan because SVC_CmdKeyValues::SVC_CmdKeyValues
+ // appears before SVC_CreateStringTable::SVC_CreateStringTable
+
func_pointer = ResolveSymbols<SVC_CreateStringTable_Constructor_t>(
engine_loader, Symbols::SVC_CreateStringTable_Constructor,
- reinterpret_cast<const uint8_t *>( CBaseClientState_ConnectionStart( ) ) + 16
+ reinterpret_cast<const uint8_t *>( SVC_CmdKeyValues_Constructor( ) ) + 16
);
}
@@ -158,10 +177,12 @@ namespace FunctionPointers
if( func_pointer == nullptr )
{
SourceSDK::FactoryLoader engine_loader( "engine" );
+
// we use a starting point for sigscan because SVC_CmdKeyValues::SVC_CmdKeyValues
// and CLC_CmdKeyValues::CLC_CmdKeyValues have the same signature
// this code expects CLC_CmdKeyValues::CLC_CmdKeyValues to appear before
// SVC_CmdKeyValues::SVC_CmdKeyValues
+
func_pointer = ResolveSymbols<SVC_CmdKeyValues_Constructor_t>(
engine_loader, Symbols::SVC_CmdKeyValues_Constructor,
reinterpret_cast<const uint8_t *>( CLC_CmdKeyValues_Constructor( ) ) + 16
diff --git a/helpers_extended/source/Symbols.cpp b/helpers_extended/source/Symbols.cpp
index 20b61df..192d17d 100644
--- a/helpers_extended/source/Symbols.cpp
+++ b/helpers_extended/source/Symbols.cpp
@@ -35,11 +35,17 @@ namespace Symbols
Symbol::FromName( "?ConnectionStart@CBaseClientState@@UEAAXPEAVINetChannel@@@Z" )
};
- const std::vector<Symbol> CLC_CmdKeyValues_Constructor = { };
+ const std::vector<Symbol> CLC_CmdKeyValues_Constructor = {
+ Symbol::FromSignature( "\x48\x8D\x05\x2A\x2A\x2A\x2A\xC6\x41\x08\x01\x48\x89\x01\x48\x8B\xC1" )
+ };
- const std::vector<Symbol> SVC_CreateStringTable_Constructor = { };
+ const std::vector<Symbol> SVC_CreateStringTable_Constructor = {
+ Symbol::FromSignature( "\x40\x53\x48\x83\xEC\x20\x48\x8B\xD9\xC6\x41\x08\x01\x33\xC9\x48\x8D\x05\x2A\x2A\x2A\x2A\x48\x89\x4B\x10" )
+ };
- const std::vector<Symbol> SVC_CmdKeyValues_Constructor = { };
+ const std::vector<Symbol> SVC_CmdKeyValues_Constructor = {
+ Symbol::FromSignature( "\x48\x8D\x05\x2A\x2A\x2A\x2A\xC6\x41\x08\x01\x48\x89\x01\x48\x8B\xC1" )
+ };
const std::vector<Symbol> CBaseServer_RecalculateTags = {
Symbol::FromName( "?RecalculateTags@CBaseServer@@QEAAXXZ" )
@@ -120,15 +126,15 @@ namespace Symbols
};
const std::vector<Symbol> CLC_CmdKeyValues_Constructor = {
- Symbol::FromSignature( "\x55\x8B\xEC\x8B\x45\x2A\x89\x41\x2A\x8B\xC1\xC6\x41\x2A\x01\xC7\x41\x2A\x00\x00\x00\x00\xC7\x01\x2A\x2A\x2A\x2A\x5D\xC2\x04\x00" )
+ Symbol::FromSignature( "\x55\x8B\xEC\x8B\x45\x08\x89\x41\x0C\x8B\xC1\xC6\x41\x04\x01\xC7\x41\x08\x00\x00\x00\x00\xC7\x01\x2A\x2A\x2A\x2A\x5D\xC2\x04\x00" )
};
const std::vector<Symbol> SVC_CreateStringTable_Constructor = {
- Symbol::FromSignature( "\x56\x8B\xF1\x8D\x4E\x2A\xC6\x46\x2A\x01" )
+ Symbol::FromSignature( "\x56\x8B\xF1\xC6\x46\x04\x01\x8D\x4E\x54\xC7\x46\x08\x00\x00\x00\x00\xC7\x06\x2A\x2A\x2A\x2A\xC6\x46\x34\x00" )
};
const std::vector<Symbol> SVC_CmdKeyValues_Constructor = {
- Symbol::FromSignature( "\x55\x8B\xEC\x8B\x45\x2A\x89\x41\x2A\x8B\xC1\xC6\x41\x2A\x01\xC7\x41\x2A\x00\x00\x00\x00\xC7\x01\x2A\x2A\x2A\x2A\x5D\xC2\x04\x00" )
+ Symbol::FromSignature( "\x55\x8B\xEC\x8B\x45\x08\x89\x41\x0C\x8B\xC1\xC6\x41\x04\x01\xC7\x41\x08\x00\x00\x00\x00\xC7\x01\x2A\x2A\x2A\x2A\x5D\xC2\x04\x00" )
};
const std::vector<Symbol> CBaseServer_RecalculateTags = {
@@ -264,6 +270,10 @@ namespace Symbols
Symbol::FromSignature( "\x55\x89\xE5\x8B\x45\x2A\x8B\x55\x2A\xC6\x40\x2A\x01\xC7\x40\x2A\x00\x00\x00\x00\x89\x50\x2A\xC7\x00\x2A\x2A\x2A\x2A\x5D\xC3" )
+#elif defined ARCHITECTURE_X86_64
+
+ Symbol::FromSignature( "\x55\x48\x8D\x05\x2A\x2A\x2A\x2A\xC6\x47\x2A\x2A\x48\x89\xE5\x48\xC7\x47\x2A\x2A\x2A\x2A\x2A\x48\x89\x77\x2A\x48\x89\x07\x5D\xC3" )
+
#endif
};
@@ -275,6 +285,10 @@ namespace Symbols
Symbol::FromSignature( "\x55\x89\xE5\x53\x83\xEC\x14\x8B\x5D\x2A\x8D\x43\x2A\xC6\x43\x2A\x01" )
+#elif defined ARCHITECTURE_X86_64
+
+ Symbol::FromSignature( "\x55\x48\x8D\x05\x2A\x2A\x2A\x2A\x48\x89\xE5\x53\x48\x89\xFB\x48\x8D\xBF\x2A\x2A\x2A\x2A\x48\x83\xEC\x2A\xC6\x47" )
+
#endif
};
@@ -286,6 +300,10 @@ namespace Symbols
Symbol::FromSignature( "\x55\x89\xE5\x8B\x45\x2A\x8B\x55\x2A\xC6\x40\x2A\x01\xC7\x40\x2A\x00\x00\x00\x00\x89\x50\x2A\xC7\x00\x2A\x2A\x2A\x2A\x5D\xC3" )
+#elif defined ARCHITECTURE_X86_64
+
+ Symbol::FromSignature( "\x55\x48\x8D\x05\x2A\x2A\x2A\x2A\xC6\x47\x2A\x2A\x48\x89\xE5\x48\xC7\x47\x2A\x2A\x2A\x2A\x2A\x48\x89\x77\x2A\x48\x89\x07\x5D\xC3" )
+
#endif
};
@@ -371,7 +389,7 @@ namespace Symbols
#elif defined ARCHITECTURE_X86_64
const Symbol Steam3Server =
- Symbol::FromSignature( "\x55\x48\x8D\x05\x2A\x2A\x2A\x2A\x48\x89\xE5\x5D\xC3\x90\x66\x90\x55\x31\xC0\xB9\x09\x00\x00\x00\x48\x89\xE5\x41\x57\xBE" );
+ Symbol::FromSignature( "\x55\x48\x8D\x05\x2A\x2A\x2A\x2A\x48\x89\xE5\x5D\xC3\x2A\x2A\x2A\x55\x31\xC0\xB9\x2A\x2A\x2A\x2A\x48\x89\xE5\x41\x57\xBE" );
#endif
--
2.43.0.windows.1 |
magnalunar
force-pushed
the
x86-64-support-sourcesdk
branch
from
March 8, 2024 16:58
41abe00
to
0f7d14c
Compare
Yes, some things have been changed and are no longer up to date. Therefore, I'm updating my fork from the upstream and closing this pull request, as the important changes have already been merged. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixed:
Improvements:
Test results with gm_sourcenet: