svc: Return random seed for svcGetInfo RandomEntropy

This commit is contained in:
Zach Hilman 2018-11-12 21:46:21 -05:00
parent 2a16fd7ffc
commit cb1e63ef09
2 changed files with 8 additions and 4 deletions

View File

@ -34,6 +34,7 @@
#include "core/hle/lock.h" #include "core/hle/lock.h"
#include "core/hle/result.h" #include "core/hle/result.h"
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
#include "core/settings.h"
namespace Kernel { namespace Kernel {
namespace { namespace {
@ -558,7 +559,7 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
*result = 0; *result = 0;
break; break;
case GetInfoType::RandomEntropy: case GetInfoType::RandomEntropy:
*result = 0; *result = Settings::values.rng_seed.value_or(0);
break; break;
case GetInfoType::ASLRRegionBaseAddr: case GetInfoType::ASLRRegionBaseAddr:
*result = vm_manager.GetASLRRegionBaseAddress(); *result = vm_manager.GetASLRRegionBaseAddress();

View File

@ -140,7 +140,7 @@ ConfigureSystem::ConfigureSystem(QWidget* parent)
connect(ui->rng_seed_checkbox, &QCheckBox::stateChanged, this, [this](bool checked) { connect(ui->rng_seed_checkbox, &QCheckBox::stateChanged, this, [this](bool checked) {
ui->rng_seed_edit->setEnabled(checked); ui->rng_seed_edit->setEnabled(checked);
if (!checked) if (!checked)
ui->rng_seed_edit->setText("0000000000000000"); ui->rng_seed_edit->setText(QStringLiteral("0000000000000000"));
}); });
scene = new QGraphicsScene; scene = new QGraphicsScene;
@ -164,8 +164,11 @@ void ConfigureSystem::setConfiguration() {
ui->rng_seed_checkbox->setChecked(Settings::values.rng_seed.has_value()); ui->rng_seed_checkbox->setChecked(Settings::values.rng_seed.has_value());
ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.has_value()); ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.has_value());
ui->rng_seed_edit->setText(
QString::fromStdString(fmt::format("{:016X}", Settings::values.rng_seed.value_or(0)))); const auto rng_seed = QString("%1")
.arg(Settings::values.rng_seed.value_or(0), 16, 16, QLatin1Char{'0'})
.toUpper();
ui->rng_seed_edit->setText(rng_seed);
} }
void ConfigureSystem::PopulateUserList() { void ConfigureSystem::PopulateUserList() {