Compare commits
4 Commits
__refs_pul
...
__refs_pul
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49f6deecb8 | ||
|
|
f09d192aac | ||
|
|
9971cd1d55 | ||
|
|
c4f5615c6b |
@@ -210,7 +210,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
||||
# =======================================================================
|
||||
|
||||
# Enforce the search mode of non-required packages for better and shorter failure messages
|
||||
find_package(Boost 1.81.0 REQUIRED context)
|
||||
find_package(Boost 1.79.0 REQUIRED context)
|
||||
find_package(enet 1.3 MODULE)
|
||||
find_package(fmt 9 REQUIRED)
|
||||
find_package(inih 52 MODULE COMPONENTS INIReader)
|
||||
|
||||
@@ -38,6 +38,7 @@ add_library(common STATIC
|
||||
common_precompiled_headers.h
|
||||
common_types.h
|
||||
concepts.h
|
||||
container_hash.h
|
||||
demangle.cpp
|
||||
demangle.h
|
||||
div_ceil.h
|
||||
|
||||
91
src/common/container_hash.h
Normal file
91
src/common/container_hash.h
Normal file
@@ -0,0 +1,91 @@
|
||||
// SPDX-FileCopyrightText: 2005-2014 Daniel James
|
||||
// SPDX-FileCopyrightText: 2016 Austin Appleby
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
namespace Common {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename T>
|
||||
requires std::is_unsigned_v<T>
|
||||
inline std::size_t HashValue(T val) {
|
||||
const unsigned int size_t_bits = std::numeric_limits<std::size_t>::digits;
|
||||
const unsigned int length =
|
||||
(std::numeric_limits<T>::digits - 1) / static_cast<unsigned int>(size_t_bits);
|
||||
|
||||
std::size_t seed = 0;
|
||||
|
||||
for (unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits) {
|
||||
seed ^= static_cast<size_t>(val >> i) + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
|
||||
seed ^= static_cast<size_t>(val) + (seed << 6) + (seed >> 2);
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
||||
template <size_t Bits>
|
||||
struct HashCombineImpl {
|
||||
template <typename T>
|
||||
static inline T fn(T seed, T value) {
|
||||
seed ^= value + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
return seed;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct HashCombineImpl<64> {
|
||||
static inline std::uint64_t fn(std::uint64_t h, std::uint64_t k) {
|
||||
const std::uint64_t m = (std::uint64_t(0xc6a4a793) << 32) + 0x5bd1e995;
|
||||
const int r = 47;
|
||||
|
||||
k *= m;
|
||||
k ^= k >> r;
|
||||
k *= m;
|
||||
|
||||
h ^= k;
|
||||
h *= m;
|
||||
|
||||
// Completely arbitrary number, to prevent 0's
|
||||
// from hashing to 0.
|
||||
h += 0xe6546b64;
|
||||
|
||||
return h;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename T>
|
||||
inline void HashCombine(std::size_t& seed, const T& v) {
|
||||
seed = detail::HashCombineImpl<sizeof(std::size_t) * CHAR_BIT>::fn(seed, detail::HashValue(v));
|
||||
}
|
||||
|
||||
template <typename It>
|
||||
inline std::size_t HashRange(It first, It last) {
|
||||
std::size_t seed = 0;
|
||||
|
||||
for (; first != last; ++first) {
|
||||
HashCombine<typename std::iterator_traits<It>::value_type>(seed, *first);
|
||||
}
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
||||
template <typename T, size_t Size>
|
||||
std::size_t HashValue(const std::array<T, Size>& v) {
|
||||
return HashRange(v.cbegin(), v.cend());
|
||||
}
|
||||
|
||||
template <typename T, typename Allocator>
|
||||
std::size_t HashValue(const std::vector<T, Allocator>& v) {
|
||||
return HashRange(v.cbegin(), v.cend());
|
||||
}
|
||||
|
||||
} // namespace Common
|
||||
@@ -1,14 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Core::Frontend {
|
||||
|
||||
class Applet {
|
||||
public:
|
||||
virtual ~Applet() = default;
|
||||
virtual void Close() const = 0;
|
||||
};
|
||||
|
||||
} // namespace Core::Frontend
|
||||
@@ -10,8 +10,6 @@ namespace Core::Frontend {
|
||||
|
||||
CabinetApplet::~CabinetApplet() = default;
|
||||
|
||||
void DefaultCabinetApplet::Close() const {}
|
||||
|
||||
void DefaultCabinetApplet::ShowCabinetApplet(
|
||||
const CabinetCallback& callback, const CabinetParameters& parameters,
|
||||
std::shared_ptr<Service::NFP::NfpDevice> nfp_device) const {
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include "core/frontend/applets/applet.h"
|
||||
#include "core/hle/service/nfp/nfp_types.h"
|
||||
|
||||
namespace Service::NFP {
|
||||
@@ -21,7 +20,7 @@ struct CabinetParameters {
|
||||
|
||||
using CabinetCallback = std::function<void(bool, const std::string&)>;
|
||||
|
||||
class CabinetApplet : public Applet {
|
||||
class CabinetApplet {
|
||||
public:
|
||||
virtual ~CabinetApplet();
|
||||
virtual void ShowCabinetApplet(const CabinetCallback& callback,
|
||||
@@ -31,7 +30,6 @@ public:
|
||||
|
||||
class DefaultCabinetApplet final : public CabinetApplet {
|
||||
public:
|
||||
void Close() const override;
|
||||
void ShowCabinetApplet(const CabinetCallback& callback, const CabinetParameters& parameters,
|
||||
std::shared_ptr<Service::NFP::NfpDevice> nfp_device) const override;
|
||||
};
|
||||
|
||||
@@ -16,8 +16,6 @@ DefaultControllerApplet::DefaultControllerApplet(HID::HIDCore& hid_core_) : hid_
|
||||
|
||||
DefaultControllerApplet::~DefaultControllerApplet() = default;
|
||||
|
||||
void DefaultControllerApplet::Close() const {}
|
||||
|
||||
void DefaultControllerApplet::ReconfigureControllers(ReconfigureCallback callback,
|
||||
const ControllerParameters& parameters) const {
|
||||
LOG_INFO(Service_HID, "called, deducing the best configuration based on the given parameters!");
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "core/frontend/applets/applet.h"
|
||||
|
||||
namespace Core::HID {
|
||||
class HIDCore;
|
||||
@@ -35,7 +34,7 @@ struct ControllerParameters {
|
||||
bool allow_gamecube_controller{};
|
||||
};
|
||||
|
||||
class ControllerApplet : public Applet {
|
||||
class ControllerApplet {
|
||||
public:
|
||||
using ReconfigureCallback = std::function<void()>;
|
||||
|
||||
@@ -50,7 +49,6 @@ public:
|
||||
explicit DefaultControllerApplet(HID::HIDCore& hid_core_);
|
||||
~DefaultControllerApplet() override;
|
||||
|
||||
void Close() const override;
|
||||
void ReconfigureControllers(ReconfigureCallback callback,
|
||||
const ControllerParameters& parameters) const override;
|
||||
|
||||
|
||||
@@ -8,8 +8,6 @@ namespace Core::Frontend {
|
||||
|
||||
ErrorApplet::~ErrorApplet() = default;
|
||||
|
||||
void DefaultErrorApplet::Close() const {}
|
||||
|
||||
void DefaultErrorApplet::ShowError(Result error, FinishedCallback finished) const {
|
||||
LOG_CRITICAL(Service_Fatal, "Application requested error display: {:04}-{:04} (raw={:08X})",
|
||||
error.module.Value(), error.description.Value(), error.raw);
|
||||
|
||||
@@ -6,12 +6,11 @@
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
|
||||
#include "core/frontend/applets/applet.h"
|
||||
#include "core/hle/result.h"
|
||||
|
||||
namespace Core::Frontend {
|
||||
|
||||
class ErrorApplet : public Applet {
|
||||
class ErrorApplet {
|
||||
public:
|
||||
using FinishedCallback = std::function<void()>;
|
||||
|
||||
@@ -29,7 +28,6 @@ public:
|
||||
|
||||
class DefaultErrorApplet final : public ErrorApplet {
|
||||
public:
|
||||
void Close() const override;
|
||||
void ShowError(Result error, FinishedCallback finished) const override;
|
||||
void ShowErrorWithTimestamp(Result error, std::chrono::seconds time,
|
||||
FinishedCallback finished) const override;
|
||||
|
||||
@@ -10,8 +10,6 @@ ParentalControlsApplet::~ParentalControlsApplet() = default;
|
||||
|
||||
DefaultParentalControlsApplet::~DefaultParentalControlsApplet() = default;
|
||||
|
||||
void DefaultParentalControlsApplet::Close() const {}
|
||||
|
||||
void DefaultParentalControlsApplet::VerifyPIN(std::function<void(bool)> finished,
|
||||
bool suspend_future_verification_temporarily) {
|
||||
LOG_INFO(Service_AM,
|
||||
@@ -41,8 +39,6 @@ PhotoViewerApplet::~PhotoViewerApplet() = default;
|
||||
|
||||
DefaultPhotoViewerApplet::~DefaultPhotoViewerApplet() = default;
|
||||
|
||||
void DefaultPhotoViewerApplet::Close() const {}
|
||||
|
||||
void DefaultPhotoViewerApplet::ShowPhotosForApplication(u64 title_id,
|
||||
std::function<void()> finished) const {
|
||||
LOG_INFO(Service_AM,
|
||||
|
||||
@@ -6,11 +6,9 @@
|
||||
#include <functional>
|
||||
#include "common/common_types.h"
|
||||
|
||||
#include "core/frontend/applets/applet.h"
|
||||
|
||||
namespace Core::Frontend {
|
||||
|
||||
class ParentalControlsApplet : public Applet {
|
||||
class ParentalControlsApplet {
|
||||
public:
|
||||
virtual ~ParentalControlsApplet();
|
||||
|
||||
@@ -35,7 +33,6 @@ class DefaultParentalControlsApplet final : public ParentalControlsApplet {
|
||||
public:
|
||||
~DefaultParentalControlsApplet() override;
|
||||
|
||||
void Close() const override;
|
||||
void VerifyPIN(std::function<void(bool)> finished,
|
||||
bool suspend_future_verification_temporarily) override;
|
||||
void VerifyPINForSettings(std::function<void(bool)> finished) override;
|
||||
@@ -43,7 +40,7 @@ public:
|
||||
void ChangePIN(std::function<void()> finished) override;
|
||||
};
|
||||
|
||||
class PhotoViewerApplet : public Applet {
|
||||
class PhotoViewerApplet {
|
||||
public:
|
||||
virtual ~PhotoViewerApplet();
|
||||
|
||||
@@ -55,7 +52,6 @@ class DefaultPhotoViewerApplet final : public PhotoViewerApplet {
|
||||
public:
|
||||
~DefaultPhotoViewerApplet() override;
|
||||
|
||||
void Close() const override;
|
||||
void ShowPhotosForApplication(u64 title_id, std::function<void()> finished) const override;
|
||||
void ShowAllPhotos(std::function<void()> finished) const override;
|
||||
};
|
||||
|
||||
@@ -8,8 +8,6 @@ namespace Core::Frontend {
|
||||
|
||||
MiiEditApplet::~MiiEditApplet() = default;
|
||||
|
||||
void DefaultMiiEditApplet::Close() const {}
|
||||
|
||||
void DefaultMiiEditApplet::ShowMiiEdit(const MiiEditCallback& callback) const {
|
||||
LOG_WARNING(Service_AM, "(STUBBED) called");
|
||||
|
||||
|
||||
@@ -5,11 +5,9 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "core/frontend/applets/applet.h"
|
||||
|
||||
namespace Core::Frontend {
|
||||
|
||||
class MiiEditApplet : public Applet {
|
||||
class MiiEditApplet {
|
||||
public:
|
||||
using MiiEditCallback = std::function<void()>;
|
||||
|
||||
@@ -20,7 +18,6 @@ public:
|
||||
|
||||
class DefaultMiiEditApplet final : public MiiEditApplet {
|
||||
public:
|
||||
void Close() const override;
|
||||
void ShowMiiEdit(const MiiEditCallback& callback) const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -9,8 +9,6 @@ namespace Core::Frontend {
|
||||
|
||||
ProfileSelectApplet::~ProfileSelectApplet() = default;
|
||||
|
||||
void DefaultProfileSelectApplet::Close() const {}
|
||||
|
||||
void DefaultProfileSelectApplet::SelectProfile(SelectProfileCallback callback) const {
|
||||
Service::Account::ProfileManager manager;
|
||||
callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::UUID{}));
|
||||
|
||||
@@ -7,11 +7,9 @@
|
||||
#include <optional>
|
||||
#include "common/uuid.h"
|
||||
|
||||
#include "core/frontend/applets/applet.h"
|
||||
|
||||
namespace Core::Frontend {
|
||||
|
||||
class ProfileSelectApplet : public Applet {
|
||||
class ProfileSelectApplet {
|
||||
public:
|
||||
using SelectProfileCallback = std::function<void(std::optional<Common::UUID>)>;
|
||||
|
||||
@@ -22,7 +20,6 @@ public:
|
||||
|
||||
class DefaultProfileSelectApplet final : public ProfileSelectApplet {
|
||||
public:
|
||||
void Close() const override;
|
||||
void SelectProfile(SelectProfileCallback callback) const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -13,8 +13,6 @@ SoftwareKeyboardApplet::~SoftwareKeyboardApplet() = default;
|
||||
|
||||
DefaultSoftwareKeyboardApplet::~DefaultSoftwareKeyboardApplet() = default;
|
||||
|
||||
void DefaultSoftwareKeyboardApplet::Close() const {}
|
||||
|
||||
void DefaultSoftwareKeyboardApplet::InitializeKeyboard(
|
||||
bool is_inline, KeyboardInitializeParameters initialize_parameters,
|
||||
SubmitNormalCallback submit_normal_callback_, SubmitInlineCallback submit_inline_callback_) {
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
#include "common/common_types.h"
|
||||
|
||||
#include "core/frontend/applets/applet.h"
|
||||
#include "core/hle/service/am/applets/applet_software_keyboard_types.h"
|
||||
|
||||
namespace Core::Frontend {
|
||||
@@ -53,7 +52,7 @@ struct InlineTextParameters {
|
||||
s32 cursor_position;
|
||||
};
|
||||
|
||||
class SoftwareKeyboardApplet : public Applet {
|
||||
class SoftwareKeyboardApplet {
|
||||
public:
|
||||
using SubmitInlineCallback =
|
||||
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>;
|
||||
@@ -85,8 +84,6 @@ class DefaultSoftwareKeyboardApplet final : public SoftwareKeyboardApplet {
|
||||
public:
|
||||
~DefaultSoftwareKeyboardApplet() override;
|
||||
|
||||
void Close() const override;
|
||||
|
||||
void InitializeKeyboard(bool is_inline, KeyboardInitializeParameters initialize_parameters,
|
||||
SubmitNormalCallback submit_normal_callback_,
|
||||
SubmitInlineCallback submit_inline_callback_) override;
|
||||
|
||||
@@ -10,8 +10,6 @@ WebBrowserApplet::~WebBrowserApplet() = default;
|
||||
|
||||
DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default;
|
||||
|
||||
void DefaultWebBrowserApplet::Close() const {}
|
||||
|
||||
void DefaultWebBrowserApplet::OpenLocalWebPage(const std::string& local_url,
|
||||
ExtractROMFSCallback extract_romfs_callback,
|
||||
OpenWebPageCallback callback) const {
|
||||
|
||||
@@ -5,12 +5,11 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "core/frontend/applets/applet.h"
|
||||
#include "core/hle/service/am/applets/applet_web_browser_types.h"
|
||||
|
||||
namespace Core::Frontend {
|
||||
|
||||
class WebBrowserApplet : public Applet {
|
||||
class WebBrowserApplet {
|
||||
public:
|
||||
using ExtractROMFSCallback = std::function<void()>;
|
||||
using OpenWebPageCallback =
|
||||
@@ -30,8 +29,6 @@ class DefaultWebBrowserApplet final : public WebBrowserApplet {
|
||||
public:
|
||||
~DefaultWebBrowserApplet() override;
|
||||
|
||||
void Close() const override;
|
||||
|
||||
void OpenLocalWebPage(const std::string& local_url, ExtractROMFSCallback extract_romfs_callback,
|
||||
OpenWebPageCallback callback) const override;
|
||||
|
||||
|
||||
@@ -945,7 +945,7 @@ public:
|
||||
{0, &ILibraryAppletAccessor::GetAppletStateChangedEvent, "GetAppletStateChangedEvent"},
|
||||
{1, &ILibraryAppletAccessor::IsCompleted, "IsCompleted"},
|
||||
{10, &ILibraryAppletAccessor::Start, "Start"},
|
||||
{20, &ILibraryAppletAccessor::RequestExit, "RequestExit"},
|
||||
{20, nullptr, "RequestExit"},
|
||||
{25, nullptr, "Terminate"},
|
||||
{30, &ILibraryAppletAccessor::GetResult, "GetResult"},
|
||||
{50, nullptr, "SetOutOfFocusApplicationSuspendingEnabled"},
|
||||
@@ -1010,15 +1010,6 @@ private:
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void RequestExit(HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_AM, "called");
|
||||
|
||||
ASSERT(applet != nullptr);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(applet->RequestExit());
|
||||
}
|
||||
|
||||
void PushInData(HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_AM, "called");
|
||||
|
||||
|
||||
@@ -174,9 +174,4 @@ void Cabinet::Cancel() {
|
||||
broker.SignalStateChanged();
|
||||
}
|
||||
|
||||
Result Cabinet::RequestExit() {
|
||||
frontend.Close();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
} // namespace Service::AM::Applets
|
||||
|
||||
@@ -89,7 +89,6 @@ public:
|
||||
void Execute() override;
|
||||
void DisplayCompleted(bool apply_changes, std::string_view amiibo_name);
|
||||
void Cancel();
|
||||
Result RequestExit() override;
|
||||
|
||||
private:
|
||||
const Core::Frontend::CabinetApplet& frontend;
|
||||
|
||||
@@ -262,9 +262,4 @@ void Controller::ConfigurationComplete() {
|
||||
broker.SignalStateChanged();
|
||||
}
|
||||
|
||||
Result Controller::RequestExit() {
|
||||
frontend.Close();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
} // namespace Service::AM::Applets
|
||||
|
||||
@@ -129,7 +129,6 @@ public:
|
||||
Result GetStatus() const override;
|
||||
void ExecuteInteractive() override;
|
||||
void Execute() override;
|
||||
Result RequestExit() override;
|
||||
|
||||
void ConfigurationComplete();
|
||||
|
||||
|
||||
@@ -209,9 +209,4 @@ void Error::DisplayCompleted() {
|
||||
broker.SignalStateChanged();
|
||||
}
|
||||
|
||||
Result Error::RequestExit() {
|
||||
frontend.Close();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
} // namespace Service::AM::Applets
|
||||
|
||||
@@ -34,7 +34,6 @@ public:
|
||||
Result GetStatus() const override;
|
||||
void ExecuteInteractive() override;
|
||||
void Execute() override;
|
||||
Result RequestExit() override;
|
||||
|
||||
void DisplayCompleted();
|
||||
|
||||
|
||||
@@ -150,11 +150,6 @@ void Auth::AuthFinished(bool is_successful) {
|
||||
broker.SignalStateChanged();
|
||||
}
|
||||
|
||||
Result Auth::RequestExit() {
|
||||
frontend.Close();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
PhotoViewer::PhotoViewer(Core::System& system_, LibraryAppletMode applet_mode_,
|
||||
const Core::Frontend::PhotoViewerApplet& frontend_)
|
||||
: Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {}
|
||||
@@ -207,11 +202,6 @@ void PhotoViewer::ViewFinished() {
|
||||
broker.SignalStateChanged();
|
||||
}
|
||||
|
||||
Result PhotoViewer::RequestExit() {
|
||||
frontend.Close();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
StubApplet::StubApplet(Core::System& system_, AppletId id_, LibraryAppletMode applet_mode_)
|
||||
: Applet{system_, applet_mode_}, id{id_}, system{system_} {}
|
||||
|
||||
@@ -260,9 +250,4 @@ void StubApplet::Execute() {
|
||||
broker.SignalStateChanged();
|
||||
}
|
||||
|
||||
Result StubApplet::RequestExit() {
|
||||
// Nothing to do.
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
} // namespace Service::AM::Applets
|
||||
|
||||
@@ -28,7 +28,6 @@ public:
|
||||
Result GetStatus() const override;
|
||||
void ExecuteInteractive() override;
|
||||
void Execute() override;
|
||||
Result RequestExit() override;
|
||||
|
||||
void AuthFinished(bool is_successful = true);
|
||||
|
||||
@@ -60,7 +59,6 @@ public:
|
||||
Result GetStatus() const override;
|
||||
void ExecuteInteractive() override;
|
||||
void Execute() override;
|
||||
Result RequestExit() override;
|
||||
|
||||
void ViewFinished();
|
||||
|
||||
@@ -82,7 +80,6 @@ public:
|
||||
Result GetStatus() const override;
|
||||
void ExecuteInteractive() override;
|
||||
void Execute() override;
|
||||
Result RequestExit() override;
|
||||
|
||||
private:
|
||||
AppletId id;
|
||||
|
||||
@@ -135,9 +135,4 @@ void MiiEdit::MiiEditOutputForCharInfoEditing(MiiEditResult result,
|
||||
broker.SignalStateChanged();
|
||||
}
|
||||
|
||||
Result MiiEdit::RequestExit() {
|
||||
frontend.Close();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
} // namespace Service::AM::Applets
|
||||
|
||||
@@ -25,7 +25,6 @@ public:
|
||||
Result GetStatus() const override;
|
||||
void ExecuteInteractive() override;
|
||||
void Execute() override;
|
||||
Result RequestExit() override;
|
||||
|
||||
void MiiEditOutput(MiiEditResult result, s32 index);
|
||||
|
||||
|
||||
@@ -73,9 +73,4 @@ void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) {
|
||||
broker.SignalStateChanged();
|
||||
}
|
||||
|
||||
Result ProfileSelect::RequestExit() {
|
||||
frontend.Close();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
} // namespace Service::AM::Applets
|
||||
|
||||
@@ -42,7 +42,6 @@ public:
|
||||
Result GetStatus() const override;
|
||||
void ExecuteInteractive() override;
|
||||
void Execute() override;
|
||||
Result RequestExit() override;
|
||||
|
||||
void SelectionComplete(std::optional<Common::UUID> uuid);
|
||||
|
||||
|
||||
@@ -770,11 +770,6 @@ void SoftwareKeyboard::ExitKeyboard() {
|
||||
broker.SignalStateChanged();
|
||||
}
|
||||
|
||||
Result SoftwareKeyboard::RequestExit() {
|
||||
frontend.Close();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
// Inline Software Keyboard Requests
|
||||
|
||||
void SoftwareKeyboard::RequestFinalize(const std::vector<u8>& request_data) {
|
||||
|
||||
@@ -31,7 +31,6 @@ public:
|
||||
Result GetStatus() const override;
|
||||
void ExecuteInteractive() override;
|
||||
void Execute() override;
|
||||
Result RequestExit() override;
|
||||
|
||||
/**
|
||||
* Submits the input text to the application.
|
||||
|
||||
@@ -363,11 +363,6 @@ void WebBrowser::WebBrowserExit(WebExitReason exit_reason, std::string last_url)
|
||||
broker.SignalStateChanged();
|
||||
}
|
||||
|
||||
Result WebBrowser::RequestExit() {
|
||||
frontend.Close();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
bool WebBrowser::InputTLVExistsInMap(WebArgInputTLVType input_tlv_type) const {
|
||||
return web_arg_input_tlv_map.find(input_tlv_type) != web_arg_input_tlv_map.end();
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ public:
|
||||
Result GetStatus() const override;
|
||||
void ExecuteInteractive() override;
|
||||
void Execute() override;
|
||||
Result RequestExit() override;
|
||||
|
||||
void ExtractOfflineRomFS();
|
||||
|
||||
|
||||
@@ -142,7 +142,6 @@ public:
|
||||
virtual Result GetStatus() const = 0;
|
||||
virtual void ExecuteInteractive() = 0;
|
||||
virtual void Execute() = 0;
|
||||
virtual Result RequestExit() = 0;
|
||||
|
||||
AppletDataBroker& GetBroker() {
|
||||
return broker;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
add_executable(tests
|
||||
common/bit_field.cpp
|
||||
common/cityhash.cpp
|
||||
common/container_hash.cpp
|
||||
common/fibers.cpp
|
||||
common/host_memory.cpp
|
||||
common/param_package.cpp
|
||||
|
||||
41
src/tests/common/container_hash.cpp
Normal file
41
src/tests/common/container_hash.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/container_hash.h"
|
||||
|
||||
TEST_CASE("ContainerHash", "[common]") {
|
||||
constexpr std::array<u8, 32> U8Values{
|
||||
114, 10, 238, 189, 199, 242, 86, 96, 53, 193, 195, 247, 249, 56, 253, 61,
|
||||
205, 3, 172, 4, 210, 197, 43, 72, 103, 8, 99, 89, 5, 97, 68, 196,
|
||||
};
|
||||
constexpr std::array<u16, 32> U16Values{
|
||||
61586, 49151, 3313, 11641, 31695, 54795, 46764, 20965, 23287, 14039, 19265,
|
||||
49093, 58932, 22518, 27139, 42825, 57417, 54237, 48057, 14586, 42813, 32994,
|
||||
33970, 45501, 5619, 15895, 33227, 27509, 25391, 37275, 60218, 17599,
|
||||
};
|
||||
constexpr std::array<u32, 32> U32Values{
|
||||
3838402410, 2029146863, 1730869921, 985528872, 186773874, 2094639868, 3324775932,
|
||||
1795512424, 2571165571, 3256934519, 2358691590, 2752682538, 1484336451, 378124520,
|
||||
3463015699, 3395942161, 1263211979, 3473632889, 3039822212, 2068707357, 2223837919,
|
||||
1823232191, 1583884041, 1264393380, 4087566993, 3188607101, 3933680362, 1464520765,
|
||||
1786838406, 1311734848, 2773642241, 3993641692,
|
||||
};
|
||||
constexpr std::array<u64, 32> U64Values{
|
||||
5908025796157537817, 10947547850358315100, 844798943576724669, 7999662937458523703,
|
||||
4006550374705895164, 1832550525423503632, 9323088254855830976, 12028890075598379412,
|
||||
6021511300787826236, 7864675007938747948, 18099387408859708806, 6438638299316820708,
|
||||
9029399285648501543, 18195459433089960253, 17214335092761966083, 5549347964591337833,
|
||||
14899526073304962015, 5058883181561464475, 7436311795731206973, 7535129567768649864,
|
||||
1287169596809258072, 8237671246353565927, 1715230541978016153, 8443157615068813300,
|
||||
6098675262328527839, 704652094100376853, 1303411723202926503, 7808312933946424854,
|
||||
6863726670433556594, 9870361541383217495, 9273671094091079488, 17541434976160119010,
|
||||
};
|
||||
|
||||
REQUIRE(Common::HashValue(U8Values) == 5867183267093890552);
|
||||
REQUIRE(Common::HashValue(U16Values) == 9594135570564347135);
|
||||
REQUIRE(Common::HashValue(U32Values) == 13123757214696618460);
|
||||
REQUIRE(Common::HashValue(U64Values) == 7296500016546938380);
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <optional>
|
||||
#include <span>
|
||||
|
||||
#include <boost/container_hash/hash.hpp>
|
||||
#include "common/container_hash.h"
|
||||
|
||||
#include <fstream>
|
||||
#include "common/assert.h"
|
||||
@@ -89,7 +89,7 @@ void MacroEngine::Execute(u32 method, const std::vector<u32>& parameters) {
|
||||
|
||||
if (!mid_method.has_value()) {
|
||||
cache_info.lle_program = Compile(macro_code->second);
|
||||
cache_info.hash = boost::hash_value(macro_code->second);
|
||||
cache_info.hash = Common::HashValue(macro_code->second);
|
||||
if (Settings::values.dump_macros) {
|
||||
Dump(cache_info.hash, macro_code->second);
|
||||
}
|
||||
@@ -100,7 +100,7 @@ void MacroEngine::Execute(u32 method, const std::vector<u32>& parameters) {
|
||||
code.resize(macro_cached.size() - rebased_method);
|
||||
std::memcpy(code.data(), macro_cached.data() + rebased_method,
|
||||
code.size() * sizeof(u32));
|
||||
cache_info.hash = boost::hash_value(code);
|
||||
cache_info.hash = Common::HashValue(code);
|
||||
cache_info.lle_program = Compile(code);
|
||||
if (Settings::values.dump_macros) {
|
||||
Dump(cache_info.hash, code);
|
||||
|
||||
@@ -245,19 +245,12 @@ void QtAmiiboSettingsDialog::SetSettingsDescription() {
|
||||
QtAmiiboSettings::QtAmiiboSettings(GMainWindow& parent) {
|
||||
connect(this, &QtAmiiboSettings::MainWindowShowAmiiboSettings, &parent,
|
||||
&GMainWindow::AmiiboSettingsShowDialog, Qt::QueuedConnection);
|
||||
connect(this, &QtAmiiboSettings::MainWindowRequestExit, &parent,
|
||||
&GMainWindow::AmiiboSettingsRequestExit, Qt::QueuedConnection);
|
||||
connect(&parent, &GMainWindow::AmiiboSettingsFinished, this,
|
||||
&QtAmiiboSettings::MainWindowFinished, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
QtAmiiboSettings::~QtAmiiboSettings() = default;
|
||||
|
||||
void QtAmiiboSettings::Close() const {
|
||||
callback = {};
|
||||
emit MainWindowRequestExit();
|
||||
}
|
||||
|
||||
void QtAmiiboSettings::ShowCabinetApplet(
|
||||
const Core::Frontend::CabinetCallback& callback_,
|
||||
const Core::Frontend::CabinetParameters& parameters,
|
||||
@@ -267,7 +260,5 @@ void QtAmiiboSettings::ShowCabinetApplet(
|
||||
}
|
||||
|
||||
void QtAmiiboSettings::MainWindowFinished(bool is_success, const std::string& name) {
|
||||
if (callback) {
|
||||
callback(is_success, name);
|
||||
}
|
||||
callback(is_success, name);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,6 @@ public:
|
||||
explicit QtAmiiboSettings(GMainWindow& parent);
|
||||
~QtAmiiboSettings() override;
|
||||
|
||||
void Close() const override;
|
||||
void ShowCabinetApplet(const Core::Frontend::CabinetCallback& callback_,
|
||||
const Core::Frontend::CabinetParameters& parameters,
|
||||
std::shared_ptr<Service::NFP::NfpDevice> nfp_device) const override;
|
||||
@@ -76,7 +75,6 @@ public:
|
||||
signals:
|
||||
void MainWindowShowAmiiboSettings(const Core::Frontend::CabinetParameters& parameters,
|
||||
std::shared_ptr<Service::NFP::NfpDevice> nfp_device) const;
|
||||
void MainWindowRequestExit() const;
|
||||
|
||||
private:
|
||||
void MainWindowFinished(bool is_success, const std::string& name);
|
||||
|
||||
@@ -678,19 +678,12 @@ void QtControllerSelectorDialog::DisableUnsupportedPlayers() {
|
||||
QtControllerSelector::QtControllerSelector(GMainWindow& parent) {
|
||||
connect(this, &QtControllerSelector::MainWindowReconfigureControllers, &parent,
|
||||
&GMainWindow::ControllerSelectorReconfigureControllers, Qt::QueuedConnection);
|
||||
connect(this, &QtControllerSelector::MainWindowRequestExit, &parent,
|
||||
&GMainWindow::ControllerSelectorRequestExit, Qt::QueuedConnection);
|
||||
connect(&parent, &GMainWindow::ControllerSelectorReconfigureFinished, this,
|
||||
&QtControllerSelector::MainWindowReconfigureFinished, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
QtControllerSelector::~QtControllerSelector() = default;
|
||||
|
||||
void QtControllerSelector::Close() const {
|
||||
callback = {};
|
||||
emit MainWindowRequestExit();
|
||||
}
|
||||
|
||||
void QtControllerSelector::ReconfigureControllers(
|
||||
ReconfigureCallback callback_, const Core::Frontend::ControllerParameters& parameters) const {
|
||||
callback = std::move(callback_);
|
||||
@@ -698,7 +691,5 @@ void QtControllerSelector::ReconfigureControllers(
|
||||
}
|
||||
|
||||
void QtControllerSelector::MainWindowReconfigureFinished() {
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
callback();
|
||||
}
|
||||
|
||||
@@ -156,7 +156,6 @@ public:
|
||||
explicit QtControllerSelector(GMainWindow& parent);
|
||||
~QtControllerSelector() override;
|
||||
|
||||
void Close() const override;
|
||||
void ReconfigureControllers(
|
||||
ReconfigureCallback callback_,
|
||||
const Core::Frontend::ControllerParameters& parameters) const override;
|
||||
@@ -164,7 +163,6 @@ public:
|
||||
signals:
|
||||
void MainWindowReconfigureControllers(
|
||||
const Core::Frontend::ControllerParameters& parameters) const;
|
||||
void MainWindowRequestExit() const;
|
||||
|
||||
private:
|
||||
void MainWindowReconfigureFinished();
|
||||
|
||||
@@ -8,19 +8,12 @@
|
||||
QtErrorDisplay::QtErrorDisplay(GMainWindow& parent) {
|
||||
connect(this, &QtErrorDisplay::MainWindowDisplayError, &parent,
|
||||
&GMainWindow::ErrorDisplayDisplayError, Qt::QueuedConnection);
|
||||
connect(this, &QtErrorDisplay::MainWindowRequestExit, &parent,
|
||||
&GMainWindow::ErrorDisplayRequestExit, Qt::QueuedConnection);
|
||||
connect(&parent, &GMainWindow::ErrorDisplayFinished, this,
|
||||
&QtErrorDisplay::MainWindowFinishedError, Qt::DirectConnection);
|
||||
}
|
||||
|
||||
QtErrorDisplay::~QtErrorDisplay() = default;
|
||||
|
||||
void QtErrorDisplay::Close() const {
|
||||
callback = {};
|
||||
emit MainWindowRequestExit();
|
||||
}
|
||||
|
||||
void QtErrorDisplay::ShowError(Result error, FinishedCallback finished) const {
|
||||
callback = std::move(finished);
|
||||
emit MainWindowDisplayError(
|
||||
@@ -62,7 +55,5 @@ void QtErrorDisplay::ShowCustomErrorText(Result error, std::string dialog_text,
|
||||
}
|
||||
|
||||
void QtErrorDisplay::MainWindowFinishedError() {
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
callback();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ public:
|
||||
explicit QtErrorDisplay(GMainWindow& parent);
|
||||
~QtErrorDisplay() override;
|
||||
|
||||
void Close() const override;
|
||||
void ShowError(Result error, FinishedCallback finished) const override;
|
||||
void ShowErrorWithTimestamp(Result error, std::chrono::seconds time,
|
||||
FinishedCallback finished) const override;
|
||||
@@ -25,7 +24,6 @@ public:
|
||||
|
||||
signals:
|
||||
void MainWindowDisplayError(QString error_code, QString error_text) const;
|
||||
void MainWindowRequestExit() const;
|
||||
|
||||
private:
|
||||
void MainWindowFinishedError();
|
||||
|
||||
@@ -157,26 +157,17 @@ void QtProfileSelectionDialog::SelectUser(const QModelIndex& index) {
|
||||
QtProfileSelector::QtProfileSelector(GMainWindow& parent) {
|
||||
connect(this, &QtProfileSelector::MainWindowSelectProfile, &parent,
|
||||
&GMainWindow::ProfileSelectorSelectProfile, Qt::QueuedConnection);
|
||||
connect(this, &QtProfileSelector::MainWindowRequestExit, &parent,
|
||||
&GMainWindow::ProfileSelectorRequestExit, Qt::QueuedConnection);
|
||||
connect(&parent, &GMainWindow::ProfileSelectorFinishedSelection, this,
|
||||
&QtProfileSelector::MainWindowFinishedSelection, Qt::DirectConnection);
|
||||
}
|
||||
|
||||
QtProfileSelector::~QtProfileSelector() = default;
|
||||
|
||||
void QtProfileSelector::Close() const {
|
||||
callback = {};
|
||||
emit MainWindowRequestExit();
|
||||
}
|
||||
|
||||
void QtProfileSelector::SelectProfile(SelectProfileCallback callback_) const {
|
||||
callback = std::move(callback_);
|
||||
emit MainWindowSelectProfile();
|
||||
}
|
||||
|
||||
void QtProfileSelector::MainWindowFinishedSelection(std::optional<Common::UUID> uuid) {
|
||||
if (callback) {
|
||||
callback(uuid);
|
||||
}
|
||||
callback(uuid);
|
||||
}
|
||||
|
||||
@@ -65,12 +65,10 @@ public:
|
||||
explicit QtProfileSelector(GMainWindow& parent);
|
||||
~QtProfileSelector() override;
|
||||
|
||||
void Close() const override;
|
||||
void SelectProfile(SelectProfileCallback callback_) const override;
|
||||
|
||||
signals:
|
||||
void MainWindowSelectProfile() const;
|
||||
void MainWindowRequestExit() const;
|
||||
|
||||
private:
|
||||
void MainWindowFinishedSelection(std::optional<Common::UUID> uuid);
|
||||
|
||||
@@ -233,10 +233,6 @@ public:
|
||||
explicit QtSoftwareKeyboard(GMainWindow& parent);
|
||||
~QtSoftwareKeyboard() override;
|
||||
|
||||
void Close() const override {
|
||||
ExitKeyboard();
|
||||
}
|
||||
|
||||
void InitializeKeyboard(bool is_inline,
|
||||
Core::Frontend::KeyboardInitializeParameters initialize_parameters,
|
||||
SubmitNormalCallback submit_normal_callback_,
|
||||
|
||||
@@ -393,8 +393,6 @@ void QtNXWebEngineView::FocusFirstLinkElement() {
|
||||
QtWebBrowser::QtWebBrowser(GMainWindow& main_window) {
|
||||
connect(this, &QtWebBrowser::MainWindowOpenWebPage, &main_window,
|
||||
&GMainWindow::WebBrowserOpenWebPage, Qt::QueuedConnection);
|
||||
connect(this, &QtWebBrowser::MainWindowRequestExit, &main_window,
|
||||
&GMainWindow::WebBrowserRequestExit, Qt::QueuedConnection);
|
||||
connect(&main_window, &GMainWindow::WebBrowserExtractOfflineRomFS, this,
|
||||
&QtWebBrowser::MainWindowExtractOfflineRomFS, Qt::QueuedConnection);
|
||||
connect(&main_window, &GMainWindow::WebBrowserClosed, this,
|
||||
@@ -403,11 +401,6 @@ QtWebBrowser::QtWebBrowser(GMainWindow& main_window) {
|
||||
|
||||
QtWebBrowser::~QtWebBrowser() = default;
|
||||
|
||||
void QtWebBrowser::Close() const {
|
||||
callback = {};
|
||||
emit MainWindowRequestExit();
|
||||
}
|
||||
|
||||
void QtWebBrowser::OpenLocalWebPage(const std::string& local_url,
|
||||
ExtractROMFSCallback extract_romfs_callback_,
|
||||
OpenWebPageCallback callback_) const {
|
||||
@@ -443,7 +436,5 @@ void QtWebBrowser::MainWindowExtractOfflineRomFS() {
|
||||
|
||||
void QtWebBrowser::MainWindowWebBrowserClosed(Service::AM::Applets::WebExitReason exit_reason,
|
||||
std::string last_url) {
|
||||
if (callback) {
|
||||
callback(exit_reason, last_url);
|
||||
}
|
||||
callback(exit_reason, last_url);
|
||||
}
|
||||
|
||||
@@ -196,7 +196,6 @@ public:
|
||||
explicit QtWebBrowser(GMainWindow& parent);
|
||||
~QtWebBrowser() override;
|
||||
|
||||
void Close() const override;
|
||||
void OpenLocalWebPage(const std::string& local_url,
|
||||
ExtractROMFSCallback extract_romfs_callback_,
|
||||
OpenWebPageCallback callback_) const override;
|
||||
@@ -207,7 +206,6 @@ public:
|
||||
signals:
|
||||
void MainWindowOpenWebPage(const std::string& main_url, const std::string& additional_args,
|
||||
bool is_local) const;
|
||||
void MainWindowRequestExit() const;
|
||||
|
||||
private:
|
||||
void MainWindowExtractOfflineRomFS();
|
||||
|
||||
@@ -596,45 +596,27 @@ void GMainWindow::RegisterMetaTypes() {
|
||||
|
||||
void GMainWindow::AmiiboSettingsShowDialog(const Core::Frontend::CabinetParameters& parameters,
|
||||
std::shared_ptr<Service::NFP::NfpDevice> nfp_device) {
|
||||
cabinet_applet =
|
||||
new QtAmiiboSettingsDialog(this, parameters, input_subsystem.get(), nfp_device);
|
||||
SCOPE_EXIT({
|
||||
cabinet_applet->deleteLater();
|
||||
cabinet_applet = nullptr;
|
||||
});
|
||||
QtAmiiboSettingsDialog dialog(this, parameters, input_subsystem.get(), nfp_device);
|
||||
|
||||
cabinet_applet->setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint |
|
||||
Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
||||
cabinet_applet->setWindowModality(Qt::WindowModal);
|
||||
|
||||
if (cabinet_applet->exec() == QDialog::Rejected) {
|
||||
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint |
|
||||
Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
if (dialog.exec() == QDialog::Rejected) {
|
||||
emit AmiiboSettingsFinished(false, {});
|
||||
return;
|
||||
}
|
||||
|
||||
emit AmiiboSettingsFinished(true, cabinet_applet->GetName());
|
||||
}
|
||||
|
||||
void GMainWindow::AmiiboSettingsRequestExit() {
|
||||
if (cabinet_applet) {
|
||||
cabinet_applet->reject();
|
||||
}
|
||||
emit AmiiboSettingsFinished(true, dialog.GetName());
|
||||
}
|
||||
|
||||
void GMainWindow::ControllerSelectorReconfigureControllers(
|
||||
const Core::Frontend::ControllerParameters& parameters) {
|
||||
controller_applet =
|
||||
new QtControllerSelectorDialog(this, parameters, input_subsystem.get(), *system);
|
||||
SCOPE_EXIT({
|
||||
controller_applet->deleteLater();
|
||||
controller_applet = nullptr;
|
||||
});
|
||||
QtControllerSelectorDialog dialog(this, parameters, input_subsystem.get(), *system);
|
||||
|
||||
controller_applet->setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint |
|
||||
Qt::WindowStaysOnTopHint | Qt::WindowTitleHint |
|
||||
Qt::WindowSystemMenuHint);
|
||||
controller_applet->setWindowModality(Qt::WindowModal);
|
||||
controller_applet->exec();
|
||||
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint |
|
||||
Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
dialog.exec();
|
||||
|
||||
emit ControllerSelectorReconfigureFinished();
|
||||
|
||||
@@ -645,30 +627,19 @@ void GMainWindow::ControllerSelectorReconfigureControllers(
|
||||
UpdateStatusButtons();
|
||||
}
|
||||
|
||||
void GMainWindow::ControllerSelectorRequestExit() {
|
||||
if (controller_applet) {
|
||||
controller_applet->reject();
|
||||
}
|
||||
}
|
||||
|
||||
void GMainWindow::ProfileSelectorSelectProfile() {
|
||||
profile_select_applet = new QtProfileSelectionDialog(system->HIDCore(), this);
|
||||
SCOPE_EXIT({
|
||||
profile_select_applet->deleteLater();
|
||||
profile_select_applet = nullptr;
|
||||
});
|
||||
|
||||
profile_select_applet->setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint |
|
||||
Qt::WindowStaysOnTopHint | Qt::WindowTitleHint |
|
||||
Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
|
||||
profile_select_applet->setWindowModality(Qt::WindowModal);
|
||||
if (profile_select_applet->exec() == QDialog::Rejected) {
|
||||
QtProfileSelectionDialog dialog(system->HIDCore(), this);
|
||||
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint |
|
||||
Qt::WindowTitleHint | Qt::WindowSystemMenuHint |
|
||||
Qt::WindowCloseButtonHint);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
if (dialog.exec() == QDialog::Rejected) {
|
||||
emit ProfileSelectorFinishedSelection(std::nullopt);
|
||||
return;
|
||||
}
|
||||
|
||||
const Service::Account::ProfileManager manager;
|
||||
const auto uuid = manager.GetUser(static_cast<std::size_t>(profile_select_applet->GetIndex()));
|
||||
const auto uuid = manager.GetUser(static_cast<std::size_t>(dialog.GetIndex()));
|
||||
if (!uuid.has_value()) {
|
||||
emit ProfileSelectorFinishedSelection(std::nullopt);
|
||||
return;
|
||||
@@ -677,12 +648,6 @@ void GMainWindow::ProfileSelectorSelectProfile() {
|
||||
emit ProfileSelectorFinishedSelection(uuid);
|
||||
}
|
||||
|
||||
void GMainWindow::ProfileSelectorRequestExit() {
|
||||
if (profile_select_applet) {
|
||||
profile_select_applet->reject();
|
||||
}
|
||||
}
|
||||
|
||||
void GMainWindow::SoftwareKeyboardInitialize(
|
||||
bool is_inline, Core::Frontend::KeyboardInitializeParameters initialize_parameters) {
|
||||
if (software_keyboard) {
|
||||
@@ -807,7 +772,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
|
||||
return;
|
||||
}
|
||||
|
||||
web_applet = new QtNXWebEngineView(this, *system, input_subsystem.get());
|
||||
QtNXWebEngineView web_browser_view(this, *system, input_subsystem.get());
|
||||
|
||||
ui->action_Pause->setEnabled(false);
|
||||
ui->action_Restart->setEnabled(false);
|
||||
@@ -834,9 +799,9 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
|
||||
loading_progress.setValue(1);
|
||||
|
||||
if (is_local) {
|
||||
web_applet->LoadLocalWebPage(main_url, additional_args);
|
||||
web_browser_view.LoadLocalWebPage(main_url, additional_args);
|
||||
} else {
|
||||
web_applet->LoadExternalWebPage(main_url, additional_args);
|
||||
web_browser_view.LoadExternalWebPage(main_url, additional_args);
|
||||
}
|
||||
|
||||
if (render_window->IsLoadingComplete()) {
|
||||
@@ -845,15 +810,15 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
|
||||
|
||||
const auto& layout = render_window->GetFramebufferLayout();
|
||||
const auto scale_ratio = devicePixelRatioF();
|
||||
web_applet->resize(layout.screen.GetWidth() / scale_ratio,
|
||||
layout.screen.GetHeight() / scale_ratio);
|
||||
web_applet->move(layout.screen.left / scale_ratio,
|
||||
(layout.screen.top / scale_ratio) + menuBar()->height());
|
||||
web_applet->setZoomFactor(static_cast<qreal>(layout.screen.GetWidth() / scale_ratio) /
|
||||
static_cast<qreal>(Layout::ScreenUndocked::Width));
|
||||
web_browser_view.resize(layout.screen.GetWidth() / scale_ratio,
|
||||
layout.screen.GetHeight() / scale_ratio);
|
||||
web_browser_view.move(layout.screen.left / scale_ratio,
|
||||
(layout.screen.top / scale_ratio) + menuBar()->height());
|
||||
web_browser_view.setZoomFactor(static_cast<qreal>(layout.screen.GetWidth() / scale_ratio) /
|
||||
static_cast<qreal>(Layout::ScreenUndocked::Width));
|
||||
|
||||
web_applet->setFocus();
|
||||
web_applet->show();
|
||||
web_browser_view.setFocus();
|
||||
web_browser_view.show();
|
||||
|
||||
loading_progress.setValue(2);
|
||||
|
||||
@@ -866,7 +831,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
|
||||
|
||||
// TODO (Morph): Remove this
|
||||
QAction* exit_action = new QAction(tr("Disable Web Applet"), this);
|
||||
connect(exit_action, &QAction::triggered, this, [this] {
|
||||
connect(exit_action, &QAction::triggered, this, [this, &web_browser_view] {
|
||||
const auto result = QMessageBox::warning(
|
||||
this, tr("Disable Web Applet"),
|
||||
tr("Disabling the web applet can lead to undefined behavior and should only be used "
|
||||
@@ -875,21 +840,21 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (result == QMessageBox::Yes) {
|
||||
UISettings::values.disable_web_applet = true;
|
||||
web_applet->SetFinished(true);
|
||||
web_browser_view.SetFinished(true);
|
||||
}
|
||||
});
|
||||
ui->menubar->addAction(exit_action);
|
||||
|
||||
while (!web_applet->IsFinished()) {
|
||||
while (!web_browser_view.IsFinished()) {
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
if (!exit_check) {
|
||||
web_applet->page()->runJavaScript(
|
||||
web_browser_view.page()->runJavaScript(
|
||||
QStringLiteral("end_applet;"), [&](const QVariant& variant) {
|
||||
exit_check = false;
|
||||
if (variant.toBool()) {
|
||||
web_applet->SetFinished(true);
|
||||
web_applet->SetExitReason(
|
||||
web_browser_view.SetFinished(true);
|
||||
web_browser_view.SetExitReason(
|
||||
Service::AM::Applets::WebExitReason::EndButtonPressed);
|
||||
}
|
||||
});
|
||||
@@ -897,22 +862,22 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
|
||||
exit_check = true;
|
||||
}
|
||||
|
||||
if (web_applet->GetCurrentURL().contains(QStringLiteral("localhost"))) {
|
||||
if (!web_applet->IsFinished()) {
|
||||
web_applet->SetFinished(true);
|
||||
web_applet->SetExitReason(Service::AM::Applets::WebExitReason::CallbackURL);
|
||||
if (web_browser_view.GetCurrentURL().contains(QStringLiteral("localhost"))) {
|
||||
if (!web_browser_view.IsFinished()) {
|
||||
web_browser_view.SetFinished(true);
|
||||
web_browser_view.SetExitReason(Service::AM::Applets::WebExitReason::CallbackURL);
|
||||
}
|
||||
|
||||
web_applet->SetLastURL(web_applet->GetCurrentURL().toStdString());
|
||||
web_browser_view.SetLastURL(web_browser_view.GetCurrentURL().toStdString());
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
const auto exit_reason = web_applet->GetExitReason();
|
||||
const auto last_url = web_applet->GetLastURL();
|
||||
const auto exit_reason = web_browser_view.GetExitReason();
|
||||
const auto last_url = web_browser_view.GetLastURL();
|
||||
|
||||
web_applet->hide();
|
||||
web_browser_view.hide();
|
||||
|
||||
render_window->setFocus();
|
||||
|
||||
@@ -938,15 +903,6 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
|
||||
#endif
|
||||
}
|
||||
|
||||
void GMainWindow::WebBrowserRequestExit() {
|
||||
#ifdef YUZU_USE_QT_WEB_ENGINE
|
||||
if (web_applet) {
|
||||
web_applet->SetExitReason(Service::AM::Applets::WebExitReason::ExitRequested);
|
||||
web_applet->SetFinished(true);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void GMainWindow::InitializeWidgets() {
|
||||
#ifdef YUZU_ENABLE_COMPATIBILITY_REPORTING
|
||||
ui->action_Report_Compatibility->setVisible(true);
|
||||
@@ -3133,23 +3089,13 @@ void GMainWindow::OnSaveConfig() {
|
||||
}
|
||||
|
||||
void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_text) {
|
||||
error_applet = new OverlayDialog(render_window, *system, error_code, error_text, QString{},
|
||||
tr("OK"), Qt::AlignLeft | Qt::AlignVCenter);
|
||||
SCOPE_EXIT({
|
||||
error_applet->deleteLater();
|
||||
error_applet = nullptr;
|
||||
});
|
||||
error_applet->exec();
|
||||
OverlayDialog dialog(render_window, *system, error_code, error_text, QString{}, tr("OK"),
|
||||
Qt::AlignLeft | Qt::AlignVCenter);
|
||||
dialog.exec();
|
||||
|
||||
emit ErrorDisplayFinished();
|
||||
}
|
||||
|
||||
void GMainWindow::ErrorDisplayRequestExit() {
|
||||
if (error_applet) {
|
||||
error_applet->reject();
|
||||
}
|
||||
}
|
||||
|
||||
void GMainWindow::OnMenuReportCompatibility() {
|
||||
#if defined(ARCHITECTURE_x86_64) && !defined(__APPLE__)
|
||||
const auto& caps = Common::GetCPUCaps();
|
||||
|
||||
@@ -47,11 +47,7 @@ enum class DumpRomFSTarget;
|
||||
enum class InstalledEntryType;
|
||||
class GameListPlaceholder;
|
||||
|
||||
class QtAmiiboSettingsDialog;
|
||||
class QtControllerSelectorDialog;
|
||||
class QtProfileSelectionDialog;
|
||||
class QtSoftwareKeyboardDialog;
|
||||
class QtNXWebEngineView;
|
||||
|
||||
enum class StartGameType {
|
||||
Normal, // Can use custom configuration
|
||||
@@ -188,10 +184,8 @@ public slots:
|
||||
void OnSaveConfig();
|
||||
void AmiiboSettingsShowDialog(const Core::Frontend::CabinetParameters& parameters,
|
||||
std::shared_ptr<Service::NFP::NfpDevice> nfp_device);
|
||||
void AmiiboSettingsRequestExit();
|
||||
void ControllerSelectorReconfigureControllers(
|
||||
const Core::Frontend::ControllerParameters& parameters);
|
||||
void ControllerSelectorRequestExit();
|
||||
void SoftwareKeyboardInitialize(
|
||||
bool is_inline, Core::Frontend::KeyboardInitializeParameters initialize_parameters);
|
||||
void SoftwareKeyboardShowNormal();
|
||||
@@ -202,12 +196,9 @@ public slots:
|
||||
void SoftwareKeyboardInlineTextChanged(Core::Frontend::InlineTextParameters text_parameters);
|
||||
void SoftwareKeyboardExit();
|
||||
void ErrorDisplayDisplayError(QString error_code, QString error_text);
|
||||
void ErrorDisplayRequestExit();
|
||||
void ProfileSelectorSelectProfile();
|
||||
void ProfileSelectorRequestExit();
|
||||
void WebBrowserOpenWebPage(const std::string& main_url, const std::string& additional_args,
|
||||
bool is_local);
|
||||
void WebBrowserRequestExit();
|
||||
void OnAppFocusStateChanged(Qt::ApplicationState state);
|
||||
void OnTasStateChanged();
|
||||
|
||||
@@ -475,12 +466,7 @@ private:
|
||||
QString last_filename_booted;
|
||||
|
||||
// Applets
|
||||
QtAmiiboSettingsDialog* cabinet_applet = nullptr;
|
||||
QtControllerSelectorDialog* controller_applet = nullptr;
|
||||
QtProfileSelectionDialog* profile_select_applet = nullptr;
|
||||
QDialog* error_applet = nullptr;
|
||||
QtSoftwareKeyboardDialog* software_keyboard = nullptr;
|
||||
QtNXWebEngineView* web_applet = nullptr;
|
||||
|
||||
// True if amiibo file select is visible
|
||||
bool is_amiibo_file_select_active{};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
|
||||
"name": "yuzu",
|
||||
"builtin-baseline": "a7b6122f6b6504d16d96117336a0562693579933",
|
||||
"builtin-baseline": "acc3bcf76b84ae5041c86ab55fe138ae7b8255c7",
|
||||
"version": "1.0",
|
||||
"dependencies": [
|
||||
"boost-algorithm",
|
||||
|
||||
Reference in New Issue
Block a user