gamemode: Implement FeralInteractive/gamemode support #437

Merged
PiergiorgioZagaria merged 11 commits from main into main 2022-07-28 11:12:25 +00:00
PiergiorgioZagaria commented 2022-07-27 08:53:00 +00:00 (Migrated from github.com)
  • By selecting this checkbox, I agree to license my contributions to this project under the license(s) described in the LICENSE file, and I have the right to do so or have received permission to do so by an employer or client I am producing work for whom has this right.

The previous comment assumed that we needed to compile the gamemode shared library ourselves, which is wrong, so I deleted the old comment.

As a sidenote: getEnvVarOwned() was taken from utils.zig (it is used to check GPU_BACKEND), when exiting the program, the gpa said there were memory leaks, which were caused by getEnvVarOwned(). Should we free the other strings where it's called too?

- [X] By selecting this checkbox, I agree to license my contributions to this project under the license(s) described in the LICENSE file, and I have the right to do so or have received permission to do so by an employer or client I am producing work for whom has this right. The previous comment assumed that we needed to compile the gamemode shared library ourselves, which is wrong, so I deleted the old comment. As a sidenote: `getEnvVarOwned()` was taken from utils.zig (it is used to check GPU_BACKEND), when exiting the program, the gpa said there were memory leaks, which were caused by `getEnvVarOwned()`. Should we free the other strings where it's called too?
emidoots (Migrated from github.com) reviewed 2022-07-28 08:59:57 +00:00
emidoots (Migrated from github.com) commented 2022-07-28 08:59:57 +00:00

Maybe move these blocks into a separate function we call from here, e.g. platform.deinitLinuxGameMode()

Maybe move these blocks into a separate function we call from here, e.g. `platform.deinitLinuxGameMode()`
emidoots (Migrated from github.com) reviewed 2022-07-28 09:00:16 +00:00
@ -40,3 +42,4 @@
const EventQueue = std.TailQueue(structs.Event);
const EventNode = EventQueue.Node;
emidoots (Migrated from github.com) commented 2022-07-28 09:00:15 +00:00

Same here, so the init function doesn't grow too large.

Same here, so the `init` function doesn't grow too large.
emidoots (Migrated from github.com) reviewed 2022-07-28 09:01:10 +00:00
emidoots (Migrated from github.com) commented 2022-07-28 09:01:10 +00:00

what's the motivation for using translate-c vs. just directly importing the header?

what's the motivation for using translate-c vs. just directly importing the header?
emidoots commented 2022-07-28 09:05:22 +00:00 (Migrated from github.com)

As a sidenote: getEnvVarOwned() was taken from utils.zig (it is used to check GPU_BACKEND), when exiting the program, the gpa said there were memory leaks, which were caused by getEnvVarOwned(). Should we free the other strings where it's called too?

Definitely, it probably was copied from a build script where free'ing is not important due to arena allocator. Do you want to include a commit to fix it (or send another PR)?

> As a sidenote: getEnvVarOwned() was taken from utils.zig (it is used to check GPU_BACKEND), when exiting the program, the gpa said there were memory leaks, which were caused by getEnvVarOwned(). Should we free the other strings where it's called too? Definitely, it probably was copied from a build script where free'ing is not important due to arena allocator. Do you want to include a commit to fix it (or send another PR)?
PiergiorgioZagaria (Migrated from github.com) reviewed 2022-07-28 09:15:21 +00:00
PiergiorgioZagaria (Migrated from github.com) commented 2022-07-28 09:15:20 +00:00

zig translate-c produced a zig file with an error that made it not compile. It tried to @alignCast(std.meta.alignment(?*anyopaque), &REAL_internal_gamemode_request_start), for all the functions. In fetch_upstream.sh I delete that part to make it compile

`zig translate-c` produced a zig file with an error that made it not compile. It tried to `@alignCast(std.meta.alignment(?*anyopaque), &REAL_internal_gamemode_request_start)`, for all the functions. In fetch_upstream.sh I delete that part to make it compile
PiergiorgioZagaria commented 2022-07-28 09:31:51 +00:00 (Migrated from github.com)

After checking more closely I noticed the getEnvVarOwned() that leaked were all in the build scripts, I guess there is no need to fix them

After checking more closely I noticed the `getEnvVarOwned()` that leaked were all in the build scripts, I guess there is no need to fix them
emidoots (Migrated from github.com) reviewed 2022-07-28 09:40:18 +00:00
emidoots (Migrated from github.com) commented 2022-07-28 09:40:17 +00:00

did these symlink changes make it into here by accident? feel free to force-push if so

did these symlink changes make it into here by accident? feel free to force-push if so
PiergiorgioZagaria (Migrated from github.com) reviewed 2022-07-28 09:47:54 +00:00
PiergiorgioZagaria (Migrated from github.com) commented 2022-07-28 09:47:54 +00:00

I was testing if it worked and forgot to go back to how it was before

I was testing if it worked and forgot to go back to how it was before
emidoots (Migrated from github.com) reviewed 2022-07-28 09:48:30 +00:00
emidoots (Migrated from github.com) commented 2022-07-28 09:48:30 +00:00

Maybe check for both off and false here?

Maybe check for both `off` and `false` here?
emidoots (Migrated from github.com) reviewed 2022-07-28 09:49:26 +00:00
emidoots (Migrated from github.com) commented 2022-07-28 09:49:26 +00:00

We could store whether or not we used gamemode in a field of platform struct, so that we can reuse it simply in the deinit code without duplicating the env var handling logic

We could store whether or not we used gamemode in a field of `platform` struct, so that we can reuse it simply in the deinit code without duplicating the env var handling logic
emidoots (Migrated from github.com) reviewed 2022-07-28 09:49:49 +00:00
emidoots (Migrated from github.com) commented 2022-07-28 09:49:49 +00:00

Ahh got it, makes sense

Ahh got it, makes sense
alichraghi (Migrated from github.com) reviewed 2022-07-28 10:01:24 +00:00
alichraghi (Migrated from github.com) commented 2022-07-28 10:01:24 +00:00

hopefully this fixes #405

hopefully this fixes #405
emidoots commented 2022-07-28 10:02:53 +00:00 (Migrated from github.com)
LGTM once https://github.com/hexops/mach/pull/437#discussion_r932012343 is addressed
emidoots (Migrated from github.com) approved these changes 2022-07-28 11:12:11 +00:00
emidoots (Migrated from github.com) left a comment

🔥 you rock, really excited to have this!

🔥 you rock, really excited to have this!
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hexops/mach!437
No description provided.