Make the random seed controllable

- This allows eliminating random seed differences from savestates (may
be useful for some forms of sync stability testing).
- Would also allow (re)recording with randomization enabled, as the
seed can be set portably).
This commit is contained in:
Ilari Liusvaara 2011-11-11 19:54:34 +02:00 committed by Themaister
parent 7b7d2c89ac
commit b8d8ffb3bf
3 changed files with 6 additions and 1 deletions

View File

@ -22,4 +22,8 @@ time_t Interface::currentTime() {
return time(0); return time(0);
} }
time_t Interface::randomSeed() {
return time(0);
}
} }

View File

@ -6,6 +6,7 @@ struct Interface {
virtual string path(Cartridge::Slot::e slot, const string &hint) = 0; virtual string path(Cartridge::Slot::e slot, const string &hint) = 0;
virtual void message(const string &text); virtual void message(const string &text);
virtual time_t currentTime(); virtual time_t currentTime();
virtual time_t randomSeed();
}; };
extern Interface *interface; extern Interface *interface;

View File

@ -147,7 +147,7 @@ void System::unload() {
} }
void System::power() { void System::power() {
random.seed((unsigned)time(0)); random.seed((unsigned)interface->randomSeed());
region = config.region; region = config.region;
expansion = config.expansion_port; expansion = config.expansion_port;