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

Allow autosplitters to set LiveSplit CustomVariables #16

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

AlexKnauth
Copy link
Contributor

A companion PR to LiveSplit/LiveSplit#2528. Depends on #15. Allows autosplitters to set the LiveSplit CustomVariables.

@@ -55,6 +55,7 @@ public Runtime(
SetGameTimeDelegate setGameTime,
Action pauseGameTime,
Action resumeGameTime,
SetCustomVariableDelegate setCustomVariable,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This constructor is a public API. Adding this parameter is a breaking change.

@@ -667,6 +669,7 @@ internal Widgets(IntPtr ptr) : base(ptr) { }

public delegate int StateDelegate();
public delegate void SetGameTimeDelegate(long gameTime);
public delegate void SetCustomVariableDelegate(IntPtr namePtr, UIntPtr nameLen, IntPtr valuePtr, UIntPtr valueLen);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not place delegates inside classes.

Is passing a Func<IntPtr, UIntPtr, IntPtr, UIntPtr> as set_custom_variable not possible?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that the other delegates have been moved outside, I've moved SetCustomVariableDelegate outside as well, next to them.

@@ -684,6 +687,7 @@ public static extern IntPtr Runtime_new(
SetGameTimeDelegate set_game_time,
Action pause_game_time,
Action resume_game_time,
SetCustomVariableDelegate set_custom_variable,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is a public API. Adding this parameter is a breaking change.

@AlexKnauth AlexKnauth force-pushed the CustomVariable branch 2 times, most recently from ed75f2b to 1ed23b5 Compare September 5, 2024 15:35
@just-ero
Copy link
Contributor

By the way, is the ASR.cs file generated automatically? It looks generated in the same way that LiveSplitCore.cs does in the LiveSplit repo.

@AlexKnauth
Copy link
Contributor Author

Not as of now... but it is formulaic for similar ffi bridge reasons. It's possible parts of it could be made to be generated in the future, but I don't know whether it would be worth the effort.

@AlexKnauth AlexKnauth marked this pull request as ready for review October 12, 2024 22:00
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.

2 participants