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

Bugfix: Missing Map Files #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Bugfix: Missing Map Files #10

wants to merge 1 commit into from

Conversation

corigne
Copy link

@corigne corigne commented Dec 21, 2024

Description:

Addresses JSON 302 bug.

Observed behavior:

The client is using a "file exists" check to determine if a map was base game or usermap, assuming all base game and DLC files should always be present. This check resulted in unintended behavior when connecting to a server where-- if the client was missing a map-- the client would expect the usermap_hash when parsing the jsonInfo object from the server's CURL string. This missing json object key would result in a hanging connection state which required a full client restart. Users would simply received a JSON 302 error and have to restart the client if this happened.

Typically affected users were those who did not own the MWR DLC.

Expected behavior:

Joining a server which is hosting a map you do not own should result in a client error notification explaining they don't have the map, and then the client should return to the main MP lobby or the main menu screen.

Changes:

  • Created a single map_exists() function which returns the map type for a file as an enum or the enum value MISSING if the file doesn't actually exist in the filesystem.
  • Added an is_dlc_map() check which parses map strings for the 4 dlc map base names
  • Added calls to the above checks to the set_new_map() and connect_to_server_tcp() functions which handle disconnecting and notifying the player of missing files instead of crashing the game or putting the client in a bugged state.

TODO:

In the future I would like to further improve the map file checks to include a LUT of all base game filenames so we can separate the exists() and is_stock_map() functions properly. The client should NOT be using exists to determine the difference between stock maps and usermaps.

Added check for official DLC maps. Prevents client missing DLC from looking for a usermap_hash in the infoJson when loading a DLC map. TODO: Handle missing map errors gracefully.

Added is_dlc_map() to fastfiles header.

WIP: logic for map guard.

Reworked map checking. Added additional map_exists check...

Added map exists checks to connect and set_new_map calls to prevent crashes when
non-dlc owner joins or rotates to a dlc map. Should also prevent weird
behavior for missing modmaps and joining servers with custom maps the
user doesn't own.

Added exit vlobby hook to set_new_map after disconenct to ensure client returns to correct state after mid-game disconnect.
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.

1 participant