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

Mono build does not have numeric values for enums #420

Open
brentbatch opened this issue Feb 19, 2024 · 5 comments
Open

Mono build does not have numeric values for enums #420

brentbatch opened this issue Feb 19, 2024 · 5 comments
Assignees
Labels
bug Related to any general issue with GodotSteam

Comments

@brentbatch
Copy link

Describe the bug
Enums such as SteamApiInitResult do not have numeric values assigned to the enumvalues, which in this case cause a mismatch when casting the numeric 'status' value of Steam.SteamInit to SteamApiInitResult.

Expected behavior
All enums to contain the correct numeric values. for SteamApiInitResult this would defined as such (as described from the documentation):

public enum SteamApiInitResult : long
{
    SteamworksActive = 1,
    SteamworksFailedToInitialize = 2,
    SteamNotRunning = 20,
    InvalidAppIDOrAppNotInstalled = 79,
}

Desktop (please complete the following information):

  • OS: Windows
  • Version 11

Version of Godot: 4.2.1

Version of GodotSteam: latest

@Gramps Gramps self-assigned this Feb 19, 2024
@Gramps Gramps added the bug Related to any general issue with GodotSteam label Feb 19, 2024
@Gramps
Copy link
Member

Gramps commented Apr 2, 2024

No idea how I didn't comment on this yet. Haha. Yeah, all the enums are directly passed from Valve; saved us from having to change those values manually when Valve did; granted that has only happened maybe four times.

I know there is an issue with Rust and enums still. We are going to have to cast them specifically in that case. Since I know nothing of how Mono / C# works, I'd have to investigate this further.

@Deozaan
Copy link

Deozaan commented Apr 12, 2024

I don't use the .NET/Mono builds so I can't verify this is the case, but as I understand the description of the problem, it is that the enum values aren't assigned in C# which means they start at the default enum value of 0 and count upward instead of matching the values from Valve. Or in other words:

Actual Behavior:

public enum SteamApiInitResult : long
{
    SteamworksActive, // ==> 0
    SteamworksFailedToInitialize, // ==> 1
    SteamNotRunning, // ==> 2
    InvalidAppIDOrAppNotInstalled, // ==> 3
}

Expected Behavior:

public enum SteamApiInitResult : long
{
    SteamworksActive = 1,
    SteamworksFailedToInitialize = 2,
    SteamNotRunning = 20,
    InvalidAppIDOrAppNotInstalled = 79,
}

@Gramps
Copy link
Member

Gramps commented Apr 13, 2024

Since I know nothing of C# I'm not 100% how to solve the issue. We just pass the enum values from Valve because manually assigning them is very problematic; while they don't typically change those values, they do sometimes.

So, my question is, how do we get C# to use the correct values?

@Deozaan
Copy link

Deozaan commented Apr 13, 2024

I don't know either. 😅

I think I misunderstood your first response and thought that maybe you misunderstood the OP, so I was trying to add clarifying detail. But it seems it wasn't necessary because you were on the same page as the OP after all. 😁

@Gramps
Copy link
Member

Gramps commented Apr 13, 2024

Haha, thank you for clarifying though; I feel like many times I misunderstand things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Related to any general issue with GodotSteam
Projects
None yet
Development

No branches or pull requests

3 participants