summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/spl/module.cpp
diff options
context:
space:
mode:
authormailwl <mailwl@gmail.com>2018-03-22 07:54:16 +0100
committermailwl <mailwl@gmail.com>2018-03-22 07:55:14 +0100
commit95e747cd06810b0e95ee6cd379772a4e36ab9794 (patch)
treec1c76fedd5bc3b5815b2eac9b7f83b6bbc5b37bb /src/core/hle/service/spl/module.cpp
parentMerge pull request #258 from Subv/gpu_attribs (diff)
downloadyuzu-95e747cd06810b0e95ee6cd379772a4e36ab9794.tar
yuzu-95e747cd06810b0e95ee6cd379772a4e36ab9794.tar.gz
yuzu-95e747cd06810b0e95ee6cd379772a4e36ab9794.tar.bz2
yuzu-95e747cd06810b0e95ee6cd379772a4e36ab9794.tar.lz
yuzu-95e747cd06810b0e95ee6cd379772a4e36ab9794.tar.xz
yuzu-95e747cd06810b0e95ee6cd379772a4e36ab9794.tar.zst
yuzu-95e747cd06810b0e95ee6cd379772a4e36ab9794.zip
Diffstat (limited to 'src/core/hle/service/spl/module.cpp')
-rw-r--r--src/core/hle/service/spl/module.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/core/hle/service/spl/module.cpp b/src/core/hle/service/spl/module.cpp
new file mode 100644
index 000000000..fc1bcd94c
--- /dev/null
+++ b/src/core/hle/service/spl/module.cpp
@@ -0,0 +1,42 @@
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include <algorithm>
+#include <cstdlib>
+#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"
+
+namespace Service {
+namespace SPL {
+
+Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)
+ : ServiceFramework(name), module(std::move(module)) {}
+
+void Module::Interface::GetRandomBytes(Kernel::HLERequestContext& ctx) {
+ IPC::RequestParser rp{ctx};
+
+ size_t size = ctx.GetWriteBufferSize();
+
+ std::vector<u8> data(size);
+ std::generate(data.begin(), data.end(), std::rand);
+
+ ctx.WriteBuffer(data);
+
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+ LOG_DEBUG(Service_SPL, "called");
+}
+
+void InstallInterfaces(SM::ServiceManager& service_manager) {
+ auto module = std::make_shared<Module>();
+ std::make_shared<CSRNG>(module)->InstallAsService(service_manager);
+ std::make_shared<SPL>(module)->InstallAsService(service_manager);
+}
+
+} // namespace SPL
+} // namespace Service