diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/audio_core/sink_details.h | 13 | ||||
-rw-r--r-- | src/common/logging/backend.cpp | 1 | ||||
-rw-r--r-- | src/common/logging/log.h | 1 | ||||
-rw-r--r-- | src/common/math_util.h | 10 | ||||
-rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/core/hle/service/acc/acc.cpp | 30 | ||||
-rw-r--r-- | src/core/hle/service/am/am.cpp | 3 | ||||
-rw-r--r-- | src/core/hle/service/mig/mig.cpp | 34 | ||||
-rw-r--r-- | src/core/hle/service/mig/mig.h | 15 | ||||
-rw-r--r-- | src/core/hle/service/service.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/service/set/set.cpp | 15 | ||||
-rw-r--r-- | src/core/hle/service/set/set.h | 2 | ||||
-rw-r--r-- | src/core/settings.h | 2 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_manager.h | 2 | ||||
-rw-r--r-- | src/yuzu/configuration/config.cpp | 4 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_system.cpp | 8 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_system.ui | 29 | ||||
-rw-r--r-- | src/yuzu_cmd/default_ini.h | 10 |
18 files changed, 164 insertions, 19 deletions
diff --git a/src/audio_core/sink_details.h b/src/audio_core/sink_details.h index aa8aae1a9..ea666c554 100644 --- a/src/audio_core/sink_details.h +++ b/src/audio_core/sink_details.h @@ -6,6 +6,7 @@ #include <functional> #include <memory> +#include <utility> #include <vector> namespace AudioCore { @@ -13,16 +14,18 @@ namespace AudioCore { class Sink; struct SinkDetails { - SinkDetails(const char* id_, std::function<std::unique_ptr<Sink>(std::string)> factory_, - std::function<std::vector<std::string>()> list_devices_) - : id(id_), factory(factory_), list_devices(list_devices_) {} + using FactoryFn = std::function<std::unique_ptr<Sink>(std::string)>; + using ListDevicesFn = std::function<std::vector<std::string>()>; + + SinkDetails(const char* id_, FactoryFn factory_, ListDevicesFn list_devices_) + : id(id_), factory(std::move(factory_)), list_devices(std::move(list_devices_)) {} /// Name for this sink. const char* id; /// A method to call to construct an instance of this type of sink. - std::function<std::unique_ptr<Sink>(std::string device_id)> factory; + FactoryFn factory; /// A method to call to list available devices. - std::function<std::vector<std::string>()> list_devices; + ListDevicesFn list_devices; }; extern const std::vector<SinkDetails> g_sink_details; diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index 43561d607..c6a21d993 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -180,6 +180,7 @@ void FileBackend::Write(const Entry& entry) { SUB(Service, LBL) \ SUB(Service, LDN) \ SUB(Service, LM) \ + SUB(Service, Migration) \ SUB(Service, Mii) \ SUB(Service, MM) \ SUB(Service, NCM) \ diff --git a/src/common/logging/log.h b/src/common/logging/log.h index b5891fb15..3d6a161a5 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h @@ -67,6 +67,7 @@ enum class Class : ClassType { Service_LBL, ///< The LBL (LCD backlight) service Service_LDN, ///< The LDN (Local domain network) service Service_LM, ///< The LM (Logger) service + Service_Migration, ///< The migration service Service_Mii, ///< The Mii service Service_MM, ///< The MM (Multimedia) service Service_NCM, ///< The NCM service diff --git a/src/common/math_util.h b/src/common/math_util.h index c6a83c953..343cdd902 100644 --- a/src/common/math_util.h +++ b/src/common/math_util.h @@ -19,12 +19,12 @@ inline bool IntervalsIntersect(unsigned start0, unsigned length0, unsigned start template <class T> struct Rectangle { - T left; - T top; - T right; - T bottom; + T left{}; + T top{}; + T right{}; + T bottom{}; - Rectangle() {} + Rectangle() = default; Rectangle(T left, T top, T right, T bottom) : left(left), top(top), right(right), bottom(bottom) {} diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 19c629afe..884c28e20 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -204,6 +204,8 @@ add_library(core STATIC hle/service/ldr/ldr.h hle/service/lm/lm.cpp hle/service/lm/lm.h + hle/service/mig/mig.cpp + hle/service/mig/mig.h hle/service/mii/mii.cpp hle/service/mii/mii.h hle/service/mm/mm_u.cpp diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 0b158e015..6d15b46ed 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -10,6 +10,7 @@ #include "core/hle/service/acc/acc_su.h" #include "core/hle/service/acc/acc_u0.h" #include "core/hle/service/acc/acc_u1.h" +#include "core/settings.h" namespace Service::Account { @@ -31,13 +32,14 @@ struct ProfileBase { }; static_assert(sizeof(ProfileBase) == 0x38, "ProfileBase structure has incorrect size"); +// TODO(ogniK): Generate a real user id based on username, md5(username) maybe? static constexpr u128 DEFAULT_USER_ID{1ull, 0ull}; class IProfile final : public ServiceFramework<IProfile> { public: explicit IProfile(u128 user_id) : ServiceFramework("IProfile"), user_id(user_id) { static const FunctionInfo functions[] = { - {0, nullptr, "Get"}, + {0, &IProfile::Get, "Get"}, {1, &IProfile::GetBase, "GetBase"}, {10, nullptr, "GetImageSize"}, {11, nullptr, "LoadImage"}, @@ -46,14 +48,36 @@ public: } private: + void Get(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_ACC, "(STUBBED) called"); + ProfileBase profile_base{}; + profile_base.user_id = user_id; + if (Settings::values.username.size() > profile_base.username.size()) { + std::copy_n(Settings::values.username.begin(), profile_base.username.size(), + profile_base.username.begin()); + } else { + std::copy(Settings::values.username.begin(), Settings::values.username.end(), + profile_base.username.begin()); + } + + IPC::ResponseBuilder rb{ctx, 16}; + rb.Push(RESULT_SUCCESS); + rb.PushRaw(profile_base); + } + void GetBase(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_ACC, "(STUBBED) called"); // TODO(Subv): Retrieve this information from somewhere. ProfileBase profile_base{}; profile_base.user_id = user_id; - profile_base.username = {'y', 'u', 'z', 'u'}; - + if (Settings::values.username.size() > profile_base.username.size()) { + std::copy_n(Settings::values.username.begin(), profile_base.username.size(), + profile_base.username.begin()); + } else { + std::copy(Settings::values.username.begin(), Settings::values.username.end(), + profile_base.username.begin()); + } IPC::ResponseBuilder rb{ctx, 16}; rb.Push(RESULT_SUCCESS); rb.PushRaw(profile_base); diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 94d2a973d..9404d6b8c 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -652,7 +652,8 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) { // TODO(bunnei): This should be configurable IPC::ResponseBuilder rb{ctx, 4}; rb.Push(RESULT_SUCCESS); - rb.Push(static_cast<u64>(Service::Set::LanguageCode::EN_US)); + rb.Push( + static_cast<u64>(Service::Set::GetLanguageCodeFromIndex(Settings::values.language_index))); LOG_DEBUG(Service_AM, "called"); } diff --git a/src/core/hle/service/mig/mig.cpp b/src/core/hle/service/mig/mig.cpp new file mode 100644 index 000000000..d16367f2c --- /dev/null +++ b/src/core/hle/service/mig/mig.cpp @@ -0,0 +1,34 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include <memory> + +#include "core/hle/service/mig/mig.h" +#include "core/hle/service/service.h" +#include "core/hle/service/sm/sm.h" + +namespace Service::Migration { + +class MIG_USR final : public ServiceFramework<MIG_USR> { +public: + explicit MIG_USR() : ServiceFramework{"mig:usr"} { + // clang-format off + static const FunctionInfo functions[] = { + {10, nullptr, "TryGetLastMigrationInfo"}, + {100, nullptr, "CreateServer"}, + {101, nullptr, "ResumeServer"}, + {200, nullptr, "CreateClient"}, + {201, nullptr, "ResumeClient"}, + }; + // clang-format on + + RegisterHandlers(functions); + } +}; + +void InstallInterfaces(SM::ServiceManager& sm) { + std::make_shared<MIG_USR>()->InstallAsService(sm); +} + +} // namespace Service::Migration diff --git a/src/core/hle/service/mig/mig.h b/src/core/hle/service/mig/mig.h new file mode 100644 index 000000000..288c1c1b3 --- /dev/null +++ b/src/core/hle/service/mig/mig.h @@ -0,0 +1,15 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +namespace Service::SM { +class ServiceManager; +} + +namespace Service::Migration { + +void InstallInterfaces(SM::ServiceManager& sm); + +} // namespace Service::Migration diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 025f0c696..61e0c34a0 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -38,6 +38,7 @@ #include "core/hle/service/ldn/ldn.h" #include "core/hle/service/ldr/ldr.h" #include "core/hle/service/lm/lm.h" +#include "core/hle/service/mig/mig.h" #include "core/hle/service/mii/mii.h" #include "core/hle/service/mm/mm_u.h" #include "core/hle/service/ncm/ncm.h" @@ -225,6 +226,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm) { LDN::InstallInterfaces(*sm); LDR::InstallInterfaces(*sm); LM::InstallInterfaces(*sm); + Migration::InstallInterfaces(*sm); Mii::InstallInterfaces(*sm); MM::InstallInterfaces(*sm); NCM::InstallInterfaces(*sm); diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp index 1651f6122..a461e72ec 100644 --- a/src/core/hle/service/set/set.cpp +++ b/src/core/hle/service/set/set.cpp @@ -8,6 +8,7 @@ #include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_session.h" #include "core/hle/service/set/set.h" +#include "core/settings.h" namespace Service::Set { @@ -31,6 +32,10 @@ constexpr std::array<LanguageCode, 17> available_language_codes = {{ LanguageCode::ZH_HANT, }}; +LanguageCode GetLanguageCodeFromIndex(size_t index) { + return available_language_codes.at(index); +} + void SET::GetAvailableLanguageCodes(Kernel::HLERequestContext& ctx) { ctx.WriteBuffer(available_language_codes); @@ -49,9 +54,17 @@ void SET::GetAvailableLanguageCodeCount(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_SET, "called"); } +void SET::GetLanguageCode(Kernel::HLERequestContext& ctx) { + IPC::ResponseBuilder rb{ctx, 4}; + rb.Push(RESULT_SUCCESS); + rb.Push(static_cast<u64>(available_language_codes[Settings::values.language_index])); + + LOG_DEBUG(Service_SET, "called {}", Settings::values.language_index); +} + SET::SET() : ServiceFramework("set") { static const FunctionInfo functions[] = { - {0, nullptr, "GetLanguageCode"}, + {0, &SET::GetLanguageCode, "GetLanguageCode"}, {1, &SET::GetAvailableLanguageCodes, "GetAvailableLanguageCodes"}, {2, nullptr, "MakeLanguageCode"}, {3, &SET::GetAvailableLanguageCodeCount, "GetAvailableLanguageCodeCount"}, diff --git a/src/core/hle/service/set/set.h b/src/core/hle/service/set/set.h index a2472ec4c..4232b6162 100644 --- a/src/core/hle/service/set/set.h +++ b/src/core/hle/service/set/set.h @@ -28,6 +28,7 @@ enum class LanguageCode : u64 { ZH_HANS = 0x00736E61482D687A, ZH_HANT = 0x00746E61482D687A, }; +LanguageCode GetLanguageCodeFromIndex(size_t idx); class SET final : public ServiceFramework<SET> { public: @@ -35,6 +36,7 @@ public: ~SET() = default; private: + void GetLanguageCode(Kernel::HLERequestContext& ctx); void GetAvailableLanguageCodes(Kernel::HLERequestContext& ctx); void GetAvailableLanguageCodeCount(Kernel::HLERequestContext& ctx); }; diff --git a/src/core/settings.h b/src/core/settings.h index 8cc65e434..e826d4235 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -112,6 +112,8 @@ static const std::array<const char*, NumAnalogs> mapping = {{ struct Values { // System bool use_docked_mode; + std::string username; + int language_index; // Controls std::array<std::string, NativeButton::NumButtons> buttons; diff --git a/src/video_core/renderer_opengl/gl_shader_manager.h b/src/video_core/renderer_opengl/gl_shader_manager.h index 2214c348a..716933a0b 100644 --- a/src/video_core/renderer_opengl/gl_shader_manager.h +++ b/src/video_core/renderer_opengl/gl_shader_manager.h @@ -118,7 +118,7 @@ public: return result; } - GLuint GetCurrentProgramStage(Maxwell3D::Regs::ShaderStage stage) { + GLuint GetCurrentProgramStage(Maxwell3D::Regs::ShaderStage stage) const { switch (stage) { case Maxwell3D::Regs::ShaderStage::Vertex: return current.vs; diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index e8b3a9866..9d6454bbd 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -105,6 +105,8 @@ void Config::ReadValues() { qt_config->beginGroup("System"); Settings::values.use_docked_mode = qt_config->value("use_docked_mode", false).toBool(); + Settings::values.username = qt_config->value("username", "yuzu").toString().toStdString(); + Settings::values.language_index = qt_config->value("language_index", 1).toInt(); qt_config->endGroup(); qt_config->beginGroup("Miscellaneous"); @@ -214,6 +216,8 @@ void Config::SaveValues() { qt_config->beginGroup("System"); qt_config->setValue("use_docked_mode", Settings::values.use_docked_mode); + qt_config->setValue("username", QString::fromStdString(Settings::values.username)); + qt_config->setValue("language_index", Settings::values.language_index); qt_config->endGroup(); qt_config->beginGroup("Miscellaneous"); diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index d09505a0f..9be2c939c 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -4,9 +4,10 @@ #include <QMessageBox> #include "core/core.h" +#include "core/settings.h" #include "ui_configure_system.h" #include "yuzu/configuration/configure_system.h" -#include "yuzu/ui_settings.h" +#include "yuzu/main.h" static const std::array<int, 12> days_in_month = {{ 31, @@ -38,6 +39,8 @@ ConfigureSystem::~ConfigureSystem() {} void ConfigureSystem::setConfiguration() { enabled = !Core::System::GetInstance().IsPoweredOn(); + ui->edit_username->setText(QString::fromStdString(Settings::values.username)); + ui->combo_language->setCurrentIndex(Settings::values.language_index); } void ConfigureSystem::ReadSystemSettings() {} @@ -45,6 +48,9 @@ void ConfigureSystem::ReadSystemSettings() {} void ConfigureSystem::applyConfiguration() { if (!enabled) return; + Settings::values.username = ui->edit_username->text().toStdString(); + Settings::values.language_index = ui->combo_language->currentIndex(); + Settings::Apply(); } void ConfigureSystem::updateBirthdayComboBox(int birthmonth_index) { diff --git a/src/yuzu/configuration/configure_system.ui b/src/yuzu/configuration/configure_system.ui index 8caf49623..f3f8db038 100644 --- a/src/yuzu/configuration/configure_system.ui +++ b/src/yuzu/configuration/configure_system.ui @@ -38,7 +38,7 @@ </sizepolicy> </property> <property name="maxLength"> - <number>10</number> + <number>32</number> </property> </widget> </item> @@ -164,7 +164,7 @@ </item> <item> <property name="text"> - <string>Simplified Chinese (简体中文)</string> + <string>Chinese</string> </property> </item> <item> @@ -187,6 +187,31 @@ <string>Russian (Русский)</string> </property> </item> + <item> + <property name="text"> + <string>Taiwanese</string> + </property> + </item> + <item> + <property name="text"> + <string>British English</string> + </property> + </item> + <item> + <property name="text"> + <string>Canadian French</string> + </property> + </item> + <item> + <property name="text"> + <string>Latin American Spanish</string> + </property> + </item> + <item> + <property name="text"> + <string>Simplified Chinese</string> + </property> + </item> <item> <property name="text"> <string>Traditional Chinese (正體中文)</string> diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h index 6553c7814..9a935a0d5 100644 --- a/src/yuzu_cmd/default_ini.h +++ b/src/yuzu_cmd/default_ini.h @@ -164,6 +164,16 @@ use_virtual_sd = # 1: Yes, 0 (default): No use_docked_mode = +# Sets the account username, max length is 32 characters +# yuzu (default) +username = + +# Sets the systems language index +# 0: Japanese, 1: English (default), 2: French, 3: German, 4: Italian, 5: Spanish, 6: Chinese, +# 7: Korean, 8: Dutch, 9: Portuguese, 10: Russian, 11: Taiwanese, 12: British English, 13: Canadian French, +# 14: Latin American Spanish, 15: Simplified Chinese, 16: Traditional Chinese +language_index = + # The system region that yuzu will use during emulation # -1: Auto-select (default), 0: Japan, 1: USA, 2: Europe, 3: Australia, 4: China, 5: Korea, 6: Taiwan region_value = |