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

TerminateRound crash Linux Servers #611

Open
zakriamansoor47 opened this issue Oct 7, 2024 · 2 comments
Open

TerminateRound crash Linux Servers #611

zakriamansoor47 opened this issue Oct 7, 2024 · 2 comments
Labels
untriaged New issue has not been triaged

Comments

@zakriamansoor47
Copy link

zakriamansoor47 commented Oct 7, 2024

TerminateRound signs for Linux, it's updated in gamedata.json but the function of css gamerules.TerminateRound causes server crash. because Linux TerminateRound arguments are in a different position than Windows

public Action<IntPtr, float, RoundEndReason, nint, uint> TerminateRoundWindows = TerminateRoundWindowsFunc.Invoke;
	public static MemoryFunctionVoid<nint, float, RoundEndReason, nint, uint> TerminateRoundWindowsFunc = new(GameData.GetSignature("CCSGameRules_TerminateRound"));
    // For linux users
    public static MemoryFunctionVoid<nint, RoundEndReason, nint, uint, float> TerminateRoundLinuxFunc = new("55 48 89 E5 41 57 41 56 41 55 41 54 49 89 FC 53 48 81 EC 88 00 00 00 48 8D 05 ? ? ? ?");
    public Action<IntPtr, RoundEndReason, nint, uint, float> TerminateRoundLinux = TerminateRoundLinuxFunc.Invoke;
    private static readonly bool IsWindowsPlatform = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
    public void TerminateRound(float delay, RoundEndReason roundEndReason)
    {
        CCSGameRules gamerules = GetGameRules();
        if (IsWindowsPlatform) // For Windows
            TerminateRoundWindows(gamerules.Handle, delay, roundEndReason, 0, 0); // In windows delay is at 2nd position and roundEndReason at 3rd
        else // For linux
            TerminateRoundLinux(gamerules.Handle, roundEndReason, 0, 0, delay); // In linux delay is at last (5th) postion and roundEndReason is 2nd 
    }

But in CCSGameRules.cs file TerminateRound is written like this

    public void TerminateRound(float delay, RoundEndReason roundEndReason)
    {
        VirtualFunctions.TerminateRound(base.Handle, roundEndReason, delay, 0, 0);
    }
    ```
@github-actions github-actions bot added the untriaged New issue has not been triaged label Oct 7, 2024
@KillStr3aK
Copy link
Contributor

I'll investigate, thanks for reporting this

@KillStr3aK
Copy link
Contributor

KillStr3aK commented Oct 8, 2024

Using this code:

CCSGameRules rules = GetGameRules();
rules.TerminateRound(0.5f, RoundEndReason.BombDefused);

worked on both platforms for me.
Mind sharing what distribution of linux you are experiencing crashes on? or maybe you are using a different TerminateRound implementation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged New issue has not been triaged
Projects
None yet
Development

No branches or pull requests

2 participants