Path: blob/master/libsnes/lsnes_patches/0003-Allow-frontend-to-control-random-number-seed.patch
2 views
From 5f76449a70c9a546e18c2fdebe7588bbe90b56d2 Mon Sep 17 00:00:00 20011From: Ilari Liusvaara <[email protected]>2Date: Fri, 11 Nov 2011 19:49:46 +02003Subject: [PATCH 3/4] Allow frontend to control random number seed45---6snes/interface/interface.cpp | 5 +++++7snes/interface/interface.hpp | 1 +8snes/system/system.cpp | 2 +-93 files changed, 7 insertions(+), 1 deletions(-)1011diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp12index b3017c9..0a21a13 10075513--- snes/interface/interface.cpp14+++ snes/interface/interface.cpp15@@ -23,4 +23,9 @@ time_t Interface::currentTime()16return time(0);17}1819+time_t Interface::randomSeed()20+{21+ return time(0);22+}23+24}25diff --git a/snes/interface/interface.hpp b/snes/interface/interface.hpp26index df975e8..30ee7fd 10075527--- snes/interface/interface.hpp28+++ snes/interface/interface.hpp29@@ -6,6 +6,7 @@ struct Interface {30virtual string path(Cartridge::Slot slot, const string &hint) = 0;31virtual void message(const string &text);32virtual time_t currentTime();33+ virtual time_t randomSeed();34};3536extern Interface *interface;37diff --git a/snes/system/system.cpp b/snes/system/system.cpp38index 9b70bbf..cbd096c 10075539--- snes/system/system.cpp40+++ snes/system/system.cpp41@@ -151,7 +151,7 @@ void System::unload() {42}4344void System::power() {45- random.seed((unsigned)time(0));46+ random.seed((unsigned)interface->randomSeed());4748region = config.region;49expansion = config.expansion_port;50--511.7.9.48.g85da4d52535455