diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/core.cpp | 2 | ||||
| -rw-r--r-- | src/core/core_timing.cpp | 16 | ||||
| -rw-r--r-- | src/core/core_timing.h | 7 | ||||
| -rw-r--r-- | src/core/device_memory.cpp | 5 | ||||
| -rw-r--r-- | src/core/device_memory.h | 8 | ||||
| -rw-r--r-- | src/core/file_sys/registered_cache.cpp | 101 | ||||
| -rw-r--r-- | src/core/file_sys/registered_cache.h | 6 | ||||
| -rw-r--r-- | src/core/file_sys/xts_archive.cpp | 14 | ||||
| -rw-r--r-- | src/core/hardware_interrupt_manager.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/kernel.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/server_session.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/kernel/time_manager.cpp | 10 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.h | 2 | ||||
| -rw-r--r-- | src/core/hle/service/nvflinger/nvflinger.cpp | 2 | ||||
| -rw-r--r-- | src/core/memory/cheat_engine.cpp | 12 | ||||
| -rw-r--r-- | src/core/memory/cheat_engine.h | 2 | ||||
| -rw-r--r-- | src/core/settings.cpp | 1 | ||||
| -rw-r--r-- | src/core/settings.h | 1 | ||||
| -rw-r--r-- | src/core/tools/freezer.cpp | 11 | ||||
| -rw-r--r-- | src/core/tools/freezer.h | 2 |
21 files changed, 113 insertions, 109 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index e598c0e2b..42277e2cd 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -146,7 +146,7 @@ struct System::Impl { | |||
| 146 | ResultStatus Init(System& system, Frontend::EmuWindow& emu_window) { | 146 | ResultStatus Init(System& system, Frontend::EmuWindow& emu_window) { |
| 147 | LOG_DEBUG(HW_Memory, "initialized OK"); | 147 | LOG_DEBUG(HW_Memory, "initialized OK"); |
| 148 | 148 | ||
| 149 | device_memory = std::make_unique<Core::DeviceMemory>(system); | 149 | device_memory = std::make_unique<Core::DeviceMemory>(); |
| 150 | 150 | ||
| 151 | is_multicore = Settings::values.use_multi_core.GetValue(); | 151 | is_multicore = Settings::values.use_multi_core.GetValue(); |
| 152 | is_async_gpu = is_multicore || Settings::values.use_asynchronous_gpu_emulation.GetValue(); | 152 | is_async_gpu = is_multicore || Settings::values.use_asynchronous_gpu_emulation.GetValue(); |
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index b5feb3f24..71af26ec5 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp | |||
| @@ -23,7 +23,7 @@ std::shared_ptr<EventType> CreateEvent(std::string name, TimedCallback&& callbac | |||
| 23 | struct CoreTiming::Event { | 23 | struct CoreTiming::Event { |
| 24 | u64 time; | 24 | u64 time; |
| 25 | u64 fifo_order; | 25 | u64 fifo_order; |
| 26 | u64 userdata; | 26 | std::uintptr_t user_data; |
| 27 | std::weak_ptr<EventType> type; | 27 | std::weak_ptr<EventType> type; |
| 28 | 28 | ||
| 29 | // Sort by time, unless the times are the same, in which case sort by | 29 | // Sort by time, unless the times are the same, in which case sort by |
| @@ -58,7 +58,7 @@ void CoreTiming::Initialize(std::function<void()>&& on_thread_init_) { | |||
| 58 | event_fifo_id = 0; | 58 | event_fifo_id = 0; |
| 59 | shutting_down = false; | 59 | shutting_down = false; |
| 60 | ticks = 0; | 60 | ticks = 0; |
| 61 | const auto empty_timed_callback = [](u64, std::chrono::nanoseconds) {}; | 61 | const auto empty_timed_callback = [](std::uintptr_t, std::chrono::nanoseconds) {}; |
| 62 | ev_lost = CreateEvent("_lost_event", empty_timed_callback); | 62 | ev_lost = CreateEvent("_lost_event", empty_timed_callback); |
| 63 | if (is_multicore) { | 63 | if (is_multicore) { |
| 64 | timer_thread = std::make_unique<std::thread>(ThreadEntry, std::ref(*this)); | 64 | timer_thread = std::make_unique<std::thread>(ThreadEntry, std::ref(*this)); |
| @@ -107,22 +107,24 @@ bool CoreTiming::HasPendingEvents() const { | |||
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | void CoreTiming::ScheduleEvent(std::chrono::nanoseconds ns_into_future, | 109 | void CoreTiming::ScheduleEvent(std::chrono::nanoseconds ns_into_future, |
| 110 | const std::shared_ptr<EventType>& event_type, u64 userdata) { | 110 | const std::shared_ptr<EventType>& event_type, |
| 111 | std::uintptr_t user_data) { | ||
| 111 | { | 112 | { |
| 112 | std::scoped_lock scope{basic_lock}; | 113 | std::scoped_lock scope{basic_lock}; |
| 113 | const u64 timeout = static_cast<u64>((GetGlobalTimeNs() + ns_into_future).count()); | 114 | const u64 timeout = static_cast<u64>((GetGlobalTimeNs() + ns_into_future).count()); |
| 114 | 115 | ||
| 115 | event_queue.emplace_back(Event{timeout, event_fifo_id++, userdata, event_type}); | 116 | event_queue.emplace_back(Event{timeout, event_fifo_id++, user_data, event_type}); |
| 116 | 117 | ||
| 117 | std::push_heap(event_queue.begin(), event_queue.end(), std::greater<>()); | 118 | std::push_heap(event_queue.begin(), event_queue.end(), std::greater<>()); |
| 118 | } | 119 | } |
| 119 | event.Set(); | 120 | event.Set(); |
| 120 | } | 121 | } |
| 121 | 122 | ||
| 122 | void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type, u64 userdata) { | 123 | void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type, |
| 124 | std::uintptr_t user_data) { | ||
| 123 | std::scoped_lock scope{basic_lock}; | 125 | std::scoped_lock scope{basic_lock}; |
| 124 | const auto itr = std::remove_if(event_queue.begin(), event_queue.end(), [&](const Event& e) { | 126 | const auto itr = std::remove_if(event_queue.begin(), event_queue.end(), [&](const Event& e) { |
| 125 | return e.type.lock().get() == event_type.get() && e.userdata == userdata; | 127 | return e.type.lock().get() == event_type.get() && e.user_data == user_data; |
| 126 | }); | 128 | }); |
| 127 | 129 | ||
| 128 | // Removing random items breaks the invariant so we have to re-establish it. | 130 | // Removing random items breaks the invariant so we have to re-establish it. |
| @@ -197,7 +199,7 @@ std::optional<s64> CoreTiming::Advance() { | |||
| 197 | 199 | ||
| 198 | if (const auto event_type{evt.type.lock()}) { | 200 | if (const auto event_type{evt.type.lock()}) { |
| 199 | event_type->callback( | 201 | event_type->callback( |
| 200 | evt.userdata, std::chrono::nanoseconds{static_cast<s64>(global_timer - evt.time)}); | 202 | evt.user_data, std::chrono::nanoseconds{static_cast<s64>(global_timer - evt.time)}); |
| 201 | } | 203 | } |
| 202 | 204 | ||
| 203 | basic_lock.lock(); | 205 | basic_lock.lock(); |
diff --git a/src/core/core_timing.h b/src/core/core_timing.h index 120c74e46..b0b6036e4 100644 --- a/src/core/core_timing.h +++ b/src/core/core_timing.h | |||
| @@ -22,7 +22,8 @@ | |||
| 22 | namespace Core::Timing { | 22 | namespace Core::Timing { |
| 23 | 23 | ||
| 24 | /// A callback that may be scheduled for a particular core timing event. | 24 | /// A callback that may be scheduled for a particular core timing event. |
| 25 | using TimedCallback = std::function<void(u64 userdata, std::chrono::nanoseconds ns_late)>; | 25 | using TimedCallback = |
| 26 | std::function<void(std::uintptr_t user_data, std::chrono::nanoseconds ns_late)>; | ||
| 26 | 27 | ||
| 27 | /// Contains the characteristics of a particular event. | 28 | /// Contains the characteristics of a particular event. |
| 28 | struct EventType { | 29 | struct EventType { |
| @@ -94,9 +95,9 @@ public: | |||
| 94 | 95 | ||
| 95 | /// Schedules an event in core timing | 96 | /// Schedules an event in core timing |
| 96 | void ScheduleEvent(std::chrono::nanoseconds ns_into_future, | 97 | void ScheduleEvent(std::chrono::nanoseconds ns_into_future, |
| 97 | const std::shared_ptr<EventType>& event_type, u64 userdata = 0); | 98 | const std::shared_ptr<EventType>& event_type, std::uintptr_t user_data = 0); |
| 98 | 99 | ||
| 99 | void UnscheduleEvent(const std::shared_ptr<EventType>& event_type, u64 userdata); | 100 | void UnscheduleEvent(const std::shared_ptr<EventType>& event_type, std::uintptr_t user_data); |
| 100 | 101 | ||
| 101 | /// We only permit one event of each type in the queue at a time. | 102 | /// We only permit one event of each type in the queue at a time. |
| 102 | void RemoveEvent(const std::shared_ptr<EventType>& event_type); | 103 | void RemoveEvent(const std::shared_ptr<EventType>& event_type); |
diff --git a/src/core/device_memory.cpp b/src/core/device_memory.cpp index 51097ced3..0c4b440ed 100644 --- a/src/core/device_memory.cpp +++ b/src/core/device_memory.cpp | |||
| @@ -2,14 +2,11 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "core/core.h" | ||
| 6 | #include "core/device_memory.h" | 5 | #include "core/device_memory.h" |
| 7 | #include "core/memory.h" | ||
| 8 | 6 | ||
| 9 | namespace Core { | 7 | namespace Core { |
| 10 | 8 | ||
| 11 | DeviceMemory::DeviceMemory(System& system) : buffer{DramMemoryMap::Size}, system{system} {} | 9 | DeviceMemory::DeviceMemory() : buffer{DramMemoryMap::Size} {} |
| 12 | |||
| 13 | DeviceMemory::~DeviceMemory() = default; | 10 | DeviceMemory::~DeviceMemory() = default; |
| 14 | 11 | ||
| 15 | } // namespace Core | 12 | } // namespace Core |
diff --git a/src/core/device_memory.h b/src/core/device_memory.h index 9efa088d0..5b1ae28f3 100644 --- a/src/core/device_memory.h +++ b/src/core/device_memory.h | |||
| @@ -4,14 +4,11 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "common/assert.h" | 7 | #include "common/common_types.h" |
| 8 | #include "common/common_funcs.h" | ||
| 9 | #include "common/virtual_buffer.h" | 8 | #include "common/virtual_buffer.h" |
| 10 | 9 | ||
| 11 | namespace Core { | 10 | namespace Core { |
| 12 | 11 | ||
| 13 | class System; | ||
| 14 | |||
| 15 | namespace DramMemoryMap { | 12 | namespace DramMemoryMap { |
| 16 | enum : u64 { | 13 | enum : u64 { |
| 17 | Base = 0x80000000ULL, | 14 | Base = 0x80000000ULL, |
| @@ -26,7 +23,7 @@ enum : u64 { | |||
| 26 | 23 | ||
| 27 | class DeviceMemory : NonCopyable { | 24 | class DeviceMemory : NonCopyable { |
| 28 | public: | 25 | public: |
| 29 | explicit DeviceMemory(Core::System& system); | 26 | explicit DeviceMemory(); |
| 30 | ~DeviceMemory(); | 27 | ~DeviceMemory(); |
| 31 | 28 | ||
| 32 | template <typename T> | 29 | template <typename T> |
| @@ -45,7 +42,6 @@ public: | |||
| 45 | 42 | ||
| 46 | private: | 43 | private: |
| 47 | Common::VirtualBuffer<u8> buffer; | 44 | Common::VirtualBuffer<u8> buffer; |
| 48 | Core::System& system; | ||
| 49 | }; | 45 | }; |
| 50 | 46 | ||
| 51 | } // namespace Core | 47 | } // namespace Core |
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index 37351c561..e94eed3b6 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp | |||
| @@ -547,56 +547,6 @@ InstallResult RegisteredCache::InstallEntry(const XCI& xci, bool overwrite_if_ex | |||
| 547 | return InstallEntry(*xci.GetSecurePartitionNSP(), overwrite_if_exists, copy); | 547 | return InstallEntry(*xci.GetSecurePartitionNSP(), overwrite_if_exists, copy); |
| 548 | } | 548 | } |
| 549 | 549 | ||
| 550 | bool RegisteredCache::RemoveExistingEntry(u64 title_id) { | ||
| 551 | const auto delete_nca = [this](const NcaID& id) { | ||
| 552 | const auto path = GetRelativePathFromNcaID(id, false, true, false); | ||
| 553 | |||
| 554 | if (dir->GetFileRelative(path) == nullptr) { | ||
| 555 | return false; | ||
| 556 | } | ||
| 557 | |||
| 558 | Core::Crypto::SHA256Hash hash{}; | ||
| 559 | mbedtls_sha256_ret(id.data(), id.size(), hash.data(), 0); | ||
| 560 | const auto dirname = fmt::format("000000{:02X}", hash[0]); | ||
| 561 | |||
| 562 | const auto dir2 = GetOrCreateDirectoryRelative(dir, dirname); | ||
| 563 | |||
| 564 | const auto res = dir2->DeleteFile(fmt::format("{}.nca", Common::HexToString(id, false))); | ||
| 565 | |||
| 566 | return res; | ||
| 567 | }; | ||
| 568 | |||
| 569 | // If an entry exists in the registered cache, remove it | ||
| 570 | if (HasEntry(title_id, ContentRecordType::Meta)) { | ||
| 571 | LOG_INFO(Loader, | ||
| 572 | "Previously installed entry (v{}) for title_id={:016X} detected! " | ||
| 573 | "Attempting to remove...", | ||
| 574 | GetEntryVersion(title_id).value_or(0), title_id); | ||
| 575 | // Get all the ncas associated with the current CNMT and delete them | ||
| 576 | const auto meta_old_id = | ||
| 577 | GetNcaIDFromMetadata(title_id, ContentRecordType::Meta).value_or(NcaID{}); | ||
| 578 | const auto program_id = | ||
| 579 | GetNcaIDFromMetadata(title_id, ContentRecordType::Program).value_or(NcaID{}); | ||
| 580 | const auto data_id = | ||
| 581 | GetNcaIDFromMetadata(title_id, ContentRecordType::Data).value_or(NcaID{}); | ||
| 582 | const auto control_id = | ||
| 583 | GetNcaIDFromMetadata(title_id, ContentRecordType::Control).value_or(NcaID{}); | ||
| 584 | const auto html_id = | ||
| 585 | GetNcaIDFromMetadata(title_id, ContentRecordType::HtmlDocument).value_or(NcaID{}); | ||
| 586 | const auto legal_id = | ||
| 587 | GetNcaIDFromMetadata(title_id, ContentRecordType::LegalInformation).value_or(NcaID{}); | ||
| 588 | |||
| 589 | delete_nca(meta_old_id); | ||
| 590 | delete_nca(program_id); | ||
| 591 | delete_nca(data_id); | ||
| 592 | delete_nca(control_id); | ||
| 593 | delete_nca(html_id); | ||
| 594 | delete_nca(legal_id); | ||
| 595 | return true; | ||
| 596 | } | ||
| 597 | return false; | ||
| 598 | } | ||
| 599 | |||
| 600 | InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_exists, | 550 | InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_exists, |
| 601 | const VfsCopyFunction& copy) { | 551 | const VfsCopyFunction& copy) { |
| 602 | const auto ncas = nsp.GetNCAsCollapsed(); | 552 | const auto ncas = nsp.GetNCAsCollapsed(); |
| @@ -692,6 +642,57 @@ InstallResult RegisteredCache::InstallEntry(const NCA& nca, TitleType type, | |||
| 692 | return RawInstallNCA(nca, copy, overwrite_if_exists, c_rec.nca_id); | 642 | return RawInstallNCA(nca, copy, overwrite_if_exists, c_rec.nca_id); |
| 693 | } | 643 | } |
| 694 | 644 | ||
| 645 | bool RegisteredCache::RemoveExistingEntry(u64 title_id) const { | ||
| 646 | const auto delete_nca = [this](const NcaID& id) { | ||
| 647 | const auto path = GetRelativePathFromNcaID(id, false, true, false); | ||
| 648 | |||
| 649 | const bool isFile = dir->GetFileRelative(path) != nullptr; | ||
| 650 | const bool isDir = dir->GetDirectoryRelative(path) != nullptr; | ||
| 651 | |||
| 652 | if (isFile) { | ||
| 653 | return dir->DeleteFile(path); | ||
| 654 | } else if (isDir) { | ||
| 655 | return dir->DeleteSubdirectoryRecursive(path); | ||
| 656 | } | ||
| 657 | |||
| 658 | return false; | ||
| 659 | }; | ||
| 660 | |||
| 661 | // If an entry exists in the registered cache, remove it | ||
| 662 | if (HasEntry(title_id, ContentRecordType::Meta)) { | ||
| 663 | LOG_INFO(Loader, | ||
| 664 | "Previously installed entry (v{}) for title_id={:016X} detected! " | ||
| 665 | "Attempting to remove...", | ||
| 666 | GetEntryVersion(title_id).value_or(0), title_id); | ||
| 667 | |||
| 668 | // Get all the ncas associated with the current CNMT and delete them | ||
| 669 | const auto meta_old_id = | ||
| 670 | GetNcaIDFromMetadata(title_id, ContentRecordType::Meta).value_or(NcaID{}); | ||
| 671 | const auto program_id = | ||
| 672 | GetNcaIDFromMetadata(title_id, ContentRecordType::Program).value_or(NcaID{}); | ||
| 673 | const auto data_id = | ||
| 674 | GetNcaIDFromMetadata(title_id, ContentRecordType::Data).value_or(NcaID{}); | ||
| 675 | const auto control_id = | ||
| 676 | GetNcaIDFromMetadata(title_id, ContentRecordType::Control).value_or(NcaID{}); | ||
| 677 | const auto html_id = | ||
| 678 | GetNcaIDFromMetadata(title_id, ContentRecordType::HtmlDocument).value_or(NcaID{}); | ||
| 679 | const auto legal_id = | ||
| 680 | GetNcaIDFromMetadata(title_id, ContentRecordType::LegalInformation).value_or(NcaID{}); | ||
| 681 | |||
| 682 | const auto deleted_meta = delete_nca(meta_old_id); | ||
| 683 | const auto deleted_program = delete_nca(program_id); | ||
| 684 | const auto deleted_data = delete_nca(data_id); | ||
| 685 | const auto deleted_control = delete_nca(control_id); | ||
| 686 | const auto deleted_html = delete_nca(html_id); | ||
| 687 | const auto deleted_legal = delete_nca(legal_id); | ||
| 688 | |||
| 689 | return deleted_meta && (deleted_meta || deleted_program || deleted_data || | ||
| 690 | deleted_control || deleted_html || deleted_legal); | ||
| 691 | } | ||
| 692 | |||
| 693 | return false; | ||
| 694 | } | ||
| 695 | |||
| 695 | InstallResult RegisteredCache::RawInstallNCA(const NCA& nca, const VfsCopyFunction& copy, | 696 | InstallResult RegisteredCache::RawInstallNCA(const NCA& nca, const VfsCopyFunction& copy, |
| 696 | bool overwrite_if_exists, | 697 | bool overwrite_if_exists, |
| 697 | std::optional<NcaID> override_id) { | 698 | std::optional<NcaID> override_id) { |
diff --git a/src/core/file_sys/registered_cache.h b/src/core/file_sys/registered_cache.h index 29cf0d40c..ec1d54f27 100644 --- a/src/core/file_sys/registered_cache.h +++ b/src/core/file_sys/registered_cache.h | |||
| @@ -155,9 +155,6 @@ public: | |||
| 155 | std::optional<TitleType> title_type = {}, std::optional<ContentRecordType> record_type = {}, | 155 | std::optional<TitleType> title_type = {}, std::optional<ContentRecordType> record_type = {}, |
| 156 | std::optional<u64> title_id = {}) const override; | 156 | std::optional<u64> title_id = {}) const override; |
| 157 | 157 | ||
| 158 | // Removes an existing entry based on title id | ||
| 159 | bool RemoveExistingEntry(u64 title_id); | ||
| 160 | |||
| 161 | // Raw copies all the ncas from the xci/nsp to the csache. Does some quick checks to make sure | 158 | // Raw copies all the ncas from the xci/nsp to the csache. Does some quick checks to make sure |
| 162 | // there is a meta NCA and all of them are accessible. | 159 | // there is a meta NCA and all of them are accessible. |
| 163 | InstallResult InstallEntry(const XCI& xci, bool overwrite_if_exists = false, | 160 | InstallResult InstallEntry(const XCI& xci, bool overwrite_if_exists = false, |
| @@ -172,6 +169,9 @@ public: | |||
| 172 | InstallResult InstallEntry(const NCA& nca, TitleType type, bool overwrite_if_exists = false, | 169 | InstallResult InstallEntry(const NCA& nca, TitleType type, bool overwrite_if_exists = false, |
| 173 | const VfsCopyFunction& copy = &VfsRawCopy); | 170 | const VfsCopyFunction& copy = &VfsRawCopy); |
| 174 | 171 | ||
| 172 | // Removes an existing entry based on title id | ||
| 173 | bool RemoveExistingEntry(u64 title_id) const; | ||
| 174 | |||
| 175 | private: | 175 | private: |
| 176 | template <typename T> | 176 | template <typename T> |
| 177 | void IterateAllMetadata(std::vector<T>& out, | 177 | void IterateAllMetadata(std::vector<T>& out, |
diff --git a/src/core/file_sys/xts_archive.cpp b/src/core/file_sys/xts_archive.cpp index 86e06ccb9..81413c684 100644 --- a/src/core/file_sys/xts_archive.cpp +++ b/src/core/file_sys/xts_archive.cpp | |||
| @@ -70,14 +70,18 @@ NAX::NAX(VirtualFile file_, std::array<u8, 0x10> nca_id) | |||
| 70 | NAX::~NAX() = default; | 70 | NAX::~NAX() = default; |
| 71 | 71 | ||
| 72 | Loader::ResultStatus NAX::Parse(std::string_view path) { | 72 | Loader::ResultStatus NAX::Parse(std::string_view path) { |
| 73 | if (file->ReadObject(header.get()) != sizeof(NAXHeader)) | 73 | if (file == nullptr) { |
| 74 | return Loader::ResultStatus::ErrorNullFile; | ||
| 75 | } | ||
| 76 | if (file->ReadObject(header.get()) != sizeof(NAXHeader)) { | ||
| 74 | return Loader::ResultStatus::ErrorBadNAXHeader; | 77 | return Loader::ResultStatus::ErrorBadNAXHeader; |
| 75 | 78 | } | |
| 76 | if (header->magic != Common::MakeMagic('N', 'A', 'X', '0')) | 79 | if (header->magic != Common::MakeMagic('N', 'A', 'X', '0')) { |
| 77 | return Loader::ResultStatus::ErrorBadNAXHeader; | 80 | return Loader::ResultStatus::ErrorBadNAXHeader; |
| 78 | 81 | } | |
| 79 | if (file->GetSize() < NAX_HEADER_PADDING_SIZE + header->file_size) | 82 | if (file->GetSize() < NAX_HEADER_PADDING_SIZE + header->file_size) { |
| 80 | return Loader::ResultStatus::ErrorIncorrectNAXFileSize; | 83 | return Loader::ResultStatus::ErrorIncorrectNAXFileSize; |
| 84 | } | ||
| 81 | 85 | ||
| 82 | keys.DeriveSDSeedLazy(); | 86 | keys.DeriveSDSeedLazy(); |
| 83 | std::array<Core::Crypto::Key256, 2> sd_keys{}; | 87 | std::array<Core::Crypto::Key256, 2> sd_keys{}; |
diff --git a/src/core/hardware_interrupt_manager.cpp b/src/core/hardware_interrupt_manager.cpp index efc1030c1..645f26e91 100644 --- a/src/core/hardware_interrupt_manager.cpp +++ b/src/core/hardware_interrupt_manager.cpp | |||
| @@ -11,8 +11,8 @@ | |||
| 11 | namespace Core::Hardware { | 11 | namespace Core::Hardware { |
| 12 | 12 | ||
| 13 | InterruptManager::InterruptManager(Core::System& system_in) : system(system_in) { | 13 | InterruptManager::InterruptManager(Core::System& system_in) : system(system_in) { |
| 14 | gpu_interrupt_event = | 14 | gpu_interrupt_event = Core::Timing::CreateEvent( |
| 15 | Core::Timing::CreateEvent("GPUInterrupt", [this](u64 message, std::chrono::nanoseconds) { | 15 | "GPUInterrupt", [this](std::uintptr_t message, std::chrono::nanoseconds) { |
| 16 | auto nvdrv = system.ServiceManager().GetService<Service::Nvidia::NVDRV>("nvdrv"); | 16 | auto nvdrv = system.ServiceManager().GetService<Service::Nvidia::NVDRV>("nvdrv"); |
| 17 | const u32 syncpt = static_cast<u32>(message >> 32); | 17 | const u32 syncpt = static_cast<u32>(message >> 32); |
| 18 | const u32 value = static_cast<u32>(message); | 18 | const u32 value = static_cast<u32>(message); |
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 8dd4a2637..cabe8d418 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -145,7 +145,7 @@ struct KernelCore::Impl { | |||
| 145 | 145 | ||
| 146 | void InitializePreemption(KernelCore& kernel) { | 146 | void InitializePreemption(KernelCore& kernel) { |
| 147 | preemption_event = Core::Timing::CreateEvent( | 147 | preemption_event = Core::Timing::CreateEvent( |
| 148 | "PreemptionCallback", [this, &kernel](u64, std::chrono::nanoseconds) { | 148 | "PreemptionCallback", [this, &kernel](std::uintptr_t, std::chrono::nanoseconds) { |
| 149 | { | 149 | { |
| 150 | SchedulerLock lock(kernel); | 150 | SchedulerLock lock(kernel); |
| 151 | global_scheduler.PreemptThreads(); | 151 | global_scheduler.PreemptThreads(); |
diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp index af22f4c33..7e6391c6c 100644 --- a/src/core/hle/kernel/server_session.cpp +++ b/src/core/hle/kernel/server_session.cpp | |||
| @@ -33,8 +33,10 @@ ResultVal<std::shared_ptr<ServerSession>> ServerSession::Create(KernelCore& kern | |||
| 33 | std::string name) { | 33 | std::string name) { |
| 34 | std::shared_ptr<ServerSession> session{std::make_shared<ServerSession>(kernel)}; | 34 | std::shared_ptr<ServerSession> session{std::make_shared<ServerSession>(kernel)}; |
| 35 | 35 | ||
| 36 | session->request_event = Core::Timing::CreateEvent( | 36 | session->request_event = |
| 37 | name, [session](u64, std::chrono::nanoseconds) { session->CompleteSyncRequest(); }); | 37 | Core::Timing::CreateEvent(name, [session](std::uintptr_t, std::chrono::nanoseconds) { |
| 38 | session->CompleteSyncRequest(); | ||
| 39 | }); | ||
| 38 | session->name = std::move(name); | 40 | session->name = std::move(name); |
| 39 | session->parent = std::move(parent); | 41 | session->parent = std::move(parent); |
| 40 | 42 | ||
diff --git a/src/core/hle/kernel/time_manager.cpp b/src/core/hle/kernel/time_manager.cpp index 88b01b751..95f2446c9 100644 --- a/src/core/hle/kernel/time_manager.cpp +++ b/src/core/hle/kernel/time_manager.cpp | |||
| @@ -16,14 +16,14 @@ namespace Kernel { | |||
| 16 | 16 | ||
| 17 | TimeManager::TimeManager(Core::System& system_) : system{system_} { | 17 | TimeManager::TimeManager(Core::System& system_) : system{system_} { |
| 18 | time_manager_event_type = Core::Timing::CreateEvent( | 18 | time_manager_event_type = Core::Timing::CreateEvent( |
| 19 | "Kernel::TimeManagerCallback", [this](u64 thread_handle, std::chrono::nanoseconds) { | 19 | "Kernel::TimeManagerCallback", |
| 20 | SchedulerLock lock(system.Kernel()); | 20 | [this](std::uintptr_t thread_handle, std::chrono::nanoseconds) { |
| 21 | Handle proper_handle = static_cast<Handle>(thread_handle); | 21 | const SchedulerLock lock(system.Kernel()); |
| 22 | const auto proper_handle = static_cast<Handle>(thread_handle); | ||
| 22 | if (cancelled_events[proper_handle]) { | 23 | if (cancelled_events[proper_handle]) { |
| 23 | return; | 24 | return; |
| 24 | } | 25 | } |
| 25 | std::shared_ptr<Thread> thread = | 26 | auto thread = this->system.Kernel().RetrieveThreadFromGlobalHandleTable(proper_handle); |
| 26 | this->system.Kernel().RetrieveThreadFromGlobalHandleTable(proper_handle); | ||
| 27 | thread->OnWakeUp(); | 27 | thread->OnWakeUp(); |
| 28 | }); | 28 | }); |
| 29 | } | 29 | } |
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 680290cbd..1e95b7580 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -77,8 +77,9 @@ IAppletResource::IAppletResource(Core::System& system) | |||
| 77 | 77 | ||
| 78 | // Register update callbacks | 78 | // Register update callbacks |
| 79 | pad_update_event = Core::Timing::CreateEvent( | 79 | pad_update_event = Core::Timing::CreateEvent( |
| 80 | "HID::UpdatePadCallback", [this](u64 userdata, std::chrono::nanoseconds ns_late) { | 80 | "HID::UpdatePadCallback", |
| 81 | UpdateControllers(userdata, ns_late); | 81 | [this](std::uintptr_t user_data, std::chrono::nanoseconds ns_late) { |
| 82 | UpdateControllers(user_data, ns_late); | ||
| 82 | }); | 83 | }); |
| 83 | 84 | ||
| 84 | // TODO(shinyquagsire23): Other update callbacks? (accel, gyro?) | 85 | // TODO(shinyquagsire23): Other update callbacks? (accel, gyro?) |
| @@ -108,7 +109,8 @@ void IAppletResource::GetSharedMemoryHandle(Kernel::HLERequestContext& ctx) { | |||
| 108 | rb.PushCopyObjects(shared_mem); | 109 | rb.PushCopyObjects(shared_mem); |
| 109 | } | 110 | } |
| 110 | 111 | ||
| 111 | void IAppletResource::UpdateControllers(u64 userdata, std::chrono::nanoseconds ns_late) { | 112 | void IAppletResource::UpdateControllers(std::uintptr_t user_data, |
| 113 | std::chrono::nanoseconds ns_late) { | ||
| 112 | auto& core_timing = system.CoreTiming(); | 114 | auto& core_timing = system.CoreTiming(); |
| 113 | 115 | ||
| 114 | const bool should_reload = Settings::values.is_device_reload_pending.exchange(false); | 116 | const bool should_reload = Settings::values.is_device_reload_pending.exchange(false); |
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index c6f0a2584..efb07547f 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h | |||
| @@ -64,7 +64,7 @@ private: | |||
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | void GetSharedMemoryHandle(Kernel::HLERequestContext& ctx); | 66 | void GetSharedMemoryHandle(Kernel::HLERequestContext& ctx); |
| 67 | void UpdateControllers(u64 userdata, std::chrono::nanoseconds ns_late); | 67 | void UpdateControllers(std::uintptr_t user_data, std::chrono::nanoseconds ns_late); |
| 68 | 68 | ||
| 69 | std::shared_ptr<Kernel::SharedMemory> shared_mem; | 69 | std::shared_ptr<Kernel::SharedMemory> shared_mem; |
| 70 | 70 | ||
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index e561bf654..f644a460d 100644 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp | |||
| @@ -67,7 +67,7 @@ NVFlinger::NVFlinger(Core::System& system) : system(system) { | |||
| 67 | 67 | ||
| 68 | // Schedule the screen composition events | 68 | // Schedule the screen composition events |
| 69 | composition_event = Core::Timing::CreateEvent( | 69 | composition_event = Core::Timing::CreateEvent( |
| 70 | "ScreenComposition", [this](u64, std::chrono::nanoseconds ns_late) { | 70 | "ScreenComposition", [this](std::uintptr_t, std::chrono::nanoseconds ns_late) { |
| 71 | const auto guard = Lock(); | 71 | const auto guard = Lock(); |
| 72 | Compose(); | 72 | Compose(); |
| 73 | 73 | ||
diff --git a/src/core/memory/cheat_engine.cpp b/src/core/memory/cheat_engine.cpp index ced41b1fe..eeebdf02e 100644 --- a/src/core/memory/cheat_engine.cpp +++ b/src/core/memory/cheat_engine.cpp | |||
| @@ -188,11 +188,11 @@ CheatEngine::~CheatEngine() { | |||
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | void CheatEngine::Initialize() { | 190 | void CheatEngine::Initialize() { |
| 191 | event = Core::Timing::CreateEvent("CheatEngine::FrameCallback::" + | 191 | event = Core::Timing::CreateEvent( |
| 192 | Common::HexToString(metadata.main_nso_build_id), | 192 | "CheatEngine::FrameCallback::" + Common::HexToString(metadata.main_nso_build_id), |
| 193 | [this](u64 userdata, std::chrono::nanoseconds ns_late) { | 193 | [this](std::uintptr_t user_data, std::chrono::nanoseconds ns_late) { |
| 194 | FrameCallback(userdata, ns_late); | 194 | FrameCallback(user_data, ns_late); |
| 195 | }); | 195 | }); |
| 196 | core_timing.ScheduleEvent(CHEAT_ENGINE_NS, event); | 196 | core_timing.ScheduleEvent(CHEAT_ENGINE_NS, event); |
| 197 | 197 | ||
| 198 | metadata.process_id = system.CurrentProcess()->GetProcessID(); | 198 | metadata.process_id = system.CurrentProcess()->GetProcessID(); |
| @@ -219,7 +219,7 @@ void CheatEngine::Reload(std::vector<CheatEntry> cheats) { | |||
| 219 | 219 | ||
| 220 | MICROPROFILE_DEFINE(Cheat_Engine, "Add-Ons", "Cheat Engine", MP_RGB(70, 200, 70)); | 220 | MICROPROFILE_DEFINE(Cheat_Engine, "Add-Ons", "Cheat Engine", MP_RGB(70, 200, 70)); |
| 221 | 221 | ||
| 222 | void CheatEngine::FrameCallback(u64, std::chrono::nanoseconds ns_late) { | 222 | void CheatEngine::FrameCallback(std::uintptr_t, std::chrono::nanoseconds ns_late) { |
| 223 | if (is_pending_reload.exchange(false)) { | 223 | if (is_pending_reload.exchange(false)) { |
| 224 | vm.LoadProgram(cheats); | 224 | vm.LoadProgram(cheats); |
| 225 | } | 225 | } |
diff --git a/src/core/memory/cheat_engine.h b/src/core/memory/cheat_engine.h index d4068cf84..fa039a831 100644 --- a/src/core/memory/cheat_engine.h +++ b/src/core/memory/cheat_engine.h | |||
| @@ -72,7 +72,7 @@ public: | |||
| 72 | void Reload(std::vector<CheatEntry> cheats); | 72 | void Reload(std::vector<CheatEntry> cheats); |
| 73 | 73 | ||
| 74 | private: | 74 | private: |
| 75 | void FrameCallback(u64 userdata, std::chrono::nanoseconds ns_late); | 75 | void FrameCallback(std::uintptr_t user_data, std::chrono::nanoseconds ns_late); |
| 76 | 76 | ||
| 77 | DmntCheatVm vm; | 77 | DmntCheatVm vm; |
| 78 | CheatProcessMetadata metadata; | 78 | CheatProcessMetadata metadata; |
diff --git a/src/core/settings.cpp b/src/core/settings.cpp index 44252dd81..416b2d866 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp | |||
| @@ -173,7 +173,6 @@ void RestoreGlobalState() { | |||
| 173 | values.use_assembly_shaders.SetGlobal(true); | 173 | values.use_assembly_shaders.SetGlobal(true); |
| 174 | values.use_asynchronous_shaders.SetGlobal(true); | 174 | values.use_asynchronous_shaders.SetGlobal(true); |
| 175 | values.use_fast_gpu_time.SetGlobal(true); | 175 | values.use_fast_gpu_time.SetGlobal(true); |
| 176 | values.force_30fps_mode.SetGlobal(true); | ||
| 177 | values.bg_red.SetGlobal(true); | 176 | values.bg_red.SetGlobal(true); |
| 178 | values.bg_green.SetGlobal(true); | 177 | values.bg_green.SetGlobal(true); |
| 179 | values.bg_blue.SetGlobal(true); | 178 | values.bg_blue.SetGlobal(true); |
diff --git a/src/core/settings.h b/src/core/settings.h index 386233fdf..bb145f193 100644 --- a/src/core/settings.h +++ b/src/core/settings.h | |||
| @@ -435,7 +435,6 @@ struct Values { | |||
| 435 | Setting<bool> use_vsync; | 435 | Setting<bool> use_vsync; |
| 436 | Setting<bool> use_assembly_shaders; | 436 | Setting<bool> use_assembly_shaders; |
| 437 | Setting<bool> use_asynchronous_shaders; | 437 | Setting<bool> use_asynchronous_shaders; |
| 438 | Setting<bool> force_30fps_mode; | ||
| 439 | Setting<bool> use_fast_gpu_time; | 438 | Setting<bool> use_fast_gpu_time; |
| 440 | 439 | ||
| 441 | Setting<float> bg_red; | 440 | Setting<float> bg_red; |
diff --git a/src/core/tools/freezer.cpp b/src/core/tools/freezer.cpp index 27b894b51..2003e096f 100644 --- a/src/core/tools/freezer.cpp +++ b/src/core/tools/freezer.cpp | |||
| @@ -55,10 +55,11 @@ void MemoryWriteWidth(Core::Memory::Memory& memory, u32 width, VAddr addr, u64 v | |||
| 55 | 55 | ||
| 56 | Freezer::Freezer(Core::Timing::CoreTiming& core_timing_, Core::Memory::Memory& memory_) | 56 | Freezer::Freezer(Core::Timing::CoreTiming& core_timing_, Core::Memory::Memory& memory_) |
| 57 | : core_timing{core_timing_}, memory{memory_} { | 57 | : core_timing{core_timing_}, memory{memory_} { |
| 58 | event = Core::Timing::CreateEvent("MemoryFreezer::FrameCallback", | 58 | event = Core::Timing::CreateEvent( |
| 59 | [this](u64 userdata, std::chrono::nanoseconds ns_late) { | 59 | "MemoryFreezer::FrameCallback", |
| 60 | FrameCallback(userdata, ns_late); | 60 | [this](std::uintptr_t user_data, std::chrono::nanoseconds ns_late) { |
| 61 | }); | 61 | FrameCallback(user_data, ns_late); |
| 62 | }); | ||
| 62 | core_timing.ScheduleEvent(memory_freezer_ns, event); | 63 | core_timing.ScheduleEvent(memory_freezer_ns, event); |
| 63 | } | 64 | } |
| 64 | 65 | ||
| @@ -159,7 +160,7 @@ std::vector<Freezer::Entry> Freezer::GetEntries() const { | |||
| 159 | return entries; | 160 | return entries; |
| 160 | } | 161 | } |
| 161 | 162 | ||
| 162 | void Freezer::FrameCallback(u64, std::chrono::nanoseconds ns_late) { | 163 | void Freezer::FrameCallback(std::uintptr_t, std::chrono::nanoseconds ns_late) { |
| 163 | if (!IsActive()) { | 164 | if (!IsActive()) { |
| 164 | LOG_DEBUG(Common_Memory, "Memory freezer has been deactivated, ending callback events."); | 165 | LOG_DEBUG(Common_Memory, "Memory freezer has been deactivated, ending callback events."); |
| 165 | return; | 166 | return; |
diff --git a/src/core/tools/freezer.h b/src/core/tools/freezer.h index 8438783d5..2b2326bc4 100644 --- a/src/core/tools/freezer.h +++ b/src/core/tools/freezer.h | |||
| @@ -73,7 +73,7 @@ public: | |||
| 73 | std::vector<Entry> GetEntries() const; | 73 | std::vector<Entry> GetEntries() const; |
| 74 | 74 | ||
| 75 | private: | 75 | private: |
| 76 | void FrameCallback(u64 userdata, std::chrono::nanoseconds ns_late); | 76 | void FrameCallback(std::uintptr_t user_data, std::chrono::nanoseconds ns_late); |
| 77 | void FillEntryReads(); | 77 | void FillEntryReads(); |
| 78 | 78 | ||
| 79 | std::atomic_bool active{false}; | 79 | std::atomic_bool active{false}; |