pokemon-speedrunning / gambatte-speedrun

Fork of https://github.com/sinamas/gambatte with Pokemon speedrunning-related changes.
GNU General Public License v2.0
94 stars 27 forks source link

Emulator RNG (sub-frame resets) can be manipulated #75

Open CasualPokePlayer opened 3 years ago

CasualPokePlayer commented 3 years ago

The seed is apparently consistent on starting up the emulator, lol

Dabomstew commented 3 years ago

Seems like the fault is here:

https://en.cppreference.com/w/cpp/numeric/random/random_device

A notable implementation where std::random_device is deterministic is old versions of MinGW (bug 338, fixed since GCC 9.2), although replacement implementations exist, such as mingw-std-random_device. The latest MinGW Versions can be downloaded from GCC with the MCF thread model.

which eventually references

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85494

CasualPokePlayer commented 2 years ago

Looking back, I wonder if this is really something we need to "fix" now. We're at GCC 11.2 now, a ways ahead of 9.2. You'd have to have a seriously outdated build environment to get a build with this bug now. And this seems to be a Windows specific case, so the Linux users who are expected to build wouldn't encounter any issues, so this is practically just an issue for the people making future releases.

entrpntr commented 2 years ago

It's an issue with the official r717 Windows binaries, not with the code itself. That said, GCC 9.1 was May 2019, which really isn't that ancient (and was obviously even less so when r717 was released).

The main takeaway is whoever builds the official Windows releases in the future should know to have GCC 9.2 at minimum if building with MinGW. No code fix necessary; at most a documentation effort.