diff options
author | bunnei <bunneidev@gmail.com> | 2018-04-04 22:50:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-04 22:50:12 +0200 |
commit | 20bd26dc7d322cc6409c9e09ee6c8908658d3bbd (patch) | |
tree | c7a28e58e2b7cba62faa6e6989dc240f28f021c9 /src | |
parent | Merge pull request #306 from daniellimws/new-fmt-macros (diff) | |
parent | svc: Stub out SetThreadActivity, GetThreadContext. (diff) | |
download | yuzu-20bd26dc7d322cc6409c9e09ee6c8908658d3bbd.tar yuzu-20bd26dc7d322cc6409c9e09ee6c8908658d3bbd.tar.gz yuzu-20bd26dc7d322cc6409c9e09ee6c8908658d3bbd.tar.bz2 yuzu-20bd26dc7d322cc6409c9e09ee6c8908658d3bbd.tar.lz yuzu-20bd26dc7d322cc6409c9e09ee6c8908658d3bbd.tar.xz yuzu-20bd26dc7d322cc6409c9e09ee6c8908658d3bbd.tar.zst yuzu-20bd26dc7d322cc6409c9e09ee6c8908658d3bbd.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/core/hle/kernel/shared_memory.cpp | 12 | ||||
-rw-r--r-- | src/core/hle/kernel/svc.cpp | 16 | ||||
-rw-r--r-- | src/core/hle/kernel/svc_wrap.h | 5 | ||||
-rw-r--r-- | src/core/hle/service/audio/audout_u.cpp | 9 | ||||
-rw-r--r-- | src/core/hle/service/audio/audren_u.cpp | 14 | ||||
-rw-r--r-- | src/core/hle/service/friend/friend.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/service/friend/friend_u.cpp | 19 | ||||
-rw-r--r-- | src/core/hle/service/friend/friend_u.h | 18 | ||||
-rw-r--r-- | src/core/hle/service/nifm/nifm.cpp | 3 | ||||
-rw-r--r-- | src/core/hle/service/vi/vi.cpp | 19 | ||||
-rw-r--r-- | src/core/hle/service/vi/vi.h | 7 |
12 files changed, 108 insertions, 18 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 6f8104516..97d795d5f 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -130,6 +130,8 @@ add_library(core STATIC hle/service/friend/friend.h hle/service/friend/friend_a.cpp hle/service/friend/friend_a.h + hle/service/friend/friend_u.cpp + hle/service/friend/friend_u.h hle/service/hid/hid.cpp hle/service/hid/hid.h hle/service/lm/lm.cpp diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index 88230bdd9..bc99993c8 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp @@ -120,18 +120,6 @@ ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermi return ERR_WRONG_PERMISSION; } - // TODO(Subv): The same process that created a SharedMemory object - // can not map it in its own address space unless it was created with addr=0, result 0xD900182C. - - if (address != 0) { - // TODO(shinyquagsire23): Check for virtual/mappable memory here too? - if (address >= Memory::HEAP_VADDR && address < Memory::HEAP_VADDR_END) { - LOG_ERROR(Kernel, "cannot map id=%u, address=0x%lx name=%s, invalid address", - GetObjectId(), address, name.c_str()); - return ERR_INVALID_ADDRESS; - } - } - VAddr target_address = address; if (base_address == 0 && target_address == 0) { diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 171bbd956..36ea23cd9 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -371,6 +371,18 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id) return RESULT_SUCCESS; } +/// Sets the thread activity +static ResultCode SetThreadActivity(Handle handle, u32 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) { + LOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x%08X, addr=0x%" PRIx64, handle, addr); + return RESULT_SUCCESS; +} + /// Gets the priority for the specified thread static ResultCode GetThreadPriority(u32* priority, Handle handle) { const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(handle); @@ -853,8 +865,8 @@ static const FunctionDef SVC_Table[] = { {0x2F, nullptr, "GetLastThreadInfo"}, {0x30, nullptr, "GetResourceLimitLimitValue"}, {0x31, nullptr, "GetResourceLimitCurrentValue"}, - {0x32, nullptr, "SetThreadActivity"}, - {0x33, nullptr, "GetThreadContext"}, + {0x32, SvcWrap<SetThreadActivity>, "SetThreadActivity"}, + {0x33, SvcWrap<GetThreadContext>, "GetThreadContext"}, {0x34, nullptr, "Unknown"}, {0x35, nullptr, "Unknown"}, {0x36, nullptr, "Unknown"}, diff --git a/src/core/hle/kernel/svc_wrap.h b/src/core/hle/kernel/svc_wrap.h index 5da4f5269..c86ad3e04 100644 --- a/src/core/hle/kernel/svc_wrap.h +++ b/src/core/hle/kernel/svc_wrap.h @@ -70,6 +70,11 @@ void SvcWrap() { FuncReturn(retval); } +template <ResultCode func(u32, u64)> +void SvcWrap() { + FuncReturn(func((u32)(PARAM(0) & 0xFFFFFFFF), PARAM(1)).raw); +} + template <ResultCode func(u32, u32, u64)> void SvcWrap() { FuncReturn(func((u32)(PARAM(0) & 0xFFFFFFFF), (u32)(PARAM(1) & 0xFFFFFFFF), PARAM(2)).raw); diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp index e873d768f..8e935cb7f 100644 --- a/src/core/hle/service/audio/audout_u.cpp +++ b/src/core/hle/service/audio/audout_u.cpp @@ -25,7 +25,7 @@ class IAudioOut final : public ServiceFramework<IAudioOut> { public: IAudioOut() : ServiceFramework("IAudioOut"), audio_out_state(AudioState::Stopped) { static const FunctionInfo functions[] = { - {0x0, nullptr, "GetAudioOutState"}, + {0x0, &IAudioOut::GetAudioOutState, "GetAudioOutState"}, {0x1, &IAudioOut::StartAudioOut, "StartAudioOut"}, {0x2, &IAudioOut::StopAudioOut, "StopAudioOut"}, {0x3, &IAudioOut::AppendAudioOutBuffer_1, "AppendAudioOutBuffer_1"}, @@ -57,6 +57,13 @@ public: } private: + void GetAudioOutState(Kernel::HLERequestContext& ctx) { + 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) { LOG_WARNING(Service_Audio, "(STUBBED) called"); diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index 6d0461bbc..7990595aa 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp @@ -158,7 +158,7 @@ public: {0x0, &IAudioDevice::ListAudioDeviceName, "ListAudioDeviceName"}, {0x1, &IAudioDevice::SetAudioDeviceOutputVolume, "SetAudioDeviceOutputVolume"}, {0x2, nullptr, "GetAudioDeviceOutputVolume"}, - {0x3, nullptr, "GetActiveAudioDeviceName"}, + {0x3, &IAudioDevice::GetActiveAudioDeviceName, "GetActiveAudioDeviceName"}, {0x4, &IAudioDevice::QueryAudioDeviceSystemEvent, "QueryAudioDeviceSystemEvent"}, {0x5, &IAudioDevice::GetActiveChannelCount, "GetActiveChannelCount"}, {0x6, nullptr, "ListAudioDeviceNameAuto"}, @@ -199,6 +199,18 @@ private: rb.Push(RESULT_SUCCESS); } + void GetActiveAudioDeviceName(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_Audio, "(STUBBED) called"); + IPC::RequestParser rp{ctx}; + + const std::string audio_interface = "AudioDevice"; + ctx.WriteBuffer(audio_interface.c_str(), audio_interface.size()); + + IPC::ResponseBuilder rb = rp.MakeBuilder(3, 0, 0); + rb.Push(RESULT_SUCCESS); + rb.Push<u32>(1); + } + void QueryAudioDeviceSystemEvent(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_Audio, "(STUBBED) called"); diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index 26593bb0c..fc5adc56d 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp @@ -6,6 +6,7 @@ #include "core/hle/ipc_helpers.h" #include "core/hle/service/friend/friend.h" #include "core/hle/service/friend/friend_a.h" +#include "core/hle/service/friend/friend_u.h" namespace Service { namespace Friend { @@ -22,6 +23,7 @@ Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) void InstallInterfaces(SM::ServiceManager& service_manager) { auto module = std::make_shared<Module>(); std::make_shared<Friend_A>(module)->InstallAsService(service_manager); + std::make_shared<Friend_U>(module)->InstallAsService(service_manager); } } // namespace Friend diff --git a/src/core/hle/service/friend/friend_u.cpp b/src/core/hle/service/friend/friend_u.cpp new file mode 100644 index 000000000..084388e5f --- /dev/null +++ b/src/core/hle/service/friend/friend_u.cpp @@ -0,0 +1,19 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/hle/service/friend/friend_u.h" + +namespace Service { +namespace Friend { + +Friend_U::Friend_U(std::shared_ptr<Module> module) + : Module::Interface(std::move(module), "friend:u") { + static const FunctionInfo functions[] = { + {0, &Friend_U::Unknown, "Unknown"}, + }; + RegisterHandlers(functions); +} + +} // namespace Friend +} // namespace Service diff --git a/src/core/hle/service/friend/friend_u.h b/src/core/hle/service/friend/friend_u.h new file mode 100644 index 000000000..6be49ff01 --- /dev/null +++ b/src/core/hle/service/friend/friend_u.h @@ -0,0 +1,18 @@ +// 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/friend/friend.h" + +namespace Service { +namespace Friend { + +class Friend_U final : public Module::Interface { +public: + explicit Friend_U(std::shared_ptr<Module> module); +}; + +} // namespace Friend +} // namespace Service diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index dd2d5fe63..b32112db3 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp @@ -70,9 +70,8 @@ private: } void GetResult(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); - IPC::ResponseBuilder rb{ctx, 3}; + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - rb.Push<u32>(0); } void GetSystemEventReadableHandles(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 06c34e979..42793f155 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp @@ -17,6 +17,7 @@ #include "core/hle/service/vi/vi_m.h" #include "core/hle/service/vi/vi_s.h" #include "core/hle/service/vi/vi_u.h" +#include "core/settings.h" #include "video_core/renderer_base.h" #include "video_core/video_core.h" @@ -711,6 +712,23 @@ private: rb.Push(RESULT_SUCCESS); } + void GetDisplayResolution(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_VI, "(STUBBED) called"); + IPC::RequestParser rp{ctx}; + u64 display_id = rp.Pop<u64>(); + + IPC::ResponseBuilder rb = rp.MakeBuilder(6, 0, 0); + rb.Push(RESULT_SUCCESS); + + if (Settings::values.use_docked_mode) { + rb.Push(static_cast<u32>(DisplayResolution::DockedWidth)); + rb.Push(static_cast<u32>(DisplayResolution::DockedHeight)); + } else { + rb.Push(static_cast<u32>(DisplayResolution::UndockedWidth)); + rb.Push(static_cast<u32>(DisplayResolution::UndockedHeight)); + } + } + void SetLayerScalingMode(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::RequestParser rp{ctx}; @@ -808,6 +826,7 @@ IApplicationDisplayService::IApplicationDisplayService( {1000, &IApplicationDisplayService::ListDisplays, "ListDisplays"}, {1010, &IApplicationDisplayService::OpenDisplay, "OpenDisplay"}, {1020, &IApplicationDisplayService::CloseDisplay, "CloseDisplay"}, + {1102, &IApplicationDisplayService::GetDisplayResolution, "GetDisplayResolution"}, {2101, &IApplicationDisplayService::SetLayerScalingMode, "SetLayerScalingMode"}, {2020, &IApplicationDisplayService::OpenLayer, "OpenLayer"}, {2030, &IApplicationDisplayService::CreateStrayLayer, "CreateStrayLayer"}, diff --git a/src/core/hle/service/vi/vi.h b/src/core/hle/service/vi/vi.h index 985c9d27c..7f16fad8e 100644 --- a/src/core/hle/service/vi/vi.h +++ b/src/core/hle/service/vi/vi.h @@ -14,6 +14,13 @@ struct EventType; namespace Service { namespace VI { +enum class DisplayResolution : u32 { + DockedWidth = 1920, + DockedHeight = 1080, + UndockedWidth = 1280, + UndockedHeight = 720, +}; + class Module final { public: class Interface : public ServiceFramework<Interface> { |