1 From e1fce124df0a1ea43324df65b9d0ee7262eda988 Mon Sep 17 00:00:00 2001
2 From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
3 Date: Fri, 11 Nov 2011 19:49:46 +0200
4 Subject: [PATCH 3/8] Allow frontend to control random number seed
7 snes/interface/interface.cpp | 5 +++++
8 snes/interface/interface.hpp | 1 +
9 snes/system/system.cpp | 2 +-
10 3 files changed, 7 insertions(+), 1 deletion(-)
12 diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
13 index b3017c9..0a21a13 100755
14 --- a/snes/interface/interface.cpp
15 +++ b/snes/interface/interface.cpp
16 @@ -23,4 +23,9 @@ time_t Interface::currentTime()
20 +time_t Interface::randomSeed()
26 diff --git a/snes/interface/interface.hpp b/snes/interface/interface.hpp
27 index df975e8..30ee7fd 100755
28 --- a/snes/interface/interface.hpp
29 +++ b/snes/interface/interface.hpp
30 @@ -6,6 +6,7 @@ struct Interface {
31 virtual string path(Cartridge::Slot slot, const string &hint) = 0;
32 virtual void message(const string &text);
33 virtual time_t currentTime();
34 + virtual time_t randomSeed();
37 extern Interface *interface;
38 diff --git a/snes/system/system.cpp b/snes/system/system.cpp
39 index 9b70bbf..cbd096c 100755
40 --- a/snes/system/system.cpp
41 +++ b/snes/system/system.cpp
42 @@ -151,7 +151,7 @@ void System::unload() {
45 void System::power() {
46 - random.seed((unsigned)time(0));
47 + random.seed((unsigned)interface->randomSeed());
49 region = config.region;
50 expansion = config.expansion_port;