Skip to content

update for 64 bits#38

Open
bottiger1 wants to merge 4 commits into
KyleSanderson:masterfrom
bottiger1:x64
Open

update for 64 bits#38
bottiger1 wants to merge 4 commits into
KyleSanderson:masterfrom
bottiger1:x64

Conversation

@bottiger1

@bottiger1 bottiger1 commented May 7, 2024

Copy link
Copy Markdown

probably broke buildbot with this due to ambuild issues. can't run hl2sdk_manifest script outside of source dir nor can you make a symlink outside of it so I made the symlink in a bash script.

do what you will with this

@C0deSlasher

Copy link
Copy Markdown

I would test this if I could, but I need the Windows version of the extension. I tried building it myself (which is really hard to do because there are no instructions on how to build it), but AMBuild is refusing to cooperate and is complaining of errors in swgsdetours.cpp:

swgsdetours.cpp
C:[path]\steamworks-x64\Extension\swgsdetours.cpp(38): error C2065: 'SteamGameServer_InitSafeDetour': undeclared identifier
C:[path]\steamworks-x64\Extension\swgsdetours.cpp(38): error C2062: type 'bool' unexpected
C:[path]\steamworks-x64\Extension\swgsdetours.cpp(39): error C2143: syntax error: missing ';' before '{'
C:[path]\steamworks-x64\Extension\swgsdetours.cpp(39): error C2447: '{': missing function header (old-style formal list?)
C:[path]\steamworks-x64\Extension\swgsdetours.cpp(100): error C2065: 'SteamGameServer_InitSafeDetour': undeclared identifier
C:[path]\steamworks-x64\Extension\swgsdetours.cpp(100): error C2065: 'SteamGameServer_InitSafeDetour_Actual': undeclared identifier

@bottiger1

Copy link
Copy Markdown
Author

I'm not willing to spend much of my time on the windows version given that I don't have a windows build environment set up, and the lack of other people working on 64 bits is sucking up most of my time.

Your error indicates there is something wrong with your DETOUR_DECL_STATIC6 macro. Either it's missing or corrupted or your compiler is out of date.

@C0deSlasher

Copy link
Copy Markdown

The DETOUR_DECL_STATIC6 macro from swgsdetours.cpp is the same as yours. It came from your fork.

I am trying to use Visual Studio Community 2022 as the C++ compiler.

@bottiger1

Copy link
Copy Markdown
Author

I'm sorry but I cannot offer you any more support on this. My fork doesn't have the macro, it comes from sourcemod.

@C0deSlasher

C0deSlasher commented May 19, 2024

Copy link
Copy Markdown

Sorry, you are right, that does come from SourceMod. The point that I am trying to make is that something is preventing me from building this. Other Windows users may need help with this as well if you or someone else does not build it for them.

Also of interest is that I am using the version of SourceMod that your .yml work file is recommending: 1.7. How are you making this work with such an old version of SourceMod?

@C0deSlasher

C0deSlasher commented May 31, 2024

Copy link
Copy Markdown

I was able to get your previous version to build using Visual Studio 2015, hl2sdk-sdk2013, SourceMod 1.12 (not 1.7 like .github\workflows\c-cpp.yml suggested, which is what caused the problems earlier), MetaMod 2.0 (not 1.10), and a version of the Steamworks SDK that I found on here from someone. However, it resulted in a 32-bit extension instead of a 64-bit extension, and any attempt to force Visual Studio 2015 to make a 64-bit extension failed. Funny how something as simple as adding "--target x86_64" allowed for the x86 x64 cross tools compiler to initialize configure.py with your newest version, but now, it looks like you added some extra requirements, as ambuild is now complaining of missing "Zydis.c".

I know that you do not have much time, but I am determined to make this work. Hopefully, if we can come up with a solution, other Windows users may benefit from it.

Would you be willing to at least tell me what dependencies, dependency versions, and compiler you are using?

@bottiger1

Copy link
Copy Markdown
Author

I did not test windows, it may have compiler flags missing in windows. If there is some file that sets sourcemod to be an ancient version on windows, that is because I don't know about it. I have no idea how this build system works in windows. I used the latest sourcemod and metamod.

Zydis was moved out of the CDetour folder. Just look for it on the sourcemod github. When I was working on my pull request for sourcemod I put it in the CDetour folder, but someone close to the core devs decided to take over what I started and put it in a different directory.

@C0deSlasher

Copy link
Copy Markdown

Updating my copy of the master branch of SourceMod helped me find the Zydis files, but you also made safetyhook.cpp a requirement. That file expects to find an include file called "optional", which does not exist in SourceMod's master branch. Any idea where I might be able to find that file?

@rafradek

Copy link
Copy Markdown

Yeah, recent sourcemod changes moved safetyhook files around, the build script needs to be updated

@sapphonie

Copy link
Copy Markdown

Is this stale? I want this merged

@sapphonie

Copy link
Copy Markdown

cc @bottiger1

@C0deSlasher

Copy link
Copy Markdown

Is this stale? I want this merged

Unfortunately, I can almost guarantee that this is stale. This seems to happen a lot with SourceMod plugins and extensions, especially nowadays. Usually, someone else has to make their own fork for development to continue.

@bottiger1

Copy link
Copy Markdown
Author

I'm not sure why I'm being CCed for this, I have no control over this project.

The only changes you'd need to make this work now is to update the location of cdetour to point to sourcemod

'CDetour/Zydis.c',

And wrap these 2 includes with "if posix" if compiling on windows.

#include <dlfcn.h>

I've been using this with no issues for the past year.

@szentigrad3

Copy link
Copy Markdown

I'm not sure why I'm being CCed for this, I have no control over this project.

The only changes you'd need to make this work now is to update the location of cdetour to point to sourcemod

'CDetour/Zydis.c',

And wrap these 2 includes with "if posix" if compiling on windows.

#include <dlfcn.h>

I've been using this with no issues for the past year.

Is there a built linux 64bit version because im trying to get this to work on my Team Fortress 2 Dedicated Server

@Maxim766

Maxim766 commented May 1, 2026

Copy link
Copy Markdown

@KyleSanderson Could you review this PR, please?

moonexpr added a commit to moonexpr/SteamWorks that referenced this pull request Jun 16, 2026
The Steam API library path was hardcoded to the 32-bit "./bin/libsteam_api.so"
layout, which is not guaranteed to exist on a 64-bit srcds. Discover the
actually-loaded library via dl_iterate_phdr so the Steam interface creators
resolve regardless of architecture / install layout, falling back to the old
path and keeping the gamedata LibSteamAPI override.

Adopts the runtime-discovery approach from bottiger1's prior 64-bit PR
(KyleSanderson#38).
@moonexpr

Copy link
Copy Markdown

Hi @bottiger1 — heads up, I opened a 64-bit PR for SteamWorks (#39) and only
spotted yours afterwards. It lands on the same approach you took here: multi-arch
AMBuildScript, dropping the bundled 32-bit CDetour/asm, the ForceHeartbeat
change, and the DETOUR_CREATE_STATIC_FIXED macro. I also pulled in your
dl_iterate_phdr discovery of libsteam_api.so (credited in the commit) — good
call, the hardcoded ./bin/libsteam_api.so isn't portable across install layouts.

On top of that, #39 builds safetyhook from SourceMod's bundled copy so the detour
layer actually links, builds + packages both x86 and x86_64 on linux and windows
(CI green), and is validated loading + running on a live 64-bit TF2 server. Credit
to you for the original 64-bit work — figured I'd cross-link so it isn't lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants