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

Exception thrown if a player (de)selects more than 200 things at once (if limit increased by mods) #377

Open
SokyranTheDragon opened this issue Mar 8, 2023 · 0 comments
Labels
bug Something isn't working.

Comments

@SokyranTheDragon
Copy link
Member

An example of a mod that raises the limit of 200 maximum selections is HugsLib ("select similar" designator while holding the alt key ignores the limit).

A simple fix would be to remove the limit when reading the data on server side (currently limited to 200).
https://github.com/rwmt/Multiplayer/blob/master/Source/Common/Networking/State/ServerPlayingState.cs#L165-L166

A more complex fix would be to limit the amount of synced things to 200. This would be more complex as there would be need for extra checks, checking the previous amount of (de)selected things and sending only up to 200, making sure not to go over 200 as it could potentially cause issues.
https://github.com/rwmt/Multiplayer/blob/master/Source/Client/UI/CursorAndPing.cs#L157-L160

Exception in question:

Exception handling packet by LocalServerConn: Multiplayer.Common.ReaderException: Int array too long (912>200)
  at Multiplayer.Common.ByteReader.ReadPrefixedInts (System.Int32 maxLen) [0x00040] in <e0e2c93bb68944739d5863ff1eb2b19f>:0 
  at Multiplayer.Common.ServerPlayingState.HandleSelected (Multiplayer.Common.ByteReader data) [0x00026] in <e0e2c93bb68944739d5863ff1eb2b19f>:0 
  at (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition.FastInvoke_HandleSelected_indirect(object,object[])
  at Multiplayer.Common.ConnectionBase.HandleReceive (System.Int32 msgId, System.Int32 fragState, Multiplayer.Common.ByteReader reader, System.Boolean reliable) [0x000bb] in <e0e2c93bb68944739d5863ff1eb2b19f>:0 
  at Multiplayer.Common.ConnectionBase.HandleReceive (Multiplayer.Common.ByteReader data, System.Boolean reliable) [0x00031] in <e0e2c93bb68944739d5863ff1eb2b19f>:0 
  at Multiplayer.Client.Networking.LocalClientConnection+<>c__DisplayClass5_0.<SendRaw>b__0 () [0x00016] in <e0e2c93bb68944739d5863ff1eb2b19f>:0  
@SokyranTheDragon SokyranTheDragon added the bug Something isn't working. label Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working.
Projects
None yet
Development

No branches or pull requests

1 participant