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

Using Reloaded.Hooks on Linux #27

Open
NotNite opened this issue Nov 13, 2024 · 1 comment
Open

Using Reloaded.Hooks on Linux #27

NotNite opened this issue Nov 13, 2024 · 1 comment

Comments

@NotNite
Copy link

NotNite commented Nov 13, 2024

Hi! I use Reloaded libraries in GDWeave, a mod loader for Godot Engine games. Recently the topic of adding native Linux support has come up (shouldn't be too difficult assuming I can adjust my hooks+sigs), but I'm running into the issue that Reloaded.Hooks only works on Windows.

It looks like the dependency on Reloaded.Memory.Buffers is over 2 years old, and while the latest updates make it work cross-platform, Reloaded.Hooks hasn't been updated for it. Is this the only blocker for Linux support in Reloaded.Hooks, or am I mistaken? If so, how much effort would it be to port it to a newer version?

Thanks!

@Sewer56
Copy link
Member

Sewer56 commented Nov 13, 2024

The other blocker is FASM. Reloaded.Hooks relies on FASM for assembly code generation under the hood.

FASM itself is written in assembly, 32-bit assembly. While there is a hack on Windows to make it run in 64-bit processes, the same is not possible on Linux. I tried a while back at least. I forked fasmDLL and made the exports work on Linux IIRC, not only Wimdows.

Namely, on Linux it does not appear possible to relocate the binary in memory, so you'd need to build it with the assumption it lives at a specific memory address and always map it there. I forgot the exact technical details there. You could in theory still run the CLI tool as separate process, but that would be dreadfully slow at runtime.

I started work on a Rust successor halfway through last year reloaded-hooks-rs. The successor IS multi-platform AND multi-architecture, however it's only around 80% done. All the 'hard' parts are done, just some final bits functionality wise, a C API, C# API and wrapper for old library are missing. I took a hiatus from it however back in March to focus on the Reloaded3 spec, and now I'm on another side project sewer56-archive-nx that's part of R3 long term. This other side subproject, will be done around new year's. After that I could pick up hooks again.

I wouldn't expect new hooks lib to be available until some time half way through next year however.

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

2 participants