diff options
Diffstat (limited to 'src/core')
26 files changed, 670 insertions, 256 deletions
| diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 47418006b..cb9ced5c9 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -606,11 +606,11 @@ endif()  create_target_directory_groups(core)  target_link_libraries(core PUBLIC common PRIVATE audio_core video_core) -target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls Opus::Opus unicorn) +target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls Opus::Opus unicorn zip)  if (YUZU_ENABLE_BOXCAT)      target_compile_definitions(core PRIVATE -DYUZU_ENABLE_BOXCAT) -    target_link_libraries(core PRIVATE httplib nlohmann_json::nlohmann_json zip) +    target_link_libraries(core PRIVATE httplib nlohmann_json::nlohmann_json)  endif()  if (ENABLE_WEB_SERVICE) diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.cpp b/src/core/arm/dynarmic/arm_dynarmic_32.cpp index 9bc86e3b9..4c8663d03 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_32.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_32.cpp @@ -50,7 +50,8 @@ public:      }      void InterpreterFallback(u32 pc, std::size_t num_instructions) override { -        UNIMPLEMENTED(); +        UNIMPLEMENTED_MSG("This should never happen, pc = {:08X}, code = {:08X}", pc, +                          MemoryReadCode(pc));      }      void ExceptionRaised(u32 pc, Dynarmic::A32::Exception exception) override { @@ -61,7 +62,7 @@ public:          case Dynarmic::A32::Exception::Breakpoint:              break;          } -        LOG_CRITICAL(HW_GPU, "ExceptionRaised(exception = {}, pc = {:08X}, code = {:08X})", +        LOG_CRITICAL(Core_ARM, "ExceptionRaised(exception = {}, pc = {:08X}, code = {:08X})",                       static_cast<std::size_t>(exception), pc, MemoryReadCode(pc));          UNIMPLEMENTED();      } @@ -89,8 +90,6 @@ public:      ARM_Dynarmic_32& parent;      std::size_t num_interpreted_instructions{}; -    u64 tpidrro_el0{}; -    u64 tpidr_el0{};  };  std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable& page_table, @@ -99,7 +98,7 @@ std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable&      config.callbacks = cb.get();      // TODO(bunnei): Implement page table for 32-bit      // config.page_table = &page_table.pointers; -    config.coprocessors[15] = std::make_shared<DynarmicCP15>((u32*)&CP15_regs[0]); +    config.coprocessors[15] = cp15;      config.define_unpredictable_behaviour = true;      return std::make_unique<Dynarmic::A32::Jit>(config);  } @@ -112,13 +111,13 @@ void ARM_Dynarmic_32::Run() {  }  void ARM_Dynarmic_32::Step() { -    cb->InterpreterFallback(jit->Regs()[15], 1); +    jit->Step();  }  ARM_Dynarmic_32::ARM_Dynarmic_32(System& system, ExclusiveMonitor& exclusive_monitor,                                   std::size_t core_index) -    : ARM_Interface{system}, -      cb(std::make_unique<DynarmicCallbacks32>(*this)), core_index{core_index}, +    : ARM_Interface{system}, cb(std::make_unique<DynarmicCallbacks32>(*this)), +      cp15(std::make_shared<DynarmicCP15>(*this)), core_index{core_index},        exclusive_monitor{dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor)} {}  ARM_Dynarmic_32::~ARM_Dynarmic_32() = default; @@ -154,19 +153,19 @@ void ARM_Dynarmic_32::SetPSTATE(u32 cpsr) {  }  u64 ARM_Dynarmic_32::GetTlsAddress() const { -    return CP15_regs[static_cast<std::size_t>(CP15Register::CP15_THREAD_URO)]; +    return cp15->uro;  }  void ARM_Dynarmic_32::SetTlsAddress(VAddr address) { -    CP15_regs[static_cast<std::size_t>(CP15Register::CP15_THREAD_URO)] = static_cast<u32>(address); +    cp15->uro = static_cast<u32>(address);  }  u64 ARM_Dynarmic_32::GetTPIDR_EL0() const { -    return cb->tpidr_el0; +    return cp15->uprw;  }  void ARM_Dynarmic_32::SetTPIDR_EL0(u64 value) { -    cb->tpidr_el0 = value; +    cp15->uprw = static_cast<u32>(value);  }  void ARM_Dynarmic_32::SaveContext(ThreadContext32& ctx) { diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.h b/src/core/arm/dynarmic/arm_dynarmic_32.h index 8ba9cea8f..e5b92d7bb 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_32.h +++ b/src/core/arm/dynarmic/arm_dynarmic_32.h @@ -22,6 +22,7 @@ class Memory;  namespace Core {  class DynarmicCallbacks32; +class DynarmicCP15;  class DynarmicExclusiveMonitor;  class System; @@ -66,12 +67,14 @@ private:          std::unordered_map<JitCacheKey, std::shared_ptr<Dynarmic::A32::Jit>, Common::PairHash>;      friend class DynarmicCallbacks32; +    friend class DynarmicCP15; +      std::unique_ptr<DynarmicCallbacks32> cb;      JitCacheType jit_cache;      std::shared_ptr<Dynarmic::A32::Jit> jit; +    std::shared_ptr<DynarmicCP15> cp15;      std::size_t core_index;      DynarmicExclusiveMonitor& exclusive_monitor; -    std::array<u32, 84> CP15_regs{};  };  } // namespace Core diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp index 337b97be9..5f5e36d94 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp @@ -98,8 +98,8 @@ public:              }              [[fallthrough]];          default: -            ASSERT_MSG(false, "ExceptionRaised(exception = {}, pc = {:X})", -                       static_cast<std::size_t>(exception), pc); +            ASSERT_MSG(false, "ExceptionRaised(exception = {}, pc = {:08X}, code = {:08X})", +                       static_cast<std::size_t>(exception), pc, MemoryReadCode(pc));          }      } diff --git a/src/core/arm/dynarmic/arm_dynarmic_cp15.cpp b/src/core/arm/dynarmic/arm_dynarmic_cp15.cpp index 3fdcdebde..d43e4dd70 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_cp15.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_cp15.cpp @@ -2,79 +2,132 @@  // Licensed under GPLv2 or any later version  // Refer to the license.txt file included. +#include <fmt/format.h> +#include "common/logging/log.h" +#include "core/arm/dynarmic/arm_dynarmic_32.h"  #include "core/arm/dynarmic/arm_dynarmic_cp15.h" +#include "core/core.h" +#include "core/core_timing.h" +#include "core/core_timing_util.h"  using Callback = Dynarmic::A32::Coprocessor::Callback;  using CallbackOrAccessOneWord = Dynarmic::A32::Coprocessor::CallbackOrAccessOneWord;  using CallbackOrAccessTwoWords = Dynarmic::A32::Coprocessor::CallbackOrAccessTwoWords; +template <> +struct fmt::formatter<Dynarmic::A32::CoprocReg> { +    constexpr auto parse(format_parse_context& ctx) { +        return ctx.begin(); +    } +    template <typename FormatContext> +    auto format(const Dynarmic::A32::CoprocReg& reg, FormatContext& ctx) { +        return format_to(ctx.out(), "cp{}", static_cast<size_t>(reg)); +    } +}; + +namespace Core { + +static u32 dummy_value; +  std::optional<Callback> DynarmicCP15::CompileInternalOperation(bool two, unsigned opc1,                                                                 CoprocReg CRd, CoprocReg CRn,                                                                 CoprocReg CRm, unsigned opc2) { +    LOG_CRITICAL(Core_ARM, "CP15: cdp{} p15, {}, {}, {}, {}, {}", two ? "2" : "", opc1, CRd, CRn, +                 CRm, opc2);      return {};  }  CallbackOrAccessOneWord DynarmicCP15::CompileSendOneWord(bool two, unsigned opc1, CoprocReg CRn,                                                           CoprocReg CRm, unsigned opc2) { -    // TODO(merry): Privileged CP15 registers -      if (!two && CRn == CoprocReg::C7 && opc1 == 0 && CRm == CoprocReg::C5 && opc2 == 4) { +        // CP15_FLUSH_PREFETCH_BUFFER          // This is a dummy write, we ignore the value written here. -        return &CP15[static_cast<std::size_t>(CP15Register::CP15_FLUSH_PREFETCH_BUFFER)]; +        return &dummy_value;      }      if (!two && CRn == CoprocReg::C7 && opc1 == 0 && CRm == CoprocReg::C10) {          switch (opc2) {          case 4: +            // CP15_DATA_SYNC_BARRIER              // This is a dummy write, we ignore the value written here. -            return &CP15[static_cast<std::size_t>(CP15Register::CP15_DATA_SYNC_BARRIER)]; +            return &dummy_value;          case 5: +            // CP15_DATA_MEMORY_BARRIER              // This is a dummy write, we ignore the value written here. -            return &CP15[static_cast<std::size_t>(CP15Register::CP15_DATA_MEMORY_BARRIER)]; -        default: -            return {}; +            return &dummy_value;          }      }      if (!two && CRn == CoprocReg::C13 && opc1 == 0 && CRm == CoprocReg::C0 && opc2 == 2) { -        return &CP15[static_cast<std::size_t>(CP15Register::CP15_THREAD_UPRW)]; +        // CP15_THREAD_UPRW +        return &uprw;      } +    LOG_CRITICAL(Core_ARM, "CP15: mcr{} p15, {}, <Rt>, {}, {}, {}", two ? "2" : "", opc1, CRn, CRm, +                 opc2);      return {};  }  CallbackOrAccessTwoWords DynarmicCP15::CompileSendTwoWords(bool two, unsigned opc, CoprocReg CRm) { +    LOG_CRITICAL(Core_ARM, "CP15: mcrr{} p15, {}, <Rt>, <Rt2>, {}", two ? "2" : "", opc, CRm);      return {};  }  CallbackOrAccessOneWord DynarmicCP15::CompileGetOneWord(bool two, unsigned opc1, CoprocReg CRn,                                                          CoprocReg CRm, unsigned opc2) { -    // TODO(merry): Privileged CP15 registers -      if (!two && CRn == CoprocReg::C13 && opc1 == 0 && CRm == CoprocReg::C0) {          switch (opc2) {          case 2: -            return &CP15[static_cast<std::size_t>(CP15Register::CP15_THREAD_UPRW)]; +            // CP15_THREAD_UPRW +            return &uprw;          case 3: -            return &CP15[static_cast<std::size_t>(CP15Register::CP15_THREAD_URO)]; -        default: -            return {}; +            // CP15_THREAD_URO +            return &uro;          }      } +    LOG_CRITICAL(Core_ARM, "CP15: mrc{} p15, {}, <Rt>, {}, {}, {}", two ? "2" : "", opc1, CRn, CRm, +                 opc2);      return {};  }  CallbackOrAccessTwoWords DynarmicCP15::CompileGetTwoWords(bool two, unsigned opc, CoprocReg CRm) { +    if (!two && opc == 0 && CRm == CoprocReg::C14) { +        // CNTPCT +        const auto callback = static_cast<u64 (*)(Dynarmic::A32::Jit*, void*, u32, u32)>( +            [](Dynarmic::A32::Jit*, void* arg, u32, u32) -> u64 { +                ARM_Dynarmic_32& parent = *(ARM_Dynarmic_32*)arg; +                return Timing::CpuCyclesToClockCycles(parent.system.CoreTiming().GetTicks()); +            }); +        return Dynarmic::A32::Coprocessor::Callback{callback, (void*)&parent}; +    } + +    LOG_CRITICAL(Core_ARM, "CP15: mrrc{} p15, {}, <Rt>, <Rt2>, {}", two ? "2" : "", opc, CRm);      return {};  }  std::optional<Callback> DynarmicCP15::CompileLoadWords(bool two, bool long_transfer, CoprocReg CRd,                                                         std::optional<u8> option) { +    if (option) { +        LOG_CRITICAL(Core_ARM, "CP15: mrrc{}{} p15, {}, [...], {}", two ? "2" : "", +                     long_transfer ? "l" : "", CRd, *option); +    } else { +        LOG_CRITICAL(Core_ARM, "CP15: mrrc{}{} p15, {}, [...]", two ? "2" : "", +                     long_transfer ? "l" : "", CRd); +    }      return {};  }  std::optional<Callback> DynarmicCP15::CompileStoreWords(bool two, bool long_transfer, CoprocReg CRd,                                                          std::optional<u8> option) { +    if (option) { +        LOG_CRITICAL(Core_ARM, "CP15: mrrc{}{} p15, {}, [...], {}", two ? "2" : "", +                     long_transfer ? "l" : "", CRd, *option); +    } else { +        LOG_CRITICAL(Core_ARM, "CP15: mrrc{}{} p15, {}, [...]", two ? "2" : "", +                     long_transfer ? "l" : "", CRd); +    }      return {};  } + +} // namespace Core diff --git a/src/core/arm/dynarmic/arm_dynarmic_cp15.h b/src/core/arm/dynarmic/arm_dynarmic_cp15.h index 07bcde5f9..7356d252e 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_cp15.h +++ b/src/core/arm/dynarmic/arm_dynarmic_cp15.h @@ -10,128 +10,15 @@  #include <dynarmic/A32/coprocessor.h>  #include "common/common_types.h" -enum class CP15Register { -    // c0 - Information registers -    CP15_MAIN_ID, -    CP15_CACHE_TYPE, -    CP15_TCM_STATUS, -    CP15_TLB_TYPE, -    CP15_CPU_ID, -    CP15_PROCESSOR_FEATURE_0, -    CP15_PROCESSOR_FEATURE_1, -    CP15_DEBUG_FEATURE_0, -    CP15_AUXILIARY_FEATURE_0, -    CP15_MEMORY_MODEL_FEATURE_0, -    CP15_MEMORY_MODEL_FEATURE_1, -    CP15_MEMORY_MODEL_FEATURE_2, -    CP15_MEMORY_MODEL_FEATURE_3, -    CP15_ISA_FEATURE_0, -    CP15_ISA_FEATURE_1, -    CP15_ISA_FEATURE_2, -    CP15_ISA_FEATURE_3, -    CP15_ISA_FEATURE_4, +namespace Core { -    // c1 - Control registers -    CP15_CONTROL, -    CP15_AUXILIARY_CONTROL, -    CP15_COPROCESSOR_ACCESS_CONTROL, - -    // c2 - Translation table registers -    CP15_TRANSLATION_BASE_TABLE_0, -    CP15_TRANSLATION_BASE_TABLE_1, -    CP15_TRANSLATION_BASE_CONTROL, -    CP15_DOMAIN_ACCESS_CONTROL, -    CP15_RESERVED, - -    // c5 - Fault status registers -    CP15_FAULT_STATUS, -    CP15_INSTR_FAULT_STATUS, -    CP15_COMBINED_DATA_FSR = CP15_FAULT_STATUS, -    CP15_INST_FSR, - -    // c6 - Fault Address registers -    CP15_FAULT_ADDRESS, -    CP15_COMBINED_DATA_FAR = CP15_FAULT_ADDRESS, -    CP15_WFAR, -    CP15_IFAR, - -    // c7 - Cache operation registers -    CP15_WAIT_FOR_INTERRUPT, -    CP15_PHYS_ADDRESS, -    CP15_INVALIDATE_INSTR_CACHE, -    CP15_INVALIDATE_INSTR_CACHE_USING_MVA, -    CP15_INVALIDATE_INSTR_CACHE_USING_INDEX, -    CP15_FLUSH_PREFETCH_BUFFER, -    CP15_FLUSH_BRANCH_TARGET_CACHE, -    CP15_FLUSH_BRANCH_TARGET_CACHE_ENTRY, -    CP15_INVALIDATE_DATA_CACHE, -    CP15_INVALIDATE_DATA_CACHE_LINE_USING_MVA, -    CP15_INVALIDATE_DATA_CACHE_LINE_USING_INDEX, -    CP15_INVALIDATE_DATA_AND_INSTR_CACHE, -    CP15_CLEAN_DATA_CACHE, -    CP15_CLEAN_DATA_CACHE_LINE_USING_MVA, -    CP15_CLEAN_DATA_CACHE_LINE_USING_INDEX, -    CP15_DATA_SYNC_BARRIER, -    CP15_DATA_MEMORY_BARRIER, -    CP15_CLEAN_AND_INVALIDATE_DATA_CACHE, -    CP15_CLEAN_AND_INVALIDATE_DATA_CACHE_LINE_USING_MVA, -    CP15_CLEAN_AND_INVALIDATE_DATA_CACHE_LINE_USING_INDEX, - -    // c8 - TLB operations -    CP15_INVALIDATE_ITLB, -    CP15_INVALIDATE_ITLB_SINGLE_ENTRY, -    CP15_INVALIDATE_ITLB_ENTRY_ON_ASID_MATCH, -    CP15_INVALIDATE_ITLB_ENTRY_ON_MVA, -    CP15_INVALIDATE_DTLB, -    CP15_INVALIDATE_DTLB_SINGLE_ENTRY, -    CP15_INVALIDATE_DTLB_ENTRY_ON_ASID_MATCH, -    CP15_INVALIDATE_DTLB_ENTRY_ON_MVA, -    CP15_INVALIDATE_UTLB, -    CP15_INVALIDATE_UTLB_SINGLE_ENTRY, -    CP15_INVALIDATE_UTLB_ENTRY_ON_ASID_MATCH, -    CP15_INVALIDATE_UTLB_ENTRY_ON_MVA, - -    // c9 - Data cache lockdown register -    CP15_DATA_CACHE_LOCKDOWN, - -    // c10 - TLB/Memory map registers -    CP15_TLB_LOCKDOWN, -    CP15_PRIMARY_REGION_REMAP, -    CP15_NORMAL_REGION_REMAP, - -    // c13 - Thread related registers -    CP15_PID, -    CP15_CONTEXT_ID, -    CP15_THREAD_UPRW, // Thread ID register - User/Privileged Read/Write -    CP15_THREAD_URO,  // Thread ID register - User Read Only (Privileged R/W) -    CP15_THREAD_PRW,  // Thread ID register - Privileged R/W only. - -    // c15 - Performance and TLB lockdown registers -    CP15_PERFORMANCE_MONITOR_CONTROL, -    CP15_CYCLE_COUNTER, -    CP15_COUNT_0, -    CP15_COUNT_1, -    CP15_READ_MAIN_TLB_LOCKDOWN_ENTRY, -    CP15_WRITE_MAIN_TLB_LOCKDOWN_ENTRY, -    CP15_MAIN_TLB_LOCKDOWN_VIRT_ADDRESS, -    CP15_MAIN_TLB_LOCKDOWN_PHYS_ADDRESS, -    CP15_MAIN_TLB_LOCKDOWN_ATTRIBUTE, -    CP15_TLB_DEBUG_CONTROL, - -    // Skyeye defined -    CP15_TLB_FAULT_ADDR, -    CP15_TLB_FAULT_STATUS, - -    // Not an actual register. -    // All registers should be defined above this. -    CP15_REGISTER_COUNT, -}; +class ARM_Dynarmic_32;  class DynarmicCP15 final : public Dynarmic::A32::Coprocessor {  public:      using CoprocReg = Dynarmic::A32::CoprocReg; -    explicit DynarmicCP15(u32* cp15) : CP15(cp15){}; +    explicit DynarmicCP15(ARM_Dynarmic_32& parent) : parent(parent) {}      std::optional<Callback> CompileInternalOperation(bool two, unsigned opc1, CoprocReg CRd,                                                       CoprocReg CRn, CoprocReg CRm, @@ -147,6 +34,9 @@ public:      std::optional<Callback> CompileStoreWords(bool two, bool long_transfer, CoprocReg CRd,                                                std::optional<u8> option) override; -private: -    u32* CP15{}; +    ARM_Dynarmic_32& parent; +    u32 uprw; +    u32 uro;  }; + +} // namespace Core diff --git a/src/core/file_sys/system_archive/mii_model.cpp b/src/core/file_sys/system_archive/mii_model.cpp index 6a9add87c..61bb67945 100644 --- a/src/core/file_sys/system_archive/mii_model.cpp +++ b/src/core/file_sys/system_archive/mii_model.cpp @@ -40,7 +40,7 @@ VirtualDir MiiModel() {      out->AddFile(std::make_shared<ArrayVfsFile<MiiModelData::SHAPE_MID.size()>>(          MiiModelData::SHAPE_MID, "ShapeMid.dat")); -    return std::move(out); +    return out;  }  } // namespace FileSys::SystemArchive diff --git a/src/core/file_sys/system_archive/shared_font.cpp b/src/core/file_sys/system_archive/shared_font.cpp index 2c05eb42e..c5cdf7d9b 100644 --- a/src/core/file_sys/system_archive/shared_font.cpp +++ b/src/core/file_sys/system_archive/shared_font.cpp @@ -23,7 +23,7 @@ VirtualFile PackBFTTF(const std::array<u8, Size>& data, const std::string& name)      std::vector<u8> bfttf(Size + sizeof(u64)); -    u64 offset = 0; +    size_t offset = 0;      Service::NS::EncryptSharedFont(vec, bfttf, offset);      return std::make_shared<VectorVfsFile>(std::move(bfttf), name);  } diff --git a/src/core/hle/kernel/memory/memory_manager.cpp b/src/core/hle/kernel/memory/memory_manager.cpp index 6b432e1b2..616148190 100644 --- a/src/core/hle/kernel/memory/memory_manager.cpp +++ b/src/core/hle/kernel/memory/memory_manager.cpp @@ -104,7 +104,7 @@ ResultCode MemoryManager::Allocate(PageLinkedList& page_list, std::size_t num_pa      // Ensure that we don't leave anything un-freed      auto group_guard = detail::ScopeExit([&] {          for (const auto& it : page_list.Nodes()) { -            const auto min_num_pages{std::min( +            const auto min_num_pages{std::min<size_t>(                  it.GetNumPages(), (chosen_manager.GetEndAddress() - it.GetAddress()) / PageSize)};              chosen_manager.Free(it.GetAddress(), min_num_pages);          } @@ -165,7 +165,7 @@ ResultCode MemoryManager::Free(PageLinkedList& page_list, std::size_t num_pages,      // Free all of the pages      for (const auto& it : page_list.Nodes()) { -        const auto min_num_pages{std::min( +        const auto min_num_pages{std::min<size_t>(              it.GetNumPages(), (chosen_manager.GetEndAddress() - it.GetAddress()) / PageSize)};          chosen_manager.Free(it.GetAddress(), min_num_pages);      } diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index 36724569f..c4c5199b1 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp @@ -132,7 +132,8 @@ std::shared_ptr<ResourceLimit> Process::GetResourceLimit() const {  u64 Process::GetTotalPhysicalMemoryAvailable() const {      const u64 capacity{resource_limit->GetCurrentResourceValue(ResourceType::PhysicalMemory) + -                       page_table->GetTotalHeapSize() + image_size + main_thread_stack_size}; +                       page_table->GetTotalHeapSize() + GetSystemResourceSize() + image_size + +                       main_thread_stack_size};      if (capacity < memory_usage_capacity) {          return capacity; @@ -146,7 +147,8 @@ u64 Process::GetTotalPhysicalMemoryAvailableWithoutSystemResource() const {  }  u64 Process::GetTotalPhysicalMemoryUsed() const { -    return image_size + main_thread_stack_size + page_table->GetTotalHeapSize(); +    return image_size + main_thread_stack_size + page_table->GetTotalHeapSize() + +           GetSystemResourceSize();  }  u64 Process::GetTotalPhysicalMemoryUsedWithoutSystemResource() const { diff --git a/src/core/hle/kernel/readable_event.cpp b/src/core/hle/kernel/readable_event.cpp index 00860fcbd..ef5e19e63 100644 --- a/src/core/hle/kernel/readable_event.cpp +++ b/src/core/hle/kernel/readable_event.cpp @@ -38,7 +38,7 @@ void ReadableEvent::Clear() {  ResultCode ReadableEvent::Reset() {      if (!is_signaled) { -        LOG_ERROR(Kernel, "Handle is not signaled! object_id={}, object_type={}, object_name={}", +        LOG_TRACE(Kernel, "Handle is not signaled! object_id={}, object_type={}, object_name={}",                    GetObjectId(), GetTypeName(), GetName());          return ERR_INVALID_STATE;      } diff --git a/src/core/hle/kernel/resource_limit.cpp b/src/core/hle/kernel/resource_limit.cpp index d9beaa3a4..212e442f4 100644 --- a/src/core/hle/kernel/resource_limit.cpp +++ b/src/core/hle/kernel/resource_limit.cpp @@ -24,13 +24,9 @@ bool ResourceLimit::Reserve(ResourceType resource, s64 amount, u64 timeout) {      const std::size_t index{ResourceTypeToIndex(resource)};      s64 new_value = current[index] + amount; -    while (new_value > limit[index] && available[index] + amount <= limit[index]) { +    if (new_value > limit[index] && available[index] + amount <= limit[index]) {          // TODO(bunnei): This is wrong for multicore, we should wait the calling thread for timeout          new_value = current[index] + amount; - -        if (timeout >= 0) { -            break; -        }      }      if (new_value <= limit[index]) { diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 630a8b048..94d8c1fc6 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -44,6 +44,218 @@ static constexpr u32 SanitizeJPEGSize(std::size_t size) {      return static_cast<u32>(std::min(size, max_jpeg_image_size));  } +class IManagerForSystemService final : public ServiceFramework<IManagerForSystemService> { +public: +    explicit IManagerForSystemService(Common::UUID user_id) +        : ServiceFramework("IManagerForSystemService") { +        // clang-format off +        static const FunctionInfo functions[] = { +            {0, nullptr, "CheckAvailability"}, +            {1, nullptr, "GetAccountId"}, +            {2, nullptr, "EnsureIdTokenCacheAsync"}, +            {3, nullptr, "LoadIdTokenCache"}, +            {100, nullptr, "SetSystemProgramIdentification"}, +            {101, nullptr, "RefreshNotificationTokenAsync"}, // 7.0.0+ +            {110, nullptr, "GetServiceEntryRequirementCache"}, // 4.0.0+ +            {111, nullptr, "InvalidateServiceEntryRequirementCache"}, // 4.0.0+ +            {112, nullptr, "InvalidateTokenCache"}, // 4.0.0 - 6.2.0 +            {113, nullptr, "GetServiceEntryRequirementCacheForOnlinePlay"}, // 6.1.0+ +            {120, nullptr, "GetNintendoAccountId"}, +            {121, nullptr, "CalculateNintendoAccountAuthenticationFingerprint"}, // 9.0.0+ +            {130, nullptr, "GetNintendoAccountUserResourceCache"}, +            {131, nullptr, "RefreshNintendoAccountUserResourceCacheAsync"}, +            {132, nullptr, "RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed"}, +            {133, nullptr, "GetNintendoAccountVerificationUrlCache"}, // 9.0.0+ +            {134, nullptr, "RefreshNintendoAccountVerificationUrlCache"}, // 9.0.0+ +            {135, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed"}, // 9.0.0+ +            {140, nullptr, "GetNetworkServiceLicenseCache"}, // 5.0.0+ +            {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+ +            {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+ +            {150, nullptr, "CreateAuthorizationRequest"}, +        }; +        // clang-format on + +        RegisterHandlers(functions); +    } +}; + +// 3.0.0+ +class IFloatingRegistrationRequest final : public ServiceFramework<IFloatingRegistrationRequest> { +public: +    explicit IFloatingRegistrationRequest(Common::UUID user_id) +        : ServiceFramework("IFloatingRegistrationRequest") { +        // clang-format off +        static const FunctionInfo functions[] = { +            {0, nullptr, "GetSessionId"}, +            {12, nullptr, "GetAccountId"}, +            {13, nullptr, "GetLinkedNintendoAccountId"}, +            {14, nullptr, "GetNickname"}, +            {15, nullptr, "GetProfileImage"}, +            {21, nullptr, "LoadIdTokenCache"}, +            {100, nullptr, "RegisterUser"}, // [1.0.0-3.0.2] RegisterAsync +            {101, nullptr, "RegisterUserWithUid"}, // [1.0.0-3.0.2] RegisterWithUidAsync +            {102, nullptr, "RegisterNetworkServiceAccountAsync"}, // 4.0.0+ +            {103, nullptr, "RegisterNetworkServiceAccountWithUidAsync"}, // 4.0.0+ +            {110, nullptr, "SetSystemProgramIdentification"}, +            {111, nullptr, "EnsureIdTokenCacheAsync"}, +        }; +        // clang-format on + +        RegisterHandlers(functions); +    } +}; + +class IAdministrator final : public ServiceFramework<IAdministrator> { +public: +    explicit IAdministrator(Common::UUID user_id) : ServiceFramework("IAdministrator") { +        // clang-format off +        static const FunctionInfo functions[] = { +            {0, nullptr, "CheckAvailability"}, +            {1, nullptr, "GetAccountId"}, +            {2, nullptr, "EnsureIdTokenCacheAsync"}, +            {3, nullptr, "LoadIdTokenCache"}, +            {100, nullptr, "SetSystemProgramIdentification"}, +            {101, nullptr, "RefreshNotificationTokenAsync"}, // 7.0.0+ +            {110, nullptr, "GetServiceEntryRequirementCache"}, // 4.0.0+ +            {111, nullptr, "InvalidateServiceEntryRequirementCache"}, // 4.0.0+ +            {112, nullptr, "InvalidateTokenCache"}, // 4.0.0 - 6.2.0 +            {113, nullptr, "GetServiceEntryRequirementCacheForOnlinePlay"}, // 6.1.0+ +            {120, nullptr, "GetNintendoAccountId"}, +            {121, nullptr, "CalculateNintendoAccountAuthenticationFingerprint"}, // 9.0.0+ +            {130, nullptr, "GetNintendoAccountUserResourceCache"}, +            {131, nullptr, "RefreshNintendoAccountUserResourceCacheAsync"}, +            {132, nullptr, "RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed"}, +            {133, nullptr, "GetNintendoAccountVerificationUrlCache"}, // 9.0.0+ +            {134, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsync"}, // 9.0.0+ +            {135, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed"}, // 9.0.0+ +            {140, nullptr, "GetNetworkServiceLicenseCache"}, // 5.0.0+ +            {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+ +            {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+ +            {150, nullptr, "CreateAuthorizationRequest"}, +            {200, nullptr, "IsRegistered"}, +            {201, nullptr, "RegisterAsync"}, +            {202, nullptr, "UnregisterAsync"}, +            {203, nullptr, "DeleteRegistrationInfoLocally"}, +            {220, nullptr, "SynchronizeProfileAsync"}, +            {221, nullptr, "UploadProfileAsync"}, +            {222, nullptr, "SynchronizaProfileAsyncIfSecondsElapsed"}, +            {250, nullptr, "IsLinkedWithNintendoAccount"}, +            {251, nullptr, "CreateProcedureToLinkWithNintendoAccount"}, +            {252, nullptr, "ResumeProcedureToLinkWithNintendoAccount"}, +            {255, nullptr, "CreateProcedureToUpdateLinkageStateOfNintendoAccount"}, +            {256, nullptr, "ResumeProcedureToUpdateLinkageStateOfNintendoAccount"}, +            {260, nullptr, "CreateProcedureToLinkNnidWithNintendoAccount"}, // 3.0.0+ +            {261, nullptr, "ResumeProcedureToLinkNnidWithNintendoAccount"}, // 3.0.0+ +            {280, nullptr, "ProxyProcedureToAcquireApplicationAuthorizationForNintendoAccount"}, +            {290, nullptr, "GetRequestForNintendoAccountUserResourceView"}, // 8.0.0+ +            {300, nullptr, "TryRecoverNintendoAccountUserStateAsync"}, // 6.0.0+ +            {400, nullptr, "IsServiceEntryRequirementCacheRefreshRequiredForOnlinePlay"}, // 6.1.0+ +            {401, nullptr, "RefreshServiceEntryRequirementCacheForOnlinePlayAsync"}, // 6.1.0+ +            {900, nullptr, "GetAuthenticationInfoForWin"}, // 9.0.0+ +            {901, nullptr, "ImportAsyncForWin"}, // 9.0.0+ +            {997, nullptr, "DebugUnlinkNintendoAccountAsync"}, +            {998, nullptr, "DebugSetAvailabilityErrorDetail"}, +        }; +        // clang-format on + +        RegisterHandlers(functions); +    } +}; + +class IAuthorizationRequest final : public ServiceFramework<IAuthorizationRequest> { +public: +    explicit IAuthorizationRequest(Common::UUID user_id) +        : ServiceFramework("IAuthorizationRequest") { +        // clang-format off +        static const FunctionInfo functions[] = { +            {0, nullptr, "GetSessionId"}, +            {10, nullptr, "InvokeWithoutInteractionAsync"}, +            {19, nullptr, "IsAuthorized"}, +            {20, nullptr, "GetAuthorizationCode"}, +            {21, nullptr, "GetIdToken"}, +            {22, nullptr, "GetState"}, +        }; +        // clang-format on + +        RegisterHandlers(functions); +    } +}; + +class IOAuthProcedure final : public ServiceFramework<IOAuthProcedure> { +public: +    explicit IOAuthProcedure(Common::UUID user_id) : ServiceFramework("IOAuthProcedure") { +        // clang-format off +        static const FunctionInfo functions[] = { +            {0, nullptr, "PrepareAsync"}, +            {1, nullptr, "GetRequest"}, +            {2, nullptr, "ApplyResponse"}, +            {3, nullptr, "ApplyResponseAsync"}, +            {10, nullptr, "Suspend"}, +        }; +        // clang-format on + +        RegisterHandlers(functions); +    } +}; + +// 3.0.0+ +class IOAuthProcedureForExternalNsa final : public ServiceFramework<IOAuthProcedureForExternalNsa> { +public: +    explicit IOAuthProcedureForExternalNsa(Common::UUID user_id) +        : ServiceFramework("IOAuthProcedureForExternalNsa") { +        // clang-format off +        static const FunctionInfo functions[] = { +            {0, nullptr, "PrepareAsync"}, +            {1, nullptr, "GetRequest"}, +            {2, nullptr, "ApplyResponse"}, +            {3, nullptr, "ApplyResponseAsync"}, +            {10, nullptr, "Suspend"}, +            {100, nullptr, "GetAccountId"}, +            {101, nullptr, "GetLinkedNintendoAccountId"}, +            {102, nullptr, "GetNickname"}, +            {103, nullptr, "GetProfileImage"}, +        }; +        // clang-format on + +        RegisterHandlers(functions); +    } +}; + +class IOAuthProcedureForNintendoAccountLinkage final +    : public ServiceFramework<IOAuthProcedureForNintendoAccountLinkage> { +public: +    explicit IOAuthProcedureForNintendoAccountLinkage(Common::UUID user_id) +        : ServiceFramework("IOAuthProcedureForNintendoAccountLinkage") { +        // clang-format off +        static const FunctionInfo functions[] = { +            {0, nullptr, "PrepareAsync"}, +            {1, nullptr, "GetRequest"}, +            {2, nullptr, "ApplyResponse"}, +            {3, nullptr, "ApplyResponseAsync"}, +            {10, nullptr, "Suspend"}, +            {100, nullptr, "GetRequestWithTheme"}, +            {101, nullptr, "IsNetworkServiceAccountReplaced"}, +            {199, nullptr, "GetUrlForIntroductionOfExtraMembership"}, // 2.0.0 - 5.1.0 +        }; +        // clang-format on + +        RegisterHandlers(functions); +    } +}; + +class INotifier final : public ServiceFramework<INotifier> { +public: +    explicit INotifier(Common::UUID user_id) : ServiceFramework("INotifier") { +        // clang-format off +        static const FunctionInfo functions[] = { +            {0, nullptr, "GetSystemEvent"}, +        }; +        // clang-format on + +        RegisterHandlers(functions); +    } +}; +  class IProfileCommon : public ServiceFramework<IProfileCommon> {  public:      explicit IProfileCommon(const char* name, bool editor_commands, Common::UUID user_id, @@ -226,6 +438,54 @@ public:          : IProfileCommon("IProfileEditor", true, user_id, profile_manager) {}  }; +class IAsyncContext final : public ServiceFramework<IAsyncContext> { +public: +    explicit IAsyncContext(Common::UUID user_id) : ServiceFramework("IAsyncContext") { +        // clang-format off +        static const FunctionInfo functions[] = { +            {0, nullptr, "GetSystemEvent"}, +            {1, nullptr, "Cancel"}, +            {2, nullptr, "HasDone"}, +            {3, nullptr, "GetResult"}, +        }; +        // clang-format on + +        RegisterHandlers(functions); +    } +}; + +class ISessionObject final : public ServiceFramework<ISessionObject> { +public: +    explicit ISessionObject(Common::UUID user_id) : ServiceFramework("ISessionObject") { +        // clang-format off +        static const FunctionInfo functions[] = { +            {999, nullptr, "Dummy"}, +        }; +        // clang-format on + +        RegisterHandlers(functions); +    } +}; + +class IGuestLoginRequest final : public ServiceFramework<IGuestLoginRequest> { +public: +    explicit IGuestLoginRequest(Common::UUID) : ServiceFramework("IGuestLoginRequest") { +        // clang-format off +        static const FunctionInfo functions[] = { +            {0, nullptr, "GetSessionId"}, +            {11, nullptr, "Unknown"}, // 1.0.0 - 2.3.0 (the name is blank on Switchbrew) +            {12, nullptr, "GetAccountId"}, +            {13, nullptr, "GetLinkedNintendoAccountId"}, +            {14, nullptr, "GetNickname"}, +            {15, nullptr, "GetProfileImage"}, +            {21, nullptr, "LoadIdTokenCache"}, // 3.0.0+ +        }; +        // clang-format on + +        RegisterHandlers(functions); +    } +}; +  class IManagerForApplication final : public ServiceFramework<IManagerForApplication> {  public:      explicit IManagerForApplication(Common::UUID user_id) @@ -265,6 +525,87 @@ private:      Common::UUID user_id;  }; +// 6.0.0+ +class IAsyncNetworkServiceLicenseKindContext final +    : public ServiceFramework<IAsyncNetworkServiceLicenseKindContext> { +public: +    explicit IAsyncNetworkServiceLicenseKindContext(Common::UUID user_id) +        : ServiceFramework("IAsyncNetworkServiceLicenseKindContext") { +        // clang-format off +        static const FunctionInfo functions[] = { +            {0, nullptr, "GetSystemEvent"}, +            {1, nullptr, "Cancel"}, +            {2, nullptr, "HasDone"}, +            {3, nullptr, "GetResult"}, +            {4, nullptr, "GetNetworkServiceLicenseKind"}, +        }; +        // clang-format on + +        RegisterHandlers(functions); +    } +}; + +// 8.0.0+ +class IOAuthProcedureForUserRegistration final +    : public ServiceFramework<IOAuthProcedureForUserRegistration> { +public: +    explicit IOAuthProcedureForUserRegistration(Common::UUID user_id) +        : ServiceFramework("IOAuthProcedureForUserRegistration") { +        // clang-format off +        static const FunctionInfo functions[] = { +            {0, nullptr, "PrepareAsync"}, +            {1, nullptr, "GetRequest"}, +            {2, nullptr, "ApplyResponse"}, +            {3, nullptr, "ApplyResponseAsync"}, +            {10, nullptr, "Suspend"}, +            {100, nullptr, "GetAccountId"}, +            {101, nullptr, "GetLinkedNintendoAccountId"}, +            {102, nullptr, "GetNickname"}, +            {103, nullptr, "GetProfileImage"}, +            {110, nullptr, "RegisterUserAsync"}, +            {111, nullptr, "GetUid"}, +        }; +        // clang-format on + +        RegisterHandlers(functions); +    } +}; + +class DAUTH_O final : public ServiceFramework<DAUTH_O> { +public: +    explicit DAUTH_O(Common::UUID) : ServiceFramework("dauth:o") { +        // clang-format off +        static const FunctionInfo functions[] = { +            {0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, // [5.0.0-5.1.0] GeneratePostData +            {1, nullptr, "LoadAuthenticationTokenCache"}, // 6.0.0+ +            {2, nullptr, "InvalidateAuthenticationTokenCache"}, // 6.0.0+ +            {10, nullptr, "EnsureEdgeTokenCacheAsync"}, // 6.0.0+ +            {11, nullptr, "LoadEdgeTokenCache"}, // 6.0.0+ +            {12, nullptr, "InvalidateEdgeTokenCache"}, // 6.0.0+ +        }; +        // clang-format on + +        RegisterHandlers(functions); +    } +}; + +// 6.0.0+ +class IAsyncResult final : public ServiceFramework<IAsyncResult> { +public: +    explicit IAsyncResult(Common::UUID user_id) : ServiceFramework("IAsyncResult") { +        // clang-format off +        static const FunctionInfo functions[] = { +            {0, nullptr, "GetResult"}, +            {1, nullptr, "Cancel"}, +            {2, nullptr, "IsAvailable"}, +            {3, nullptr, "GetSystemEvent"}, +        }; +        // clang-format on + +        RegisterHandlers(functions); +    } +}; +  void Module::Interface::GetUserCount(Kernel::HLERequestContext& ctx) {      LOG_DEBUG(Service_ACC, "called");      IPC::ResponseBuilder rb{ctx, 3}; diff --git a/src/core/hle/service/acc/acc_aa.cpp b/src/core/hle/service/acc/acc_aa.cpp index 3bac6bcd1..51f119b12 100644 --- a/src/core/hle/service/acc/acc_aa.cpp +++ b/src/core/hle/service/acc/acc_aa.cpp @@ -13,8 +13,8 @@ ACC_AA::ACC_AA(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p          {0, nullptr, "EnsureCacheAsync"},          {1, nullptr, "LoadCache"},          {2, nullptr, "GetDeviceAccountId"}, -        {50, nullptr, "RegisterNotificationTokenAsync"}, -        {51, nullptr, "UnregisterNotificationTokenAsync"}, +        {50, nullptr, "RegisterNotificationTokenAsync"},   // 1.0.0 - 6.2.0 +        {51, nullptr, "UnregisterNotificationTokenAsync"}, // 1.0.0 - 6.2.0      };      RegisterHandlers(functions);  } diff --git a/src/core/hle/service/acc/acc_su.cpp b/src/core/hle/service/acc/acc_su.cpp index 2eefc6df5..85620bde3 100644 --- a/src/core/hle/service/acc/acc_su.cpp +++ b/src/core/hle/service/acc/acc_su.cpp @@ -17,28 +17,28 @@ ACC_SU::ACC_SU(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p          {3, &ACC_SU::ListOpenUsers, "ListOpenUsers"},          {4, &ACC_SU::GetLastOpenedUser, "GetLastOpenedUser"},          {5, &ACC_SU::GetProfile, "GetProfile"}, -        {6, nullptr, "GetProfileDigest"}, +        {6, nullptr, "GetProfileDigest"}, // 3.0.0+          {50, &ACC_SU::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"},          {51, &ACC_SU::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, -        {60, nullptr, "ListOpenContextStoredUsers"}, -        {99, nullptr, "DebugActivateOpenContextRetention"}, +        {60, nullptr, "ListOpenContextStoredUsers"}, // 5.0.0 - 5.1.0 +        {99, nullptr, "DebugActivateOpenContextRetention"}, // 6.0.0+          {100, nullptr, "GetUserRegistrationNotifier"},          {101, nullptr, "GetUserStateChangeNotifier"},          {102, nullptr, "GetBaasAccountManagerForSystemService"},          {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"},          {104, nullptr, "GetProfileUpdateNotifier"}, -        {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, -        {106, nullptr, "GetProfileSyncNotifier"}, +        {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, // 4.0.0+ +        {106, nullptr, "GetProfileSyncNotifier"}, // 9.0.0+          {110, nullptr, "StoreSaveDataThumbnail"},          {111, nullptr, "ClearSaveDataThumbnail"},          {112, nullptr, "LoadSaveDataThumbnail"}, -        {113, nullptr, "GetSaveDataThumbnailExistence"}, -        {120, nullptr, "ListOpenUsersInApplication"}, -        {130, nullptr, "ActivateOpenContextRetention"}, -        {140, &ACC_SU::ListQualifiedUsers, "ListQualifiedUsers"}, -        {150, nullptr, "AuthenticateApplicationAsync"}, -        {190, nullptr, "GetUserLastOpenedApplication"}, -        {191, nullptr, "ActivateOpenContextHolder"}, +        {113, nullptr, "GetSaveDataThumbnailExistence"}, // 5.0.0+ +        {120, nullptr, "ListOpenUsersInApplication"}, // 10.0.0+ +        {130, nullptr, "ActivateOpenContextRetention"}, // 6.0.0+ +        {140, &ACC_SU::ListQualifiedUsers, "ListQualifiedUsers"}, // 6.0.0+ +        {150, nullptr, "AuthenticateApplicationAsync"}, // 10.0.0+ +        {190, nullptr, "GetUserLastOpenedApplication"}, // 1.0.0 - 9.2.0 +        {191, nullptr, "ActivateOpenContextHolder"}, // 7.0.0+          {200, nullptr, "BeginUserRegistration"},          {201, nullptr, "CompleteUserRegistration"},          {202, nullptr, "CancelUserRegistration"}, @@ -46,15 +46,15 @@ ACC_SU::ACC_SU(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p          {204, nullptr, "SetUserPosition"},          {205, &ACC_SU::GetProfileEditor, "GetProfileEditor"},          {206, nullptr, "CompleteUserRegistrationForcibly"}, -        {210, nullptr, "CreateFloatingRegistrationRequest"}, -        {211, nullptr, "CreateProcedureToRegisterUserWithNintendoAccount"}, -        {212, nullptr, "ResumeProcedureToRegisterUserWithNintendoAccount"}, +        {210, nullptr, "CreateFloatingRegistrationRequest"}, // 3.0.0+ +        {211, nullptr, "CreateProcedureToRegisterUserWithNintendoAccount"}, // 8.0.0+ +        {212, nullptr, "ResumeProcedureToRegisterUserWithNintendoAccount"}, // 8.0.0+          {230, nullptr, "AuthenticateServiceAsync"},          {250, nullptr, "GetBaasAccountAdministrator"},          {290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"}, -        {291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"}, +        {291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"}, // 3.0.0+          {299, nullptr, "SuspendBackgroundDaemon"}, -        {997, nullptr, "DebugInvalidateTokenCacheForUser"}, +        {997, nullptr, "DebugInvalidateTokenCacheForUser"}, // 3.0.0+          {998, nullptr, "DebugSetUserStateClose"},          {999, nullptr, "DebugSetUserStateOpen"},      }; diff --git a/src/core/hle/service/acc/acc_u0.cpp b/src/core/hle/service/acc/acc_u0.cpp index fb4e7e772..49f6e20f1 100644 --- a/src/core/hle/service/acc/acc_u0.cpp +++ b/src/core/hle/service/acc/acc_u0.cpp @@ -17,23 +17,23 @@ ACC_U0::ACC_U0(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p          {3, &ACC_U0::ListOpenUsers, "ListOpenUsers"},          {4, &ACC_U0::GetLastOpenedUser, "GetLastOpenedUser"},          {5, &ACC_U0::GetProfile, "GetProfile"}, -        {6, nullptr, "GetProfileDigest"}, +        {6, nullptr, "GetProfileDigest"}, // 3.0.0+          {50, &ACC_U0::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"},          {51, &ACC_U0::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, -        {60, nullptr, "ListOpenContextStoredUsers"}, -        {99, nullptr, "DebugActivateOpenContextRetention"}, +        {60, nullptr, "ListOpenContextStoredUsers"}, // 5.0.0 - 5.1.0 +        {99, nullptr, "DebugActivateOpenContextRetention"}, // 6.0.0+          {100, &ACC_U0::InitializeApplicationInfo, "InitializeApplicationInfo"},          {101, &ACC_U0::GetBaasAccountManagerForApplication, "GetBaasAccountManagerForApplication"},          {102, nullptr, "AuthenticateApplicationAsync"}, -        {103, nullptr, "CheckNetworkServiceAvailabilityAsync"}, +        {103, nullptr, "CheckNetworkServiceAvailabilityAsync"}, // 4.0.0+          {110, nullptr, "StoreSaveDataThumbnail"},          {111, nullptr, "ClearSaveDataThumbnail"},          {120, nullptr, "CreateGuestLoginRequest"}, -        {130, nullptr, "LoadOpenContext"}, -        {131, nullptr, "ListOpenContextStoredUsers"}, -        {140, &ACC_U0::InitializeApplicationInfoRestricted, "InitializeApplicationInfoRestricted"}, -        {141, &ACC_U0::ListQualifiedUsers, "ListQualifiedUsers"}, -        {150, &ACC_U0::IsUserAccountSwitchLocked, "IsUserAccountSwitchLocked"}, +        {130, nullptr, "LoadOpenContext"}, // 5.0.0+ +        {131, nullptr, "ListOpenContextStoredUsers"}, // 6.0.0+ +        {140, &ACC_U0::InitializeApplicationInfoRestricted, "InitializeApplicationInfoRestricted"}, // 6.0.0+ +        {141, &ACC_U0::ListQualifiedUsers, "ListQualifiedUsers"}, // 6.0.0+ +        {150, &ACC_U0::IsUserAccountSwitchLocked, "IsUserAccountSwitchLocked"}, // 6.0.0+      };      // clang-format on diff --git a/src/core/hle/service/acc/acc_u1.cpp b/src/core/hle/service/acc/acc_u1.cpp index 9f29cdc82..f47004f84 100644 --- a/src/core/hle/service/acc/acc_u1.cpp +++ b/src/core/hle/service/acc/acc_u1.cpp @@ -17,28 +17,29 @@ ACC_U1::ACC_U1(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p          {3, &ACC_U1::ListOpenUsers, "ListOpenUsers"},          {4, &ACC_U1::GetLastOpenedUser, "GetLastOpenedUser"},          {5, &ACC_U1::GetProfile, "GetProfile"}, -        {6, nullptr, "GetProfileDigest"}, +        {6, nullptr, "GetProfileDigest"}, // 3.0.0+          {50, &ACC_U1::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"},          {51, &ACC_U1::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, -        {60, nullptr, "ListOpenContextStoredUsers"}, -        {99, nullptr, "DebugActivateOpenContextRetention"}, +        {60, nullptr, "ListOpenContextStoredUsers"}, // 5.0.0 - 5.1.0 +        {99, nullptr, "DebugActivateOpenContextRetention"}, // 6.0.0+          {100, nullptr, "GetUserRegistrationNotifier"},          {101, nullptr, "GetUserStateChangeNotifier"},          {102, nullptr, "GetBaasAccountManagerForSystemService"}, -        {103, nullptr, "GetProfileUpdateNotifier"}, -        {104, nullptr, "CheckNetworkServiceAvailabilityAsync"}, -        {105, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, -        {106, nullptr, "GetProfileSyncNotifier"}, +        {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, +        {104, nullptr, "GetProfileUpdateNotifier"}, +        {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, // 4.0.0+ +        {106, nullptr, "GetProfileSyncNotifier"}, // 9.0.0+          {110, nullptr, "StoreSaveDataThumbnail"},          {111, nullptr, "ClearSaveDataThumbnail"},          {112, nullptr, "LoadSaveDataThumbnail"}, -        {113, nullptr, "GetSaveDataThumbnailExistence"}, -        {130, nullptr, "ActivateOpenContextRetention"}, -        {140, &ACC_U1::ListQualifiedUsers, "ListQualifiedUsers"}, -        {150, nullptr, "AuthenticateApplicationAsync"}, -        {190, nullptr, "GetUserLastOpenedApplication"}, -        {191, nullptr, "ActivateOpenContextHolder"}, -        {997, nullptr, "DebugInvalidateTokenCacheForUser"}, +        {113, nullptr, "GetSaveDataThumbnailExistence"}, // 5.0.0+ +        {120, nullptr, "ListOpenUsersInApplication"}, // 10.0.0+ +        {130, nullptr, "ActivateOpenContextRetention"}, // 6.0.0+ +        {140, &ACC_U1::ListQualifiedUsers, "ListQualifiedUsers"}, // 6.0.0+ +        {150, nullptr, "AuthenticateApplicationAsync"}, // 10.0.0+ +        {190, nullptr, "GetUserLastOpenedApplication"}, // 1.0.0 - 9.2.0 +        {191, nullptr, "ActivateOpenContextHolder"}, // 7.0.0+ +        {997, nullptr, "DebugInvalidateTokenCacheForUser"}, // 3.0.0+          {998, nullptr, "DebugSetUserStateClose"},          {999, nullptr, "DebugSetUserStateOpen"},      }; diff --git a/src/core/hle/service/am/applets/software_keyboard.cpp b/src/core/hle/service/am/applets/software_keyboard.cpp index 54e63c138..d14076b02 100644 --- a/src/core/hle/service/am/applets/software_keyboard.cpp +++ b/src/core/hle/service/am/applets/software_keyboard.cpp @@ -30,7 +30,7 @@ static Core::Frontend::SoftwareKeyboardParameters ConvertToFrontendParameters(                                                                         config.sub_text.size());      params.guide_text = Common::UTF16StringFromFixedZeroTerminatedBuffer(config.guide_text.data(),                                                                           config.guide_text.size()); -    params.initial_text = initial_text; +    params.initial_text = std::move(initial_text);      params.max_length = config.length_limit == 0 ? DEFAULT_MAX_LENGTH : config.length_limit;      params.password = static_cast<bool>(config.is_password);      params.cursor_at_beginning = static_cast<bool>(config.initial_cursor_position); @@ -109,7 +109,7 @@ void SoftwareKeyboard::Execute() {      const auto parameters = ConvertToFrontendParameters(config, initial_text); -    frontend.RequestText([this](std::optional<std::u16string> text) { WriteText(text); }, +    frontend.RequestText([this](std::optional<std::u16string> text) { WriteText(std::move(text)); },                           parameters);  } diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index c55d900e2..6fbee7efa 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -566,6 +566,14 @@ void Controller_NPad::DisconnectNPad(u32 npad_id) {      connected_controllers[NPadIdToIndex(npad_id)].is_connected = false;  } +void Controller_NPad::SetGyroscopeZeroDriftMode(GyroscopeZeroDriftMode drift_mode) { +    gyroscope_zero_drift_mode = drift_mode; +} + +Controller_NPad::GyroscopeZeroDriftMode Controller_NPad::GetGyroscopeZeroDriftMode() const { +    return gyroscope_zero_drift_mode; +} +  void Controller_NPad::StartLRAssignmentMode() {      // Nothing internally is used for lr assignment mode. Since we have the ability to set the      // controller types from boot, it doesn't really matter about showing a selection screen diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index 931f03430..5d4c58a43 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h @@ -58,6 +58,12 @@ public:      };      static_assert(sizeof(Vibration) == 0x10, "Vibration is an invalid size"); +    enum class GyroscopeZeroDriftMode : u32 { +        Loose = 0, +        Standard = 1, +        Tight = 2, +    }; +      enum class NpadHoldType : u64 {          Vertical = 0,          Horizontal = 1, @@ -117,6 +123,8 @@ public:      void ConnectNPad(u32 npad_id);      void DisconnectNPad(u32 npad_id); +    void SetGyroscopeZeroDriftMode(GyroscopeZeroDriftMode drift_mode); +    GyroscopeZeroDriftMode GetGyroscopeZeroDriftMode() const;      LedPattern GetLedPattern(u32 npad_id);      void SetVibrationEnabled(bool can_vibrate);      bool IsVibrationEnabled() const; @@ -324,8 +332,8 @@ private:      std::array<Kernel::EventPair, 10> styleset_changed_events;      Vibration last_processed_vibration{};      std::array<ControllerHolder, 10> connected_controllers{}; +    GyroscopeZeroDriftMode gyroscope_zero_drift_mode{GyroscopeZeroDriftMode::Standard};      bool can_controllers_vibrate{true}; -      std::array<ControllerPad, 10> npad_pad_states{};      bool is_in_lr_assignment_mode{false};      Core::System& system; diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index c84cb1483..57d5edea7 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -161,7 +161,7 @@ Hid::Hid(Core::System& system) : ServiceFramework("hid"), system(system) {          {40, nullptr, "AcquireXpadIdEventHandle"},          {41, nullptr, "ReleaseXpadIdEventHandle"},          {51, &Hid::ActivateXpad, "ActivateXpad"}, -        {55, nullptr, "GetXpadIds"}, +        {55, &Hid::GetXpadIDs, "GetXpadIds"},          {56, nullptr, "ActivateJoyXpad"},          {58, nullptr, "GetJoyXpadLifoHandle"},          {59, nullptr, "GetJoyXpadIds"}, @@ -185,8 +185,8 @@ Hid::Hid(Core::System& system) : ServiceFramework("hid"), system(system) {          {77, nullptr, "GetAccelerometerPlayMode"},          {78, nullptr, "ResetAccelerometerPlayMode"},          {79, &Hid::SetGyroscopeZeroDriftMode, "SetGyroscopeZeroDriftMode"}, -        {80, nullptr, "GetGyroscopeZeroDriftMode"}, -        {81, nullptr, "ResetGyroscopeZeroDriftMode"}, +        {80, &Hid::GetGyroscopeZeroDriftMode, "GetGyroscopeZeroDriftMode"}, +        {81, &Hid::ResetGyroscopeZeroDriftMode, "ResetGyroscopeZeroDriftMode"},          {82, &Hid::IsSixAxisSensorAtRest, "IsSixAxisSensorAtRest"},          {83, nullptr, "IsFirmwareUpdateAvailableForSixAxisSensor"},          {91, &Hid::ActivateGesture, "ActivateGesture"}, @@ -230,15 +230,15 @@ Hid::Hid(Core::System& system) : ServiceFramework("hid"), system(system) {          {211, nullptr, "IsVibrationDeviceMounted"},          {300, &Hid::ActivateConsoleSixAxisSensor, "ActivateConsoleSixAxisSensor"},          {301, &Hid::StartConsoleSixAxisSensor, "StartConsoleSixAxisSensor"}, -        {302, nullptr, "StopConsoleSixAxisSensor"}, -        {303, nullptr, "ActivateSevenSixAxisSensor"}, -        {304, nullptr, "StartSevenSixAxisSensor"}, +        {302, &Hid::StopConsoleSixAxisSensor, "StopConsoleSixAxisSensor"}, +        {303, &Hid::ActivateSevenSixAxisSensor, "ActivateSevenSixAxisSensor"}, +        {304, &Hid::StartSevenSixAxisSensor, "StartSevenSixAxisSensor"},          {305, &Hid::StopSevenSixAxisSensor, "StopSevenSixAxisSensor"},          {306, &Hid::InitializeSevenSixAxisSensor, "InitializeSevenSixAxisSensor"}, -        {307, nullptr, "FinalizeSevenSixAxisSensor"}, +        {307, &Hid::FinalizeSevenSixAxisSensor, "FinalizeSevenSixAxisSensor"},          {308, nullptr, "SetSevenSixAxisSensorFusionStrength"},          {309, nullptr, "GetSevenSixAxisSensorFusionStrength"}, -        {310, nullptr, "ResetSevenSixAxisSensorTimestamp"}, +        {310, &Hid::ResetSevenSixAxisSensorTimestamp, "ResetSevenSixAxisSensorTimestamp"},          {400, nullptr, "IsUsbFullKeyControllerEnabled"},          {401, nullptr, "EnableUsbFullKeyController"},          {402, nullptr, "IsUsbFullKeyControllerConnected"}, @@ -319,6 +319,17 @@ void Hid::ActivateXpad(Kernel::HLERequestContext& ctx) {      rb.Push(RESULT_SUCCESS);  } +void Hid::GetXpadIDs(Kernel::HLERequestContext& ctx) { +    IPC::RequestParser rp{ctx}; +    const auto applet_resource_user_id{rp.Pop<u64>()}; + +    LOG_DEBUG(Service_HID, "(STUBBED) called, applet_resource_user_id={}", applet_resource_user_id); + +    IPC::ResponseBuilder rb{ctx, 3}; +    rb.Push(RESULT_SUCCESS); +    rb.Push(0); +} +  void Hid::ActivateDebugPad(Kernel::HLERequestContext& ctx) {      IPC::RequestParser rp{ctx};      const auto applet_resource_user_id{rp.Pop<u64>()}; @@ -363,6 +374,15 @@ void Hid::ActivateKeyboard(Kernel::HLERequestContext& ctx) {      rb.Push(RESULT_SUCCESS);  } +void Hid::SendKeyboardLockKeyEvent(Kernel::HLERequestContext& ctx) { +    IPC::RequestParser rp{ctx}; +    const auto flags{rp.Pop<u32>()}; +    LOG_WARNING(Service_HID, "(STUBBED) called. flags={}", flags); + +    IPC::ResponseBuilder rb{ctx, 2}; +    rb.Push(RESULT_SUCCESS); +} +  void Hid::ActivateGesture(Kernel::HLERequestContext& ctx) {      IPC::RequestParser rp{ctx};      const auto unknown{rp.Pop<u32>()}; @@ -402,15 +422,59 @@ void Hid::StartSixAxisSensor(Kernel::HLERequestContext& ctx) {      rb.Push(RESULT_SUCCESS);  } +void Hid::StopSixAxisSensor(Kernel::HLERequestContext& ctx) { +    IPC::RequestParser rp{ctx}; +    const auto handle{rp.Pop<u32>()}; +    const auto applet_resource_user_id{rp.Pop<u64>()}; + +    LOG_WARNING(Service_HID, "(STUBBED) called, handle={}, applet_resource_user_id={}", handle, +                applet_resource_user_id); + +    IPC::ResponseBuilder rb{ctx, 2}; +    rb.Push(RESULT_SUCCESS); +} +  void Hid::SetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) {      IPC::RequestParser rp{ctx};      const auto handle{rp.Pop<u32>()};      const auto drift_mode{rp.Pop<u32>()};      const auto applet_resource_user_id{rp.Pop<u64>()}; -    LOG_WARNING(Service_HID, -                "(STUBBED) called, handle={}, drift_mode={}, applet_resource_user_id={}", handle, -                drift_mode, applet_resource_user_id); +    applet_resource->GetController<Controller_NPad>(HidController::NPad) +        .SetGyroscopeZeroDriftMode(Controller_NPad::GyroscopeZeroDriftMode{drift_mode}); + +    LOG_DEBUG(Service_HID, "called, handle={}, drift_mode={}, applet_resource_user_id={}", handle, +              drift_mode, applet_resource_user_id); + +    IPC::ResponseBuilder rb{ctx, 2}; +    rb.Push(RESULT_SUCCESS); +} + +void Hid::GetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) { +    IPC::RequestParser rp{ctx}; +    const auto handle{rp.Pop<u32>()}; +    const auto applet_resource_user_id{rp.Pop<u64>()}; + +    LOG_DEBUG(Service_HID, "called, handle={}, applet_resource_user_id={}", handle, +              applet_resource_user_id); + +    IPC::ResponseBuilder rb{ctx, 3}; +    rb.Push(RESULT_SUCCESS); +    rb.Push<u32>( +        static_cast<u32>(applet_resource->GetController<Controller_NPad>(HidController::NPad) +                             .GetGyroscopeZeroDriftMode())); +} + +void Hid::ResetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) { +    IPC::RequestParser rp{ctx}; +    const auto handle{rp.Pop<u32>()}; +    const auto applet_resource_user_id{rp.Pop<u64>()}; + +    applet_resource->GetController<Controller_NPad>(HidController::NPad) +        .SetGyroscopeZeroDriftMode(Controller_NPad::GyroscopeZeroDriftMode::Standard); + +    LOG_DEBUG(Service_HID, "called, handle={}, applet_resource_user_id={}", handle, +              applet_resource_user_id);      IPC::ResponseBuilder rb{ctx, 2};      rb.Push(RESULT_SUCCESS); @@ -821,33 +885,35 @@ void Hid::StartConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) {      rb.Push(RESULT_SUCCESS);  } -void Hid::StopSixAxisSensor(Kernel::HLERequestContext& ctx) { +void Hid::StopConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) {      IPC::RequestParser rp{ctx};      const auto handle{rp.Pop<u32>()}; +    const auto applet_resource_user_id{rp.Pop<u64>()}; -    LOG_WARNING(Service_HID, "(STUBBED) called, handle={}", handle); +    LOG_WARNING(Service_HID, "(STUBBED) called, handle={}, applet_resource_user_id={}", handle, +                applet_resource_user_id);      IPC::ResponseBuilder rb{ctx, 2};      rb.Push(RESULT_SUCCESS);  } -void Hid::SetIsPalmaAllConnectable(Kernel::HLERequestContext& ctx) { +void Hid::ActivateSevenSixAxisSensor(Kernel::HLERequestContext& ctx) {      IPC::RequestParser rp{ctx};      const auto applet_resource_user_id{rp.Pop<u64>()}; -    const auto unknown{rp.Pop<u32>()}; -    LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}, unknown={}", -                applet_resource_user_id, unknown); +    LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}", +                applet_resource_user_id);      IPC::ResponseBuilder rb{ctx, 2};      rb.Push(RESULT_SUCCESS);  } -void Hid::SetPalmaBoostMode(Kernel::HLERequestContext& ctx) { +void Hid::StartSevenSixAxisSensor(Kernel::HLERequestContext& ctx) {      IPC::RequestParser rp{ctx}; -    const auto unknown{rp.Pop<u32>()}; +    const auto applet_resource_user_id{rp.Pop<u64>()}; -    LOG_WARNING(Service_HID, "(STUBBED) called, unknown={}", unknown); +    LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}", +                applet_resource_user_id);      IPC::ResponseBuilder rb{ctx, 2};      rb.Push(RESULT_SUCCESS); @@ -871,10 +937,46 @@ void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) {      rb.Push(RESULT_SUCCESS);  } -void Hid::SendKeyboardLockKeyEvent(Kernel::HLERequestContext& ctx) { +void Hid::FinalizeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) {      IPC::RequestParser rp{ctx}; -    const auto flags{rp.Pop<u32>()}; -    LOG_WARNING(Service_HID, "(STUBBED) called. flags={}", flags); +    const auto applet_resource_user_id{rp.Pop<u64>()}; + +    LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}", +                applet_resource_user_id); + +    IPC::ResponseBuilder rb{ctx, 2}; +    rb.Push(RESULT_SUCCESS); +} + +void Hid::ResetSevenSixAxisSensorTimestamp(Kernel::HLERequestContext& ctx) { +    IPC::RequestParser rp{ctx}; +    const auto applet_resource_user_id{rp.Pop<u64>()}; + +    LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}", +                applet_resource_user_id); + +    IPC::ResponseBuilder rb{ctx, 2}; +    rb.Push(RESULT_SUCCESS); +} + +void Hid::SetIsPalmaAllConnectable(Kernel::HLERequestContext& ctx) { +    IPC::RequestParser rp{ctx}; +    const auto applet_resource_user_id{rp.Pop<u64>()}; +    const auto is_palma_all_connectable{rp.Pop<bool>()}; + +    LOG_WARNING(Service_HID, +                "(STUBBED) called, applet_resource_user_id={}, is_palma_all_connectable={}", +                applet_resource_user_id, is_palma_all_connectable); + +    IPC::ResponseBuilder rb{ctx, 2}; +    rb.Push(RESULT_SUCCESS); +} + +void Hid::SetPalmaBoostMode(Kernel::HLERequestContext& ctx) { +    IPC::RequestParser rp{ctx}; +    const auto palma_boost_mode{rp.Pop<bool>()}; + +    LOG_WARNING(Service_HID, "(STUBBED) called, palma_boost_mode={}", palma_boost_mode);      IPC::ResponseBuilder rb{ctx, 2};      rb.Push(RESULT_SUCCESS); diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index c8ed4ad8b..6fb048360 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h @@ -86,14 +86,19 @@ public:  private:      void CreateAppletResource(Kernel::HLERequestContext& ctx);      void ActivateXpad(Kernel::HLERequestContext& ctx); +    void GetXpadIDs(Kernel::HLERequestContext& ctx);      void ActivateDebugPad(Kernel::HLERequestContext& ctx);      void ActivateTouchScreen(Kernel::HLERequestContext& ctx);      void ActivateMouse(Kernel::HLERequestContext& ctx);      void ActivateKeyboard(Kernel::HLERequestContext& ctx); +    void SendKeyboardLockKeyEvent(Kernel::HLERequestContext& ctx);      void ActivateGesture(Kernel::HLERequestContext& ctx);      void ActivateNpadWithRevision(Kernel::HLERequestContext& ctx);      void StartSixAxisSensor(Kernel::HLERequestContext& ctx); +    void StopSixAxisSensor(Kernel::HLERequestContext& ctx);      void SetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx); +    void GetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx); +    void ResetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx);      void IsSixAxisSensorAtRest(Kernel::HLERequestContext& ctx);      void SetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx);      void GetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx); @@ -125,12 +130,15 @@ private:      void IsVibrationPermitted(Kernel::HLERequestContext& ctx);      void ActivateConsoleSixAxisSensor(Kernel::HLERequestContext& ctx);      void StartConsoleSixAxisSensor(Kernel::HLERequestContext& ctx); -    void StopSixAxisSensor(Kernel::HLERequestContext& ctx); -    void SetIsPalmaAllConnectable(Kernel::HLERequestContext& ctx); -    void SetPalmaBoostMode(Kernel::HLERequestContext& ctx); +    void StopConsoleSixAxisSensor(Kernel::HLERequestContext& ctx); +    void ActivateSevenSixAxisSensor(Kernel::HLERequestContext& ctx); +    void StartSevenSixAxisSensor(Kernel::HLERequestContext& ctx);      void StopSevenSixAxisSensor(Kernel::HLERequestContext& ctx);      void InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx); -    void SendKeyboardLockKeyEvent(Kernel::HLERequestContext& ctx); +    void FinalizeSevenSixAxisSensor(Kernel::HLERequestContext& ctx); +    void ResetSevenSixAxisSensorTimestamp(Kernel::HLERequestContext& ctx); +    void SetIsPalmaAllConnectable(Kernel::HLERequestContext& ctx); +    void SetPalmaBoostMode(Kernel::HLERequestContext& ctx);      std::shared_ptr<IAppletResource> applet_resource;      Core::System& system; diff --git a/src/core/hle/service/lm/manager.cpp b/src/core/hle/service/lm/manager.cpp index b67081b86..3ee2374e7 100644 --- a/src/core/hle/service/lm/manager.cpp +++ b/src/core/hle/service/lm/manager.cpp @@ -86,7 +86,8 @@ std::string FormatField(Field type, const std::vector<u8>& data) {          return Common::StringFromFixedZeroTerminatedBuffer(              reinterpret_cast<const char*>(data.data()), data.size());      default: -        UNIMPLEMENTED(); +        UNIMPLEMENTED_MSG("Unimplemented field type={}", type); +        return "";      }  } diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp index cc2192e5c..0d913334e 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp @@ -25,7 +25,7 @@ u32 nvhost_ctrl_gpu::ioctl(Ioctl command, const std::vector<u8>& input,      case IoctlCommand::IocGetCharacteristicsCommand:          return GetCharacteristics(input, output, output2, version);      case IoctlCommand::IocGetTPCMasksCommand: -        return GetTPCMasks(input, output); +        return GetTPCMasks(input, output, output2, version);      case IoctlCommand::IocGetActiveSlotMaskCommand:          return GetActiveSlotMask(input, output);      case IoctlCommand::IocZcullGetCtxSizeCommand: @@ -98,17 +98,22 @@ u32 nvhost_ctrl_gpu::GetCharacteristics(const std::vector<u8>& input, std::vecto      return 0;  } -u32 nvhost_ctrl_gpu::GetTPCMasks(const std::vector<u8>& input, std::vector<u8>& output) { +u32 nvhost_ctrl_gpu::GetTPCMasks(const std::vector<u8>& input, std::vector<u8>& output, +                                 std::vector<u8>& output2, IoctlVersion version) {      IoctlGpuGetTpcMasksArgs params{};      std::memcpy(¶ms, input.data(), input.size()); -    LOG_INFO(Service_NVDRV, "called, mask=0x{:X}, mask_buf_addr=0x{:X}", params.mask_buf_size, -             params.mask_buf_addr); -    // TODO(ogniK): Confirm value on hardware -    if (params.mask_buf_size) -        params.tpc_mask_size = 4 * 1; // 4 * num_gpc -    else -        params.tpc_mask_size = 0; -    std::memcpy(output.data(), ¶ms, sizeof(params)); +    LOG_DEBUG(Service_NVDRV, "called, mask_buffer_size=0x{:X}", params.mask_buffer_size); +    if (params.mask_buffer_size != 0) { +        params.tcp_mask = 3; +    } + +    if (version == IoctlVersion::Version3) { +        std::memcpy(output.data(), input.data(), output.size()); +        std::memcpy(output2.data(), ¶ms.tcp_mask, output2.size()); +    } else { +        std::memcpy(output.data(), ¶ms, output.size()); +    } +      return 0;  } diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h index 07b644ec5..ef60f72ce 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h @@ -92,16 +92,11 @@ private:                    "IoctlCharacteristics is incorrect size");      struct IoctlGpuGetTpcMasksArgs { -        /// [in]  TPC mask buffer size reserved by userspace. Should be at least -        /// sizeof(__u32) * fls(gpc_mask) to receive TPC mask for each GPC. -        /// [out] full kernel buffer size -        u32_le mask_buf_size; -        u32_le reserved; - -        /// [in]  pointer to TPC mask buffer. It will receive one 32-bit TPC mask per GPC or 0 if -        /// GPC is not enabled or not present. This parameter is ignored if mask_buf_size is 0. -        u64_le mask_buf_addr; -        u64_le tpc_mask_size; // Nintendo add this? +        u32_le mask_buffer_size{}; +        INSERT_PADDING_WORDS(1); +        u64_le mask_buffer_address{}; +        u32_le tcp_mask{}; +        INSERT_PADDING_WORDS(1);      };      static_assert(sizeof(IoctlGpuGetTpcMasksArgs) == 24,                    "IoctlGpuGetTpcMasksArgs is incorrect size"); @@ -166,7 +161,8 @@ private:      u32 GetCharacteristics(const std::vector<u8>& input, std::vector<u8>& output,                             std::vector<u8>& output2, IoctlVersion version); -    u32 GetTPCMasks(const std::vector<u8>& input, std::vector<u8>& output); +    u32 GetTPCMasks(const std::vector<u8>& input, std::vector<u8>& output, std::vector<u8>& output2, +                    IoctlVersion version);      u32 GetActiveSlotMask(const std::vector<u8>& input, std::vector<u8>& output);      u32 ZCullGetCtxSize(const std::vector<u8>& input, std::vector<u8>& output);      u32 ZCullGetInfo(const std::vector<u8>& input, std::vector<u8>& output); diff --git a/src/core/settings.h b/src/core/settings.h index 78eb33737..33e1e06cd 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -437,7 +437,7 @@ struct Values {      bool renderer_debug;      int vulkan_device; -    float resolution_factor; +    u16 resolution_factor{1};      int aspect_ratio;      int max_anisotropy;      bool use_frame_limit; @@ -474,6 +474,7 @@ struct Values {      bool reporting_services;      bool quest_flag;      bool disable_cpu_opt; +    bool disable_macro_jit;      // BCAT      std::string bcat_backend; | 
