Initialize fdset before polling on it
[lsnes.git] / bsnes-patches / v084 / 0006-Allow-frontend-to-control-random-number-seed.patch
bloba1a73787b55733f68cd592696398cc20b8bab96c
1 From 794d83cb28a93d9ae1e613598d3c7cf09090d6a3 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/10] Allow frontend to control random number seed
6 ---
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()
17 return time(0);
20 +time_t Interface::randomSeed()
22 + return time(0);
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 6881810..8583595 100755
40 --- a/snes/system/system.cpp
41 +++ b/snes/system/system.cpp
42 @@ -147,7 +147,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;
51 --
52 1.8.4.4