summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/frontend/emu_window.cpp23
-rw-r--r--src/core/frontend/emu_window.h28
-rw-r--r--src/core/hle/service/hid/hid.cpp39
-rw-r--r--src/yuzu_cmd/CMakeLists.txt1
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2.cpp2
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2.h2
-rw-r--r--src/yuzu_cmd/resource.h16
7 files changed, 67 insertions, 44 deletions
diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp
index 474de9206..cff49899a 100644
--- a/src/core/frontend/emu_window.cpp
+++ b/src/core/frontend/emu_window.cpp
@@ -60,23 +60,23 @@ EmuWindow::~EmuWindow() {
60 * @param framebuffer_y Framebuffer y-coordinate to check 60 * @param framebuffer_y Framebuffer y-coordinate to check
61 * @return True if the coordinates are within the touchpad, otherwise false 61 * @return True if the coordinates are within the touchpad, otherwise false
62 */ 62 */
63static bool IsWithinTouchscreen(const Layout::FramebufferLayout& layout, unsigned framebuffer_x, 63static bool IsWithinTouchscreen(const Layout::FramebufferLayout& layout, u32 framebuffer_x,
64 unsigned framebuffer_y) { 64 u32 framebuffer_y) {
65 return (framebuffer_y >= layout.screen.top && framebuffer_y < layout.screen.bottom && 65 return (framebuffer_y >= layout.screen.top && framebuffer_y < layout.screen.bottom &&
66 framebuffer_x >= layout.screen.left && framebuffer_x < layout.screen.right); 66 framebuffer_x >= layout.screen.left && framebuffer_x < layout.screen.right);
67} 67}
68 68
69std::tuple<unsigned, unsigned> EmuWindow::ClipToTouchScreen(unsigned new_x, unsigned new_y) const { 69std::pair<u32, u32> EmuWindow::ClipToTouchScreen(u32 new_x, u32 new_y) const {
70 new_x = std::max(new_x, framebuffer_layout.screen.left); 70 new_x = std::max(new_x, framebuffer_layout.screen.left);
71 new_x = std::min(new_x, framebuffer_layout.screen.right - 1); 71 new_x = std::min(new_x, framebuffer_layout.screen.right - 1);
72 72
73 new_y = std::max(new_y, framebuffer_layout.screen.top); 73 new_y = std::max(new_y, framebuffer_layout.screen.top);
74 new_y = std::min(new_y, framebuffer_layout.screen.bottom - 1); 74 new_y = std::min(new_y, framebuffer_layout.screen.bottom - 1);
75 75
76 return std::make_tuple(new_x, new_y); 76 return std::make_pair(new_x, new_y);
77} 77}
78 78
79void EmuWindow::TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y, std::size_t id) { 79void EmuWindow::TouchPressed(u32 framebuffer_x, u32 framebuffer_y, size_t id) {
80 if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y)) { 80 if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y)) {
81 return; 81 return;
82 } 82 }
@@ -95,7 +95,7 @@ void EmuWindow::TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y, std
95 touch_state->status[id] = std::make_tuple(x, y, true); 95 touch_state->status[id] = std::make_tuple(x, y, true);
96} 96}
97 97
98void EmuWindow::TouchReleased(std::size_t id) { 98void EmuWindow::TouchReleased(size_t id) {
99 if (id >= touch_state->status.size()) { 99 if (id >= touch_state->status.size()) {
100 return; 100 return;
101 } 101 }
@@ -103,20 +103,23 @@ void EmuWindow::TouchReleased(std::size_t id) {
103 touch_state->status[id] = std::make_tuple(0.0f, 0.0f, false); 103 touch_state->status[id] = std::make_tuple(0.0f, 0.0f, false);
104} 104}
105 105
106void EmuWindow::TouchMoved(unsigned framebuffer_x, unsigned framebuffer_y, std::size_t id) { 106void EmuWindow::TouchMoved(u32 framebuffer_x, u32 framebuffer_y, size_t id) {
107 if (id >= touch_state->status.size()) { 107 if (id >= touch_state->status.size()) {
108 return; 108 return;
109 } 109 }
110 if (!std::get<2>(touch_state->status[id])) 110
111 if (!std::get<2>(touch_state->status[id])) {
111 return; 112 return;
113 }
112 114
113 if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y)) 115 if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y)) {
114 std::tie(framebuffer_x, framebuffer_y) = ClipToTouchScreen(framebuffer_x, framebuffer_y); 116 std::tie(framebuffer_x, framebuffer_y) = ClipToTouchScreen(framebuffer_x, framebuffer_y);
117 }
115 118
116 TouchPressed(framebuffer_x, framebuffer_y, id); 119 TouchPressed(framebuffer_x, framebuffer_y, id);
117} 120}
118 121
119void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height) { 122void EmuWindow::UpdateCurrentFramebufferLayout(u32 width, u32 height) {
120 NotifyFramebufferLayoutChanged(Layout::DefaultFrameLayout(width, height)); 123 NotifyFramebufferLayoutChanged(Layout::DefaultFrameLayout(width, height));
121} 124}
122 125
diff --git a/src/core/frontend/emu_window.h b/src/core/frontend/emu_window.h
index 2436c6580..076148698 100644
--- a/src/core/frontend/emu_window.h
+++ b/src/core/frontend/emu_window.h
@@ -82,7 +82,7 @@ public:
82 bool fullscreen = false; 82 bool fullscreen = false;
83 int res_width = 0; 83 int res_width = 0;
84 int res_height = 0; 84 int res_height = 0;
85 std::pair<unsigned, unsigned> min_client_area_size; 85 std::pair<u32, u32> min_client_area_size;
86 }; 86 };
87 87
88 /// Data describing host window system information 88 /// Data describing host window system information
@@ -119,13 +119,13 @@ public:
119 * @param framebuffer_y Framebuffer y-coordinate that was pressed 119 * @param framebuffer_y Framebuffer y-coordinate that was pressed
120 * @param id Touch event ID 120 * @param id Touch event ID
121 */ 121 */
122 void TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y, std::size_t id); 122 void TouchPressed(u32 framebuffer_x, u32 framebuffer_y, size_t id);
123 123
124 /** 124 /**
125 * Signal that a touch released event has occurred (e.g. mouse click released) 125 * Signal that a touch released event has occurred (e.g. mouse click released)
126 * @param id Touch event ID 126 * @param id Touch event ID
127 */ 127 */
128 void TouchReleased(std::size_t id); 128 void TouchReleased(size_t id);
129 129
130 /** 130 /**
131 * Signal that a touch movement event has occurred (e.g. mouse was moved over the emu window) 131 * Signal that a touch movement event has occurred (e.g. mouse was moved over the emu window)
@@ -133,7 +133,7 @@ public:
133 * @param framebuffer_y Framebuffer y-coordinate 133 * @param framebuffer_y Framebuffer y-coordinate
134 * @param id Touch event ID 134 * @param id Touch event ID
135 */ 135 */
136 void TouchMoved(unsigned framebuffer_x, unsigned framebuffer_y, std::size_t id); 136 void TouchMoved(u32 framebuffer_x, u32 framebuffer_y, size_t id);
137 137
138 /** 138 /**
139 * Returns currently active configuration. 139 * Returns currently active configuration.
@@ -173,7 +173,7 @@ public:
173 * Convenience method to update the current frame layout 173 * Convenience method to update the current frame layout
174 * Read from the current settings to determine which layout to use. 174 * Read from the current settings to determine which layout to use.
175 */ 175 */
176 void UpdateCurrentFramebufferLayout(unsigned width, unsigned height); 176 void UpdateCurrentFramebufferLayout(u32 width, u32 height);
177 177
178protected: 178protected:
179 explicit EmuWindow(); 179 explicit EmuWindow();
@@ -208,7 +208,7 @@ protected:
208 * Update internal client area size with the given parameter. 208 * Update internal client area size with the given parameter.
209 * @note EmuWindow implementations will usually use this in window resize event handlers. 209 * @note EmuWindow implementations will usually use this in window resize event handlers.
210 */ 210 */
211 void NotifyClientAreaSizeChanged(const std::pair<unsigned, unsigned>& size) { 211 void NotifyClientAreaSizeChanged(std::pair<u32, u32> size) {
212 client_area_width = size.first; 212 client_area_width = size.first;
213 client_area_height = size.second; 213 client_area_height = size.second;
214 } 214 }
@@ -221,14 +221,19 @@ private:
221 * For the request to be honored, EmuWindow implementations will usually reimplement this 221 * For the request to be honored, EmuWindow implementations will usually reimplement this
222 * function. 222 * function.
223 */ 223 */
224 virtual void OnMinimalClientAreaChangeRequest(std::pair<unsigned, unsigned>) { 224 virtual void OnMinimalClientAreaChangeRequest(std::pair<u32, u32>) {
225 // By default, ignore this request and do nothing. 225 // By default, ignore this request and do nothing.
226 } 226 }
227 227
228 /**
229 * Clip the provided coordinates to be inside the touchscreen area.
230 */
231 std::pair<u32, u32> ClipToTouchScreen(u32 new_x, u32 new_y) const;
232
228 Layout::FramebufferLayout framebuffer_layout; ///< Current framebuffer layout 233 Layout::FramebufferLayout framebuffer_layout; ///< Current framebuffer layout
229 234
230 unsigned client_area_width; ///< Current client width, should be set by window impl. 235 u32 client_area_width; ///< Current client width, should be set by window impl.
231 unsigned client_area_height; ///< Current client height, should be set by window impl. 236 u32 client_area_height; ///< Current client height, should be set by window impl.
232 237
233 WindowConfig config; ///< Internal configuration (changes pending for being applied in 238 WindowConfig config; ///< Internal configuration (changes pending for being applied in
234 /// ProcessConfigurationChanges) 239 /// ProcessConfigurationChanges)
@@ -236,11 +241,6 @@ private:
236 241
237 class TouchState; 242 class TouchState;
238 std::shared_ptr<TouchState> touch_state; 243 std::shared_ptr<TouchState> touch_state;
239
240 /**
241 * Clip the provided coordinates to be inside the touchscreen area.
242 */
243 std::tuple<unsigned, unsigned> ClipToTouchScreen(unsigned new_x, unsigned new_y) const;
244}; 244};
245 245
246} // namespace Core::Frontend 246} // namespace Core::Frontend
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 4c1c0ac68..2aa1942cb 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -19,6 +19,7 @@
19#include "core/hle/kernel/k_shared_memory.h" 19#include "core/hle/kernel/k_shared_memory.h"
20#include "core/hle/kernel/k_writable_event.h" 20#include "core/hle/kernel/k_writable_event.h"
21#include "core/hle/kernel/kernel.h" 21#include "core/hle/kernel/kernel.h"
22#include "core/hle/kernel/transfer_memory.h"
22#include "core/hle/service/hid/errors.h" 23#include "core/hle/service/hid/errors.h"
23#include "core/hle/service/hid/hid.h" 24#include "core/hle/service/hid/hid.h"
24#include "core/hle/service/hid/irs.h" 25#include "core/hle/service/hid/irs.h"
@@ -1484,7 +1485,43 @@ void Hid::StopSevenSixAxisSensor(Kernel::HLERequestContext& ctx) {
1484} 1485}
1485 1486
1486void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { 1487void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) {
1487 LOG_WARNING(Service_HID, "(STUBBED) called"); 1488 IPC::RequestParser rp{ctx};
1489 const auto applet_resource_user_id{rp.Pop<u64>()};
1490 const auto t_mem_1_size{rp.Pop<u64>()};
1491 const auto t_mem_2_size{rp.Pop<u64>()};
1492 const auto t_mem_1_handle{ctx.GetCopyHandle(0)};
1493 const auto t_mem_2_handle{ctx.GetCopyHandle(1)};
1494
1495 ASSERT_MSG(t_mem_1_size == 0x1000, "t_mem_1_size is not 0x1000 bytes");
1496 ASSERT_MSG(t_mem_2_size == 0x7F000, "t_mem_2_size is not 0x7F000 bytes");
1497
1498 auto t_mem_1 =
1499 system.CurrentProcess()->GetHandleTable().Get<Kernel::TransferMemory>(t_mem_1_handle);
1500
1501 if (t_mem_1 == nullptr) {
1502 LOG_ERROR(Service_HID, "t_mem_1 is a nullptr for handle=0x{:08X}", t_mem_1_handle);
1503 IPC::ResponseBuilder rb{ctx, 2};
1504 rb.Push(RESULT_UNKNOWN);
1505 return;
1506 }
1507
1508 auto t_mem_2 =
1509 system.CurrentProcess()->GetHandleTable().Get<Kernel::TransferMemory>(t_mem_2_handle);
1510
1511 if (t_mem_2 == nullptr) {
1512 LOG_ERROR(Service_HID, "t_mem_2 is a nullptr for handle=0x{:08X}", t_mem_2_handle);
1513 IPC::ResponseBuilder rb{ctx, 2};
1514 rb.Push(RESULT_UNKNOWN);
1515 return;
1516 }
1517
1518 ASSERT_MSG(t_mem_1->GetSize() == 0x1000, "t_mem_1 has incorrect size");
1519 ASSERT_MSG(t_mem_2->GetSize() == 0x7F000, "t_mem_2 has incorrect size");
1520
1521 LOG_WARNING(Service_HID,
1522 "(STUBBED) called, t_mem_1_handle=0x{:08X}, t_mem_2_handle=0x{:08X}, "
1523 "applet_resource_user_id={}",
1524 t_mem_1_handle, t_mem_2_handle, applet_resource_user_id);
1488 1525
1489 IPC::ResponseBuilder rb{ctx, 2}; 1526 IPC::ResponseBuilder rb{ctx, 2};
1490 rb.Push(RESULT_SUCCESS); 1527 rb.Push(RESULT_SUCCESS);
diff --git a/src/yuzu_cmd/CMakeLists.txt b/src/yuzu_cmd/CMakeLists.txt
index 8461f8896..4bf25727b 100644
--- a/src/yuzu_cmd/CMakeLists.txt
+++ b/src/yuzu_cmd/CMakeLists.txt
@@ -20,7 +20,6 @@ add_executable(yuzu-cmd
20 emu_window/emu_window_sdl2_gl.h 20 emu_window/emu_window_sdl2_gl.h
21 emu_window/emu_window_sdl2_vk.cpp 21 emu_window/emu_window_sdl2_vk.cpp
22 emu_window/emu_window_sdl2_vk.h 22 emu_window/emu_window_sdl2_vk.h
23 resource.h
24 yuzu.cpp 23 yuzu.cpp
25 yuzu.rc 24 yuzu.rc
26) 25)
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
index 3bb555a6b..d64f81106 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
@@ -238,6 +238,6 @@ void EmuWindow_SDL2::SetWindowIcon() {
238 SDL_FreeSurface(window_icon); 238 SDL_FreeSurface(window_icon);
239} 239}
240 240
241void EmuWindow_SDL2::OnMinimalClientAreaChangeRequest(std::pair<unsigned, unsigned> minimal_size) { 241void EmuWindow_SDL2::OnMinimalClientAreaChangeRequest(std::pair<u32, u32> minimal_size) {
242 SDL_SetWindowMinimumSize(render_window, minimal_size.first, minimal_size.second); 242 SDL_SetWindowMinimumSize(render_window, minimal_size.first, minimal_size.second);
243} 243}
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.h b/src/yuzu_cmd/emu_window/emu_window_sdl2.h
index 0e17bbca7..1b9ab5b93 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2.h
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.h
@@ -71,7 +71,7 @@ protected:
71 void Fullscreen(); 71 void Fullscreen();
72 72
73 /// Called when a configuration change affects the minimal size of the window 73 /// Called when a configuration change affects the minimal size of the window
74 void OnMinimalClientAreaChangeRequest(std::pair<unsigned, unsigned> minimal_size) override; 74 void OnMinimalClientAreaChangeRequest(std::pair<u32, u32> minimal_size) override;
75 75
76 /// Is the window still open? 76 /// Is the window still open?
77 bool is_open = true; 77 bool is_open = true;
diff --git a/src/yuzu_cmd/resource.h b/src/yuzu_cmd/resource.h
deleted file mode 100644
index df8e459e4..000000000
--- a/src/yuzu_cmd/resource.h
+++ /dev/null
@@ -1,16 +0,0 @@
1//{{NO_DEPENDENCIES}}
2// Microsoft Visual C++ generated include file.
3// Used by pcafe.rc
4//
5#define IDI_ICON3 103
6
7// Next default values for new objects
8//
9#ifdef APSTUDIO_INVOKED
10#ifndef APSTUDIO_READONLY_SYMBOLS
11#define _APS_NEXT_RESOURCE_VALUE 105
12#define _APS_NEXT_COMMAND_VALUE 40001
13#define _APS_NEXT_CONTROL_VALUE 1001
14#define _APS_NEXT_SYMED_VALUE 101
15#endif
16#endif