Compare commits

..

21 Commits

Author SHA1 Message Date
FearlessTobi
20b20a1086 .ci/transifex: Mark docker.sh as executable 2021-10-16 00:59:18 +02:00
Morph
41b4047536 Merge pull request #7188 from Morph1984/web-applet-include
qt_web_browser: Add missing QApplication include
2021-10-15 18:52:22 -04:00
Feng Chen
de81571289 service/vi: Stub IHOSBinderDriver::TransactParcel GetBufferHistory (#7184) 2021-10-15 18:50:45 -04:00
Morph
2b622411fd qt_web_browser: Add missing QApplication include 2021-10-15 18:48:50 -04:00
Mai M
dc385b7392 Merge pull request #7182 from Morph1984/system
yuzu: Remove all remaining global system instances
2021-10-15 17:57:58 -04:00
Morph
5c6ca597c5 bootmanager: Forward declare System and SystemResultStatus 2021-10-15 17:35:34 -04:00
Morph
f0dc07dbac yuzu: Construct system in GMainWindow 2021-10-15 17:35:33 -04:00
Morph
17763a44d5 core: Move ResultStatus outside of System
Allows it to be a forward declaration in other header files.
2021-10-15 17:34:49 -04:00
Morph
218ebc1fe8 yuzu_cmd: Remove remaining static system instances 2021-10-15 17:34:48 -04:00
Morph
b6719094e6 core: Remove static system instance 2021-10-15 17:34:48 -04:00
Mai M
2a5014b193 Merge pull request #7183 from FearlessTobi/translation-ci
.ci: Use Github Actions to update translation source files
2021-10-15 17:06:01 -04:00
Mai M
764369f4c7 Merge pull request #7172 from Morph1984/out-of-bounds
string_util: Prevent out of bounds access in u16string_view buffer
2021-10-15 17:04:44 -04:00
Mai M
d5c4af2d5b Merge pull request #7174 from MightyCreak/hide-cursor-by-default
Check "Hide mouse on inactivity" by default
2021-10-15 17:03:10 -04:00
Mai M
5b7b7276d5 Merge pull request #7185 from Morph1984/make_unique_ui
yuzu: Use make_unique instead of operator new for constructing ui
2021-10-15 16:58:45 -04:00
Romain Failliot
ecef109162 Hide mouse cursor by default 2021-10-15 16:01:20 -04:00
Creak
bad122b195 main: Slightly refactor NCA entry installation in InstallNCA (#7181)
* main: Slightly refactor NCA entry installation in InstallNCA

Co-authored-by: Ameer J <52414509+ameerj@users.noreply.github.com>
2021-10-15 15:57:25 -04:00
Morph
86908d569e main: Use std::unique_ptr for ui 2021-10-15 15:35:59 -04:00
Morph
ab441fb009 configuration: Use std::make_unique instead of operator new for ui 2021-10-15 15:26:32 -04:00
FearlessTobi
07b82427ab .ci: Use Github Actions to update translation source files 2021-10-15 15:12:14 +02:00
Morph
0d6057b2fa string_util: Make use of std::string_view and add bounds checking
Makes use of std::string_view in StringFromFixedZeroTerminatedBuffer and add bounds checking
2021-10-14 14:09:34 -04:00
Morph
3ffff78a27 string_util: Prevent out of bounds access in u16string_view buffer 2021-10-14 14:09:34 -04:00
27 changed files with 396 additions and 352 deletions

25
.ci/scripts/transifex/docker.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/bash -e
# Setup RC file for tx
cat << EOF > ~/.transifexrc
[https://www.transifex.com]
hostname = https://www.transifex.com
username = api
password = $TRANSIFEX_API_TOKEN
EOF
set -x
echo -e "\e[1m\e[33mBuild tools information:\e[0m"
cmake --version
gcc -v
tx --version
mkdir build && cd build
cmake .. -DENABLE_QT_TRANSLATION=ON -DGENERATE_QT_TRANSLATION=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_SDL2=OFF
make translation
cd ..
cd dist/languages
tx push -s

23
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: yuzu-ci
on:
push:
branches: [ master ]
tags: [ "*" ]
pull_request:
branches: [ master ]
jobs:
transifex:
runs-on: ubuntu-latest
container: yuzuemu/build-environments:linux-transifex
if: ${{ github.repository == 'yuzu-emu/yuzu' && !github.head_ref }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- name: Update Translation
run: ./.ci/scripts/transifex/docker.sh
env:
TRANSIFEX_API_TOKEN: ${{ secrets.TRANSIFEX_API_TOKEN }}

View File

@@ -180,20 +180,20 @@ std::wstring UTF8ToUTF16W(const std::string& input) {
#endif
std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, std::size_t max_len) {
std::string StringFromFixedZeroTerminatedBuffer(std::string_view buffer, std::size_t max_len) {
std::size_t len = 0;
while (len < max_len && buffer[len] != '\0')
while (len < buffer.length() && len < max_len && buffer[len] != '\0') {
++len;
return std::string(buffer, len);
}
return std::string(buffer.begin(), buffer.begin() + len);
}
std::u16string UTF16StringFromFixedZeroTerminatedBuffer(std::u16string_view buffer,
std::size_t max_len) {
std::size_t len = 0;
while (len < max_len && buffer[len] != '\0')
while (len < buffer.length() && len < max_len && buffer[len] != '\0') {
++len;
}
return std::u16string(buffer.begin(), buffer.begin() + len);
}

View File

@@ -63,7 +63,7 @@ template <typename InIt>
* Creates a std::string from a fixed-size NUL-terminated char buffer. If the buffer isn't
* NUL-terminated then the string ends at max_len characters.
*/
[[nodiscard]] std::string StringFromFixedZeroTerminatedBuffer(const char* buffer,
[[nodiscard]] std::string StringFromFixedZeroTerminatedBuffer(std::string_view buffer,
std::size_t max_len);
/**

View File

@@ -139,8 +139,8 @@ struct System::Impl {
: kernel{system}, fs_controller{system}, memory{system},
cpu_manager{system}, reporter{system}, applet_manager{system}, time_manager{system} {}
ResultStatus Run() {
status = ResultStatus::Success;
SystemResultStatus Run() {
status = SystemResultStatus::Success;
kernel.Suspend(false);
core_timing.SyncPause(false);
@@ -149,8 +149,8 @@ struct System::Impl {
return status;
}
ResultStatus Pause() {
status = ResultStatus::Success;
SystemResultStatus Pause() {
status = SystemResultStatus::Success;
core_timing.SyncPause(true);
kernel.Suspend(true);
@@ -159,7 +159,7 @@ struct System::Impl {
return status;
}
ResultStatus Init(System& system, Frontend::EmuWindow& emu_window) {
SystemResultStatus Init(System& system, Frontend::EmuWindow& emu_window) {
LOG_DEBUG(Core, "initialized OK");
device_memory = std::make_unique<Core::DeviceMemory>();
@@ -197,7 +197,7 @@ struct System::Impl {
gpu_core = VideoCore::CreateGPU(emu_window, system);
if (!gpu_core) {
return ResultStatus::ErrorVideoCore;
return SystemResultStatus::ErrorVideoCore;
}
service_manager = std::make_shared<Service::SM::ServiceManager>(kernel);
@@ -217,21 +217,22 @@ struct System::Impl {
LOG_DEBUG(Core, "Initialized OK");
return ResultStatus::Success;
return SystemResultStatus::Success;
}
ResultStatus Load(System& system, Frontend::EmuWindow& emu_window, const std::string& filepath,
u64 program_id, std::size_t program_index) {
SystemResultStatus Load(System& system, Frontend::EmuWindow& emu_window,
const std::string& filepath, u64 program_id,
std::size_t program_index) {
app_loader = Loader::GetLoader(system, GetGameFileFromPath(virtual_filesystem, filepath),
program_id, program_index);
if (!app_loader) {
LOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath);
return ResultStatus::ErrorGetLoader;
return SystemResultStatus::ErrorGetLoader;
}
ResultStatus init_result{Init(system, emu_window)};
if (init_result != ResultStatus::Success) {
SystemResultStatus init_result{Init(system, emu_window)};
if (init_result != SystemResultStatus::Success) {
LOG_CRITICAL(Core, "Failed to initialize system (Error {})!",
static_cast<int>(init_result));
Shutdown();
@@ -249,8 +250,8 @@ struct System::Impl {
LOG_CRITICAL(Core, "Failed to load ROM (Error {})!", load_result);
Shutdown();
return static_cast<ResultStatus>(static_cast<u32>(ResultStatus::ErrorLoader) +
static_cast<u32>(load_result));
return static_cast<SystemResultStatus>(
static_cast<u32>(SystemResultStatus::ErrorLoader) + static_cast<u32>(load_result));
}
AddGlueRegistrationForProcess(*app_loader, *main_process);
kernel.MakeCurrentProcess(main_process.get());
@@ -282,7 +283,7 @@ struct System::Impl {
GetAndResetPerfStats();
perf_stats->BeginSystemFrame();
status = ResultStatus::Success;
status = SystemResultStatus::Success;
return status;
}
@@ -355,7 +356,7 @@ struct System::Impl {
arp_manager.Register(launch.title_id, launch, std::move(nacp_data));
}
void SetStatus(ResultStatus new_status, const char* details = nullptr) {
void SetStatus(SystemResultStatus new_status, const char* details = nullptr) {
status = new_status;
if (details) {
status_details = details;
@@ -411,7 +412,7 @@ struct System::Impl {
/// Network instance
Network::NetworkInstance network_instance;
ResultStatus status = ResultStatus::Success;
SystemResultStatus status = SystemResultStatus::Success;
std::string status_details = "";
std::unique_ptr<Core::PerfStats> perf_stats;
@@ -428,22 +429,9 @@ struct System::Impl {
};
System::System() : impl{std::make_unique<Impl>(*this)} {}
System::~System() = default;
System& System::GetInstance() {
if (!s_instance) {
throw std::runtime_error("Using System instance before its initialization");
}
return *s_instance;
}
void System::InitializeGlobalInstance() {
if (s_instance) {
throw std::runtime_error("Reinitializing Global System instance.");
}
s_instance = std::unique_ptr<System>(new System);
}
CpuManager& System::GetCpuManager() {
return impl->cpu_manager;
}
@@ -452,16 +440,16 @@ const CpuManager& System::GetCpuManager() const {
return impl->cpu_manager;
}
System::ResultStatus System::Run() {
SystemResultStatus System::Run() {
return impl->Run();
}
System::ResultStatus System::Pause() {
SystemResultStatus System::Pause() {
return impl->Pause();
}
System::ResultStatus System::SingleStep() {
return ResultStatus::Success;
SystemResultStatus System::SingleStep() {
return SystemResultStatus::Success;
}
void System::InvalidateCpuInstructionCaches() {
@@ -476,8 +464,8 @@ void System::Shutdown() {
impl->Shutdown();
}
System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath,
u64 program_id, std::size_t program_index) {
SystemResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath,
u64 program_id, std::size_t program_index) {
return impl->Load(*this, emu_window, filepath, program_id, program_index);
}
@@ -637,7 +625,7 @@ Loader::ResultStatus System::GetGameName(std::string& out) const {
return impl->GetGameName(out);
}
void System::SetStatus(ResultStatus new_status, const char* details) {
void System::SetStatus(SystemResultStatus new_status, const char* details) {
impl->SetStatus(new_status, details);
}

View File

@@ -104,55 +104,49 @@ struct PerfStatsResults;
FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs,
const std::string& path);
/// Enumeration representing the return values of the System Initialize and Load process.
enum class SystemResultStatus : u32 {
Success, ///< Succeeded
ErrorNotInitialized, ///< Error trying to use core prior to initialization
ErrorGetLoader, ///< Error finding the correct application loader
ErrorSystemFiles, ///< Error in finding system files
ErrorSharedFont, ///< Error in finding shared font
ErrorVideoCore, ///< Error in the video core
ErrorUnknown, ///< Any other error
ErrorLoader, ///< The base for loader errors (too many to repeat)
};
class System {
public:
using CurrentBuildProcessID = std::array<u8, 0x20>;
explicit System();
~System();
System(const System&) = delete;
System& operator=(const System&) = delete;
System(System&&) = delete;
System& operator=(System&&) = delete;
~System();
/**
* Gets the instance of the System singleton class.
* @returns Reference to the instance of the System singleton class.
*/
[[deprecated("Use of the global system instance is deprecated")]] static System& GetInstance();
static void InitializeGlobalInstance();
/// Enumeration representing the return values of the System Initialize and Load process.
enum class ResultStatus : u32 {
Success, ///< Succeeded
ErrorNotInitialized, ///< Error trying to use core prior to initialization
ErrorGetLoader, ///< Error finding the correct application loader
ErrorSystemFiles, ///< Error in finding system files
ErrorSharedFont, ///< Error in finding shared font
ErrorVideoCore, ///< Error in the video core
ErrorUnknown, ///< Any other error
ErrorLoader, ///< The base for loader errors (too many to repeat)
};
/**
* Run the OS and Application
* This function will start emulation and run the relevant devices
*/
[[nodiscard]] ResultStatus Run();
[[nodiscard]] SystemResultStatus Run();
/**
* Pause the OS and Application
* This function will pause emulation and stop the relevant devices
*/
[[nodiscard]] ResultStatus Pause();
[[nodiscard]] SystemResultStatus Pause();
/**
* Step the CPU one instruction
* @return Result status, indicating whether or not the operation succeeded.
*/
[[nodiscard]] ResultStatus SingleStep();
[[nodiscard]] SystemResultStatus SingleStep();
/**
* Invalidate the CPU instruction caches
@@ -172,10 +166,11 @@ public:
* input.
* @param filepath String path to the executable application to load on the host file system.
* @param program_index Specifies the index within the container of the program to launch.
* @returns ResultStatus code, indicating if the operation succeeded.
* @returns SystemResultStatus code, indicating if the operation succeeded.
*/
[[nodiscard]] ResultStatus Load(Frontend::EmuWindow& emu_window, const std::string& filepath,
u64 program_id = 0, std::size_t program_index = 0);
[[nodiscard]] SystemResultStatus Load(Frontend::EmuWindow& emu_window,
const std::string& filepath, u64 program_id = 0,
std::size_t program_index = 0);
/**
* Indicates if the emulated system is powered on (all subsystems initialized and able to run an
@@ -301,7 +296,7 @@ public:
/// Gets the name of the current game
[[nodiscard]] Loader::ResultStatus GetGameName(std::string& out) const;
void SetStatus(ResultStatus new_status, const char* details);
void SetStatus(SystemResultStatus new_status, const char* details);
[[nodiscard]] const std::string& GetStatusDetails() const;
@@ -403,12 +398,8 @@ public:
void ApplySettings();
private:
System();
struct Impl;
std::unique_ptr<Impl> impl;
inline static std::unique_ptr<System> s_instance{};
};
} // namespace Core

View File

@@ -524,7 +524,9 @@ private:
Disconnect = 11,
AllocateBuffers = 13,
SetPreallocatedBuffer = 14
SetPreallocatedBuffer = 14,
GetBufferHistory = 17
};
void TransactParcel(Kernel::HLERequestContext& ctx) {
@@ -641,6 +643,14 @@ private:
ctx.WriteBuffer(response.Serialize());
break;
}
case TransactionId::GetBufferHistory: {
LOG_WARNING(Service_VI, "(STUBBED) called, transaction=GetBufferHistory");
[[maybe_unused]] const auto buffer = ctx.ReadBuffer();
IGBPEmptyResponseParcel response{};
ctx.WriteBuffer(response.Serialize());
break;
}
default:
ASSERT_MSG(false, "Unimplemented");
}

View File

@@ -8,7 +8,8 @@
#include "ui_aboutdialog.h"
#include "yuzu/about_dialog.h"
AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDialog) {
AboutDialog::AboutDialog(QWidget* parent)
: QDialog(parent), ui{std::make_unique<Ui::AboutDialog>()} {
const auto branch_name = std::string(Common::g_scm_branch);
const auto description = std::string(Common::g_scm_desc);
const auto build_id = std::string(Common::g_build_id);

View File

@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#ifdef YUZU_USE_QT_WEB_ENGINE
#include <QApplication>
#include <QKeyEvent>
#include <QWebEngineProfile>

View File

@@ -86,15 +86,15 @@ void EmuThread::run() {
}
running_guard = true;
Core::System::ResultStatus result = system.Run();
if (result != Core::System::ResultStatus::Success) {
Core::SystemResultStatus result = system.Run();
if (result != Core::SystemResultStatus::Success) {
running_guard = false;
this->SetRunning(false);
emit ErrorThrown(result, system.GetStatusDetails());
}
running_wait.Wait();
result = system.Pause();
if (result != Core::System::ResultStatus::Success) {
if (result != Core::SystemResultStatus::Success) {
running_guard = false;
this->SetRunning(false);
emit ErrorThrown(result, system.GetStatusDetails());

View File

@@ -16,7 +16,6 @@
#include <QWindow>
#include "common/thread.h"
#include "core/core.h"
#include "core/frontend/emu_window.h"
class GRenderWindow;
@@ -24,6 +23,11 @@ class GMainWindow;
class QKeyEvent;
class QStringList;
namespace Core {
enum class SystemResultStatus : u32;
class System;
} // namespace Core
namespace InputCommon {
class InputSubsystem;
}
@@ -123,7 +127,7 @@ signals:
*/
void DebugModeLeft();
void ErrorThrown(Core::System::ResultStatus, std::string);
void ErrorThrown(Core::SystemResultStatus, std::string);
void LoadProgress(VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total);
};

View File

@@ -14,7 +14,7 @@
#include "yuzu/configuration/configure_cpu.h"
ConfigureCpu::ConfigureCpu(const Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigureCpu), system{system_} {
: QWidget(parent), ui{std::make_unique<Ui::ConfigureCpu>()}, system{system_} {
ui->setupUi(this);
SetupPerGameUI();

View File

@@ -12,7 +12,7 @@
#include "yuzu/configuration/configure_cpu_debug.h"
ConfigureCpuDebug::ConfigureCpuDebug(const Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigureCpuDebug), system{system_} {
: QWidget(parent), ui{std::make_unique<Ui::ConfigureCpuDebug>()}, system{system_} {
ui->setupUi(this);
SetConfiguration();

View File

@@ -15,7 +15,7 @@
#include "yuzu/uisettings.h"
ConfigureDebug::ConfigureDebug(const Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigureDebug), system{system_} {
: QWidget(parent), ui{std::make_unique<Ui::ConfigureDebug>()}, system{system_} {
ui->setupUi(this);
SetConfiguration();

View File

@@ -9,8 +9,8 @@
#include "yuzu/configuration/configure_debug_tab.h"
ConfigureDebugTab::ConfigureDebugTab(const Core::System& system_, QWidget* parent)
: QWidget(parent),
ui(new Ui::ConfigureDebugTab), debug_tab{std::make_unique<ConfigureDebug>(system_, this)},
: QWidget(parent), ui{std::make_unique<Ui::ConfigureDebugTab>()},
debug_tab{std::make_unique<ConfigureDebug>(system_, this)},
cpu_debug_tab{std::make_unique<ConfigureCpuDebug>(system_, this)} {
ui->setupUi(this);

View File

@@ -36,7 +36,7 @@
ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry,
InputCommon::InputSubsystem* input_subsystem,
Core::System& system_)
: QDialog(parent), ui(new Ui::ConfigureDialog),
: QDialog(parent), ui{std::make_unique<Ui::ConfigureDialog>()},
registry(registry), system{system_}, audio_tab{std::make_unique<ConfigureAudio>(system_,
this)},
cpu_tab{std::make_unique<ConfigureCpu>(system_, this)},
@@ -81,11 +81,8 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry,
SetConfiguration();
PopulateSelectionList();
connect(ui->tabWidget, &QTabWidget::currentChanged, this, [this](int index) {
if (index != -1) {
debug_tab_tab->SetCurrentIndex(0);
}
});
connect(ui->tabWidget, &QTabWidget::currentChanged, this,
[this]() { debug_tab_tab->SetCurrentIndex(0); });
connect(ui_tab.get(), &ConfigureUi::LanguageChanged, this, &ConfigureDialog::OnLanguageChanged);
connect(ui->selectorList, &QListWidget::itemSelectionChanged, this,
&ConfigureDialog::UpdateVisibleTabs);

View File

@@ -16,7 +16,7 @@
#include "yuzu/uisettings.h"
ConfigureGeneral::ConfigureGeneral(const Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigureGeneral), system{system_} {
: QWidget(parent), ui{std::make_unique<Ui::ConfigureGeneral>()}, system{system_} {
ui->setupUi(this);
SetupPerGameUI();

View File

@@ -20,7 +20,7 @@
#include "yuzu/configuration/configure_graphics.h"
ConfigureGraphics::ConfigureGraphics(const Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigureGraphics), system{system_} {
: QWidget(parent), ui{std::make_unique<Ui::ConfigureGraphics>()}, system{system_} {
vulkan_device = Settings::values.vulkan_device.GetValue();
RetrieveVulkanDevices();

View File

@@ -9,7 +9,7 @@
#include "yuzu/configuration/configure_graphics_advanced.h"
ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced(const Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigureGraphicsAdvanced), system{system_} {
: QWidget(parent), ui{std::make_unique<Ui::ConfigureGraphicsAdvanced>()}, system{system_} {
ui->setupUi(this);

View File

@@ -27,7 +27,7 @@
#include "yuzu/util/util.h"
ConfigurePerGameAddons::ConfigurePerGameAddons(Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigurePerGameAddons), system{system_} {
: QWidget(parent), ui{std::make_unique<Ui::ConfigurePerGameAddons>()}, system{system_} {
ui->setupUi(this);
layout = new QVBoxLayout;

View File

@@ -77,7 +77,7 @@ QString GetProfileUsernameFromUser(QWidget* parent, const QString& description_t
} // Anonymous namespace
ConfigureProfileManager::ConfigureProfileManager(const Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigureProfileManager),
: QWidget(parent), ui{std::make_unique<Ui::ConfigureProfileManager>()},
profile_manager(std::make_unique<Service::Account::ProfileManager>()), system{system_} {
ui->setupUi(this);

View File

@@ -18,7 +18,7 @@
#include "yuzu/configuration/configure_system.h"
ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigureSystem), system{system_} {
: QWidget(parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_} {
ui->setupUi(this);
connect(ui->button_regenerate_console_id, &QPushButton::clicked, this,
&ConfigureSystem::RefreshConsoleID);

View File

@@ -55,7 +55,7 @@ QString GetTranslatedRowTextName(size_t index) {
} // Anonymous namespace
ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent)
: QWidget(parent), ui(new Ui::ConfigureUi), system{system_} {
: QWidget(parent), ui{std::make_unique<Ui::ConfigureUi>()}, system{system_} {
ui->setupUi(this);
InitializeLanguageComboBox();

File diff suppressed because it is too large Load Diff

View File

@@ -13,9 +13,7 @@
#include <QTranslator>
#include "common/common_types.h"
#include "core/core.h"
#include "core/hle/service/acc/profile_manager.h"
#include "ui_main.h"
#include "yuzu/compatibility_list.h"
#include "yuzu/hotkeys.h"
@@ -45,6 +43,11 @@ enum class StartGameType {
Global, // Only uses global configuration
};
namespace Core {
enum class SystemResultStatus : u32;
class System;
} // namespace Core
namespace Core::Frontend {
struct ControllerParameters;
struct InlineAppearParameters;
@@ -73,6 +76,10 @@ enum class SwkbdReplyType : u32;
enum class WebExitReason : u32;
} // namespace Service::AM::Applets
namespace Ui {
class MainWindow;
}
enum class EmulatedDirectoryTarget {
NAND,
SDMC,
@@ -107,7 +114,7 @@ class GMainWindow : public QMainWindow {
public:
void filterBarSetChecked(bool state);
void UpdateUITheme();
GMainWindow(Core::System& system_);
explicit GMainWindow();
~GMainWindow() override;
bool DropAction(QDropEvent* event);
@@ -277,7 +284,7 @@ private slots:
void ResetWindowSize900();
void ResetWindowSize1080();
void OnCaptureScreenshot();
void OnCoreError(Core::System::ResultStatus, std::string);
void OnCoreError(Core::SystemResultStatus, std::string);
void OnReinitializeKeys(ReinitializeKeyBehavior behavior);
void OnLanguageChanged(const QString& locale);
void OnMouseActivity();
@@ -306,13 +313,12 @@ private:
void OpenPerGameConfiguration(u64 title_id, const std::string& file_name);
QString GetTasStateDescription() const;
Ui::MainWindow ui;
std::unique_ptr<Ui::MainWindow> ui;
std::unique_ptr<Core::System> system;
std::unique_ptr<DiscordRPC::DiscordInterface> discord_rpc;
std::shared_ptr<InputCommon::InputSubsystem> input_subsystem;
Core::System& system;
GRenderWindow* render_window;
GameList* game_list;
LoadingScreen* loading_screen;

View File

@@ -60,7 +60,7 @@ struct Values {
Settings::BasicSetting<bool> confirm_before_closing{true, "confirmClose"};
Settings::BasicSetting<bool> first_start{true, "firstStart"};
Settings::BasicSetting<bool> pause_when_in_background{false, "pauseWhenInBackground"};
Settings::BasicSetting<bool> hide_mouse{false, "hideInactiveMouse"};
Settings::BasicSetting<bool> hide_mouse{true, "hideInactiveMouse"};
Settings::BasicSetting<bool> select_user_on_boot{false, "select_user_on_boot"};

View File

@@ -146,9 +146,8 @@ int main(int argc, char** argv) {
return -1;
}
Core::System::InitializeGlobalInstance();
auto& system{Core::System::GetInstance()};
InputCommon::InputSubsystem input_subsystem;
Core::System system{};
InputCommon::InputSubsystem input_subsystem{};
// Apply the command line arguments
system.ApplySettings();
@@ -167,27 +166,27 @@ int main(int argc, char** argv) {
system.SetFilesystem(std::make_shared<FileSys::RealVfsFilesystem>());
system.GetFileSystemController().CreateFactories(*system.GetFilesystem());
const Core::System::ResultStatus load_result{system.Load(*emu_window, filepath)};
const Core::SystemResultStatus load_result{system.Load(*emu_window, filepath)};
switch (load_result) {
case Core::System::ResultStatus::ErrorGetLoader:
case Core::SystemResultStatus::ErrorGetLoader:
LOG_CRITICAL(Frontend, "Failed to obtain loader for {}!", filepath);
return -1;
case Core::System::ResultStatus::ErrorLoader:
case Core::SystemResultStatus::ErrorLoader:
LOG_CRITICAL(Frontend, "Failed to load ROM!");
return -1;
case Core::System::ResultStatus::ErrorNotInitialized:
case Core::SystemResultStatus::ErrorNotInitialized:
LOG_CRITICAL(Frontend, "CPUCore not initialized");
return -1;
case Core::System::ResultStatus::ErrorVideoCore:
case Core::SystemResultStatus::ErrorVideoCore:
LOG_CRITICAL(Frontend, "Failed to initialize VideoCore!");
return -1;
case Core::System::ResultStatus::Success:
case Core::SystemResultStatus::Success:
break; // Expected case
default:
if (static_cast<u32>(load_result) >
static_cast<u32>(Core::System::ResultStatus::ErrorLoader)) {
const u16 loader_id = static_cast<u16>(Core::System::ResultStatus::ErrorLoader);
static_cast<u32>(Core::SystemResultStatus::ErrorLoader)) {
const u16 loader_id = static_cast<u16>(Core::SystemResultStatus::ErrorLoader);
const u16 error_id = static_cast<u16>(load_result) - loader_id;
LOG_CRITICAL(Frontend,
"While attempting to load the ROM requested, an error occurred. Please "