Skip to content
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

Source2Gen is an executable + Linux support #48

Open
Cre3per opened this issue Apr 21, 2024 · 0 comments
Open

Source2Gen is an executable + Linux support #48

Cre3per opened this issue Apr 21, 2024 · 0 comments

Comments

@Cre3per
Copy link

Cre3per commented Apr 21, 2024

PR #47

My dear ladies, I bring sunshine! (And a large pull request, sorry for that)

dll -> exe

The goal of this issue is to convert source2gen from an injected library to an executable. This brings several benefits

  • Ease of use, no need for an injector
  • Works on headless systems (Servers), because the game does't need to be running
  • No more waiting for the game to be ready, we make it ready!
    • It's fast, about 2 seconds to dump CS2, start to finish
      • makes debugging a bliss
  • Single-threaded
  • No manually-created console

How does it work?

  • Load all libraries that we intend to dump
  • Call InstallSchemaBindings() in each of those libraries
  • Dump as per usual

Linux Support

This is what makes the issue a little bigger. I don't have Windows, and I can't run games, so I had to make both changes at once.

How does it work?

  • Add some macros to make conditional code easier (tools/platform.h)
  • Add a cross-platform module loader that uses libloaderapi on Windows and dlfcn on Linux (tools/loader.h)
  • Update structs and assertions to match offsets in Linux games
  • Make the code compatible with more compilers (clang++, g++)
    • Fix case-sensitive file and entity names
    • Add missing includes
    • NOP mscv macros on Linux
    • Some other minor changes

Status

This is where this issue still needs help. As I don't have Windows and there is no CI, I can't make sure I'm not breaking anything. I wrote all code with Windows in mind, it should still work, but I can't test it.

  • ✔️ Runs and dumps on linux
  • 🚫 Generated SDK tested on Linux - Postponed, merge in alpha quality with disclaimer in readme to avoid diverging from master
  • ❌ Compiles on Windows
    • ❌ Update premake to build an executable instead of a library
    • ❌ Fix loader_windows.h if necessary
    • ❌ Fix compiler bugs that were added in the linux port, if necessary
  • ❌ Runs on Windows without crashing
  • ❌ Dumps on Windows, with no regressions
  • ❌ Documentation about how to run source2gen on Windows (Need to set PATH to load libraries) (Hint: Perhaps we can use the registry to find the game path and set PATH automatically)
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

No branches or pull requests

1 participant