Compare commits
15 Commits
__refs_pul
...
__refs_pul
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a49f1f5765 | ||
|
|
0ca29f1e54 | ||
|
|
5295a925d8 | ||
|
|
67569dfe9d | ||
|
|
7709374f4f | ||
|
|
7130bcc46d | ||
|
|
262df44be1 | ||
|
|
1193f7c393 | ||
|
|
693b212417 | ||
|
|
8304b14a90 | ||
|
|
64e93dc959 | ||
|
|
a7f7279d9d | ||
|
|
9d64253916 | ||
|
|
8eabdc058b | ||
|
|
91a6df0361 |
@@ -8,7 +8,7 @@ steps:
|
||||
displayName: 'Install vulkan-sdk'
|
||||
- script: python -m pip install --upgrade pip conan
|
||||
displayName: 'Install conan'
|
||||
- script: refreshenv && mkdir build && cd build && cmake -G "Visual Studio 16 2019" -A x64 -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DYUZU_TESTS=OFF -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON -DDISPLAY_VERSION=${{ parameters['version'] }} -DCMAKE_BUILD_TYPE=Release .. && cd ..
|
||||
- script: refreshenv && mkdir build && cd build && cmake -G "Visual Studio 17 2022" -A x64 -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DYUZU_TESTS=OFF -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON -DDISPLAY_VERSION=${{ parameters['version'] }} -DCMAKE_BUILD_TYPE=Release .. && cd ..
|
||||
displayName: 'Configure CMake'
|
||||
- task: MSBuild@1
|
||||
displayName: 'Build'
|
||||
|
||||
@@ -47,7 +47,7 @@ stages:
|
||||
timeoutInMinutes: 120
|
||||
displayName: 'msvc'
|
||||
pool:
|
||||
vmImage: windows-2019
|
||||
vmImage: windows-2022
|
||||
steps:
|
||||
- template: ./templates/sync-source.yml
|
||||
parameters:
|
||||
|
||||
@@ -12,7 +12,7 @@ stages:
|
||||
timeoutInMinutes: 120
|
||||
displayName: 'windows-msvc'
|
||||
pool:
|
||||
vmImage: windows-2019
|
||||
vmImage: windows-2022
|
||||
steps:
|
||||
- template: ./templates/sync-source.yml
|
||||
parameters:
|
||||
|
||||
@@ -405,13 +405,11 @@ if (CONAN_REQUIRED_LIBS)
|
||||
# Download conan.cmake automatically, you can also just copy the conan.cmake file
|
||||
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
|
||||
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
|
||||
# TODO: Use a tagged release. The latest tagged release does not support VS2022 as of this writing.
|
||||
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/43e385830ee35377dbd2dcbe8d5a9e750301ea00/conan.cmake"
|
||||
"${CMAKE_BINARY_DIR}/conan.cmake")
|
||||
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/release/0.18/conan.cmake" "${CMAKE_BINARY_DIR}/conan.cmake")
|
||||
endif()
|
||||
include(${CMAKE_BINARY_DIR}/conan.cmake)
|
||||
|
||||
conan_check(VERSION 1.41.0 REQUIRED)
|
||||
conan_check(VERSION 1.45.0 REQUIRED)
|
||||
|
||||
# Manually add iconv to fix a dep conflict between qt and sdl2
|
||||
# We don't need to add it through find_package or anything since the other two can find it just fine
|
||||
|
||||
@@ -135,7 +135,7 @@ void Fiber::YieldTo(std::weak_ptr<Fiber> weak_from, Fiber& to) {
|
||||
}
|
||||
|
||||
std::shared_ptr<Fiber> Fiber::ThreadToFiber() {
|
||||
std::shared_ptr<Fiber> fiber = std::shared_ptr<Fiber>{new Fiber()};
|
||||
auto fiber = std::make_shared<Fiber>();
|
||||
fiber->impl->guard.lock();
|
||||
fiber->impl->is_thread_fiber = true;
|
||||
return fiber;
|
||||
|
||||
@@ -120,7 +120,7 @@ private:
|
||||
// and a pointer to the next ElementPtr
|
||||
class ElementPtr {
|
||||
public:
|
||||
ElementPtr() {}
|
||||
ElementPtr() = default;
|
||||
~ElementPtr() {
|
||||
ElementPtr* next_ptr = next.load();
|
||||
|
||||
|
||||
@@ -174,9 +174,6 @@ public:
|
||||
/// Clears the exclusive monitor's state.
|
||||
virtual void ClearExclusiveState() = 0;
|
||||
|
||||
/// Prepare core for thread reschedule (if needed to correctly handle state)
|
||||
virtual void PrepareReschedule() = 0;
|
||||
|
||||
/// Signal an interrupt and ask the core to halt as soon as possible.
|
||||
virtual void SignalInterrupt() = 0;
|
||||
|
||||
|
||||
@@ -327,10 +327,6 @@ void ARM_Dynarmic_32::LoadContext(const ThreadContext32& ctx) {
|
||||
jit.load()->LoadContext(context);
|
||||
}
|
||||
|
||||
void ARM_Dynarmic_32::PrepareReschedule() {
|
||||
jit.load()->HaltExecution(break_loop);
|
||||
}
|
||||
|
||||
void ARM_Dynarmic_32::SignalInterrupt() {
|
||||
jit.load()->HaltExecution(break_loop);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@ public:
|
||||
void LoadContext(const ThreadContext32& ctx) override;
|
||||
void LoadContext(const ThreadContext64& ctx) override {}
|
||||
|
||||
void PrepareReschedule() override;
|
||||
void SignalInterrupt() override;
|
||||
void ClearExclusiveState() override;
|
||||
|
||||
|
||||
@@ -395,10 +395,6 @@ void ARM_Dynarmic_64::LoadContext(const ThreadContext64& ctx) {
|
||||
SetTPIDR_EL0(ctx.tpidr);
|
||||
}
|
||||
|
||||
void ARM_Dynarmic_64::PrepareReschedule() {
|
||||
jit.load()->HaltExecution(break_loop);
|
||||
}
|
||||
|
||||
void ARM_Dynarmic_64::SignalInterrupt() {
|
||||
jit.load()->HaltExecution(break_loop);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ public:
|
||||
void LoadContext(const ThreadContext32& ctx) override {}
|
||||
void LoadContext(const ThreadContext64& ctx) override;
|
||||
|
||||
void PrepareReschedule() override;
|
||||
void SignalInterrupt() override;
|
||||
void ClearExclusiveState() override;
|
||||
|
||||
|
||||
@@ -505,10 +505,6 @@ bool System::IsPoweredOn() const {
|
||||
return impl->is_powered_on.load(std::memory_order::relaxed);
|
||||
}
|
||||
|
||||
void System::PrepareReschedule() {
|
||||
// Deprecated, does nothing, kept for backward compatibility.
|
||||
}
|
||||
|
||||
void System::PrepareReschedule(const u32 core_index) {
|
||||
impl->kernel.PrepareReschedule(core_index);
|
||||
}
|
||||
|
||||
@@ -193,9 +193,6 @@ public:
|
||||
/// Gets a reference to the telemetry session for this emulation session.
|
||||
[[nodiscard]] const Core::TelemetrySession& TelemetrySession() const;
|
||||
|
||||
/// Prepare the core emulation for a reschedule
|
||||
void PrepareReschedule();
|
||||
|
||||
/// Prepare the core emulation for a reschedule
|
||||
void PrepareReschedule(u32 core_index);
|
||||
|
||||
|
||||
@@ -717,7 +717,6 @@ InstallResult RegisteredCache::RawInstallNCA(const NCA& nca, const VfsCopyFuncti
|
||||
bool overwrite_if_exists,
|
||||
std::optional<NcaID> override_id) {
|
||||
const auto in = nca.GetBaseFile();
|
||||
Core::Crypto::SHA256Hash hash{};
|
||||
|
||||
// Calculate NcaID
|
||||
// NOTE: Because computing the SHA256 of an entire NCA is quite expensive (especially if the
|
||||
@@ -727,6 +726,7 @@ InstallResult RegisteredCache::RawInstallNCA(const NCA& nca, const VfsCopyFuncti
|
||||
if (override_id) {
|
||||
id = *override_id;
|
||||
} else {
|
||||
Core::Crypto::SHA256Hash hash{};
|
||||
const auto& data = in->ReadBytes(0x100000);
|
||||
mbedtls_sha256_ret(data.data(), data.size(), hash.data(), 0);
|
||||
memcpy(id.data(), hash.data(), 16);
|
||||
|
||||
@@ -21,8 +21,8 @@ void DefaultErrorApplet::ShowErrorWithTimestamp(ResultCode error, std::chrono::s
|
||||
error.module.Value(), error.description.Value(), error.raw, time.count());
|
||||
}
|
||||
|
||||
void DefaultErrorApplet::ShowCustomErrorText(ResultCode error, std::string main_text,
|
||||
std::string detail_text,
|
||||
void DefaultErrorApplet::ShowCustomErrorText(ResultCode error, std::string_view main_text,
|
||||
std::string_view detail_text,
|
||||
std::function<void()> finished) const {
|
||||
LOG_CRITICAL(Service_Fatal,
|
||||
"Application requested custom error with error_code={:04X}-{:04X} (raw={:08X})",
|
||||
|
||||
@@ -19,8 +19,8 @@ public:
|
||||
virtual void ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time,
|
||||
std::function<void()> finished) const = 0;
|
||||
|
||||
virtual void ShowCustomErrorText(ResultCode error, std::string dialog_text,
|
||||
std::string fullscreen_text,
|
||||
virtual void ShowCustomErrorText(ResultCode error, std::string_view dialog_text,
|
||||
std::string_view fullscreen_text,
|
||||
std::function<void()> finished) const = 0;
|
||||
};
|
||||
|
||||
@@ -29,7 +29,8 @@ public:
|
||||
void ShowError(ResultCode error, std::function<void()> finished) const override;
|
||||
void ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time,
|
||||
std::function<void()> finished) const override;
|
||||
void ShowCustomErrorText(ResultCode error, std::string main_text, std::string detail_text,
|
||||
void ShowCustomErrorText(ResultCode error, std::string_view main_text,
|
||||
std::string_view detail_text,
|
||||
std::function<void()> finished) const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -91,7 +91,6 @@ void MotionInput::UpdateOrientation(u64 elapsed_time) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto normal_accel = accel.Normalized();
|
||||
auto rad_gyro = gyro * Common::PI * 2;
|
||||
const f32 swap = rad_gyro.x;
|
||||
rad_gyro.x = rad_gyro.y;
|
||||
@@ -107,6 +106,7 @@ void MotionInput::UpdateOrientation(u64 elapsed_time) {
|
||||
|
||||
// Ignore drift correction if acceleration is not reliable
|
||||
if (accel.Length() >= 0.75f && accel.Length() <= 1.25f) {
|
||||
const auto normal_accel = accel.Normalized();
|
||||
const f32 ax = -normal_accel.x;
|
||||
const f32 ay = normal_accel.y;
|
||||
const f32 az = -normal_accel.z;
|
||||
|
||||
@@ -85,11 +85,11 @@ void KMemoryBlockManager::Update(VAddr addr, std::size_t num_pages, KMemoryState
|
||||
|
||||
iterator new_node{node};
|
||||
if (addr > cur_addr) {
|
||||
memory_block_tree.insert(node, block->Split(addr));
|
||||
memory_block_tree.emplace(node, block->Split(addr));
|
||||
}
|
||||
|
||||
if (update_end_addr < cur_end_addr) {
|
||||
new_node = memory_block_tree.insert(node, block->Split(update_end_addr));
|
||||
new_node = memory_block_tree.emplace(node, block->Split(update_end_addr));
|
||||
}
|
||||
|
||||
new_node->Update(state, perm, attribute);
|
||||
@@ -120,11 +120,11 @@ void KMemoryBlockManager::Update(VAddr addr, std::size_t num_pages, KMemoryState
|
||||
iterator new_node{node};
|
||||
|
||||
if (addr > cur_addr) {
|
||||
memory_block_tree.insert(node, block->Split(addr));
|
||||
memory_block_tree.emplace(node, block->Split(addr));
|
||||
}
|
||||
|
||||
if (update_end_addr < cur_end_addr) {
|
||||
new_node = memory_block_tree.insert(node, block->Split(update_end_addr));
|
||||
new_node = memory_block_tree.emplace(node, block->Split(update_end_addr));
|
||||
}
|
||||
|
||||
new_node->Update(state, perm, attribute);
|
||||
@@ -155,11 +155,11 @@ void KMemoryBlockManager::UpdateLock(VAddr addr, std::size_t num_pages, LockFunc
|
||||
iterator new_node{node};
|
||||
|
||||
if (addr > cur_addr) {
|
||||
memory_block_tree.insert(node, block->Split(addr));
|
||||
memory_block_tree.emplace(node, block->Split(addr));
|
||||
}
|
||||
|
||||
if (update_end_addr < cur_end_addr) {
|
||||
new_node = memory_block_tree.insert(node, block->Split(update_end_addr));
|
||||
new_node = memory_block_tree.emplace(node, block->Split(update_end_addr));
|
||||
}
|
||||
|
||||
lock_func(new_node, perm);
|
||||
|
||||
@@ -35,7 +35,7 @@ void KServerSession::Initialize(KSession* parent_session_, std::string&& name_,
|
||||
name = std::move(name_);
|
||||
|
||||
if (manager_) {
|
||||
manager = manager_;
|
||||
manager = std::move(manager_);
|
||||
} else {
|
||||
manager = std::make_shared<SessionRequestManager>(kernel);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
|
||||
public:
|
||||
KAutoObjectWithSlabHeapAndContainer(KernelCore& kernel_) : Base(kernel_), kernel(kernel_) {}
|
||||
virtual ~KAutoObjectWithSlabHeapAndContainer() {}
|
||||
virtual ~KAutoObjectWithSlabHeapAndContainer() = default;
|
||||
|
||||
virtual void Destroy() override {
|
||||
const bool is_initialized = this->IsInitialized();
|
||||
|
||||
@@ -899,7 +899,7 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
|
||||
|
||||
// Verify the requested core is valid.
|
||||
const bool core_valid =
|
||||
(info_sub_id == static_cast<u64>(-1ULL)) ||
|
||||
(info_sub_id == 0xFFFFFFFFFFFFFFFF) ||
|
||||
(info_sub_id == static_cast<u64>(system.Kernel().CurrentPhysicalCoreIndex()));
|
||||
R_UNLESS(core_valid, ResultInvalidCombination);
|
||||
|
||||
|
||||
@@ -187,9 +187,9 @@ ResultCode VfsDirectoryServiceWrapper::RenameDirectory(const std::string& src_pa
|
||||
const std::string& dest_path_) const {
|
||||
std::string src_path(Common::FS::SanitizePath(src_path_));
|
||||
std::string dest_path(Common::FS::SanitizePath(dest_path_));
|
||||
auto src = GetDirectoryRelativeWrapped(backing, src_path);
|
||||
if (Common::FS::GetParentPath(src_path) == Common::FS::GetParentPath(dest_path)) {
|
||||
// Use more-optimized vfs implementation rename.
|
||||
auto src = GetDirectoryRelativeWrapped(backing, src_path);
|
||||
if (src == nullptr)
|
||||
return FileSys::ERROR_PATH_NOT_FOUND;
|
||||
if (!src->Rename(Common::FS::GetFilename(dest_path))) {
|
||||
@@ -772,10 +772,10 @@ void FileSystemController::CreateFactories(FileSys::VfsFilesystem& vfs, bool ove
|
||||
vfs.OpenDirectory(Common::FS::GetYuzuPathString(YuzuPath::LoadDir), FileSys::Mode::Read);
|
||||
auto sd_load_directory =
|
||||
vfs.OpenDirectory(Common::FS::PathToUTF8String(sdmc_load_dir_path), FileSys::Mode::Read);
|
||||
auto dump_directory =
|
||||
vfs.OpenDirectory(Common::FS::GetYuzuPathString(YuzuPath::DumpDir), rw_mode);
|
||||
|
||||
if (bis_factory == nullptr) {
|
||||
auto dump_directory =
|
||||
vfs.OpenDirectory(Common::FS::GetYuzuPathString(YuzuPath::DumpDir), rw_mode);
|
||||
bis_factory = std::make_unique<FileSys::BISFactory>(
|
||||
nand_directory, std::move(load_directory), std::move(dump_directory));
|
||||
system.RegisterContentProvider(FileSys::ContentProviderUnionSlot::SysNAND,
|
||||
|
||||
@@ -21,9 +21,10 @@ struct CodeRange {
|
||||
|
||||
class IJitEnvironment final : public ServiceFramework<IJitEnvironment> {
|
||||
public:
|
||||
explicit IJitEnvironment(Core::System& system_, CodeRange user_rx, CodeRange user_ro)
|
||||
explicit IJitEnvironment(Core::System& system_, Kernel::KProcess& process_, CodeRange user_rx,
|
||||
CodeRange user_ro)
|
||||
: ServiceFramework{system_, "IJitEnvironment", ServiceThreadType::CreateNew},
|
||||
context{system_.Memory()} {
|
||||
process{&process_}, context{system_.Memory()} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, &IJitEnvironment::GenerateCode, "GenerateCode"},
|
||||
@@ -43,54 +44,80 @@ public:
|
||||
}
|
||||
|
||||
void GenerateCode(Kernel::HLERequestContext& ctx) {
|
||||
struct Parameters {
|
||||
LOG_DEBUG(Service_JIT, "called");
|
||||
|
||||
struct InputParameters {
|
||||
u32 data_size;
|
||||
u64 command;
|
||||
CodeRange cr1;
|
||||
CodeRange cr2;
|
||||
std::array<CodeRange, 2> ranges;
|
||||
Struct32 data;
|
||||
};
|
||||
|
||||
struct OutputParameters {
|
||||
s32 return_value;
|
||||
std::array<CodeRange, 2> ranges;
|
||||
};
|
||||
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto parameters{rp.PopRaw<Parameters>()};
|
||||
const auto parameters{rp.PopRaw<InputParameters>()};
|
||||
|
||||
// Optional input/output buffers
|
||||
std::vector<u8> input_buffer{ctx.CanReadBuffer() ? ctx.ReadBuffer() : std::vector<u8>()};
|
||||
std::vector<u8> output_buffer(ctx.CanWriteBuffer() ? ctx.GetWriteBufferSize() : 0);
|
||||
|
||||
const VAddr return_ptr{context.AddHeap(0u)};
|
||||
const VAddr cr1_in_ptr{context.AddHeap(parameters.cr1)};
|
||||
const VAddr cr2_in_ptr{context.AddHeap(parameters.cr2)};
|
||||
const VAddr cr1_out_ptr{
|
||||
context.AddHeap(CodeRange{.offset = parameters.cr1.offset, .size = 0})};
|
||||
const VAddr cr2_out_ptr{
|
||||
context.AddHeap(CodeRange{.offset = parameters.cr2.offset, .size = 0})};
|
||||
// Function call prototype:
|
||||
// void GenerateCode(s32* ret, CodeRange* c0_out, CodeRange* c1_out, JITConfiguration* cfg,
|
||||
// u64 cmd, u8* input_buf, size_t input_size, CodeRange* c0_in,
|
||||
// CodeRange* c1_in, Struct32* data, size_t data_size, u8* output_buf,
|
||||
// size_t output_size);
|
||||
//
|
||||
// The command argument is used to control the behavior of the plugin during code
|
||||
// generation. The configuration allows the plugin to access the output code ranges, and the
|
||||
// other arguments are used to transfer state between the game and the plugin.
|
||||
|
||||
const VAddr ret_ptr{context.AddHeap(0u)};
|
||||
const VAddr c0_in_ptr{context.AddHeap(parameters.ranges[0])};
|
||||
const VAddr c1_in_ptr{context.AddHeap(parameters.ranges[1])};
|
||||
const VAddr c0_out_ptr{context.AddHeap(ClearSize(parameters.ranges[0]))};
|
||||
const VAddr c1_out_ptr{context.AddHeap(ClearSize(parameters.ranges[1]))};
|
||||
|
||||
const VAddr input_ptr{context.AddHeap(input_buffer.data(), input_buffer.size())};
|
||||
const VAddr output_ptr{context.AddHeap(output_buffer.data(), output_buffer.size())};
|
||||
const VAddr data_ptr{context.AddHeap(parameters.data)};
|
||||
const VAddr configuration_ptr{context.AddHeap(configuration)};
|
||||
|
||||
context.CallFunction(callbacks.GenerateCode, return_ptr, cr1_out_ptr, cr2_out_ptr,
|
||||
// The callback does not directly return a value, it only writes to the output pointer
|
||||
context.CallFunction(callbacks.GenerateCode, ret_ptr, c0_out_ptr, c1_out_ptr,
|
||||
configuration_ptr, parameters.command, input_ptr, input_buffer.size(),
|
||||
cr1_in_ptr, cr2_in_ptr, data_ptr, parameters.data_size, output_ptr,
|
||||
c0_in_ptr, c1_in_ptr, data_ptr, parameters.data_size, output_ptr,
|
||||
output_buffer.size());
|
||||
|
||||
const s32 return_value{context.GetHeap<s32>(return_ptr)};
|
||||
const s32 return_value{context.GetHeap<s32>(ret_ptr)};
|
||||
|
||||
if (return_value == 0) {
|
||||
// The callback has written to the output executable code range,
|
||||
// requiring an instruction cache invalidation
|
||||
system.InvalidateCpuInstructionCacheRange(configuration.user_rx_memory.offset,
|
||||
configuration.user_rx_memory.size);
|
||||
|
||||
// Write back to the IPC output buffer, if provided
|
||||
if (ctx.CanWriteBuffer()) {
|
||||
context.GetHeap(output_ptr, output_buffer.data(), output_buffer.size());
|
||||
ctx.WriteBuffer(output_buffer.data(), output_buffer.size());
|
||||
}
|
||||
const auto cr1_out{context.GetHeap<CodeRange>(cr1_out_ptr)};
|
||||
const auto cr2_out{context.GetHeap<CodeRange>(cr2_out_ptr)};
|
||||
|
||||
const OutputParameters out{
|
||||
.return_value = return_value,
|
||||
.ranges =
|
||||
{
|
||||
context.GetHeap<CodeRange>(c0_out_ptr),
|
||||
context.GetHeap<CodeRange>(c1_out_ptr),
|
||||
},
|
||||
};
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 8};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u64>(return_value);
|
||||
rb.PushRaw(cr1_out);
|
||||
rb.PushRaw(cr2_out);
|
||||
rb.PushRaw(out);
|
||||
} else {
|
||||
LOG_WARNING(Service_JIT, "plugin GenerateCode callback failed");
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
@@ -99,25 +126,40 @@ public:
|
||||
};
|
||||
|
||||
void Control(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_JIT, "called");
|
||||
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto command{rp.PopRaw<u64>()};
|
||||
const auto input_buffer{ctx.ReadBuffer()};
|
||||
|
||||
// Optional input/output buffers
|
||||
std::vector<u8> input_buffer{ctx.CanReadBuffer() ? ctx.ReadBuffer() : std::vector<u8>()};
|
||||
std::vector<u8> output_buffer(ctx.CanWriteBuffer() ? ctx.GetWriteBufferSize() : 0);
|
||||
|
||||
const VAddr return_ptr{context.AddHeap(0u)};
|
||||
// Function call prototype:
|
||||
// u64 Control(s32* ret, JITConfiguration* cfg, u64 cmd, u8* input_buf, size_t input_size,
|
||||
// u8* output_buf, size_t output_size);
|
||||
//
|
||||
// This function is used to set up the state of the plugin before code generation, generally
|
||||
// passing objects like pointers to VM state from the game. It is usually called once.
|
||||
|
||||
const VAddr ret_ptr{context.AddHeap(0u)};
|
||||
const VAddr configuration_ptr{context.AddHeap(configuration)};
|
||||
const VAddr input_ptr{context.AddHeap(input_buffer.data(), input_buffer.size())};
|
||||
const VAddr output_ptr{context.AddHeap(output_buffer.data(), output_buffer.size())};
|
||||
const u64 wrapper_value{
|
||||
context.CallFunction(callbacks.Control, return_ptr, configuration_ptr, command,
|
||||
input_ptr, input_buffer.size(), output_ptr, output_buffer.size())};
|
||||
const s32 return_value{context.GetHeap<s32>(return_ptr)};
|
||||
|
||||
const u64 wrapper_value{context.CallFunction(callbacks.Control, ret_ptr, configuration_ptr,
|
||||
command, input_ptr, input_buffer.size(),
|
||||
output_ptr, output_buffer.size())};
|
||||
|
||||
const s32 return_value{context.GetHeap<s32>(ret_ptr)};
|
||||
|
||||
if (wrapper_value == 0 && return_value == 0) {
|
||||
// Write back to the IPC output buffer, if provided
|
||||
if (ctx.CanWriteBuffer()) {
|
||||
context.GetHeap(output_ptr, output_buffer.data(), output_buffer.size());
|
||||
ctx.WriteBuffer(output_buffer.data(), output_buffer.size());
|
||||
}
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 3};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(return_value);
|
||||
@@ -129,8 +171,13 @@ public:
|
||||
}
|
||||
|
||||
void LoadPlugin(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_JIT, "called");
|
||||
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto tmem_size{rp.PopRaw<u64>()};
|
||||
const auto tmem_handle{ctx.GetCopyHandle(0)};
|
||||
const auto nro_plugin{ctx.ReadBuffer(1)};
|
||||
|
||||
if (tmem_size == 0) {
|
||||
LOG_ERROR(Service_JIT, "attempted to load plugin with empty transfer memory");
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
@@ -138,9 +185,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
const auto tmem_handle{ctx.GetCopyHandle(0)};
|
||||
auto tmem{system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(
|
||||
tmem_handle)};
|
||||
auto tmem{process->GetHandleTable().GetObject<Kernel::KTransferMemory>(tmem_handle)};
|
||||
if (tmem.IsNull()) {
|
||||
LOG_ERROR(Service_JIT, "attempted to load plugin with invalid transfer memory handle");
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
@@ -148,24 +193,24 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
configuration.work_memory.offset = tmem->GetSourceAddress();
|
||||
configuration.work_memory.size = tmem_size;
|
||||
// Set up the configuration with the required TransferMemory address
|
||||
configuration.transfer_memory.offset = tmem->GetSourceAddress();
|
||||
configuration.transfer_memory.size = tmem_size;
|
||||
|
||||
const auto nro_plugin{ctx.ReadBuffer(1)};
|
||||
// Gather up all the callbacks from the loaded plugin
|
||||
auto symbols{Core::Symbols::GetSymbols(nro_plugin, true)};
|
||||
const auto GetSymbol{[&](std::string name) { return symbols[name].first; }};
|
||||
const auto GetSymbol{[&](const std::string& name) { return symbols[name].first; }};
|
||||
|
||||
callbacks =
|
||||
GuestCallbacks{.rtld_fini = GetSymbol("_fini"),
|
||||
.rtld_init = GetSymbol("_init"),
|
||||
.Control = GetSymbol("nnjitpluginControl"),
|
||||
.ResolveBasicSymbols = GetSymbol("nnjitpluginResolveBasicSymbols"),
|
||||
.SetupDiagnostics = GetSymbol("nnjitpluginSetupDiagnostics"),
|
||||
.Configure = GetSymbol("nnjitpluginConfigure"),
|
||||
.GenerateCode = GetSymbol("nnjitpluginGenerateCode"),
|
||||
.GetVersion = GetSymbol("nnjitpluginGetVersion"),
|
||||
.Keeper = GetSymbol("nnjitpluginKeeper"),
|
||||
.OnPrepared = GetSymbol("nnjitpluginOnPrepared")};
|
||||
callbacks.rtld_fini = GetSymbol("_fini");
|
||||
callbacks.rtld_init = GetSymbol("_init");
|
||||
callbacks.Control = GetSymbol("nnjitpluginControl");
|
||||
callbacks.ResolveBasicSymbols = GetSymbol("nnjitpluginResolveBasicSymbols");
|
||||
callbacks.SetupDiagnostics = GetSymbol("nnjitpluginSetupDiagnostics");
|
||||
callbacks.Configure = GetSymbol("nnjitpluginConfigure");
|
||||
callbacks.GenerateCode = GetSymbol("nnjitpluginGenerateCode");
|
||||
callbacks.GetVersion = GetSymbol("nnjitpluginGetVersion");
|
||||
callbacks.OnPrepared = GetSymbol("nnjitpluginOnPrepared");
|
||||
callbacks.Keeper = GetSymbol("nnjitpluginKeeper");
|
||||
|
||||
if (callbacks.GetVersion == 0 || callbacks.Configure == 0 || callbacks.GenerateCode == 0 ||
|
||||
callbacks.OnPrepared == 0) {
|
||||
@@ -186,12 +231,16 @@ public:
|
||||
configuration.sys_ro_memory.size);
|
||||
context.MapProcessMemory(configuration.sys_rx_memory.offset,
|
||||
configuration.sys_rx_memory.size);
|
||||
context.MapProcessMemory(configuration.work_memory.offset, configuration.work_memory.size);
|
||||
context.MapProcessMemory(configuration.transfer_memory.offset,
|
||||
configuration.transfer_memory.size);
|
||||
|
||||
// Run ELF constructors, if needed
|
||||
if (callbacks.rtld_init != 0) {
|
||||
context.CallFunction(callbacks.rtld_init);
|
||||
}
|
||||
|
||||
// Function prototype:
|
||||
// u64 GetVersion();
|
||||
const auto version{context.CallFunction(callbacks.GetVersion)};
|
||||
if (version != 1) {
|
||||
LOG_ERROR(Service_JIT, "unknown plugin version {}", version);
|
||||
@@ -200,16 +249,26 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
// Function prototype:
|
||||
// void ResolveBasicSymbols(void (*resolver)(const char* name));
|
||||
const auto resolve{context.GetHelper("_resolve")};
|
||||
if (callbacks.ResolveBasicSymbols != 0) {
|
||||
context.CallFunction(callbacks.ResolveBasicSymbols, resolve);
|
||||
}
|
||||
|
||||
// Function prototype:
|
||||
// void SetupDiagnostics(u32 enabled, void (**resolver)(const char* name));
|
||||
const auto resolve_ptr{context.AddHeap(resolve)};
|
||||
if (callbacks.SetupDiagnostics != 0) {
|
||||
context.CallFunction(callbacks.SetupDiagnostics, 0u, resolve_ptr);
|
||||
}
|
||||
|
||||
context.CallFunction(callbacks.Configure, 0u);
|
||||
// Function prototype:
|
||||
// void Configure(u32* memory_flags);
|
||||
context.CallFunction(callbacks.Configure, 0ull);
|
||||
|
||||
// Function prototype:
|
||||
// void OnPrepared(JITConfiguration* cfg);
|
||||
const auto configuration_ptr{context.AddHeap(configuration)};
|
||||
context.CallFunction(callbacks.OnPrepared, configuration_ptr);
|
||||
|
||||
@@ -218,6 +277,8 @@ public:
|
||||
}
|
||||
|
||||
void GetCodeAddress(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_JIT, "called");
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 6};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(configuration.user_rx_memory.offset);
|
||||
@@ -243,11 +304,17 @@ private:
|
||||
struct JITConfiguration {
|
||||
CodeRange user_rx_memory;
|
||||
CodeRange user_ro_memory;
|
||||
CodeRange work_memory;
|
||||
CodeRange transfer_memory;
|
||||
CodeRange sys_rx_memory;
|
||||
CodeRange sys_ro_memory;
|
||||
};
|
||||
|
||||
static CodeRange ClearSize(CodeRange in) {
|
||||
in.size = 0;
|
||||
return in;
|
||||
}
|
||||
|
||||
Kernel::KScopedAutoObject<Kernel::KProcess> process;
|
||||
GuestCallbacks callbacks;
|
||||
JITConfiguration configuration;
|
||||
JITContext context;
|
||||
@@ -275,8 +342,9 @@ public:
|
||||
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto parameters{rp.PopRaw<Parameters>()};
|
||||
const auto executable_mem_handle{ctx.GetCopyHandle(1)};
|
||||
const auto readable_mem_handle{ctx.GetCopyHandle(2)};
|
||||
const auto process_handle{ctx.GetCopyHandle(0)};
|
||||
const auto rx_mem_handle{ctx.GetCopyHandle(1)};
|
||||
const auto ro_mem_handle{ctx.GetCopyHandle(2)};
|
||||
|
||||
if (parameters.rx_size == 0 || parameters.ro_size == 0) {
|
||||
LOG_ERROR(Service_JIT, "attempted to init with empty code regions");
|
||||
@@ -285,42 +353,47 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
// The copy handle at index 0 is the process handle, but handle tables are
|
||||
// per-process, so there is no point reading it here until we are multiprocess
|
||||
const auto& process{*system.CurrentProcess()};
|
||||
// Fetch using the handle table for the current process here,
|
||||
// since we are not multiprocess yet.
|
||||
const auto& handle_table{system.CurrentProcess()->GetHandleTable()};
|
||||
|
||||
auto executable_mem{
|
||||
process.GetHandleTable().GetObject<Kernel::KCodeMemory>(executable_mem_handle)};
|
||||
if (executable_mem.IsNull()) {
|
||||
LOG_ERROR(Service_JIT, "executable_mem is null for handle=0x{:08X}",
|
||||
executable_mem_handle);
|
||||
auto process{handle_table.GetObject<Kernel::KProcess>(process_handle)};
|
||||
if (process.IsNull()) {
|
||||
LOG_ERROR(Service_JIT, "process is null for handle=0x{:08X}", process_handle);
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(ResultUnknown);
|
||||
return;
|
||||
}
|
||||
|
||||
auto readable_mem{
|
||||
process.GetHandleTable().GetObject<Kernel::KCodeMemory>(readable_mem_handle)};
|
||||
if (readable_mem.IsNull()) {
|
||||
LOG_ERROR(Service_JIT, "readable_mem is null for handle=0x{:08X}", readable_mem_handle);
|
||||
auto rx_mem{handle_table.GetObject<Kernel::KCodeMemory>(rx_mem_handle)};
|
||||
if (rx_mem.IsNull()) {
|
||||
LOG_ERROR(Service_JIT, "rx_mem is null for handle=0x{:08X}", rx_mem_handle);
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(ResultUnknown);
|
||||
return;
|
||||
}
|
||||
|
||||
auto ro_mem{handle_table.GetObject<Kernel::KCodeMemory>(ro_mem_handle)};
|
||||
if (ro_mem.IsNull()) {
|
||||
LOG_ERROR(Service_JIT, "ro_mem is null for handle=0x{:08X}", ro_mem_handle);
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(ResultUnknown);
|
||||
return;
|
||||
}
|
||||
|
||||
const CodeRange user_rx{
|
||||
.offset = executable_mem->GetSourceAddress(),
|
||||
.offset = rx_mem->GetSourceAddress(),
|
||||
.size = parameters.rx_size,
|
||||
};
|
||||
|
||||
const CodeRange user_ro{
|
||||
.offset = readable_mem->GetSourceAddress(),
|
||||
.offset = ro_mem->GetSourceAddress(),
|
||||
.size = parameters.ro_size,
|
||||
};
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushIpcInterface<IJitEnvironment>(system, user_rx, user_ro);
|
||||
rb.PushIpcInterface<IJitEnvironment>(system, *process, user_rx, user_ro);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -17,61 +17,15 @@
|
||||
|
||||
namespace Service::JIT {
|
||||
|
||||
constexpr std::array<u8, 4> STOP_ARM64 = {
|
||||
constexpr std::array<u8, 8> SVC0_ARM64 = {
|
||||
0x01, 0x00, 0x00, 0xd4, // svc #0
|
||||
};
|
||||
|
||||
constexpr std::array<u8, 8> RESOLVE_ARM64 = {
|
||||
0x21, 0x00, 0x00, 0xd4, // svc #1
|
||||
0xc0, 0x03, 0x5f, 0xd6, // ret
|
||||
};
|
||||
|
||||
constexpr std::array<u8, 4> PANIC_ARM64 = {
|
||||
0x41, 0x00, 0x00, 0xd4, // svc #2
|
||||
constexpr std::array HELPER_FUNCTIONS{
|
||||
"_stop", "_resolve", "_panic", "memcpy", "memmove", "memset",
|
||||
};
|
||||
|
||||
constexpr std::array<u8, 60> MEMMOVE_ARM64 = {
|
||||
0x1f, 0x00, 0x01, 0xeb, // cmp x0, x1
|
||||
0x83, 0x01, 0x00, 0x54, // b.lo #+34
|
||||
0x42, 0x04, 0x00, 0xd1, // sub x2, x2, 1
|
||||
0x22, 0x01, 0xf8, 0xb7, // tbnz x2, #63, #+36
|
||||
0x23, 0x68, 0x62, 0x38, // ldrb w3, [x1, x2]
|
||||
0x03, 0x68, 0x22, 0x38, // strb w3, [x0, x2]
|
||||
0xfc, 0xff, 0xff, 0x17, // b #-16
|
||||
0x24, 0x68, 0x63, 0x38, // ldrb w4, [x1, x3]
|
||||
0x04, 0x68, 0x23, 0x38, // strb w4, [x0, x3]
|
||||
0x63, 0x04, 0x00, 0x91, // add x3, x3, 1
|
||||
0x7f, 0x00, 0x02, 0xeb, // cmp x3, x2
|
||||
0x8b, 0xff, 0xff, 0x54, // b.lt #-16
|
||||
0xc0, 0x03, 0x5f, 0xd6, // ret
|
||||
0x03, 0x00, 0x80, 0xd2, // mov x3, 0
|
||||
0xfc, 0xff, 0xff, 0x17, // b #-16
|
||||
};
|
||||
|
||||
constexpr std::array<u8, 28> MEMSET_ARM64 = {
|
||||
0x03, 0x00, 0x80, 0xd2, // mov x3, 0
|
||||
0x7f, 0x00, 0x02, 0xeb, // cmp x3, x2
|
||||
0x4b, 0x00, 0x00, 0x54, // b.lt #+8
|
||||
0xc0, 0x03, 0x5f, 0xd6, // ret
|
||||
0x01, 0x68, 0x23, 0x38, // strb w1, [x0, x3]
|
||||
0x63, 0x04, 0x00, 0x91, // add x3, x3, 1
|
||||
0xfb, 0xff, 0xff, 0x17, // b #-20
|
||||
};
|
||||
|
||||
struct HelperFunction {
|
||||
const char* name;
|
||||
const std::span<const u8> data;
|
||||
};
|
||||
|
||||
constexpr std::array<HelperFunction, 6> HELPER_FUNCTIONS{{
|
||||
{"_stop", STOP_ARM64},
|
||||
{"_resolve", RESOLVE_ARM64},
|
||||
{"_panic", PANIC_ARM64},
|
||||
{"memcpy", MEMMOVE_ARM64},
|
||||
{"memmove", MEMMOVE_ARM64},
|
||||
{"memset", MEMSET_ARM64},
|
||||
}};
|
||||
|
||||
struct Elf64_Dyn {
|
||||
u64 d_tag;
|
||||
u64 d_un;
|
||||
@@ -224,17 +178,24 @@ public:
|
||||
InsertHelperFunctions();
|
||||
InsertStack();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FixupRelocations() {
|
||||
// The loaded NRO file has ELF relocations that must be processed before it can run.
|
||||
// Normally this would be processed by RTLD, but in HLE context, we don't have
|
||||
// the linker available, so we have to do it ourselves.
|
||||
|
||||
const VAddr mod_offset{callbacks->MemoryRead32(4)};
|
||||
if (callbacks->MemoryRead32(mod_offset) != Common::MakeMagic('M', 'O', 'D', '0')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// For more info about dynamic entries, see the ELF ABI specification:
|
||||
// https://refspecs.linuxbase.org/elf/gabi4+/ch5.dynamic.html
|
||||
// https://refspecs.linuxbase.org/elf/gabi4+/ch4.reloc.html
|
||||
VAddr dynamic_offset{mod_offset + callbacks->MemoryRead32(mod_offset + 4)};
|
||||
VAddr rela_dyn = 0;
|
||||
size_t num_rela = 0;
|
||||
@@ -266,13 +227,15 @@ public:
|
||||
}
|
||||
|
||||
void InsertHelperFunctions() {
|
||||
for (const auto& [name, contents] : HELPER_FUNCTIONS) {
|
||||
for (const auto& name : HELPER_FUNCTIONS) {
|
||||
helpers[name] = local_memory.size();
|
||||
local_memory.insert(local_memory.end(), contents.begin(), contents.end());
|
||||
local_memory.insert(local_memory.end(), SVC0_ARM64.begin(), SVC0_ARM64.end());
|
||||
}
|
||||
}
|
||||
|
||||
void InsertStack() {
|
||||
// Allocate enough space to avoid any reasonable risk of
|
||||
// overflowing the stack during plugin execution
|
||||
const u64 pad_amount{Common::AlignUp(local_memory.size(), STACK_ALIGN) -
|
||||
local_memory.size()};
|
||||
local_memory.insert(local_memory.end(), 0x10000 + pad_amount, 0);
|
||||
@@ -292,9 +255,21 @@ public:
|
||||
}
|
||||
|
||||
void SetupArguments() {
|
||||
// The first 8 integer registers are used for the first 8 integer
|
||||
// arguments. Floating-point arguments are not handled at this time.
|
||||
//
|
||||
// If a function takes more than 8 arguments, then stack space is reserved
|
||||
// for the remaining arguments, and the remaining arguments are inserted in
|
||||
// ascending memory order, each argument aligned to an 8-byte boundary. The
|
||||
// stack pointer must remain aligned to 16 bytes.
|
||||
//
|
||||
// For more info, see the AArch64 ABI PCS:
|
||||
// https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst
|
||||
|
||||
for (size_t i = 0; i < 8 && i < argument_stack.size(); i++) {
|
||||
jit->SetRegister(i, argument_stack[i]);
|
||||
}
|
||||
|
||||
if (argument_stack.size() > 8) {
|
||||
const VAddr new_sp = Common::AlignDown(
|
||||
top_of_stack - (argument_stack.size() - 8) * sizeof(u64), STACK_ALIGN);
|
||||
@@ -303,6 +278,8 @@ public:
|
||||
}
|
||||
jit->SetSP(new_sp);
|
||||
}
|
||||
|
||||
// Reset the call state for the next invocation
|
||||
argument_stack.clear();
|
||||
heap_pointer = top_of_stack;
|
||||
}
|
||||
@@ -322,11 +299,16 @@ public:
|
||||
}
|
||||
|
||||
VAddr AddHeap(const void* data, size_t size) {
|
||||
// Require all heap data types to have the same alignment as the
|
||||
// stack pointer, for compatibility
|
||||
const size_t num_bytes{Common::AlignUp(size, STACK_ALIGN)};
|
||||
|
||||
// Make additional memory space if required
|
||||
if (heap_pointer + num_bytes > local_memory.size()) {
|
||||
local_memory.insert(local_memory.end(),
|
||||
(heap_pointer + num_bytes) - local_memory.size(), 0);
|
||||
}
|
||||
|
||||
const VAddr location{heap_pointer};
|
||||
std::memcpy(local_memory.data() + location, data, size);
|
||||
heap_pointer += num_bytes;
|
||||
@@ -350,30 +332,67 @@ public:
|
||||
};
|
||||
|
||||
void DynarmicCallbacks64::CallSVC(u32 swi) {
|
||||
switch (swi) {
|
||||
case 0:
|
||||
parent.jit->HaltExecution();
|
||||
break;
|
||||
// Service calls are used to implement helper functionality.
|
||||
//
|
||||
// The most important of these is the _stop helper, which transfers control
|
||||
// from the plugin back to HLE context to return a value. However, a few more
|
||||
// are also implemented to reduce the need for direct ARM implementations of
|
||||
// basic functionality, like memory operations.
|
||||
//
|
||||
// When we receive a helper request, the swi number will be zero, and the call
|
||||
// will have originated from an address we know is a helper function. Otherwise,
|
||||
// the plugin may be trying to issue a service call, which we shouldn't handle.
|
||||
|
||||
case 1: {
|
||||
if (swi != 0) {
|
||||
LOG_CRITICAL(Service_JIT, "plugin issued unknown service call {}", swi);
|
||||
parent.jit->HaltExecution();
|
||||
return;
|
||||
}
|
||||
|
||||
u64 pc{parent.jit->GetPC() - 4};
|
||||
auto& helpers{parent.helpers};
|
||||
|
||||
if (pc == helpers["memcpy"] || pc == helpers["memmove"]) {
|
||||
const VAddr dest{parent.jit->GetRegister(0)};
|
||||
const VAddr src{parent.jit->GetRegister(1)};
|
||||
const size_t n{parent.jit->GetRegister(2)};
|
||||
|
||||
if (dest < src) {
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
MemoryWrite8(dest + i, MemoryRead8(src + i));
|
||||
}
|
||||
} else {
|
||||
for (size_t i = n; i > 0; i--) {
|
||||
MemoryWrite8(dest + i - 1, MemoryRead8(src + i - 1));
|
||||
}
|
||||
}
|
||||
} else if (pc == helpers["memset"]) {
|
||||
const VAddr dest{parent.jit->GetRegister(0)};
|
||||
const u64 c{parent.jit->GetRegister(1)};
|
||||
const size_t n{parent.jit->GetRegister(2)};
|
||||
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
MemoryWrite8(dest + i, static_cast<u8>(c));
|
||||
}
|
||||
} else if (pc == helpers["_resolve"]) {
|
||||
// X0 contains a char* for a symbol to resolve
|
||||
std::string name{MemoryReadCString(parent.jit->GetRegister(0))};
|
||||
const auto helper{parent.helpers[name]};
|
||||
const auto name{MemoryReadCString(parent.jit->GetRegister(0))};
|
||||
const auto helper{helpers[name]};
|
||||
|
||||
if (helper != 0) {
|
||||
parent.jit->SetRegister(0, helper);
|
||||
} else {
|
||||
LOG_WARNING(Service_JIT, "plugin requested unknown function {}", name);
|
||||
parent.jit->SetRegister(0, parent.helpers["_panic"]);
|
||||
parent.jit->SetRegister(0, helpers["_panic"]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
default:
|
||||
} else if (pc == helpers["_stop"]) {
|
||||
parent.jit->HaltExecution();
|
||||
} else if (pc == helpers["_panic"]) {
|
||||
LOG_CRITICAL(Service_JIT, "plugin panicked!");
|
||||
parent.jit->HaltExecution();
|
||||
break;
|
||||
} else {
|
||||
LOG_CRITICAL(Service_JIT, "plugin issued syscall at unknown address 0x{:x}", pc);
|
||||
parent.jit->HaltExecution();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,7 +409,7 @@ void DynarmicCallbacks64::InterpreterFallback(u64 pc, size_t num_instructions) {
|
||||
JITContext::JITContext(Core::Memory::Memory& memory)
|
||||
: impl{std::make_unique<JITContextImpl>(memory)} {}
|
||||
|
||||
JITContext::~JITContext() {}
|
||||
JITContext::~JITContext() = default;
|
||||
|
||||
bool JITContext::LoadNRO(std::span<const u8> data) {
|
||||
return impl->LoadNRO(data);
|
||||
|
||||
@@ -28,6 +28,7 @@ public:
|
||||
template <typename T, typename... Ts>
|
||||
u64 CallFunction(VAddr func, T argument, Ts... rest) {
|
||||
static_assert(std::is_trivially_copyable_v<T>);
|
||||
static_assert(!std::is_floating_point_v<T>);
|
||||
PushArgument(&argument, sizeof(argument));
|
||||
|
||||
if constexpr (sizeof...(rest) > 0) {
|
||||
|
||||
@@ -122,7 +122,7 @@ struct PL_U::Impl {
|
||||
// Derive key withing inverse xor
|
||||
const u32 KEY = GetU32Swapped(input.data() + cur_offset) ^ EXPECTED_MAGIC;
|
||||
const u32 SIZE = GetU32Swapped(input.data() + cur_offset + 4) ^ KEY;
|
||||
shared_font_regions.push_back(FontRegion{cur_offset + 8, SIZE});
|
||||
shared_font_regions.emplace_back(cur_offset + 8, SIZE);
|
||||
cur_offset += SIZE + 8;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Service::NVFlinger {
|
||||
HosBinderDriverServer::HosBinderDriverServer(Core::System& system_)
|
||||
: service_context(system_, "HosBinderDriverServer") {}
|
||||
|
||||
HosBinderDriverServer::~HosBinderDriverServer() {}
|
||||
HosBinderDriverServer::~HosBinderDriverServer() = default;
|
||||
|
||||
u64 HosBinderDriverServer::RegisterProducer(std::unique_ptr<android::IBinder>&& binder) {
|
||||
std::scoped_lock lk{lock};
|
||||
|
||||
@@ -22,7 +22,7 @@ struct SteadyClockTimePoint {
|
||||
s64 time_point;
|
||||
Common::UUID clock_source_id;
|
||||
|
||||
ResultCode GetSpanBetween(SteadyClockTimePoint other, s64& span) const {
|
||||
ResultCode GetSpanBetween(const SteadyClockTimePoint& other, s64& span) const {
|
||||
span = 0;
|
||||
|
||||
if (clock_source_id != other.clock_source_id) {
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
return auto_correction_enabled;
|
||||
}
|
||||
|
||||
void SetAutomaticCorrectionUpdatedTime(SteadyClockTimePoint steady_clock_time_point) {
|
||||
void SetAutomaticCorrectionUpdatedTime(const SteadyClockTimePoint& steady_clock_time_point) {
|
||||
auto_correction_time = steady_clock_time_point;
|
||||
}
|
||||
|
||||
|
||||
@@ -797,7 +797,6 @@ AnalogMapping SDLDriver::GetAnalogMappingForDevice(const Common::ParamPackage& p
|
||||
return {};
|
||||
}
|
||||
const auto joystick = GetSDLJoystickByGUID(params.Get("guid", ""), params.Get("port", 0));
|
||||
const auto joystick2 = GetSDLJoystickByGUID(params.Get("guid2", ""), params.Get("port", 0));
|
||||
auto* controller = joystick->GetSDLGameController();
|
||||
if (controller == nullptr) {
|
||||
return {};
|
||||
@@ -809,6 +808,7 @@ AnalogMapping SDLDriver::GetAnalogMappingForDevice(const Common::ParamPackage& p
|
||||
const auto& binding_left_y =
|
||||
SDL_GameControllerGetBindForAxis(controller, SDL_CONTROLLER_AXIS_LEFTY);
|
||||
if (params.Has("guid2")) {
|
||||
const auto joystick2 = GetSDLJoystickByGUID(params.Get("guid2", ""), params.Get("port", 0));
|
||||
const auto identifier = joystick2->GetPadIdentifier();
|
||||
PreSetController(identifier);
|
||||
PreSetAxis(identifier, binding_left_x.value.axis);
|
||||
@@ -853,7 +853,6 @@ MotionMapping SDLDriver::GetMotionMappingForDevice(const Common::ParamPackage& p
|
||||
return {};
|
||||
}
|
||||
const auto joystick = GetSDLJoystickByGUID(params.Get("guid", ""), params.Get("port", 0));
|
||||
const auto joystick2 = GetSDLJoystickByGUID(params.Get("guid2", ""), params.Get("port", 0));
|
||||
auto* controller = joystick->GetSDLGameController();
|
||||
if (controller == nullptr) {
|
||||
return {};
|
||||
@@ -867,6 +866,7 @@ MotionMapping SDLDriver::GetMotionMappingForDevice(const Common::ParamPackage& p
|
||||
BuildMotionParam(joystick->GetPort(), joystick->GetGUID()));
|
||||
}
|
||||
if (params.Has("guid2")) {
|
||||
const auto joystick2 = GetSDLJoystickByGUID(params.Get("guid2", ""), params.Get("port", 0));
|
||||
joystick2->EnableMotion();
|
||||
if (joystick2->HasGyro() || joystick2->HasAccel()) {
|
||||
mapping.insert_or_assign(Settings::NativeMotion::MotionLeft,
|
||||
|
||||
@@ -50,11 +50,11 @@ public:
|
||||
}
|
||||
|
||||
void UpdateButtonStatus(const Common::Input::CallbackStatus& button_callback) {
|
||||
const Common::Input::CallbackStatus status{
|
||||
.type = Common::Input::InputType::Touch,
|
||||
.touch_status = GetStatus(button_callback.button_status.value),
|
||||
};
|
||||
if (last_button_value != button_callback.button_status.value) {
|
||||
const Common::Input::CallbackStatus status{
|
||||
.type = Common::Input::InputType::Touch,
|
||||
.touch_status = GetStatus(button_callback.button_status.value),
|
||||
};
|
||||
last_button_value = button_callback.button_status.value;
|
||||
TriggerOnChange(status);
|
||||
}
|
||||
|
||||
@@ -268,7 +268,6 @@ void EmitImageSampleExplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Valu
|
||||
const auto info{inst.Flags<IR::TextureInstInfo>()};
|
||||
const auto sparse_inst{PrepareSparse(inst)};
|
||||
const std::string_view sparse_mod{sparse_inst ? ".SPARSE" : ""};
|
||||
const std::string_view type{TextureType(info)};
|
||||
const std::string texture{Texture(ctx, info, index)};
|
||||
const std::string offset_vec{Offset(ctx, offset)};
|
||||
const auto [coord_vec, coord_alloc]{Coord(ctx, coord)};
|
||||
@@ -277,6 +276,7 @@ void EmitImageSampleExplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Valu
|
||||
ctx.Add("TXL.F{} {},{},{},{},ARRAYCUBE{};", sparse_mod, ret, coord_vec, lod, texture,
|
||||
offset_vec);
|
||||
} else {
|
||||
const std::string_view type{TextureType(info)};
|
||||
ctx.Add("MOV.F {}.w,{};"
|
||||
"TXL.F{} {},{},{},{}{};",
|
||||
coord_vec, lod, sparse_mod, ret, coord_vec, texture, type, offset_vec);
|
||||
|
||||
@@ -60,15 +60,14 @@ void GetCbuf(EmitContext& ctx, std::string_view ret, const IR::Value& binding,
|
||||
const auto offset_var{ctx.var_alloc.Consume(offset)};
|
||||
const auto index{is_immediate ? fmt::format("{}", offset.U32() / 16)
|
||||
: fmt::format("{}>>4", offset_var)};
|
||||
const auto swizzle{is_immediate ? fmt::format(".{}", OffsetSwizzle(offset.U32()))
|
||||
: fmt::format("[({}>>2)%4]", offset_var)};
|
||||
|
||||
const auto cbuf{ChooseCbuf(ctx, binding, index)};
|
||||
const auto cbuf_cast{fmt::format("{}({}{{}})", cast, cbuf)};
|
||||
const auto extraction{num_bits == 32 ? cbuf_cast
|
||||
: fmt::format("bitfieldExtract({},int({}),{})", cbuf_cast,
|
||||
bit_offset, num_bits)};
|
||||
if (!component_indexing_bug) {
|
||||
const auto swizzle{is_immediate ? fmt::format(".{}", OffsetSwizzle(offset.U32()))
|
||||
: fmt::format("[({}>>2)%4]", offset_var)};
|
||||
const auto result{fmt::format(fmt::runtime(extraction), swizzle)};
|
||||
ctx.Add("{}={};", ret, result);
|
||||
return;
|
||||
|
||||
@@ -226,7 +226,6 @@ Id Emit(MethodPtrType sparse_ptr, MethodPtrType non_sparse_ptr, EmitContext& ctx
|
||||
}
|
||||
|
||||
Id IsScaled(EmitContext& ctx, const IR::Value& index, Id member_index, u32 base_index) {
|
||||
const Id push_constant_u32{ctx.TypePointer(spv::StorageClass::PushConstant, ctx.U32[1])};
|
||||
Id bit{};
|
||||
if (index.IsImmediate()) {
|
||||
// Use BitwiseAnd instead of BitfieldExtract for better codegen on Nvidia OpenGL.
|
||||
@@ -234,6 +233,7 @@ Id IsScaled(EmitContext& ctx, const IR::Value& index, Id member_index, u32 base_
|
||||
const u32 index_value{index.U32() + base_index};
|
||||
const Id word_index{ctx.Const(index_value / 32)};
|
||||
const Id bit_index_mask{ctx.Const(1u << (index_value % 32))};
|
||||
const Id push_constant_u32{ctx.TypePointer(spv::StorageClass::PushConstant, ctx.U32[1])};
|
||||
const Id pointer{ctx.OpAccessChain(push_constant_u32, ctx.rescaling_push_constants,
|
||||
member_index, word_index)};
|
||||
const Id word{ctx.OpLoad(ctx.U32[1], pointer)};
|
||||
|
||||
@@ -80,7 +80,7 @@ IR::Value MakeCoords(TranslatorVisitor& v, IR::Reg reg, Type type) {
|
||||
}
|
||||
|
||||
IR::Value ApplyAtomicOp(IR::IREmitter& ir, const IR::U32& handle, const IR::Value& coords,
|
||||
const IR::Value& op_b, IR::TextureInstInfo info, AtomicOp op,
|
||||
const IR::Value& op_b, const IR::TextureInstInfo& info, AtomicOp op,
|
||||
bool is_signed) {
|
||||
switch (op) {
|
||||
case AtomicOp::ADD:
|
||||
@@ -149,11 +149,10 @@ void ImageAtomOp(TranslatorVisitor& v, IR::Reg dest_reg, IR::Reg operand_reg, IR
|
||||
info.type.Assign(tex_type);
|
||||
info.image_format.Assign(format);
|
||||
|
||||
// TODO: float/64-bit operand
|
||||
const IR::Value op_b{v.X(operand_reg)};
|
||||
const IR::Value color{ApplyAtomicOp(v.ir, handle, coords, op_b, info, op, is_signed)};
|
||||
|
||||
if (write_result) {
|
||||
// TODO: float/64-bit operand
|
||||
const IR::Value op_b{v.X(operand_reg)};
|
||||
const IR::Value color{ApplyAtomicOp(v.ir, handle, coords, op_b, info, op, is_signed)};
|
||||
v.X(dest_reg, IR::U32{color});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -546,7 +546,7 @@ IR::Value EvalImmediates(const IR::Inst& inst, Func&& func, std::index_sequence<
|
||||
return IR::Value{func(Arg<typename Traits::template ArgType<I>>(inst.Arg(I))...)};
|
||||
}
|
||||
|
||||
std::optional<IR::Value> FoldCompositeExtractImpl(IR::Value inst_value, IR::Opcode insert,
|
||||
std::optional<IR::Value> FoldCompositeExtractImpl(const IR::Value& inst_value, IR::Opcode insert,
|
||||
IR::Opcode construct, u32 first_index) {
|
||||
IR::Inst* const inst{inst_value.InstRecursive()};
|
||||
if (inst->GetOpcode() == construct) {
|
||||
@@ -587,7 +587,7 @@ void FoldCompositeExtract(IR::Inst& inst, IR::Opcode construct, IR::Opcode inser
|
||||
inst.ReplaceUsesWith(*result);
|
||||
}
|
||||
|
||||
IR::Value GetThroughCast(IR::Value value, IR::Opcode expected_cast) {
|
||||
IR::Value GetThroughCast(const IR::Value& value, IR::Opcode expected_cast) {
|
||||
if (value.IsImmediate()) {
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ private:
|
||||
|
||||
class RescalingPushConstant {
|
||||
public:
|
||||
explicit RescalingPushConstant() noexcept {}
|
||||
explicit RescalingPushConstant() noexcept = default;
|
||||
|
||||
void PushTexture(bool is_rescaled) noexcept {
|
||||
*texture_ptr |= is_rescaled ? texture_bit : 0u;
|
||||
|
||||
@@ -105,7 +105,7 @@ struct Client::Impl {
|
||||
httplib::Request request;
|
||||
request.method = method;
|
||||
request.path = path;
|
||||
request.headers = params;
|
||||
request.headers = std::move(params);
|
||||
request.body = data;
|
||||
|
||||
httplib::Response response;
|
||||
|
||||
@@ -37,7 +37,7 @@ void UpdateController(Core::HID::EmulatedController* controller,
|
||||
|
||||
// Returns true if the given controller type is compatible with the given parameters.
|
||||
bool IsControllerCompatible(Core::HID::NpadStyleIndex controller_type,
|
||||
Core::Frontend::ControllerParameters parameters) {
|
||||
const Core::Frontend::ControllerParameters& parameters) {
|
||||
switch (controller_type) {
|
||||
case Core::HID::NpadStyleIndex::ProController:
|
||||
return parameters.allow_pro_controller;
|
||||
|
||||
@@ -40,8 +40,8 @@ void QtErrorDisplay::ShowErrorWithTimestamp(ResultCode error, std::chrono::secon
|
||||
.arg(date_time.toString(QStringLiteral("h:mm:ss A"))));
|
||||
}
|
||||
|
||||
void QtErrorDisplay::ShowCustomErrorText(ResultCode error, std::string dialog_text,
|
||||
std::string fullscreen_text,
|
||||
void QtErrorDisplay::ShowCustomErrorText(ResultCode error, std::string_view dialog_text,
|
||||
std::string_view fullscreen_text,
|
||||
std::function<void()> finished) const {
|
||||
callback = std::move(finished);
|
||||
emit MainWindowDisplayError(
|
||||
|
||||
@@ -19,7 +19,8 @@ public:
|
||||
void ShowError(ResultCode error, std::function<void()> finished) const override;
|
||||
void ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time,
|
||||
std::function<void()> finished) const override;
|
||||
void ShowCustomErrorText(ResultCode error, std::string dialog_text, std::string fullscreen_text,
|
||||
void ShowCustomErrorText(ResultCode error, std::string_view dialog_text,
|
||||
std::string_view fullscreen_text,
|
||||
std::function<void()> finished) const override;
|
||||
|
||||
signals:
|
||||
|
||||
@@ -385,7 +385,7 @@ void QtSoftwareKeyboardDialog::ShowNormalKeyboard(QPoint pos, QSize size) {
|
||||
|
||||
void QtSoftwareKeyboardDialog::ShowTextCheckDialog(
|
||||
Service::AM::Applets::SwkbdTextCheckResult text_check_result,
|
||||
std::u16string text_check_message) {
|
||||
const std::u16string& text_check_message) {
|
||||
switch (text_check_result) {
|
||||
case SwkbdTextCheckResult::Success:
|
||||
case SwkbdTextCheckResult::Silent:
|
||||
@@ -422,7 +422,7 @@ void QtSoftwareKeyboardDialog::ShowTextCheckDialog(
|
||||
}
|
||||
|
||||
void QtSoftwareKeyboardDialog::ShowInlineKeyboard(
|
||||
Core::Frontend::InlineAppearParameters appear_parameters, QPoint pos, QSize size) {
|
||||
const Core::Frontend::InlineAppearParameters& appear_parameters, QPoint pos, QSize size) {
|
||||
MoveAndResizeWindow(pos, size);
|
||||
|
||||
ui->topOSK->setStyleSheet(QStringLiteral("background: rgba(0, 0, 0, 0);"));
|
||||
@@ -456,7 +456,7 @@ void QtSoftwareKeyboardDialog::HideInlineKeyboard() {
|
||||
}
|
||||
|
||||
void QtSoftwareKeyboardDialog::InlineTextChanged(
|
||||
Core::Frontend::InlineTextParameters text_parameters) {
|
||||
const Core::Frontend::InlineTextParameters& text_parameters) {
|
||||
current_text = text_parameters.input_text;
|
||||
cursor_position = text_parameters.cursor_position;
|
||||
|
||||
|
||||
@@ -40,14 +40,15 @@ public:
|
||||
void ShowNormalKeyboard(QPoint pos, QSize size);
|
||||
|
||||
void ShowTextCheckDialog(Service::AM::Applets::SwkbdTextCheckResult text_check_result,
|
||||
std::u16string text_check_message);
|
||||
const std::u16string& text_check_message);
|
||||
|
||||
void ShowInlineKeyboard(Core::Frontend::InlineAppearParameters appear_parameters, QPoint pos,
|
||||
void ShowInlineKeyboard(const Core::Frontend::InlineAppearParameters& appear_parameters,
|
||||
QPoint pos,
|
||||
QSize size);
|
||||
|
||||
void HideInlineKeyboard();
|
||||
|
||||
void InlineTextChanged(Core::Frontend::InlineTextParameters text_parameters);
|
||||
void InlineTextChanged(const Core::Frontend::InlineTextParameters& text_parameters);
|
||||
|
||||
void ExitKeyboard();
|
||||
|
||||
|
||||
@@ -280,7 +280,7 @@ void ConfigureGraphics::RetranslateUI() {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
|
||||
void ConfigureGraphics::UpdateBackgroundColorButton(QColor color) {
|
||||
void ConfigureGraphics::UpdateBackgroundColorButton(const QColor& color) {
|
||||
bg_color = color;
|
||||
|
||||
QPixmap pixmap(ui->bg_button->size());
|
||||
|
||||
@@ -36,7 +36,7 @@ private:
|
||||
void changeEvent(QEvent* event) override;
|
||||
void RetranslateUI();
|
||||
|
||||
void UpdateBackgroundColorButton(QColor color);
|
||||
void UpdateBackgroundColorButton(const QColor& color);
|
||||
void UpdateAPILayout();
|
||||
void UpdateDeviceSelection(int device);
|
||||
void UpdateShaderBackendSelection(int backend);
|
||||
|
||||
@@ -128,7 +128,7 @@ void ConfigureHotkeys::Configure(QModelIndex index) {
|
||||
model->setData(index, key_sequence.toString(QKeySequence::NativeText));
|
||||
}
|
||||
}
|
||||
void ConfigureHotkeys::ConfigureController(QModelIndex index) {
|
||||
void ConfigureHotkeys::ConfigureController(const QModelIndex& index) {
|
||||
if (timeout_timer->isActive()) {
|
||||
return;
|
||||
}
|
||||
@@ -342,7 +342,7 @@ void ConfigureHotkeys::PopupContextMenu(const QPoint& menu_location) {
|
||||
context_menu.exec(ui->hotkey_list->viewport()->mapToGlobal(menu_location));
|
||||
}
|
||||
|
||||
void ConfigureHotkeys::RestoreControllerHotkey(QModelIndex index) {
|
||||
void ConfigureHotkeys::RestoreControllerHotkey(const QModelIndex& index) {
|
||||
const QString& default_key_sequence =
|
||||
Config::default_hotkeys[index.row()].shortcut.controller_keyseq;
|
||||
const auto [key_sequence_used, used_action] = IsUsedControllerKey(default_key_sequence);
|
||||
@@ -356,7 +356,7 @@ void ConfigureHotkeys::RestoreControllerHotkey(QModelIndex index) {
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigureHotkeys::RestoreHotkey(QModelIndex index) {
|
||||
void ConfigureHotkeys::RestoreHotkey(const QModelIndex& index) {
|
||||
const QKeySequence& default_key_sequence = QKeySequence::fromString(
|
||||
Config::default_hotkeys[index.row()].shortcut.keyseq, QKeySequence::NativeText);
|
||||
const auto [key_sequence_used, used_action] = IsUsedKey(default_key_sequence);
|
||||
|
||||
@@ -45,15 +45,15 @@ private:
|
||||
void RetranslateUI();
|
||||
|
||||
void Configure(QModelIndex index);
|
||||
void ConfigureController(QModelIndex index);
|
||||
void ConfigureController(const QModelIndex& index);
|
||||
std::pair<bool, QString> IsUsedKey(QKeySequence key_sequence) const;
|
||||
std::pair<bool, QString> IsUsedControllerKey(const QString& key_sequence) const;
|
||||
|
||||
void RestoreDefaults();
|
||||
void ClearAll();
|
||||
void PopupContextMenu(const QPoint& menu_location);
|
||||
void RestoreControllerHotkey(QModelIndex index);
|
||||
void RestoreHotkey(QModelIndex index);
|
||||
void RestoreControllerHotkey(const QModelIndex& index);
|
||||
void RestoreHotkey(const QModelIndex& index);
|
||||
|
||||
std::unique_ptr<Ui::ConfigureHotkeys> ui;
|
||||
|
||||
|
||||
@@ -234,7 +234,6 @@ QString ConfigureInputPlayer::AnalogToText(const Common::ParamPackage& param,
|
||||
return QObject::tr("[unknown]");
|
||||
}
|
||||
|
||||
const auto engine_str = param.Get("engine", "");
|
||||
const QString axis_x_str = QString::fromStdString(param.Get("axis_x", ""));
|
||||
const QString axis_y_str = QString::fromStdString(param.Get("axis_y", ""));
|
||||
const bool invert_x = param.Get("invert_x", "+") == "-";
|
||||
|
||||
@@ -1996,8 +1996,8 @@ void PlayerControlPreview::DrawProTriggers(QPainter& p, const QPointF center,
|
||||
}
|
||||
|
||||
void PlayerControlPreview::DrawGCTriggers(QPainter& p, const QPointF center,
|
||||
Common::Input::TriggerStatus left_trigger,
|
||||
Common::Input::TriggerStatus right_trigger) {
|
||||
const Common::Input::TriggerStatus& left_trigger,
|
||||
const Common::Input::TriggerStatus& right_trigger) {
|
||||
std::array<QPointF, left_gc_trigger.size() / 2> qleft_trigger;
|
||||
std::array<QPointF, left_gc_trigger.size() / 2> qright_trigger;
|
||||
|
||||
@@ -2404,7 +2404,8 @@ void PlayerControlPreview::DrawGCJoystick(QPainter& p, const QPointF center,
|
||||
DrawCircle(p, center, 7.5f);
|
||||
}
|
||||
|
||||
void PlayerControlPreview::DrawRawJoystick(QPainter& p, QPointF center_left, QPointF center_right) {
|
||||
void PlayerControlPreview::DrawRawJoystick(QPainter& p, const QPointF& center_left,
|
||||
const QPointF& center_right) {
|
||||
using namespace Settings::NativeAnalog;
|
||||
if (center_right != QPointF(0, 0)) {
|
||||
DrawJoystickProperties(p, center_right, stick_values[RStick].x.properties);
|
||||
@@ -2672,7 +2673,7 @@ void PlayerControlPreview::DrawTriggerButton(QPainter& p, const QPointF center,
|
||||
DrawPolygon(p, qtrigger_button);
|
||||
}
|
||||
|
||||
void PlayerControlPreview::DrawBattery(QPainter& p, QPointF center,
|
||||
void PlayerControlPreview::DrawBattery(QPainter& p, const QPointF& center,
|
||||
Common::Input::BatteryLevel battery) {
|
||||
if (battery == Common::Input::BatteryLevel::None) {
|
||||
return;
|
||||
|
||||
@@ -120,8 +120,8 @@ private:
|
||||
void DrawProTriggers(QPainter& p, QPointF center,
|
||||
const Common::Input::ButtonStatus& left_pressed,
|
||||
const Common::Input::ButtonStatus& right_pressed);
|
||||
void DrawGCTriggers(QPainter& p, QPointF center, Common::Input::TriggerStatus left_trigger,
|
||||
Common::Input::TriggerStatus right_trigger);
|
||||
void DrawGCTriggers(QPainter& p, QPointF center, const Common::Input::TriggerStatus& left_trigger,
|
||||
const Common::Input::TriggerStatus& right_trigger);
|
||||
void DrawHandheldTriggers(QPainter& p, QPointF center,
|
||||
const Common::Input::ButtonStatus& left_pressed,
|
||||
const Common::Input::ButtonStatus& right_pressed);
|
||||
@@ -156,7 +156,7 @@ private:
|
||||
const Common::Input::ButtonStatus& pressed);
|
||||
void DrawJoystickSideview(QPainter& p, QPointF center, float angle, float size,
|
||||
const Common::Input::ButtonStatus& pressed);
|
||||
void DrawRawJoystick(QPainter& p, QPointF center_left, QPointF center_right);
|
||||
void DrawRawJoystick(QPainter& p, const QPointF& center_left, const QPointF& center_right);
|
||||
void DrawJoystickProperties(QPainter& p, QPointF center,
|
||||
const Common::Input::AnalogProperties& properties);
|
||||
void DrawJoystickDot(QPainter& p, QPointF center, const Common::Input::StickStatus& stick,
|
||||
@@ -185,7 +185,7 @@ private:
|
||||
const Common::Input::ButtonStatus& pressed);
|
||||
|
||||
// Draw battery functions
|
||||
void DrawBattery(QPainter& p, QPointF center, Common::Input::BatteryLevel battery);
|
||||
void DrawBattery(QPainter& p, const QPointF& center, Common::Input::BatteryLevel battery);
|
||||
|
||||
// Draw icon functions
|
||||
void DrawSymbol(QPainter& p, QPointF center, Symbol symbol, float icon_size);
|
||||
|
||||
@@ -86,7 +86,7 @@ void ConfigurePerGameAddons::ApplyConfiguration() {
|
||||
"game_list" / fmt::format("{:016X}.pv.txt", title_id));
|
||||
}
|
||||
|
||||
Settings::values.disabled_addons[title_id] = disabled_addons;
|
||||
Settings::values.disabled_addons[title_id] = std::move(disabled_addons);
|
||||
}
|
||||
|
||||
void ConfigurePerGameAddons::LoadFromFile(FileSys::VirtualFile file) {
|
||||
|
||||
@@ -392,7 +392,6 @@ QString ConfigureRingController::AnalogToText(const Common::ParamPackage& param,
|
||||
return QObject::tr("[unknown]");
|
||||
}
|
||||
|
||||
const auto engine_str = param.Get("engine", "");
|
||||
const QString axis_x_str = QString::fromStdString(param.Get("axis_x", ""));
|
||||
const QString axis_y_str = QString::fromStdString(param.Get("axis_y", ""));
|
||||
const bool invert_x = param.Get("invert_x", "+") == "-";
|
||||
|
||||
@@ -131,6 +131,7 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeMutexInfo::GetChildren() cons
|
||||
const bool has_waiters = (mutex_value & Kernel::Svc::HandleWaitMask) != 0;
|
||||
|
||||
std::vector<std::unique_ptr<WaitTreeItem>> list;
|
||||
list.reserve(3);
|
||||
list.push_back(std::make_unique<WaitTreeText>(tr("has waiters: %1").arg(has_waiters)));
|
||||
list.push_back(std::make_unique<WaitTreeText>(
|
||||
tr("owner handle: 0x%1").arg(owner_handle, 8, 16, QLatin1Char{'0'})));
|
||||
|
||||
@@ -150,9 +150,8 @@ bool IsExtractedNCAMain(const std::string& file_name) {
|
||||
|
||||
QString FormatGameName(const std::string& physical_name) {
|
||||
const QString physical_name_as_qstring = QString::fromStdString(physical_name);
|
||||
const QFileInfo file_info(physical_name_as_qstring);
|
||||
|
||||
if (IsExtractedNCAMain(physical_name)) {
|
||||
const QFileInfo file_info(physical_name_as_qstring);
|
||||
return file_info.dir().path();
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ void Config::ReadValues() {
|
||||
"ControlsGeneral", std::string("debug_pad_") + Settings::NativeButton::mapping[i],
|
||||
default_param);
|
||||
if (Settings::values.debug_pad_buttons[i].empty())
|
||||
Settings::values.debug_pad_buttons[i] = default_param;
|
||||
Settings::values.debug_pad_buttons[i] = std::move(default_param);
|
||||
}
|
||||
|
||||
for (int i = 0; i < Settings::NativeAnalog::NumAnalogs; ++i) {
|
||||
@@ -170,7 +170,7 @@ void Config::ReadValues() {
|
||||
"ControlsGeneral", std::string("debug_pad_") + Settings::NativeAnalog::mapping[i],
|
||||
default_param);
|
||||
if (Settings::values.debug_pad_analogs[i].empty())
|
||||
Settings::values.debug_pad_analogs[i] = default_param;
|
||||
Settings::values.debug_pad_analogs[i] = std::move(default_param);
|
||||
}
|
||||
|
||||
ReadSetting("ControlsGeneral", Settings::values.vibration_enabled);
|
||||
|
||||
Reference in New Issue
Block a user