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

Seed the RNG with the time in seconds in HQ mode #3812

Merged
merged 8 commits into from
Jan 19, 2024

Conversation

tertu-m
Copy link
Collaborator

@tertu-m tertu-m commented Dec 23, 2023

Description

In HQ mode, SeedRng() and SeedRng2() now take 32 bit arguments. SeedRngWithRtc() now generates the number of seconds on the RTC, which I think provides 3.something billion seed values. u16 arguments would be zero-extended, which matches the old behavior.

Discord contact info

tertu

@tertu-m tertu-m changed the base branch from master to upcoming December 23, 2023 18:14
@Bassoonian Bassoonian requested a review from mrgriffin January 18, 2024 14:09
Copy link
Collaborator

@mrgriffin mrgriffin left a comment

Choose a reason for hiding this comment

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

lgtm

Two minor comments that aren't blocking:

  • SeedRng can't be conveniently stored in a function pointer because its type varies. An alternative would have been to always take a u32, and then cast it to u16 inside the non-HQ implementation.
  • ConvertBcdToBinary converts invalid numbers into 0xFF and then reports an error, whereas BCD blindly plows on. I doubt this matters either, if the RTC is non-functional then just seeding to some consistent value doesn't seem like a problem. (I suppose in the future if somebody wants to be broken-RTC-proof they could mix in a frame count)

@mrgriffin mrgriffin merged commit 179a0ea into rh-hideout:upcoming Jan 19, 2024
1 check passed
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.

3 participants