diff options
| -rw-r--r-- | src/core/hle/ipc_helpers.h | 67 | ||||
| -rw-r--r-- | src/core/hle/service/vi/vi.cpp | 4 |
2 files changed, 37 insertions, 34 deletions
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index d57776ce9..56cc911d1 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h | |||
| @@ -166,8 +166,23 @@ public: | |||
| 166 | ValidateHeader(); | 166 | ValidateHeader(); |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | void PushImpl(s8 value); | ||
| 170 | void PushImpl(s16 value); | ||
| 171 | void PushImpl(s32 value); | ||
| 172 | void PushImpl(s64 value); | ||
| 173 | void PushImpl(u8 value); | ||
| 174 | void PushImpl(u16 value); | ||
| 175 | void PushImpl(u32 value); | ||
| 176 | void PushImpl(u64 value); | ||
| 177 | void PushImpl(float value); | ||
| 178 | void PushImpl(double value); | ||
| 179 | void PushImpl(bool value); | ||
| 180 | void PushImpl(ResultCode value); | ||
| 181 | |||
| 169 | template <typename T> | 182 | template <typename T> |
| 170 | void Push(T value); | 183 | void Push(T value) { |
| 184 | return PushImpl(value); | ||
| 185 | } | ||
| 171 | 186 | ||
| 172 | template <typename First, typename... Other> | 187 | template <typename First, typename... Other> |
| 173 | void Push(const First& first_value, const Other&... other_values); | 188 | void Push(const First& first_value, const Other&... other_values); |
| @@ -215,13 +230,11 @@ private: | |||
| 215 | 230 | ||
| 216 | /// Push /// | 231 | /// Push /// |
| 217 | 232 | ||
| 218 | template <> | 233 | inline void ResponseBuilder::PushImpl(s32 value) { |
| 219 | inline void ResponseBuilder::Push(s32 value) { | ||
| 220 | cmdbuf[index++] = static_cast<u32>(value); | 234 | cmdbuf[index++] = static_cast<u32>(value); |
| 221 | } | 235 | } |
| 222 | 236 | ||
| 223 | template <> | 237 | inline void ResponseBuilder::PushImpl(u32 value) { |
| 224 | inline void ResponseBuilder::Push(u32 value) { | ||
| 225 | cmdbuf[index++] = value; | 238 | cmdbuf[index++] = value; |
| 226 | } | 239 | } |
| 227 | 240 | ||
| @@ -233,62 +246,52 @@ void ResponseBuilder::PushRaw(const T& value) { | |||
| 233 | index += (sizeof(T) + 3) / 4; // round up to word length | 246 | index += (sizeof(T) + 3) / 4; // round up to word length |
| 234 | } | 247 | } |
| 235 | 248 | ||
| 236 | template <> | 249 | inline void ResponseBuilder::PushImpl(ResultCode value) { |
| 237 | inline void ResponseBuilder::Push(ResultCode value) { | ||
| 238 | // Result codes are actually 64-bit in the IPC buffer, but only the high part is discarded. | 250 | // Result codes are actually 64-bit in the IPC buffer, but only the high part is discarded. |
| 239 | Push(value.raw); | 251 | Push(value.raw); |
| 240 | Push<u32>(0); | 252 | Push<u32>(0); |
| 241 | } | 253 | } |
| 242 | 254 | ||
| 243 | template <> | 255 | inline void ResponseBuilder::PushImpl(s8 value) { |
| 244 | inline void ResponseBuilder::Push(s8 value) { | ||
| 245 | PushRaw(value); | 256 | PushRaw(value); |
| 246 | } | 257 | } |
| 247 | 258 | ||
| 248 | template <> | 259 | inline void ResponseBuilder::PushImpl(s16 value) { |
| 249 | inline void ResponseBuilder::Push(s16 value) { | ||
| 250 | PushRaw(value); | 260 | PushRaw(value); |
| 251 | } | 261 | } |
| 252 | 262 | ||
| 253 | template <> | 263 | inline void ResponseBuilder::PushImpl(s64 value) { |
| 254 | inline void ResponseBuilder::Push(s64 value) { | 264 | PushImpl(static_cast<u32>(value)); |
| 255 | Push(static_cast<u32>(value)); | 265 | PushImpl(static_cast<u32>(value >> 32)); |
| 256 | Push(static_cast<u32>(value >> 32)); | ||
| 257 | } | 266 | } |
| 258 | 267 | ||
| 259 | template <> | 268 | inline void ResponseBuilder::PushImpl(u8 value) { |
| 260 | inline void ResponseBuilder::Push(u8 value) { | ||
| 261 | PushRaw(value); | 269 | PushRaw(value); |
| 262 | } | 270 | } |
| 263 | 271 | ||
| 264 | template <> | 272 | inline void ResponseBuilder::PushImpl(u16 value) { |
| 265 | inline void ResponseBuilder::Push(u16 value) { | ||
| 266 | PushRaw(value); | 273 | PushRaw(value); |
| 267 | } | 274 | } |
| 268 | 275 | ||
| 269 | template <> | 276 | inline void ResponseBuilder::PushImpl(u64 value) { |
| 270 | inline void ResponseBuilder::Push(u64 value) { | 277 | PushImpl(static_cast<u32>(value)); |
| 271 | Push(static_cast<u32>(value)); | 278 | PushImpl(static_cast<u32>(value >> 32)); |
| 272 | Push(static_cast<u32>(value >> 32)); | ||
| 273 | } | 279 | } |
| 274 | 280 | ||
| 275 | template <> | 281 | inline void ResponseBuilder::PushImpl(float value) { |
| 276 | inline void ResponseBuilder::Push(float value) { | ||
| 277 | u32 integral; | 282 | u32 integral; |
| 278 | std::memcpy(&integral, &value, sizeof(u32)); | 283 | std::memcpy(&integral, &value, sizeof(u32)); |
| 279 | Push(integral); | 284 | PushImpl(integral); |
| 280 | } | 285 | } |
| 281 | 286 | ||
| 282 | template <> | 287 | inline void ResponseBuilder::PushImpl(double value) { |
| 283 | inline void ResponseBuilder::Push(double value) { | ||
| 284 | u64 integral; | 288 | u64 integral; |
| 285 | std::memcpy(&integral, &value, sizeof(u64)); | 289 | std::memcpy(&integral, &value, sizeof(u64)); |
| 286 | Push(integral); | 290 | PushImpl(integral); |
| 287 | } | 291 | } |
| 288 | 292 | ||
| 289 | template <> | 293 | inline void ResponseBuilder::PushImpl(bool value) { |
| 290 | inline void ResponseBuilder::Push(bool value) { | 294 | PushImpl(static_cast<u8>(value)); |
| 291 | Push(static_cast<u8>(value)); | ||
| 292 | } | 295 | } |
| 293 | 296 | ||
| 294 | template <typename First, typename... Other> | 297 | template <typename First, typename... Other> |
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index af5b8b0b9..422e9e02f 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -1230,8 +1230,8 @@ private: | |||
| 1230 | const auto height = rp.Pop<u64>(); | 1230 | const auto height = rp.Pop<u64>(); |
| 1231 | LOG_DEBUG(Service_VI, "called width={}, height={}", width, height); | 1231 | LOG_DEBUG(Service_VI, "called width={}, height={}", width, height); |
| 1232 | 1232 | ||
| 1233 | constexpr std::size_t base_size = 0x20000; | 1233 | constexpr u64 base_size = 0x20000; |
| 1234 | constexpr std::size_t alignment = 0x1000; | 1234 | constexpr u64 alignment = 0x1000; |
| 1235 | const auto texture_size = width * height * 4; | 1235 | const auto texture_size = width * height * 4; |
| 1236 | const auto out_size = (texture_size + base_size - 1) / base_size * base_size; | 1236 | const auto out_size = (texture_size + base_size - 1) / base_size * base_size; |
| 1237 | 1237 | ||