diff options
author | Zach Hilman <zachhilman@gmail.com> | 2018-11-12 04:33:31 +0100 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-11-12 05:08:39 +0100 |
commit | 4b4f883aef8fbc4f8a8b6c842df61eb0d5253f45 (patch) | |
tree | 00d203262914bf2802558e5a99a3d6ac43cfef9d | |
parent | Merge pull request #1660 from Tinob/master (diff) | |
download | yuzu-4b4f883aef8fbc4f8a8b6c842df61eb0d5253f45.tar yuzu-4b4f883aef8fbc4f8a8b6c842df61eb0d5253f45.tar.gz yuzu-4b4f883aef8fbc4f8a8b6c842df61eb0d5253f45.tar.bz2 yuzu-4b4f883aef8fbc4f8a8b6c842df61eb0d5253f45.tar.lz yuzu-4b4f883aef8fbc4f8a8b6c842df61eb0d5253f45.tar.xz yuzu-4b4f883aef8fbc4f8a8b6c842df61eb0d5253f45.tar.zst yuzu-4b4f883aef8fbc4f8a8b6c842df61eb0d5253f45.zip |
-rw-r--r-- | src/core/hle/service/spl/module.cpp | 9 | ||||
-rw-r--r-- | src/core/hle/service/spl/module.h | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/core/hle/service/spl/module.cpp b/src/core/hle/service/spl/module.cpp index 44a6717d0..69c260408 100644 --- a/src/core/hle/service/spl/module.cpp +++ b/src/core/hle/service/spl/module.cpp @@ -3,18 +3,23 @@ // Refer to the license.txt file included. #include <algorithm> +#include <chrono> #include <cstdlib> +#include <ctime> +#include <functional> #include <vector> #include "common/logging/log.h" #include "core/hle/ipc_helpers.h" #include "core/hle/service/spl/csrng.h" #include "core/hle/service/spl/module.h" #include "core/hle/service/spl/spl.h" +#include "core/settings.h" namespace Service::SPL { Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) - : ServiceFramework(name), module(std::move(module)) {} + : ServiceFramework(name), module(std::move(module)), + rng(Settings::values.rng_seed.value_or(std::time(nullptr))) {} Module::Interface::~Interface() = default; @@ -24,7 +29,7 @@ void Module::Interface::GetRandomBytes(Kernel::HLERequestContext& ctx) { std::size_t size = ctx.GetWriteBufferSize(); std::vector<u8> data(size); - std::generate(data.begin(), data.end(), std::rand); + std::generate(data.begin(), data.end(), rng); ctx.WriteBuffer(data); diff --git a/src/core/hle/service/spl/module.h b/src/core/hle/service/spl/module.h index 48fda6099..afa1f0295 100644 --- a/src/core/hle/service/spl/module.h +++ b/src/core/hle/service/spl/module.h @@ -4,6 +4,7 @@ #pragma once +#include <random> #include "core/hle/service/service.h" namespace Service::SPL { @@ -19,6 +20,9 @@ public: protected: std::shared_ptr<Module> module; + + private: + std::mt19937 rng; }; }; |