summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-04-04 16:50:12 -0400
committerGravatar GitHub2018-04-04 16:50:12 -0400
commit20bd26dc7d322cc6409c9e09ee6c8908658d3bbd (patch)
treec7a28e58e2b7cba62faa6e6989dc240f28f021c9 /src
parentMerge pull request #306 from daniellimws/new-fmt-macros (diff)
parentsvc: Stub out SetThreadActivity, GetThreadContext. (diff)
downloadyuzu-20bd26dc7d322cc6409c9e09ee6c8908658d3bbd.tar.gz
yuzu-20bd26dc7d322cc6409c9e09ee6c8908658d3bbd.tar.xz
yuzu-20bd26dc7d322cc6409c9e09ee6c8908658d3bbd.zip
Merge pull request #308 from bunnei/misc-fixes-2
Implement and stub several SVC/VI/Audio/Friend/etc. funcs
Diffstat (limited to 'src')
-rw-r--r--src/core/CMakeLists.txt2
-rw-r--r--src/core/hle/kernel/shared_memory.cpp12
-rw-r--r--src/core/hle/kernel/svc.cpp16
-rw-r--r--src/core/hle/kernel/svc_wrap.h5
-rw-r--r--src/core/hle/service/audio/audout_u.cpp9
-rw-r--r--src/core/hle/service/audio/audren_u.cpp14
-rw-r--r--src/core/hle/service/friend/friend.cpp2
-rw-r--r--src/core/hle/service/friend/friend_u.cpp19
-rw-r--r--src/core/hle/service/friend/friend_u.h18
-rw-r--r--src/core/hle/service/nifm/nifm.cpp3
-rw-r--r--src/core/hle/service/vi/vi.cpp19
-rw-r--r--src/core/hle/service/vi/vi.h7
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
130 hle/service/friend/friend.h 130 hle/service/friend/friend.h
131 hle/service/friend/friend_a.cpp 131 hle/service/friend/friend_a.cpp
132 hle/service/friend/friend_a.h 132 hle/service/friend/friend_a.h
133 hle/service/friend/friend_u.cpp
134 hle/service/friend/friend_u.h
133 hle/service/hid/hid.cpp 135 hle/service/hid/hid.cpp
134 hle/service/hid/hid.h 136 hle/service/hid/hid.h
135 hle/service/lm/lm.cpp 137 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
120 return ERR_WRONG_PERMISSION; 120 return ERR_WRONG_PERMISSION;
121 } 121 }
122 122
123 // TODO(Subv): The same process that created a SharedMemory object
124 // can not map it in its own address space unless it was created with addr=0, result 0xD900182C.
125
126 if (address != 0) {
127 // TODO(shinyquagsire23): Check for virtual/mappable memory here too?
128 if (address >= Memory::HEAP_VADDR && address < Memory::HEAP_VADDR_END) {
129 LOG_ERROR(Kernel, "cannot map id=%u, address=0x%lx name=%s, invalid address",
130 GetObjectId(), address, name.c_str());
131 return ERR_INVALID_ADDRESS;
132 }
133 }
134
135 VAddr target_address = address; 123 VAddr target_address = address;
136 124
137 if (base_address == 0 && target_address == 0) { 125 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)
371 return RESULT_SUCCESS; 371 return RESULT_SUCCESS;
372} 372}
373 373
374/// Sets the thread activity
375static ResultCode SetThreadActivity(Handle handle, u32 unknown) {
376 LOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x%08X, unknown=0x%08X", handle, unknown);
377 return RESULT_SUCCESS;
378}
379
380/// Gets the thread context
381static ResultCode GetThreadContext(Handle handle, VAddr addr) {
382 LOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x%08X, addr=0x%" PRIx64, handle, addr);
383 return RESULT_SUCCESS;
384}
385
374/// Gets the priority for the specified thread 386/// Gets the priority for the specified thread
375static ResultCode GetThreadPriority(u32* priority, Handle handle) { 387static ResultCode GetThreadPriority(u32* priority, Handle handle) {
376 const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(handle); 388 const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(handle);
@@ -853,8 +865,8 @@ static const FunctionDef SVC_Table[] = {
853 {0x2F, nullptr, "GetLastThreadInfo"}, 865 {0x2F, nullptr, "GetLastThreadInfo"},
854 {0x30, nullptr, "GetResourceLimitLimitValue"}, 866 {0x30, nullptr, "GetResourceLimitLimitValue"},
855 {0x31, nullptr, "GetResourceLimitCurrentValue"}, 867 {0x31, nullptr, "GetResourceLimitCurrentValue"},
856 {0x32, nullptr, "SetThreadActivity"}, 868 {0x32, SvcWrap<SetThreadActivity>, "SetThreadActivity"},
857 {0x33, nullptr, "GetThreadContext"}, 869 {0x33, SvcWrap<GetThreadContext>, "GetThreadContext"},
858 {0x34, nullptr, "Unknown"}, 870 {0x34, nullptr, "Unknown"},
859 {0x35, nullptr, "Unknown"}, 871 {0x35, nullptr, "Unknown"},
860 {0x36, nullptr, "Unknown"}, 872 {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() {
70 FuncReturn(retval); 70 FuncReturn(retval);
71} 71}
72 72
73template <ResultCode func(u32, u64)>
74void SvcWrap() {
75 FuncReturn(func((u32)(PARAM(0) & 0xFFFFFFFF), PARAM(1)).raw);
76}
77
73template <ResultCode func(u32, u32, u64)> 78template <ResultCode func(u32, u32, u64)>
74void SvcWrap() { 79void SvcWrap() {
75 FuncReturn(func((u32)(PARAM(0) & 0xFFFFFFFF), (u32)(PARAM(1) & 0xFFFFFFFF), PARAM(2)).raw); 80 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> {
25public: 25public:
26 IAudioOut() : ServiceFramework("IAudioOut"), audio_out_state(AudioState::Stopped) { 26 IAudioOut() : ServiceFramework("IAudioOut"), audio_out_state(AudioState::Stopped) {
27 static const FunctionInfo functions[] = { 27 static const FunctionInfo functions[] = {
28 {0x0, nullptr, "GetAudioOutState"}, 28 {0x0, &IAudioOut::GetAudioOutState, "GetAudioOutState"},
29 {0x1, &IAudioOut::StartAudioOut, "StartAudioOut"}, 29 {0x1, &IAudioOut::StartAudioOut, "StartAudioOut"},
30 {0x2, &IAudioOut::StopAudioOut, "StopAudioOut"}, 30 {0x2, &IAudioOut::StopAudioOut, "StopAudioOut"},
31 {0x3, &IAudioOut::AppendAudioOutBuffer_1, "AppendAudioOutBuffer_1"}, 31 {0x3, &IAudioOut::AppendAudioOutBuffer_1, "AppendAudioOutBuffer_1"},
@@ -57,6 +57,13 @@ public:
57 } 57 }
58 58
59private: 59private:
60 void GetAudioOutState(Kernel::HLERequestContext& ctx) {
61 LOG_DEBUG(Service_Audio, "called");
62 IPC::ResponseBuilder rb{ctx, 3};
63 rb.Push(RESULT_SUCCESS);
64 rb.Push(static_cast<u32>(audio_out_state));
65 }
66
60 void StartAudioOut(Kernel::HLERequestContext& ctx) { 67 void StartAudioOut(Kernel::HLERequestContext& ctx) {
61 LOG_WARNING(Service_Audio, "(STUBBED) called"); 68 LOG_WARNING(Service_Audio, "(STUBBED) called");
62 69
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:
158 {0x0, &IAudioDevice::ListAudioDeviceName, "ListAudioDeviceName"}, 158 {0x0, &IAudioDevice::ListAudioDeviceName, "ListAudioDeviceName"},
159 {0x1, &IAudioDevice::SetAudioDeviceOutputVolume, "SetAudioDeviceOutputVolume"}, 159 {0x1, &IAudioDevice::SetAudioDeviceOutputVolume, "SetAudioDeviceOutputVolume"},
160 {0x2, nullptr, "GetAudioDeviceOutputVolume"}, 160 {0x2, nullptr, "GetAudioDeviceOutputVolume"},
161 {0x3, nullptr, "GetActiveAudioDeviceName"}, 161 {0x3, &IAudioDevice::GetActiveAudioDeviceName, "GetActiveAudioDeviceName"},
162 {0x4, &IAudioDevice::QueryAudioDeviceSystemEvent, "QueryAudioDeviceSystemEvent"}, 162 {0x4, &IAudioDevice::QueryAudioDeviceSystemEvent, "QueryAudioDeviceSystemEvent"},
163 {0x5, &IAudioDevice::GetActiveChannelCount, "GetActiveChannelCount"}, 163 {0x5, &IAudioDevice::GetActiveChannelCount, "GetActiveChannelCount"},
164 {0x6, nullptr, "ListAudioDeviceNameAuto"}, 164 {0x6, nullptr, "ListAudioDeviceNameAuto"},
@@ -199,6 +199,18 @@ private:
199 rb.Push(RESULT_SUCCESS); 199 rb.Push(RESULT_SUCCESS);
200 } 200 }
201 201
202 void GetActiveAudioDeviceName(Kernel::HLERequestContext& ctx) {
203 LOG_WARNING(Service_Audio, "(STUBBED) called");
204 IPC::RequestParser rp{ctx};
205
206 const std::string audio_interface = "AudioDevice";
207 ctx.WriteBuffer(audio_interface.c_str(), audio_interface.size());
208
209 IPC::ResponseBuilder rb = rp.MakeBuilder(3, 0, 0);
210 rb.Push(RESULT_SUCCESS);
211 rb.Push<u32>(1);
212 }
213
202 void QueryAudioDeviceSystemEvent(Kernel::HLERequestContext& ctx) { 214 void QueryAudioDeviceSystemEvent(Kernel::HLERequestContext& ctx) {
203 LOG_WARNING(Service_Audio, "(STUBBED) called"); 215 LOG_WARNING(Service_Audio, "(STUBBED) called");
204 216
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 @@
6#include "core/hle/ipc_helpers.h" 6#include "core/hle/ipc_helpers.h"
7#include "core/hle/service/friend/friend.h" 7#include "core/hle/service/friend/friend.h"
8#include "core/hle/service/friend/friend_a.h" 8#include "core/hle/service/friend/friend_a.h"
9#include "core/hle/service/friend/friend_u.h"
9 10
10namespace Service { 11namespace Service {
11namespace Friend { 12namespace Friend {
@@ -22,6 +23,7 @@ Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)
22void InstallInterfaces(SM::ServiceManager& service_manager) { 23void InstallInterfaces(SM::ServiceManager& service_manager) {
23 auto module = std::make_shared<Module>(); 24 auto module = std::make_shared<Module>();
24 std::make_shared<Friend_A>(module)->InstallAsService(service_manager); 25 std::make_shared<Friend_A>(module)->InstallAsService(service_manager);
26 std::make_shared<Friend_U>(module)->InstallAsService(service_manager);
25} 27}
26 28
27} // namespace Friend 29} // 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 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "core/hle/service/friend/friend_u.h"
6
7namespace Service {
8namespace Friend {
9
10Friend_U::Friend_U(std::shared_ptr<Module> module)
11 : Module::Interface(std::move(module), "friend:u") {
12 static const FunctionInfo functions[] = {
13 {0, &Friend_U::Unknown, "Unknown"},
14 };
15 RegisterHandlers(functions);
16}
17
18} // namespace Friend
19} // 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 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "core/hle/service/friend/friend.h"
8
9namespace Service {
10namespace Friend {
11
12class Friend_U final : public Module::Interface {
13public:
14 explicit Friend_U(std::shared_ptr<Module> module);
15};
16
17} // namespace Friend
18} // 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:
70 } 70 }
71 void GetResult(Kernel::HLERequestContext& ctx) { 71 void GetResult(Kernel::HLERequestContext& ctx) {
72 LOG_WARNING(Service_NIFM, "(STUBBED) called"); 72 LOG_WARNING(Service_NIFM, "(STUBBED) called");
73 IPC::ResponseBuilder rb{ctx, 3}; 73 IPC::ResponseBuilder rb{ctx, 2};
74 rb.Push(RESULT_SUCCESS); 74 rb.Push(RESULT_SUCCESS);
75 rb.Push<u32>(0);
76 } 75 }
77 void GetSystemEventReadableHandles(Kernel::HLERequestContext& ctx) { 76 void GetSystemEventReadableHandles(Kernel::HLERequestContext& ctx) {
78 LOG_WARNING(Service_NIFM, "(STUBBED) called"); 77 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 @@
17#include "core/hle/service/vi/vi_m.h" 17#include "core/hle/service/vi/vi_m.h"
18#include "core/hle/service/vi/vi_s.h" 18#include "core/hle/service/vi/vi_s.h"
19#include "core/hle/service/vi/vi_u.h" 19#include "core/hle/service/vi/vi_u.h"
20#include "core/settings.h"
20#include "video_core/renderer_base.h" 21#include "video_core/renderer_base.h"
21#include "video_core/video_core.h" 22#include "video_core/video_core.h"
22 23
@@ -711,6 +712,23 @@ private:
711 rb.Push(RESULT_SUCCESS); 712 rb.Push(RESULT_SUCCESS);
712 } 713 }
713 714
715 void GetDisplayResolution(Kernel::HLERequestContext& ctx) {
716 LOG_WARNING(Service_VI, "(STUBBED) called");
717 IPC::RequestParser rp{ctx};
718 u64 display_id = rp.Pop<u64>();
719
720 IPC::ResponseBuilder rb = rp.MakeBuilder(6, 0, 0);
721 rb.Push(RESULT_SUCCESS);
722
723 if (Settings::values.use_docked_mode) {
724 rb.Push(static_cast<u32>(DisplayResolution::DockedWidth));
725 rb.Push(static_cast<u32>(DisplayResolution::DockedHeight));
726 } else {
727 rb.Push(static_cast<u32>(DisplayResolution::UndockedWidth));
728 rb.Push(static_cast<u32>(DisplayResolution::UndockedHeight));
729 }
730 }
731
714 void SetLayerScalingMode(Kernel::HLERequestContext& ctx) { 732 void SetLayerScalingMode(Kernel::HLERequestContext& ctx) {
715 LOG_WARNING(Service_VI, "(STUBBED) called"); 733 LOG_WARNING(Service_VI, "(STUBBED) called");
716 IPC::RequestParser rp{ctx}; 734 IPC::RequestParser rp{ctx};
@@ -808,6 +826,7 @@ IApplicationDisplayService::IApplicationDisplayService(
808 {1000, &IApplicationDisplayService::ListDisplays, "ListDisplays"}, 826 {1000, &IApplicationDisplayService::ListDisplays, "ListDisplays"},
809 {1010, &IApplicationDisplayService::OpenDisplay, "OpenDisplay"}, 827 {1010, &IApplicationDisplayService::OpenDisplay, "OpenDisplay"},
810 {1020, &IApplicationDisplayService::CloseDisplay, "CloseDisplay"}, 828 {1020, &IApplicationDisplayService::CloseDisplay, "CloseDisplay"},
829 {1102, &IApplicationDisplayService::GetDisplayResolution, "GetDisplayResolution"},
811 {2101, &IApplicationDisplayService::SetLayerScalingMode, "SetLayerScalingMode"}, 830 {2101, &IApplicationDisplayService::SetLayerScalingMode, "SetLayerScalingMode"},
812 {2020, &IApplicationDisplayService::OpenLayer, "OpenLayer"}, 831 {2020, &IApplicationDisplayService::OpenLayer, "OpenLayer"},
813 {2030, &IApplicationDisplayService::CreateStrayLayer, "CreateStrayLayer"}, 832 {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;
14namespace Service { 14namespace Service {
15namespace VI { 15namespace VI {
16 16
17enum class DisplayResolution : u32 {
18 DockedWidth = 1920,
19 DockedHeight = 1080,
20 UndockedWidth = 1280,
21 UndockedHeight = 720,
22};
23
17class Module final { 24class Module final {
18public: 25public:
19 class Interface : public ServiceFramework<Interface> { 26 class Interface : public ServiceFramework<Interface> {