chore: make yuzu REUSE compliant
[REUSE] is a specification that aims at making file copyright
information consistent, so that it can be both human and machine
readable. It basically requires that all files have a header containing
copyright and licensing information. When this isn't possible, like
when dealing with binary assets, generated files or embedded third-party
dependencies, it is permitted to insert copyright information in the
`.reuse/dep5` file.
Oh, and it also requires that all the licenses used in the project are
present in the `LICENSES` folder, that's why the diff is so huge.
This can be done automatically with `reuse download --all`.
The `reuse` tool also contains a handy subcommand that analyzes the
project and tells whether or not the project is (still) compliant,
`reuse lint`.
Following REUSE has a few advantages over the current approach:
- Copyright information is easy to access for users / downstream
- Files like `dist/license.md` do not need to exist anymore, as
`.reuse/dep5` is used instead
- `reuse lint` makes it easy to ensure that copyright information of
files like binary assets / images is always accurate and up to date
To add copyright information of files that didn't have it I looked up
who committed what and when, for each file. As yuzu contributors do not
have to sign a CLA or similar I couldn't assume that copyright ownership
was of the "yuzu Emulator Project", so I used the name and/or email of
the commit author instead.
[REUSE]: https://reuse.software
Follow-up to 01cf05bc75b1e47beb08937439f3ed9339e7b254
2022-05-15 02:06:02 +02:00
|
|
|
// SPDX-FileCopyrightText: 2017 Citra Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2017-05-02 06:09:15 +02:00
|
|
|
|
2018-10-09 20:42:49 +02:00
|
|
|
#include <array>
|
|
|
|
|
2018-10-09 20:47:24 +02:00
|
|
|
#include <mbedtls/ctr_drbg.h>
|
|
|
|
#include <mbedtls/entropy.h>
|
|
|
|
|
2017-07-13 04:19:34 +02:00
|
|
|
#include "common/assert.h"
|
2018-08-15 00:48:28 +02:00
|
|
|
#include "common/common_types.h"
|
2021-05-26 01:32:56 +02:00
|
|
|
#include "common/fs/file.h"
|
|
|
|
#include "common/fs/fs.h"
|
|
|
|
#include "common/fs/path_util.h"
|
2018-10-09 20:47:24 +02:00
|
|
|
#include "common/logging/log.h"
|
2018-08-15 00:48:28 +02:00
|
|
|
|
2021-04-15 01:07:40 +02:00
|
|
|
#include "common/settings.h"
|
2018-09-04 01:00:51 +02:00
|
|
|
#include "core/file_sys/control_metadata.h"
|
|
|
|
#include "core/file_sys/patch_manager.h"
|
2018-08-31 18:21:34 +02:00
|
|
|
#include "core/loader/loader.h"
|
2017-05-02 06:09:15 +02:00
|
|
|
#include "core/telemetry_session.h"
|
2017-07-09 23:52:18 +02:00
|
|
|
|
2018-09-16 20:05:51 +02:00
|
|
|
#ifdef ENABLE_WEB_SERVICE
|
|
|
|
#include "web_service/telemetry_json.h"
|
|
|
|
#include "web_service/verify_login.h"
|
|
|
|
#endif
|
|
|
|
|
2017-05-02 06:09:15 +02:00
|
|
|
namespace Core {
|
|
|
|
|
2020-08-18 20:21:50 +02:00
|
|
|
namespace Telemetry = Common::Telemetry;
|
|
|
|
|
2017-08-23 02:58:19 +02:00
|
|
|
static u64 GenerateTelemetryId() {
|
|
|
|
u64 telemetry_id{};
|
2018-09-16 20:05:51 +02:00
|
|
|
|
|
|
|
mbedtls_entropy_context entropy;
|
|
|
|
mbedtls_entropy_init(&entropy);
|
|
|
|
mbedtls_ctr_drbg_context ctr_drbg;
|
2023-02-14 17:13:47 +01:00
|
|
|
static constexpr std::array<char, 18> personalization{{"yuzu Telemetry ID"}};
|
2018-09-16 20:05:51 +02:00
|
|
|
|
|
|
|
mbedtls_ctr_drbg_init(&ctr_drbg);
|
2018-09-17 17:16:01 +02:00
|
|
|
ASSERT(mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy,
|
2018-10-09 20:42:49 +02:00
|
|
|
reinterpret_cast<const unsigned char*>(personalization.data()),
|
2018-09-17 20:58:24 +02:00
|
|
|
personalization.size()) == 0);
|
2018-09-16 20:05:51 +02:00
|
|
|
ASSERT(mbedtls_ctr_drbg_random(&ctr_drbg, reinterpret_cast<unsigned char*>(&telemetry_id),
|
|
|
|
sizeof(u64)) == 0);
|
|
|
|
|
|
|
|
mbedtls_ctr_drbg_free(&ctr_drbg);
|
|
|
|
mbedtls_entropy_free(&entropy);
|
|
|
|
|
2017-08-23 02:58:19 +02:00
|
|
|
return telemetry_id;
|
|
|
|
}
|
|
|
|
|
2020-01-21 20:37:41 +01:00
|
|
|
static const char* TranslateRenderer(Settings::RendererBackend backend) {
|
|
|
|
switch (backend) {
|
|
|
|
case Settings::RendererBackend::OpenGL:
|
|
|
|
return "OpenGL";
|
|
|
|
case Settings::RendererBackend::Vulkan:
|
|
|
|
return "Vulkan";
|
2022-11-28 02:37:37 +01:00
|
|
|
case Settings::RendererBackend::Null:
|
|
|
|
return "Null";
|
2020-01-21 20:37:41 +01:00
|
|
|
}
|
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
|
2020-02-18 21:51:42 +01:00
|
|
|
static const char* TranslateGPUAccuracyLevel(Settings::GPUAccuracy backend) {
|
|
|
|
switch (backend) {
|
|
|
|
case Settings::GPUAccuracy::Normal:
|
|
|
|
return "Normal";
|
|
|
|
case Settings::GPUAccuracy::High:
|
|
|
|
return "High";
|
|
|
|
case Settings::GPUAccuracy::Extreme:
|
|
|
|
return "Extreme";
|
|
|
|
}
|
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
|
2021-08-08 22:56:40 +02:00
|
|
|
static const char* TranslateNvdecEmulation(Settings::NvdecEmulation backend) {
|
|
|
|
switch (backend) {
|
|
|
|
case Settings::NvdecEmulation::Off:
|
|
|
|
return "Off";
|
|
|
|
case Settings::NvdecEmulation::CPU:
|
|
|
|
return "CPU";
|
|
|
|
case Settings::NvdecEmulation::GPU:
|
|
|
|
return "GPU";
|
|
|
|
}
|
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
|
2023-04-30 21:39:00 +02:00
|
|
|
constexpr const char* TranslateVSyncMode(Settings::VSyncMode mode) {
|
|
|
|
switch (mode) {
|
|
|
|
case Settings::VSyncMode::Immediate:
|
|
|
|
return "Immediate";
|
|
|
|
case Settings::VSyncMode::FIFO:
|
|
|
|
return "FIFO";
|
|
|
|
case Settings::VSyncMode::Mailbox:
|
|
|
|
return "Mailbox";
|
|
|
|
}
|
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
|
2017-08-23 06:08:07 +02:00
|
|
|
u64 GetTelemetryId() {
|
2017-08-23 02:58:19 +02:00
|
|
|
u64 telemetry_id{};
|
2021-05-26 01:32:56 +02:00
|
|
|
const auto filename = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ConfigDir) / "telemetry_id";
|
2017-08-23 02:58:19 +02:00
|
|
|
|
2020-08-15 14:33:16 +02:00
|
|
|
bool generate_new_id = !Common::FS::Exists(filename);
|
2021-05-26 01:32:56 +02:00
|
|
|
|
2018-09-16 20:05:51 +02:00
|
|
|
if (!generate_new_id) {
|
2021-05-26 01:32:56 +02:00
|
|
|
Common::FS::IOFile file{filename, Common::FS::FileAccessMode::Read,
|
|
|
|
Common::FS::FileType::BinaryFile};
|
|
|
|
|
2017-08-23 02:58:19 +02:00
|
|
|
if (!file.IsOpen()) {
|
2021-05-26 01:32:56 +02:00
|
|
|
LOG_ERROR(Core, "failed to open telemetry_id: {}",
|
|
|
|
Common::FS::PathToUTF8String(filename));
|
2017-08-23 02:58:19 +02:00
|
|
|
return {};
|
|
|
|
}
|
2021-05-26 01:32:56 +02:00
|
|
|
|
|
|
|
if (!file.ReadObject(telemetry_id) || telemetry_id == 0) {
|
2018-09-16 20:05:51 +02:00
|
|
|
LOG_ERROR(Frontend, "telemetry_id is 0. Generating a new one.", telemetry_id);
|
|
|
|
generate_new_id = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (generate_new_id) {
|
2021-05-26 01:32:56 +02:00
|
|
|
Common::FS::IOFile file{filename, Common::FS::FileAccessMode::Write,
|
|
|
|
Common::FS::FileType::BinaryFile};
|
|
|
|
|
2017-08-23 02:58:19 +02:00
|
|
|
if (!file.IsOpen()) {
|
2021-05-26 01:32:56 +02:00
|
|
|
LOG_ERROR(Core, "failed to open telemetry_id: {}",
|
|
|
|
Common::FS::PathToUTF8String(filename));
|
2017-08-23 02:58:19 +02:00
|
|
|
return {};
|
|
|
|
}
|
2021-05-26 01:32:56 +02:00
|
|
|
|
2017-08-23 02:58:19 +02:00
|
|
|
telemetry_id = GenerateTelemetryId();
|
2021-05-26 01:32:56 +02:00
|
|
|
|
|
|
|
if (!file.WriteObject(telemetry_id)) {
|
|
|
|
LOG_ERROR(Core, "Failed to write telemetry_id to file.");
|
|
|
|
}
|
2017-08-23 02:58:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return telemetry_id;
|
|
|
|
}
|
|
|
|
|
2017-08-23 06:08:07 +02:00
|
|
|
u64 RegenerateTelemetryId() {
|
|
|
|
const u64 new_telemetry_id{GenerateTelemetryId()};
|
2021-05-26 01:32:56 +02:00
|
|
|
const auto filename = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ConfigDir) / "telemetry_id";
|
|
|
|
|
|
|
|
Common::FS::IOFile file{filename, Common::FS::FileAccessMode::Write,
|
|
|
|
Common::FS::FileType::BinaryFile};
|
2017-08-23 06:08:07 +02:00
|
|
|
|
|
|
|
if (!file.IsOpen()) {
|
2021-05-26 01:32:56 +02:00
|
|
|
LOG_ERROR(Core, "failed to open telemetry_id: {}", Common::FS::PathToUTF8String(filename));
|
2017-08-23 06:08:07 +02:00
|
|
|
return {};
|
|
|
|
}
|
2021-05-26 01:32:56 +02:00
|
|
|
|
|
|
|
if (!file.WriteObject(new_telemetry_id)) {
|
|
|
|
LOG_ERROR(Core, "Failed to write telemetry_id to file.");
|
|
|
|
}
|
|
|
|
|
2017-08-23 06:08:07 +02:00
|
|
|
return new_telemetry_id;
|
|
|
|
}
|
|
|
|
|
2018-09-17 17:16:01 +02:00
|
|
|
bool VerifyLogin(const std::string& username, const std::string& token) {
|
2017-09-19 03:18:26 +02:00
|
|
|
#ifdef ENABLE_WEB_SERVICE
|
2021-06-29 01:41:39 +02:00
|
|
|
return WebService::VerifyLogin(Settings::values.web_api_url.GetValue(), username, token);
|
2017-09-19 03:18:26 +02:00
|
|
|
#else
|
2018-09-16 20:05:51 +02:00
|
|
|
return false;
|
2017-09-19 03:18:26 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-05-29 03:12:23 +02:00
|
|
|
TelemetrySession::TelemetrySession() = default;
|
|
|
|
|
|
|
|
TelemetrySession::~TelemetrySession() {
|
|
|
|
// Log one-time session end information
|
|
|
|
const s64 shutdown_time{std::chrono::duration_cast<std::chrono::milliseconds>(
|
|
|
|
std::chrono::system_clock::now().time_since_epoch())
|
|
|
|
.count()};
|
|
|
|
AddField(Telemetry::FieldType::Session, "Shutdown_Time", shutdown_time);
|
|
|
|
|
|
|
|
#ifdef ENABLE_WEB_SERVICE
|
|
|
|
auto backend = std::make_unique<WebService::TelemetryJson>(
|
2021-06-29 01:41:39 +02:00
|
|
|
Settings::values.web_api_url.GetValue(), Settings::values.yuzu_username.GetValue(),
|
|
|
|
Settings::values.yuzu_token.GetValue());
|
2019-05-29 03:12:23 +02:00
|
|
|
#else
|
|
|
|
auto backend = std::make_unique<Telemetry::NullVisitor>();
|
|
|
|
#endif
|
|
|
|
|
2019-05-29 03:32:48 +02:00
|
|
|
// Complete the session, submitting to the web service backend if necessary
|
2019-05-29 03:12:23 +02:00
|
|
|
field_collection.Accept(*backend);
|
|
|
|
if (Settings::values.enable_telemetry) {
|
|
|
|
backend->Complete();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-18 13:53:10 +01:00
|
|
|
void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader,
|
|
|
|
const Service::FileSystem::FileSystemController& fsc,
|
|
|
|
const FileSys::ContentProvider& content_provider) {
|
2017-08-23 02:58:19 +02:00
|
|
|
// Log one-time top-level information
|
|
|
|
AddField(Telemetry::FieldType::None, "TelemetryId", GetTelemetryId());
|
|
|
|
|
2017-05-02 06:10:04 +02:00
|
|
|
// Log one-time session start information
|
2017-07-13 04:19:34 +02:00
|
|
|
const s64 init_time{std::chrono::duration_cast<std::chrono::milliseconds>(
|
|
|
|
std::chrono::system_clock::now().time_since_epoch())
|
|
|
|
.count()};
|
|
|
|
AddField(Telemetry::FieldType::Session, "Init_Time", init_time);
|
2018-09-04 01:00:51 +02:00
|
|
|
|
|
|
|
u64 program_id{};
|
2019-05-29 03:12:23 +02:00
|
|
|
const Loader::ResultStatus res{app_loader.ReadProgramId(program_id)};
|
2017-08-02 01:55:48 +02:00
|
|
|
if (res == Loader::ResultStatus::Success) {
|
2018-09-17 17:16:01 +02:00
|
|
|
const std::string formatted_program_id{fmt::format("{:016X}", program_id)};
|
2018-09-16 20:05:51 +02:00
|
|
|
AddField(Telemetry::FieldType::Session, "ProgramId", formatted_program_id);
|
2018-09-04 01:00:51 +02:00
|
|
|
|
|
|
|
std::string name;
|
2019-05-29 03:12:23 +02:00
|
|
|
app_loader.ReadTitle(name);
|
2018-09-04 01:00:51 +02:00
|
|
|
|
|
|
|
if (name.empty()) {
|
2020-11-18 13:53:10 +01:00
|
|
|
const auto metadata = [&content_provider, &fsc, program_id] {
|
|
|
|
const FileSys::PatchManager pm{program_id, fsc, content_provider};
|
|
|
|
return pm.GetControlMetadata();
|
|
|
|
}();
|
2020-04-15 21:59:23 +02:00
|
|
|
if (metadata.first != nullptr) {
|
|
|
|
name = metadata.first->GetApplicationName();
|
2019-05-29 03:12:23 +02:00
|
|
|
}
|
2018-09-04 01:00:51 +02:00
|
|
|
}
|
|
|
|
|
2019-05-29 03:12:23 +02:00
|
|
|
if (!name.empty()) {
|
2018-09-04 01:00:51 +02:00
|
|
|
AddField(Telemetry::FieldType::Session, "ProgramName", name);
|
2019-05-29 03:12:23 +02:00
|
|
|
}
|
2017-08-02 01:55:48 +02:00
|
|
|
}
|
2017-05-02 06:10:04 +02:00
|
|
|
|
2018-09-04 01:00:51 +02:00
|
|
|
AddField(Telemetry::FieldType::Session, "ProgramFormat",
|
2019-05-29 03:12:23 +02:00
|
|
|
static_cast<u8>(app_loader.GetFileType()));
|
2018-09-04 01:00:51 +02:00
|
|
|
|
2017-07-13 04:19:34 +02:00
|
|
|
// Log application information
|
2018-08-15 00:48:28 +02:00
|
|
|
Telemetry::AppendBuildInfo(field_collection);
|
2017-07-13 04:19:34 +02:00
|
|
|
|
2018-08-15 00:48:28 +02:00
|
|
|
// Log user system information
|
|
|
|
Telemetry::AppendCPUInfo(field_collection);
|
|
|
|
Telemetry::AppendOSInfo(field_collection);
|
2017-07-13 04:19:34 +02:00
|
|
|
|
|
|
|
// Log user configuration information
|
2023-02-14 17:13:47 +01:00
|
|
|
constexpr auto field_type = Telemetry::FieldType::UserConfig;
|
2021-06-28 21:58:16 +02:00
|
|
|
AddField(field_type, "Audio_SinkId", Settings::values.sink_id.GetValue());
|
configuration: implement per-game configurations (#4098)
* Switch game settings to use a pointer
In order to add full per-game settings, we need to be able to tell yuzu to switch
to using either the global or game configuration. Using a pointer makes it easier
to switch.
* configuration: add new UI without changing existing funcitonality
The new UI also adds General, System, Graphics, Advanced Graphics,
and Audio tabs, but as yet they do nothing. This commit keeps yuzu
to the same functionality as originally branched.
* configuration: Rename files
These weren't included in the last commit. Now they are.
* configuration: setup global configuration checkbox
Global config checkbox now enables/disables the appropriate tabs in the game
properties dialog. The use global configuration setting is now saved to the
config, defaulting to true. This also addresses some changes requested in the PR.
* configuration: swap to per-game config memory for properties dialog
Does not set memory going in-game. Swaps to game values when opening the
properties dialog, then swaps back when closing it. Uses a `memcpy` to swap.
Also implements saving config files, limited to certain groups of configurations
so as to not risk setting unsafe configurations.
* configuration: change config interfaces to use config-specific pointers
When a game is booted, we need to be able to open the configuration dialogs
without changing the settings pointer in the game's emualtion. A new pointer
specific to just the configuration dialogs can be used to separate changes
to just those config dialogs without affecting the emulation.
* configuration: boot a game using per-game settings
Swaps values where needed to boot a game.
* configuration: user correct config during emulation
Creates a new pointer specifically for modifying the configuration while
emulation is in progress. Both the regular configuration dialog and the game
properties dialog now use the pointer Settings::config_values to focus edits to
the correct struct.
* settings: split Settings::values into two different structs
By splitting the settings into two mutually exclusive structs, it becomes easier,
as a developer, to determine how to use the Settings structs after per-game
configurations is merged. Other benefits include only duplicating the required
settings in memory.
* settings: move use_docked_mode to Controls group
`use_docked_mode` is set in the input settings and cannot be accessed from the
system settings. Grouping it with system settings causes it to be saved with
per-game settings, which may make transferring configs more difficult later on,
especially since docked mode cannot be set from within the game properties
dialog.
* configuration: Fix the other yuzu executables and a regression
In main.cpp, we have to get the title ID before the ROM is loaded, else the
renderer will reflect only the global settings and now the user's game specific
settings.
* settings: use a template to duplicate memory for each setting
Replaces the type of each variable in the Settings::Values struct with a new
class that allows basic data reading and writing. The new struct
Settings::Setting duplicates the data in memory and can manage global overrides
per each setting.
* configuration: correct add-ons config and swap settings when apropriate
Any add-ons interaction happens directly through the global values struct.
Swapping bewteen structs now also includes copying the necessary global configs
that cannot be changed nor saved in per-game settings. General and System config
menus now update based on whether it is viewing the global or per-game settings.
* settings: restore old values struct
No longer needed with the Settings::Setting class template.
* configuration: implement hierarchical game properties dialog
This sets the apropriate global or local data in each setting.
* clang format
* clang format take 2
can the docker container save this?
* address comments and style issues
* config: read and write settings with global awareness
Adds new functions to read and write settings while keeping the global state in
focus. Files now generated per-game are much smaller since often they only need
address the global state.
* settings: restore global state when necessary
Upon closing a game or the game properties dialog, we need to restore all global
settings to the original global state so that we can properly open the
configuration dialog or boot a different game.
* configuration: guard setting values incorrectly
This disables setting values while a game is running if the setting is
overwritten by a per game setting.
* config: don't write local settings in the global config
Simple guards to prevent writing the wrong settings in the wrong files.
* configuration: add comments, assume less, and clang format
No longer assumes that a disabled UI element means the global state is turned
off, instead opting to directly answer that question. Still however assumes a
game is running if it is in that state.
* configuration: fix a logic error
Should not be negated
* restore settings' global state regardless of accept/cancel
Fixes loading a properties dialog and causing the global config dialog to show
local settings.
* fix more logic errors
Fixed the frame limit would set the global setting from the game properties
dialog. Also strengthened the Settings::Setting member variables and simplified
the logic in config reading (ReadSettingGlobal).
* fix another logic error
In my efforts to guard RestoreGlobalState, I accidentally negated the IsPowered
condition.
* configure_audio: set toggle_stretched_audio to tristate
* fixed custom rtc and rng seed overwriting the global value
* clang format
* rebased
* clang format take 4
* address my own review
Basically revert unintended changes
* settings: literal instead of casting
"No need to cast, use 1U instead"
Thanks, Morph!
Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com>
* Revert "settings: literal instead of casting
"
This reverts commit 95e992a87c898f3e882ffdb415bb0ef9f80f613f.
* main: fix status buttons reporting wrong settings after stop emulation
* settings: Log UseDockedMode in the Controls group
This should have happened when use_docked_mode was moved over to the controls group
internally. This just reflects this in the log.
* main: load settings if the file has a title id
In other words, don't exit if the loader has trouble getting a title id.
* use a zero
* settings: initalize resolution factor with constructor instead of casting
* Revert "settings: initalize resolution factor with constructor instead of casting"
This reverts commit 54c35ecb46a29953842614620f9b7de1aa9d5dc8.
* configure_graphics: guard device selector when Vulkan is global
Prevents the user from editing the device selector if Vulkan is the global
renderer backend. Also resets the vulkan_device variable when the users
switches back-and-forth between global and Vulkan.
* address reviewer concerns
Changes function variables to const wherever they don't need to be changed. Sets Settings::Setting to final as it should not be inherited from. Sets ConfigurationShared::use_global_text to static.
Co-Authored-By: VolcaEM <volcaem@users.noreply.github.com>
* main: load per-game settings after LoadROM
This prevents `Restart Emulation` from restoring the global settings *after* the per-game settings were applied. Thanks to BSoDGamingYT for finding this bug.
* Revert "main: load per-game settings after LoadROM"
This reverts commit 9d0d48c52d2dcf3bfb1806cc8fa7d5a271a8a804.
* main: only restore global settings when necessary
Loading the per-game settings cannot happen after the ROM is loaded, so we have to specify when to restore the global state. Again thanks to BSoD for finding the bug.
* configuration_shared: address reviewer concerns except operator overrides
Dropping operator override usage in next commit.
Co-Authored-By: LC <lioncash@users.noreply.github.com>
* settings: Drop operator overrides from Setting template
Requires using GetValue and SetValue explicitly. Also reverts a change that broke title ID formatting in the game properties dialog.
* complete rebase
* configuration_shared: translate "Use global configuration"
Uses ConfigurePerGame to do so, since its usage, at least as of now, corresponds with ConfigurationShared.
* configure_per_game: address reviewer concern
As far as I understand, it prevents the program from unnecessarily copying strings.
Co-Authored-By: LC <lioncash@users.noreply.github.com>
Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com>
Co-authored-by: VolcaEM <volcaem@users.noreply.github.com>
Co-authored-by: LC <lioncash@users.noreply.github.com>
2020-07-10 04:42:09 +02:00
|
|
|
AddField(field_type, "Core_UseMultiCore", Settings::values.use_multi_core.GetValue());
|
|
|
|
AddField(field_type, "Renderer_Backend",
|
|
|
|
TranslateRenderer(Settings::values.renderer_backend.GetValue()));
|
2021-07-23 01:56:21 +02:00
|
|
|
AddField(field_type, "Renderer_UseSpeedLimit", Settings::values.use_speed_limit.GetValue());
|
|
|
|
AddField(field_type, "Renderer_SpeedLimit", Settings::values.speed_limit.GetValue());
|
configuration: implement per-game configurations (#4098)
* Switch game settings to use a pointer
In order to add full per-game settings, we need to be able to tell yuzu to switch
to using either the global or game configuration. Using a pointer makes it easier
to switch.
* configuration: add new UI without changing existing funcitonality
The new UI also adds General, System, Graphics, Advanced Graphics,
and Audio tabs, but as yet they do nothing. This commit keeps yuzu
to the same functionality as originally branched.
* configuration: Rename files
These weren't included in the last commit. Now they are.
* configuration: setup global configuration checkbox
Global config checkbox now enables/disables the appropriate tabs in the game
properties dialog. The use global configuration setting is now saved to the
config, defaulting to true. This also addresses some changes requested in the PR.
* configuration: swap to per-game config memory for properties dialog
Does not set memory going in-game. Swaps to game values when opening the
properties dialog, then swaps back when closing it. Uses a `memcpy` to swap.
Also implements saving config files, limited to certain groups of configurations
so as to not risk setting unsafe configurations.
* configuration: change config interfaces to use config-specific pointers
When a game is booted, we need to be able to open the configuration dialogs
without changing the settings pointer in the game's emualtion. A new pointer
specific to just the configuration dialogs can be used to separate changes
to just those config dialogs without affecting the emulation.
* configuration: boot a game using per-game settings
Swaps values where needed to boot a game.
* configuration: user correct config during emulation
Creates a new pointer specifically for modifying the configuration while
emulation is in progress. Both the regular configuration dialog and the game
properties dialog now use the pointer Settings::config_values to focus edits to
the correct struct.
* settings: split Settings::values into two different structs
By splitting the settings into two mutually exclusive structs, it becomes easier,
as a developer, to determine how to use the Settings structs after per-game
configurations is merged. Other benefits include only duplicating the required
settings in memory.
* settings: move use_docked_mode to Controls group
`use_docked_mode` is set in the input settings and cannot be accessed from the
system settings. Grouping it with system settings causes it to be saved with
per-game settings, which may make transferring configs more difficult later on,
especially since docked mode cannot be set from within the game properties
dialog.
* configuration: Fix the other yuzu executables and a regression
In main.cpp, we have to get the title ID before the ROM is loaded, else the
renderer will reflect only the global settings and now the user's game specific
settings.
* settings: use a template to duplicate memory for each setting
Replaces the type of each variable in the Settings::Values struct with a new
class that allows basic data reading and writing. The new struct
Settings::Setting duplicates the data in memory and can manage global overrides
per each setting.
* configuration: correct add-ons config and swap settings when apropriate
Any add-ons interaction happens directly through the global values struct.
Swapping bewteen structs now also includes copying the necessary global configs
that cannot be changed nor saved in per-game settings. General and System config
menus now update based on whether it is viewing the global or per-game settings.
* settings: restore old values struct
No longer needed with the Settings::Setting class template.
* configuration: implement hierarchical game properties dialog
This sets the apropriate global or local data in each setting.
* clang format
* clang format take 2
can the docker container save this?
* address comments and style issues
* config: read and write settings with global awareness
Adds new functions to read and write settings while keeping the global state in
focus. Files now generated per-game are much smaller since often they only need
address the global state.
* settings: restore global state when necessary
Upon closing a game or the game properties dialog, we need to restore all global
settings to the original global state so that we can properly open the
configuration dialog or boot a different game.
* configuration: guard setting values incorrectly
This disables setting values while a game is running if the setting is
overwritten by a per game setting.
* config: don't write local settings in the global config
Simple guards to prevent writing the wrong settings in the wrong files.
* configuration: add comments, assume less, and clang format
No longer assumes that a disabled UI element means the global state is turned
off, instead opting to directly answer that question. Still however assumes a
game is running if it is in that state.
* configuration: fix a logic error
Should not be negated
* restore settings' global state regardless of accept/cancel
Fixes loading a properties dialog and causing the global config dialog to show
local settings.
* fix more logic errors
Fixed the frame limit would set the global setting from the game properties
dialog. Also strengthened the Settings::Setting member variables and simplified
the logic in config reading (ReadSettingGlobal).
* fix another logic error
In my efforts to guard RestoreGlobalState, I accidentally negated the IsPowered
condition.
* configure_audio: set toggle_stretched_audio to tristate
* fixed custom rtc and rng seed overwriting the global value
* clang format
* rebased
* clang format take 4
* address my own review
Basically revert unintended changes
* settings: literal instead of casting
"No need to cast, use 1U instead"
Thanks, Morph!
Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com>
* Revert "settings: literal instead of casting
"
This reverts commit 95e992a87c898f3e882ffdb415bb0ef9f80f613f.
* main: fix status buttons reporting wrong settings after stop emulation
* settings: Log UseDockedMode in the Controls group
This should have happened when use_docked_mode was moved over to the controls group
internally. This just reflects this in the log.
* main: load settings if the file has a title id
In other words, don't exit if the loader has trouble getting a title id.
* use a zero
* settings: initalize resolution factor with constructor instead of casting
* Revert "settings: initalize resolution factor with constructor instead of casting"
This reverts commit 54c35ecb46a29953842614620f9b7de1aa9d5dc8.
* configure_graphics: guard device selector when Vulkan is global
Prevents the user from editing the device selector if Vulkan is the global
renderer backend. Also resets the vulkan_device variable when the users
switches back-and-forth between global and Vulkan.
* address reviewer concerns
Changes function variables to const wherever they don't need to be changed. Sets Settings::Setting to final as it should not be inherited from. Sets ConfigurationShared::use_global_text to static.
Co-Authored-By: VolcaEM <volcaem@users.noreply.github.com>
* main: load per-game settings after LoadROM
This prevents `Restart Emulation` from restoring the global settings *after* the per-game settings were applied. Thanks to BSoDGamingYT for finding this bug.
* Revert "main: load per-game settings after LoadROM"
This reverts commit 9d0d48c52d2dcf3bfb1806cc8fa7d5a271a8a804.
* main: only restore global settings when necessary
Loading the per-game settings cannot happen after the ROM is loaded, so we have to specify when to restore the global state. Again thanks to BSoD for finding the bug.
* configuration_shared: address reviewer concerns except operator overrides
Dropping operator override usage in next commit.
Co-Authored-By: LC <lioncash@users.noreply.github.com>
* settings: Drop operator overrides from Setting template
Requires using GetValue and SetValue explicitly. Also reverts a change that broke title ID formatting in the game properties dialog.
* complete rebase
* configuration_shared: translate "Use global configuration"
Uses ConfigurePerGame to do so, since its usage, at least as of now, corresponds with ConfigurationShared.
* configure_per_game: address reviewer concern
As far as I understand, it prevents the program from unnecessarily copying strings.
Co-Authored-By: LC <lioncash@users.noreply.github.com>
Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com>
Co-authored-by: VolcaEM <volcaem@users.noreply.github.com>
Co-authored-by: LC <lioncash@users.noreply.github.com>
2020-07-10 04:42:09 +02:00
|
|
|
AddField(field_type, "Renderer_UseDiskShaderCache",
|
|
|
|
Settings::values.use_disk_shader_cache.GetValue());
|
2020-02-18 21:51:42 +01:00
|
|
|
AddField(field_type, "Renderer_GPUAccuracyLevel",
|
configuration: implement per-game configurations (#4098)
* Switch game settings to use a pointer
In order to add full per-game settings, we need to be able to tell yuzu to switch
to using either the global or game configuration. Using a pointer makes it easier
to switch.
* configuration: add new UI without changing existing funcitonality
The new UI also adds General, System, Graphics, Advanced Graphics,
and Audio tabs, but as yet they do nothing. This commit keeps yuzu
to the same functionality as originally branched.
* configuration: Rename files
These weren't included in the last commit. Now they are.
* configuration: setup global configuration checkbox
Global config checkbox now enables/disables the appropriate tabs in the game
properties dialog. The use global configuration setting is now saved to the
config, defaulting to true. This also addresses some changes requested in the PR.
* configuration: swap to per-game config memory for properties dialog
Does not set memory going in-game. Swaps to game values when opening the
properties dialog, then swaps back when closing it. Uses a `memcpy` to swap.
Also implements saving config files, limited to certain groups of configurations
so as to not risk setting unsafe configurations.
* configuration: change config interfaces to use config-specific pointers
When a game is booted, we need to be able to open the configuration dialogs
without changing the settings pointer in the game's emualtion. A new pointer
specific to just the configuration dialogs can be used to separate changes
to just those config dialogs without affecting the emulation.
* configuration: boot a game using per-game settings
Swaps values where needed to boot a game.
* configuration: user correct config during emulation
Creates a new pointer specifically for modifying the configuration while
emulation is in progress. Both the regular configuration dialog and the game
properties dialog now use the pointer Settings::config_values to focus edits to
the correct struct.
* settings: split Settings::values into two different structs
By splitting the settings into two mutually exclusive structs, it becomes easier,
as a developer, to determine how to use the Settings structs after per-game
configurations is merged. Other benefits include only duplicating the required
settings in memory.
* settings: move use_docked_mode to Controls group
`use_docked_mode` is set in the input settings and cannot be accessed from the
system settings. Grouping it with system settings causes it to be saved with
per-game settings, which may make transferring configs more difficult later on,
especially since docked mode cannot be set from within the game properties
dialog.
* configuration: Fix the other yuzu executables and a regression
In main.cpp, we have to get the title ID before the ROM is loaded, else the
renderer will reflect only the global settings and now the user's game specific
settings.
* settings: use a template to duplicate memory for each setting
Replaces the type of each variable in the Settings::Values struct with a new
class that allows basic data reading and writing. The new struct
Settings::Setting duplicates the data in memory and can manage global overrides
per each setting.
* configuration: correct add-ons config and swap settings when apropriate
Any add-ons interaction happens directly through the global values struct.
Swapping bewteen structs now also includes copying the necessary global configs
that cannot be changed nor saved in per-game settings. General and System config
menus now update based on whether it is viewing the global or per-game settings.
* settings: restore old values struct
No longer needed with the Settings::Setting class template.
* configuration: implement hierarchical game properties dialog
This sets the apropriate global or local data in each setting.
* clang format
* clang format take 2
can the docker container save this?
* address comments and style issues
* config: read and write settings with global awareness
Adds new functions to read and write settings while keeping the global state in
focus. Files now generated per-game are much smaller since often they only need
address the global state.
* settings: restore global state when necessary
Upon closing a game or the game properties dialog, we need to restore all global
settings to the original global state so that we can properly open the
configuration dialog or boot a different game.
* configuration: guard setting values incorrectly
This disables setting values while a game is running if the setting is
overwritten by a per game setting.
* config: don't write local settings in the global config
Simple guards to prevent writing the wrong settings in the wrong files.
* configuration: add comments, assume less, and clang format
No longer assumes that a disabled UI element means the global state is turned
off, instead opting to directly answer that question. Still however assumes a
game is running if it is in that state.
* configuration: fix a logic error
Should not be negated
* restore settings' global state regardless of accept/cancel
Fixes loading a properties dialog and causing the global config dialog to show
local settings.
* fix more logic errors
Fixed the frame limit would set the global setting from the game properties
dialog. Also strengthened the Settings::Setting member variables and simplified
the logic in config reading (ReadSettingGlobal).
* fix another logic error
In my efforts to guard RestoreGlobalState, I accidentally negated the IsPowered
condition.
* configure_audio: set toggle_stretched_audio to tristate
* fixed custom rtc and rng seed overwriting the global value
* clang format
* rebased
* clang format take 4
* address my own review
Basically revert unintended changes
* settings: literal instead of casting
"No need to cast, use 1U instead"
Thanks, Morph!
Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com>
* Revert "settings: literal instead of casting
"
This reverts commit 95e992a87c898f3e882ffdb415bb0ef9f80f613f.
* main: fix status buttons reporting wrong settings after stop emulation
* settings: Log UseDockedMode in the Controls group
This should have happened when use_docked_mode was moved over to the controls group
internally. This just reflects this in the log.
* main: load settings if the file has a title id
In other words, don't exit if the loader has trouble getting a title id.
* use a zero
* settings: initalize resolution factor with constructor instead of casting
* Revert "settings: initalize resolution factor with constructor instead of casting"
This reverts commit 54c35ecb46a29953842614620f9b7de1aa9d5dc8.
* configure_graphics: guard device selector when Vulkan is global
Prevents the user from editing the device selector if Vulkan is the global
renderer backend. Also resets the vulkan_device variable when the users
switches back-and-forth between global and Vulkan.
* address reviewer concerns
Changes function variables to const wherever they don't need to be changed. Sets Settings::Setting to final as it should not be inherited from. Sets ConfigurationShared::use_global_text to static.
Co-Authored-By: VolcaEM <volcaem@users.noreply.github.com>
* main: load per-game settings after LoadROM
This prevents `Restart Emulation` from restoring the global settings *after* the per-game settings were applied. Thanks to BSoDGamingYT for finding this bug.
* Revert "main: load per-game settings after LoadROM"
This reverts commit 9d0d48c52d2dcf3bfb1806cc8fa7d5a271a8a804.
* main: only restore global settings when necessary
Loading the per-game settings cannot happen after the ROM is loaded, so we have to specify when to restore the global state. Again thanks to BSoD for finding the bug.
* configuration_shared: address reviewer concerns except operator overrides
Dropping operator override usage in next commit.
Co-Authored-By: LC <lioncash@users.noreply.github.com>
* settings: Drop operator overrides from Setting template
Requires using GetValue and SetValue explicitly. Also reverts a change that broke title ID formatting in the game properties dialog.
* complete rebase
* configuration_shared: translate "Use global configuration"
Uses ConfigurePerGame to do so, since its usage, at least as of now, corresponds with ConfigurationShared.
* configure_per_game: address reviewer concern
As far as I understand, it prevents the program from unnecessarily copying strings.
Co-Authored-By: LC <lioncash@users.noreply.github.com>
Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com>
Co-authored-by: VolcaEM <volcaem@users.noreply.github.com>
Co-authored-by: LC <lioncash@users.noreply.github.com>
2020-07-10 04:42:09 +02:00
|
|
|
TranslateGPUAccuracyLevel(Settings::values.gpu_accuracy.GetValue()));
|
2019-12-02 20:49:46 +01:00
|
|
|
AddField(field_type, "Renderer_UseAsynchronousGpuEmulation",
|
configuration: implement per-game configurations (#4098)
* Switch game settings to use a pointer
In order to add full per-game settings, we need to be able to tell yuzu to switch
to using either the global or game configuration. Using a pointer makes it easier
to switch.
* configuration: add new UI without changing existing funcitonality
The new UI also adds General, System, Graphics, Advanced Graphics,
and Audio tabs, but as yet they do nothing. This commit keeps yuzu
to the same functionality as originally branched.
* configuration: Rename files
These weren't included in the last commit. Now they are.
* configuration: setup global configuration checkbox
Global config checkbox now enables/disables the appropriate tabs in the game
properties dialog. The use global configuration setting is now saved to the
config, defaulting to true. This also addresses some changes requested in the PR.
* configuration: swap to per-game config memory for properties dialog
Does not set memory going in-game. Swaps to game values when opening the
properties dialog, then swaps back when closing it. Uses a `memcpy` to swap.
Also implements saving config files, limited to certain groups of configurations
so as to not risk setting unsafe configurations.
* configuration: change config interfaces to use config-specific pointers
When a game is booted, we need to be able to open the configuration dialogs
without changing the settings pointer in the game's emualtion. A new pointer
specific to just the configuration dialogs can be used to separate changes
to just those config dialogs without affecting the emulation.
* configuration: boot a game using per-game settings
Swaps values where needed to boot a game.
* configuration: user correct config during emulation
Creates a new pointer specifically for modifying the configuration while
emulation is in progress. Both the regular configuration dialog and the game
properties dialog now use the pointer Settings::config_values to focus edits to
the correct struct.
* settings: split Settings::values into two different structs
By splitting the settings into two mutually exclusive structs, it becomes easier,
as a developer, to determine how to use the Settings structs after per-game
configurations is merged. Other benefits include only duplicating the required
settings in memory.
* settings: move use_docked_mode to Controls group
`use_docked_mode` is set in the input settings and cannot be accessed from the
system settings. Grouping it with system settings causes it to be saved with
per-game settings, which may make transferring configs more difficult later on,
especially since docked mode cannot be set from within the game properties
dialog.
* configuration: Fix the other yuzu executables and a regression
In main.cpp, we have to get the title ID before the ROM is loaded, else the
renderer will reflect only the global settings and now the user's game specific
settings.
* settings: use a template to duplicate memory for each setting
Replaces the type of each variable in the Settings::Values struct with a new
class that allows basic data reading and writing. The new struct
Settings::Setting duplicates the data in memory and can manage global overrides
per each setting.
* configuration: correct add-ons config and swap settings when apropriate
Any add-ons interaction happens directly through the global values struct.
Swapping bewteen structs now also includes copying the necessary global configs
that cannot be changed nor saved in per-game settings. General and System config
menus now update based on whether it is viewing the global or per-game settings.
* settings: restore old values struct
No longer needed with the Settings::Setting class template.
* configuration: implement hierarchical game properties dialog
This sets the apropriate global or local data in each setting.
* clang format
* clang format take 2
can the docker container save this?
* address comments and style issues
* config: read and write settings with global awareness
Adds new functions to read and write settings while keeping the global state in
focus. Files now generated per-game are much smaller since often they only need
address the global state.
* settings: restore global state when necessary
Upon closing a game or the game properties dialog, we need to restore all global
settings to the original global state so that we can properly open the
configuration dialog or boot a different game.
* configuration: guard setting values incorrectly
This disables setting values while a game is running if the setting is
overwritten by a per game setting.
* config: don't write local settings in the global config
Simple guards to prevent writing the wrong settings in the wrong files.
* configuration: add comments, assume less, and clang format
No longer assumes that a disabled UI element means the global state is turned
off, instead opting to directly answer that question. Still however assumes a
game is running if it is in that state.
* configuration: fix a logic error
Should not be negated
* restore settings' global state regardless of accept/cancel
Fixes loading a properties dialog and causing the global config dialog to show
local settings.
* fix more logic errors
Fixed the frame limit would set the global setting from the game properties
dialog. Also strengthened the Settings::Setting member variables and simplified
the logic in config reading (ReadSettingGlobal).
* fix another logic error
In my efforts to guard RestoreGlobalState, I accidentally negated the IsPowered
condition.
* configure_audio: set toggle_stretched_audio to tristate
* fixed custom rtc and rng seed overwriting the global value
* clang format
* rebased
* clang format take 4
* address my own review
Basically revert unintended changes
* settings: literal instead of casting
"No need to cast, use 1U instead"
Thanks, Morph!
Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com>
* Revert "settings: literal instead of casting
"
This reverts commit 95e992a87c898f3e882ffdb415bb0ef9f80f613f.
* main: fix status buttons reporting wrong settings after stop emulation
* settings: Log UseDockedMode in the Controls group
This should have happened when use_docked_mode was moved over to the controls group
internally. This just reflects this in the log.
* main: load settings if the file has a title id
In other words, don't exit if the loader has trouble getting a title id.
* use a zero
* settings: initalize resolution factor with constructor instead of casting
* Revert "settings: initalize resolution factor with constructor instead of casting"
This reverts commit 54c35ecb46a29953842614620f9b7de1aa9d5dc8.
* configure_graphics: guard device selector when Vulkan is global
Prevents the user from editing the device selector if Vulkan is the global
renderer backend. Also resets the vulkan_device variable when the users
switches back-and-forth between global and Vulkan.
* address reviewer concerns
Changes function variables to const wherever they don't need to be changed. Sets Settings::Setting to final as it should not be inherited from. Sets ConfigurationShared::use_global_text to static.
Co-Authored-By: VolcaEM <volcaem@users.noreply.github.com>
* main: load per-game settings after LoadROM
This prevents `Restart Emulation` from restoring the global settings *after* the per-game settings were applied. Thanks to BSoDGamingYT for finding this bug.
* Revert "main: load per-game settings after LoadROM"
This reverts commit 9d0d48c52d2dcf3bfb1806cc8fa7d5a271a8a804.
* main: only restore global settings when necessary
Loading the per-game settings cannot happen after the ROM is loaded, so we have to specify when to restore the global state. Again thanks to BSoD for finding the bug.
* configuration_shared: address reviewer concerns except operator overrides
Dropping operator override usage in next commit.
Co-Authored-By: LC <lioncash@users.noreply.github.com>
* settings: Drop operator overrides from Setting template
Requires using GetValue and SetValue explicitly. Also reverts a change that broke title ID formatting in the game properties dialog.
* complete rebase
* configuration_shared: translate "Use global configuration"
Uses ConfigurePerGame to do so, since its usage, at least as of now, corresponds with ConfigurationShared.
* configure_per_game: address reviewer concern
As far as I understand, it prevents the program from unnecessarily copying strings.
Co-Authored-By: LC <lioncash@users.noreply.github.com>
Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com>
Co-authored-by: VolcaEM <volcaem@users.noreply.github.com>
Co-authored-by: LC <lioncash@users.noreply.github.com>
2020-07-10 04:42:09 +02:00
|
|
|
Settings::values.use_asynchronous_gpu_emulation.GetValue());
|
2021-08-08 22:56:40 +02:00
|
|
|
AddField(field_type, "Renderer_NvdecEmulation",
|
|
|
|
TranslateNvdecEmulation(Settings::values.nvdec_emulation.GetValue()));
|
2021-06-13 21:38:54 +02:00
|
|
|
AddField(field_type, "Renderer_AccelerateASTC", Settings::values.accelerate_astc.GetValue());
|
2023-04-30 21:39:00 +02:00
|
|
|
AddField(field_type, "Renderer_UseVsync",
|
|
|
|
TranslateVSyncMode(Settings::values.vsync_mode.GetValue()));
|
2021-07-08 23:28:48 +02:00
|
|
|
AddField(field_type, "Renderer_ShaderBackend",
|
|
|
|
static_cast<u32>(Settings::values.shader_backend.GetValue()));
|
2020-07-10 06:00:02 +02:00
|
|
|
AddField(field_type, "Renderer_UseAsynchronousShaders",
|
|
|
|
Settings::values.use_asynchronous_shaders.GetValue());
|
2020-09-28 16:00:15 +02:00
|
|
|
AddField(field_type, "System_UseDockedMode", Settings::values.use_docked_mode.GetValue());
|
2017-05-02 06:09:15 +02:00
|
|
|
}
|
|
|
|
|
2018-10-26 16:21:45 +02:00
|
|
|
bool TelemetrySession::SubmitTestcase() {
|
|
|
|
#ifdef ENABLE_WEB_SERVICE
|
2019-04-19 16:02:49 +02:00
|
|
|
auto backend = std::make_unique<WebService::TelemetryJson>(
|
2021-06-29 01:41:39 +02:00
|
|
|
Settings::values.web_api_url.GetValue(), Settings::values.yuzu_username.GetValue(),
|
|
|
|
Settings::values.yuzu_token.GetValue());
|
2018-10-26 16:21:45 +02:00
|
|
|
field_collection.Accept(*backend);
|
|
|
|
return backend->SubmitTestcase();
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2017-05-02 06:09:15 +02:00
|
|
|
} // namespace Core
|