early-access version 4067

This commit is contained in:
pineappleEA 2024-01-16 07:24:48 +01:00
parent d0f8ea1640
commit 1d5b8027e5
76 changed files with 265 additions and 228 deletions

View file

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 4066. This is the source code for early-access 4067.
## Legal Notice ## Legal Notice

View file

@ -104,7 +104,7 @@ object FileUtil {
/** /**
* Reference: https://stackoverflow.com/questions/42186820/documentfile-is-very-slow * Reference: https://stackoverflow.com/questions/42186820/documentfile-is-very-slow
* This function will be faster than DoucmentFile.listFiles * This function will be faster than DocumentFile.listFiles
* @param uri Directory uri. * @param uri Directory uri.
* @return CheapDocument lists. * @return CheapDocument lists.
*/ */

View file

@ -205,7 +205,7 @@ jboolean Java_org_yuzu_yuzu_1emu_utils_NativeConfig_getIsRuntimeModifiable(JNIEn
jstring jkey) { jstring jkey) {
auto setting = getSetting<std::string>(env, jkey); auto setting = getSetting<std::string>(env, jkey);
if (setting != nullptr) { if (setting != nullptr) {
return setting->RuntimeModfiable(); return setting->RuntimeModifiable();
} }
return true; return true;
} }

View file

@ -29,7 +29,7 @@
<item>@string/language_dutch</item> <item>@string/language_dutch</item>
<item>@string/language_english</item> <item>@string/language_english</item>
<item>@string/language_french</item> <item>@string/language_french</item>
<item>@string/langauge_german</item> <item>@string/language_german</item>
<item>@string/language_italian</item> <item>@string/language_italian</item>
<item>@string/language_japanese</item> <item>@string/language_japanese</item>
<item>@string/language_korean</item> <item>@string/language_korean</item>

View file

@ -410,7 +410,7 @@
<string name="language_japanese" translatable="false">日本語</string> <string name="language_japanese" translatable="false">日本語</string>
<string name="language_english" translatable="false">English</string> <string name="language_english" translatable="false">English</string>
<string name="language_french" translatable="false">Français</string> <string name="language_french" translatable="false">Français</string>
<string name="langauge_german" translatable="false">Deutsch</string> <string name="language_german" translatable="false">Deutsch</string>
<string name="language_italian" translatable="false">Italiano</string> <string name="language_italian" translatable="false">Italiano</string>
<string name="language_spanish" translatable="false">Español</string> <string name="language_spanish" translatable="false">Español</string>
<string name="language_chinese" translatable="false">简体中文</string> <string name="language_chinese" translatable="false">简体中文</string>

View file

@ -11,7 +11,7 @@ ADSP::ADSP(Core::System& system, Sink::Sink& sink) {
opus_decoder = std::make_unique<OpusDecoder::OpusDecoder>(system); opus_decoder = std::make_unique<OpusDecoder::OpusDecoder>(system);
opus_decoder->Send(Direction::DSP, OpusDecoder::Message::Start); opus_decoder->Send(Direction::DSP, OpusDecoder::Message::Start);
if (opus_decoder->Receive(Direction::Host) != OpusDecoder::Message::StartOK) { if (opus_decoder->Receive(Direction::Host) != OpusDecoder::Message::StartOK) {
LOG_ERROR(Service_Audio, "OpusDeocder failed to initialize."); LOG_ERROR(Service_Audio, "OpusDecoder failed to initialize.");
return; return;
} }
} }

View file

@ -41,7 +41,7 @@ void CommandGenerator::GenerateDataSourceCommand(VoiceInfo& voice_info,
const VoiceState& voice_state, const s8 channel) { const VoiceState& voice_state, const s8 channel) {
if (voice_info.mix_id == UnusedMixId) { if (voice_info.mix_id == UnusedMixId) {
if (voice_info.splitter_id != UnusedSplitterId) { if (voice_info.splitter_id != UnusedSplitterId) {
auto destination{splitter_context.GetDesintationData(voice_info.splitter_id, 0)}; auto destination{splitter_context.GetDestinationData(voice_info.splitter_id, 0)};
u32 dest_id{0}; u32 dest_id{0};
while (destination != nullptr) { while (destination != nullptr) {
if (destination->IsConfigured()) { if (destination->IsConfigured()) {
@ -55,7 +55,7 @@ void CommandGenerator::GenerateDataSourceCommand(VoiceInfo& voice_info,
} }
} }
dest_id++; dest_id++;
destination = splitter_context.GetDesintationData(voice_info.splitter_id, dest_id); destination = splitter_context.GetDestinationData(voice_info.splitter_id, dest_id);
} }
} }
} else { } else {
@ -234,7 +234,7 @@ void CommandGenerator::GenerateVoiceCommand(VoiceInfo& voice_info) {
if (voice_info.mix_id == UnusedMixId) { if (voice_info.mix_id == UnusedMixId) {
if (voice_info.splitter_id != UnusedSplitterId) { if (voice_info.splitter_id != UnusedSplitterId) {
auto i{channel}; auto i{channel};
auto destination{splitter_context.GetDesintationData(voice_info.splitter_id, i)}; auto destination{splitter_context.GetDestinationData(voice_info.splitter_id, i)};
while (destination != nullptr) { while (destination != nullptr) {
if (destination->IsConfigured()) { if (destination->IsConfigured()) {
const auto mix_id{destination->GetMixId()}; const auto mix_id{destination->GetMixId()};
@ -249,7 +249,7 @@ void CommandGenerator::GenerateVoiceCommand(VoiceInfo& voice_info) {
} }
} }
i += voice_info.channel_count; i += voice_info.channel_count;
destination = splitter_context.GetDesintationData(voice_info.splitter_id, i); destination = splitter_context.GetDestinationData(voice_info.splitter_id, i);
} }
} }
} else { } else {
@ -591,7 +591,7 @@ void CommandGenerator::GenerateMixCommands(MixInfo& mix_info) {
if (mix_info.dst_splitter_id != UnusedSplitterId) { if (mix_info.dst_splitter_id != UnusedSplitterId) {
s16 dest_id{0}; s16 dest_id{0};
auto destination{ auto destination{
splitter_context.GetDesintationData(mix_info.dst_splitter_id, dest_id)}; splitter_context.GetDestinationData(mix_info.dst_splitter_id, dest_id)};
while (destination != nullptr) { while (destination != nullptr) {
if (destination->IsConfigured()) { if (destination->IsConfigured()) {
auto splitter_mix_id{destination->GetMixId()}; auto splitter_mix_id{destination->GetMixId()};
@ -612,7 +612,7 @@ void CommandGenerator::GenerateMixCommands(MixInfo& mix_info) {
} }
dest_id++; dest_id++;
destination = destination =
splitter_context.GetDesintationData(mix_info.dst_splitter_id, dest_id); splitter_context.GetDestinationData(mix_info.dst_splitter_id, dest_id);
} }
} }
} else { } else {

View file

@ -93,7 +93,7 @@ bool MixInfo::UpdateConnection(EdgeMatrix& edge_matrix, const InParameter& in_pa
for (u32 i = 0; i < destination_count; i++) { for (u32 i = 0; i < destination_count; i++) {
auto destination{ auto destination{
splitter_context.GetDesintationData(in_params.dest_splitter_id, i)}; splitter_context.GetDestinationData(in_params.dest_splitter_id, i)};
if (destination) { if (destination) {
const auto destination_id{destination->GetMixId()}; const auto destination_id{destination->GetMixId()};

View file

@ -9,7 +9,7 @@
namespace AudioCore::Renderer { namespace AudioCore::Renderer {
SplitterDestinationData* SplitterContext::GetDesintationData(const s32 splitter_id, SplitterDestinationData* SplitterContext::GetDestinationData(const s32 splitter_id,
const s32 destination_id) { const s32 destination_id) {
return splitter_infos[splitter_id].GetData(destination_id); return splitter_infos[splitter_id].GetData(destination_id);
} }

View file

@ -42,7 +42,7 @@ public:
* @param destination_id - Destination index within the splitter. * @param destination_id - Destination index within the splitter.
* @return Pointer to the found destination. May be nullptr. * @return Pointer to the found destination. May be nullptr.
*/ */
SplitterDestinationData* GetDesintationData(s32 splitter_id, s32 destination_id); SplitterDestinationData* GetDestinationData(s32 splitter_id, s32 destination_id);
/** /**
* Get a splitter from the given index. * Get a splitter from the given index.

View file

@ -35,7 +35,7 @@ bool BasicSetting::Save() const {
return save; return save;
} }
bool BasicSetting::RuntimeModfiable() const { bool BasicSetting::RuntimeModifiable() const {
return runtime_modifiable; return runtime_modifiable;
} }

View file

@ -186,7 +186,7 @@ public:
/** /**
* @returns true if the current setting can be changed while the guest is running. * @returns true if the current setting can be changed while the guest is running.
*/ */
[[nodiscard]] bool RuntimeModfiable() const; [[nodiscard]] bool RuntimeModifiable() const;
/** /**
* @returns A unique number corresponding to the setting. * @returns A unique number corresponding to the setting.

View file

@ -28,6 +28,10 @@ class Memory;
template <typename DTraits> template <typename DTraits>
struct DeviceMemoryManagerAllocator; struct DeviceMemoryManagerAllocator;
struct Asid {
size_t id;
};
template <typename Traits> template <typename Traits>
class DeviceMemoryManager { class DeviceMemoryManager {
using DeviceInterface = typename Traits::DeviceInterface; using DeviceInterface = typename Traits::DeviceInterface;
@ -43,15 +47,14 @@ public:
void AllocateFixed(DAddr start, size_t size); void AllocateFixed(DAddr start, size_t size);
void Free(DAddr start, size_t size); void Free(DAddr start, size_t size);
void Map(DAddr address, VAddr virtual_address, size_t size, size_t process_id, void Map(DAddr address, VAddr virtual_address, size_t size, Asid asid, bool track = false);
bool track = false);
void Unmap(DAddr address, size_t size); void Unmap(DAddr address, size_t size);
void TrackContinuityImpl(DAddr address, VAddr virtual_address, size_t size, size_t process_id); void TrackContinuityImpl(DAddr address, VAddr virtual_address, size_t size, Asid asid);
void TrackContinuity(DAddr address, VAddr virtual_address, size_t size, size_t process_id) { void TrackContinuity(DAddr address, VAddr virtual_address, size_t size, Asid asid) {
std::scoped_lock lk(mapping_guard); std::scoped_lock lk(mapping_guard);
TrackContinuityImpl(address, virtual_address, size, process_id); TrackContinuityImpl(address, virtual_address, size, asid);
} }
// Write / Read // Write / Read
@ -105,8 +108,8 @@ public:
void WriteBlock(DAddr address, const void* src_pointer, size_t size); void WriteBlock(DAddr address, const void* src_pointer, size_t size);
void WriteBlockUnsafe(DAddr address, const void* src_pointer, size_t size); void WriteBlockUnsafe(DAddr address, const void* src_pointer, size_t size);
size_t RegisterProcess(Memory::Memory* memory); Asid RegisterProcess(Memory::Memory* memory);
void UnregisterProcess(size_t id); void UnregisterProcess(Asid id);
void UpdatePagesCachedCount(DAddr addr, size_t size, s32 delta); void UpdatePagesCachedCount(DAddr addr, size_t size, s32 delta);
@ -163,17 +166,17 @@ private:
static constexpr size_t guest_max_as_bits = 39; static constexpr size_t guest_max_as_bits = 39;
static constexpr size_t guest_as_size = 1ULL << guest_max_as_bits; static constexpr size_t guest_as_size = 1ULL << guest_max_as_bits;
static constexpr size_t guest_mask = guest_as_size - 1ULL; static constexpr size_t guest_mask = guest_as_size - 1ULL;
static constexpr size_t process_id_start_bit = guest_max_as_bits; static constexpr size_t asid_start_bit = guest_max_as_bits;
std::pair<size_t, VAddr> ExtractCPUBacking(size_t page_index) { std::pair<Asid, VAddr> ExtractCPUBacking(size_t page_index) {
auto content = cpu_backing_address[page_index]; auto content = cpu_backing_address[page_index];
const VAddr address = content & guest_mask; const VAddr address = content & guest_mask;
const size_t process_id = static_cast<size_t>(content >> process_id_start_bit); const Asid asid{static_cast<size_t>(content >> asid_start_bit)};
return std::make_pair(process_id, address); return std::make_pair(asid, address);
} }
void InsertCPUBacking(size_t page_index, VAddr address, size_t process_id) { void InsertCPUBacking(size_t page_index, VAddr address, Asid asid) {
cpu_backing_address[page_index] = address | (process_id << process_id_start_bit); cpu_backing_address[page_index] = address | (asid.id << asid_start_bit);
} }
Common::VirtualBuffer<VAddr> cpu_backing_address; Common::VirtualBuffer<VAddr> cpu_backing_address;

View file

@ -215,8 +215,8 @@ void DeviceMemoryManager<Traits>::Free(DAddr start, size_t size) {
template <typename Traits> template <typename Traits>
void DeviceMemoryManager<Traits>::Map(DAddr address, VAddr virtual_address, size_t size, void DeviceMemoryManager<Traits>::Map(DAddr address, VAddr virtual_address, size_t size,
size_t process_id, bool track) { Asid asid, bool track) {
Core::Memory::Memory* process_memory = registered_processes[process_id]; Core::Memory::Memory* process_memory = registered_processes[asid.id];
size_t start_page_d = address >> Memory::YUZU_PAGEBITS; size_t start_page_d = address >> Memory::YUZU_PAGEBITS;
size_t num_pages = Common::AlignUp(size, Memory::YUZU_PAGESIZE) >> Memory::YUZU_PAGEBITS; size_t num_pages = Common::AlignUp(size, Memory::YUZU_PAGESIZE) >> Memory::YUZU_PAGEBITS;
std::scoped_lock lk(mapping_guard); std::scoped_lock lk(mapping_guard);
@ -229,7 +229,7 @@ void DeviceMemoryManager<Traits>::Map(DAddr address, VAddr virtual_address, size
} }
auto phys_addr = static_cast<u32>(GetRawPhysicalAddr(ptr) >> Memory::YUZU_PAGEBITS) + 1U; auto phys_addr = static_cast<u32>(GetRawPhysicalAddr(ptr) >> Memory::YUZU_PAGEBITS) + 1U;
compressed_physical_ptr[start_page_d + i] = phys_addr; compressed_physical_ptr[start_page_d + i] = phys_addr;
InsertCPUBacking(start_page_d + i, new_vaddress, process_id); InsertCPUBacking(start_page_d + i, new_vaddress, asid);
const u32 base_dev = compressed_device_addr[phys_addr - 1U]; const u32 base_dev = compressed_device_addr[phys_addr - 1U];
const u32 new_dev = static_cast<u32>(start_page_d + i); const u32 new_dev = static_cast<u32>(start_page_d + i);
if (base_dev == 0) [[likely]] { if (base_dev == 0) [[likely]] {
@ -244,7 +244,7 @@ void DeviceMemoryManager<Traits>::Map(DAddr address, VAddr virtual_address, size
impl->multi_dev_address.Register(new_dev, start_id); impl->multi_dev_address.Register(new_dev, start_id);
} }
if (track) { if (track) {
TrackContinuityImpl(address, virtual_address, size, process_id); TrackContinuityImpl(address, virtual_address, size, asid);
} }
} }
@ -277,8 +277,8 @@ void DeviceMemoryManager<Traits>::Unmap(DAddr address, size_t size) {
} }
template <typename Traits> template <typename Traits>
void DeviceMemoryManager<Traits>::TrackContinuityImpl(DAddr address, VAddr virtual_address, void DeviceMemoryManager<Traits>::TrackContinuityImpl(DAddr address, VAddr virtual_address,
size_t size, size_t process_id) { size_t size, Asid asid) {
Core::Memory::Memory* process_memory = registered_processes[process_id]; Core::Memory::Memory* process_memory = registered_processes[asid.id];
size_t start_page_d = address >> Memory::YUZU_PAGEBITS; size_t start_page_d = address >> Memory::YUZU_PAGEBITS;
size_t num_pages = Common::AlignUp(size, Memory::YUZU_PAGESIZE) >> Memory::YUZU_PAGEBITS; size_t num_pages = Common::AlignUp(size, Memory::YUZU_PAGESIZE) >> Memory::YUZU_PAGEBITS;
uintptr_t last_ptr = 0; uintptr_t last_ptr = 0;
@ -488,8 +488,8 @@ void DeviceMemoryManager<Traits>::WriteBlockUnsafe(DAddr address, const void* sr
} }
template <typename Traits> template <typename Traits>
size_t DeviceMemoryManager<Traits>::RegisterProcess(Memory::Memory* memory_device_inter) { Asid DeviceMemoryManager<Traits>::RegisterProcess(Memory::Memory* memory_device_inter) {
size_t new_id; size_t new_id{};
if (!id_pool.empty()) { if (!id_pool.empty()) {
new_id = id_pool.front(); new_id = id_pool.front();
id_pool.pop_front(); id_pool.pop_front();
@ -498,29 +498,23 @@ size_t DeviceMemoryManager<Traits>::RegisterProcess(Memory::Memory* memory_devic
registered_processes.emplace_back(memory_device_inter); registered_processes.emplace_back(memory_device_inter);
new_id = registered_processes.size() - 1U; new_id = registered_processes.size() - 1U;
} }
return new_id; return Asid{new_id};
} }
template <typename Traits> template <typename Traits>
void DeviceMemoryManager<Traits>::UnregisterProcess(size_t id) { void DeviceMemoryManager<Traits>::UnregisterProcess(Asid asid) {
registered_processes[id] = nullptr; registered_processes[asid.id] = nullptr;
id_pool.push_front(id); id_pool.push_front(asid.id);
} }
template <typename Traits> template <typename Traits>
void DeviceMemoryManager<Traits>::UpdatePagesCachedCount(DAddr addr, size_t size, s32 delta) { void DeviceMemoryManager<Traits>::UpdatePagesCachedCount(DAddr addr, size_t size, s32 delta) {
bool locked = false; std::unique_lock<std::mutex> lk(counter_guard, std::defer_lock);
auto lock = [&] { const auto Lock = [&] {
if (!locked) { if (!lk) {
counter_guard.lock(); lk.lock();
locked = true;
} }
}; };
SCOPE_EXIT({
if (locked) {
counter_guard.unlock();
}
});
u64 uncache_begin = 0; u64 uncache_begin = 0;
u64 cache_begin = 0; u64 cache_begin = 0;
u64 uncache_bytes = 0; u64 uncache_bytes = 0;
@ -530,9 +524,9 @@ void DeviceMemoryManager<Traits>::UpdatePagesCachedCount(DAddr addr, size_t size
std::atomic_thread_fence(std::memory_order_acquire); std::atomic_thread_fence(std::memory_order_acquire);
const size_t page_end = Common::DivCeil(addr + size, Memory::YUZU_PAGESIZE); const size_t page_end = Common::DivCeil(addr + size, Memory::YUZU_PAGESIZE);
size_t page = addr >> Memory::YUZU_PAGEBITS; size_t page = addr >> Memory::YUZU_PAGEBITS;
auto [process_id, base_vaddress] = ExtractCPUBacking(page); auto [asid, base_vaddress] = ExtractCPUBacking(page);
size_t vpage = base_vaddress >> Memory::YUZU_PAGEBITS; size_t vpage = base_vaddress >> Memory::YUZU_PAGEBITS;
auto* memory_device_inter = registered_processes[process_id]; auto* memory_device_inter = registered_processes[asid.id];
for (; page != page_end; ++page) { for (; page != page_end; ++page) {
std::atomic_uint8_t& count = cached_pages->at(page >> 3).Count(page); std::atomic_uint8_t& count = cached_pages->at(page >> 3).Count(page);
@ -555,7 +549,7 @@ void DeviceMemoryManager<Traits>::UpdatePagesCachedCount(DAddr addr, size_t size
} }
uncache_bytes += Memory::YUZU_PAGESIZE; uncache_bytes += Memory::YUZU_PAGESIZE;
} else if (uncache_bytes > 0) { } else if (uncache_bytes > 0) {
lock(); Lock();
MarkRegionCaching(memory_device_inter, uncache_begin << Memory::YUZU_PAGEBITS, MarkRegionCaching(memory_device_inter, uncache_begin << Memory::YUZU_PAGEBITS,
uncache_bytes, false); uncache_bytes, false);
uncache_bytes = 0; uncache_bytes = 0;
@ -566,7 +560,7 @@ void DeviceMemoryManager<Traits>::UpdatePagesCachedCount(DAddr addr, size_t size
} }
cache_bytes += Memory::YUZU_PAGESIZE; cache_bytes += Memory::YUZU_PAGESIZE;
} else if (cache_bytes > 0) { } else if (cache_bytes > 0) {
lock(); Lock();
MarkRegionCaching(memory_device_inter, cache_begin << Memory::YUZU_PAGEBITS, cache_bytes, MarkRegionCaching(memory_device_inter, cache_begin << Memory::YUZU_PAGEBITS, cache_bytes,
true); true);
cache_bytes = 0; cache_bytes = 0;
@ -574,12 +568,12 @@ void DeviceMemoryManager<Traits>::UpdatePagesCachedCount(DAddr addr, size_t size
vpage++; vpage++;
} }
if (uncache_bytes > 0) { if (uncache_bytes > 0) {
lock(); Lock();
MarkRegionCaching(memory_device_inter, uncache_begin << Memory::YUZU_PAGEBITS, uncache_bytes, MarkRegionCaching(memory_device_inter, uncache_begin << Memory::YUZU_PAGEBITS, uncache_bytes,
false); false);
} }
if (cache_bytes > 0) { if (cache_bytes > 0) {
lock(); Lock();
MarkRegionCaching(memory_device_inter, cache_begin << Memory::YUZU_PAGEBITS, cache_bytes, MarkRegionCaching(memory_device_inter, cache_begin << Memory::YUZU_PAGEBITS, cache_bytes,
true); true);
} }

View file

@ -16,9 +16,8 @@
namespace Service::Nvidia::NvCore { namespace Service::Nvidia::NvCore {
Session::Session(size_t id_, Kernel::KProcess* process_, size_t smmu_id_) Session::Session(SessionId id_, Kernel::KProcess* process_, Core::Asid asid_)
: id{id_}, process{process_}, smmu_id{smmu_id_}, : id{id_}, process{process_}, asid{asid_}, has_preallocated_area{}, mapper{}, is_active{} {}
has_preallocated_area{}, mapper{}, is_active{} {}
Session::~Session() = default; Session::~Session() = default;
@ -41,7 +40,9 @@ Container::Container(Tegra::Host1x::Host1x& host1x_) {
Container::~Container() = default; Container::~Container() = default;
size_t Container::OpenSession(Kernel::KProcess* process) { SessionId Container::OpenSession(Kernel::KProcess* process) {
using namespace Common::Literals;
std::scoped_lock lk(impl->session_guard); std::scoped_lock lk(impl->session_guard);
for (auto& session : impl->sessions) { for (auto& session : impl->sessions) {
if (!session.is_active) { if (!session.is_active) {
@ -54,14 +55,14 @@ size_t Container::OpenSession(Kernel::KProcess* process) {
size_t new_id{}; size_t new_id{};
auto* memory_interface = &process->GetMemory(); auto* memory_interface = &process->GetMemory();
auto& smmu = impl->host1x.MemoryManager(); auto& smmu = impl->host1x.MemoryManager();
auto smmu_id = smmu.RegisterProcess(memory_interface); auto asid = smmu.RegisterProcess(memory_interface);
if (!impl->id_pool.empty()) { if (!impl->id_pool.empty()) {
new_id = impl->id_pool.front(); new_id = impl->id_pool.front();
impl->id_pool.pop_front(); impl->id_pool.pop_front();
impl->sessions[new_id] = Session{new_id, process, smmu_id}; impl->sessions[new_id] = Session{SessionId{new_id}, process, asid};
} else { } else {
new_id = impl->new_ids++; new_id = impl->new_ids++;
impl->sessions.emplace_back(new_id, process, smmu_id); impl->sessions.emplace_back(SessionId{new_id}, process, asid);
} }
auto& session = impl->sessions[new_id]; auto& session = impl->sessions[new_id];
session.is_active = true; session.is_active = true;
@ -80,7 +81,7 @@ size_t Container::OpenSession(Kernel::KProcess* process) {
cur_addr)); cur_addr));
auto svc_mem_info = mem_info.GetSvcMemoryInfo(); auto svc_mem_info = mem_info.GetSvcMemoryInfo();
// check if this memory block is heap // Check if this memory block is heap.
if (svc_mem_info.state == Kernel::Svc::MemoryState::Normal) { if (svc_mem_info.state == Kernel::Svc::MemoryState::Normal) {
if (svc_mem_info.size > region_size) { if (svc_mem_info.size > region_size) {
region_size = svc_mem_info.size; region_size = svc_mem_info.size;
@ -97,21 +98,21 @@ size_t Container::OpenSession(Kernel::KProcess* process) {
cur_addr = next_address; cur_addr = next_address;
} }
session.has_preallocated_area = false; session.has_preallocated_area = false;
auto start_region = (region_size >> 15) >= 1024 ? smmu.Allocate(region_size) : 0; auto start_region = region_size >= 32_MiB ? smmu.Allocate(region_size) : 0;
if (start_region != 0) { if (start_region != 0) {
session.mapper = std::make_unique<HeapMapper>(region_start, start_region, region_size, session.mapper = std::make_unique<HeapMapper>(region_start, start_region, region_size,
smmu_id, impl->host1x); asid, impl->host1x);
smmu.TrackContinuity(start_region, region_start, region_size, smmu_id); smmu.TrackContinuity(start_region, region_start, region_size, asid);
session.has_preallocated_area = true; session.has_preallocated_area = true;
LOG_CRITICAL(Debug, "Preallocation created!"); LOG_DEBUG(Debug, "Preallocation created!");
} }
} }
return new_id; return SessionId{new_id};
} }
void Container::CloseSession(size_t id) { void Container::CloseSession(SessionId session_id) {
std::scoped_lock lk(impl->session_guard); std::scoped_lock lk(impl->session_guard);
auto& session = impl->sessions[id]; auto& session = impl->sessions[session_id.id];
auto& smmu = impl->host1x.MemoryManager(); auto& smmu = impl->host1x.MemoryManager();
if (session.has_preallocated_area) { if (session.has_preallocated_area) {
const DAddr region_start = session.mapper->GetRegionStart(); const DAddr region_start = session.mapper->GetRegionStart();
@ -121,13 +122,13 @@ void Container::CloseSession(size_t id) {
session.has_preallocated_area = false; session.has_preallocated_area = false;
} }
session.is_active = false; session.is_active = false;
smmu.UnregisterProcess(impl->sessions[id].smmu_id); smmu.UnregisterProcess(impl->sessions[session_id.id].asid);
impl->id_pool.emplace_front(id); impl->id_pool.emplace_front(session_id.id);
} }
Session* Container::GetSession(size_t id) { Session* Container::GetSession(SessionId session_id) {
std::atomic_thread_fence(std::memory_order_acquire); std::atomic_thread_fence(std::memory_order_acquire);
return &impl->sessions[id]; return &impl->sessions[session_id.id];
} }
NvMap& Container::GetNvMapFile() { NvMap& Container::GetNvMapFile() {

View file

@ -8,6 +8,7 @@
#include <memory> #include <memory>
#include <unordered_map> #include <unordered_map>
#include "core/device_memory_manager.h"
#include "core/hle/service/nvdrv/nvdata.h" #include "core/hle/service/nvdrv/nvdata.h"
namespace Kernel { namespace Kernel {
@ -26,8 +27,12 @@ class SyncpointManager;
struct ContainerImpl; struct ContainerImpl;
struct SessionId {
size_t id;
};
struct Session { struct Session {
Session(size_t id_, Kernel::KProcess* process_, size_t smmu_id_); Session(SessionId id_, Kernel::KProcess* process_, Core::Asid asid_);
~Session(); ~Session();
Session(const Session&) = delete; Session(const Session&) = delete;
@ -35,9 +40,9 @@ struct Session {
Session(Session&&) = default; Session(Session&&) = default;
Session& operator=(Session&&) = default; Session& operator=(Session&&) = default;
size_t id; SessionId id;
Kernel::KProcess* process; Kernel::KProcess* process;
size_t smmu_id; Core::Asid asid;
bool has_preallocated_area{}; bool has_preallocated_area{};
std::unique_ptr<HeapMapper> mapper{}; std::unique_ptr<HeapMapper> mapper{};
bool is_active{}; bool is_active{};
@ -48,10 +53,10 @@ public:
explicit Container(Tegra::Host1x::Host1x& host1x); explicit Container(Tegra::Host1x::Host1x& host1x);
~Container(); ~Container();
size_t OpenSession(Kernel::KProcess* process); SessionId OpenSession(Kernel::KProcess* process);
void CloseSession(size_t id); void CloseSession(SessionId id);
Session* GetSession(size_t id); Session* GetSession(SessionId id);
NvMap& GetNvMapFile(); NvMap& GetNvMapFile();

View file

@ -109,9 +109,9 @@ struct HeapMapper::HeapMapperInternal {
std::mutex guard; std::mutex guard;
}; };
HeapMapper::HeapMapper(VAddr start_vaddress, DAddr start_daddress, size_t size, size_t smmu_id, HeapMapper::HeapMapper(VAddr start_vaddress, DAddr start_daddress, size_t size, Core::Asid asid,
Tegra::Host1x::Host1x& host1x) Tegra::Host1x::Host1x& host1x)
: m_vaddress{start_vaddress}, m_daddress{start_daddress}, m_size{size}, m_smmu_id{smmu_id} { : m_vaddress{start_vaddress}, m_daddress{start_daddress}, m_size{size}, m_asid{asid} {
m_internal = std::make_unique<HeapMapperInternal>(host1x); m_internal = std::make_unique<HeapMapperInternal>(host1x);
} }
@ -138,7 +138,7 @@ DAddr HeapMapper::Map(VAddr start, size_t size) {
const size_t offset = inter_addr - m_vaddress; const size_t offset = inter_addr - m_vaddress;
const size_t sub_size = inter_addr_end - inter_addr; const size_t sub_size = inter_addr_end - inter_addr;
m_internal->device_memory.Map(m_daddress + offset, m_vaddress + offset, sub_size, m_internal->device_memory.Map(m_daddress + offset, m_vaddress + offset, sub_size,
m_smmu_id); m_asid);
} }
} }
m_internal->mapping_overlaps += std::make_pair(interval, 1); m_internal->mapping_overlaps += std::make_pair(interval, 1);

View file

@ -6,6 +6,7 @@
#include <memory> #include <memory>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/device_memory_manager.h"
namespace Tegra::Host1x { namespace Tegra::Host1x {
class Host1x; class Host1x;
@ -15,7 +16,7 @@ namespace Service::Nvidia::NvCore {
class HeapMapper { class HeapMapper {
public: public:
HeapMapper(VAddr start_vaddress, DAddr start_daddress, size_t size, size_t smmu_id, HeapMapper(VAddr start_vaddress, DAddr start_daddress, size_t size, Core::Asid asid,
Tegra::Host1x::Host1x& host1x); Tegra::Host1x::Host1x& host1x);
~HeapMapper(); ~HeapMapper();
@ -41,7 +42,7 @@ private:
VAddr m_vaddress; VAddr m_vaddress;
DAddr m_daddress; DAddr m_daddress;
size_t m_size; size_t m_size;
size_t m_smmu_id; Core::Asid m_asid;
std::unique_ptr<HeapMapperInternal> m_internal; std::unique_ptr<HeapMapperInternal> m_internal;
}; };

View file

@ -22,7 +22,8 @@ NvMap::Handle::Handle(u64 size_, Id id_)
flags.raw = 0; flags.raw = 0;
} }
NvResult NvMap::Handle::Alloc(Flags pFlags, u32 pAlign, u8 pKind, u64 pAddress, size_t pSessionId) { NvResult NvMap::Handle::Alloc(Flags pFlags, u32 pAlign, u8 pKind, u64 pAddress,
NvCore::SessionId pSessionId) {
std::scoped_lock lock(mutex); std::scoped_lock lock(mutex);
// Handles cannot be allocated twice // Handles cannot be allocated twice
if (allocated) { if (allocated) {
@ -223,7 +224,7 @@ DAddr NvMap::PinHandle(NvMap::Handle::Id handle, bool low_area_pin) {
} }
handle_description->d_address = address; handle_description->d_address = address;
smmu.Map(address, vaddress, map_size, session->smmu_id, true); smmu.Map(address, vaddress, map_size, session->asid, true);
handle_description->in_heap = false; handle_description->in_heap = false;
} }
} }

View file

@ -14,6 +14,7 @@
#include "common/bit_field.h" #include "common/bit_field.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/service/nvdrv/core/container.h"
#include "core/hle/service/nvdrv/nvdata.h" #include "core/hle/service/nvdrv/nvdata.h"
namespace Tegra { namespace Tegra {
@ -71,7 +72,7 @@ public:
u8 kind{}; //!< Used for memory compression u8 kind{}; //!< Used for memory compression
bool allocated{}; //!< If the handle has been allocated with `Alloc` bool allocated{}; //!< If the handle has been allocated with `Alloc`
bool in_heap{}; bool in_heap{};
size_t session_id{}; NvCore::SessionId session_id{};
DAddr d_address{}; //!< The memory location in the device's AS that this handle corresponds DAddr d_address{}; //!< The memory location in the device's AS that this handle corresponds
//!< to, this can also be in the nvdrv tmem //!< to, this can also be in the nvdrv tmem
@ -83,7 +84,7 @@ public:
* if a 0 address is passed * if a 0 address is passed
*/ */
[[nodiscard]] NvResult Alloc(Flags pFlags, u32 pAlign, u8 pKind, u64 pAddress, [[nodiscard]] NvResult Alloc(Flags pFlags, u32 pAlign, u8 pKind, u64 pAddress,
size_t pSessionId); NvCore::SessionId pSessionId);
/** /**
* @brief Increases the dupe counter of the handle for the given session * @brief Increases the dupe counter of the handle for the given session

View file

@ -7,6 +7,7 @@
#include <vector> #include <vector>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/service/nvdrv/core/container.h"
#include "core/hle/service/nvdrv/nvdata.h" #include "core/hle/service/nvdrv/nvdata.h"
namespace Core { namespace Core {
@ -62,7 +63,7 @@ public:
* Called once a device is opened * Called once a device is opened
* @param fd The device fd * @param fd The device fd
*/ */
virtual void OnOpen(size_t session_id, DeviceFD fd) = 0; virtual void OnOpen(NvCore::SessionId session_id, DeviceFD fd) = 0;
/** /**
* Called once a device is closed * Called once a device is closed

View file

@ -35,7 +35,7 @@ NvResult nvdisp_disp0::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> in
return NvResult::NotImplemented; return NvResult::NotImplemented;
} }
void nvdisp_disp0::OnOpen(size_t session_id, DeviceFD fd) {} void nvdisp_disp0::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {}
void nvdisp_disp0::OnClose(DeviceFD fd) {} void nvdisp_disp0::OnClose(DeviceFD fd) {}
void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, android::PixelFormat format, u32 width, void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, android::PixelFormat format, u32 width,

View file

@ -32,7 +32,7 @@ public:
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output, NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
std::span<u8> inline_output) override; std::span<u8> inline_output) override;
void OnOpen(size_t session_id, DeviceFD fd) override; void OnOpen(NvCore::SessionId session_id, DeviceFD fd) override;
void OnClose(DeviceFD fd) override; void OnClose(DeviceFD fd) override;
/// Performs a screen flip, drawing the buffer pointed to by the handle. /// Performs a screen flip, drawing the buffer pointed to by the handle.

View file

@ -86,7 +86,7 @@ NvResult nvhost_as_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> i
return NvResult::NotImplemented; return NvResult::NotImplemented;
} }
void nvhost_as_gpu::OnOpen(size_t session_id, DeviceFD fd) {} void nvhost_as_gpu::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {}
void nvhost_as_gpu::OnClose(DeviceFD fd) {} void nvhost_as_gpu::OnClose(DeviceFD fd) {}
NvResult nvhost_as_gpu::AllocAsEx(IoctlAllocAsEx& params) { NvResult nvhost_as_gpu::AllocAsEx(IoctlAllocAsEx& params) {

View file

@ -55,7 +55,7 @@ public:
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output, NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
std::span<u8> inline_output) override; std::span<u8> inline_output) override;
void OnOpen(size_t session_id, DeviceFD fd) override; void OnOpen(NvCore::SessionId session_id, DeviceFD fd) override;
void OnClose(DeviceFD fd) override; void OnClose(DeviceFD fd) override;
Kernel::KEvent* QueryEvent(u32 event_id) override; Kernel::KEvent* QueryEvent(u32 event_id) override;

View file

@ -76,7 +76,7 @@ NvResult nvhost_ctrl::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> inp
return NvResult::NotImplemented; return NvResult::NotImplemented;
} }
void nvhost_ctrl::OnOpen(size_t session_id, DeviceFD fd) {} void nvhost_ctrl::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {}
void nvhost_ctrl::OnClose(DeviceFD fd) {} void nvhost_ctrl::OnClose(DeviceFD fd) {}

View file

@ -32,7 +32,7 @@ public:
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output, NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
std::span<u8> inline_output) override; std::span<u8> inline_output) override;
void OnOpen(size_t session_id, DeviceFD fd) override; void OnOpen(NvCore::SessionId session_id, DeviceFD fd) override;
void OnClose(DeviceFD fd) override; void OnClose(DeviceFD fd) override;
Kernel::KEvent* QueryEvent(u32 event_id) override; Kernel::KEvent* QueryEvent(u32 event_id) override;

View file

@ -82,7 +82,7 @@ NvResult nvhost_ctrl_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8>
return NvResult::NotImplemented; return NvResult::NotImplemented;
} }
void nvhost_ctrl_gpu::OnOpen(size_t session_id, DeviceFD fd) {} void nvhost_ctrl_gpu::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {}
void nvhost_ctrl_gpu::OnClose(DeviceFD fd) {} void nvhost_ctrl_gpu::OnClose(DeviceFD fd) {}
NvResult nvhost_ctrl_gpu::GetCharacteristics1(IoctlCharacteristics& params) { NvResult nvhost_ctrl_gpu::GetCharacteristics1(IoctlCharacteristics& params) {

View file

@ -28,7 +28,7 @@ public:
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output, NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
std::span<u8> inline_output) override; std::span<u8> inline_output) override;
void OnOpen(size_t session_id, DeviceFD fd) override; void OnOpen(NvCore::SessionId session_id, DeviceFD fd) override;
void OnClose(DeviceFD fd) override; void OnClose(DeviceFD fd) override;
Kernel::KEvent* QueryEvent(u32 event_id) override; Kernel::KEvent* QueryEvent(u32 event_id) override;

View file

@ -120,7 +120,7 @@ NvResult nvhost_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> inpu
return NvResult::NotImplemented; return NvResult::NotImplemented;
} }
void nvhost_gpu::OnOpen(size_t session_id, DeviceFD fd) {} void nvhost_gpu::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {}
void nvhost_gpu::OnClose(DeviceFD fd) {} void nvhost_gpu::OnClose(DeviceFD fd) {}
NvResult nvhost_gpu::SetNVMAPfd(IoctlSetNvmapFD& params) { NvResult nvhost_gpu::SetNVMAPfd(IoctlSetNvmapFD& params) {

View file

@ -47,7 +47,7 @@ public:
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output, NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
std::span<u8> inline_output) override; std::span<u8> inline_output) override;
void OnOpen(size_t session_id, DeviceFD fd) override; void OnOpen(NvCore::SessionId session_id, DeviceFD fd) override;
void OnClose(DeviceFD fd) override; void OnClose(DeviceFD fd) override;
Kernel::KEvent* QueryEvent(u32 event_id) override; Kernel::KEvent* QueryEvent(u32 event_id) override;

View file

@ -68,7 +68,7 @@ NvResult nvhost_nvdec::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> in
return NvResult::NotImplemented; return NvResult::NotImplemented;
} }
void nvhost_nvdec::OnOpen(size_t session_id, DeviceFD fd) { void nvhost_nvdec::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {
LOG_INFO(Service_NVDRV, "NVDEC video stream started"); LOG_INFO(Service_NVDRV, "NVDEC video stream started");
system.SetNVDECActive(true); system.SetNVDECActive(true);
sessions[fd] = session_id; sessions[fd] = session_id;

View file

@ -20,7 +20,7 @@ public:
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output, NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
std::span<u8> inline_output) override; std::span<u8> inline_output) override;
void OnOpen(size_t session_id, DeviceFD fd) override; void OnOpen(NvCore::SessionId session_id, DeviceFD fd) override;
void OnClose(DeviceFD fd) override; void OnClose(DeviceFD fd) override;
}; };

View file

@ -127,7 +127,7 @@ protected:
NvCore::NvMap& nvmap; NvCore::NvMap& nvmap;
NvCore::ChannelType channel_type; NvCore::ChannelType channel_type;
std::array<u32, MaxSyncPoints> device_syncpoints{}; std::array<u32, MaxSyncPoints> device_syncpoints{};
std::unordered_map<DeviceFD, size_t> sessions; std::unordered_map<DeviceFD, NvCore::SessionId> sessions;
}; };
}; // namespace Devices }; // namespace Devices
} // namespace Service::Nvidia } // namespace Service::Nvidia

View file

@ -44,7 +44,7 @@ NvResult nvhost_nvjpg::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> in
return NvResult::NotImplemented; return NvResult::NotImplemented;
} }
void nvhost_nvjpg::OnOpen(size_t session_id, DeviceFD fd) {} void nvhost_nvjpg::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {}
void nvhost_nvjpg::OnClose(DeviceFD fd) {} void nvhost_nvjpg::OnClose(DeviceFD fd) {}
NvResult nvhost_nvjpg::SetNVMAPfd(IoctlSetNvmapFD& params) { NvResult nvhost_nvjpg::SetNVMAPfd(IoctlSetNvmapFD& params) {

View file

@ -22,7 +22,7 @@ public:
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output, NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
std::span<u8> inline_output) override; std::span<u8> inline_output) override;
void OnOpen(size_t session_id, DeviceFD fd) override; void OnOpen(NvCore::SessionId session_id, DeviceFD fd) override;
void OnClose(DeviceFD fd) override; void OnClose(DeviceFD fd) override;
private: private:

View file

@ -68,7 +68,7 @@ NvResult nvhost_vic::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> inpu
return NvResult::NotImplemented; return NvResult::NotImplemented;
} }
void nvhost_vic::OnOpen(size_t session_id, DeviceFD fd) { void nvhost_vic::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {
sessions[fd] = session_id; sessions[fd] = session_id;
} }
@ -78,10 +78,7 @@ void nvhost_vic::OnClose(DeviceFD fd) {
if (iter != host1x_file.fd_to_id.end()) { if (iter != host1x_file.fd_to_id.end()) {
system.GPU().ClearCdmaInstance(iter->second); system.GPU().ClearCdmaInstance(iter->second);
} }
auto it = sessions.find(fd); sessions.erase(fd);
if (it != sessions.end()) {
sessions.erase(it);
}
} }
} // namespace Service::Nvidia::Devices } // namespace Service::Nvidia::Devices

View file

@ -19,7 +19,7 @@ public:
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output, NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
std::span<u8> inline_output) override; std::span<u8> inline_output) override;
void OnOpen(size_t session_id, DeviceFD fd) override; void OnOpen(NvCore::SessionId session_id, DeviceFD fd) override;
void OnClose(DeviceFD fd) override; void OnClose(DeviceFD fd) override;
}; };
} // namespace Service::Nvidia::Devices } // namespace Service::Nvidia::Devices

View file

@ -67,7 +67,7 @@ NvResult nvmap::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, st
return NvResult::NotImplemented; return NvResult::NotImplemented;
} }
void nvmap::OnOpen(size_t session_id, DeviceFD fd) { void nvmap::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {
sessions[fd] = session_id; sessions[fd] = session_id;
} }
void nvmap::OnClose(DeviceFD fd) { void nvmap::OnClose(DeviceFD fd) {

View file

@ -33,7 +33,7 @@ public:
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output, NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
std::span<u8> inline_output) override; std::span<u8> inline_output) override;
void OnOpen(size_t session_id, DeviceFD fd) override; void OnOpen(NvCore::SessionId session_id, DeviceFD fd) override;
void OnClose(DeviceFD fd) override; void OnClose(DeviceFD fd) override;
enum class HandleParameterType : u32_le { enum class HandleParameterType : u32_le {
@ -115,7 +115,7 @@ private:
NvCore::Container& container; NvCore::Container& container;
NvCore::NvMap& file; NvCore::NvMap& file;
std::unordered_map<DeviceFD, size_t> sessions; std::unordered_map<DeviceFD, NvCore::SessionId> sessions;
}; };
} // namespace Service::Nvidia::Devices } // namespace Service::Nvidia::Devices

View file

@ -52,15 +52,15 @@ void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system) {
return std::make_shared<NVDRV>(system, module, "nvdrv:a"); return std::make_shared<NVDRV>(system, module, "nvdrv:a");
}; };
const auto NvdrvInterfaceFactoryForSysmodules = [&, module] { const auto NvdrvInterfaceFactoryForSysmodules = [&, module] {
return std::make_shared<NVDRV>(system, module, "nvdrv:a"); return std::make_shared<NVDRV>(system, module, "nvdrv:s");
}; };
const auto NvdrvInterfaceFactory = [&, module] { const auto NvdrvInterfaceFactoryForTesting = [&, module] {
return std::make_shared<NVDRV>(system, module, "nvdrv:t"); return std::make_shared<NVDRV>(system, module, "nvdrv:t");
}; };
server_manager->RegisterNamedService("nvdrv", NvdrvInterfaceFactoryForApplication); server_manager->RegisterNamedService("nvdrv", NvdrvInterfaceFactoryForApplication);
server_manager->RegisterNamedService("nvdrv:a", NvdrvInterfaceFactoryForApplets); server_manager->RegisterNamedService("nvdrv:a", NvdrvInterfaceFactoryForApplets);
server_manager->RegisterNamedService("nvdrv:s", NvdrvInterfaceFactoryForSysmodules); server_manager->RegisterNamedService("nvdrv:s", NvdrvInterfaceFactoryForSysmodules);
server_manager->RegisterNamedService("nvdrv:t", NvdrvInterfaceFactory); server_manager->RegisterNamedService("nvdrv:t", NvdrvInterfaceFactoryForTesting);
server_manager->RegisterNamedService("nvmemp", std::make_shared<NVMEMP>(system)); server_manager->RegisterNamedService("nvmemp", std::make_shared<NVMEMP>(system));
nvnflinger.SetNVDrvInstance(module); nvnflinger.SetNVDrvInstance(module);
ServerManager::RunServer(std::move(server_manager)); ServerManager::RunServer(std::move(server_manager));
@ -122,7 +122,7 @@ NvResult Module::VerifyFD(DeviceFD fd) const {
return NvResult::Success; return NvResult::Success;
} }
DeviceFD Module::Open(const std::string& device_name, size_t session_id) { DeviceFD Module::Open(const std::string& device_name, NvCore::SessionId session_id) {
auto it = builders.find(device_name); auto it = builders.find(device_name);
if (it == builders.end()) { if (it == builders.end()) {
LOG_ERROR(Service_NVDRV, "Trying to open unknown device {}", device_name); LOG_ERROR(Service_NVDRV, "Trying to open unknown device {}", device_name);

View file

@ -77,7 +77,7 @@ public:
NvResult VerifyFD(DeviceFD fd) const; NvResult VerifyFD(DeviceFD fd) const;
/// Opens a device node and returns a file descriptor to it. /// Opens a device node and returns a file descriptor to it.
DeviceFD Open(const std::string& device_name, size_t session_id); DeviceFD Open(const std::string& device_name, NvCore::SessionId session_id);
/// Sends an ioctl command to the specified file descriptor. /// Sends an ioctl command to the specified file descriptor.
NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output); NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output);

View file

@ -35,7 +35,7 @@ private:
u64 pid{}; u64 pid{};
bool is_initialized{}; bool is_initialized{};
size_t session_id{}; NvCore::SessionId session_id{};
Common::ScratchBuffer<u8> output_buffer; Common::ScratchBuffer<u8> output_buffer;
Common::ScratchBuffer<u8> inline_output_buffer; Common::ScratchBuffer<u8> inline_output_buffer;
}; };

View file

@ -4,6 +4,7 @@
#pragma once #pragma once
#include "common/math_util.h" #include "common/math_util.h"
#include "core/hle/service/nvdrv/core/container.h"
#include "core/hle/service/nvdrv/nvdata.h" #include "core/hle/service/nvdrv/nvdata.h"
#include "core/hle/service/nvnflinger/nvnflinger.h" #include "core/hle/service/nvnflinger/nvnflinger.h"
#include "core/hle/service/nvnflinger/ui/fence.h" #include "core/hle/service/nvnflinger/ui/fence.h"
@ -55,7 +56,7 @@ private:
u32 m_buffer_nvmap_handle = 0; u32 m_buffer_nvmap_handle = 0;
SharedMemoryPoolLayout m_pool_layout = {}; SharedMemoryPoolLayout m_pool_layout = {};
Nvidia::DeviceFD m_nvmap_fd = {}; Nvidia::DeviceFD m_nvmap_fd = {};
size_t m_session_id = {}; Nvidia::NvCore::SessionId m_session_id = {};
std::unique_ptr<Kernel::KPageGroup> m_buffer_page_group; std::unique_ptr<Kernel::KPageGroup> m_buffer_page_group;
std::mutex m_guard; std::mutex m_guard;

View file

@ -126,7 +126,7 @@ void Nvnflinger::ShutdownLayers() {
void Nvnflinger::SetNVDrvInstance(std::shared_ptr<Nvidia::Module> instance) { void Nvnflinger::SetNVDrvInstance(std::shared_ptr<Nvidia::Module> instance) {
nvdrv = std::move(instance); nvdrv = std::move(instance);
disp_fd = nvdrv->Open("/dev/nvdisp_disp0", 0); disp_fd = nvdrv->Open("/dev/nvdisp_disp0", {});
} }
std::optional<u64> Nvnflinger::OpenDisplay(std::string_view name) { std::optional<u64> Nvnflinger::OpenDisplay(std::string_view name) {

View file

@ -509,11 +509,11 @@ void EmulatedController::ReloadInput() {
}); });
} }
turbo_button_state = 0; turbo_button_state = 0;
is_initalized = true; is_initialized = true;
} }
void EmulatedController::UnloadInput() { void EmulatedController::UnloadInput() {
is_initalized = false; is_initialized = false;
for (auto& button : button_devices) { for (auto& button : button_devices) {
button.reset(); button.reset();
} }
@ -1209,7 +1209,7 @@ void EmulatedController::SetNfc(const Common::Input::CallbackStatus& callback) {
} }
bool EmulatedController::SetVibration(std::size_t device_index, VibrationValue vibration) { bool EmulatedController::SetVibration(std::size_t device_index, VibrationValue vibration) {
if (!is_initalized) { if (!is_initialized) {
return false; return false;
} }
if (device_index >= output_devices.size()) { if (device_index >= output_devices.size()) {
@ -1247,7 +1247,7 @@ bool EmulatedController::IsVibrationEnabled(std::size_t device_index) {
const auto player_index = Service::HID::NpadIdTypeToIndex(npad_id_type); const auto player_index = Service::HID::NpadIdTypeToIndex(npad_id_type);
const auto& player = Settings::values.players.GetValue()[player_index]; const auto& player = Settings::values.players.GetValue()[player_index];
if (!is_initalized) { if (!is_initialized) {
return false; return false;
} }
@ -1270,7 +1270,7 @@ Common::Input::DriverResult EmulatedController::SetPollingMode(
EmulatedDeviceIndex device_index, Common::Input::PollingMode polling_mode) { EmulatedDeviceIndex device_index, Common::Input::PollingMode polling_mode) {
LOG_INFO(Service_HID, "Set polling mode {}, device_index={}", polling_mode, device_index); LOG_INFO(Service_HID, "Set polling mode {}, device_index={}", polling_mode, device_index);
if (!is_initalized) { if (!is_initialized) {
return Common::Input::DriverResult::InvalidHandle; return Common::Input::DriverResult::InvalidHandle;
} }
@ -1319,7 +1319,7 @@ bool EmulatedController::SetCameraFormat(
Core::IrSensor::ImageTransferProcessorFormat camera_format) { Core::IrSensor::ImageTransferProcessorFormat camera_format) {
LOG_INFO(Service_HID, "Set camera format {}", camera_format); LOG_INFO(Service_HID, "Set camera format {}", camera_format);
if (!is_initalized) { if (!is_initialized) {
return false; return false;
} }
@ -1347,7 +1347,7 @@ void EmulatedController::SetRingParam(Common::ParamPackage param) {
bool EmulatedController::HasNfc() const { bool EmulatedController::HasNfc() const {
if (!is_initalized) { if (!is_initialized) {
return false; return false;
} }
@ -1388,7 +1388,7 @@ bool EmulatedController::RemoveNfcHandle() {
} }
bool EmulatedController::StartNfcPolling() { bool EmulatedController::StartNfcPolling() {
if (!is_initalized) { if (!is_initialized) {
return false; return false;
} }
@ -1403,7 +1403,7 @@ bool EmulatedController::StartNfcPolling() {
} }
bool EmulatedController::StopNfcPolling() { bool EmulatedController::StopNfcPolling() {
if (!is_initalized) { if (!is_initialized) {
return false; return false;
} }
@ -1418,7 +1418,7 @@ bool EmulatedController::StopNfcPolling() {
} }
bool EmulatedController::ReadAmiiboData(std::vector<u8>& data) { bool EmulatedController::ReadAmiiboData(std::vector<u8>& data) {
if (!is_initalized) { if (!is_initialized) {
return false; return false;
} }
@ -1434,7 +1434,7 @@ bool EmulatedController::ReadAmiiboData(std::vector<u8>& data) {
bool EmulatedController::ReadMifareData(const Common::Input::MifareRequest& request, bool EmulatedController::ReadMifareData(const Common::Input::MifareRequest& request,
Common::Input::MifareRequest& out_data) { Common::Input::MifareRequest& out_data) {
if (!is_initalized) { if (!is_initialized) {
return false; return false;
} }
@ -1450,7 +1450,7 @@ bool EmulatedController::ReadMifareData(const Common::Input::MifareRequest& requ
} }
bool EmulatedController::WriteMifareData(const Common::Input::MifareRequest& request) { bool EmulatedController::WriteMifareData(const Common::Input::MifareRequest& request) {
if (!is_initalized) { if (!is_initialized) {
return false; return false;
} }
@ -1465,7 +1465,7 @@ bool EmulatedController::WriteMifareData(const Common::Input::MifareRequest& req
} }
bool EmulatedController::WriteNfc(const std::vector<u8>& data) { bool EmulatedController::WriteNfc(const std::vector<u8>& data) {
if (!is_initalized) { if (!is_initialized) {
return false; return false;
} }
@ -1480,7 +1480,7 @@ bool EmulatedController::WriteNfc(const std::vector<u8>& data) {
} }
void EmulatedController::SetLedPattern() { void EmulatedController::SetLedPattern() {
if (!is_initalized) { if (!is_initialized) {
return; return;
} }
@ -1508,8 +1508,8 @@ void EmulatedController::SetGyroscopeZeroDriftMode(GyroscopeZeroDriftMode mode)
motion.emulated.SetGyroThreshold(motion.emulated.ThresholdLoose); motion.emulated.SetGyroThreshold(motion.emulated.ThresholdLoose);
break; break;
case GyroscopeZeroDriftMode::Tight: case GyroscopeZeroDriftMode::Tight:
motion_sensitivity = motion.emulated.IsAtRestThight; motion_sensitivity = motion.emulated.IsAtRestTight;
motion.emulated.SetGyroThreshold(motion.emulated.ThresholdThight); motion.emulated.SetGyroThreshold(motion.emulated.ThresholdTight);
break; break;
case GyroscopeZeroDriftMode::Standard: case GyroscopeZeroDriftMode::Standard:
default: default:

View file

@ -559,7 +559,7 @@ private:
NpadStyleTag supported_style_tag{NpadStyleSet::All}; NpadStyleTag supported_style_tag{NpadStyleSet::All};
bool is_connected{false}; bool is_connected{false};
bool is_configuring{false}; bool is_configuring{false};
bool is_initalized{false}; bool is_initialized{false};
bool system_buttons_enabled{true}; bool system_buttons_enabled{true};
f32 motion_sensitivity{Core::HID::MotionInput::IsAtRestStandard}; f32 motion_sensitivity{Core::HID::MotionInput::IsAtRestStandard};
u32 turbo_button_state{0}; u32 turbo_button_state{0};

View file

@ -13,12 +13,12 @@ class MotionInput {
public: public:
static constexpr float ThresholdLoose = 0.01f; static constexpr float ThresholdLoose = 0.01f;
static constexpr float ThresholdStandard = 0.007f; static constexpr float ThresholdStandard = 0.007f;
static constexpr float ThresholdThight = 0.002f; static constexpr float ThresholdTight = 0.002f;
static constexpr float IsAtRestRelaxed = 0.05f; static constexpr float IsAtRestRelaxed = 0.05f;
static constexpr float IsAtRestLoose = 0.02f; static constexpr float IsAtRestLoose = 0.02f;
static constexpr float IsAtRestStandard = 0.01f; static constexpr float IsAtRestStandard = 0.01f;
static constexpr float IsAtRestThight = 0.005f; static constexpr float IsAtRestTight = 0.005f;
static constexpr float GyroMaxValue = 5.0f; static constexpr float GyroMaxValue = 5.0f;
static constexpr float AccelMaxValue = 7.0f; static constexpr float AccelMaxValue = 7.0f;

View file

@ -15,7 +15,7 @@ constexpr Result ResultVibrationNotInitialized{ErrorModule::HID, 121};
constexpr Result ResultVibrationInvalidStyleIndex{ErrorModule::HID, 122}; constexpr Result ResultVibrationInvalidStyleIndex{ErrorModule::HID, 122};
constexpr Result ResultVibrationInvalidNpadId{ErrorModule::HID, 123}; constexpr Result ResultVibrationInvalidNpadId{ErrorModule::HID, 123};
constexpr Result ResultVibrationDeviceIndexOutOfRange{ErrorModule::HID, 124}; constexpr Result ResultVibrationDeviceIndexOutOfRange{ErrorModule::HID, 124};
constexpr Result ResultVibrationStrenghtOutOfRange{ErrorModule::HID, 126}; constexpr Result ResultVibrationStrengthOutOfRange{ErrorModule::HID, 126};
constexpr Result ResultVibrationArraySizeMismatch{ErrorModule::HID, 131}; constexpr Result ResultVibrationArraySizeMismatch{ErrorModule::HID, 131};
constexpr Result InvalidSixAxisFusionRange{ErrorModule::HID, 423}; constexpr Result InvalidSixAxisFusionRange{ErrorModule::HID, 423};

View file

@ -106,8 +106,8 @@ enum class HandAnalysisMode : u32 {
None, None,
Silhouette, Silhouette,
Image, Image,
SilhoueteAndImage, SilhouetteAndImage,
SilhuetteOnly, SilhouetteOnly,
}; };
// This is nn::irsensor::IrSensorFunctionLevel // This is nn::irsensor::IrSensorFunctionLevel

View file

@ -14,7 +14,7 @@ void HidFirmwareSettings::Reload() {
} }
void HidFirmwareSettings::LoadSettings(bool reload_config) { void HidFirmwareSettings::LoadSettings(bool reload_config) {
if (is_initalized && !reload_config) { if (is_initialized && !reload_config) {
return; return;
} }
@ -33,7 +33,7 @@ void HidFirmwareSettings::LoadSettings(bool reload_config) {
is_handheld_forced = true; is_handheld_forced = true;
features_per_id_disabled = {}; features_per_id_disabled = {};
is_touch_firmware_auto_update_disabled = false; is_touch_firmware_auto_update_disabled = false;
is_initalized = true; is_initialized = true;
} }
bool HidFirmwareSettings::IsDebugPadEnabled() { bool HidFirmwareSettings::IsDebugPadEnabled() {

View file

@ -33,7 +33,7 @@ public:
FeaturesPerId FeaturesDisabledPerId(); FeaturesPerId FeaturesDisabledPerId();
private: private:
bool is_initalized{}; bool is_initialized{};
// Debug settings // Debug settings
bool is_debug_pad_enabled{}; bool is_debug_pad_enabled{};

View file

@ -318,7 +318,7 @@ struct InternalFlags {
BitField<1, 1, u32> is_connected; BitField<1, 1, u32> is_connected;
BitField<2, 1, u32> is_battery_low_ovln_required; BitField<2, 1, u32> is_battery_low_ovln_required;
BitField<3, 1, u32> is_battery_low_ovln_delay_required; BitField<3, 1, u32> is_battery_low_ovln_delay_required;
BitField<4, 1, u32> is_sample_recieved; BitField<4, 1, u32> is_sample_received;
BitField<5, 1, u32> is_virtual_input; BitField<5, 1, u32> is_virtual_input;
BitField<6, 1, u32> is_wired; BitField<6, 1, u32> is_wired;
BitField<8, 1, u32> use_center_clamp; BitField<8, 1, u32> use_center_clamp;

View file

@ -15,7 +15,7 @@ Result NpadVibration::Activate() {
const f32 master_volume = 1.0f; // nn::settings::system::GetVibrationMasterVolume(); const f32 master_volume = 1.0f; // nn::settings::system::GetVibrationMasterVolume();
// if (master_volume < 0.0f || master_volume > 1.0f) { // if (master_volume < 0.0f || master_volume > 1.0f) {
// return ResultVibrationStrenghtOutOfRange; // return ResultVibrationStrengthOutOfRange;
// } // }
volume = master_volume; volume = master_volume;
@ -30,7 +30,7 @@ Result NpadVibration::SetVibrationMasterVolume(f32 master_volume) {
std::scoped_lock lock{mutex}; std::scoped_lock lock{mutex};
if (master_volume < 0.0f && master_volume > 1.0f) { if (master_volume < 0.0f && master_volume > 1.0f) {
return ResultVibrationStrenghtOutOfRange; return ResultVibrationStrengthOutOfRange;
} }
volume = master_volume; volume = master_volume;
@ -50,7 +50,7 @@ Result NpadVibration::GetVibrationMasterVolume(f32& out_volume) const {
const f32 master_volume = 1.0f; // nn::settings::system::GetVibrationMasterVolume(); const f32 master_volume = 1.0f; // nn::settings::system::GetVibrationMasterVolume();
// if (master_volume < 0.0f || master_volume > 1.0f) { // if (master_volume < 0.0f || master_volume > 1.0f) {
// return ResultVibrationStrenghtOutOfRange; // return ResultVibrationStrengthOutOfRange;
// } // }
out_volume = master_volume; out_volume = master_volume;
@ -69,7 +69,7 @@ Result NpadVibration::EndPermitVibrationSession() {
const f32 master_volume = 1.0f; // nn::settings::system::GetVibrationMasterVolume(); const f32 master_volume = 1.0f; // nn::settings::system::GetVibrationMasterVolume();
// if (master_volume < 0.0f || master_volume > 1.0f) { // if (master_volume < 0.0f || master_volume > 1.0f) {
// return ResultVibrationStrenghtOutOfRange; // return ResultVibrationStrengthOutOfRange;
// } // }
volume = master_volume; volume = master_volume;

View file

@ -249,7 +249,7 @@ Result SixAxis::EnableSixAxisSensorUnalteredPassthrough(
} }
auto& sixaxis = GetSixaxisState(sixaxis_handle); auto& sixaxis = GetSixaxisState(sixaxis_handle);
sixaxis.unaltered_passtrough = is_enabled; sixaxis.unaltered_passthrough = is_enabled;
return ResultSuccess; return ResultSuccess;
} }
@ -262,7 +262,7 @@ Result SixAxis::IsSixAxisSensorUnalteredPassthroughEnabled(
} }
const auto& sixaxis = GetSixaxisState(sixaxis_handle); const auto& sixaxis = GetSixaxisState(sixaxis_handle);
is_enabled = sixaxis.unaltered_passtrough; is_enabled = sixaxis.unaltered_passthrough;
return ResultSuccess; return ResultSuccess;
} }

View file

@ -62,7 +62,7 @@ private:
struct SixaxisParameters { struct SixaxisParameters {
bool is_fusion_enabled{true}; bool is_fusion_enabled{true};
bool unaltered_passtrough{false}; bool unaltered_passthrough{false};
Core::HID::SixAxisSensorFusionParameters fusion{}; Core::HID::SixAxisSensorFusionParameters fusion{};
Core::HID::SixAxisSensorCalibrationParameter calibration{}; Core::HID::SixAxisSensorCalibrationParameter calibration{};
Core::HID::SixAxisSensorIcInformation ic_information{}; Core::HID::SixAxisSensorIcInformation ic_information{};

View file

@ -451,11 +451,11 @@ ButtonMapping GCAdapter::GetButtonMappingForDevice(const Common::ParamPackage& p
std::tuple{Settings::NativeButton::ZL, PadButton::TriggerL, PadAxes::TriggerLeft}, std::tuple{Settings::NativeButton::ZL, PadButton::TriggerL, PadAxes::TriggerLeft},
{Settings::NativeButton::ZR, PadButton::TriggerR, PadAxes::TriggerRight}, {Settings::NativeButton::ZR, PadButton::TriggerR, PadAxes::TriggerRight},
}; };
for (const auto& [switch_button, gcadapter_buton, gcadapter_axis] : switch_to_gcadapter_axis) { for (const auto& [switch_button, gcadapter_button, gcadapter_axis] : switch_to_gcadapter_axis) {
Common::ParamPackage button_params{}; Common::ParamPackage button_params{};
button_params.Set("engine", GetEngineName()); button_params.Set("engine", GetEngineName());
button_params.Set("port", params.Get("port", 0)); button_params.Set("port", params.Get("port", 0));
button_params.Set("button", static_cast<s32>(gcadapter_buton)); button_params.Set("button", static_cast<s32>(gcadapter_button));
button_params.Set("axis", static_cast<s32>(gcadapter_axis)); button_params.Set("axis", static_cast<s32>(gcadapter_axis));
button_params.Set("threshold", 0.5f); button_params.Set("threshold", 0.5f);
button_params.Set("range", 1.9f); button_params.Set("range", 1.9f);

View file

@ -236,9 +236,9 @@ Common::Input::DriverResult IrsProtocol::WriteRegistersStep2() {
.number_of_registers = 0x8, .number_of_registers = 0x8,
.registers = .registers =
{ {
IrsRegister{IrRegistersAddress::LedIntensitiyMSB, IrsRegister{IrRegistersAddress::LedIntensityMSB,
static_cast<u8>(led_intensity >> 8)}, static_cast<u8>(led_intensity >> 8)},
{IrRegistersAddress::LedIntensitiyLSB, static_cast<u8>(led_intensity & 0xff)}, {IrRegistersAddress::LedIntensityLSB, static_cast<u8>(led_intensity & 0xff)},
{IrRegistersAddress::ImageFlip, static_cast<u8>(image_flip)}, {IrRegistersAddress::ImageFlip, static_cast<u8>(image_flip)},
{IrRegistersAddress::DenoiseSmoothing, static_cast<u8>((denoise >> 16) & 0xff)}, {IrRegistersAddress::DenoiseSmoothing, static_cast<u8>((denoise >> 16) & 0xff)},
{IrRegistersAddress::DenoiseEdge, static_cast<u8>((denoise >> 8) & 0xff)}, {IrRegistersAddress::DenoiseEdge, static_cast<u8>((denoise >> 8) & 0xff)},

View file

@ -282,7 +282,7 @@ enum class NFCCommand : u8 {
CancelAll = 0x00, CancelAll = 0x00,
StartPolling = 0x01, StartPolling = 0x01,
StopPolling = 0x02, StopPolling = 0x02,
StartWaitingRecieve = 0x04, StartWaitingReceive = 0x04,
ReadNtag = 0x06, ReadNtag = 0x06,
WriteNtag = 0x08, WriteNtag = 0x08,
Mifare = 0x0F, Mifare = 0x0F,
@ -382,8 +382,8 @@ enum class IrRegistersAddress : u16 {
FinalizeConfig = 0x0700, FinalizeConfig = 0x0700,
LedFilter = 0x0e00, LedFilter = 0x0e00,
Leds = 0x1000, Leds = 0x1000,
LedIntensitiyMSB = 0x1100, LedIntensityMSB = 0x1100,
LedIntensitiyLSB = 0x1200, LedIntensityLSB = 0x1200,
ImageFlip = 0x2d00, ImageFlip = 0x2d00,
Resolution = 0x2e00, Resolution = 0x2e00,
DigitalGainLSB = 0x2e01, DigitalGainLSB = 0x2e01,

View file

@ -519,13 +519,13 @@ Common::Input::DriverResult NfcProtocol::GetMifareData(
} }
if (output.mcu_report == MCUReport::NFCState && output.mcu_data[1] == 0x10) { if (output.mcu_report == MCUReport::NFCState && output.mcu_data[1] == 0x10) {
constexpr std::size_t DATA_LENGHT = 0x10 + 1; constexpr std::size_t DATA_LENGTH = 0x10 + 1;
constexpr std::size_t DATA_START = 11; constexpr std::size_t DATA_START = 11;
const u8 number_of_elements = output.mcu_data[10]; const u8 number_of_elements = output.mcu_data[10];
for (std::size_t i = 0; i < number_of_elements; i++) { for (std::size_t i = 0; i < number_of_elements; i++) {
out_data[i].sector = output.mcu_data[DATA_START + (i * DATA_LENGHT)]; out_data[i].sector = output.mcu_data[DATA_START + (i * DATA_LENGTH)];
memcpy(out_data[i].data.data(), memcpy(out_data[i].data.data(),
output.mcu_data.data() + DATA_START + 1 + (i * DATA_LENGHT), output.mcu_data.data() + DATA_START + 1 + (i * DATA_LENGTH),
sizeof(MifareReadData::data)); sizeof(MifareReadData::data));
} }
package_index++; package_index++;
@ -659,7 +659,7 @@ Common::Input::DriverResult NfcProtocol::SendStopPollingRequest(MCUCommandRespon
Common::Input::DriverResult NfcProtocol::SendNextPackageRequest(MCUCommandResponse& output, Common::Input::DriverResult NfcProtocol::SendNextPackageRequest(MCUCommandResponse& output,
u8 packet_id) { u8 packet_id) {
NFCRequestState request{ NFCRequestState request{
.command_argument = NFCCommand::StartWaitingRecieve, .command_argument = NFCCommand::StartWaitingReceive,
.block_id = {}, .block_id = {},
.packet_id = packet_id, .packet_id = packet_id,
.packet_flag = MCUPacketFlag::LastCommandPacket, .packet_flag = MCUPacketFlag::LastCommandPacket,

View file

@ -67,7 +67,7 @@ u8 RumbleProtocol::EncodeHighAmplitude(f32 amplitude) const {
// More information about these values can be found here: // More information about these values can be found here:
// https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/rumble_data_table.md // https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/rumble_data_table.md
static constexpr std::array<std::pair<f32, int>, 101> high_fequency_amplitude{ static constexpr std::array<std::pair<f32, int>, 101> high_frequency_amplitude{
std::pair<f32, int>{0.0f, 0x0}, std::pair<f32, int>{0.0f, 0x0},
{0.01f, 0x2}, {0.01f, 0x2},
{0.012f, 0x4}, {0.012f, 0x4},
@ -171,20 +171,20 @@ u8 RumbleProtocol::EncodeHighAmplitude(f32 amplitude) const {
{1.003f, 0xc8}, {1.003f, 0xc8},
}; };
for (const auto& [amplitude_value, code] : high_fequency_amplitude) { for (const auto& [amplitude_value, code] : high_frequency_amplitude) {
if (amplitude <= amplitude_value) { if (amplitude <= amplitude_value) {
return static_cast<u8>(code); return static_cast<u8>(code);
} }
} }
return static_cast<u8>(high_fequency_amplitude[high_fequency_amplitude.size() - 1].second); return static_cast<u8>(high_frequency_amplitude[high_frequency_amplitude.size() - 1].second);
} }
u16 RumbleProtocol::EncodeLowAmplitude(f32 amplitude) const { u16 RumbleProtocol::EncodeLowAmplitude(f32 amplitude) const {
// More information about these values can be found here: // More information about these values can be found here:
// https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/rumble_data_table.md // https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/rumble_data_table.md
static constexpr std::array<std::pair<f32, int>, 101> high_fequency_amplitude{ static constexpr std::array<std::pair<f32, int>, 101> high_frequency_amplitude{
std::pair<f32, int>{0.0f, 0x0040}, std::pair<f32, int>{0.0f, 0x0040},
{0.01f, 0x8040}, {0.01f, 0x8040},
{0.012f, 0x0041}, {0.012f, 0x0041},
@ -288,13 +288,13 @@ u16 RumbleProtocol::EncodeLowAmplitude(f32 amplitude) const {
{1.003f, 0x0072}, {1.003f, 0x0072},
}; };
for (const auto& [amplitude_value, code] : high_fequency_amplitude) { for (const auto& [amplitude_value, code] : high_frequency_amplitude) {
if (amplitude <= amplitude_value) { if (amplitude <= amplitude_value) {
return static_cast<u16>(code); return static_cast<u16>(code);
} }
} }
return static_cast<u16>(high_fequency_amplitude[high_fequency_amplitude.size() - 1].second); return static_cast<u16>(high_frequency_amplitude[high_frequency_amplitude.size() - 1].second);
} }
} // namespace InputCommon::Joycon } // namespace InputCommon::Joycon

View file

@ -78,7 +78,7 @@ namespace Request {
enum RegisterFlags : u8 { enum RegisterFlags : u8 {
AllPads, AllPads,
PadID, PadID,
PadMACAdddress, PadMACAddress,
}; };
struct Version {}; struct Version {};

View file

@ -724,7 +724,7 @@ RoomMember::CallbackHandle<RoomInformation> RoomMember::BindOnRoomInformationCha
return room_member_impl->Bind(callback); return room_member_impl->Bind(callback);
} }
RoomMember::CallbackHandle<ChatEntry> RoomMember::BindOnChatMessageRecieved( RoomMember::CallbackHandle<ChatEntry> RoomMember::BindOnChatMessageReceived(
std::function<void(const ChatEntry&)> callback) { std::function<void(const ChatEntry&)> callback) {
return room_member_impl->Bind(callback); return room_member_impl->Bind(callback);
} }

View file

@ -254,7 +254,7 @@ public:
* @param callback The function to call * @param callback The function to call
* @return A handle used for removing the function from the registered list * @return A handle used for removing the function from the registered list
*/ */
CallbackHandle<ChatEntry> BindOnChatMessageRecieved( CallbackHandle<ChatEntry> BindOnChatMessageReceived(
std::function<void(const ChatEntry&)> callback); std::function<void(const ChatEntry&)> callback);
/** /**

View file

@ -608,8 +608,8 @@ std::string EmitContext::DefineGlobalMemoryFunctions() {
const auto aligned_low_addr{fmt::format("{}&{}", addr_xy[0], ssbo_align_mask)}; const auto aligned_low_addr{fmt::format("{}&{}", addr_xy[0], ssbo_align_mask)};
const auto aligned_addr{fmt::format("uvec2({},{})", aligned_low_addr, addr_xy[1])}; const auto aligned_addr{fmt::format("uvec2({},{})", aligned_low_addr, addr_xy[1])};
const auto addr_pack{fmt::format("packUint2x32({})", aligned_addr)}; const auto addr_pack{fmt::format("packUint2x32({})", aligned_addr)};
const auto addr_statment{fmt::format("uint64_t {}={};", ssbo_addr, addr_pack)}; const auto addr_statement{fmt::format("uint64_t {}={};", ssbo_addr, addr_pack)};
func += addr_statment; func += addr_statement;
const auto size_vec{fmt::format("uvec2({},{})", size_xy[0], size_xy[1])}; const auto size_vec{fmt::format("uvec2({},{})", size_xy[0], size_xy[1])};
const auto comp_lhs{fmt::format("(addr>={})", ssbo_addr)}; const auto comp_lhs{fmt::format("(addr>={})", ssbo_addr)};

View file

@ -12,6 +12,11 @@ namespace Shader::Backend::SPIRV {
namespace { namespace {
class ImageOperands { class ImageOperands {
public: public:
[[maybe_unused]] static constexpr bool ImageSampleOffsetAllowed = false;
[[maybe_unused]] static constexpr bool ImageGatherOffsetAllowed = true;
[[maybe_unused]] static constexpr bool ImageFetchOffsetAllowed = false;
[[maybe_unused]] static constexpr bool ImageGradientOffsetAllowed = false;
explicit ImageOperands(EmitContext& ctx, bool has_bias, bool has_lod, bool has_lod_clamp, explicit ImageOperands(EmitContext& ctx, bool has_bias, bool has_lod, bool has_lod_clamp,
Id lod, const IR::Value& offset) { Id lod, const IR::Value& offset) {
if (has_bias) { if (has_bias) {
@ -22,7 +27,7 @@ public:
const Id lod_value{has_lod_clamp ? ctx.OpCompositeExtract(ctx.F32[1], lod, 0) : lod}; const Id lod_value{has_lod_clamp ? ctx.OpCompositeExtract(ctx.F32[1], lod, 0) : lod};
Add(spv::ImageOperandsMask::Lod, lod_value); Add(spv::ImageOperandsMask::Lod, lod_value);
} }
AddOffset(ctx, offset); AddOffset(ctx, offset, ImageSampleOffsetAllowed);
if (has_lod_clamp) { if (has_lod_clamp) {
const Id lod_clamp{has_bias ? ctx.OpCompositeExtract(ctx.F32[1], lod, 1) : lod}; const Id lod_clamp{has_bias ? ctx.OpCompositeExtract(ctx.F32[1], lod, 1) : lod};
Add(spv::ImageOperandsMask::MinLod, lod_clamp); Add(spv::ImageOperandsMask::MinLod, lod_clamp);
@ -55,20 +60,17 @@ public:
Add(spv::ImageOperandsMask::ConstOffsets, offsets); Add(spv::ImageOperandsMask::ConstOffsets, offsets);
} }
explicit ImageOperands(Id offset, Id lod, Id ms) { explicit ImageOperands(Id lod, Id ms) {
if (Sirit::ValidId(lod)) { if (Sirit::ValidId(lod)) {
Add(spv::ImageOperandsMask::Lod, lod); Add(spv::ImageOperandsMask::Lod, lod);
} }
if (Sirit::ValidId(offset)) {
Add(spv::ImageOperandsMask::Offset, offset);
}
if (Sirit::ValidId(ms)) { if (Sirit::ValidId(ms)) {
Add(spv::ImageOperandsMask::Sample, ms); Add(spv::ImageOperandsMask::Sample, ms);
} }
} }
explicit ImageOperands(EmitContext& ctx, bool has_lod_clamp, Id derivatives, explicit ImageOperands(EmitContext& ctx, bool has_lod_clamp, Id derivatives,
u32 num_derivatives, Id offset, Id lod_clamp) { u32 num_derivatives, const IR::Value& offset, Id lod_clamp) {
if (!Sirit::ValidId(derivatives)) { if (!Sirit::ValidId(derivatives)) {
throw LogicError("Derivatives must be present"); throw LogicError("Derivatives must be present");
} }
@ -83,16 +85,14 @@ public:
const Id derivatives_Y{ctx.OpCompositeConstruct( const Id derivatives_Y{ctx.OpCompositeConstruct(
ctx.F32[num_derivatives], std::span{deriv_y_accum.data(), deriv_y_accum.size()})}; ctx.F32[num_derivatives], std::span{deriv_y_accum.data(), deriv_y_accum.size()})};
Add(spv::ImageOperandsMask::Grad, derivatives_X, derivatives_Y); Add(spv::ImageOperandsMask::Grad, derivatives_X, derivatives_Y);
if (Sirit::ValidId(offset)) { AddOffset(ctx, offset, ImageGradientOffsetAllowed);
Add(spv::ImageOperandsMask::Offset, offset);
}
if (has_lod_clamp) { if (has_lod_clamp) {
Add(spv::ImageOperandsMask::MinLod, lod_clamp); Add(spv::ImageOperandsMask::MinLod, lod_clamp);
} }
} }
explicit ImageOperands(EmitContext& ctx, bool has_lod_clamp, Id derivatives_1, Id derivatives_2, explicit ImageOperands(EmitContext& ctx, bool has_lod_clamp, Id derivatives_1, Id derivatives_2,
Id offset, Id lod_clamp) { const IR::Value& offset, Id lod_clamp) {
if (!Sirit::ValidId(derivatives_1) || !Sirit::ValidId(derivatives_2)) { if (!Sirit::ValidId(derivatives_1) || !Sirit::ValidId(derivatives_2)) {
throw LogicError("Derivatives must be present"); throw LogicError("Derivatives must be present");
} }
@ -111,9 +111,7 @@ public:
const Id derivatives_id2{ctx.OpCompositeConstruct( const Id derivatives_id2{ctx.OpCompositeConstruct(
ctx.F32[3], std::span{deriv_2_accum.data(), deriv_2_accum.size()})}; ctx.F32[3], std::span{deriv_2_accum.data(), deriv_2_accum.size()})};
Add(spv::ImageOperandsMask::Grad, derivatives_id1, derivatives_id2); Add(spv::ImageOperandsMask::Grad, derivatives_id1, derivatives_id2);
if (Sirit::ValidId(offset)) { AddOffset(ctx, offset, ImageGradientOffsetAllowed);
Add(spv::ImageOperandsMask::Offset, offset);
}
if (has_lod_clamp) { if (has_lod_clamp) {
Add(spv::ImageOperandsMask::MinLod, lod_clamp); Add(spv::ImageOperandsMask::MinLod, lod_clamp);
} }
@ -132,7 +130,7 @@ public:
} }
private: private:
void AddOffset(EmitContext& ctx, const IR::Value& offset) { void AddOffset(EmitContext& ctx, const IR::Value& offset, bool runtime_offset_allowed) {
if (offset.IsEmpty()) { if (offset.IsEmpty()) {
return; return;
} }
@ -165,7 +163,9 @@ private:
break; break;
} }
} }
Add(spv::ImageOperandsMask::Offset, ctx.Def(offset)); if (runtime_offset_allowed) {
Add(spv::ImageOperandsMask::Offset, ctx.Def(offset));
}
} }
void Add(spv::ImageOperandsMask new_mask, Id value) { void Add(spv::ImageOperandsMask new_mask, Id value) {
@ -311,6 +311,37 @@ Id ImageGatherSubpixelOffset(EmitContext& ctx, const IR::TextureInstInfo& info,
return coords; return coords;
} }
} }
void AddOffsetToCoordinates(EmitContext& ctx, const IR::TextureInstInfo& info, Id& coords,
Id offset) {
if (!Sirit::ValidId(offset)) {
return;
}
Id result_type{};
switch (info.type) {
case TextureType::Buffer:
case TextureType::Color1D:
case TextureType::ColorArray1D: {
result_type = ctx.U32[1];
break;
}
case TextureType::Color2D:
case TextureType::Color2DRect:
case TextureType::ColorArray2D: {
result_type = ctx.U32[2];
break;
}
case TextureType::Color3D: {
result_type = ctx.U32[3];
break;
}
case TextureType::ColorCube:
case TextureType::ColorArrayCube:
return;
}
coords = ctx.OpIAdd(result_type, coords, offset);
}
} // Anonymous namespace } // Anonymous namespace
Id EmitBindlessImageSampleImplicitLod(EmitContext&) { Id EmitBindlessImageSampleImplicitLod(EmitContext&) {
@ -496,6 +527,7 @@ Id EmitImageGatherDref(EmitContext& ctx, IR::Inst* inst, const IR::Value& index,
Id EmitImageFetch(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, Id offset, Id EmitImageFetch(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, Id offset,
Id lod, Id ms) { Id lod, Id ms) {
const auto info{inst->Flags<IR::TextureInstInfo>()}; const auto info{inst->Flags<IR::TextureInstInfo>()};
AddOffsetToCoordinates(ctx, info, coords, offset);
if (info.type == TextureType::Buffer) { if (info.type == TextureType::Buffer) {
lod = Id{}; lod = Id{};
} }
@ -503,7 +535,7 @@ Id EmitImageFetch(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id c
// This image is multisampled, lod must be implicit // This image is multisampled, lod must be implicit
lod = Id{}; lod = Id{};
} }
const ImageOperands operands(offset, lod, ms); const ImageOperands operands(lod, ms);
return Emit(&EmitContext::OpImageSparseFetch, &EmitContext::OpImageFetch, ctx, inst, ctx.F32[4], return Emit(&EmitContext::OpImageSparseFetch, &EmitContext::OpImageFetch, ctx, inst, ctx.F32[4],
TextureImage(ctx, info, index), coords, operands.MaskOptional(), operands.Span()); TextureImage(ctx, info, index), coords, operands.MaskOptional(), operands.Span());
} }
@ -548,13 +580,13 @@ Id EmitImageQueryLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, I
} }
Id EmitImageGradient(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, Id EmitImageGradient(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords,
Id derivatives, Id offset, Id lod_clamp) { Id derivatives, const IR::Value& offset, Id lod_clamp) {
const auto info{inst->Flags<IR::TextureInstInfo>()}; const auto info{inst->Flags<IR::TextureInstInfo>()};
const auto operands = const auto operands = info.num_derivatives == 3
info.num_derivatives == 3 ? ImageOperands(ctx, info.has_lod_clamp != 0, derivatives,
? ImageOperands(ctx, info.has_lod_clamp != 0, derivatives, offset, {}, lod_clamp) ctx.Def(offset), {}, lod_clamp)
: ImageOperands(ctx, info.has_lod_clamp != 0, derivatives, info.num_derivatives, offset, : ImageOperands(ctx, info.has_lod_clamp != 0, derivatives,
lod_clamp); info.num_derivatives, offset, lod_clamp);
return Emit(&EmitContext::OpImageSparseSampleExplicitLod, return Emit(&EmitContext::OpImageSparseSampleExplicitLod,
&EmitContext::OpImageSampleExplicitLod, ctx, inst, ctx.F32[4], &EmitContext::OpImageSampleExplicitLod, ctx, inst, ctx.F32[4],
Texture(ctx, info, index), coords, operands.Mask(), operands.Span()); Texture(ctx, info, index), coords, operands.Mask(), operands.Span());

View file

@ -543,7 +543,7 @@ Id EmitImageQueryDimensions(EmitContext& ctx, IR::Inst* inst, const IR::Value& i
const IR::Value& skip_mips); const IR::Value& skip_mips);
Id EmitImageQueryLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords); Id EmitImageQueryLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords);
Id EmitImageGradient(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, Id EmitImageGradient(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords,
Id derivatives, Id offset, Id lod_clamp); Id derivatives, const IR::Value& offset, Id lod_clamp);
Id EmitImageRead(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords); Id EmitImageRead(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords);
void EmitImageWrite(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, Id color); void EmitImageWrite(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, Id color);
Id EmitIsTextureScaled(EmitContext& ctx, const IR::Value& index); Id EmitIsTextureScaled(EmitContext& ctx, const IR::Value& index);

View file

@ -55,7 +55,7 @@ public:
/// Requests to begin a renderpass. /// Requests to begin a renderpass.
void RequestRenderpass(const Framebuffer* framebuffer); void RequestRenderpass(const Framebuffer* framebuffer);
/// Requests the current executino context to be able to execute operations only allowed outside /// Requests the current execution context to be able to execute operations only allowed outside
/// of a renderpass. /// of a renderpass.
void RequestOutsideRenderPassOperationContext(); void RequestOutsideRenderPassOperationContext();

View file

@ -36,7 +36,7 @@ QtAmiiboSettingsDialog::QtAmiiboSettingsDialog(QWidget* parent,
QtAmiiboSettingsDialog::~QtAmiiboSettingsDialog() = default; QtAmiiboSettingsDialog::~QtAmiiboSettingsDialog() = default;
int QtAmiiboSettingsDialog::exec() { int QtAmiiboSettingsDialog::exec() {
if (!is_initalized) { if (!is_initialized) {
return QDialog::Rejected; return QDialog::Rejected;
} }
return QDialog::exec(); return QDialog::exec();
@ -66,7 +66,7 @@ void QtAmiiboSettingsDialog::LoadInfo() {
QString::fromStdString(input_subsystem->GetVirtualAmiibo()->GetLastFilePath())); QString::fromStdString(input_subsystem->GetVirtualAmiibo()->GetLastFilePath()));
SetSettingsDescription(); SetSettingsDescription();
is_initalized = true; is_initialized = true;
} }
void QtAmiiboSettingsDialog::LoadAmiiboInfo() { void QtAmiiboSettingsDialog::LoadAmiiboInfo() {

View file

@ -58,7 +58,7 @@ private:
Core::Frontend::CabinetParameters parameters; Core::Frontend::CabinetParameters parameters;
// If false amiibo settings failed to load // If false amiibo settings failed to load
bool is_initalized{}; bool is_initialized{};
}; };
class QtAmiiboSettings final : public QObject, public Core::Frontend::CabinetApplet { class QtAmiiboSettings final : public QObject, public Core::Frontend::CabinetApplet {

View file

@ -170,7 +170,7 @@ public:
void resizeEvent(QResizeEvent* event) override; void resizeEvent(QResizeEvent* event) override;
/// Converts a Qt keybard key into NativeKeyboard key /// Converts a Qt keyboard key into NativeKeyboard key
static int QtKeyToSwitchKey(Qt::Key qt_keys); static int QtKeyToSwitchKey(Qt::Key qt_keys);
/// Converts a Qt modifier keys into NativeKeyboard modifier keys /// Converts a Qt modifier keys into NativeKeyboard modifier keys

View file

@ -845,12 +845,12 @@ void PlayerControlPreview::DrawProController(QPainter& p, const QPointF center)
DrawSymbol(p, face_center + QPoint(-face_distance, 1), Symbol::Y, text_size); DrawSymbol(p, face_center + QPoint(-face_distance, 1), Symbol::Y, text_size);
// D-pad buttons // D-pad buttons
const QPointF dpad_postion = center + QPoint(-61, 0); const QPointF dpad_position = center + QPoint(-61, 0);
DrawArrowButton(p, dpad_postion, Direction::Up, button_values[DUp]); DrawArrowButton(p, dpad_position, Direction::Up, button_values[DUp]);
DrawArrowButton(p, dpad_postion, Direction::Left, button_values[DLeft]); DrawArrowButton(p, dpad_position, Direction::Left, button_values[DLeft]);
DrawArrowButton(p, dpad_postion, Direction::Right, button_values[DRight]); DrawArrowButton(p, dpad_position, Direction::Right, button_values[DRight]);
DrawArrowButton(p, dpad_postion, Direction::Down, button_values[DDown]); DrawArrowButton(p, dpad_position, Direction::Down, button_values[DDown]);
DrawArrowButtonOutline(p, dpad_postion); DrawArrowButtonOutline(p, dpad_position);
// ZL and ZR buttons // ZL and ZR buttons
p.setPen(colors.outline); p.setPen(colors.outline);
@ -935,13 +935,13 @@ void PlayerControlPreview::DrawGCController(QPainter& p, const QPointF center) {
DrawSymbol(p, center + QPoint(100, -83), Symbol::Y, text_size); DrawSymbol(p, center + QPoint(100, -83), Symbol::Y, text_size);
// D-pad buttons // D-pad buttons
const QPointF dpad_postion = center + QPoint(-61, 37); const QPointF dpad_position = center + QPoint(-61, 37);
const float dpad_size = 0.8f; const float dpad_size = 0.8f;
DrawArrowButton(p, dpad_postion, Direction::Up, button_values[DUp], dpad_size); DrawArrowButton(p, dpad_position, Direction::Up, button_values[DUp], dpad_size);
DrawArrowButton(p, dpad_postion, Direction::Left, button_values[DLeft], dpad_size); DrawArrowButton(p, dpad_position, Direction::Left, button_values[DLeft], dpad_size);
DrawArrowButton(p, dpad_postion, Direction::Right, button_values[DRight], dpad_size); DrawArrowButton(p, dpad_position, Direction::Right, button_values[DRight], dpad_size);
DrawArrowButton(p, dpad_postion, Direction::Down, button_values[DDown], dpad_size); DrawArrowButton(p, dpad_position, Direction::Down, button_values[DDown], dpad_size);
DrawArrowButtonOutline(p, dpad_postion, dpad_size); DrawArrowButtonOutline(p, dpad_position, dpad_size);
// Minus and Plus buttons // Minus and Plus buttons
p.setPen(colors.outline); p.setPen(colors.outline);

View file

@ -121,7 +121,7 @@ void ConfigureSystem::Setup(const ConfigurationShared::Builder& builder) {
} }
if (setting->Id() == Settings::values.region_index.Id()) { if (setting->Id() == Settings::values.region_index.Id()) {
// Keep track of the region_index (and langauge_index) combobox to validate the selected // Keep track of the region_index (and language_index) combobox to validate the selected
// settings // settings
combo_region = widget->combobox; combo_region = widget->combobox;
} else if (setting->Id() == Settings::values.language_index.Id()) { } else if (setting->Id() == Settings::values.language_index.Id()) {

View file

@ -750,12 +750,12 @@ Widget::Widget(Settings::BasicSetting* setting_, const TranslationMap& translati
} }
apply_funcs.push_back([load_func, setting_](bool powered_on) { apply_funcs.push_back([load_func, setting_](bool powered_on) {
if (setting_->RuntimeModfiable() || !powered_on) { if (setting_->RuntimeModifiable() || !powered_on) {
load_func(); load_func();
} }
}); });
bool enable = runtime_lock || setting.RuntimeModfiable(); bool enable = runtime_lock || setting.RuntimeModifiable();
if (setting.Switchable() && Settings::IsConfiguringGlobal() && !runtime_lock) { if (setting.Switchable() && Settings::IsConfiguringGlobal() && !runtime_lock) {
enable &= setting.UsingGlobal(); enable &= setting.UsingGlobal();
} }

View file

@ -206,7 +206,7 @@ void ChatRoom::Initialize(Network::RoomNetwork* room_network_) {
room_network = room_network_; room_network = room_network_;
// setup the callbacks for network updates // setup the callbacks for network updates
if (auto member = room_network->GetRoomMember().lock()) { if (auto member = room_network->GetRoomMember().lock()) {
member->BindOnChatMessageRecieved( member->BindOnChatMessageReceived(
[this](const Network::ChatEntry& chat) { emit ChatReceived(chat); }); [this](const Network::ChatEntry& chat) { emit ChatReceived(chat); });
member->BindOnStatusMessageReceived( member->BindOnStatusMessageReceived(
[this](const Network::StatusMessageEntry& status_message) { [this](const Network::StatusMessageEntry& status_message) {

View file

@ -401,7 +401,7 @@ int main(int argc, char** argv) {
if (use_multiplayer) { if (use_multiplayer) {
if (auto member = system.GetRoomNetwork().GetRoomMember().lock()) { if (auto member = system.GetRoomNetwork().GetRoomMember().lock()) {
member->BindOnChatMessageRecieved(OnMessageReceived); member->BindOnChatMessageReceived(OnMessageReceived);
member->BindOnStatusMessageReceived(OnStatusMessageReceived); member->BindOnStatusMessageReceived(OnStatusMessageReceived);
member->BindOnStateChanged(OnStateChanged); member->BindOnStateChanged(OnStateChanged);
member->BindOnError(OnNetworkError); member->BindOnError(OnNetworkError);