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

[FFMQ] Fix all checks sending on hard reset + stronger read validation check #4242

Merged
merged 5 commits into from
Nov 25, 2024

Conversation

wildham0
Copy link
Contributor

What is this fixing or adding?

SNIClient's task will die sometime (like on hard resets) and FFMQ's client will pass the validation check when it's not supposed to on some emulator. This fix the issue by checking None type and adding a stronger validation check.

How was this tested?

Test was done on a known seed that would reliably trigger the behaviour on hard reset.

@github-actions github-actions bot added the waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. label Nov 25, 2024
worlds/ffmq/Client.py Outdated Show resolved Hide resolved
Co-authored-by: Exempt-Medic <[email protected]>
worlds/ffmq/Client.py Outdated Show resolved Hide resolved
@Exempt-Medic Exempt-Medic added the is: bug/fix Issues that are reporting bugs or pull requests that are fixing bugs. label Nov 25, 2024
Co-authored-by: Exempt-Medic <[email protected]>
@NewSoupVi
Copy link
Member

NewSoupVi commented Nov 25, 2024

I want to merge this but I'm not 100% sure how to validate that this validation_array is always the same & always static... Is there some way you can assure that for me?

@wildham0
Copy link
Contributor Author

I want to merge this but I'm not 100% sure how to validate that this validation_array is always the same & always static... Is there some way you can assure that for me?

The rando adds a function called at boot up that write 1 state byte (0 outside gameplay loop, 1 inside gameplay loop), then 5 bytes for "FFMQR"

https://github.com/wildham0/FFMQRando/blob/8e6a7571d085036a1e5cc81f7a7cf195468bb2d6/FFMQRLib/Hacks.cs#L392

@@ -47,6 +47,17 @@ def get_flag(data, flag):
bit = int(0x80 / (2 ** (flag % 8)))
return (data[byte] & bit) > 0

def validate_read_state(data1, data2):
validation_array = bytes([0x01, 0x46, 0x46, 0x4D, 0x51, 0x52])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
validation_array = bytes([0x01, 0x46, 0x46, 0x4D, 0x51, 0x52])
validation_array = b"\x01FFMQR"

another way this could be written (not saying one should be preferred over the other)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>>> a = bytes([0x01, 0x46, 0x46, 0x4D, 0x51, 0x52])
>>> b = b"\x01FFMQR"
>>> a == b
True

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good to know, i'll keep that in mind for next time

Copy link
Member

@NewSoupVi NewSoupVi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good enough for me

@NewSoupVi NewSoupVi merged commit 0ad5b0a into ArchipelagoMW:main Nov 25, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is: bug/fix Issues that are reporting bugs or pull requests that are fixing bugs. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants