Skip to content

Conversation

@henriquelouteiro
Copy link

Added a bitwise AND operation (index = index & 0xFFFF) at the beginning of the get_weapon_name_by_index function to ensure that the input index is always within the valid 16-bit range. This prevents issues caused by negative or out-of-range values that could result from unsigned-to-signed integer conversions or memory reading anomalies.

This change helps improve reliability when integrating with game memory structures where weapon indices may contain additional flags or unintended bits.

Also noticed a key duplication for index 43 ("Galil" and "Flashbang"). Only the last entry will be used due to dictionary behavior.

Added a bitwise AND operation (`index = index & 0xFFFF`) at the beginning of the `get_weapon_name_by_index` function to ensure that the input index is always within the valid 16-bit range. This prevents issues caused by negative or out-of-range values that could result from unsigned-to-signed integer conversions or memory reading anomalies.

This change helps improve reliability when integrating with game memory structures where weapon indices may contain additional flags or unintended bits.

Also noticed a key duplication for index 43 ("Galil" and "Flashbang"). Only the last entry will be used due to dictionary behavior. Galil New Index -> 13
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