1436aa7d3d
The new code seems to be about 400x faster, at least in some cases...
53 lines
1.5 KiB
Diff
53 lines
1.5 KiB
Diff
From 4dc46334ec175e26277632fee4aea80768749af9 Mon Sep 17 00:00:00 2001
|
|
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
|
Date: Fri, 11 Nov 2011 19:49:46 +0200
|
|
Subject: [PATCH 06/17] Allow frontend to control random number seed
|
|
|
|
---
|
|
snes/interface/interface.cpp | 5 +++++
|
|
snes/interface/interface.hpp | 1 +
|
|
snes/system/system.cpp | 2 +-
|
|
3 files changed, 7 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
|
|
index b3017c9..0a21a13 100755
|
|
--- a/snes/interface/interface.cpp
|
|
+++ b/snes/interface/interface.cpp
|
|
@@ -23,4 +23,9 @@ time_t Interface::currentTime()
|
|
return time(0);
|
|
}
|
|
|
|
+time_t Interface::randomSeed()
|
|
+{
|
|
+ return time(0);
|
|
+}
|
|
+
|
|
}
|
|
diff --git a/snes/interface/interface.hpp b/snes/interface/interface.hpp
|
|
index df975e8..30ee7fd 100755
|
|
--- a/snes/interface/interface.hpp
|
|
+++ b/snes/interface/interface.hpp
|
|
@@ -6,6 +6,7 @@ struct Interface {
|
|
virtual string path(Cartridge::Slot slot, const string &hint) = 0;
|
|
virtual void message(const string &text);
|
|
virtual time_t currentTime();
|
|
+ virtual time_t randomSeed();
|
|
};
|
|
|
|
extern Interface *interface;
|
|
diff --git a/snes/system/system.cpp b/snes/system/system.cpp
|
|
index c19a7c5..dbd912d 100755
|
|
--- a/snes/system/system.cpp
|
|
+++ b/snes/system/system.cpp
|
|
@@ -146,7 +146,7 @@ void System::unload() {
|
|
}
|
|
|
|
void System::power() {
|
|
- random.seed((unsigned)time(0));
|
|
+ random.seed((unsigned)interface->randomSeed());
|
|
|
|
region = config.region;
|
|
expansion = config.expansion_port;
|
|
--
|
|
1.9.0
|
|
|