diff options
Diffstat (limited to 'src/core/hle')
65 files changed, 1039 insertions, 582 deletions
diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp new file mode 100644 index 000000000..e9c8369d7 --- /dev/null +++ b/src/core/hle/kernel/address_arbiter.cpp @@ -0,0 +1,173 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/assert.h" +#include "common/common_funcs.h" +#include "common/common_types.h" +#include "core/core.h" +#include "core/hle/kernel/errors.h" +#include "core/hle/kernel/kernel.h" +#include "core/hle/kernel/process.h" +#include "core/hle/kernel/thread.h" +#include "core/hle/lock.h" +#include "core/memory.h" + +namespace Kernel { +namespace AddressArbiter { + +// Performs actual address waiting logic. +static ResultCode WaitForAddress(VAddr address, s64 timeout) { + SharedPtr<Thread> current_thread = GetCurrentThread(); + current_thread->arb_wait_address = address; + current_thread->status = THREADSTATUS_WAIT_ARB; + current_thread->wakeup_callback = nullptr; + + current_thread->WakeAfterDelay(timeout); + + Core::System::GetInstance().CpuCore(current_thread->processor_id).PrepareReschedule(); + return RESULT_TIMEOUT; +} + +// Gets the threads waiting on an address. +static void GetThreadsWaitingOnAddress(std::vector<SharedPtr<Thread>>& waiting_threads, + VAddr address) { + auto RetrieveWaitingThreads = + [](size_t core_index, std::vector<SharedPtr<Thread>>& waiting_threads, VAddr arb_addr) { + const auto& scheduler = Core::System::GetInstance().Scheduler(core_index); + auto& thread_list = scheduler->GetThreadList(); + + for (auto& thread : thread_list) { + if (thread->arb_wait_address == arb_addr) + waiting_threads.push_back(thread); + } + }; + + // Retrieve a list of all threads that are waiting for this address. + RetrieveWaitingThreads(0, waiting_threads, address); + RetrieveWaitingThreads(1, waiting_threads, address); + RetrieveWaitingThreads(2, waiting_threads, address); + RetrieveWaitingThreads(3, waiting_threads, address); + // Sort them by priority, such that the highest priority ones come first. + std::sort(waiting_threads.begin(), waiting_threads.end(), + [](const SharedPtr<Thread>& lhs, const SharedPtr<Thread>& rhs) { + return lhs->current_priority < rhs->current_priority; + }); +} + +// Wake up num_to_wake (or all) threads in a vector. +static void WakeThreads(std::vector<SharedPtr<Thread>>& waiting_threads, s32 num_to_wake) { + // Only process up to 'target' threads, unless 'target' is <= 0, in which case process + // them all. + size_t last = waiting_threads.size(); + if (num_to_wake > 0) + last = num_to_wake; + + // Signal the waiting threads. + for (size_t i = 0; i < last; i++) { + ASSERT(waiting_threads[i]->status = THREADSTATUS_WAIT_ARB); + waiting_threads[i]->SetWaitSynchronizationResult(RESULT_SUCCESS); + waiting_threads[i]->arb_wait_address = 0; + waiting_threads[i]->ResumeFromWait(); + } +} + +// Signals an address being waited on. +ResultCode SignalToAddress(VAddr address, s32 num_to_wake) { + // Get threads waiting on the address. + std::vector<SharedPtr<Thread>> waiting_threads; + GetThreadsWaitingOnAddress(waiting_threads, address); + + WakeThreads(waiting_threads, num_to_wake); + return RESULT_SUCCESS; +} + +// Signals an address being waited on and increments its value if equal to the value argument. +ResultCode IncrementAndSignalToAddressIfEqual(VAddr address, s32 value, s32 num_to_wake) { + // Ensure that we can write to the address. + if (!Memory::IsValidVirtualAddress(address)) { + return ERR_INVALID_ADDRESS_STATE; + } + + if (static_cast<s32>(Memory::Read32(address)) == value) { + Memory::Write32(address, static_cast<u32>(value + 1)); + } else { + return ERR_INVALID_STATE; + } + + return SignalToAddress(address, num_to_wake); +} + +// Signals an address being waited on and modifies its value based on waiting thread count if equal +// to the value argument. +ResultCode ModifyByWaitingCountAndSignalToAddressIfEqual(VAddr address, s32 value, + s32 num_to_wake) { + // Ensure that we can write to the address. + if (!Memory::IsValidVirtualAddress(address)) { + return ERR_INVALID_ADDRESS_STATE; + } + + // Get threads waiting on the address. + std::vector<SharedPtr<Thread>> waiting_threads; + GetThreadsWaitingOnAddress(waiting_threads, address); + + // Determine the modified value depending on the waiting count. + s32 updated_value; + if (waiting_threads.size() == 0) { + updated_value = value - 1; + } else if (num_to_wake <= 0 || waiting_threads.size() <= num_to_wake) { + updated_value = value + 1; + } else { + updated_value = value; + } + + if (static_cast<s32>(Memory::Read32(address)) == value) { + Memory::Write32(address, static_cast<u32>(updated_value)); + } else { + return ERR_INVALID_STATE; + } + + WakeThreads(waiting_threads, num_to_wake); + return RESULT_SUCCESS; +} + +// Waits on an address if the value passed is less than the argument value, optionally decrementing. +ResultCode WaitForAddressIfLessThan(VAddr address, s32 value, s64 timeout, bool should_decrement) { + // Ensure that we can read the address. + if (!Memory::IsValidVirtualAddress(address)) { + return ERR_INVALID_ADDRESS_STATE; + } + + s32 cur_value = static_cast<s32>(Memory::Read32(address)); + if (cur_value < value) { + Memory::Write32(address, static_cast<u32>(cur_value - 1)); + } else { + return ERR_INVALID_STATE; + } + // Short-circuit without rescheduling, if timeout is zero. + if (timeout == 0) { + return RESULT_TIMEOUT; + } + + return WaitForAddress(address, timeout); +} + +// Waits on an address if the value passed is equal to the argument value. +ResultCode WaitForAddressIfEqual(VAddr address, s32 value, s64 timeout) { + // Ensure that we can read the address. + if (!Memory::IsValidVirtualAddress(address)) { + return ERR_INVALID_ADDRESS_STATE; + } + // Only wait for the address if equal. + if (static_cast<s32>(Memory::Read32(address)) != value) { + return ERR_INVALID_STATE; + } + // Short-circuit without rescheduling, if timeout is zero. + if (timeout == 0) { + return RESULT_TIMEOUT; + } + + return WaitForAddress(address, timeout); +} +} // namespace AddressArbiter +} // namespace Kernel diff --git a/src/core/hle/kernel/address_arbiter.h b/src/core/hle/kernel/address_arbiter.h new file mode 100644 index 000000000..f20f3dbc0 --- /dev/null +++ b/src/core/hle/kernel/address_arbiter.h @@ -0,0 +1,32 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/result.h" + +namespace Kernel { + +namespace AddressArbiter { +enum class ArbitrationType { + WaitIfLessThan = 0, + DecrementAndWaitIfLessThan = 1, + WaitIfEqual = 2, +}; + +enum class SignalType { + Signal = 0, + IncrementAndSignalIfEqual = 1, + ModifyByWaitingCountAndSignalIfEqual = 2, +}; + +ResultCode SignalToAddress(VAddr address, s32 num_to_wake); +ResultCode IncrementAndSignalToAddressIfEqual(VAddr address, s32 value, s32 num_to_wake); +ResultCode ModifyByWaitingCountAndSignalToAddressIfEqual(VAddr address, s32 value, s32 num_to_wake); + +ResultCode WaitForAddressIfLessThan(VAddr address, s32 value, s64 timeout, bool should_decrement); +ResultCode WaitForAddressIfEqual(VAddr address, s32 value, s64 timeout); +} // namespace AddressArbiter + +} // namespace Kernel diff --git a/src/core/hle/kernel/errors.h b/src/core/hle/kernel/errors.h index e1b5430bf..221cb1bb5 100644 --- a/src/core/hle/kernel/errors.h +++ b/src/core/hle/kernel/errors.h @@ -20,13 +20,16 @@ enum { MaxConnectionsReached = 52, // Confirmed Switch OS error codes - MisalignedAddress = 102, + InvalidAddress = 102, + InvalidMemoryState = 106, InvalidProcessorId = 113, InvalidHandle = 114, InvalidCombination = 116, Timeout = 117, SynchronizationCanceled = 118, TooLarge = 119, + InvalidEnumValue = 120, + InvalidState = 125, }; } @@ -39,14 +42,15 @@ constexpr ResultCode ERR_SESSION_CLOSED_BY_REMOTE(-1); constexpr ResultCode ERR_PORT_NAME_TOO_LONG(-1); constexpr ResultCode ERR_WRONG_PERMISSION(-1); constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(-1); -constexpr ResultCode ERR_INVALID_ENUM_VALUE(-1); +constexpr ResultCode ERR_INVALID_ENUM_VALUE(ErrorModule::Kernel, ErrCodes::InvalidEnumValue); constexpr ResultCode ERR_INVALID_ENUM_VALUE_FND(-1); constexpr ResultCode ERR_INVALID_COMBINATION(-1); constexpr ResultCode ERR_INVALID_COMBINATION_KERNEL(-1); constexpr ResultCode ERR_OUT_OF_MEMORY(-1); -constexpr ResultCode ERR_INVALID_ADDRESS(-1); -constexpr ResultCode ERR_INVALID_ADDRESS_STATE(-1); +constexpr ResultCode ERR_INVALID_ADDRESS(ErrorModule::Kernel, ErrCodes::InvalidAddress); +constexpr ResultCode ERR_INVALID_ADDRESS_STATE(ErrorModule::Kernel, ErrCodes::InvalidMemoryState); constexpr ResultCode ERR_INVALID_HANDLE(ErrorModule::Kernel, ErrCodes::InvalidHandle); +constexpr ResultCode ERR_INVALID_STATE(ErrorModule::Kernel, ErrCodes::InvalidState); constexpr ResultCode ERR_INVALID_POINTER(-1); constexpr ResultCode ERR_INVALID_OBJECT_ADDR(-1); constexpr ResultCode ERR_NOT_AUTHORIZED(-1); diff --git a/src/core/hle/kernel/handle_table.cpp b/src/core/hle/kernel/handle_table.cpp index f7a9920d8..7dd67f80f 100644 --- a/src/core/hle/kernel/handle_table.cpp +++ b/src/core/hle/kernel/handle_table.cpp @@ -26,7 +26,7 @@ ResultVal<Handle> HandleTable::Create(SharedPtr<Object> obj) { u16 slot = next_free_slot; if (slot >= generations.size()) { - NGLOG_ERROR(Kernel, "Unable to allocate Handle, too many slots in use."); + LOG_ERROR(Kernel, "Unable to allocate Handle, too many slots in use."); return ERR_OUT_OF_HANDLES; } next_free_slot = generations[slot]; @@ -48,7 +48,7 @@ ResultVal<Handle> HandleTable::Create(SharedPtr<Object> obj) { ResultVal<Handle> HandleTable::Duplicate(Handle handle) { SharedPtr<Object> object = GetGeneric(handle); if (object == nullptr) { - NGLOG_ERROR(Kernel, "Tried to duplicate invalid handle: {:08X}", handle); + LOG_ERROR(Kernel, "Tried to duplicate invalid handle: {:08X}", handle); return ERR_INVALID_HANDLE; } return Create(std::move(object)); diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index 01904467e..609cdbff2 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp @@ -120,7 +120,7 @@ void HLERequestContext::ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming) { std::make_shared<IPC::DomainMessageHeader>(rp.PopRaw<IPC::DomainMessageHeader>()); } else { if (Session()->IsDomain()) - NGLOG_WARNING(IPC, "Domain request has no DomainMessageHeader!"); + LOG_WARNING(IPC, "Domain request has no DomainMessageHeader!"); } } @@ -271,11 +271,16 @@ std::vector<u8> HLERequestContext::ReadBuffer(int buffer_index) const { } size_t HLERequestContext::WriteBuffer(const void* buffer, size_t size, int buffer_index) const { + if (size == 0) { + LOG_WARNING(Core, "skip empty buffer write"); + return 0; + } + const bool is_buffer_b{BufferDescriptorB().size() && BufferDescriptorB()[buffer_index].Size()}; const size_t buffer_size{GetWriteBufferSize(buffer_index)}; if (size > buffer_size) { - NGLOG_CRITICAL(Core, "size ({:016X}) is greater than buffer_size ({:016X})", size, - buffer_size); + LOG_CRITICAL(Core, "size ({:016X}) is greater than buffer_size ({:016X})", size, + buffer_size); size = buffer_size; // TODO(bunnei): This needs to be HW tested } diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index bc144f3de..65560226d 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -59,7 +59,7 @@ ResultCode Mutex::TryAcquire(VAddr address, Handle holding_thread_handle, Handle requesting_thread_handle) { // The mutex address must be 4-byte aligned if ((address % sizeof(u32)) != 0) { - return ResultCode(ErrorModule::Kernel, ErrCodes::MisalignedAddress); + return ResultCode(ErrorModule::Kernel, ErrCodes::InvalidAddress); } SharedPtr<Thread> holding_thread = g_handle_table.Get<Thread>(holding_thread_handle); @@ -97,7 +97,7 @@ ResultCode Mutex::TryAcquire(VAddr address, Handle holding_thread_handle, ResultCode Mutex::Release(VAddr address) { // The mutex address must be 4-byte aligned if ((address % sizeof(u32)) != 0) { - return ResultCode(ErrorModule::Kernel, ErrCodes::MisalignedAddress); + return ResultCode(ErrorModule::Kernel, ErrCodes::InvalidAddress); } auto [thread, num_waiters] = GetHighestPriorityMutexWaitingThread(GetCurrentThread(), address); diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index 651d932d3..0c0506085 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp @@ -54,7 +54,7 @@ void Process::ParseKernelCaps(const u32* kernel_caps, size_t len) { continue; } else if ((type & 0xF00) == 0xE00) { // 0x0FFF // Allowed interrupts list - NGLOG_WARNING(Loader, "ExHeader allowed interrupts list ignored"); + LOG_WARNING(Loader, "ExHeader allowed interrupts list ignored"); } else if ((type & 0xF80) == 0xF00) { // 0x07FF // Allowed syscalls mask unsigned int index = ((descriptor >> 24) & 7) * 24; @@ -74,7 +74,7 @@ void Process::ParseKernelCaps(const u32* kernel_caps, size_t len) { } else if ((type & 0xFFE) == 0xFF8) { // 0x001F // Mapped memory range if (i + 1 >= len || ((kernel_caps[i + 1] >> 20) & 0xFFE) != 0xFF8) { - NGLOG_WARNING(Loader, "Incomplete exheader memory range descriptor ignored."); + LOG_WARNING(Loader, "Incomplete exheader memory range descriptor ignored."); continue; } u32 end_desc = kernel_caps[i + 1]; @@ -109,9 +109,9 @@ void Process::ParseKernelCaps(const u32* kernel_caps, size_t len) { int minor = kernel_version & 0xFF; int major = (kernel_version >> 8) & 0xFF; - NGLOG_INFO(Loader, "ExHeader kernel version: {}.{}", major, minor); + LOG_INFO(Loader, "ExHeader kernel version: {}.{}", major, minor); } else { - NGLOG_ERROR(Loader, "Unhandled kernel caps descriptor: 0x{:08X}", descriptor); + LOG_ERROR(Loader, "Unhandled kernel caps descriptor: 0x{:08X}", descriptor); } } } diff --git a/src/core/hle/kernel/resource_limit.cpp b/src/core/hle/kernel/resource_limit.cpp index 0ef5fc57d..17a3e8a74 100644 --- a/src/core/hle/kernel/resource_limit.cpp +++ b/src/core/hle/kernel/resource_limit.cpp @@ -29,7 +29,7 @@ SharedPtr<ResourceLimit> ResourceLimit::GetForCategory(ResourceLimitCategory cat case ResourceLimitCategory::OTHER: return resource_limits[static_cast<u8>(category)]; default: - NGLOG_CRITICAL(Kernel, "Unknown resource limit category"); + LOG_CRITICAL(Kernel, "Unknown resource limit category"); UNREACHABLE(); } } @@ -55,7 +55,7 @@ s32 ResourceLimit::GetCurrentResourceValue(ResourceType resource) const { case ResourceType::CPUTime: return current_cpu_time; default: - NGLOG_ERROR(Kernel, "Unknown resource type={:08X}", static_cast<u32>(resource)); + LOG_ERROR(Kernel, "Unknown resource type={:08X}", static_cast<u32>(resource)); UNIMPLEMENTED(); return 0; } @@ -84,7 +84,7 @@ u32 ResourceLimit::GetMaxResourceValue(ResourceType resource) const { case ResourceType::CPUTime: return max_cpu_time; default: - NGLOG_ERROR(Kernel, "Unknown resource type={:08X}", static_cast<u32>(resource)); + LOG_ERROR(Kernel, "Unknown resource type={:08X}", static_cast<u32>(resource)); UNIMPLEMENTED(); return 0; } diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp index 9cb9e0e5c..11c2cb69e 100644 --- a/src/core/hle/kernel/scheduler.cpp +++ b/src/core/hle/kernel/scheduler.cpp @@ -99,11 +99,11 @@ void Scheduler::Reschedule() { Thread* next = PopNextReadyThread(); if (cur && next) { - NGLOG_TRACE(Kernel, "context switch {} -> {}", cur->GetObjectId(), next->GetObjectId()); + LOG_TRACE(Kernel, "context switch {} -> {}", cur->GetObjectId(), next->GetObjectId()); } else if (cur) { - NGLOG_TRACE(Kernel, "context switch {} -> idle", cur->GetObjectId()); + LOG_TRACE(Kernel, "context switch {} -> idle", cur->GetObjectId()); } else if (next) { - NGLOG_TRACE(Kernel, "context switch idle -> {}", next->GetObjectId()); + LOG_TRACE(Kernel, "context switch idle -> {}", next->GetObjectId()); } SwitchContext(next); diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp index bf812c543..0d5cba1d9 100644 --- a/src/core/hle/kernel/server_session.cpp +++ b/src/core/hle/kernel/server_session.cpp @@ -71,7 +71,7 @@ ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& con return domain_request_handlers[object_id - 1]->HandleSyncRequest(context); case IPC::DomainMessageHeader::CommandType::CloseVirtualHandle: { - NGLOG_DEBUG(IPC, "CloseVirtualHandle, object_id=0x{:08X}", object_id); + LOG_DEBUG(IPC, "CloseVirtualHandle, object_id=0x{:08X}", object_id); domain_request_handlers[object_id - 1] = nullptr; @@ -81,8 +81,8 @@ ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& con } } - NGLOG_CRITICAL(IPC, "Unknown domain command={}", - static_cast<int>(domain_message_header->command.Value())); + LOG_CRITICAL(IPC, "Unknown domain command={}", + static_cast<int>(domain_message_header->command.Value())); ASSERT(false); } diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index ac4921298..93f7f2772 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp @@ -107,16 +107,16 @@ ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermi // Error out if the requested permissions don't match what the creator process allows. if (static_cast<u32>(permissions) & ~static_cast<u32>(own_other_permissions)) { - NGLOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match", - GetObjectId(), address, name); + LOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match", + GetObjectId(), address, name); return ERR_INVALID_COMBINATION; } // Error out if the provided permissions are not compatible with what the creator process needs. if (other_permissions != MemoryPermission::DontCare && static_cast<u32>(this->permissions) & ~static_cast<u32>(other_permissions)) { - NGLOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match", - GetObjectId(), address, name); + LOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match", + GetObjectId(), address, name); return ERR_WRONG_PERMISSION; } @@ -131,7 +131,7 @@ ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermi auto result = target_process->vm_manager.MapMemoryBlock( target_address, backing_block, backing_block_offset, size, MemoryState::Shared); if (result.Failed()) { - NGLOG_ERROR( + LOG_ERROR( Kernel, "cannot map id={}, target_address=0x{:X} name={}, error mapping to virtual memory", GetObjectId(), target_address, name); diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index ec3601e8b..5ad923fe7 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -11,6 +11,7 @@ #include "common/string_util.h" #include "core/core.h" #include "core/core_timing.h" +#include "core/hle/kernel/address_arbiter.h" #include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_session.h" #include "core/hle/kernel/event.h" @@ -31,7 +32,7 @@ namespace Kernel { /// Set the process heap to a given Size. It can both extend and shrink the heap. static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) { - NGLOG_TRACE(Kernel_SVC, "called, heap_size=0x{:X}", heap_size); + LOG_TRACE(Kernel_SVC, "called, heap_size=0x{:X}", heap_size); auto& process = *Core::CurrentProcess(); CASCADE_RESULT(*heap_addr, process.HeapAllocate(Memory::HEAP_VADDR, heap_size, VMAPermission::ReadWrite)); @@ -39,21 +40,21 @@ static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) { } static ResultCode SetMemoryAttribute(VAddr addr, u64 size, u32 state0, u32 state1) { - NGLOG_WARNING(Kernel_SVC, "(STUBBED) called, addr=0x{:X}", addr); + LOG_WARNING(Kernel_SVC, "(STUBBED) called, addr=0x{:X}", addr); return RESULT_SUCCESS; } /// Maps a memory range into a different range. static ResultCode MapMemory(VAddr dst_addr, VAddr src_addr, u64 size) { - NGLOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, - src_addr, size); + LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, + src_addr, size); return Core::CurrentProcess()->MirrorMemory(dst_addr, src_addr, size); } /// Unmaps a region that was previously mapped with svcMapMemory static ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size) { - NGLOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, - src_addr, size); + LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, + src_addr, size); return Core::CurrentProcess()->UnmapMemory(dst_addr, src_addr, size); } @@ -68,11 +69,11 @@ static ResultCode ConnectToNamedPort(Handle* out_handle, VAddr port_name_address if (port_name.size() > PortNameMaxLength) return ERR_PORT_NAME_TOO_LONG; - NGLOG_TRACE(Kernel_SVC, "called port_name={}", port_name); + LOG_TRACE(Kernel_SVC, "called port_name={}", port_name); auto it = Service::g_kernel_named_ports.find(port_name); if (it == Service::g_kernel_named_ports.end()) { - NGLOG_WARNING(Kernel_SVC, "tried to connect to unknown port: {}", port_name); + LOG_WARNING(Kernel_SVC, "tried to connect to unknown port: {}", port_name); return ERR_NOT_FOUND; } @@ -90,11 +91,11 @@ static ResultCode ConnectToNamedPort(Handle* out_handle, VAddr port_name_address static ResultCode SendSyncRequest(Handle handle) { SharedPtr<ClientSession> session = g_handle_table.Get<ClientSession>(handle); if (!session) { - NGLOG_ERROR(Kernel_SVC, "called with invalid handle=0x{:08X}", handle); + LOG_ERROR(Kernel_SVC, "called with invalid handle=0x{:08X}", handle); return ERR_INVALID_HANDLE; } - NGLOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName()); + LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName()); Core::System::GetInstance().PrepareReschedule(); @@ -105,7 +106,7 @@ static ResultCode SendSyncRequest(Handle handle) { /// Get the ID for the specified thread. static ResultCode GetThreadId(u32* thread_id, Handle thread_handle) { - NGLOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle); + LOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle); const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); if (!thread) { @@ -118,7 +119,7 @@ static ResultCode GetThreadId(u32* thread_id, Handle thread_handle) { /// Get the ID of the specified process static ResultCode GetProcessId(u32* process_id, Handle process_handle) { - NGLOG_TRACE(Kernel_SVC, "called process=0x{:08X}", process_handle); + LOG_TRACE(Kernel_SVC, "called process=0x{:08X}", process_handle); const SharedPtr<Process> process = g_handle_table.Get<Process>(process_handle); if (!process) { @@ -148,8 +149,8 @@ static bool DefaultThreadWakeupCallback(ThreadWakeupReason reason, SharedPtr<Thr /// Wait for the given handles to synchronize, timeout after the specified nanoseconds static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64 handle_count, s64 nano_seconds) { - NGLOG_TRACE(Kernel_SVC, "called handles_address=0x{:X}, handle_count={}, nano_seconds={}", - handles_address, handle_count, nano_seconds); + LOG_TRACE(Kernel_SVC, "called handles_address=0x{:X}, handle_count={}, nano_seconds={}", + handles_address, handle_count, nano_seconds); if (!Memory::IsValidVirtualAddress(handles_address)) return ERR_INVALID_POINTER; @@ -209,7 +210,7 @@ static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64 /// Resumes a thread waiting on WaitSynchronization static ResultCode CancelSynchronization(Handle thread_handle) { - NGLOG_TRACE(Kernel_SVC, "called thread=0x{:X}", thread_handle); + LOG_TRACE(Kernel_SVC, "called thread=0x{:X}", thread_handle); const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); if (!thread) { @@ -226,24 +227,24 @@ static ResultCode CancelSynchronization(Handle thread_handle) { /// Attempts to locks a mutex, creating it if it does not already exist static ResultCode ArbitrateLock(Handle holding_thread_handle, VAddr mutex_addr, Handle requesting_thread_handle) { - NGLOG_TRACE(Kernel_SVC, - "called holding_thread_handle=0x{:08X}, mutex_addr=0x{:X}, " - "requesting_current_thread_handle=0x{:08X}", - holding_thread_handle, mutex_addr, requesting_thread_handle); + LOG_TRACE(Kernel_SVC, + "called holding_thread_handle=0x{:08X}, mutex_addr=0x{:X}, " + "requesting_current_thread_handle=0x{:08X}", + holding_thread_handle, mutex_addr, requesting_thread_handle); return Mutex::TryAcquire(mutex_addr, holding_thread_handle, requesting_thread_handle); } /// Unlock a mutex static ResultCode ArbitrateUnlock(VAddr mutex_addr) { - NGLOG_TRACE(Kernel_SVC, "called mutex_addr=0x{:X}", mutex_addr); + LOG_TRACE(Kernel_SVC, "called mutex_addr=0x{:X}", mutex_addr); return Mutex::Release(mutex_addr); } /// Break program execution static void Break(u64 unk_0, u64 unk_1, u64 unk_2) { - NGLOG_CRITICAL(Debug_Emulated, "Emulated program broke execution!"); + LOG_CRITICAL(Debug_Emulated, "Emulated program broke execution!"); ASSERT(false); } @@ -251,13 +252,13 @@ static void Break(u64 unk_0, u64 unk_1, u64 unk_2) { static void OutputDebugString(VAddr address, s32 len) { std::string str(len, '\0'); Memory::ReadBlock(address, str.data(), str.size()); - NGLOG_DEBUG(Debug_Emulated, "{}", str); + LOG_DEBUG(Debug_Emulated, "{}", str); } /// Gets system/memory information for the current process static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id) { - NGLOG_TRACE(Kernel_SVC, "called info_id=0x{:X}, info_sub_id=0x{:X}, handle=0x{:08X}", info_id, - info_sub_id, handle); + LOG_TRACE(Kernel_SVC, "called info_id=0x{:X}, info_sub_id=0x{:X}, handle=0x{:08X}", info_id, + info_sub_id, handle); auto& vm_manager = Core::CurrentProcess()->vm_manager; @@ -308,12 +309,17 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id) *result = Core::CurrentProcess()->is_virtual_address_memory_enabled; break; case GetInfoType::TitleId: - NGLOG_WARNING(Kernel_SVC, "(STUBBED) Attempted to query titleid, returned 0"); + LOG_WARNING(Kernel_SVC, "(STUBBED) Attempted to query titleid, returned 0"); *result = 0; break; case GetInfoType::PrivilegedProcessId: - NGLOG_WARNING(Kernel_SVC, - "(STUBBED) Attempted to query privileged process id bounds, returned 0"); + LOG_WARNING(Kernel_SVC, + "(STUBBED) Attempted to query privileged process id bounds, returned 0"); + *result = 0; + break; + case GetInfoType::UserExceptionContextAddr: + LOG_WARNING(Kernel_SVC, + "(STUBBED) Attempted to query user exception context address, returned 0"); *result = 0; break; default: @@ -325,14 +331,13 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id) /// Sets the thread activity static ResultCode SetThreadActivity(Handle handle, u32 unknown) { - NGLOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x{:08X}, unknown=0x{:08X}", handle, - unknown); + LOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x{:08X}, unknown=0x{:08X}", handle, unknown); return RESULT_SUCCESS; } /// Gets the thread context static ResultCode GetThreadContext(Handle handle, VAddr addr) { - NGLOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x{:08X}, addr=0x{:X}", handle, addr); + LOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x{:08X}, addr=0x{:X}", handle, addr); return RESULT_SUCCESS; } @@ -371,16 +376,15 @@ static ResultCode SetThreadPriority(Handle handle, u32 priority) { /// Get which CPU core is executing the current thread static u32 GetCurrentProcessorNumber() { - NGLOG_TRACE(Kernel_SVC, "called"); + LOG_TRACE(Kernel_SVC, "called"); return GetCurrentThread()->processor_id; } static ResultCode MapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 size, u32 permissions) { - NGLOG_TRACE( - Kernel_SVC, - "called, shared_memory_handle=0x{:X}, addr=0x{:X}, size=0x{:X}, permissions=0x{:08X}", - shared_memory_handle, addr, size, permissions); + LOG_TRACE(Kernel_SVC, + "called, shared_memory_handle=0x{:X}, addr=0x{:X}, size=0x{:X}, permissions=0x{:08X}", + shared_memory_handle, addr, size, permissions); SharedPtr<SharedMemory> shared_memory = g_handle_table.Get<SharedMemory>(shared_memory_handle); if (!shared_memory) { @@ -400,15 +404,15 @@ static ResultCode MapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 s return shared_memory->Map(Core::CurrentProcess().get(), addr, permissions_type, MemoryPermission::DontCare); default: - NGLOG_ERROR(Kernel_SVC, "unknown permissions=0x{:08X}", permissions); + LOG_ERROR(Kernel_SVC, "unknown permissions=0x{:08X}", permissions); } return RESULT_SUCCESS; } static ResultCode UnmapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 size) { - NGLOG_WARNING(Kernel_SVC, "called, shared_memory_handle=0x{:08X}, addr=0x{:X}, size=0x{:X}", - shared_memory_handle, addr, size); + LOG_WARNING(Kernel_SVC, "called, shared_memory_handle=0x{:08X}, addr=0x{:X}, size=0x{:X}", + shared_memory_handle, addr, size); SharedPtr<SharedMemory> shared_memory = g_handle_table.Get<SharedMemory>(shared_memory_handle); @@ -436,19 +440,19 @@ static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* /*page_i memory_info->type = static_cast<u32>(vma->second.meminfo_state); } - NGLOG_TRACE(Kernel_SVC, "called process=0x{:08X} addr={:X}", process_handle, addr); + LOG_TRACE(Kernel_SVC, "called process=0x{:08X} addr={:X}", process_handle, addr); return RESULT_SUCCESS; } /// Query memory static ResultCode QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, VAddr addr) { - NGLOG_TRACE(Kernel_SVC, "called, addr={:X}", addr); + LOG_TRACE(Kernel_SVC, "called, addr={:X}", addr); return QueryProcessMemory(memory_info, page_info, CurrentProcess, addr); } /// Exits the current process static void ExitProcess() { - NGLOG_INFO(Kernel_SVC, "Process {} exiting", Core::CurrentProcess()->process_id); + LOG_INFO(Kernel_SVC, "Process {} exiting", Core::CurrentProcess()->process_id); ASSERT_MSG(Core::CurrentProcess()->status == ProcessStatus::Running, "Process has already exited"); @@ -524,17 +528,17 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V Core::System::GetInstance().PrepareReschedule(); Core::System::GetInstance().CpuCore(thread->processor_id).PrepareReschedule(); - NGLOG_TRACE(Kernel_SVC, - "called entrypoint=0x{:08X} ({}), arg=0x{:08X}, stacktop=0x{:08X}, " - "threadpriority=0x{:08X}, processorid=0x{:08X} : created handle=0x{:08X}", - entry_point, name, arg, stack_top, priority, processor_id, *out_handle); + LOG_TRACE(Kernel_SVC, + "called entrypoint=0x{:08X} ({}), arg=0x{:08X}, stacktop=0x{:08X}, " + "threadpriority=0x{:08X}, processorid=0x{:08X} : created handle=0x{:08X}", + entry_point, name, arg, stack_top, priority, processor_id, *out_handle); return RESULT_SUCCESS; } /// Starts the thread for the provided handle static ResultCode StartThread(Handle thread_handle) { - NGLOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle); + LOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle); const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); if (!thread) { @@ -551,7 +555,7 @@ static ResultCode StartThread(Handle thread_handle) { /// Called when a thread exits static void ExitThread() { - NGLOG_TRACE(Kernel_SVC, "called, pc=0x{:08X}", Core::CurrentArmInterface().GetPC()); + LOG_TRACE(Kernel_SVC, "called, pc=0x{:08X}", Core::CurrentArmInterface().GetPC()); ExitCurrentThread(); Core::System::GetInstance().PrepareReschedule(); @@ -559,7 +563,7 @@ static void ExitThread() { /// Sleep the current thread static void SleepThread(s64 nanoseconds) { - NGLOG_TRACE(Kernel_SVC, "called nanoseconds={}", nanoseconds); + LOG_TRACE(Kernel_SVC, "called nanoseconds={}", nanoseconds); // Don't attempt to yield execution if there are no available threads to run, // this way we avoid a useless reschedule to the idle thread. @@ -575,10 +579,10 @@ static void SleepThread(s64 nanoseconds) { Core::System::GetInstance().PrepareReschedule(); } -/// Signal process wide key atomic +/// Wait process wide key atomic static ResultCode WaitProcessWideKeyAtomic(VAddr mutex_addr, VAddr condition_variable_addr, Handle thread_handle, s64 nano_seconds) { - NGLOG_TRACE( + LOG_TRACE( Kernel_SVC, "called mutex_addr={:X}, condition_variable_addr={:X}, thread_handle=0x{:08X}, timeout={}", mutex_addr, condition_variable_addr, thread_handle, nano_seconds); @@ -605,8 +609,8 @@ static ResultCode WaitProcessWideKeyAtomic(VAddr mutex_addr, VAddr condition_var /// Signal process wide key static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target) { - NGLOG_TRACE(Kernel_SVC, "called, condition_variable_addr=0x{:X}, target=0x{:08X}", - condition_variable_addr, target); + LOG_TRACE(Kernel_SVC, "called, condition_variable_addr=0x{:X}, target=0x{:08X}", + condition_variable_addr, target); auto RetrieveWaitingThreads = [](size_t core_index, std::vector<SharedPtr<Thread>>& waiting_threads, VAddr condvar_addr) { @@ -684,6 +688,57 @@ static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target return RESULT_SUCCESS; } +// Wait for an address (via Address Arbiter) +static ResultCode WaitForAddress(VAddr address, u32 type, s32 value, s64 timeout) { + LOG_WARNING(Kernel_SVC, "called, address=0x{:X}, type=0x{:X}, value=0x{:X}, timeout={}", + address, type, value, timeout); + // If the passed address is a kernel virtual address, return invalid memory state. + if (Memory::IsKernelVirtualAddress(address)) { + return ERR_INVALID_ADDRESS_STATE; + } + // If the address is not properly aligned to 4 bytes, return invalid address. + if (address % sizeof(u32) != 0) { + return ERR_INVALID_ADDRESS; + } + + switch (static_cast<AddressArbiter::ArbitrationType>(type)) { + case AddressArbiter::ArbitrationType::WaitIfLessThan: + return AddressArbiter::WaitForAddressIfLessThan(address, value, timeout, false); + case AddressArbiter::ArbitrationType::DecrementAndWaitIfLessThan: + return AddressArbiter::WaitForAddressIfLessThan(address, value, timeout, true); + case AddressArbiter::ArbitrationType::WaitIfEqual: + return AddressArbiter::WaitForAddressIfEqual(address, value, timeout); + default: + return ERR_INVALID_ENUM_VALUE; + } +} + +// Signals to an address (via Address Arbiter) +static ResultCode SignalToAddress(VAddr address, u32 type, s32 value, s32 num_to_wake) { + LOG_WARNING(Kernel_SVC, "called, address=0x{:X}, type=0x{:X}, value=0x{:X}, num_to_wake=0x{:X}", + address, type, value, num_to_wake); + // If the passed address is a kernel virtual address, return invalid memory state. + if (Memory::IsKernelVirtualAddress(address)) { + return ERR_INVALID_ADDRESS_STATE; + } + // If the address is not properly aligned to 4 bytes, return invalid address. + if (address % sizeof(u32) != 0) { + return ERR_INVALID_ADDRESS; + } + + switch (static_cast<AddressArbiter::SignalType>(type)) { + case AddressArbiter::SignalType::Signal: + return AddressArbiter::SignalToAddress(address, num_to_wake); + case AddressArbiter::SignalType::IncrementAndSignalIfEqual: + return AddressArbiter::IncrementAndSignalToAddressIfEqual(address, value, num_to_wake); + case AddressArbiter::SignalType::ModifyByWaitingCountAndSignalIfEqual: + return AddressArbiter::ModifyByWaitingCountAndSignalToAddressIfEqual(address, value, + num_to_wake); + default: + return ERR_INVALID_ENUM_VALUE; + } +} + /// This returns the total CPU ticks elapsed since the CPU was powered-on static u64 GetSystemTick() { const u64 result{CoreTiming::GetTicks()}; @@ -696,13 +751,13 @@ static u64 GetSystemTick() { /// Close a handle static ResultCode CloseHandle(Handle handle) { - NGLOG_TRACE(Kernel_SVC, "Closing handle 0x{:08X}", handle); + LOG_TRACE(Kernel_SVC, "Closing handle 0x{:08X}", handle); return g_handle_table.Close(handle); } /// Reset an event static ResultCode ResetSignal(Handle handle) { - NGLOG_WARNING(Kernel_SVC, "(STUBBED) called handle 0x{:08X}", handle); + LOG_WARNING(Kernel_SVC, "(STUBBED) called handle 0x{:08X}", handle); auto event = g_handle_table.Get<Event>(handle); ASSERT(event != nullptr); event->Clear(); @@ -711,14 +766,14 @@ static ResultCode ResetSignal(Handle handle) { /// Creates a TransferMemory object static ResultCode CreateTransferMemory(Handle* handle, VAddr addr, u64 size, u32 permissions) { - NGLOG_WARNING(Kernel_SVC, "(STUBBED) called addr=0x{:X}, size=0x{:X}, perms=0x{:08X}", addr, - size, permissions); + LOG_WARNING(Kernel_SVC, "(STUBBED) called addr=0x{:X}, size=0x{:X}, perms=0x{:08X}", addr, size, + permissions); *handle = 0; return RESULT_SUCCESS; } static ResultCode GetThreadCoreMask(Handle thread_handle, u32* core, u64* mask) { - NGLOG_TRACE(Kernel_SVC, "called, handle=0x{:08X}", thread_handle); + LOG_TRACE(Kernel_SVC, "called, handle=0x{:08X}", thread_handle); const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); if (!thread) { @@ -732,8 +787,8 @@ static ResultCode GetThreadCoreMask(Handle thread_handle, u32* core, u64* mask) } static ResultCode SetThreadCoreMask(Handle thread_handle, u32 core, u64 mask) { - NGLOG_DEBUG(Kernel_SVC, "called, handle=0x{:08X}, mask=0x{:16X}, core=0x{:X}", thread_handle, - mask, core); + LOG_DEBUG(Kernel_SVC, "called, handle=0x{:08X}, mask=0x{:16X}, core=0x{:X}", thread_handle, + mask, core); const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); if (!thread) { @@ -744,7 +799,7 @@ static ResultCode SetThreadCoreMask(Handle thread_handle, u32 core, u64 mask) { ASSERT(thread->owner_process->ideal_processor != THREADPROCESSORID_DEFAULT); // Set the target CPU to the one specified in the process' exheader. core = thread->owner_process->ideal_processor; - mask = 1 << core; + mask = 1ull << core; } if (mask == 0) { @@ -761,7 +816,7 @@ static ResultCode SetThreadCoreMask(Handle thread_handle, u32 core, u64 mask) { } // Error out if the input core isn't enabled in the input mask. - if (core < Core::NUM_CPU_CORES && (mask & (1 << core)) == 0) { + if (core < Core::NUM_CPU_CORES && (mask & (1ull << core)) == 0) { return ResultCode(ErrorModule::Kernel, ErrCodes::InvalidCombination); } @@ -772,8 +827,8 @@ static ResultCode SetThreadCoreMask(Handle thread_handle, u32 core, u64 mask) { static ResultCode CreateSharedMemory(Handle* handle, u64 size, u32 local_permissions, u32 remote_permissions) { - NGLOG_TRACE(Kernel_SVC, "called, size=0x{:X}, localPerms=0x{:08X}, remotePerms=0x{:08X}", size, - local_permissions, remote_permissions); + LOG_TRACE(Kernel_SVC, "called, size=0x{:X}, localPerms=0x{:08X}, remotePerms=0x{:08X}", size, + local_permissions, remote_permissions); auto sharedMemHandle = SharedMemory::Create(g_handle_table.Get<Process>(KernelHandle::CurrentProcess), size, static_cast<MemoryPermission>(local_permissions), @@ -784,7 +839,7 @@ static ResultCode CreateSharedMemory(Handle* handle, u64 size, u32 local_permiss } static ResultCode ClearEvent(Handle handle) { - NGLOG_TRACE(Kernel_SVC, "called, event=0x{:08X}", handle); + LOG_TRACE(Kernel_SVC, "called, event=0x{:08X}", handle); SharedPtr<Event> evt = g_handle_table.Get<Event>(handle); if (evt == nullptr) @@ -856,8 +911,8 @@ static const FunctionDef SVC_Table[] = { {0x31, nullptr, "GetResourceLimitCurrentValue"}, {0x32, SvcWrap<SetThreadActivity>, "SetThreadActivity"}, {0x33, SvcWrap<GetThreadContext>, "GetThreadContext"}, - {0x34, nullptr, "WaitForAddress"}, - {0x35, nullptr, "SignalToAddress"}, + {0x34, SvcWrap<WaitForAddress>, "WaitForAddress"}, + {0x35, SvcWrap<SignalToAddress>, "SignalToAddress"}, {0x36, nullptr, "Unknown"}, {0x37, nullptr, "Unknown"}, {0x38, nullptr, "Unknown"}, @@ -936,7 +991,7 @@ static const FunctionDef SVC_Table[] = { static const FunctionDef* GetSVCInfo(u32 func_num) { if (func_num >= std::size(SVC_Table)) { - NGLOG_ERROR(Kernel_SVC, "Unknown svc=0x{:02X}", func_num); + LOG_ERROR(Kernel_SVC, "Unknown svc=0x{:02X}", func_num); return nullptr; } return &SVC_Table[func_num]; @@ -955,10 +1010,10 @@ void CallSVC(u32 immediate) { if (info->func) { info->func(); } else { - NGLOG_CRITICAL(Kernel_SVC, "Unimplemented SVC function {}(..)", info->name); + LOG_CRITICAL(Kernel_SVC, "Unimplemented SVC function {}(..)", info->name); } } else { - NGLOG_CRITICAL(Kernel_SVC, "Unknown SVC function 0x{:X}", immediate); + LOG_CRITICAL(Kernel_SVC, "Unknown SVC function 0x{:X}", immediate); } } diff --git a/src/core/hle/kernel/svc_wrap.h b/src/core/hle/kernel/svc_wrap.h index 40aa88cc1..79c3fe31b 100644 --- a/src/core/hle/kernel/svc_wrap.h +++ b/src/core/hle/kernel/svc_wrap.h @@ -179,6 +179,20 @@ void SvcWrap() { FuncReturn(retval); } +template <ResultCode func(u64, u32, s32, s64)> +void SvcWrap() { + FuncReturn( + func(PARAM(0), (u32)(PARAM(1) & 0xFFFFFFFF), (s32)(PARAM(2) & 0xFFFFFFFF), (s64)PARAM(3)) + .raw); +} + +template <ResultCode func(u64, u32, s32, s32)> +void SvcWrap() { + FuncReturn(func(PARAM(0), (u32)(PARAM(1) & 0xFFFFFFFF), (s32)(PARAM(2) & 0xFFFFFFFF), + (s32)(PARAM(3) & 0xFFFFFFFF)) + .raw); +} + //////////////////////////////////////////////////////////////////////////////////////////////////// // Function wrappers that return type u32 diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index cffa7ca83..9a9746585 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -104,7 +104,7 @@ static void ThreadWakeupCallback(u64 thread_handle, int cycles_late) { const auto proper_handle = static_cast<Handle>(thread_handle); SharedPtr<Thread> thread = wakeup_callback_handle_table.Get<Thread>(proper_handle); if (thread == nullptr) { - NGLOG_CRITICAL(Kernel, "Callback fired for invalid thread {:08X}", proper_handle); + LOG_CRITICAL(Kernel, "Callback fired for invalid thread {:08X}", proper_handle); return; } @@ -140,6 +140,11 @@ static void ThreadWakeupCallback(u64 thread_handle, int cycles_late) { } } + if (thread->arb_wait_address != 0) { + ASSERT(thread->status == THREADSTATUS_WAIT_ARB); + thread->arb_wait_address = 0; + } + if (resume) thread->ResumeFromWait(); } @@ -179,6 +184,7 @@ void Thread::ResumeFromWait() { case THREADSTATUS_WAIT_SLEEP: case THREADSTATUS_WAIT_IPC: case THREADSTATUS_WAIT_MUTEX: + case THREADSTATUS_WAIT_ARB: break; case THREADSTATUS_READY: @@ -284,19 +290,19 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point, SharedPtr<Process> owner_process) { // Check if priority is in ranged. Lowest priority -> highest priority id. if (priority > THREADPRIO_LOWEST) { - NGLOG_ERROR(Kernel_SVC, "Invalid thread priority: {}", priority); + LOG_ERROR(Kernel_SVC, "Invalid thread priority: {}", priority); return ERR_OUT_OF_RANGE; } if (processor_id > THREADPROCESSORID_MAX) { - NGLOG_ERROR(Kernel_SVC, "Invalid processor id: {}", processor_id); + LOG_ERROR(Kernel_SVC, "Invalid processor id: {}", processor_id); return ERR_OUT_OF_RANGE_KERNEL; } // TODO(yuriks): Other checks, returning 0xD9001BEA if (!Memory::IsValidVirtualAddress(*owner_process, entry_point)) { - NGLOG_ERROR(Kernel_SVC, "(name={}): invalid entry {:016X}", name, entry_point); + LOG_ERROR(Kernel_SVC, "(name={}): invalid entry {:016X}", name, entry_point); // TODO (bunnei): Find the correct error code to use here return ResultCode(-1); } @@ -337,8 +343,8 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point, auto& linheap_memory = memory_region->linear_heap_memory; if (linheap_memory->size() + Memory::PAGE_SIZE > memory_region->size) { - NGLOG_ERROR(Kernel_SVC, - "Not enough space in region to allocate a new TLS page for thread"); + LOG_ERROR(Kernel_SVC, + "Not enough space in region to allocate a new TLS page for thread"); return ERR_OUT_OF_MEMORY; } diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index 1d2da6d50..f1e759802 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h @@ -45,6 +45,7 @@ enum ThreadStatus { THREADSTATUS_WAIT_SYNCH_ANY, ///< Waiting due to WaitSynch1 or WaitSynchN with wait_all = false THREADSTATUS_WAIT_SYNCH_ALL, ///< Waiting due to WaitSynchronizationN with wait_all = true THREADSTATUS_WAIT_MUTEX, ///< Waiting due to an ArbitrateLock/WaitProcessWideKey svc + THREADSTATUS_WAIT_ARB, ///< Waiting due to a SignalToAddress/WaitForAddress svc THREADSTATUS_DORMANT, ///< Created but not yet made ready THREADSTATUS_DEAD ///< Run to completion, or forcefully terminated }; @@ -230,6 +231,9 @@ public: VAddr mutex_wait_address; ///< If waiting on a Mutex, this is the mutex address Handle wait_handle; ///< The handle used to wait for the mutex. + // If waiting for an AddressArbiter, this is the address being waited on. + VAddr arb_wait_address{0}; + std::string name; /// Handle used by guest emulated application to access this thread diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp index 661356a97..0141125e4 100644 --- a/src/core/hle/kernel/timer.cpp +++ b/src/core/hle/kernel/timer.cpp @@ -78,7 +78,7 @@ void Timer::WakeupAllWaitingThreads() { } void Timer::Signal(int cycles_late) { - NGLOG_TRACE(Kernel, "Timer {} fired", GetObjectId()); + LOG_TRACE(Kernel, "Timer {} fired", GetObjectId()); signaled = true; @@ -98,7 +98,7 @@ static void TimerCallback(u64 timer_handle, int cycles_late) { timer_callback_handle_table.Get<Timer>(static_cast<Handle>(timer_handle)); if (timer == nullptr) { - NGLOG_CRITICAL(Kernel, "Callback fired for invalid timer {:016X}", timer_handle); + LOG_CRITICAL(Kernel, "Callback fired for invalid timer {:016X}", timer_handle); return; } diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp index 676e5b282..034dd490e 100644 --- a/src/core/hle/kernel/vm_manager.cpp +++ b/src/core/hle/kernel/vm_manager.cpp @@ -242,12 +242,12 @@ void VMManager::RefreshMemoryBlockMappings(const std::vector<u8>* block) { void VMManager::LogLayout() const { for (const auto& p : vma_map) { const VirtualMemoryArea& vma = p.second; - NGLOG_DEBUG(Kernel, "{:016X} - {:016X} size: {:016X} {}{}{} {}", vma.base, - vma.base + vma.size, vma.size, - (u8)vma.permissions & (u8)VMAPermission::Read ? 'R' : '-', - (u8)vma.permissions & (u8)VMAPermission::Write ? 'W' : '-', - (u8)vma.permissions & (u8)VMAPermission::Execute ? 'X' : '-', - GetMemoryStateName(vma.meminfo_state)); + LOG_DEBUG(Kernel, "{:016X} - {:016X} size: {:016X} {}{}{} {}", vma.base, + vma.base + vma.size, vma.size, + (u8)vma.permissions & (u8)VMAPermission::Read ? 'R' : '-', + (u8)vma.permissions & (u8)VMAPermission::Write ? 'W' : '-', + (u8)vma.permissions & (u8)VMAPermission::Execute ? 'X' : '-', + GetMemoryStateName(vma.meminfo_state)); } } @@ -392,22 +392,22 @@ void VMManager::UpdatePageTableForVMA(const VirtualMemoryArea& vma) { } u64 VMManager::GetTotalMemoryUsage() { - NGLOG_WARNING(Kernel, "(STUBBED) called"); + LOG_WARNING(Kernel, "(STUBBED) called"); return 0xF8000000; } u64 VMManager::GetTotalHeapUsage() { - NGLOG_WARNING(Kernel, "(STUBBED) called"); + LOG_WARNING(Kernel, "(STUBBED) called"); return 0x0; } VAddr VMManager::GetAddressSpaceBaseAddr() { - NGLOG_WARNING(Kernel, "(STUBBED) called"); + LOG_WARNING(Kernel, "(STUBBED) called"); return 0x8000000; } u64 VMManager::GetAddressSpaceSize() { - NGLOG_WARNING(Kernel, "(STUBBED) called"); + LOG_WARNING(Kernel, "(STUBBED) called"); return MAX_ADDRESS; } diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index f2fffa760..6bafb2dce 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -47,7 +47,7 @@ public: private: void GetBase(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_ACC, "(STUBBED) called"); + LOG_WARNING(Service_ACC, "(STUBBED) called"); ProfileBase profile_base{}; IPC::ResponseBuilder rb{ctx, 16}; rb.Push(RESULT_SUCCESS); @@ -72,14 +72,14 @@ public: private: void CheckAvailability(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_ACC, "(STUBBED) called"); + LOG_WARNING(Service_ACC, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push(true); // TODO: Check when this is supposed to return true and when not } void GetAccountId(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_ACC, "(STUBBED) called"); + LOG_WARNING(Service_ACC, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 4}; rb.Push(RESULT_SUCCESS); rb.Push<u64>(0x12345678ABCDEF); @@ -87,14 +87,14 @@ private: }; void Module::Interface::GetUserExistence(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_ACC, "(STUBBED) called"); + LOG_WARNING(Service_ACC, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push(true); // TODO: Check when this is supposed to return true and when not } void Module::Interface::ListAllUsers(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_ACC, "(STUBBED) called"); + LOG_WARNING(Service_ACC, "(STUBBED) called"); constexpr std::array<u128, 10> user_ids{DEFAULT_USER_ID}; ctx.WriteBuffer(user_ids.data(), user_ids.size()); IPC::ResponseBuilder rb{ctx, 2}; @@ -102,7 +102,7 @@ void Module::Interface::ListAllUsers(Kernel::HLERequestContext& ctx) { } void Module::Interface::ListOpenUsers(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_ACC, "(STUBBED) called"); + LOG_WARNING(Service_ACC, "(STUBBED) called"); constexpr std::array<u128, 10> user_ids{DEFAULT_USER_ID}; ctx.WriteBuffer(user_ids.data(), user_ids.size()); IPC::ResponseBuilder rb{ctx, 2}; @@ -113,11 +113,11 @@ void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IProfile>(); - NGLOG_DEBUG(Service_ACC, "called"); + LOG_DEBUG(Service_ACC, "called"); } void Module::Interface::InitializeApplicationInfo(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_ACC, "(STUBBED) called"); + LOG_WARNING(Service_ACC, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } @@ -126,11 +126,11 @@ void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestCo IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IManagerForApplication>(); - NGLOG_DEBUG(Service_ACC, "called"); + LOG_DEBUG(Service_ACC, "called"); } void Module::Interface::GetLastOpenedUser(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_ACC, "(STUBBED) called"); + LOG_WARNING(Service_ACC, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 6}; rb.Push(RESULT_SUCCESS); rb.PushRaw(DEFAULT_USER_ID); diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index b8d6b8d4d..a871b3eaa 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -30,14 +30,14 @@ IWindowController::IWindowController() : ServiceFramework("IWindowController") { } void IWindowController::GetAppletResourceUserId(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 4}; rb.Push(RESULT_SUCCESS); rb.Push<u64>(0); } void IWindowController::AcquireForegroundRights(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } @@ -56,20 +56,20 @@ IAudioController::IAudioController() : ServiceFramework("IAudioController") { } void IAudioController::SetExpectedMasterVolume(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } void IAudioController::GetMainAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push(volume); } void IAudioController::GetLibraryAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push(volume); @@ -174,14 +174,14 @@ void ISelfController::SetFocusHandlingMode(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } void ISelfController::SetRestartMessageEnabled(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } void ISelfController::SetPerformanceModeChangedNotification(Kernel::HLERequestContext& ctx) { @@ -192,14 +192,14 @@ void ISelfController::SetPerformanceModeChangedNotification(Kernel::HLERequestCo IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_AM, "(STUBBED) called flag={}", flag); + LOG_WARNING(Service_AM, "(STUBBED) called flag={}", flag); } void ISelfController::SetScreenShotPermission(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } void ISelfController::SetOperationModeChangedNotification(Kernel::HLERequestContext& ctx) { @@ -210,7 +210,7 @@ void ISelfController::SetOperationModeChangedNotification(Kernel::HLERequestCont IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_AM, "(STUBBED) called flag={}", flag); + LOG_WARNING(Service_AM, "(STUBBED) called flag={}", flag); } void ISelfController::SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& ctx) { @@ -223,21 +223,21 @@ void ISelfController::SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_AM, "(STUBBED) called enabled={}", enabled); + LOG_WARNING(Service_AM, "(STUBBED) called enabled={}", enabled); } void ISelfController::LockExit(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } void ISelfController::UnlockExit(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx) { @@ -247,7 +247,7 @@ void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& rb.Push(RESULT_SUCCESS); rb.PushCopyObjects(launchable_event); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } void ISelfController::CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx) { @@ -260,14 +260,14 @@ void ISelfController::CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx) rb.Push(RESULT_SUCCESS); rb.Push(layer_id); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } void ISelfController::SetHandlesRequestToDisplay(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } ICommonStateGetter::ICommonStateGetter() : ServiceFramework("ICommonStateGetter") { @@ -311,7 +311,7 @@ void ICommonStateGetter::GetEventHandle(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); rb.PushCopyObjects(event); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } void ICommonStateGetter::ReceiveMessage(Kernel::HLERequestContext& ctx) { @@ -319,7 +319,7 @@ void ICommonStateGetter::ReceiveMessage(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); rb.Push<u32>(15); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } void ICommonStateGetter::GetCurrentFocusState(Kernel::HLERequestContext& ctx) { @@ -327,7 +327,7 @@ void ICommonStateGetter::GetCurrentFocusState(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); rb.Push(static_cast<u8>(FocusState::InFocus)); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) { @@ -336,7 +336,7 @@ void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); rb.Push(static_cast<u8>(use_docked_mode ? OperationMode::Docked : OperationMode::Handheld)); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } void ICommonStateGetter::GetPerformanceMode(Kernel::HLERequestContext& ctx) { @@ -346,7 +346,7 @@ void ICommonStateGetter::GetPerformanceMode(Kernel::HLERequestContext& ctx) { rb.Push(static_cast<u32>(use_docked_mode ? APM::PerformanceMode::Docked : APM::PerformanceMode::Handheld)); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } class IStorageAccessor final : public ServiceFramework<IStorageAccessor> { @@ -370,7 +370,7 @@ private: rb.Push(RESULT_SUCCESS); rb.Push(static_cast<u64>(buffer.size())); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void Write(Kernel::HLERequestContext& ctx) { @@ -386,7 +386,7 @@ private: IPC::ResponseBuilder rb{rp.MakeBuilder(2, 0, 0)}; rb.Push(RESULT_SUCCESS); - NGLOG_DEBUG(Service_AM, "called, offset={}", offset); + LOG_DEBUG(Service_AM, "called, offset={}", offset); } void Read(Kernel::HLERequestContext& ctx) { @@ -402,7 +402,7 @@ private: IPC::ResponseBuilder rb{rp.MakeBuilder(2, 0, 0)}; rb.Push(RESULT_SUCCESS); - NGLOG_DEBUG(Service_AM, "called, offset={}", offset); + LOG_DEBUG(Service_AM, "called, offset={}", offset); } }; @@ -426,7 +426,7 @@ private: rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<AM::IStorageAccessor>(buffer); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } }; @@ -467,21 +467,21 @@ private: rb.Push(RESULT_SUCCESS); rb.PushCopyObjects(state_changed_event); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } void GetResult(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } void Start(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } void PushInData(Kernel::HLERequestContext& ctx) { @@ -491,7 +491,7 @@ private: IPC::ResponseBuilder rb{rp.MakeBuilder(2, 0, 0)}; rb.Push(RESULT_SUCCESS); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void PopOutData(Kernel::HLERequestContext& ctx) { @@ -501,7 +501,7 @@ private: storage_stack.pop(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } std::stack<std::shared_ptr<AM::IStorage>> storage_stack; @@ -526,7 +526,7 @@ void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx) rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<AM::ILibraryAppletAccessor>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) { @@ -538,7 +538,7 @@ void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<AM::IStorage>(std::move(buffer)); - NGLOG_DEBUG(Service_AM, "called, size={}", size); + LOG_DEBUG(Service_AM, "called, size={}", size); } IApplicationFunctions::IApplicationFunctions() : ServiceFramework("IApplicationFunctions") { @@ -602,21 +602,21 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<AM::IStorage>(buffer); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void IApplicationFunctions::CreateApplicationAndRequestToStartForQuest( Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } void IApplicationFunctions::EnsureSaveData(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; u128 uid = rp.PopRaw<u128>(); - NGLOG_WARNING(Service, "(STUBBED) called uid = {:016X}{:016X}", uid[1], uid[0]); + LOG_WARNING(Service, "(STUBBED) called uid = {:016X}{:016X}", uid[1], uid[0]); IPC::ResponseBuilder rb{ctx, 4}; @@ -644,7 +644,7 @@ void IApplicationFunctions::SetTerminateResult(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_AM, "(STUBBED) called, result=0x{:08X}", result); + LOG_WARNING(Service_AM, "(STUBBED) called, result=0x{:08X}", result); } void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) { @@ -652,7 +652,7 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); rb.Push<u64>(1); rb.Push<u64>(0); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) { @@ -660,20 +660,20 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 4}; rb.Push(RESULT_SUCCESS); rb.Push(static_cast<u64>(Service::Set::LanguageCode::EN_US)); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void IApplicationFunctions::InitializeGamePlayRecording(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } void IApplicationFunctions::SetGamePlayRecordingState(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } void IApplicationFunctions::NotifyRunning(Kernel::HLERequestContext& ctx) { @@ -681,7 +681,7 @@ void IApplicationFunctions::NotifyRunning(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); rb.Push<u8>(0); // Unknown, seems to be ignored by official processes - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } void IApplicationFunctions::GetPseudoDeviceId(Kernel::HLERequestContext& ctx) { @@ -692,7 +692,7 @@ void IApplicationFunctions::GetPseudoDeviceId(Kernel::HLERequestContext& ctx) { rb.Push<u64>(0); rb.Push<u64>(0); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } void InstallInterfaces(SM::ServiceManager& service_manager, @@ -717,7 +717,7 @@ IHomeMenuFunctions::IHomeMenuFunctions() : ServiceFramework("IHomeMenuFunctions" void IHomeMenuFunctions::RequestToGetForeground(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_WARNING(Service_AM, "(STUBBED) called"); } IGlobalStateController::IGlobalStateController() : ServiceFramework("IGlobalStateController") { diff --git a/src/core/hle/service/am/applet_ae.cpp b/src/core/hle/service/am/applet_ae.cpp index 7ce551de3..180057ec2 100644 --- a/src/core/hle/service/am/applet_ae.cpp +++ b/src/core/hle/service/am/applet_ae.cpp @@ -33,63 +33,63 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<ICommonStateGetter>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetSelfController(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<ISelfController>(nvflinger); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetWindowController(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IWindowController>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetAudioController(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IAudioController>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetDisplayController(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IDisplayController>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetProcessWindingController(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IProcessWindingController>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetDebugFunctions(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IDebugFunctions>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<ILibraryAppletCreator>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetApplicationFunctions(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IApplicationFunctions>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } std::shared_ptr<NVFlinger::NVFlinger> nvflinger; @@ -120,70 +120,70 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<ICommonStateGetter>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetSelfController(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<ISelfController>(nvflinger); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetWindowController(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IWindowController>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetAudioController(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IAudioController>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetDisplayController(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IDisplayController>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetDebugFunctions(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IDebugFunctions>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<ILibraryAppletCreator>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetHomeMenuFunctions(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IHomeMenuFunctions>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetGlobalStateController(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IGlobalStateController>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetApplicationCreator(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IApplicationCreator>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } std::shared_ptr<NVFlinger::NVFlinger> nvflinger; }; @@ -192,21 +192,21 @@ void AppletAE::OpenSystemAppletProxy(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<ISystemAppletProxy>(nvflinger); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void AppletAE::OpenLibraryAppletProxy(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void AppletAE::OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } AppletAE::AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger) diff --git a/src/core/hle/service/am/applet_oe.cpp b/src/core/hle/service/am/applet_oe.cpp index 587a922fe..278259eda 100644 --- a/src/core/hle/service/am/applet_oe.cpp +++ b/src/core/hle/service/am/applet_oe.cpp @@ -33,56 +33,56 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IAudioController>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetDisplayController(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IDisplayController>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetDebugFunctions(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IDebugFunctions>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetWindowController(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IWindowController>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetSelfController(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<ISelfController>(nvflinger); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetCommonStateGetter(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<ICommonStateGetter>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<ILibraryAppletCreator>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } void GetApplicationFunctions(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IApplicationFunctions>(); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } std::shared_ptr<NVFlinger::NVFlinger> nvflinger; @@ -92,7 +92,7 @@ void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IApplicationProxy>(nvflinger); - NGLOG_DEBUG(Service_AM, "called"); + LOG_DEBUG(Service_AM, "called"); } AppletOE::AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger) diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp index 5b6dfb48f..6e7438580 100644 --- a/src/core/hle/service/aoc/aoc_u.cpp +++ b/src/core/hle/service/aoc/aoc_u.cpp @@ -27,14 +27,14 @@ void AOC_U::CountAddOnContent(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 4}; rb.Push(RESULT_SUCCESS); rb.Push<u64>(0); - NGLOG_WARNING(Service_AOC, "(STUBBED) called"); + LOG_WARNING(Service_AOC, "(STUBBED) called"); } void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 4}; rb.Push(RESULT_SUCCESS); rb.Push<u64>(0); - NGLOG_WARNING(Service_AOC, "(STUBBED) called"); + LOG_WARNING(Service_AOC, "(STUBBED) called"); } void InstallInterfaces(SM::ServiceManager& service_manager) { diff --git a/src/core/hle/service/apm/interface.cpp b/src/core/hle/service/apm/interface.cpp index 3a03188ce..751d73f8d 100644 --- a/src/core/hle/service/apm/interface.cpp +++ b/src/core/hle/service/apm/interface.cpp @@ -29,8 +29,8 @@ private: IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_APM, "(STUBBED) called mode={} config={}", static_cast<u32>(mode), - config); + LOG_WARNING(Service_APM, "(STUBBED) called mode={} config={}", static_cast<u32>(mode), + config); } void GetPerformanceConfiguration(Kernel::HLERequestContext& ctx) { @@ -42,7 +42,7 @@ private: rb.Push(RESULT_SUCCESS); rb.Push<u32>(0); // Performance configuration - NGLOG_WARNING(Service_APM, "(STUBBED) called mode={}", static_cast<u32>(mode)); + LOG_WARNING(Service_APM, "(STUBBED) called mode={}", static_cast<u32>(mode)); } }; diff --git a/src/core/hle/service/audio/audio.cpp b/src/core/hle/service/audio/audio.cpp index 92f910b5f..d231e91e1 100644 --- a/src/core/hle/service/audio/audio.cpp +++ b/src/core/hle/service/audio/audio.cpp @@ -8,6 +8,7 @@ #include "core/hle/service/audio/audrec_u.h" #include "core/hle/service/audio/audren_u.h" #include "core/hle/service/audio/codecctl.h" +#include "core/hle/service/audio/hwopus.h" namespace Service::Audio { @@ -17,6 +18,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager) { std::make_shared<AudRecU>()->InstallAsService(service_manager); std::make_shared<AudRenU>()->InstallAsService(service_manager); std::make_shared<CodecCtl>()->InstallAsService(service_manager); + std::make_shared<HwOpus>()->InstallAsService(service_manager); } } // namespace Service::Audio diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp index 402eaa306..1b4b649d8 100644 --- a/src/core/hle/service/audio/audout_u.cpp +++ b/src/core/hle/service/audio/audout_u.cpp @@ -60,14 +60,14 @@ public: private: void GetAudioOutState(Kernel::HLERequestContext& ctx) { - NGLOG_DEBUG(Service_Audio, "called"); + LOG_DEBUG(Service_Audio, "called"); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push(static_cast<u32>(audio_out_state)); } void StartAudioOut(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_Audio, "(STUBBED) called"); + LOG_WARNING(Service_Audio, "(STUBBED) called"); // Start audio audio_out_state = AudioState::Started; @@ -77,7 +77,7 @@ private: } void StopAudioOut(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_Audio, "(STUBBED) called"); + LOG_WARNING(Service_Audio, "(STUBBED) called"); // Stop audio audio_out_state = AudioState::Stopped; @@ -89,7 +89,7 @@ private: } void RegisterBufferEvent(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_Audio, "(STUBBED) called"); + LOG_WARNING(Service_Audio, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); @@ -97,7 +97,7 @@ private: } void AppendAudioOutBuffer(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_Audio, "(STUBBED) called"); + LOG_WARNING(Service_Audio, "(STUBBED) called"); IPC::RequestParser rp{ctx}; const u64 key{rp.Pop<u64>()}; @@ -108,7 +108,7 @@ private: } void GetReleasedAudioOutBuffer(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_Audio, "(STUBBED) called"); + LOG_WARNING(Service_Audio, "(STUBBED) called"); // TODO(st4rk): This is how libtransistor currently implements the // GetReleasedAudioOutBuffer, it should return the key (a VAddr) to the app and this address @@ -164,7 +164,7 @@ private: }; void AudOutU::ListAudioOuts(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_Audio, "(STUBBED) called"); + LOG_WARNING(Service_Audio, "(STUBBED) called"); IPC::RequestParser rp{ctx}; const std::string audio_interface = "AudioInterface"; @@ -180,7 +180,7 @@ void AudOutU::ListAudioOuts(Kernel::HLERequestContext& ctx) { } void AudOutU::OpenAudioOut(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_Audio, "(STUBBED) called"); + LOG_WARNING(Service_Audio, "(STUBBED) called"); if (!audio_out_interface) { audio_out_interface = std::make_shared<IAudioOut>(); diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index 6e8002bc9..2da936b27 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp @@ -17,7 +17,8 @@ constexpr u64 audio_ticks{static_cast<u64>(CoreTiming::BASE_CLOCK_RATE / 200)}; class IAudioRenderer final : public ServiceFramework<IAudioRenderer> { public: - IAudioRenderer() : ServiceFramework("IAudioRenderer") { + IAudioRenderer(AudioRendererParameter audren_params) + : ServiceFramework("IAudioRenderer"), worker_params(audren_params) { static const FunctionInfo functions[] = { {0, nullptr, "GetAudioRendererSampleRate"}, {1, nullptr, "GetAudioRendererSampleCount"}, @@ -46,6 +47,7 @@ public: // Start the audio event CoreTiming::ScheduleEvent(audio_ticks, audio_event); + voice_status_list.reserve(worker_params.voice_count); } ~IAudioRenderer() { CoreTiming::UnscheduleEvent(audio_event, 0); @@ -57,30 +59,63 @@ private: } void RequestUpdateAudioRenderer(Kernel::HLERequestContext& ctx) { - NGLOG_DEBUG(Service_Audio, "{}", ctx.Description()); - AudioRendererResponseData response_data{}; - - response_data.section_0_size = - static_cast<u32>(response_data.state_entries.size() * sizeof(AudioRendererStateEntry)); - response_data.section_1_size = static_cast<u32>(response_data.section_1.size()); - response_data.section_2_size = static_cast<u32>(response_data.section_2.size()); - response_data.section_3_size = static_cast<u32>(response_data.section_3.size()); - response_data.section_4_size = static_cast<u32>(response_data.section_4.size()); - response_data.section_5_size = static_cast<u32>(response_data.section_5.size()); - response_data.total_size = sizeof(AudioRendererResponseData); - - for (unsigned i = 0; i < response_data.state_entries.size(); i++) { - // 4 = Busy and 5 = Ready? - response_data.state_entries[i].state = 5; + UpdateDataHeader config{}; + auto buf = ctx.ReadBuffer(); + std::memcpy(&config, buf.data(), sizeof(UpdateDataHeader)); + u32 memory_pool_count = worker_params.effect_count + (worker_params.voice_count * 4); + + std::vector<MemoryPoolInfo> mem_pool_info(memory_pool_count); + std::memcpy(mem_pool_info.data(), + buf.data() + sizeof(UpdateDataHeader) + config.behavior_size, + memory_pool_count * sizeof(MemoryPoolInfo)); + + std::vector<VoiceInfo> voice_info(worker_params.voice_count); + std::memcpy(voice_info.data(), + buf.data() + sizeof(UpdateDataHeader) + config.behavior_size + + config.memory_pools_size + config.voice_resource_size, + worker_params.voice_count * sizeof(VoiceInfo)); + + UpdateDataHeader response_data{worker_params}; + + ASSERT(ctx.GetWriteBufferSize() == response_data.total_size); + + std::vector<u8> output(response_data.total_size); + std::memcpy(output.data(), &response_data, sizeof(UpdateDataHeader)); + std::vector<MemoryPoolEntry> memory_pool(memory_pool_count); + for (unsigned i = 0; i < memory_pool.size(); i++) { + if (mem_pool_info[i].pool_state == MemoryPoolStates::RequestAttach) + memory_pool[i].state = MemoryPoolStates::Attached; + else if (mem_pool_info[i].pool_state == MemoryPoolStates::RequestDetach) + memory_pool[i].state = MemoryPoolStates::Detached; + else + memory_pool[i].state = mem_pool_info[i].pool_state; } + std::memcpy(output.data() + sizeof(UpdateDataHeader), memory_pool.data(), + response_data.memory_pools_size); + + for (unsigned i = 0; i < voice_info.size(); i++) { + if (voice_info[i].is_new) { + voice_status_list[i].played_sample_count = 0; + voice_status_list[i].wave_buffer_consumed = 0; + } else if (voice_info[i].play_state == (u8)PlayStates::Started) { + for (u32 buff_idx = 0; buff_idx < voice_info[i].wave_buffer_count; buff_idx++) { + voice_status_list[i].played_sample_count += + (voice_info[i].wave_buffer[buff_idx].end_sample_offset - + voice_info[i].wave_buffer[buff_idx].start_sample_offset) / + 2; + voice_status_list[i].wave_buffer_consumed++; + } + } + } + std::memcpy(output.data() + sizeof(UpdateDataHeader) + response_data.memory_pools_size, + voice_status_list.data(), response_data.voices_size); - ctx.WriteBuffer(&response_data, response_data.total_size); + ctx.WriteBuffer(output); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_Audio, "(STUBBED) called"); + LOG_WARNING(Service_Audio, "(STUBBED) called"); } void StartAudioRenderer(Kernel::HLERequestContext& ctx) { @@ -88,7 +123,7 @@ private: rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_Audio, "(STUBBED) called"); + LOG_WARNING(Service_Audio, "(STUBBED) called"); } void StopAudioRenderer(Kernel::HLERequestContext& ctx) { @@ -96,7 +131,7 @@ private: rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_Audio, "(STUBBED) called"); + LOG_WARNING(Service_Audio, "(STUBBED) called"); } void QuerySystemEvent(Kernel::HLERequestContext& ctx) { @@ -106,51 +141,132 @@ private: rb.Push(RESULT_SUCCESS); rb.PushCopyObjects(system_event); - NGLOG_WARNING(Service_Audio, "(STUBBED) called"); + LOG_WARNING(Service_Audio, "(STUBBED) called"); } - struct AudioRendererStateEntry { - u32_le state; + enum class MemoryPoolStates : u32 { // Should be LE + Invalid = 0x0, + Unknown = 0x1, + RequestDetach = 0x2, + Detached = 0x3, + RequestAttach = 0x4, + Attached = 0x5, + Released = 0x6, + }; + + enum class PlayStates : u8 { + Started = 0, + Stopped = 1, + }; + + struct MemoryPoolEntry { + MemoryPoolStates state; u32_le unknown_4; u32_le unknown_8; u32_le unknown_c; }; - static_assert(sizeof(AudioRendererStateEntry) == 0x10, - "AudioRendererStateEntry has wrong size"); - - struct AudioRendererResponseData { - u32_le unknown_0; - u32_le section_5_size; - u32_le section_0_size; - u32_le section_1_size; - u32_le unknown_10; - u32_le section_2_size; - u32_le unknown_18; - u32_le section_3_size; - u32_le section_4_size; - u32_le unknown_24; - u32_le unknown_28; - u32_le unknown_2c; - u32_le unknown_30; - u32_le unknown_34; - u32_le unknown_38; + static_assert(sizeof(MemoryPoolEntry) == 0x10, "MemoryPoolEntry has wrong size"); + + struct MemoryPoolInfo { + u64_le pool_address; + u64_le pool_size; + MemoryPoolStates pool_state; + INSERT_PADDING_WORDS(3); // Unknown + }; + static_assert(sizeof(MemoryPoolInfo) == 0x20, "MemoryPoolInfo has wrong size"); + + struct UpdateDataHeader { + UpdateDataHeader() {} + + UpdateDataHeader(const AudioRendererParameter& config) { + revision = Common::MakeMagic('R', 'E', 'V', '4'); // 5.1.0 Revision + behavior_size = 0xb0; + memory_pools_size = (config.effect_count + (config.voice_count * 4)) * 0x10; + voices_size = config.voice_count * 0x10; + effects_size = config.effect_count * 0x10; + sinks_size = config.sink_count * 0x20; + performance_manager_size = 0x10; + total_size = sizeof(UpdateDataHeader) + behavior_size + memory_pools_size + + voices_size + effects_size + sinks_size + performance_manager_size; + } + + u32_le revision; + u32_le behavior_size; + u32_le memory_pools_size; + u32_le voices_size; + u32_le voice_resource_size; + u32_le effects_size; + u32_le mixes_size; + u32_le sinks_size; + u32_le performance_manager_size; + INSERT_PADDING_WORDS(6); u32_le total_size; + }; + static_assert(sizeof(UpdateDataHeader) == 0x40, "UpdateDataHeader has wrong size"); - std::array<AudioRendererStateEntry, 0x18e> state_entries; + struct BiquadFilter { + u8 enable; + INSERT_PADDING_BYTES(1); + s16_le numerator[3]; + s16_le denominator[2]; + }; + static_assert(sizeof(BiquadFilter) == 0xc, "BiquadFilter has wrong size"); + + struct WaveBuffer { + u64_le buffer_addr; + u64_le buffer_sz; + s32_le start_sample_offset; + s32_le end_sample_offset; + u8 loop; + u8 end_of_stream; + u8 sent_to_server; + INSERT_PADDING_BYTES(5); + u64 context_addr; + u64 context_sz; + INSERT_PADDING_BYTES(8); + }; + static_assert(sizeof(WaveBuffer) == 0x38, "WaveBuffer has wrong size"); + + struct VoiceInfo { + u32_le id; + u32_le node_id; + u8 is_new; + u8 is_in_use; + u8 play_state; + u8 sample_format; + u32_le sample_rate; + u32_le priority; + u32_le sorting_order; + u32_le channel_count; + float_le pitch; + float_le volume; + BiquadFilter biquad_filter[2]; + u32_le wave_buffer_count; + u16_le wave_buffer_head; + INSERT_PADDING_BYTES(6); + u64_le additional_params_addr; + u64_le additional_params_sz; + u32_le mix_id; + u32_le splitter_info_id; + WaveBuffer wave_buffer[4]; + u32_le voice_channel_resource_ids[6]; + INSERT_PADDING_BYTES(24); + }; + static_assert(sizeof(VoiceInfo) == 0x170, "VoiceInfo is wrong size"); - std::array<u8, 0x600> section_1; - std::array<u8, 0xe0> section_2; - std::array<u8, 0x20> section_3; - std::array<u8, 0x10> section_4; - std::array<u8, 0xb0> section_5; + struct VoiceOutStatus { + u64_le played_sample_count; + u32_le wave_buffer_consumed; + INSERT_PADDING_WORDS(1); }; - static_assert(sizeof(AudioRendererResponseData) == 0x20e0, - "AudioRendererResponseData has wrong size"); + static_assert(sizeof(VoiceOutStatus) == 0x10, "VoiceOutStatus has wrong size"); /// This is used to trigger the audio event callback. CoreTiming::EventType* audio_event; Kernel::SharedPtr<Kernel::Event> system_event; + AudioRendererParameter worker_params; + std::vector<VoiceOutStatus> voice_status_list; }; class IAudioDevice final : public ServiceFramework<IAudioDevice> { @@ -179,7 +295,7 @@ public: private: void ListAudioDeviceName(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_Audio, "(STUBBED) called"); + LOG_WARNING(Service_Audio, "(STUBBED) called"); IPC::RequestParser rp{ctx}; const std::string audio_interface = "AudioInterface"; @@ -191,7 +307,7 @@ private: } void SetAudioDeviceOutputVolume(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_Audio, "(STUBBED) called"); + LOG_WARNING(Service_Audio, "(STUBBED) called"); IPC::RequestParser rp{ctx}; f32 volume = static_cast<f32>(rp.Pop<u32>()); @@ -204,7 +320,7 @@ private: } void GetActiveAudioDeviceName(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_Audio, "(STUBBED) called"); + LOG_WARNING(Service_Audio, "(STUBBED) called"); IPC::RequestParser rp{ctx}; const std::string audio_interface = "AudioDevice"; @@ -216,7 +332,7 @@ private: } void QueryAudioDeviceSystemEvent(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_Audio, "(STUBBED) called"); + LOG_WARNING(Service_Audio, "(STUBBED) called"); buffer_event->Signal(); @@ -226,7 +342,7 @@ private: } void GetActiveChannelCount(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_Audio, "(STUBBED) called"); + LOG_WARNING(Service_Audio, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push<u32>(1); @@ -248,31 +364,33 @@ AudRenU::AudRenU() : ServiceFramework("audren:u") { } void AudRenU::OpenAudioRenderer(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + auto params = rp.PopRaw<AudioRendererParameter>(); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface<Audio::IAudioRenderer>(); + rb.PushIpcInterface<Audio::IAudioRenderer>(std::move(params)); - NGLOG_DEBUG(Service_Audio, "called"); + LOG_DEBUG(Service_Audio, "called"); } void AudRenU::GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - auto params = rp.PopRaw<WorkerBufferParameters>(); + auto params = rp.PopRaw<AudioRendererParameter>(); - u64 buffer_sz = Common::AlignUp(4 * params.unknown8, 0x40); - buffer_sz += params.unknownC * 1024; - buffer_sz += 0x940 * (params.unknownC + 1); + u64 buffer_sz = Common::AlignUp(4 * params.unknown_8, 0x40); + buffer_sz += params.unknown_c * 1024; + buffer_sz += 0x940 * (params.unknown_c + 1); buffer_sz += 0x3F0 * params.voice_count; - buffer_sz += Common::AlignUp(8 * (params.unknownC + 1), 0x10); + buffer_sz += Common::AlignUp(8 * (params.unknown_c + 1), 0x10); buffer_sz += Common::AlignUp(8 * params.voice_count, 0x10); buffer_sz += - Common::AlignUp((0x3C0 * (params.sink_count + params.unknownC) + 4 * params.sample_count) * - (params.unknown8 + 6), + Common::AlignUp((0x3C0 * (params.sink_count + params.unknown_c) + 4 * params.sample_count) * + (params.unknown_8 + 6), 0x40); - if (IsFeatureSupported(AudioFeatures::Splitter, params.magic)) { - u32 count = params.unknownC + 1; + if (IsFeatureSupported(AudioFeatures::Splitter, params.revision)) { + u32 count = params.unknown_c + 1; u64 node_count = Common::AlignUp(count, 0x40); u64 node_state_buffer_sz = 4 * (node_count * node_count) + 0xC * node_count + 2 * (node_count / 8); @@ -287,20 +405,20 @@ void AudRenU::GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx) { } buffer_sz += 0x20 * (params.effect_count + 4 * params.voice_count) + 0x50; - if (IsFeatureSupported(AudioFeatures::Splitter, params.magic)) { - buffer_sz += 0xE0 * params.unknown2c; + if (IsFeatureSupported(AudioFeatures::Splitter, params.revision)) { + buffer_sz += 0xE0 * params.unknown_2c; buffer_sz += 0x20 * params.splitter_count; - buffer_sz += Common::AlignUp(4 * params.unknown2c, 0x10); + buffer_sz += Common::AlignUp(4 * params.unknown_2c, 0x10); } buffer_sz = Common::AlignUp(buffer_sz, 0x40) + 0x170 * params.sink_count; u64 output_sz = buffer_sz + 0x280 * params.sink_count + 0x4B0 * params.effect_count + ((params.voice_count * 256) | 0x40); - if (params.unknown1c >= 1) { + if (params.unknown_1c >= 1) { output_sz = Common::AlignUp(((16 * params.sink_count + 16 * params.effect_count + 16 * params.voice_count + 16) + 0x658) * - (params.unknown1c + 1) + + (params.unknown_1c + 1) + 0xc0, 0x40) + output_sz; @@ -312,7 +430,7 @@ void AudRenU::GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); rb.Push<u64>(output_sz); - NGLOG_DEBUG(Service_Audio, "called, buffer_size=0x{:X}", output_sz); + LOG_DEBUG(Service_Audio, "called, buffer_size=0x{:X}", output_sz); } void AudRenU::GetAudioDevice(Kernel::HLERequestContext& ctx) { @@ -321,14 +439,14 @@ void AudRenU::GetAudioDevice(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<Audio::IAudioDevice>(); - NGLOG_DEBUG(Service_Audio, "called"); + LOG_DEBUG(Service_Audio, "called"); } bool AudRenU::IsFeatureSupported(AudioFeatures feature, u32_le revision) const { u32_be version_num = (revision - Common::MakeMagic('R', 'E', 'V', '0')); // Byte swap switch (feature) { case AudioFeatures::Splitter: - return version_num >= 2; + return version_num >= 2u; default: return false; } diff --git a/src/core/hle/service/audio/audren_u.h b/src/core/hle/service/audio/audren_u.h index fe53de4ce..b9b81db4f 100644 --- a/src/core/hle/service/audio/audren_u.h +++ b/src/core/hle/service/audio/audren_u.h @@ -12,6 +12,24 @@ class HLERequestContext; namespace Service::Audio { +struct AudioRendererParameter { + u32_le sample_rate; + u32_le sample_count; + u32_le unknown_8; + u32_le unknown_c; + u32_le voice_count; + u32_le sink_count; + u32_le effect_count; + u32_le unknown_1c; + u8 unknown_20; + INSERT_PADDING_BYTES(3); + u32_le splitter_count; + u32_le unknown_2c; + INSERT_PADDING_WORDS(1); + u32_le revision; +}; +static_assert(sizeof(AudioRendererParameter) == 52, "AudioRendererParameter is an invalid size"); + class AudRenU final : public ServiceFramework<AudRenU> { public: explicit AudRenU(); @@ -22,25 +40,6 @@ private: void GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx); void GetAudioDevice(Kernel::HLERequestContext& ctx); - struct WorkerBufferParameters { - u32_le sample_rate; - u32_le sample_count; - u32_le unknown8; - u32_le unknownC; - u32_le voice_count; - u32_le sink_count; - u32_le effect_count; - u32_le unknown1c; - u8 unknown20; - u8 padding1[3]; - u32_le splitter_count; - u32_le unknown2c; - u8 padding2[4]; - u32_le magic; - }; - static_assert(sizeof(WorkerBufferParameters) == 52, - "WorkerBufferParameters is an invalid size"); - enum class AudioFeatures : u32 { Splitter, }; diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp new file mode 100644 index 000000000..844df382c --- /dev/null +++ b/src/core/hle/service/audio/hwopus.cpp @@ -0,0 +1,29 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/logging/log.h" +#include "core/hle/ipc_helpers.h" +#include "core/hle/kernel/hle_ipc.h" +#include "core/hle/service/audio/hwopus.h" + +namespace Service::Audio { + +void HwOpus::GetWorkBufferSize(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_Audio, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(RESULT_SUCCESS); + rb.Push<u32>(0x4000); +} + +HwOpus::HwOpus() : ServiceFramework("hwopus") { + static const FunctionInfo functions[] = { + {0, nullptr, "Initialize"}, + {1, &HwOpus::GetWorkBufferSize, "GetWorkBufferSize"}, + {2, nullptr, "InitializeMultiStream"}, + {3, nullptr, "GetWorkBufferSizeMultiStream"}, + }; + RegisterHandlers(functions); +} + +} // namespace Service::Audio diff --git a/src/core/hle/service/audio/hwopus.h b/src/core/hle/service/audio/hwopus.h new file mode 100644 index 000000000..090b8c825 --- /dev/null +++ b/src/core/hle/service/audio/hwopus.h @@ -0,0 +1,20 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +namespace Service::Audio { + +class HwOpus final : public ServiceFramework<HwOpus> { +public: + explicit HwOpus(); + ~HwOpus() = default; + +private: + void GetWorkBufferSize(Kernel::HLERequestContext& ctx); +}; + +} // namespace Service::Audio diff --git a/src/core/hle/service/bcat/module.cpp b/src/core/hle/service/bcat/module.cpp index 52be9db22..35e024c3d 100644 --- a/src/core/hle/service/bcat/module.cpp +++ b/src/core/hle/service/bcat/module.cpp @@ -36,7 +36,7 @@ void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IBcatService>(); - NGLOG_DEBUG(Service_BCAT, "called"); + LOG_DEBUG(Service_BCAT, "called"); } Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) diff --git a/src/core/hle/service/fatal/fatal.cpp b/src/core/hle/service/fatal/fatal.cpp index 2d4282209..299b9474f 100644 --- a/src/core/hle/service/fatal/fatal.cpp +++ b/src/core/hle/service/fatal/fatal.cpp @@ -16,13 +16,13 @@ Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) void Module::Interface::ThrowFatalWithPolicy(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx); u32 error_code = rp.Pop<u32>(); - NGLOG_WARNING(Service_Fatal, "(STUBBED) called, error_code=0x{:X}", error_code); + LOG_WARNING(Service_Fatal, "(STUBBED) called, error_code=0x{:X}", error_code); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } void Module::Interface::ThrowFatalWithCpuContext(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_Fatal, "(STUBBED) called"); + LOG_WARNING(Service_Fatal, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index 68d1c90a5..f58b518b6 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp @@ -25,14 +25,14 @@ ResultCode RegisterFileSystem(std::unique_ptr<FileSys::FileSystemFactory>&& fact ASSERT_MSG(inserted, "Tried to register more than one system with same id code"); auto& filesystem = result.first->second; - NGLOG_DEBUG(Service_FS, "Registered file system {} with id code 0x{:08X}", - filesystem->GetName(), static_cast<u32>(type)); + LOG_DEBUG(Service_FS, "Registered file system {} with id code 0x{:08X}", filesystem->GetName(), + static_cast<u32>(type)); return RESULT_SUCCESS; } ResultVal<std::unique_ptr<FileSys::FileSystemBackend>> OpenFileSystem(Type type, FileSys::Path& path) { - NGLOG_TRACE(Service_FS, "Opening FileSystem with type={}", static_cast<u32>(type)); + LOG_TRACE(Service_FS, "Opening FileSystem with type={}", static_cast<u32>(type)); auto itr = filesystem_map.find(type); if (itr == filesystem_map.end()) { @@ -44,7 +44,7 @@ ResultVal<std::unique_ptr<FileSys::FileSystemBackend>> OpenFileSystem(Type type, } ResultCode FormatFileSystem(Type type) { - NGLOG_TRACE(Service_FS, "Formatting FileSystem with type={}", static_cast<u32>(type)); + LOG_TRACE(Service_FS, "Formatting FileSystem with type={}", static_cast<u32>(type)); auto itr = filesystem_map.find(type); if (itr == filesystem_map.end()) { diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index eb5748cf8..82efe7f7d 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp @@ -37,7 +37,7 @@ private: const s64 offset = rp.Pop<s64>(); const s64 length = rp.Pop<s64>(); - NGLOG_DEBUG(Service_FS, "called, offset=0x{:X}, length={}", offset, length); + LOG_DEBUG(Service_FS, "called, offset=0x{:X}, length={}", offset, length); // Error checking if (length < 0) { @@ -89,7 +89,7 @@ private: const s64 offset = rp.Pop<s64>(); const s64 length = rp.Pop<s64>(); - NGLOG_DEBUG(Service_FS, "called, offset=0x{:X}, length={}", offset, length); + LOG_DEBUG(Service_FS, "called, offset=0x{:X}, length={}", offset, length); // Error checking if (length < 0) { @@ -126,7 +126,7 @@ private: const s64 offset = rp.Pop<s64>(); const s64 length = rp.Pop<s64>(); - NGLOG_DEBUG(Service_FS, "called, offset=0x{:X}, length={}", offset, length); + LOG_DEBUG(Service_FS, "called, offset=0x{:X}, length={}", offset, length); // Error checking if (length < 0) { @@ -154,7 +154,7 @@ private: } void Flush(Kernel::HLERequestContext& ctx) { - NGLOG_DEBUG(Service_FS, "called"); + LOG_DEBUG(Service_FS, "called"); backend->Flush(); IPC::ResponseBuilder rb{ctx, 2}; @@ -165,7 +165,7 @@ private: IPC::RequestParser rp{ctx}; const u64 size = rp.Pop<u64>(); backend->SetSize(size); - NGLOG_DEBUG(Service_FS, "called, size={}", size); + LOG_DEBUG(Service_FS, "called, size={}", size); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); @@ -173,7 +173,7 @@ private: void GetSize(Kernel::HLERequestContext& ctx) { const u64 size = backend->GetSize(); - NGLOG_DEBUG(Service_FS, "called, size={}", size); + LOG_DEBUG(Service_FS, "called, size={}", size); IPC::ResponseBuilder rb{ctx, 4}; rb.Push(RESULT_SUCCESS); @@ -199,7 +199,7 @@ private: IPC::RequestParser rp{ctx}; const u64 unk = rp.Pop<u64>(); - NGLOG_DEBUG(Service_FS, "called, unk=0x{:X}", unk); + LOG_DEBUG(Service_FS, "called, unk=0x{:X}", unk); // Calculate how many entries we can fit in the output buffer u64 count_entries = ctx.GetWriteBufferSize() / sizeof(FileSys::Entry); @@ -221,7 +221,7 @@ private: } void GetEntryCount(Kernel::HLERequestContext& ctx) { - NGLOG_DEBUG(Service_FS, "called"); + LOG_DEBUG(Service_FS, "called"); u64 count = backend->GetEntryCount(); @@ -265,7 +265,7 @@ public: u64 mode = rp.Pop<u64>(); u32 size = rp.Pop<u32>(); - NGLOG_DEBUG(Service_FS, "called file {} mode 0x{:X} size 0x{:08X}", name, mode, size); + LOG_DEBUG(Service_FS, "called file {} mode 0x{:X} size 0x{:08X}", name, mode, size); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(backend->CreateFile(name, size)); @@ -277,7 +277,7 @@ public: auto file_buffer = ctx.ReadBuffer(); std::string name = Common::StringFromBuffer(file_buffer); - NGLOG_DEBUG(Service_FS, "called file {}", name); + LOG_DEBUG(Service_FS, "called file {}", name); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(backend->DeleteFile(name)); @@ -289,7 +289,7 @@ public: auto file_buffer = ctx.ReadBuffer(); std::string name = Common::StringFromBuffer(file_buffer); - NGLOG_DEBUG(Service_FS, "called directory {}", name); + LOG_DEBUG(Service_FS, "called directory {}", name); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(backend->CreateDirectory(name)); @@ -307,7 +307,7 @@ public: Memory::ReadBlock(ctx.BufferDescriptorX()[1].Address(), buffer.data(), buffer.size()); std::string dst_name = Common::StringFromBuffer(buffer); - NGLOG_DEBUG(Service_FS, "called file '{}' to file '{}'", src_name, dst_name); + LOG_DEBUG(Service_FS, "called file '{}' to file '{}'", src_name, dst_name); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(backend->RenameFile(src_name, dst_name)); @@ -321,7 +321,7 @@ public: auto mode = static_cast<FileSys::Mode>(rp.Pop<u32>()); - NGLOG_DEBUG(Service_FS, "called file {} mode {}", name, static_cast<u32>(mode)); + LOG_DEBUG(Service_FS, "called file {} mode {}", name, static_cast<u32>(mode)); auto result = backend->OpenFile(name, mode); if (result.Failed()) { @@ -346,7 +346,7 @@ public: // TODO(Subv): Implement this filter. u32 filter_flags = rp.Pop<u32>(); - NGLOG_DEBUG(Service_FS, "called directory {} filter {}", name, filter_flags); + LOG_DEBUG(Service_FS, "called directory {} filter {}", name, filter_flags); auto result = backend->OpenDirectory(name); if (result.Failed()) { @@ -368,7 +368,7 @@ public: auto file_buffer = ctx.ReadBuffer(); std::string name = Common::StringFromBuffer(file_buffer); - NGLOG_DEBUG(Service_FS, "called file {}", name); + LOG_DEBUG(Service_FS, "called file {}", name); auto result = backend->GetEntryType(name); if (result.Failed()) { @@ -383,7 +383,7 @@ public: } void Commit(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_FS, "(STUBBED) called"); + LOG_WARNING(Service_FS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); @@ -499,14 +499,14 @@ void FSP_SRV::TryLoadRomFS() { } void FSP_SRV::Initialize(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_FS, "(STUBBED) called"); + LOG_WARNING(Service_FS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } void FSP_SRV::MountSdCard(Kernel::HLERequestContext& ctx) { - NGLOG_DEBUG(Service_FS, "called"); + LOG_DEBUG(Service_FS, "called"); FileSys::Path unused; auto filesystem = OpenFileSystem(Type::SDMC, unused).Unwrap(); @@ -523,14 +523,14 @@ void FSP_SRV::CreateSaveData(Kernel::HLERequestContext& ctx) { auto save_create_struct = rp.PopRaw<std::array<u8, 0x40>>(); u128 uid = rp.PopRaw<u128>(); - NGLOG_WARNING(Service_FS, "(STUBBED) called uid = {:016X}{:016X}", uid[1], uid[0]); + LOG_WARNING(Service_FS, "(STUBBED) called uid = {:016X}{:016X}", uid[1], uid[0]); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } void FSP_SRV::MountSaveData(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_FS, "(STUBBED) called"); + LOG_WARNING(Service_FS, "(STUBBED) called"); // TODO(Subv): Read the input parameters and mount the requested savedata instead of always // mounting the current process' savedata. @@ -549,7 +549,7 @@ void FSP_SRV::MountSaveData(Kernel::HLERequestContext& ctx) { } void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_FS, "(STUBBED) called"); + LOG_WARNING(Service_FS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); @@ -557,12 +557,12 @@ void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) { } void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) { - NGLOG_DEBUG(Service_FS, "called"); + LOG_DEBUG(Service_FS, "called"); TryLoadRomFS(); if (!romfs) { // TODO (bunnei): Find the right error code to use here - NGLOG_CRITICAL(Service_FS, "no file system interface available!"); + LOG_CRITICAL(Service_FS, "no file system interface available!"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultCode(-1)); return; @@ -571,7 +571,7 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) { // Attempt to open a StorageBackend interface to the RomFS auto storage = romfs->OpenFile({}, {}); if (storage.Failed()) { - NGLOG_CRITICAL(Service_FS, "no storage interface available!"); + LOG_CRITICAL(Service_FS, "no storage interface available!"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(storage.Code()); return; @@ -583,7 +583,7 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) { } void FSP_SRV::OpenRomStorage(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_FS, "(STUBBED) called, using OpenDataStorageByCurrentProcess"); + LOG_WARNING(Service_FS, "(STUBBED) called, using OpenDataStorageByCurrentProcess"); OpenDataStorageByCurrentProcess(ctx); } diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index 94d9fbf25..c98a46e05 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp @@ -13,7 +13,7 @@ namespace Service::Friend { void Module::Interface::CreateFriendService(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_Friend, "(STUBBED) called"); + LOG_WARNING(Service_Friend, "(STUBBED) called"); } Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 00c5308ba..b0f4a384e 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -53,7 +53,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); rb.PushCopyObjects(shared_mem); - NGLOG_DEBUG(Service_HID, "called"); + LOG_DEBUG(Service_HID, "called"); } void LoadInputDevices() { @@ -75,7 +75,7 @@ private: // Set up controllers as neon red+blue Joy-Con attached to console ControllerHeader& controller_header = mem.controllers[Controller_Handheld].header; - controller_header.type = ControllerType_Handheld | ControllerType_JoyconPair; + controller_header.type = ControllerType_Handheld; controller_header.single_colors_descriptor = ColorDesc_ColorsNonexistent; controller_header.right_color_body = JOYCON_BODY_NEON_RED; controller_header.right_color_buttons = JOYCON_BUTTONS_NEON_RED; @@ -90,19 +90,22 @@ private: // HID shared memory stores the state of the past 17 samples in a circlular buffer, // each with a timestamp in number of samples since boot. + const ControllerInputEntry& last_entry = layout.entries[layout.header.latest_entry]; + layout.header.timestamp_ticks = CoreTiming::GetTicks(); layout.header.latest_entry = (layout.header.latest_entry + 1) % HID_NUM_ENTRIES; ControllerInputEntry& entry = layout.entries[layout.header.latest_entry]; - entry.connection_state = ConnectionState_Connected | ConnectionState_Wired; - entry.timestamp++; + entry.timestamp = last_entry.timestamp + 1; // TODO(shinyquagsire23): Is this always identical to timestamp? - entry.timestamp_2++; + entry.timestamp_2 = entry.timestamp; // TODO(shinyquagsire23): More than just handheld input if (controller != Controller_Handheld) continue; + entry.connection_state = ConnectionState_Connected | ConnectionState_Wired; + // TODO(shinyquagsire23): Set up some LUTs for each layout mapping in the future? // For now everything is just the default handheld layout, but split Joy-Con will // rotate the face buttons and directions for certain layouts. @@ -262,7 +265,7 @@ private: void ActivateVibrationDevice(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } }; @@ -394,144 +397,144 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IAppletResource>(applet_resource); - NGLOG_DEBUG(Service_HID, "called"); + LOG_DEBUG(Service_HID, "called"); } void ActivateDebugPad(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } void ActivateTouchScreen(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } void ActivateMouse(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } void ActivateKeyboard(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } void StartSixAxisSensor(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } void SetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } void SetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } void GetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push<u32>(0); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } void SetSupportedNpadIdType(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } void ActivateNpad(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } void AcquireNpadStyleSetUpdateEventHandle(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); rb.PushCopyObjects(event); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } void GetPlayerLedPattern(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } void SetNpadJoyHoldType(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } void GetNpadJoyHoldType(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push(joy_hold_type); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } void SetNpadJoyAssignmentModeSingleByDefault(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } void SendVibrationValue(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } void GetActualVibrationValue(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } void SetNpadJoyAssignmentModeDual(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } void SetNpadHandheldActivationMode(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } void GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 4}; rb.Push(RESULT_SUCCESS); rb.Push<u64>(0); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } void CreateActiveVibrationDeviceList(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IActiveVibrationDeviceList>(); - NGLOG_DEBUG(Service_HID, "called"); + LOG_DEBUG(Service_HID, "called"); } void SendVibrationValues(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_WARNING(Service_HID, "(STUBBED) called"); } }; diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index 15eee8f01..b499308d6 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h @@ -12,7 +12,7 @@ namespace Service::HID { // Begin enums and output structs constexpr u32 HID_NUM_ENTRIES = 17; -constexpr u32 HID_NUM_LAYOUTS = 2; +constexpr u32 HID_NUM_LAYOUTS = 7; constexpr s32 HID_JOYSTICK_MAX = 0x8000; constexpr s32 HID_JOYSTICK_MIN = -0x8000; diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp index 46194643e..e85a8bdb9 100644 --- a/src/core/hle/service/lm/lm.cpp +++ b/src/core/hle/service/lm/lm.cpp @@ -141,19 +141,19 @@ private: if (header.IsTailLog()) { switch (header.severity) { case MessageHeader::Severity::Trace: - NGLOG_TRACE(Debug_Emulated, "{}", log_stream.str()); + LOG_TRACE(Debug_Emulated, "{}", log_stream.str()); break; case MessageHeader::Severity::Info: - NGLOG_INFO(Debug_Emulated, "{}", log_stream.str()); + LOG_INFO(Debug_Emulated, "{}", log_stream.str()); break; case MessageHeader::Severity::Warning: - NGLOG_WARNING(Debug_Emulated, "{}", log_stream.str()); + LOG_WARNING(Debug_Emulated, "{}", log_stream.str()); break; case MessageHeader::Severity::Error: - NGLOG_ERROR(Debug_Emulated, "{}", log_stream.str()); + LOG_ERROR(Debug_Emulated, "{}", log_stream.str()); break; case MessageHeader::Severity::Critical: - NGLOG_CRITICAL(Debug_Emulated, "{}", log_stream.str()); + LOG_CRITICAL(Debug_Emulated, "{}", log_stream.str()); break; } } @@ -178,7 +178,7 @@ void LM::Initialize(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<Logger>(); - NGLOG_DEBUG(Service_LM, "called"); + LOG_DEBUG(Service_LM, "called"); } LM::LM() : ServiceFramework("lm") { diff --git a/src/core/hle/service/mm/mm_u.cpp b/src/core/hle/service/mm/mm_u.cpp index b3a85b818..08f45b78a 100644 --- a/src/core/hle/service/mm/mm_u.cpp +++ b/src/core/hle/service/mm/mm_u.cpp @@ -14,7 +14,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager) { } void MM_U::Initialize(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_MM, "(STUBBED) called"); + LOG_WARNING(Service_MM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } @@ -25,13 +25,13 @@ void MM_U::SetAndWait(Kernel::HLERequestContext& ctx) { max = rp.Pop<u32>(); current = min; - NGLOG_WARNING(Service_MM, "(STUBBED) called, min=0x{:X}, max=0x{:X}", min, max); + LOG_WARNING(Service_MM, "(STUBBED) called, min=0x{:X}, max=0x{:X}", min, max); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } void MM_U::Get(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_MM, "(STUBBED) called"); + LOG_WARNING(Service_MM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push(current); diff --git a/src/core/hle/service/nfp/nfp.cpp b/src/core/hle/service/nfp/nfp.cpp index 2a9f84037..56b05e9e8 100644 --- a/src/core/hle/service/nfp/nfp.cpp +++ b/src/core/hle/service/nfp/nfp.cpp @@ -64,7 +64,7 @@ private: }; void Initialize(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_NFP, "(STUBBED) called"); + LOG_WARNING(Service_NFP, "(STUBBED) called"); state = State::Initialized; @@ -78,7 +78,7 @@ private: ctx.WriteBuffer(&device_handle, sizeof(device_handle)); - NGLOG_WARNING(Service_NFP, "(STUBBED) called, array_size={}", array_size); + LOG_WARNING(Service_NFP, "(STUBBED) called, array_size={}", array_size); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); @@ -88,7 +88,7 @@ private: void AttachActivateEvent(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u64 dev_handle = rp.Pop<u64>(); - NGLOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle); + LOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle); IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); @@ -98,7 +98,7 @@ private: void AttachDeactivateEvent(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u64 dev_handle = rp.Pop<u64>(); - NGLOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle); + LOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle); IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); @@ -106,14 +106,14 @@ private: } void GetState(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_NFP, "(STUBBED) called"); + LOG_WARNING(Service_NFP, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push<u32>(static_cast<u32>(state)); } void GetDeviceState(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_NFP, "(STUBBED) called"); + LOG_WARNING(Service_NFP, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push<u32>(static_cast<u32>(device_state)); @@ -122,7 +122,7 @@ private: void GetNpadId(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u64 dev_handle = rp.Pop<u64>(); - NGLOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle); + LOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push<u32>(npad_id); @@ -131,7 +131,7 @@ private: void AttachAvailabilityChangeEvent(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u64 dev_handle = rp.Pop<u64>(); - NGLOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle); + LOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle); IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); @@ -148,7 +148,7 @@ private: }; void Module::Interface::CreateUserInterface(Kernel::HLERequestContext& ctx) { - NGLOG_DEBUG(Service_NFP, "called"); + LOG_DEBUG(Service_NFP, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IUser>(); diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index 62489c7fe..54a151c26 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp @@ -62,33 +62,33 @@ public: private: void GetRequestState(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_NIFM, "(STUBBED) called"); + LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push<u32>(0); } void GetResult(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_NIFM, "(STUBBED) called"); + LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } void GetSystemEventReadableHandles(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_NIFM, "(STUBBED) called"); + LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 2}; rb.Push(RESULT_SUCCESS); rb.PushCopyObjects(event1, event2); } void Cancel(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_NIFM, "(STUBBED) called"); + LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } void SetConnectionConfirmationOption(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_NIFM, "(STUBBED) called"); + LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } @@ -114,7 +114,7 @@ public: private: void GetClientId(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_NIFM, "(STUBBED) called"); + LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 4}; rb.Push(RESULT_SUCCESS); rb.Push<u64>(0); @@ -125,7 +125,7 @@ private: rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IScanRequest>(); - NGLOG_DEBUG(Service_NIFM, "called"); + LOG_DEBUG(Service_NIFM, "called"); } void CreateRequest(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -133,10 +133,10 @@ private: rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IRequest>(); - NGLOG_DEBUG(Service_NIFM, "called"); + LOG_DEBUG(Service_NIFM, "called"); } void RemoveNetworkProfile(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_NIFM, "(STUBBED) called"); + LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } @@ -146,7 +146,7 @@ private: rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<INetworkProfile>(); - NGLOG_DEBUG(Service_NIFM, "called"); + LOG_DEBUG(Service_NIFM, "called"); } }; @@ -196,14 +196,14 @@ void Module::Interface::CreateGeneralServiceOld(Kernel::HLERequestContext& ctx) IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IGeneralService>(); - NGLOG_DEBUG(Service_NIFM, "called"); + LOG_DEBUG(Service_NIFM, "called"); } void Module::Interface::CreateGeneralService(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IGeneralService>(); - NGLOG_DEBUG(Service_NIFM, "called"); + LOG_DEBUG(Service_NIFM, "called"); } Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) diff --git a/src/core/hle/service/ns/pl_u.cpp b/src/core/hle/service/ns/pl_u.cpp index 636af9a1e..d6a12ede5 100644 --- a/src/core/hle/service/ns/pl_u.cpp +++ b/src/core/hle/service/ns/pl_u.cpp @@ -52,7 +52,7 @@ PL_U::PL_U() : ServiceFramework("pl:u") { ASSERT(file.GetSize() == SHARED_FONT_MEM_SIZE); file.ReadBytes(shared_font->data(), shared_font->size()); } else { - NGLOG_WARNING(Service_NS, "Unable to load shared font: {}", filepath); + LOG_WARNING(Service_NS, "Unable to load shared font: {}", filepath); } } @@ -60,7 +60,7 @@ void PL_U::RequestLoad(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u32 shared_font_type{rp.Pop<u32>()}; - NGLOG_DEBUG(Service_NS, "called, shared_font_type={}", shared_font_type); + LOG_DEBUG(Service_NS, "called, shared_font_type={}", shared_font_type); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } @@ -69,7 +69,7 @@ void PL_U::GetLoadState(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u32 font_id{rp.Pop<u32>()}; - NGLOG_DEBUG(Service_NS, "called, font_id={}", font_id); + LOG_DEBUG(Service_NS, "called, font_id={}", font_id); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push<u32>(static_cast<u32>(LoadState::Done)); @@ -79,7 +79,7 @@ void PL_U::GetSize(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u32 font_id{rp.Pop<u32>()}; - NGLOG_DEBUG(Service_NS, "called, font_id={}", font_id); + LOG_DEBUG(Service_NS, "called, font_id={}", font_id); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push<u32>(SHARED_FONT_REGIONS[font_id].size); @@ -89,7 +89,7 @@ void PL_U::GetSharedMemoryAddressOffset(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u32 font_id{rp.Pop<u32>()}; - NGLOG_DEBUG(Service_NS, "called, font_id={}", font_id); + LOG_DEBUG(Service_NS, "called, font_id={}", font_id); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push<u32>(SHARED_FONT_REGIONS[font_id].offset); @@ -110,7 +110,7 @@ void PL_U::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) { Kernel::MemoryPermission::Read, SHARED_FONT_MEM_VADDR, Kernel::MemoryRegion::BASE, "PL_U:shared_font_mem"); - NGLOG_DEBUG(Service_NS, "called"); + LOG_DEBUG(Service_NS, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); rb.PushCopyObjects(shared_font_mem); @@ -119,7 +119,7 @@ void PL_U::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) { void PL_U::GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u64 language_code{rp.Pop<u64>()}; // TODO(ogniK): Find out what this is used for - NGLOG_DEBUG(Service_NS, "called, language_code=%lx", language_code); + LOG_DEBUG(Service_NS, "called, language_code=%lx", language_code); IPC::ResponseBuilder rb{ctx, 4}; std::vector<u32> font_codes; std::vector<u32> font_offsets; diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp index 103e66d0c..c39d5a164 100644 --- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp +++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp @@ -20,9 +20,9 @@ u32 nvdisp_disp0::ioctl(Ioctl command, const std::vector<u8>& input, std::vector void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, u32 stride, NVFlinger::BufferQueue::BufferTransformFlags transform) { VAddr addr = nvmap_dev->GetObjectAddress(buffer_handle); - NGLOG_WARNING(Service, - "Drawing from address {:X} offset {:08X} Width {} Height {} Stride {} Format {}", - addr, offset, width, height, stride, format); + LOG_WARNING(Service, + "Drawing from address {:X} offset {:08X} Width {} Height {} Stride {} Format {}", + addr, offset, width, height, stride, format); using PixelFormat = Tegra::FramebufferConfig::PixelFormat; const Tegra::FramebufferConfig framebuffer{ diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp index c1eea861d..57b128b40 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp @@ -8,12 +8,14 @@ #include "core/core.h" #include "core/hle/service/nvdrv/devices/nvhost_as_gpu.h" #include "core/hle/service/nvdrv/devices/nvmap.h" +#include "video_core/renderer_base.h" +#include "video_core/video_core.h" namespace Service::Nvidia::Devices { u32 nvhost_as_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { - NGLOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", - command.raw, input.size(), output.size()); + LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", + command.raw, input.size(), output.size()); switch (static_cast<IoctlCommand>(command.raw)) { case IoctlCommand::IocInitalizeExCommand: @@ -40,15 +42,15 @@ u32 nvhost_as_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vecto u32 nvhost_as_gpu::InitalizeEx(const std::vector<u8>& input, std::vector<u8>& output) { IoctlInitalizeEx params{}; std::memcpy(¶ms, input.data(), input.size()); - NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, big_page_size=0x{:X}", params.big_page_size); + LOG_WARNING(Service_NVDRV, "(STUBBED) called, big_page_size=0x{:X}", params.big_page_size); return 0; } u32 nvhost_as_gpu::AllocateSpace(const std::vector<u8>& input, std::vector<u8>& output) { IoctlAllocSpace params{}; std::memcpy(¶ms, input.data(), input.size()); - NGLOG_DEBUG(Service_NVDRV, "called, pages={:X}, page_size={:X}, flags={:X}", params.pages, - params.page_size, params.flags); + LOG_DEBUG(Service_NVDRV, "called, pages={:X}, page_size={:X}, flags={:X}", params.pages, + params.page_size, params.flags); auto& gpu = Core::System::GetInstance().GPU(); const u64 size{static_cast<u64>(params.pages) * static_cast<u64>(params.page_size)}; @@ -65,7 +67,7 @@ u32 nvhost_as_gpu::AllocateSpace(const std::vector<u8>& input, std::vector<u8>& u32 nvhost_as_gpu::Remap(const std::vector<u8>& input, std::vector<u8>& output) { size_t num_entries = input.size() / sizeof(IoctlRemapEntry); - NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, num_entries=0x{:X}", num_entries); + LOG_WARNING(Service_NVDRV, "(STUBBED) called, num_entries=0x{:X}", num_entries); std::vector<IoctlRemapEntry> entries(num_entries); std::memcpy(entries.data(), input.data(), input.size()); @@ -73,8 +75,8 @@ u32 nvhost_as_gpu::Remap(const std::vector<u8>& input, std::vector<u8>& output) auto& gpu = Core::System::GetInstance().GPU(); for (const auto& entry : entries) { - NGLOG_WARNING(Service_NVDRV, "remap entry, offset=0x{:X} handle=0x{:X} pages=0x{:X}", - entry.offset, entry.nvmap_handle, entry.pages); + LOG_WARNING(Service_NVDRV, "remap entry, offset=0x{:X} handle=0x{:X} pages=0x{:X}", + entry.offset, entry.nvmap_handle, entry.pages); Tegra::GPUVAddr offset = static_cast<Tegra::GPUVAddr>(entry.offset) << 0x10; auto object = nvmap_dev->GetObject(entry.nvmap_handle); @@ -96,11 +98,11 @@ u32 nvhost_as_gpu::MapBufferEx(const std::vector<u8>& input, std::vector<u8>& ou IoctlMapBufferEx params{}; std::memcpy(¶ms, input.data(), input.size()); - NGLOG_DEBUG(Service_NVDRV, - "called, flags={:X}, nvmap_handle={:X}, buffer_offset={}, mapping_size={}" - ", offset={}", - params.flags, params.nvmap_handle, params.buffer_offset, params.mapping_size, - params.offset); + LOG_DEBUG(Service_NVDRV, + "called, flags={:X}, nvmap_handle={:X}, buffer_offset={}, mapping_size={}" + ", offset={}", + params.flags, params.nvmap_handle, params.buffer_offset, params.mapping_size, + params.offset); if (!params.nvmap_handle) { return 0; @@ -146,7 +148,7 @@ u32 nvhost_as_gpu::UnmapBuffer(const std::vector<u8>& input, std::vector<u8>& ou IoctlUnmapBuffer params{}; std::memcpy(¶ms, input.data(), input.size()); - NGLOG_DEBUG(Service_NVDRV, "called, offset=0x{:X}", params.offset); + LOG_DEBUG(Service_NVDRV, "called, offset=0x{:X}", params.offset); auto& gpu = Core::System::GetInstance().GPU(); @@ -154,6 +156,9 @@ u32 nvhost_as_gpu::UnmapBuffer(const std::vector<u8>& input, std::vector<u8>& ou ASSERT_MSG(itr != buffer_mappings.end(), "Tried to unmap invalid mapping"); + // Remove this memory region from the rasterizer cache. + VideoCore::g_renderer->Rasterizer()->FlushAndInvalidateRegion(params.offset, itr->second.size); + params.offset = gpu.memory_manager->UnmapBuffer(params.offset, itr->second.size); buffer_mappings.erase(itr->second.offset); @@ -165,7 +170,7 @@ u32 nvhost_as_gpu::UnmapBuffer(const std::vector<u8>& input, std::vector<u8>& ou u32 nvhost_as_gpu::BindChannel(const std::vector<u8>& input, std::vector<u8>& output) { IoctlBindChannel params{}; std::memcpy(¶ms, input.data(), input.size()); - NGLOG_DEBUG(Service_NVDRV, "called, fd={:X}", params.fd); + LOG_DEBUG(Service_NVDRV, "called, fd={:X}", params.fd); channel = params.fd; return 0; } @@ -173,8 +178,8 @@ u32 nvhost_as_gpu::BindChannel(const std::vector<u8>& input, std::vector<u8>& ou u32 nvhost_as_gpu::GetVARegions(const std::vector<u8>& input, std::vector<u8>& output) { IoctlGetVaRegions params{}; std::memcpy(¶ms, input.data(), input.size()); - NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, buf_addr={:X}, buf_size={:X}", params.buf_addr, - params.buf_size); + LOG_WARNING(Service_NVDRV, "(STUBBED) called, buf_addr={:X}, buf_size={:X}", params.buf_addr, + params.buf_size); params.buf_size = 0x30; params.regions[0].offset = 0x04000000; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp index 7872d1e09..671b092e1 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp @@ -9,8 +9,8 @@ namespace Service::Nvidia::Devices { u32 nvhost_ctrl::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { - NGLOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", - command.raw, input.size(), output.size()); + LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", + command.raw, input.size(), output.size()); switch (static_cast<IoctlCommand>(command.raw)) { case IoctlCommand::IocGetConfigCommand: @@ -29,33 +29,18 @@ u32 nvhost_ctrl::ioctl(Ioctl command, const std::vector<u8>& input, std::vector< u32 nvhost_ctrl::NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output) { IocGetConfigParams params{}; std::memcpy(¶ms, input.data(), sizeof(params)); - NGLOG_DEBUG(Service_NVDRV, "called, setting={}!{}", params.domain_str.data(), - params.param_str.data()); - - if (!strcmp(params.domain_str.data(), "nv")) { - if (!strcmp(params.param_str.data(), "NV_MEMORY_PROFILER")) { - params.config_str[0] = '0'; - } else if (!strcmp(params.param_str.data(), "NVN_THROUGH_OPENGL")) { - params.config_str[0] = '0'; - } else if (!strcmp(params.param_str.data(), "NVRM_GPU_PREVENT_USE")) { - params.config_str[0] = '0'; - } else { - params.config_str[0] = '\0'; - } - } else { - UNIMPLEMENTED(); // unknown domain? Only nv has been seen so far on hardware - } - std::memcpy(output.data(), ¶ms, sizeof(params)); - return 0; + LOG_TRACE(Service_NVDRV, "called, setting={}!{}", params.domain_str.data(), + params.param_str.data()); + return 0x30006; // Returns error on production mode } u32 nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>& output, bool is_async) { IocCtrlEventWaitParams params{}; std::memcpy(¶ms, input.data(), sizeof(params)); - NGLOG_WARNING(Service_NVDRV, - "(STUBBED) called, syncpt_id={}, threshold={}, timeout={}, is_async={}", - params.syncpt_id, params.threshold, params.timeout, is_async); + LOG_WARNING(Service_NVDRV, + "(STUBBED) called, syncpt_id={}, threshold={}, timeout={}, is_async={}", + params.syncpt_id, params.threshold, params.timeout, is_async); // TODO(Subv): Implement actual syncpt waiting. params.value = 0; @@ -64,7 +49,7 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>& } u32 nvhost_ctrl::IocCtrlEventRegister(const std::vector<u8>& input, std::vector<u8>& output) { - NGLOG_WARNING(Service_NVDRV, "(STUBBED) called"); + LOG_WARNING(Service_NVDRV, "(STUBBED) called"); // TODO(bunnei): Implement this. return 0; } diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp index 0abc0de83..44e062f50 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp @@ -10,8 +10,8 @@ namespace Service::Nvidia::Devices { u32 nvhost_ctrl_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { - NGLOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", - command.raw, input.size(), output.size()); + LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", + command.raw, input.size(), output.size()); switch (static_cast<IoctlCommand>(command.raw)) { case IoctlCommand::IocGetCharacteristicsCommand: @@ -36,7 +36,7 @@ u32 nvhost_ctrl_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vec } u32 nvhost_ctrl_gpu::GetCharacteristics(const std::vector<u8>& input, std::vector<u8>& output) { - NGLOG_DEBUG(Service_NVDRV, "called"); + LOG_DEBUG(Service_NVDRV, "called"); IoctlCharacteristics params{}; std::memcpy(¶ms, input.data(), input.size()); params.gc.arch = 0x120; @@ -83,8 +83,8 @@ u32 nvhost_ctrl_gpu::GetCharacteristics(const std::vector<u8>& input, std::vecto u32 nvhost_ctrl_gpu::GetTPCMasks(const std::vector<u8>& input, std::vector<u8>& output) { IoctlGpuGetTpcMasksArgs params{}; std::memcpy(¶ms, input.data(), input.size()); - NGLOG_INFO(Service_NVDRV, "called, mask=0x{:X}, mask_buf_addr=0x{:X}", params.mask_buf_size, - params.mask_buf_addr); + LOG_INFO(Service_NVDRV, "called, mask=0x{:X}, mask_buf_addr=0x{:X}", params.mask_buf_size, + params.mask_buf_addr); // TODO(ogniK): Confirm value on hardware if (params.mask_buf_size) params.tpc_mask_size = 4 * 1; // 4 * num_gpc @@ -95,7 +95,7 @@ u32 nvhost_ctrl_gpu::GetTPCMasks(const std::vector<u8>& input, std::vector<u8>& } u32 nvhost_ctrl_gpu::GetActiveSlotMask(const std::vector<u8>& input, std::vector<u8>& output) { - NGLOG_DEBUG(Service_NVDRV, "called"); + LOG_DEBUG(Service_NVDRV, "called"); IoctlActiveSlotMask params{}; std::memcpy(¶ms, input.data(), input.size()); params.slot = 0x07; @@ -105,7 +105,7 @@ u32 nvhost_ctrl_gpu::GetActiveSlotMask(const std::vector<u8>& input, std::vector } u32 nvhost_ctrl_gpu::ZCullGetCtxSize(const std::vector<u8>& input, std::vector<u8>& output) { - NGLOG_DEBUG(Service_NVDRV, "called"); + LOG_DEBUG(Service_NVDRV, "called"); IoctlZcullGetCtxSize params{}; std::memcpy(¶ms, input.data(), input.size()); params.size = 0x1; @@ -114,7 +114,7 @@ u32 nvhost_ctrl_gpu::ZCullGetCtxSize(const std::vector<u8>& input, std::vector<u } u32 nvhost_ctrl_gpu::ZCullGetInfo(const std::vector<u8>& input, std::vector<u8>& output) { - NGLOG_DEBUG(Service_NVDRV, "called"); + LOG_DEBUG(Service_NVDRV, "called"); IoctlNvgpuGpuZcullGetInfoArgs params{}; std::memcpy(¶ms, input.data(), input.size()); params.width_align_pixels = 0x20; @@ -132,7 +132,7 @@ u32 nvhost_ctrl_gpu::ZCullGetInfo(const std::vector<u8>& input, std::vector<u8>& } u32 nvhost_ctrl_gpu::ZBCSetTable(const std::vector<u8>& input, std::vector<u8>& output) { - NGLOG_WARNING(Service_NVDRV, "(STUBBED) called"); + LOG_WARNING(Service_NVDRV, "(STUBBED) called"); IoctlZbcSetTable params{}; std::memcpy(¶ms, input.data(), input.size()); // TODO(ogniK): What does this even actually do? @@ -141,7 +141,7 @@ u32 nvhost_ctrl_gpu::ZBCSetTable(const std::vector<u8>& input, std::vector<u8>& } u32 nvhost_ctrl_gpu::ZBCQueryTable(const std::vector<u8>& input, std::vector<u8>& output) { - NGLOG_WARNING(Service_NVDRV, "(STUBBED) called"); + LOG_WARNING(Service_NVDRV, "(STUBBED) called"); IoctlZbcQueryTable params{}; std::memcpy(¶ms, input.data(), input.size()); // TODO : To implement properly @@ -150,7 +150,7 @@ u32 nvhost_ctrl_gpu::ZBCQueryTable(const std::vector<u8>& input, std::vector<u8> } u32 nvhost_ctrl_gpu::FlushL2(const std::vector<u8>& input, std::vector<u8>& output) { - NGLOG_WARNING(Service_NVDRV, "(STUBBED) called"); + LOG_WARNING(Service_NVDRV, "(STUBBED) called"); IoctlFlushL2 params{}; std::memcpy(¶ms, input.data(), input.size()); // TODO : To implement properly diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp index 79aab87f9..8de870596 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp @@ -12,8 +12,8 @@ namespace Service::Nvidia::Devices { u32 nvhost_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { - NGLOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", - command.raw, input.size(), output.size()); + LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", + command.raw, input.size(), output.size()); switch (static_cast<IoctlCommand>(command.raw)) { case IoctlCommand::IocSetNVMAPfdCommand: @@ -51,13 +51,13 @@ u32 nvhost_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u u32 nvhost_gpu::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) { IoctlSetNvmapFD params{}; std::memcpy(¶ms, input.data(), input.size()); - NGLOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd); + LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd); nvmap_fd = params.nvmap_fd; return 0; } u32 nvhost_gpu::SetClientData(const std::vector<u8>& input, std::vector<u8>& output) { - NGLOG_DEBUG(Service_NVDRV, "called"); + LOG_DEBUG(Service_NVDRV, "called"); IoctlClientData params{}; std::memcpy(¶ms, input.data(), input.size()); user_data = params.data; @@ -65,7 +65,7 @@ u32 nvhost_gpu::SetClientData(const std::vector<u8>& input, std::vector<u8>& out } u32 nvhost_gpu::GetClientData(const std::vector<u8>& input, std::vector<u8>& output) { - NGLOG_DEBUG(Service_NVDRV, "called"); + LOG_DEBUG(Service_NVDRV, "called"); IoctlClientData params{}; std::memcpy(¶ms, input.data(), input.size()); params.data = user_data; @@ -75,8 +75,8 @@ u32 nvhost_gpu::GetClientData(const std::vector<u8>& input, std::vector<u8>& out u32 nvhost_gpu::ZCullBind(const std::vector<u8>& input, std::vector<u8>& output) { std::memcpy(&zcull_params, input.data(), input.size()); - NGLOG_DEBUG(Service_NVDRV, "called, gpu_va={:X}, mode={:X}", zcull_params.gpu_va, - zcull_params.mode); + LOG_DEBUG(Service_NVDRV, "called, gpu_va={:X}, mode={:X}", zcull_params.gpu_va, + zcull_params.mode); std::memcpy(output.data(), &zcull_params, output.size()); return 0; } @@ -84,26 +84,26 @@ u32 nvhost_gpu::ZCullBind(const std::vector<u8>& input, std::vector<u8>& output) u32 nvhost_gpu::SetErrorNotifier(const std::vector<u8>& input, std::vector<u8>& output) { IoctlSetErrorNotifier params{}; std::memcpy(¶ms, input.data(), input.size()); - NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, offset={:X}, size={:X}, mem={:X}", - params.offset, params.size, params.mem); + LOG_WARNING(Service_NVDRV, "(STUBBED) called, offset={:X}, size={:X}, mem={:X}", params.offset, + params.size, params.mem); std::memcpy(output.data(), ¶ms, output.size()); return 0; } u32 nvhost_gpu::SetChannelPriority(const std::vector<u8>& input, std::vector<u8>& output) { std::memcpy(&channel_priority, input.data(), input.size()); - NGLOG_DEBUG(Service_NVDRV, "(STUBBED) called, priority={:X}", channel_priority); + LOG_DEBUG(Service_NVDRV, "(STUBBED) called, priority={:X}", channel_priority); return 0; } u32 nvhost_gpu::AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& output) { IoctlAllocGpfifoEx2 params{}; std::memcpy(¶ms, input.data(), input.size()); - NGLOG_WARNING(Service_NVDRV, - "(STUBBED) called, num_entries={:X}, flags={:X}, unk0={:X}, " - "unk1={:X}, unk2={:X}, unk3={:X}", - params.num_entries, params.flags, params.unk0, params.unk1, params.unk2, - params.unk3); + LOG_WARNING(Service_NVDRV, + "(STUBBED) called, num_entries={:X}, flags={:X}, unk0={:X}, " + "unk1={:X}, unk2={:X}, unk3={:X}", + params.num_entries, params.flags, params.unk0, params.unk1, params.unk2, + params.unk3); params.fence_out.id = 0; params.fence_out.value = 0; std::memcpy(output.data(), ¶ms, output.size()); @@ -113,20 +113,21 @@ u32 nvhost_gpu::AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& ou u32 nvhost_gpu::AllocateObjectContext(const std::vector<u8>& input, std::vector<u8>& output) { IoctlAllocObjCtx params{}; std::memcpy(¶ms, input.data(), input.size()); - NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, class_num={:X}, flags={:X}", params.class_num, - params.flags); + LOG_WARNING(Service_NVDRV, "(STUBBED) called, class_num={:X}, flags={:X}", params.class_num, + params.flags); params.obj_id = 0x0; std::memcpy(output.data(), ¶ms, output.size()); return 0; } u32 nvhost_gpu::SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& output) { - if (input.size() < sizeof(IoctlSubmitGpfifo)) + if (input.size() < sizeof(IoctlSubmitGpfifo)) { UNIMPLEMENTED(); + } IoctlSubmitGpfifo params{}; std::memcpy(¶ms, input.data(), sizeof(IoctlSubmitGpfifo)); - NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, gpfifo={:X}, num_entries={:X}, flags={:X}", - params.gpfifo, params.num_entries, params.flags); + LOG_WARNING(Service_NVDRV, "(STUBBED) called, gpfifo={:X}, num_entries={:X}, flags={:X}", + params.gpfifo, params.num_entries, params.flags); auto entries = std::vector<IoctlGpfifoEntry>(); entries.resize(params.num_entries); @@ -145,7 +146,7 @@ u32 nvhost_gpu::SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& outp u32 nvhost_gpu::GetWaitbase(const std::vector<u8>& input, std::vector<u8>& output) { IoctlGetWaitbase params{}; std::memcpy(¶ms, input.data(), sizeof(IoctlGetWaitbase)); - NGLOG_INFO(Service_NVDRV, "called, unknown=0x{:X}", params.unknown); + LOG_INFO(Service_NVDRV, "called, unknown=0x{:X}", params.unknown); params.value = 0; // Seems to be hard coded at 0 std::memcpy(output.data(), ¶ms, output.size()); return 0; @@ -154,7 +155,7 @@ u32 nvhost_gpu::GetWaitbase(const std::vector<u8>& input, std::vector<u8>& outpu u32 nvhost_gpu::ChannelSetTimeout(const std::vector<u8>& input, std::vector<u8>& output) { IoctlChannelSetTimeout params{}; std::memcpy(¶ms, input.data(), sizeof(IoctlChannelSetTimeout)); - NGLOG_INFO(Service_NVDRV, "called, timeout=0x{:X}", params.timeout); + LOG_INFO(Service_NVDRV, "called, timeout=0x{:X}", params.timeout); return 0; } diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp index 0b6c22898..b51c73ee8 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp @@ -9,8 +9,8 @@ namespace Service::Nvidia::Devices { u32 nvhost_nvdec::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { - NGLOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", - command.raw, input.size(), output.size()); + LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", + command.raw, input.size(), output.size()); switch (static_cast<IoctlCommand>(command.raw)) { case IoctlCommand::IocSetNVMAPfdCommand: @@ -24,7 +24,7 @@ u32 nvhost_nvdec::ioctl(Ioctl command, const std::vector<u8>& input, std::vector u32 nvhost_nvdec::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) { IoctlSetNvmapFD params{}; std::memcpy(¶ms, input.data(), input.size()); - NGLOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd); + LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd); nvmap_fd = params.nvmap_fd; return 0; } diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp index 23fe98190..724eeb139 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.cpp +++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp @@ -52,7 +52,7 @@ u32 nvmap::IocCreate(const std::vector<u8>& input, std::vector<u8>& output) { u32 handle = next_handle++; handles[handle] = std::move(object); - NGLOG_DEBUG(Service_NVDRV, "size=0x{:08X}", params.size); + LOG_DEBUG(Service_NVDRV, "size=0x{:08X}", params.size); params.handle = handle; @@ -73,7 +73,7 @@ u32 nvmap::IocAlloc(const std::vector<u8>& input, std::vector<u8>& output) { object->addr = params.addr; object->status = Object::Status::Allocated; - NGLOG_DEBUG(Service_NVDRV, "called, addr={:X}", params.addr); + LOG_DEBUG(Service_NVDRV, "called, addr={:X}", params.addr); std::memcpy(output.data(), ¶ms, sizeof(params)); return 0; @@ -83,7 +83,7 @@ u32 nvmap::IocGetId(const std::vector<u8>& input, std::vector<u8>& output) { IocGetIdParams params; std::memcpy(¶ms, input.data(), sizeof(params)); - NGLOG_WARNING(Service_NVDRV, "called"); + LOG_WARNING(Service_NVDRV, "called"); auto object = GetObject(params.handle); ASSERT(object); @@ -98,7 +98,7 @@ u32 nvmap::IocFromId(const std::vector<u8>& input, std::vector<u8>& output) { IocFromIdParams params; std::memcpy(¶ms, input.data(), sizeof(params)); - NGLOG_WARNING(Service_NVDRV, "(STUBBED) called"); + LOG_WARNING(Service_NVDRV, "(STUBBED) called"); auto itr = std::find_if(handles.begin(), handles.end(), [&](const auto& entry) { return entry.second->id == params.id; }); @@ -119,7 +119,7 @@ u32 nvmap::IocParam(const std::vector<u8>& input, std::vector<u8>& output) { IocParamParams params; std::memcpy(¶ms, input.data(), sizeof(params)); - NGLOG_WARNING(Service_NVDRV, "(STUBBED) called type={}", params.param); + LOG_WARNING(Service_NVDRV, "(STUBBED) called type={}", params.param); auto object = GetObject(params.handle); ASSERT(object); @@ -148,6 +148,7 @@ u32 nvmap::IocParam(const std::vector<u8>& input, std::vector<u8>& output) { } u32 nvmap::IocFree(const std::vector<u8>& input, std::vector<u8>& output) { + // TODO(Subv): These flags are unconfirmed. enum FreeFlags { Freed = 0, NotFreedYet = 1, @@ -156,20 +157,26 @@ u32 nvmap::IocFree(const std::vector<u8>& input, std::vector<u8>& output) { IocFreeParams params; std::memcpy(¶ms, input.data(), sizeof(params)); - NGLOG_WARNING(Service_NVDRV, "(STUBBED) called"); + LOG_WARNING(Service_NVDRV, "(STUBBED) called"); auto itr = handles.find(params.handle); ASSERT(itr != handles.end()); + ASSERT(itr->second->refcount > 0); + itr->second->refcount--; - params.refcount = itr->second->refcount; params.size = itr->second->size; - if (itr->second->refcount == 0) + if (itr->second->refcount == 0) { params.flags = Freed; - else + // The address of the nvmap is written to the output if we're finally freeing it, otherwise + // 0 is written. + params.address = itr->second->addr; + } else { params.flags = NotFreedYet; + params.address = 0; + } handles.erase(params.handle); diff --git a/src/core/hle/service/nvdrv/devices/nvmap.h b/src/core/hle/service/nvdrv/devices/nvmap.h index 39fafaa7c..f2eec6409 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.h +++ b/src/core/hle/service/nvdrv/devices/nvmap.h @@ -94,7 +94,7 @@ private: struct IocFreeParams { u32_le handle; INSERT_PADDING_BYTES(4); - u64_le refcount; + u64_le address; u32_le size; u32_le flags; }; diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp index 45d2862ef..b10efd5c9 100644 --- a/src/core/hle/service/nvdrv/interface.cpp +++ b/src/core/hle/service/nvdrv/interface.cpp @@ -12,7 +12,7 @@ namespace Service::Nvidia { void NVDRV::Open(Kernel::HLERequestContext& ctx) { - NGLOG_DEBUG(Service_NVDRV, "called"); + LOG_DEBUG(Service_NVDRV, "called"); const auto& buffer = ctx.ReadBuffer(); std::string device_name(buffer.begin(), buffer.end()); @@ -25,7 +25,7 @@ void NVDRV::Open(Kernel::HLERequestContext& ctx) { } void NVDRV::Ioctl(Kernel::HLERequestContext& ctx) { - NGLOG_DEBUG(Service_NVDRV, "called"); + LOG_DEBUG(Service_NVDRV, "called"); IPC::RequestParser rp{ctx}; u32 fd = rp.Pop<u32>(); @@ -41,7 +41,7 @@ void NVDRV::Ioctl(Kernel::HLERequestContext& ctx) { } void NVDRV::Close(Kernel::HLERequestContext& ctx) { - NGLOG_DEBUG(Service_NVDRV, "called"); + LOG_DEBUG(Service_NVDRV, "called"); IPC::RequestParser rp{ctx}; u32 fd = rp.Pop<u32>(); @@ -53,7 +53,7 @@ void NVDRV::Close(Kernel::HLERequestContext& ctx) { } void NVDRV::Initialize(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_NVDRV, "(STUBBED) called"); + LOG_WARNING(Service_NVDRV, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push<u32>(0); @@ -63,7 +63,7 @@ void NVDRV::QueryEvent(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; u32 fd = rp.Pop<u32>(); u32 event_id = rp.Pop<u32>(); - NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, fd={:X}, event_id={:X}", fd, event_id); + LOG_WARNING(Service_NVDRV, "(STUBBED) called, fd={:X}, event_id={:X}", fd, event_id); IPC::ResponseBuilder rb{ctx, 3, 1}; rb.Push(RESULT_SUCCESS); @@ -75,14 +75,14 @@ void NVDRV::SetClientPID(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; pid = rp.Pop<u64>(); - NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, pid=0x{:X}", pid); + LOG_WARNING(Service_NVDRV, "(STUBBED) called, pid=0x{:X}", pid); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push<u32>(0); } void NVDRV::FinishInitialize(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_NVDRV, "(STUBBED) called"); + LOG_WARNING(Service_NVDRV, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp index 49e88b394..f7f2fe1b2 100644 --- a/src/core/hle/service/nvflinger/buffer_queue.cpp +++ b/src/core/hle/service/nvflinger/buffer_queue.cpp @@ -23,7 +23,7 @@ void BufferQueue::SetPreallocatedBuffer(u32 slot, IGBPBuffer& igbp_buffer) { buffer.igbp_buffer = igbp_buffer; buffer.status = Buffer::Status::Free; - NGLOG_WARNING(Service, "Adding graphics buffer {}", slot); + LOG_WARNING(Service, "Adding graphics buffer {}", slot); queue.emplace_back(buffer); @@ -94,7 +94,7 @@ void BufferQueue::ReleaseBuffer(u32 slot) { } u32 BufferQueue::Query(QueryType type) { - NGLOG_WARNING(Service, "(STUBBED) called type={}", static_cast<u32>(type)); + LOG_WARNING(Service, "(STUBBED) called type={}", static_cast<u32>(type)); switch (type) { case QueryType::NativeWindowFormat: // TODO(Subv): Use an enum for this diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index 5c50ed601..ef3c2cc98 100644 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp @@ -48,7 +48,7 @@ NVFlinger::~NVFlinger() { } u64 NVFlinger::OpenDisplay(const std::string& name) { - NGLOG_WARNING(Service, "Opening display {}", name); + LOG_WARNING(Service, "Opening display {}", name); // TODO(Subv): Currently we only support the Default display. ASSERT(name == "Default"); diff --git a/src/core/hle/service/pctl/module.cpp b/src/core/hle/service/pctl/module.cpp index dd20d5ae7..fcf1f3da3 100644 --- a/src/core/hle/service/pctl/module.cpp +++ b/src/core/hle/service/pctl/module.cpp @@ -112,7 +112,7 @@ public: private: void Initialize(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_PCTL, "(STUBBED) called"); + LOG_WARNING(Service_PCTL, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 0}; rb.Push(RESULT_SUCCESS); } @@ -122,14 +122,14 @@ void Module::Interface::CreateService(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IParentalControlService>(); - NGLOG_DEBUG(Service_PCTL, "called"); + LOG_DEBUG(Service_PCTL, "called"); } void Module::Interface::CreateServiceWithoutInitialize(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IParentalControlService>(); - NGLOG_DEBUG(Service_PCTL, "called"); + LOG_DEBUG(Service_PCTL, "called"); } Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) diff --git a/src/core/hle/service/prepo/prepo.cpp b/src/core/hle/service/prepo/prepo.cpp index eaf30ee6b..3c43b8d8c 100644 --- a/src/core/hle/service/prepo/prepo.cpp +++ b/src/core/hle/service/prepo/prepo.cpp @@ -27,7 +27,7 @@ PlayReport::PlayReport(const char* name) : ServiceFramework(name) { void PlayReport::SaveReportWithUser(Kernel::HLERequestContext& ctx) { // TODO(ogniK): Do we want to add play report? - NGLOG_WARNING(Service_PREPO, "(STUBBED) called"); + LOG_WARNING(Service_PREPO, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index bdd9eb5a5..0d036bfaa 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -122,7 +122,7 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(Kernel::HLERequestContext } buf.push_back('}'); - NGLOG_ERROR(Service, "unknown / unimplemented {}", fmt::to_string(buf)); + LOG_ERROR(Service, "unknown / unimplemented {}", fmt::to_string(buf)); UNIMPLEMENTED(); } @@ -133,7 +133,7 @@ void ServiceFrameworkBase::InvokeRequest(Kernel::HLERequestContext& ctx) { return ReportUnimplementedFunction(ctx, info); } - NGLOG_TRACE( + LOG_TRACE( Service, "{}", MakeFunctionString(info->name, GetServiceName().c_str(), ctx.CommandBuffer()).c_str()); handler_invoker(this, info->handler_callback, ctx); @@ -206,12 +206,12 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm) { VI::InstallInterfaces(*sm, nv_flinger); Set::InstallInterfaces(*sm); - NGLOG_DEBUG(Service, "initialized OK"); + LOG_DEBUG(Service, "initialized OK"); } /// Shutdown ServiceManager void Shutdown() { g_kernel_named_ports.clear(); - NGLOG_DEBUG(Service, "shutdown OK"); + LOG_DEBUG(Service, "shutdown OK"); } } // namespace Service diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp index f0572bed6..bd295cdf6 100644 --- a/src/core/hle/service/set/set.cpp +++ b/src/core/hle/service/set/set.cpp @@ -12,9 +12,6 @@ namespace Service::Set { void SET::GetAvailableLanguageCodes(Kernel::HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - u32 id = rp.Pop<u32>(); - static constexpr std::array<LanguageCode, 17> available_language_codes = {{ LanguageCode::JA, LanguageCode::EN_US, @@ -40,7 +37,7 @@ void SET::GetAvailableLanguageCodes(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); rb.Push(static_cast<u64>(available_language_codes.size())); - NGLOG_DEBUG(Service_SET, "called"); + LOG_DEBUG(Service_SET, "called"); } SET::SET() : ServiceFramework("set") { @@ -50,7 +47,7 @@ SET::SET() : ServiceFramework("set") { {2, nullptr, "MakeLanguageCode"}, {3, nullptr, "GetAvailableLanguageCodeCount"}, {4, nullptr, "GetRegionCode"}, - {5, nullptr, "GetAvailableLanguageCodes2"}, + {5, &SET::GetAvailableLanguageCodes, "GetAvailableLanguageCodes2"}, {6, nullptr, "GetAvailableLanguageCodeCount2"}, {7, nullptr, "GetKeyCodeMap"}, {8, nullptr, "GetQuestFlag"}, diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/set_sys.cpp index 762a664c5..fa85277fe 100644 --- a/src/core/hle/service/set/set_sys.cpp +++ b/src/core/hle/service/set/set_sys.cpp @@ -16,7 +16,7 @@ void SET_SYS::GetColorSetId(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); rb.Push<u32>(0); - NGLOG_WARNING(Service_SET, "(STUBBED) called"); + LOG_WARNING(Service_SET, "(STUBBED) called"); } SET_SYS::SET_SYS() : ServiceFramework("set:sys") { diff --git a/src/core/hle/service/sm/controller.cpp b/src/core/hle/service/sm/controller.cpp index fe5097cdc..518a0cc46 100644 --- a/src/core/hle/service/sm/controller.cpp +++ b/src/core/hle/service/sm/controller.cpp @@ -17,7 +17,7 @@ void Controller::ConvertSessionToDomain(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); rb.Push<u32>(1); // Converted sessions start with 1 request handler - NGLOG_DEBUG(Service, "called, server_session={}", ctx.Session()->GetObjectId()); + LOG_DEBUG(Service, "called, server_session={}", ctx.Session()->GetObjectId()); } void Controller::DuplicateSession(Kernel::HLERequestContext& ctx) { @@ -29,11 +29,11 @@ void Controller::DuplicateSession(Kernel::HLERequestContext& ctx) { Kernel::SharedPtr<Kernel::ClientSession> session{ctx.Session()->parent->client}; rb.PushMoveObjects(session); - NGLOG_DEBUG(Service, "called, session={}", session->GetObjectId()); + LOG_DEBUG(Service, "called, session={}", session->GetObjectId()); } void Controller::DuplicateSessionEx(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service, "(STUBBED) called, using DuplicateSession"); + LOG_WARNING(Service, "(STUBBED) called, using DuplicateSession"); DuplicateSession(ctx); } @@ -43,7 +43,7 @@ void Controller::QueryPointerBufferSize(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); rb.Push<u32>(0x500); - NGLOG_WARNING(Service, "(STUBBED) called"); + LOG_WARNING(Service, "(STUBBED) called"); } Controller::Controller() : ServiceFramework("IpcController") { diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp index bded8421f..f22a2a79f 100644 --- a/src/core/hle/service/sm/sm.cpp +++ b/src/core/hle/service/sm/sm.cpp @@ -86,7 +86,7 @@ SM::~SM() = default; void SM::Initialize(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_DEBUG(Service_SM, "called"); + LOG_DEBUG(Service_SM, "called"); } void SM::GetService(Kernel::HLERequestContext& ctx) { @@ -102,8 +102,7 @@ void SM::GetService(Kernel::HLERequestContext& ctx) { if (client_port.Failed()) { IPC::ResponseBuilder rb = rp.MakeBuilder(2, 0, 0); rb.Push(client_port.Code()); - NGLOG_ERROR(Service_SM, "called service={} -> error 0x{:08X}", name, - client_port.Code().raw); + LOG_ERROR(Service_SM, "called service={} -> error 0x{:08X}", name, client_port.Code().raw); if (name.length() == 0) return; // LibNX Fix UNIMPLEMENTED(); @@ -113,7 +112,7 @@ void SM::GetService(Kernel::HLERequestContext& ctx) { auto session = client_port.Unwrap()->Connect(); ASSERT(session.Succeeded()); if (session.Succeeded()) { - NGLOG_DEBUG(Service_SM, "called service={} -> session={}", name, (*session)->GetObjectId()); + LOG_DEBUG(Service_SM, "called service={} -> session={}", name, (*session)->GetObjectId()); IPC::ResponseBuilder rb = rp.MakeBuilder(2, 0, 1, IPC::ResponseBuilder::Flags::AlwaysMoveHandles); rb.Push(session.Code()); diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp index ab909fdaa..32648bdd9 100644 --- a/src/core/hle/service/sockets/bsd.cpp +++ b/src/core/hle/service/sockets/bsd.cpp @@ -8,7 +8,7 @@ namespace Service::Sockets { void BSD::RegisterClient(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service, "(STUBBED) called"); + LOG_WARNING(Service, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; @@ -17,7 +17,7 @@ void BSD::RegisterClient(Kernel::HLERequestContext& ctx) { } void BSD::StartMonitoring(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service, "(STUBBED) called"); + LOG_WARNING(Service, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; @@ -32,8 +32,7 @@ void BSD::Socket(Kernel::HLERequestContext& ctx) { u32 type = rp.Pop<u32>(); u32 protocol = rp.Pop<u32>(); - NGLOG_WARNING(Service, "(STUBBED) called domain={} type={} protocol={}", domain, type, - protocol); + LOG_WARNING(Service, "(STUBBED) called domain={} type={} protocol={}", domain, type, protocol); u32 fd = next_fd++; @@ -45,7 +44,7 @@ void BSD::Socket(Kernel::HLERequestContext& ctx) { } void BSD::Connect(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service, "(STUBBED) called"); + LOG_WARNING(Service, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 4}; @@ -55,7 +54,7 @@ void BSD::Connect(Kernel::HLERequestContext& ctx) { } void BSD::SendTo(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service, "(STUBBED) called"); + LOG_WARNING(Service, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 4}; @@ -65,7 +64,7 @@ void BSD::SendTo(Kernel::HLERequestContext& ctx) { } void BSD::Close(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service, "(STUBBED) called"); + LOG_WARNING(Service, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 4}; diff --git a/src/core/hle/service/sockets/sfdnsres.cpp b/src/core/hle/service/sockets/sfdnsres.cpp index f377e59f2..d235c4cfd 100644 --- a/src/core/hle/service/sockets/sfdnsres.cpp +++ b/src/core/hle/service/sockets/sfdnsres.cpp @@ -10,7 +10,7 @@ namespace Service::Sockets { void SFDNSRES::GetAddrInfo(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - NGLOG_WARNING(Service, "(STUBBED) called"); + LOG_WARNING(Service, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; diff --git a/src/core/hle/service/spl/module.cpp b/src/core/hle/service/spl/module.cpp index 76ba97156..3f5a342a7 100644 --- a/src/core/hle/service/spl/module.cpp +++ b/src/core/hle/service/spl/module.cpp @@ -28,7 +28,7 @@ void Module::Interface::GetRandomBytes(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - NGLOG_DEBUG(Service_SPL, "called"); + LOG_DEBUG(Service_SPL, "called"); } void InstallInterfaces(SM::ServiceManager& service_manager) { diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp index b3dad8b06..40aea6090 100644 --- a/src/core/hle/service/ssl/ssl.cpp +++ b/src/core/hle/service/ssl/ssl.cpp @@ -65,7 +65,7 @@ public: private: void SetOption(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_SSL, "(STUBBED) called"); + LOG_WARNING(Service_SSL, "(STUBBED) called"); IPC::RequestParser rp{ctx}; IPC::ResponseBuilder rb = rp.MakeBuilder(2, 0, 0); @@ -73,7 +73,7 @@ private: } void CreateConnection(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_SSL, "(STUBBED) called"); + LOG_WARNING(Service_SSL, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); @@ -82,7 +82,7 @@ private: }; void SSL::CreateContext(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_SSL, "(STUBBED) called"); + LOG_WARNING(Service_SSL, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); @@ -103,7 +103,7 @@ SSL::SSL() : ServiceFramework("ssl") { } void SSL::SetInterfaceVersion(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_SSL, "(STUBBED) called"); + LOG_WARNING(Service_SSL, "(STUBBED) called"); IPC::RequestParser rp{ctx}; u32 unk1 = rp.Pop<u32>(); // Probably minor/major? u32 unk2 = rp.Pop<u32>(); // TODO(ogniK): Figure out what this does diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp index 654012189..507ae95f4 100644 --- a/src/core/hle/service/time/time.cpp +++ b/src/core/hle/service/time/time.cpp @@ -33,14 +33,14 @@ private: const s64 time_since_epoch{std::chrono::duration_cast<std::chrono::seconds>( std::chrono::system_clock::now().time_since_epoch()) .count()}; - NGLOG_DEBUG(Service_Time, "called"); + LOG_DEBUG(Service_Time, "called"); IPC::ResponseBuilder rb{ctx, 4}; rb.Push(RESULT_SUCCESS); rb.Push<u64>(time_since_epoch); } void GetSystemClockContext(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_Time, "(STUBBED) called"); + LOG_WARNING(Service_Time, "(STUBBED) called"); SystemClockContext system_clock_ontext{}; IPC::ResponseBuilder rb{ctx, (sizeof(SystemClockContext) / 4) + 2}; rb.Push(RESULT_SUCCESS); @@ -59,7 +59,7 @@ public: private: void GetCurrentTimePoint(Kernel::HLERequestContext& ctx) { - NGLOG_DEBUG(Service_Time, "called"); + LOG_DEBUG(Service_Time, "called"); SteadyClockTimePoint steady_clock_time_point{ CoreTiming::cyclesToMs(CoreTiming::GetTicks()) / 1000}; IPC::ResponseBuilder rb{ctx, (sizeof(SteadyClockTimePoint) / 4) + 2}; @@ -91,21 +91,21 @@ private: TimeZoneRule my_time_zone_rule{}; void GetDeviceLocationName(Kernel::HLERequestContext& ctx) { - NGLOG_DEBUG(Service_Time, "called"); + LOG_DEBUG(Service_Time, "called"); IPC::ResponseBuilder rb{ctx, (sizeof(LocationName) / 4) + 2}; rb.Push(RESULT_SUCCESS); rb.PushRaw(location_name); } void GetTotalLocationNameCount(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_Time, "(STUBBED) called"); + LOG_WARNING(Service_Time, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push<u32>(0); } void LoadTimeZoneRule(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_Time, "(STUBBED) called"); + LOG_WARNING(Service_Time, "(STUBBED) called"); ctx.WriteBuffer(&my_time_zone_rule, sizeof(TimeZoneRule)); @@ -117,7 +117,7 @@ private: IPC::RequestParser rp{ctx}; const u64 posix_time = rp.Pop<u64>(); - NGLOG_WARNING(Service_Time, "(STUBBED) called, posix_time=0x{:016X}", posix_time); + LOG_WARNING(Service_Time, "(STUBBED) called, posix_time=0x{:016X}", posix_time); TimeZoneRule time_zone_rule{}; auto buffer = ctx.ReadBuffer(); @@ -138,7 +138,7 @@ private: IPC::RequestParser rp{ctx}; const u64 posix_time = rp.Pop<u64>(); - NGLOG_WARNING(Service_Time, "(STUBBED) called, posix_time=0x{:016X}", posix_time); + LOG_WARNING(Service_Time, "(STUBBED) called, posix_time=0x{:016X}", posix_time); CalendarTime calendar_time{2018, 1, 1, 0, 0, 0}; CalendarAdditionalInfo additional_info{}; @@ -176,35 +176,35 @@ void Module::Interface::GetStandardUserSystemClock(Kernel::HLERequestContext& ct IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<ISystemClock>(); - NGLOG_DEBUG(Service_Time, "called"); + LOG_DEBUG(Service_Time, "called"); } void Module::Interface::GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<ISystemClock>(); - NGLOG_DEBUG(Service_Time, "called"); + LOG_DEBUG(Service_Time, "called"); } void Module::Interface::GetStandardSteadyClock(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<ISteadyClock>(); - NGLOG_DEBUG(Service_Time, "called"); + LOG_DEBUG(Service_Time, "called"); } void Module::Interface::GetTimeZoneService(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<ITimeZoneService>(); - NGLOG_DEBUG(Service_Time, "called"); + LOG_DEBUG(Service_Time, "called"); } void Module::Interface::GetStandardLocalSystemClock(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<ISystemClock>(); - NGLOG_DEBUG(Service_Time, "called"); + LOG_DEBUG(Service_Time, "called"); } Module::Interface::Interface(std::shared_ptr<Module> time, const char* name) diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index e86556671..f3765b555 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp @@ -470,7 +470,7 @@ private: u32 flags = rp.Pop<u32>(); auto buffer_queue = nv_flinger->GetBufferQueue(id); - NGLOG_DEBUG(Service_VI, "called, transaction={:X}", static_cast<u32>(transaction)); + LOG_DEBUG(Service_VI, "called, transaction={:X}", static_cast<u32>(transaction)); if (transaction == TransactionId::Connect) { IGBPConnectRequestParcel request{ctx.ReadBuffer()}; @@ -532,7 +532,7 @@ private: IGBPQueryResponseParcel response{value}; ctx.WriteBuffer(response.Serialize()); } else if (transaction == TransactionId::CancelBuffer) { - NGLOG_WARNING(Service_VI, "(STUBBED) called, transaction=CancelBuffer"); + LOG_WARNING(Service_VI, "(STUBBED) called, transaction=CancelBuffer"); } else { ASSERT_MSG(false, "Unimplemented"); } @@ -547,8 +547,8 @@ private: s32 addval = rp.PopRaw<s32>(); u32 type = rp.Pop<u32>(); - NGLOG_WARNING(Service_VI, "(STUBBED) called id={}, addval={:08X}, type={:08X}", id, addval, - type); + LOG_WARNING(Service_VI, "(STUBBED) called id={}, addval={:08X}, type={:08X}", id, addval, + type); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } @@ -562,7 +562,7 @@ private: // TODO(Subv): Find out what this actually is. - NGLOG_WARNING(Service_VI, "(STUBBED) called id={}, unknown={:08X}", id, unknown); + LOG_WARNING(Service_VI, "(STUBBED) called id={}, unknown={:08X}", id, unknown); IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); rb.PushCopyObjects(buffer_queue->GetNativeHandle()); @@ -625,7 +625,7 @@ public: private: void SetLayerZ(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_VI, "(STUBBED) called"); + LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::RequestParser rp{ctx}; u64 layer_id = rp.Pop<u64>(); u64 z_value = rp.Pop<u64>(); @@ -640,8 +640,8 @@ private: bool visibility = rp.Pop<bool>(); IPC::ResponseBuilder rb = rp.MakeBuilder(2, 0, 0); rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_VI, "(STUBBED) called, layer_id=0x{:08X}, visibility={}", layer_id, - visibility); + LOG_WARNING(Service_VI, "(STUBBED) called, layer_id=0x{:08X}, visibility={}", layer_id, + visibility); } }; @@ -723,7 +723,7 @@ public: private: void CloseDisplay(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_VI, "(STUBBED) called"); + LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::RequestParser rp{ctx}; u64 display = rp.Pop<u64>(); @@ -732,7 +732,7 @@ private: } void CreateManagedLayer(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_VI, "(STUBBED) called"); + LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::RequestParser rp{ctx}; u32 unknown = rp.Pop<u32>(); rp.Skip(1, false); @@ -747,7 +747,7 @@ private: } void AddToLayerStack(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_VI, "(STUBBED) called"); + LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::RequestParser rp{ctx}; u32 stack = rp.Pop<u32>(); u64 layer_id = rp.Pop<u64>(); @@ -762,8 +762,8 @@ private: bool visibility = rp.Pop<bool>(); IPC::ResponseBuilder rb = rp.MakeBuilder(2, 0, 0); rb.Push(RESULT_SUCCESS); - NGLOG_WARNING(Service_VI, "(STUBBED) called, layer_id=0x{:X}, visibility={}", layer_id, - visibility); + LOG_WARNING(Service_VI, "(STUBBED) called, layer_id=0x{:X}, visibility={}", layer_id, + visibility); } std::shared_ptr<NVFlinger::NVFlinger> nv_flinger; @@ -776,7 +776,7 @@ public: private: void GetRelayService(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_VI, "(STUBBED) called"); + LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); @@ -784,7 +784,7 @@ private: } void GetSystemDisplayService(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_VI, "(STUBBED) called"); + LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); @@ -792,7 +792,7 @@ private: } void GetManagerDisplayService(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_VI, "(STUBBED) called"); + LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); @@ -800,7 +800,7 @@ private: } void GetIndirectDisplayTransactionService(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_VI, "(STUBBED) called"); + LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); @@ -808,7 +808,7 @@ private: } void OpenDisplay(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_VI, "(STUBBED) called"); + LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::RequestParser rp{ctx}; auto name_buf = rp.PopRaw<std::array<u8, 0x40>>(); auto end = std::find(name_buf.begin(), name_buf.end(), '\0'); @@ -823,7 +823,7 @@ private: } void CloseDisplay(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_VI, "(STUBBED) called"); + LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::RequestParser rp{ctx}; u64 display_id = rp.Pop<u64>(); @@ -832,7 +832,7 @@ private: } void GetDisplayResolution(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_VI, "(STUBBED) called"); + LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::RequestParser rp{ctx}; u64 display_id = rp.Pop<u64>(); @@ -849,7 +849,7 @@ private: } void SetLayerScalingMode(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_VI, "(STUBBED) called"); + LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::RequestParser rp{ctx}; u32 scaling_mode = rp.Pop<u32>(); u64 unknown = rp.Pop<u64>(); @@ -865,11 +865,11 @@ private: IPC::ResponseBuilder rb = rp.MakeBuilder(4, 0, 0); rb.Push(RESULT_SUCCESS); rb.Push<u64>(1); - NGLOG_WARNING(Service_VI, "(STUBBED) called"); + LOG_WARNING(Service_VI, "(STUBBED) called"); } void OpenLayer(Kernel::HLERequestContext& ctx) { - NGLOG_DEBUG(Service_VI, "called"); + LOG_DEBUG(Service_VI, "called"); IPC::RequestParser rp{ctx}; auto name_buf = rp.PopRaw<std::array<u8, 0x40>>(); auto end = std::find(name_buf.begin(), name_buf.end(), '\0'); @@ -889,7 +889,7 @@ private: } void CreateStrayLayer(Kernel::HLERequestContext& ctx) { - NGLOG_DEBUG(Service_VI, "called"); + LOG_DEBUG(Service_VI, "called"); IPC::RequestParser rp{ctx}; u32 flags = rp.Pop<u32>(); @@ -909,7 +909,7 @@ private: } void DestroyStrayLayer(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_VI, "(STUBBED) called"); + LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::RequestParser rp{ctx}; u64 layer_id = rp.Pop<u64>(); @@ -919,7 +919,7 @@ private: } void GetDisplayVsyncEvent(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_VI, "(STUBBED) called"); + LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::RequestParser rp{ctx}; u64 display_id = rp.Pop<u64>(); @@ -968,7 +968,7 @@ Module::Interface::Interface(std::shared_ptr<Module> module, const char* name, : ServiceFramework(name), module(std::move(module)), nv_flinger(std::move(nv_flinger)) {} void Module::Interface::GetDisplayService(Kernel::HLERequestContext& ctx) { - NGLOG_WARNING(Service_VI, "(STUBBED) called"); + LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); |