1 From 4dc46334ec175e26277632fee4aea80768749af9 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 06/27] 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 b3017c90..0a21a132 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 df975e83..30ee7fde 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 c19a7c51..dbd912d8 100755
40 --- a/snes/system/system.cpp
41 +++ b/snes/system/system.cpp
42 @@ -146,7 +146,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;